@mappedin/mappedin-js 6.0.1-beta.47 → 6.0.1-beta.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.txt +12048 -1731
- package/lib/esm/GLTFExporter-ESCDGZUC.js +2 -0
- package/lib/esm/GLTFExporter-ESCDGZUC.js.map +7 -0
- package/lib/esm/{GLTFLoader-YCEKYYW3.js → GLTFLoader-KRE6VVI2.js} +2 -1
- package/lib/esm/GLTFLoader-KRE6VVI2.js.map +7 -0
- package/lib/esm/{browser-6R2QCUOI.js → browser-BKM6BTVQ.js} +2 -1
- package/lib/esm/browser-BKM6BTVQ.js.map +7 -0
- package/lib/esm/{chunk-KR33DBLD.js → chunk-34JGYGBQ.js} +2 -1
- package/lib/esm/chunk-34JGYGBQ.js.map +7 -0
- package/lib/esm/chunk-5N73RBNE.js +2 -0
- package/lib/esm/chunk-5N73RBNE.js.map +7 -0
- package/lib/esm/chunk-AHC6OWNT.js +2 -0
- package/lib/esm/chunk-AHC6OWNT.js.map +7 -0
- package/lib/esm/chunk-BBNTGIFB.js +578 -0
- package/lib/esm/chunk-BBNTGIFB.js.map +7 -0
- package/lib/esm/chunk-EBEZBJTY.js +2 -0
- package/lib/esm/chunk-EBEZBJTY.js.map +7 -0
- package/lib/esm/chunk-QSDIHKLQ.js +3820 -0
- package/lib/esm/chunk-QSDIHKLQ.js.map +7 -0
- package/lib/esm/chunk-TQZZUEDW.js +2229 -0
- package/lib/esm/chunk-TQZZUEDW.js.map +7 -0
- package/lib/esm/fonts/roboto-regular.ttf +0 -0
- package/lib/esm/index.css +2 -1
- package/lib/esm/index.css.map +7 -0
- package/lib/esm/index.d.ts +235 -166
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/inspector-S63NMDZZ.css +2 -0
- package/lib/esm/inspector-S63NMDZZ.css.map +7 -0
- package/lib/esm/inspector-UVCVD35T.js +483 -0
- package/lib/esm/inspector-UVCVD35T.js.map +7 -0
- package/lib/esm/internal-WH523TQS.css +2 -0
- package/lib/esm/internal-WH523TQS.css.map +7 -0
- package/lib/esm/internal-ZOHXUIA6.js +2 -0
- package/lib/esm/internal-ZOHXUIA6.js.map +7 -0
- package/lib/esm/outdoor-context-v4-B6ZFZFG7.js +2 -0
- package/lib/esm/outdoor-context-v4-B6ZFZFG7.js.map +7 -0
- package/lib/esm/{roboto-regular-JRVF4TIR.js → roboto-regular-25PMWR2T.js} +2 -1
- package/lib/esm/roboto-regular-25PMWR2T.js.map +7 -0
- package/lib/esm/text3d-ACVNKUMC.js +253 -0
- package/lib/esm/text3d-ACVNKUMC.js.map +7 -0
- package/lib/esm/workers/collision-worker.csp.js +1 -1
- package/lib/esm/workers/maplibre-worker.csp.js +2 -1
- package/lib/index-rn.js +649 -0
- package/lib/index.css +2 -1
- package/package.json +2 -2
- package/lib/esm/GLTFExporter-TZEIALSW.js +0 -1
- package/lib/esm/chunk-DNBHISVY.js +0 -1
- package/lib/esm/chunk-KVKD4E33.js +0 -1
- package/lib/esm/chunk-MENDLOSO.js +0 -1
- package/lib/esm/chunk-QRWMPXER.js +0 -1
- package/lib/esm/chunk-TVALVOG4.js +0 -1
- package/lib/esm/chunk-UIDBSU4C.js +0 -1
- package/lib/esm/inspector-CV34C4XG.js +0 -1
- package/lib/esm/inspector-WWR77OPX.css +0 -1
- package/lib/esm/internal-M7DPGYMI.css +0 -1
- package/lib/esm/internal-YXEVD377.js +0 -1
- package/lib/esm/outdoor-context-v4-IEFB4X2Q.js +0 -1
- package/lib/esm/text3d-RZEC5VQO.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-MENDLOSO.js";import{a as Bt,b as Gr,f as bt,g as vi,h as oe}from"./chunk-QRWMPXER.js";var ye=bt((NM,Qh)=>{"use strict";m();Qh.exports=wi;function wi(r,e){this.x=r,this.y=e}wi.prototype={clone:function(){return new wi(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,e){return this.clone()._rotateAround(r,e)},matMult:function(r){return this.clone()._matMult(r)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var e=r.x-this.x,t=r.y-this.y;return e*e+t*t},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult:function(r){var e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var e=Math.cos(r),t=Math.sin(r),i=e*this.x-t*this.y,n=t*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround:function(r,e){var t=Math.cos(r),i=Math.sin(r),n=e.x+t*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+t*(this.y-e.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};wi.convert=function(r){return r instanceof wi?r:Array.isArray(r)?new wi(r[0],r[1]):r}});var rf=bt((qM,tf)=>{"use strict";m();tf.exports=ef;function ef(r,e,t,i){this.cx=3*r,this.bx=3*(t-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=e,this.p2x=t,this.p2y=i}ef.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var t=r,i=0;i<8;i++){var n=this.sampleCurveX(t)-r;if(Math.abs(n)<e)return t;var o=this.sampleCurveDerivativeX(t);if(Math.abs(o)<1e-6)break;t=t-n/o}var a=0,s=1;for(t=r,i=0;i<20&&(n=this.sampleCurveX(t),!(Math.abs(n-r)<e));i++)r>n?a=t:s=t,t=(s-a)*.5+a;return t},solve:function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))}}});var $m=bt((aE,xp)=>{m();function P1(r,e){var t,i,n,o,a,s,l,u,c,p;for(t=r.length&3,i=r.length-t,n=e,a=3432918353,l=461845907,p=0;p<i;)c=r.charCodeAt(p)&255|(r.charCodeAt(++p)&255)<<8|(r.charCodeAt(++p)&255)<<16|(r.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,n^=c,n=n<<13|n>>>19,o=(n&65535)*5+(((n>>>16)*5&65535)<<16)&4294967295,n=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,t){case 3:c^=(r.charCodeAt(p+2)&255)<<16;case 2:c^=(r.charCodeAt(p+1)&255)<<8;case 1:c^=r.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,n^=c}return n^=r.length,n^=n>>>16,n=(n&65535)*2246822507+(((n>>>16)*2246822507&65535)<<16)&4294967295,n^=n>>>13,n=(n&65535)*3266489909+(((n>>>16)*3266489909&65535)<<16)&4294967295,n^=n>>>16,n>>>0}typeof xp<"u"&&(xp.exports=P1)});var Wm=bt((lE,bp)=>{m();function T1(r,e){for(var t=r.length,i=e^t,n=0,o;t>=4;)o=r.charCodeAt(n)&255|(r.charCodeAt(++n)&255)<<8|(r.charCodeAt(++n)&255)<<16|(r.charCodeAt(++n)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16)^o,t-=4,++n;switch(t){case 3:i^=(r.charCodeAt(n+2)&255)<<16;case 2:i^=(r.charCodeAt(n+1)&255)<<8;case 1:i^=r.charCodeAt(n)&255,i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16)}return i^=i>>>13,i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16),i^=i>>>15,i>>>0}typeof bp!==void 0&&(bp.exports=T1)});var _p=bt((cE,Ns)=>{m();var Xm=$m(),A1=Wm();Ns.exports=Xm;Ns.exports.murmur3=Xm;Ns.exports.murmur2=A1});var Lp=bt((IL,kp)=>{"use strict";m();kp.exports=el;kp.exports.default=el;function el(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,o=ey(r,0,n,t,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,h,f;if(i&&(o=RP(r,e,o,t)),r.length>80*t){s=u=r[0],l=c=r[1];for(var d=t;d<n;d+=t)p=r[d],h=r[d+1],p<s&&(s=p),h<l&&(l=h),p>u&&(u=p),h>c&&(c=h);f=Math.max(u-s,c-l),f=f!==0?32767/f:0}return To(o,a,t,s,l,f,0),a}function ey(r,e,t,i,n){var o,a;if(n===Ep(r,e,t,i)>0)for(o=e;o<t;o+=i)a=Qd(o,r[o],r[o+1],a);else for(o=t-i;o>=e;o-=i)a=Qd(o,r[o],r[o+1],a);return a&&tl(a,a.next)&&(Mo(a),a=a.next),a}function ci(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(tl(t,t.next)||Be(t.prev,t,t.next)===0)){if(Mo(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function To(r,e,t,i,n,o,a){if(r){!a&&o&&NP(r,i,n,o);for(var s=r,l,u;r.prev!==r.next;){if(l=r.prev,u=r.next,o?DP(r,i,n,o):LP(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),Mo(r),r=u.next,s=u.next;continue}if(r=u,r===s){a?a===1?(r=zP(ci(r),e,t),To(r,e,t,i,n,o,2)):a===2&&FP(r,e,t,i,n,o):To(ci(r),e,t,i,n,o,1);break}}}}function LP(r){var e=r.prev,t=r,i=r.next;if(Be(e,t,i)>=0)return!1;for(var n=e.x,o=t.x,a=i.x,s=e.y,l=t.y,u=i.y,c=n<o?n<a?n:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,h=n>o?n>a?n:a:o>a?o:a,f=s>l?s>u?s:u:l>u?l:u,d=i.next;d!==e;){if(d.x>=c&&d.x<=h&&d.y>=p&&d.y<=f&&Xi(n,s,o,l,a,u,d.x,d.y)&&Be(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function DP(r,e,t,i){var n=r.prev,o=r,a=r.next;if(Be(n,o,a)>=0)return!1;for(var s=n.x,l=o.x,u=a.x,c=n.y,p=o.y,h=a.y,f=s<l?s<u?s:u:l<u?l:u,d=c<p?c<h?c:h:p<h?p:h,y=s>l?s>u?s:u:l>u?l:u,g=c>p?c>h?c:h:p>h?p:h,x=Ip(f,d,e,t,i),v=Ip(y,g,e,t,i),b=r.prevZ,w=r.nextZ;b&&b.z>=x&&w&&w.z<=v;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=g&&b!==n&&b!==a&&Xi(s,c,l,p,u,h,b.x,b.y)&&Be(b.prev,b,b.next)>=0||(b=b.prevZ,w.x>=f&&w.x<=y&&w.y>=d&&w.y<=g&&w!==n&&w!==a&&Xi(s,c,l,p,u,h,w.x,w.y)&&Be(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;b&&b.z>=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=g&&b!==n&&b!==a&&Xi(s,c,l,p,u,h,b.x,b.y)&&Be(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=v;){if(w.x>=f&&w.x<=y&&w.y>=d&&w.y<=g&&w!==n&&w!==a&&Xi(s,c,l,p,u,h,w.x,w.y)&&Be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function zP(r,e,t){var i=r;do{var n=i.prev,o=i.next.next;!tl(n,o)&&ty(n,i,i.next,o)&&Ao(n,o)&&Ao(o,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Mo(i),Mo(i.next),i=r=o),i=i.next}while(i!==r);return ci(i)}function FP(r,e,t,i,n,o){var a=r;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&jP(a,s)){var l=ry(a,s);a=ci(a,a.next),l=ci(l,l.next),To(a,e,t,i,n,o,0),To(l,e,t,i,n,o,0);return}s=s.next}a=a.next}while(a!==r)}function RP(r,e,t,i){var n=[],o,a,s,l,u;for(o=0,a=e.length;o<a;o++)s=e[o]*i,l=o<a-1?e[o+1]*i:r.length,u=ey(r,s,l,i,!1),u===u.next&&(u.steiner=!0),n.push(qP(u));for(n.sort(BP),o=0;o<n.length;o++)t=OP(n[o],t);return t}function BP(r,e){return r.x-e.x}function OP(r,e){var t=VP(r,e);if(!t)return e;var i=ry(t,r);return ci(i,i.next),ci(t,t.next)}function VP(r,e){var t=e,i=r.x,n=r.y,o=-1/0,a;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var s=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(s<=i&&s>o&&(o=s,a=t.x<t.next.x?t:t.next,s===i))return a}t=t.next}while(t!==e);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,h;t=a;do i>=t.x&&t.x>=u&&i!==t.x&&Xi(n<c?i:o,n,u,c,n<c?o:i,n,t.x,t.y)&&(h=Math.abs(n-t.y)/(i-t.x),Ao(t,r)&&(h<p||h===p&&(t.x>a.x||t.x===a.x&&UP(a,t)))&&(a=t,p=h)),t=t.next;while(t!==l);return a}function UP(r,e){return Be(r.prev,r,e.prev)<0&&Be(e.next,r,r.next)<0}function NP(r,e,t,i){var n=r;do n.z===0&&(n.z=Ip(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,GP(n)}function GP(r){var e,t,i,n,o,a,s,l,u=1;do{for(t=r,r=null,o=null,a=0;t;){for(a++,i=t,s=0,e=0;e<u&&(s++,i=i.nextZ,!!i);e++);for(l=u;s>0||l>0&&i;)s!==0&&(l===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,s--):(n=i,i=i.nextZ,l--),o?o.nextZ=n:r=n,n.prevZ=o,o=n;t=i}o.nextZ=null,u*=2}while(a>1);return r}function Ip(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function qP(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Xi(r,e,t,i,n,o,a,s){return(n-a)*(e-s)>=(r-a)*(o-s)&&(r-a)*(i-s)>=(t-a)*(e-s)&&(t-a)*(o-s)>=(n-a)*(i-s)}function jP(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!ZP(r,e)&&(Ao(r,e)&&Ao(e,r)&&HP(r,e)&&(Be(r.prev,r,e.prev)||Be(r,e.prev,e))||tl(r,e)&&Be(r.prev,r,r.next)>0&&Be(e.prev,e,e.next)>0)}function Be(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function tl(r,e){return r.x===e.x&&r.y===e.y}function ty(r,e,t,i){var n=Qs(Be(r,e,t)),o=Qs(Be(r,e,i)),a=Qs(Be(t,i,r)),s=Qs(Be(t,i,e));return!!(n!==o&&a!==s||n===0&&Ys(r,t,e)||o===0&&Ys(r,i,e)||a===0&&Ys(t,r,i)||s===0&&Ys(t,e,i))}function Ys(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Qs(r){return r>0?1:r<0?-1:0}function ZP(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&ty(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ao(r,e){return Be(r.prev,r,r.next)<0?Be(r,e,r.next)>=0&&Be(r,r.prev,e)>=0:Be(r,e,r.prev)<0||Be(r,r.next,e)<0}function HP(r,e){var t=r,i=!1,n=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&n<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function ry(r,e){var t=new Cp(r.i,r.x,r.y),i=new Cp(e.i,e.x,e.y),n=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function Qd(r,e,t,i){var n=new Cp(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Mo(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Cp(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}el.deviation=function(r,e,t,i){var n=e&&e.length,o=n?e[0]*t:r.length,a=Math.abs(Ep(r,0,o,t));if(n)for(var s=0,l=e.length;s<l;s++){var u=e[s]*t,c=s<l-1?e[s+1]*t:r.length;a-=Math.abs(Ep(r,u,c,t))}var p=0;for(s=0;s<i.length;s+=3){var h=i[s]*t,f=i[s+1]*t,d=i[s+2]*t;p+=Math.abs((r[h]-r[d])*(r[f+1]-r[h+1])-(r[h]-r[f])*(r[d+1]-r[h+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function Ep(r,e,t,i){for(var n=0,o=e,a=t-i;o<t;o+=i)n+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return n}el.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var o=0;o<r[n].length;o++)for(var a=0;a<e;a++)t.vertices.push(r[n][o][a]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t}});var zp=bt((bD,cy)=>{"use strict";m();var QP=ye();cy.exports=Yi;function Yi(r,e,t,i,n){this.properties={},this.extent=t,this.type=0,this._pbf=r,this._geometry=-1,this._keys=i,this._values=n,r.readFields(eT,this,e)}function eT(r,e,t){r==1?e.id=t.readVarint():r==2?tT(t,e):r==3?e.type=t.readVarint():r==4&&(e._geometry=t.pos)}function tT(r,e){for(var t=r.readVarint()+r.pos;r.pos<t;){var i=e._keys[r.readVarint()],n=e._values[r.readVarint()];e.properties[i]=n}}Yi.types=["Unknown","Point","LineString","Polygon"];Yi.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,i=0,n=0,o=0,a=[],s;r.pos<e;){if(i<=0){var l=r.readVarint();t=l&7,i=l>>3}if(i--,t===1||t===2)n+=r.readSVarint(),o+=r.readSVarint(),t===1&&(s&&a.push(s),s=[]),s.push(new QP(n,o));else if(t===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+t)}return s&&a.push(s),a};Yi.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;r.pos<e;){if(i<=0){var c=r.readVarint();t=c&7,i=c>>3}if(i--,t===1||t===2)n+=r.readSVarint(),o+=r.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>u&&(u=o);else if(t!==7)throw new Error("unknown command "+t)}return[a,l,s,u]};Yi.prototype.toGeoJSON=function(r,e,t){var i=this.extent*Math.pow(2,t),n=this.extent*r,o=this.extent*e,a=this.loadGeometry(),s=Yi.types[this.type],l,u;function c(f){for(var d=0;d<f.length;d++){var y=f[d],g=180-(y.y+o)*360/i;f[d]=[(y.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=rT(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var h={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(h.id=this.id),h};function rT(r){var e=r.length;if(e<=1)return[r];for(var t=[],i,n,o=0;o<e;o++){var a=iT(r[o]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&t.push(i),i=[r[o]]):i.push(r[o]))}return i&&t.push(i),t}function iT(r){for(var e=0,t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}});var Fp=bt((vD,hy)=>{"use strict";m();var nT=zp();hy.exports=py;function py(r,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(oT,this,e),this.length=this._features.length}function oT(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(aT(t))}function aT(r){for(var e=null,t=r.readVarint()+r.pos;r.pos<t;){var i=r.readVarint()>>3;e=i===1?r.readString():i===2?r.readFloat():i===3?r.readDouble():i===4?r.readVarint64():i===5?r.readVarint():i===6?r.readSVarint():i===7?r.readBoolean():null}return e}py.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new nT(this._pbf,e,this.extent,this._keys,this._values)}});var my=bt((SD,fy)=>{"use strict";m();var sT=Fp();fy.exports=lT;function lT(r,e){this.layers=r.readFields(uT,{},e)}function uT(r,e,t){if(r===3){var i=new sT(t,t.readVarint()+t.pos);i.length&&(e[i.name]=i)}}});var ko=bt((TD,il)=>{m();il.exports.VectorTile=my();il.exports.VectorTileFeature=zp();il.exports.VectorTileLayer=Fp()});var Ry=bt(Up=>{m();Up.read=function(r,e,t,i,n){var o,a,s=n*8-i-1,l=(1<<s)-1,u=l>>1,c=-7,p=t?n-1:0,h=t?-1:1,f=r[e+p];for(p+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=o*256+r[e+p],p+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=a*256+r[e+p],p+=h,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-u}return(f?-1:1)*a*Math.pow(2,o-i)};Up.write=function(r,e,t,i,n,o){var a,s,l,u=o*8-n-1,c=(1<<u)-1,p=c>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,d=i?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=h/l:e+=h*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,n),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;r[t+f]=s&255,f+=d,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;r[t+f]=a&255,f+=d,a/=256,u-=8);r[t+f-d]|=y*128}});var Gp=bt((wF,Ny)=>{"use strict";m();Ny.exports=Pe;var ll=Ry();function Pe(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}Pe.Varint=0;Pe.Fixed64=1;Pe.Bytes=2;Pe.Fixed32=5;var Np=65536*65536,By=1/Np,IT=12,Uy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Pe.prototype={destroy:function(){this.buf=null},readFields:function(r,e,t){for(t=t||this.length;this.pos<t;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=i&7,r(n,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},readFixed32:function(){var r=ul(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=Vy(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=ul(this.buf,this.pos)+ul(this.buf,this.pos+4)*Np;return this.pos+=8,r},readSFixed64:function(){var r=ul(this.buf,this.pos)+Vy(this.buf,this.pos+4)*Np;return this.pos+=8,r},readFloat:function(){var r=ll.read(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=ll.read(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var e=this.buf,t,i;return i=e[this.pos++],t=i&127,i<128||(i=e[this.pos++],t|=(i&127)<<7,i<128)||(i=e[this.pos++],t|=(i&127)<<14,i<128)||(i=e[this.pos++],t|=(i&127)<<21,i<128)?t:(i=e[this.pos],t|=(i&15)<<28,CT(t,r,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var r=this.readVarint();return r%2===1?(r+1)/-2:r/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=IT&&Uy?qT(this.buf,e,r):GT(this.buf,e,r)},readBytes:function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},readPackedVarint:function(r,e){if(this.type!==Pe.Bytes)return r.push(this.readVarint(e));var t=sr(this);for(r=r||[];this.pos<t;)r.push(this.readVarint(e));return r},readPackedSVarint:function(r){if(this.type!==Pe.Bytes)return r.push(this.readSVarint());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readSVarint());return r},readPackedBoolean:function(r){if(this.type!==Pe.Bytes)return r.push(this.readBoolean());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readBoolean());return r},readPackedFloat:function(r){if(this.type!==Pe.Bytes)return r.push(this.readFloat());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readFloat());return r},readPackedDouble:function(r){if(this.type!==Pe.Bytes)return r.push(this.readDouble());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readDouble());return r},readPackedFixed32:function(r){if(this.type!==Pe.Bytes)return r.push(this.readFixed32());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readFixed32());return r},readPackedSFixed32:function(r){if(this.type!==Pe.Bytes)return r.push(this.readSFixed32());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed32());return r},readPackedFixed64:function(r){if(this.type!==Pe.Bytes)return r.push(this.readFixed64());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readFixed64());return r},readPackedSFixed64:function(r){if(this.type!==Pe.Bytes)return r.push(this.readSFixed64());var e=sr(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed64());return r},skip:function(r){var e=r&7;if(e===Pe.Varint)for(;this.buf[this.pos++]>127;);else if(e===Pe.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Pe.Fixed32)this.pos+=4;else if(e===Pe.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(r,e){this.writeVarint(r<<3|e)},realloc:function(r){for(var e=this.length||16;e<this.pos+r;)e*=2;if(e!==this.length){var t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(r){this.realloc(4),en(this.buf,r,this.pos),this.pos+=4},writeSFixed32:function(r){this.realloc(4),en(this.buf,r,this.pos),this.pos+=4},writeFixed64:function(r){this.realloc(8),en(this.buf,r&-1,this.pos),en(this.buf,Math.floor(r*By),this.pos+4),this.pos+=8},writeSFixed64:function(r){this.realloc(8),en(this.buf,r&-1,this.pos),en(this.buf,Math.floor(r*By),this.pos+4),this.pos+=8},writeVarint:function(r){if(r=+r||0,r>268435455||r<0){ET(r,this);return}this.realloc(4),this.buf[this.pos++]=r&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=r>>>7&127)))},writeSVarint:function(r){this.writeVarint(r<0?-r*2-1:r*2)},writeBoolean:function(r){this.writeVarint(!!r)},writeString:function(r){r=String(r),this.realloc(r.length*4),this.pos++;var e=this.pos;this.pos=jT(this.buf,r,this.pos);var t=this.pos-e;t>=128&&Oy(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t},writeFloat:function(r){this.realloc(4),ll.write(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),ll.write(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var t=0;t<e;t++)this.buf[this.pos++]=r[t]},writeRawMessage:function(r,e){this.pos++;var t=this.pos;r(e,this);var i=this.pos-t;i>=128&&Oy(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeMessage:function(r,e,t){this.writeTag(r,Pe.Bytes),this.writeRawMessage(e,t)},writePackedVarint:function(r,e){e.length&&this.writeMessage(r,DT,e)},writePackedSVarint:function(r,e){e.length&&this.writeMessage(r,zT,e)},writePackedBoolean:function(r,e){e.length&&this.writeMessage(r,BT,e)},writePackedFloat:function(r,e){e.length&&this.writeMessage(r,FT,e)},writePackedDouble:function(r,e){e.length&&this.writeMessage(r,RT,e)},writePackedFixed32:function(r,e){e.length&&this.writeMessage(r,OT,e)},writePackedSFixed32:function(r,e){e.length&&this.writeMessage(r,VT,e)},writePackedFixed64:function(r,e){e.length&&this.writeMessage(r,UT,e)},writePackedSFixed64:function(r,e){e.length&&this.writeMessage(r,NT,e)},writeBytesField:function(r,e){this.writeTag(r,Pe.Bytes),this.writeBytes(e)},writeFixed32Field:function(r,e){this.writeTag(r,Pe.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(r,e){this.writeTag(r,Pe.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(r,e){this.writeTag(r,Pe.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(r,e){this.writeTag(r,Pe.Fixed64),this.writeSFixed64(e)},writeVarintField:function(r,e){this.writeTag(r,Pe.Varint),this.writeVarint(e)},writeSVarintField:function(r,e){this.writeTag(r,Pe.Varint),this.writeSVarint(e)},writeStringField:function(r,e){this.writeTag(r,Pe.Bytes),this.writeString(e)},writeFloatField:function(r,e){this.writeTag(r,Pe.Fixed32),this.writeFloat(e)},writeDoubleField:function(r,e){this.writeTag(r,Pe.Fixed64),this.writeDouble(e)},writeBooleanField:function(r,e){this.writeVarintField(r,!!e)}};function CT(r,e,t){var i=t.buf,n,o;if(o=i[t.pos++],n=(o&112)>>4,o<128||(o=i[t.pos++],n|=(o&127)<<3,o<128)||(o=i[t.pos++],n|=(o&127)<<10,o<128)||(o=i[t.pos++],n|=(o&127)<<17,o<128)||(o=i[t.pos++],n|=(o&127)<<24,o<128)||(o=i[t.pos++],n|=(o&1)<<31,o<128))return Qi(r,n,e);throw new Error("Expected varint not more than 10 bytes")}function sr(r){return r.type===Pe.Bytes?r.readVarint()+r.pos:r.pos+1}function Qi(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}function ET(r,e){var t,i;if(r>=0?(t=r%4294967296|0,i=r/4294967296|0):(t=~(-r%4294967296),i=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),kT(t,i,e),LT(i,e)}function kT(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}function LT(r,e){var t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}function Oy(r,e,t){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(var n=t.pos-1;n>=r;n--)t.buf[n+i]=t.buf[n]}function DT(r,e){for(var t=0;t<r.length;t++)e.writeVarint(r[t])}function zT(r,e){for(var t=0;t<r.length;t++)e.writeSVarint(r[t])}function FT(r,e){for(var t=0;t<r.length;t++)e.writeFloat(r[t])}function RT(r,e){for(var t=0;t<r.length;t++)e.writeDouble(r[t])}function BT(r,e){for(var t=0;t<r.length;t++)e.writeBoolean(r[t])}function OT(r,e){for(var t=0;t<r.length;t++)e.writeFixed32(r[t])}function VT(r,e){for(var t=0;t<r.length;t++)e.writeSFixed32(r[t])}function UT(r,e){for(var t=0;t<r.length;t++)e.writeFixed64(r[t])}function NT(r,e){for(var t=0;t<r.length;t++)e.writeSFixed64(r[t])}function ul(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+r[e+3]*16777216}function en(r,e,t){r[t]=e,r[t+1]=e>>>8,r[t+2]=e>>>16,r[t+3]=e>>>24}function Vy(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}function GT(r,e,t){for(var i="",n=e;n<t;){var o=r[n],a=null,s=o>239?4:o>223?3:o>191?2:1;if(n+s>t)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=r[n+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=r[n+1],u=r[n+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=r[n+1],u=r[n+2],c=r[n+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,i+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),i+=String.fromCharCode(a),n+=s}return i}function qT(r,e,t){return Uy.decode(r.subarray(e,t))}function jT(r,e,t){for(var i=0,n,o;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(o)if(n<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=n;continue}else n=o-55296<<10|n-56320|65536,o=null;else{n>56319||i+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=n;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);n<128?r[t++]=n:(n<2048?r[t++]=n>>6|192:(n<65536?r[t++]=n>>12|224:(r[t++]=n>>18|240,r[t++]=n>>12&63|128),r[t++]=n>>6&63|128),r[t++]=n&63|128)}return t}});var zg=bt((nh,oh)=>{m();(function(r,e){typeof nh=="object"&&typeof oh<"u"?oh.exports=e():typeof define=="function"&&define.amd?define(e):(r=r||self,r.TinyQueue=e())})(nh,function(){"use strict";var r=function(i,n){if(i===void 0&&(i=[]),n===void 0&&(n=e),this.data=i,this.length=this.data.length,this.compare=n,this.length>0)for(var o=(this.length>>1)-1;o>=0;o--)this._down(o)};r.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var i=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),i}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(i){for(var n=this,o=n.data,a=n.compare,s=o[i];i>0;){var l=i-1>>1,u=o[l];if(a(s,u)>=0)break;o[i]=u,i=l}o[i]=s},r.prototype._down=function(i){for(var n=this,o=n.data,a=n.compare,s=this.length>>1,l=o[i];i<s;){var u=(i<<1)+1,c=o[u],p=u+1;if(p<this.length&&a(o[p],c)<0&&(u=p,c=o[p]),a(c,l)>=0)break;o[i]=c,i=u}o[i]=l};function e(t,i){return t<i?-1:t>i?1:0}return r})});m();var Ba={name:"@packages/outdoor-context-v4",version:"6.0.1-beta.47",private:!0,main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",homepage:"https://maplibre.org/",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",bugs:{url:"https://github.com/maplibre/maplibre-gl-js/issues/"},repository:{type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},types:"dist/maplibre-gl.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^20.1.1","@types/geojson":"^7946.0.14","@types/geojson-vt":"3.2.5","@types/junit-report-builder":"^3.0.2","@types/mapbox__point-geometry":"^0.1.4","@types/mapbox__vector-tile":"^1.3.4","@types/pbf":"^3.0.5","@types/supercluster":"^7.1.3",earcut:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.5","@rollup/plugin-strip":"^3.0.4","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/benchmark":"^2.1.5","@types/cssnano":"^5.0.0","@types/d3":"^7.4.3","@types/diff":"^5.2.0","@types/earcut":"^2.1.4","@types/eslint":"^8.56.7","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.4","@types/node":"^20.12.7","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.4","@types/react":"^18.2.79","@types/react-dom":"^18.2.25","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^7.7.1","@typescript-eslint/parser":"^7.7.1",address:"^2.0.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.1.2",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1291694",diff:"^5.2.0","dts-bundle-generator":"^9.5.1",eslint:"^8.57.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^8.1.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.2.0","eslint-plugin-react":"^7.34.1","eslint-plugin-tsdoc":"0.2.17",expect:"^29.7.0",glob:"^10.3.12","is-builtin-module":"^3.2.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-junit":"^16.0.0","jest-monocart-coverage":"^1.1.0","jest-webgl-canvas-mock":"^2.5.3",jsdom:"^24.0.0","json-stringify-pretty-compact":"^4.0.0","junit-report-builder":"^3.2.1",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.7.9",nise:"^5.1.9","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^5.1.1",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.38","postcss-cli":"^11.0.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^22.7.0",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^4.16.4","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.6.0","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^16.4.0","stylelint-config-standard":"^36.0.0","ts-jest":"^29.1.2","ts-node":"^10.9.2",tslib:"^2.6.2",typedoc:"^0.25.13","typedoc-plugin-markdown":"^3.17.1","typedoc-plugin-missing-exports":"^2.2.0",typescript:"^5.4.5"},overrides:{"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},scripts:{build:"tsc -b","generate-dist-package":"node --no-warnings --loader ts-node/esm build/generate-dist-package.js","generate-shaders":"node --no-warnings --loader ts-node/esm build/generate-shaders.ts","generate-struct-arrays":"node --no-warnings --loader ts-node/esm build/generate-struct-arrays.ts","generate-style-code":"node --no-warnings --loader ts-node/esm build/generate-style-code.ts","generate-typings":"dts-bundle-generator --export-referenced-types --umd-module-name=maplibregl -o ./dist/maplibre-gl.d.ts ./src/index.ts","generate-docs":"typedoc && node --no-warnings --loader ts-node/esm build/generate-docs.ts","generate-images":"node --no-warnings --loader ts-node/esm build/generate-doc-images.ts","build-dist":"npm run build-css && npm run generate-typings && npm run build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --port 9966 .","start-docs":"docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","test-build":"jest --selectProjects=build --reporters=default","test-build-ci":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration --reporters=default","test-integration-ci":"jest --selectProjects=integration","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit --reporters=default","test-unit-ci":"jest --coverage --selectProjects unit","test-watch-roots":"jest --watch",codegen:"run-p --print-label generate-dist-package generate-style-code generate-struct-arrays generate-shaders && npm run generate-typings",benchmark:"node --no-warnings --loader ts-node/esm test/bench/run-benchmarks.ts","gl-stats":"node --no-warnings --loader ts-node/esm test/bench/gl-stats.ts","prepare:backup":"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0"}};m();m();var af=oe(ye(),1),sf=oe(rf(),1);m();m();var Pc;function Oa(){return Pc==null&&(Pc=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Pc}var Va;function Tc(){if(Va==null&&(Va=!1,Oa())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let n=0;n<5*5;n++){let o=n*4;t.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(o+2,")"),t.fillRect(n%5,Math.floor(n/5),1,1)}let i=t.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!==3&&i[n]!==n){Va=!0;break}}}return Va||!1}function lf(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)}function _n(r,e,t,i){let n=new sf.default(r,e,t,i);return function(o){return n.solve(o)}}var vn=_n(.25,.1,.25,1);function Ae(r,e,t){return Math.min(t,Math.max(e,r))}function Yt(r,e,t){let i=t-e,n=((r-e)%i+i)%i+e;return n===e?t:n}function uf(r,e){let t=[];for(let i in r)i in e||t.push(i);return t}function O(r,...e){for(let t of e)for(let i in t)r[i]=t[i];return r}function mr(r,e){let t={};for(let i=0;i<e.length;i++){let n=e[i];n in r&&(t[n]=r[n])}return t}var F_=1;function Ua(){return F_++}function cf(r){return Math.log(r)/Math.LN2%1===0}function pf(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function wn(r,e,t){let i={};for(let n in r)i[n]=e.call(t||this,r[n],n,r);return i}function Na(r,e,t){let i={};for(let n in r)e.call(t||this,r[n],n,r)&&(i[n]=r[n]);return i}function Jt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Jt(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let i in r)if(!Jt(r[i],e[i]))return!1;return!0}return r===e}function ct(r){return Array.isArray(r)?r.map(ct):typeof r=="object"&&r?wn(r,ct):r}function hf(r,e){for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>=0)return!0;return!1}var nf={};function ke(r){nf[r]||(typeof console<"u"&&console.warn(r),nf[r]=!0)}function Qt(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)}function ff(r,e,t,i){let n=e.y-r.y,o=e.x-r.x,a=i.y-t.y,s=i.x-t.x,l=a*o-s*n;if(l===0)return null;let u=r.y-t.y,c=r.x-t.x,p=(s*u-a*c)/l;return new af.default(r.x+p*o,r.y+p*n)}function mf(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}function df([r,e,t]){return e+=90,e*=Math.PI/180,t*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(t),y:r*Math.sin(e)*Math.sin(t),z:r*Math.cos(t)}}function er(r){return typeof WorkerGlobalScope<"u"&&typeof r<"u"&&r instanceof WorkerGlobalScope}function yf(r){let e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,(i,n,o,a)=>{let s=o||a;return t[n]=s?s.toLowerCase():!0,""}),t["max-age"]){let i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t}var Ac=null;function gf(r){if(Ac==null){let e=r.navigator?r.navigator.userAgent:null;Ac=!!r.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ac}function pt(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}var xf=async r=>{if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error("Could not load image because of ".concat(t.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},of="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",bf=r=>new Promise((e,t)=>{let i=new Image;i.onload=()=>{e(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=of})},i.onerror=()=>t(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."));let n=new Blob([new Uint8Array(r)],{type:"image/png"});i.src=r.byteLength?URL.createObjectURL(n):of});function R_(r,e,t,i,n){let o=Math.max(-e,0)*4,l=(Math.max(0,t)-t)*i*4+o,u=i*4,c=Math.max(0,e),p=Math.max(0,t),h=Math.min(r.width,e+i),f=Math.min(r.height,t+n);return{rect:{x:c,y:p,width:h-c,height:f-p},layout:[{offset:l,stride:u}]}}async function _f(r,e,t,i,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(r,{timestamp:0});try{let a=o==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(await o.copyTo(l,R_(r,e,t,i,n)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}function vf(r,e,t,i){return r.addEventListener(e,t,i),{unsubscribe:()=>{r.removeEventListener(e,t,i)}}}function Mc(r){return r*Math.PI/180}m();m();var B_="AbortError";function qr(){return new Error(B_)}var O_=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Ga,Ic,J={now:O_,frameAsync(r){return new Promise((e,t)=>{let i=requestAnimationFrame(e);r.signal.addEventListener("abort",()=>{cancelAnimationFrame(i),t(qr())})})},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){let e=window.document.createElement("canvas"),t=e.getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0,r.width,r.height),t},resolveURL(r){return Ga||(Ga=document.createElement("a")),Ga.href=r,Ga.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Ic==null&&(Ic=matchMedia("(prefers-reduced-motion: reduce)")),Ic.matches):!1}};m();var wf=oe(ye(),1),Me=class Me{static testProp(e){if(!Me.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in Me.docStyle)return e[t];return e[0]}static create(e,t,i){let n=window.document.createElement(e);return t!==void 0&&(n.className=t),i&&i.appendChild(n),n}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){Me.docStyle&&Me.selectProp&&(Me.userSelect=Me.docStyle[Me.selectProp],Me.docStyle[Me.selectProp]="none")}static enableDrag(){Me.docStyle&&Me.selectProp&&(Me.docStyle[Me.selectProp]=Me.userSelect)}static setTransform(e,t){e.style[Me.transformProp]=t}static addEventListener(e,t,i,n={}){"passive"in n?e.addEventListener(t,i,n):e.addEventListener(t,i,n.capture)}static removeEventListener(e,t,i,n={}){"passive"in n?e.removeEventListener(t,i,n):e.removeEventListener(t,i,n.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Me.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Me.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Me.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,i){let n=t.boundingClientRect;return new wf.default((i.clientX-n.left)/t.x-e.clientLeft,(i.clientY-n.top)/t.y-e.clientTop)}static mousePos(e,t){let i=Me.getScale(e);return Me.getPoint(e,i,t)}static touchPos(e,t){let i=[],n=Me.getScale(e);for(let o=0;o<t.length;o++)i.push(Me.getPoint(e,n,t[o]));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}};Me.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Me.selectProp=Me.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Me.transformProp=Me.testProp(["transform","WebkitTransform"]);var L=Me;m();m();m();var Xe={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function qa(r){return Xe.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}function V_(r,e){Xe.REGISTERED_PROTOCOLS[r]=e}function U_(r){delete Xe.REGISTERED_PROTOCOLS[r]}m();var ja="global-dispatcher",jr=class extends Error{constructor(e,t,i,n){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(i)),this.status=e,this.statusText=t,this.url=i,this.body=n}},Za=()=>er(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,N_=r=>/^file:/.test(r)||/^file:/.test(Za())&&!/^\w+:/.test(r);async function G_(r,e){let t=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:Za(),signal:e.signal});r.type==="json"&&t.headers.set("Accept","application/json");let i=await fetch(t);if(!i.ok){let a=await i.blob();throw new jr(i.status,i.statusText,r.url,a)}let n;r.type==="arrayBuffer"||r.type==="image"?n=i.arrayBuffer():r.type==="json"?n=i.json():n=i.text();let o=await n;if(e.signal.aborted)throw qr();return{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}}function q_(r,e){return new Promise((t,i)=>{let n=new XMLHttpRequest;n.open(r.method||"GET",r.url,!0),(r.type==="arrayBuffer"||r.type==="image")&&(n.responseType="arraybuffer");for(let o in r.headers)n.setRequestHeader(o,r.headers[o]);r.type==="json"&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials=r.credentials==="include",n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let o=n.response;if(r.type==="json")try{o=JSON.parse(n.response)}catch(a){i(a);return}t({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let o=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new jr(n.status,n.statusText,r.url,o))}},e.signal.addEventListener("abort",()=>{n.abort(),i(qr())}),n.send(r.body)})}var Si=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){let t=qa(r.url);if(t)return t(r,e);if(er(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:ja},e)}if(!N_(r.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return G_(r,e);if(er(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:ja},e)}return q_(r,e)},dr=(r,e)=>Si(O(r,{type:"json"}),e),Sf=(r,e)=>Si(O(r,{type:"arrayBuffer"}),e);function Cc(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;let e=new URL(r),t=window.location;return e.protocol===t.protocol&&e.host===t.host}var Pf=r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise(t=>{e.onloadstart=()=>{t(e)};for(let i of r){let n=window.document.createElement("source");Cc(i)||(e.crossOrigin="Anonymous"),n.src=i,e.appendChild(n)}})};m();m();var Pn={supported:!1,testSupport:j_},Sn,Ec=!1,Pi,Tf=!1;typeof document<"u"&&(Pi=document.createElement("img"),Pi.onload=function(){Sn&&Af(Sn),Sn=null,Tf=!0},Pi.onerror=function(){Ec=!0,Sn=null},Pi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function j_(r){Ec||!Pi||(Tf?Af(r):Sn=r)}function Af(r){let e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Pi),r.isContextLost())return;Pn.supported=!0}catch(t){}r.deleteTexture(e),Ec=!0}var at;(f=>{let r,e,t,i;f.resetRequestQueue=()=>{r=[],e=0,t=0,i={}},f.addThrottleControl=d=>{let y=t++;return i[y]=d,y},f.removeThrottleControl=d=>{delete i[d],p()};let s=()=>{for(let d of Object.keys(i))if(i[d]())return!0;return!1};f.getImage=(d,y,g=!0)=>new Promise((x,v)=>{Pn.supported&&(d.headers||(d.headers={}),d.headers.accept="image/webp,*/*"),O(d,{type:"image"});let b={abortController:y,requestParameters:d,supportImageRefresh:g,state:"queued",onError:w=>{v(w)},onSuccess:w=>{x(w)}};r.push(b),p()});let u=d=>typeof createImageBitmap=="function"?xf(d):bf(d),c=async d=>{d.state="running";let{requestParameters:y,supportImageRefresh:g,onError:x,onSuccess:v,abortController:b}=d,w=g===!1&&!er(self)&&!qa(y.url)&&(!y.headers||Object.keys(y.headers).reduce((P,k)=>P&&k==="accept",!0));e++;let S=w?h(y,b):Si(y,b);try{let P=await S;if(delete d.abortController,d.state="completed",P.data instanceof HTMLImageElement||pt(P.data))v(P);else if(P.data){let k=await u(P.data);v({data:k,cacheControl:P.cacheControl,expires:P.expires})}}catch(P){delete d.abortController,x(P)}finally{e--,p()}},p=()=>{let d=s()?Xe.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Xe.MAX_PARALLEL_IMAGE_REQUESTS;for(let y=e;y<d&&r.length>0;y++){let g=r.shift();if(g.abortController.signal.aborted){y--;continue}c(g)}},h=(d,y)=>new Promise((g,x)=>{let v=new Image,b=d.url,w=d.credentials;w&&w==="include"?v.crossOrigin="use-credentials":(w&&w==="same-origin"||!Cc(b))&&(v.crossOrigin="anonymous"),y.signal.addEventListener("abort",()=>{v.src="",x(qr())}),v.fetchPriority="high",v.onload=()=>{v.onerror=v.onload=null,g({data:v})},v.onerror=()=>{v.onerror=v.onload=null,!y.signal.aborted&&x(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."))},v.src=b})})(at||(at={}));at.resetRequestQueue();m();var Ha=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}normalizeSpriteURL(e,t,i){let n=H_(e);return n.path+="".concat(t).concat(i),$_(n)}setTransformRequest(e){this._transformRequestFn=e}},Z_=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function H_(r){let e=r.match(Z_);if(!e)throw new Error('Unable to parse URL "'.concat(r,'"'));return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function $_(r){let e=r.params.length?"?".concat(r.params.join("&")):"";return"".concat(r.protocol,"://").concat(r.authority).concat(r.path).concat(e)}m();m();function Mf(r,e,t){t[r]&&t[r].indexOf(e)!==-1||(t[r]=t[r]||[],t[r].push(e))}function kc(r,e,t){if(t&&t[r]){let i=t[r].indexOf(e);i!==-1&&t[r].splice(i,1)}}var z=class{constructor(e,t={}){O(this,t),this.type=e}},Z=class extends z{constructor(e,t={}){super("error",O({error:e},t))}},me=class{on(e,t){return this._listeners=this._listeners||{},Mf(e,t,this._listeners),this}off(e,t){return kc(e,t,this._listeners),kc(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Mf(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new z(e,t||{}));let i=e.type;if(this.listens(i)){e.target=this;let n=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(let s of n)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(let s of o)kc(i,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(O(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof Z&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}};m();m();m();m();var W_=8,X_={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},K_={"*":{type:"source"}},J_=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Y_={type:{required:!0,type:"enum",values:{vector:{}}},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:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Q_={type:{required:!0,type:"enum",values:{raster:{}}},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,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},ev={type:{required:!0,type:"enum",values:{"raster-dem":{}}},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,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},tv={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},rv={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},iv={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},nv={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{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"}},ov=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],av={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},sv={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},lv={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},uv={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},cv={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},pv={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},hv={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},fv={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},mv={type:"array",value:"*"},dv={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},yv={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},gv={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},xv={type:"array",value:"*",minimum:1},bv={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},_v={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},vv={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},wv={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},Sv=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],Pv={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},Tv={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},Av={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},Mv={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Iv={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},Cv={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Ev={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},kv={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Lv={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Dv={"*":{type:"string"}},A={$version:W_,$root:X_,sources:K_,source:J_,source_vector:Y_,source_raster:Q_,source_raster_dem:ev,source_geojson:tv,source_video:rv,source_image:iv,layer:nv,layout:ov,layout_background:av,layout_fill:sv,layout_circle:lv,layout_heatmap:uv,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:cv,layout_symbol:pv,layout_raster:hv,layout_hillshade:fv,filter:mv,filter_operator:dv,geometry_type:yv,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:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:gv,expression:xv,light:bv,sky:_v,terrain:vv,projection:wv,paint:Sv,paint_fill:Pv,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:Tv,paint_circle:Av,paint_heatmap:Mv,paint_symbol:Iv,paint_raster:Cv,paint_hillshade:Ev,paint_background:kv,transition:Lv,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:Dv},zv=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Fv(r,e){let t={};for(let i in r)i!=="ref"&&(t[i]=r[i]);return zv.forEach(i=>{i in e&&(t[i]=e[i])}),t}function ip(r){r=r.slice();let e=Object.create(null);for(let t=0;t<r.length;t++)e[r[t].id]=r[t];for(let t=0;t<r.length;t++)"ref"in r[t]&&(r[t]=Fv(r[t],e[r[t].ref]));return r}function Ie(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Ie(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let i in r)if(!Ie(r[i],e[i]))return!1;return!0}return r===e}function Pt(r,e){r.push(e)}function Jf(r,e,t){Pt(t,{command:"addSource",args:[r,e[r]]})}function Yf(r,e,t){Pt(e,{command:"removeSource",args:[r]}),t[r]=!0}function Rv(r,e,t,i){Yf(r,t,i),Jf(r,e,t)}function Bv(r,e,t){let i;for(i in r[t])if(Object.prototype.hasOwnProperty.call(r[t],i)&&i!=="data"&&!Ie(r[t][i],e[t][i]))return!1;for(i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)&&i!=="data"&&!Ie(r[t][i],e[t][i]))return!1;return!0}function Ov(r,e,t,i){r=r||{},e=e||{};let n;for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(Object.prototype.hasOwnProperty.call(e,n)||Yf(n,t,i));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(r,n)?Ie(r[n],e[n])||(r[n].type==="geojson"&&e[n].type==="geojson"&&Bv(r,e,n)?Pt(t,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):Rv(n,e,t,i)):Jf(n,e,t))}function $a(r,e,t,i,n,o){r=r||{},e=e||{};for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(Ie(r[a],e[a])||t.push({command:o,args:[i,a,e[a],n]}));for(let a in e)!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(r,a)||Ie(r[a],e[a])||t.push({command:o,args:[i,a,e[a],n]})}function If(r){return r.id}function Cf(r,e){return r[e.id]=e,r}function Vv(r,e,t){r=r||[],e=e||[];let i=r.map(If),n=e.map(If),o=r.reduce(Cf,{}),a=e.reduce(Cf,{}),s=i.slice(),l=Object.create(null),u,c,p,h,f;for(let d=0,y=0;d<i.length;d++)u=i[d],Object.prototype.hasOwnProperty.call(a,u)?y++:(Pt(t,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,y),1));for(let d=0,y=0;d<n.length;d++)u=n[n.length-1-d],s[s.length-1-d]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(Pt(t,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,h=s[s.length-d],Pt(t,{command:"addLayer",args:[a[u],h]}),s.splice(s.length-d,0,u),l[u]=!0);for(let d=0;d<n.length;d++)if(u=n[d],c=o[u],p=a[u],!(l[u]||Ie(c,p))){if(!Ie(c.source,p.source)||!Ie(c["source-layer"],p["source-layer"])||!Ie(c.type,p.type)){Pt(t,{command:"removeLayer",args:[u]}),h=s[s.lastIndexOf(u)+1],Pt(t,{command:"addLayer",args:[p,h]});continue}$a(c.layout,p.layout,t,u,null,"setLayoutProperty"),$a(c.paint,p.paint,t,u,null,"setPaintProperty"),Ie(c.filter,p.filter)||Pt(t,{command:"setFilter",args:[u,p.filter]}),(!Ie(c.minzoom,p.minzoom)||!Ie(c.maxzoom,p.maxzoom))&&Pt(t,{command:"setLayerZoomRange",args:[u,p.minzoom,p.maxzoom]});for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?$a(c[f],p[f],t,u,f.slice(6),"setPaintProperty"):Ie(c[f],p[f])||Pt(t,{command:"setLayerProperty",args:[u,f,p[f]]})));for(f in p)!Object.prototype.hasOwnProperty.call(p,f)||Object.prototype.hasOwnProperty.call(c,f)||f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?$a(c[f],p[f],t,u,f.slice(6),"setPaintProperty"):Ie(c[f],p[f])||Pt(t,{command:"setLayerProperty",args:[u,f,p[f]]}))}}function Qf(r,e){if(!r)return[{command:"setStyle",args:[e]}];let t=[];try{if(!Ie(r.version,e.version))return[{command:"setStyle",args:[e]}];Ie(r.center,e.center)||t.push({command:"setCenter",args:[e.center]}),Ie(r.zoom,e.zoom)||t.push({command:"setZoom",args:[e.zoom]}),Ie(r.bearing,e.bearing)||t.push({command:"setBearing",args:[e.bearing]}),Ie(r.pitch,e.pitch)||t.push({command:"setPitch",args:[e.pitch]}),Ie(r.roll,e.roll)||t.push({command:"setRoll",args:[e.roll]}),Ie(r.sprite,e.sprite)||t.push({command:"setSprite",args:[e.sprite]}),Ie(r.glyphs,e.glyphs)||t.push({command:"setGlyphs",args:[e.glyphs]}),Ie(r.transition,e.transition)||t.push({command:"setTransition",args:[e.transition]}),Ie(r.light,e.light)||t.push({command:"setLight",args:[e.light]}),Ie(r.terrain,e.terrain)||t.push({command:"setTerrain",args:[e.terrain]}),Ie(r.sky,e.sky)||t.push({command:"setSky",args:[e.sky]}),Ie(r.projection,e.projection)||t.push({command:"setProjection",args:[e.projection]});let i={},n=[];Ov(r.sources,e.sources,n,i);let o=[];r.layers&&r.layers.forEach(a=>{"source"in a&&i[a.source]?t.push({command:"removeLayer",args:[a.id]}):o.push(a)}),t=t.concat(n),Vv(o,e.layers,t)}catch(i){console.warn("Unable to compute style diff:",i),t=[{command:"setStyle",args:[e]}]}return t}var R=class{constructor(e,t,i,n){this.message=(e?"".concat(e,": "):"")+i,n&&(this.identifier=n),t!=null&&t.__line__&&(this.line=t.__line__)}};function Ci(r,...e){for(let t of e)for(let i in t)r[i]=t[i];return r}var Tt=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},Nc=class r{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[i,n]of t)this.bindings[i]=n}concat(e){return new r(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},Li={kind:"null"},q={kind:"number"},ce={kind:"string"},ae={kind:"boolean"},Mt={kind:"color"},Mi={kind:"object"},se={kind:"value"},Uv={kind:"error"},hs={kind:"collator"},Di={kind:"formatted"},fs={kind:"padding"},Nn={kind:"resolvedImage"},ms={kind:"variableAnchorOffsetCollection"};function _t(r,e){return{kind:"array",itemType:r,N:e}}function Fe(r){if(r.kind==="array"){let e=Fe(r.itemType);return typeof r.N=="number"?"array<".concat(e,", ").concat(r.N,">"):r.itemType.kind==="value"?"array":"array<".concat(e,">")}else return r.kind}var Nv=[Li,q,ce,ae,Mt,Di,Mi,_t(se),fs,Nn,ms];function Cn(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Cn(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(let t of Nv)if(!Cn(t,e))return null}}return"Expected ".concat(Fe(r)," but found ").concat(Fe(e)," instead.")}function np(r,e){return e.some(t=>t.kind===r.kind)}function Wr(r,e){return e.some(t=>t==="null"?r===null:t==="array"?Array.isArray(r):t==="object"?r&&!Array.isArray(r)&&typeof r=="object":t===typeof r)}function Tn(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}var em=.96422,tm=1,rm=.82521,im=4/29,Ii=6/29,nm=3*Ii*Ii,Gv=Ii*Ii*Ii,qv=Math.PI/180,jv=180/Math.PI;function om(r){return r=r%360,r<0&&(r+=360),r}function am([r,e,t,i]){r=Lc(r),e=Lc(e),t=Lc(t);let n,o,a=Dc((.2225045*r+.7168786*e+.0606169*t)/tm);r===e&&e===t?n=o=a:(n=Dc((.4360747*r+.3850649*e+.1430804*t)/em),o=Dc((.0139322*r+.0971045*e+.7141733*t)/rm));let s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function Lc(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Dc(r){return r>Gv?Math.pow(r,1/3):r/nm+im}function sm([r,e,t,i]){let n=(r+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(t)?n:n-t/200;return n=tm*Fc(n),o=em*Fc(o),a=rm*Fc(a),[zc(3.1338561*o-1.6168667*n-.4906146*a),zc(-.9787684*o+1.9161415*n+.033454*a),zc(.0719453*o-.2289914*n+1.4052427*a),i]}function zc(r){return r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055,r<0?0:r>1?1:r}function Fc(r){return r>Ii?r*r*r:nm*(r-im)}function Zv(r){let[e,t,i,n]=am(r),o=Math.sqrt(t*t+i*i);return[Math.round(o*1e4)?om(Math.atan2(i,t)*jv):NaN,o,e,n]}function Hv([r,e,t,i]){return r=isNaN(r)?0:r*qv,sm([t,Math.cos(r)*e,Math.sin(r)*e,i])}function $v([r,e,t,i]){r=om(r),e/=100,t/=100;function n(o){let a=(o+r/30)%12,s=e*Math.min(t,1-t);return t-s*Math.max(-1,Math.min(a-3,9-a,1))}return[n(0),n(8),n(4),i]}function Wv(r){if(r=r.toLowerCase().trim(),r==="transparent")return[0,0,0,0];let e=Xv[r];if(e){let[n,o,a]=e;return[n/255,o/255,a/255,1]}if(r.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(r)){let o=r.length<6?1:2,a=1;return[Wa(r.slice(a,a+=o)),Wa(r.slice(a,a+=o)),Wa(r.slice(a,a+=o)),Wa(r.slice(a,a+o)||"ff")]}if(r.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=r.match(n);if(o){let[a,s,l,u,c,p,h,f,d,y,g,x]=o,v=[u||" ",h||" ",y].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let b=[l,p,d].join(""),w=b==="%%%"?100:b===""?255:0;if(w){let S=[Ti(+s/w,0,1),Ti(+c/w,0,1),Ti(+f/w,0,1),g?Ef(+g,x):1];if(kf(S))return S}}return}}let t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=r.match(t);if(i){let[n,o,a,s,l,u,c,p,h]=i,f=[a||" ",l||" ",c].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let d=[+o,Ti(+s,0,100),Ti(+u,0,100),p?Ef(+p,h):1];if(kf(d))return $v(d)}}}function Wa(r){return parseInt(r.padEnd(2,r),16)/255}function Ef(r,e){return Ti(e?r/100:r,0,1)}function Ti(r,e,t){return Math.min(Math.max(e,r),t)}function kf(r){return!r.some(Number.isNaN)}var Xv={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},W=class r{constructor(e,t,i,n=1,o=!0){this.r=e,this.g=t,this.b=i,this.a=n,o||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,i,n]))}static parse(e){if(e instanceof r)return e;if(typeof e!="string")return;let t=Wv(e);if(t)return new r(...t,!1)}get rgb(){let{r:e,g:t,b:i,a:n}=this,o=n||1/0;return this.overwriteGetter("rgb",[e/o,t/o,i/o,n])}get hcl(){return this.overwriteGetter("hcl",Zv(this.rgb))}get lab(){return this.overwriteGetter("lab",am(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,i,n]=this.rgb;return"rgba(".concat([e,t,i].map(o=>Math.round(o*255)).join(","),",").concat(n,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var En=class{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},kn=class{constructor(e,t,i,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=o}},wt=class r{constructor(e){this.sections=e}static fromString(e){return new r([new kn(e,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof r?e:r.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},zt=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(typeof e=="number")return new r([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new r(e)}}toString(){return JSON.stringify(this.values)}},Kv=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),tr=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){let i=e[t],n=e[t+1];if(typeof i!="string"||!Kv.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new r(e)}}toString(){return JSON.stringify(this.values)}},ht=class r{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new r({name:e,available:!1}):null}};function lm(r,e,t,i){if(!(typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255)){let n=typeof i=="number"?[r,e,t,i]:[r,e,t];return"Invalid rgba value [".concat(n.join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}return typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:"Invalid rgba value [".concat([r,e,t,i].join(", "),"]: 'a' must be between 0 and 1.")}function Ln(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof W||r instanceof En||r instanceof wt||r instanceof zt||r instanceof tr||r instanceof ht)return!0;if(Array.isArray(r)){for(let e of r)if(!Ln(e))return!1;return!0}else if(typeof r=="object"){for(let e in r)if(!Ln(r[e]))return!1;return!0}else return!1}function Ze(r){if(r===null)return Li;if(typeof r=="string")return ce;if(typeof r=="boolean")return ae;if(typeof r=="number")return q;if(r instanceof W)return Mt;if(r instanceof En)return hs;if(r instanceof wt)return Di;if(r instanceof zt)return fs;if(r instanceof tr)return ms;if(r instanceof ht)return Nn;if(Array.isArray(r)){let e=r.length,t;for(let i of r){let n=Ze(i);if(!t)t=n;else{if(t===n)continue;t=se;break}}return _t(t||se,e)}else return Mi}function Mn(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof W||r instanceof wt||r instanceof zt||r instanceof tr||r instanceof ht?r.toString():JSON.stringify(r)}var gr=class r{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error("'literal' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!Ln(e[1]))return t.error("invalid value");let i=e[1],n=Ze(i),o=t.expectedType;return n.kind==="array"&&n.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(n=o),new r(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Re=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},Xa={string:ce,number:q,boolean:ae,object:Mi},Dt=class r{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=1,n,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Xa)||u==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);s=Xa[u],i++}else s=se;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],i++}n=_t(s,l)}else{if(!Xa[o])throw new Error("Types doesn't contain name = ".concat(o));n=Xa[o]}let a=[];for(;i<e.length;i++){let s=t.parse(e[i],i,se);if(!s)return null;a.push(s)}return new r(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let i=this.args[t].evaluate(e);if(Cn(this.type,Ze(i))){if(t===this.args.length-1)throw new Re("Expected value to be of type ".concat(Fe(this.type),", but found ").concat(Fe(Ze(i))," instead."))}else return i}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Lf={"to-boolean":ae,"to-color":Mt,"to-number":q,"to-string":ce},yr=class r{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[0];if(!Lf[i])throw new Error("Can't parse ".concat(i," as it is not part of the known types"));if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");let n=Lf[i],o=[];for(let a=1;a<e.length;a++){let s=t.parse(e[a],a,se);if(!s)return null;o.push(s)}return new r(n,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(let n of this.args){if(t=n.evaluate(e),i=null,t instanceof W)return t;if(typeof t=="string"){let o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?i="Invalid rgba value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):i=lm(t[0],t[1],t[2],t[3]),!i))return new W(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Re(i||"Could not parse color from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"padding":{let t;for(let i of this.args){t=i.evaluate(e);let n=zt.parse(t);if(n)return n}throw new Re("Could not parse padding from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"variableAnchorOffsetCollection":{let t;for(let i of this.args){t=i.evaluate(e);let n=tr.parse(t);if(n)return n}throw new Re("Could not parse variableAnchorOffsetCollection from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"number":{let t=null;for(let i of this.args){if(t=i.evaluate(e),t===null)return 0;let n=Number(t);if(!isNaN(n))return n}throw new Re("Could not convert ".concat(JSON.stringify(t)," to number."))}case"formatted":return wt.fromString(Mn(this.args[0].evaluate(e)));case"resolvedImage":return ht.fromString(Mn(this.args[0].evaluate(e)));default:return Mn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Jv=["Unknown","Point","LineString","Polygon"],Qa=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Jv[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||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=W.parse(e)),t}},es=class r{constructor(e,t,i=[],n,o=new Nc,a=[]){this.registry=e,this.path=i,this.key=i.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=n,this._isConstant=t}parse(e,t,i,n,o={}){return t?this.concat(t,i,n)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(n,o,a){return a==="assert"?new Dt(o,[n]):a==="coerce"?new yr(o,[n]):n}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n=e[0];if(typeof n!="string")return this.error("Expression name must be a string, but found ".concat(typeof n,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;let o=this.registry[n];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=i(a,s,t.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=i(a,s,t.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=i(a,s,t.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=i(a,s,t.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof gr)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Qa;try{a=new gr(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found ".concat(typeof e," instead."))}concat(e,t,i){let n=typeof e=="number"?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new r(this.registry,this._isConstant,n,t||null,o,this.errors)}error(e,...t){let i="".concat(this.key).concat(t.map(n=>"[".concat(n,"]")).join(""));this.errors.push(new Tt(i,e))}checkSubtype(e,t){let i=Cn(e,t);return i&&this.error(i),i}},ts=class r{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));let i=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return t.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);let s=t.parse(e[o+1],o+1);if(!s)return null;i.push([a,s])}let n=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return n?new r(i,n):null}outputDefined(){return this.result.outputDefined()}},rs=class r{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");let i=e[1];return t.scope.has(i)?new r(i,t.scope.get(i)):t.error('Unknown variable "'.concat(i,'". Make sure "').concat(i,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Gc=class r{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,q),n=t.parse(e[2],2,_t(t.expectedType||se));if(!i||!n)return null;let o=n.type;return new r(o.itemType,i,n)}evaluate(e){let t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Re("Array index out of bounds: ".concat(t," < 0."));if(t>=i.length)throw new Re("Array index out of bounds: ".concat(t," > ").concat(i.length-1,"."));if(t!==Math.floor(t))throw new Re("Array index must be an integer, but found ".concat(t," instead."));return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},qc=class r{constructor(e,t){this.type=ae,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,se),n=t.parse(e[2],2,se);return!i||!n?null:np(i.type,[ae,ce,q,Li,se])?new r(i,n):t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Fe(i.type)," instead"))}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Wr(t,["boolean","string","number","null"]))throw new Re("Expected first argument to be of type boolean, string, number or null, but found ".concat(Fe(Ze(t))," instead."));if(!Wr(i,["string","array"]))throw new Re("Expected second argument to be of type array or string, but found ".concat(Fe(Ze(i))," instead."));return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},jc=class r{constructor(e,t,i){this.type=q,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,se),n=t.parse(e[2],2,se);if(!i||!n)return null;if(!np(i.type,[ae,ce,q,Li,se]))return t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Fe(i.type)," instead"));if(e.length===4){let o=t.parse(e[3],3,q);return o?new r(i,n,o):null}else return new r(i,n)}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Wr(t,["boolean","string","number","null"]))throw new Re("Expected first argument to be of type boolean, string, number or null, but found ".concat(Fe(Ze(t))," instead."));let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),Wr(i,["string"])){let o=i.indexOf(t,n);return o===-1?-1:[...i.slice(0,o)].length}else{if(Wr(i,["array"]))return i.indexOf(t,n);throw new Re("Expected second argument to be of type array or string, but found ".concat(Fe(Ze(i))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Zc=class r{constructor(e,t,i,n,o,a){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=o,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let h=t.concat(u);if(c.length===0)return h.error("Expected at least one branch label.");for(let d of c){if(typeof d!="number"&&typeof d!="string")return h.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return h.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof d=="number"&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(!i)i=Ze(d);else if(h.checkSubtype(i,Ze(d)))return null;if(typeof o[String(d)]<"u")return h.error("Branch labels must be unique.");o[String(d)]=a.length}let f=t.parse(p,u,n);if(!f)return null;n=n||f.type,a.push(f)}let s=t.parse(e[1],1,se);if(!s)return null;let l=t.parse(e[e.length-1],e.length-1,n);return!l||s.type.kind!=="value"&&t.concat(1).checkSubtype(i,s.type)?null:new r(i,n,s,o,a,l)}evaluate(e){let t=this.input.evaluate(e);return(Ze(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Hc=class r{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);let n=[];for(let a=1;a<e.length-1;a+=2){let s=t.parse(e[a],a,ae);if(!s)return null;let l=t.parse(e[a+1],a+1,i);if(!l)return null;n.push([s,l]),i=i||l.type}let o=t.parse(e[e.length-1],e.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new r(i,n,o)}evaluate(e){for(let[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},$c=class r{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,se),n=t.parse(e[2],2,q);if(!i||!n)return null;if(!np(i.type,[_t(se),ce,se]))return t.error("Expected first argument to be of type array or string, but found ".concat(Fe(i.type)," instead"));if(e.length===4){let o=t.parse(e[3],3,q);return o?new r(i.type,i,n,o):null}else return new r(i.type,i,n)}evaluate(e){let t=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),Wr(t,["string"]))return[...t].slice(i,n).join("");if(Wr(t,["array"]))return t.slice(i,n);throw new Re("Expected first argument to be of type array or string, but found ".concat(Fe(Ze(t))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function ds(r,e){let t=r.length-1,i=0,n=t,o=0,a,s;for(;i<=n;)if(o=Math.floor((i+n)/2),a=r[o],s=r[o+1],a<=e){if(o===t||e<s)return o;i=o+1}else if(a>e)n=o-1;else throw new Re("Input is not a number.");return 0}var Ei=class r{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[n,o]of i)this.labels.push(n),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");let i=t.parse(e[1],1,q);if(!i)return null;let n=[],o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=s)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let p=t.parse(l,c,o);if(!p)return null;o=o||p.type,n.push([s,p])}return new r(o,i,n)}evaluate(e){let t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);let o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);let a=ds(t,n);return i[a].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Yv(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Rc,Df;function Qv(){if(Df)return Rc;Df=1,Rc=r;function r(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}return r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i=i-o/a}var s=0,l=1;for(i=e,n=0;n<20&&(o=this.sampleCurveX(i),!(Math.abs(o-e)<t));n++)e>o?s=i:l=i,i=(l-s)*.5+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Rc}var e0=Qv(),t0=Yv(e0);function r0(r){return r==="rgb"||r==="hcl"||r==="lab"}function Xr(r,e,t){return r+t*(e-r)}function i0(r,e,t,i="rgb"){switch(i){case"rgb":{let[n,o,a,s]=is(r.rgb,e.rgb,t);return new W(n,o,a,s,!1)}case"hcl":{let[n,o,a,s]=r.hcl,[l,u,c,p]=e.hcl,h,f;if(!isNaN(n)&&!isNaN(l)){let v=l-n;l>n&&v>180?v-=360:l<n&&n-l>180&&(v+=360),h=n+t*v}else isNaN(n)?isNaN(l)?h=NaN:(h=l,(a===1||a===0)&&(f=u)):(h=n,(c===1||c===0)&&(f=o));let[d,y,g,x]=Hv([h,f!=null?f:Xr(o,u,t),Xr(a,c,t),Xr(s,p,t)]);return new W(d,y,g,x,!1)}case"lab":{let[n,o,a,s]=sm(is(r.lab,e.lab,t));return new W(n,o,a,s,!1)}}}function is(r,e,t){return r.map((i,n)=>Xr(i,e[n],t))}function n0(r,e,t){return new zt(is(r.values,e.values,t))}function o0(r,e,t){let i=r.values,n=e.values;if(i.length!==n.length)throw new Re("Cannot interpolate values of different length. from: ".concat(r.toString(),", to: ").concat(e.toString()));let o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==n[a])throw new Re("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(i[a],", to[").concat(a,"]: ").concat(n[a]));o.push(i[a]);let[s,l]=i[a+1],[u,c]=n[a+1];o.push([Xr(s,u,t),Xr(l,c,t)])}return new tr(o)}var Se={number:Xr,color:i0,array:is,padding:n0,variableAnchorOffsetCollection:o0},vt=class r{constructor(e,t,i,n,o){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,t,i,n){let o=0;if(e.name==="exponential")o=Bc(t,e.base,i,n);else if(e.name==="linear")o=Bc(t,1,i,n);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new t0(a[0],a[1],a[2],a[3]).solve(Bc(t,1,i,n))}return o}static parse(e,t){let[i,n,o,...a]=e;if(!Array.isArray(n)||n.length===0)return t.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return t.error("Unknown interpolation type ".concat(String(n[0])),1,0);if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,q),!o)return null;let s=[],l=null;i==="interpolate-hcl"||i==="interpolate-lab"?l=Mt:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],h=u+3,f=u+4;if(typeof c!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(s.length&&s[s.length-1][0]>=c)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);let d=t.parse(p,f,l);if(!d)return null;l=l||d.type,s.push([c,d])}return!Tn(l,q)&&!Tn(l,Mt)&&!Tn(l,fs)&&!Tn(l,ms)&&!Tn(l,_t(q))?t.error("Type ".concat(Fe(l)," is not interpolatable.")):new r(l,i,n,o,s)}evaluate(e){let t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);let o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);let a=ds(t,n),s=t[a],l=t[a+1],u=r.interpolationFactor(this.interpolation,n,s,l),c=i[a].evaluate(e),p=i[a+1].evaluate(e);switch(this.operator){case"interpolate":return Se[this.type.kind](c,p,u);case"interpolate-hcl":return Se.color(c,p,u,"hcl");case"interpolate-lab":return Se.color(c,p,u,"lab")}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Bc(r,e,t,i){let n=i-t,o=r-t;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}var ns=class r{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null,n=t.expectedType;n&&n.kind!=="value"&&(i=n);let o=[];for(let s of e.slice(1)){let l=t.parse(s,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!l)return null;i=i||l.type,o.push(l)}if(!i)throw new Error("No output type");return n&&o.some(s=>Cn(n,s.type))?new r(se,o):new r(i,o)}evaluate(e){let t=null,i=0,n;for(let o of this.args)if(i++,t=o.evaluate(e),t&&t instanceof ht&&!t.available&&(n||(n=t.name),t=null,i===this.args.length&&(t=n)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function zf(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function a0(r,e,t){return e===t}function s0(r,e,t){return e!==t}function l0(r,e,t){return e<t}function u0(r,e,t){return e>t}function c0(r,e,t){return e<=t}function p0(r,e,t){return e>=t}function um(r,e,t,i){return i.compare(e,t)===0}function h0(r,e,t,i){return!um(r,e,t,i)}function f0(r,e,t,i){return i.compare(e,t)<0}function m0(r,e,t,i){return i.compare(e,t)>0}function d0(r,e,t,i){return i.compare(e,t)<=0}function y0(r,e,t,i){return i.compare(e,t)>=0}function zi(r,e,t){let i=r!=="=="&&r!=="!=";return class cm{constructor(o,a,s){this.type=ae,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,se);if(!l)return null;if(!zf(s,l.type))return a.concat(1).error('"'.concat(s,"\" comparisons are not supported for type '").concat(Fe(l.type),"'."));let u=a.parse(o[2],2,se);if(!u)return null;if(!zf(s,u.type))return a.concat(2).error('"'.concat(s,"\" comparisons are not supported for type '").concat(Fe(u.type),"'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types '".concat(Fe(l.type),"' and '").concat(Fe(u.type),"'."));i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Dt(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Dt(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,hs),!c)return null}return new cm(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(i&&this.hasUntypedArgument){let l=Ze(a),u=Ze(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Re('Expected arguments for "'.concat(r,'" to be (string, string) or (number, number), but found (').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!i&&this.hasUntypedArgument){let l=Ze(a),u=Ze(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?t(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var g0=zi("==",a0,um),x0=zi("!=",s0,h0),b0=zi("<",l0,f0),_0=zi(">",u0,m0),v0=zi("<=",c0,d0),w0=zi(">=",p0,y0),os=class r{constructor(e,t,i){this.type=hs,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");let n=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,ae);if(!n)return null;let o=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,ae);if(!o)return null;let a=null;return i.locale&&(a=t.parse(i.locale,1,ce),!a)?null:new r(n,o,a)}evaluate(e){return new En(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Wc=class r{constructor(e,t,i,n,o){this.type=ce,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");let i=t.parse(e[1],1,q);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=t.parse(n.locale,1,ce),!o))return null;let a=null;if(n.currency&&(a=t.parse(n.currency,1,ce),!a))return null;let s=null;if(n["min-fraction-digits"]&&(s=t.parse(n["min-fraction-digits"],1,q),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,q),!l)?null:new r(i,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},Dn=class r{constructor(e){this.type=Di,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");let n=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=t.parse(s["font-scale"],1,q),!l))return null;let u=null;if(s["text-font"]&&(u=t.parse(s["text-font"],1,_t(ce)),!u))return null;let c=null;if(s["text-color"]&&(c=t.parse(s["text-color"],1,Mt),!c))return null;let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=t.parse(e[a],1,se);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:l,scale:null,font:null,textColor:null})}}return new r(n)}evaluate(e){let t=i=>{let n=i.content.evaluate(e);return Ze(n)===Nn?new kn("",n,null,null,null):new kn(Mn(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)};return new wt(this.sections.map(t))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}},Xc=class r{constructor(e){this.type=Nn,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");let i=t.parse(e[1],1,ce);return i?new r(i):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),i=ht.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},Kc=class r{constructor(e){this.type=q,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error("Expected argument of type string or array, but found ".concat(Fe(i.type)," instead.")):new r(i):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Re("Expected value to be of type string or array, but found ".concat(Fe(Ze(t))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}},Ot=8192;function S0(r,e){let t=P0(r[0]),i=A0(r[1]),n=Math.pow(2,e.z);return[Math.round(t*n*Ot),Math.round(i*n*Ot)]}function op(r,e){let t=Math.pow(2,e.z),i=(r[0]/Ot+e.x)/t,n=(r[1]/Ot+e.y)/t;return[T0(i),M0(n)]}function P0(r){return(180+r)/360}function T0(r){return r*360-180}function A0(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function M0(r){return 360/Math.PI*Math.atan(Math.exp((180-r*360)*Math.PI/180))-90}function Gn(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function zn(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function I0(r,e,t){return e[1]>r[1]!=t[1]>r[1]&&r[0]<(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1])+e[0]}function C0(r,e,t){let i=r[0]-e[0],n=r[1]-e[1],o=r[0]-t[0],a=r[1]-t[1];return i*a-o*n===0&&i*o<=0&&n*a<=0}function ys(r,e,t,i){let n=[e[0]-r[0],e[1]-r[1]],o=[i[0]-t[0],i[1]-t[1]];return D0(o,n)===0?!1:!!(Ff(r,e,t,i)&&Ff(t,i,r,e))}function E0(r,e,t){for(let i of t)for(let n=0;n<i.length-1;++n)if(ys(r,e,i[n],i[n+1]))return!0;return!1}function Fi(r,e,t=!1){let i=!1;for(let n of e)for(let o=0;o<n.length-1;o++){if(C0(r,n[o],n[o+1]))return t;I0(r,n[o],n[o+1])&&(i=!i)}return i}function k0(r,e){for(let t of e)if(Fi(r,t))return!0;return!1}function pm(r,e){for(let t of r)if(!Fi(t,e))return!1;for(let t=0;t<r.length-1;++t)if(E0(r[t],r[t+1],e))return!1;return!0}function L0(r,e){for(let t of e)if(pm(r,t))return!0;return!1}function D0(r,e){return r[0]*e[1]-r[1]*e[0]}function Ff(r,e,t,i){let n=r[0]-t[0],o=r[1]-t[1],a=e[0]-t[0],s=e[1]-t[1],l=i[0]-t[0],u=i[1]-t[1],c=n*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function ap(r,e,t){let i=[];for(let n=0;n<r.length;n++){let o=[];for(let a=0;a<r[n].length;a++){let s=S0(r[n][a],t);Gn(e,s),o.push(s)}i.push(o)}return i}function hm(r,e,t){let i=[];for(let n=0;n<r.length;n++){let o=ap(r[n],e,t);i.push(o)}return i}function fm(r,e,t,i){if(r[0]<t[0]||r[0]>t[2]){let n=i*.5,o=r[0]-t[0]>n?-i:t[0]-r[0]>n?i:0;o===0&&(o=r[0]-t[2]>n?-i:t[2]-r[0]>n?i:0),r[0]+=o}Gn(e,r)}function z0(r){r[0]=r[1]=1/0,r[2]=r[3]=-1/0}function Rf(r,e,t,i){let n=Math.pow(2,i.z)*Ot,o=[i.x*Ot,i.y*Ot],a=[];for(let s of r)for(let l of s){let u=[l.x+o[0],l.y+o[1]];fm(u,e,t,n),a.push(u)}return a}function Bf(r,e,t,i){let n=Math.pow(2,i.z)*Ot,o=[i.x*Ot,i.y*Ot],a=[];for(let s of r){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Gn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=n/2){z0(e);for(let s of a)for(let l of s)fm(l,e,t,n)}return a}function F0(r,e){let t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=r.canonicalID();if(e.type==="Polygon"){let o=ap(e.coordinates,i,n),a=Rf(r.geometry(),t,i,n);if(!zn(t,i))return!1;for(let s of a)if(!Fi(s,o))return!1}if(e.type==="MultiPolygon"){let o=hm(e.coordinates,i,n),a=Rf(r.geometry(),t,i,n);if(!zn(t,i))return!1;for(let s of a)if(!k0(s,o))return!1}return!0}function R0(r,e){let t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=r.canonicalID();if(e.type==="Polygon"){let o=ap(e.coordinates,i,n),a=Bf(r.geometry(),t,i,n);if(!zn(t,i))return!1;for(let s of a)if(!pm(s,o))return!1}if(e.type==="MultiPolygon"){let o=hm(e.coordinates,i,n),a=Bf(r.geometry(),t,i,n);if(!zn(t,i))return!1;for(let s of a)if(!L0(s,o))return!1}return!0}var Fn=class r{constructor(e,t){this.type=ae,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error("'within' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(Ln(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let o of i.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&n.push(s),a==="MultiPolygon"&&n.push(...s)}if(n.length){let o={type:"MultiPolygon",coordinates:n};return new r(i,o)}}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new r(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new r(i,i)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return F0(e,this.geometries);if(e.geometryType()==="LineString")return R0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},as=class{constructor(e=[],t=(i,n)=>i<n?-1:i>n?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,n=t[e];for(;e>0;){let o=e-1>>1,a=t[o];if(i(n,a)>=0)break;t[e]=a,e=o}t[e]=n}_down(e){let{data:t,compare:i}=this,n=this.length>>1,o=t[e];for(;e<n;){let a=(e<<1)+1,s=a+1;if(s<this.length&&i(t[s],t[a])<0&&(a=s),i(t[a],o)>=0)break;t[e]=t[a],e=a}t[e]=o}};function B0(r,e,t,i,n){mm(r,e,t,i||r.length-1,n||O0)}function mm(r,e,t,i,n){for(;i>t;){if(i-t>600){var o=i-t+1,a=e-t+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(t,Math.floor(e-a*l/o+u)),p=Math.min(i,Math.floor(e+(o-a)*l/o+u));mm(r,e,c,p,n)}var h=r[e],f=t,d=i;for(An(r,t,e),n(r[i],h)>0&&An(r,t,i);f<d;){for(An(r,f,d),f++,d--;n(r[f],h)<0;)f++;for(;n(r[d],h)>0;)d--}n(r[t],h)===0?An(r,t,d):(d++,An(r,d,i)),d<=e&&(t=d+1),e<=d&&(i=d-1)}}function An(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}function O0(r,e){return r<e?-1:r>e?1:0}function V0(r,e){if(r.length<=1)return[r];let i=[],n,o;for(let a of r){let s=N0(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(n&&i.push(n),n=[a]):n.push(a))}if(n&&i.push(n),e>1)for(let a=0;a<i.length;a++)i[a].length<=e||(B0(i[a],e,1,i[a].length-1,U0),i[a]=i[a].slice(0,e));return i}function U0(r,e){return e.area-r.area}function N0(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}var G0=6378.137,Of=1/298.257223563,Vf=Of*(2-Of),Uf=Math.PI/180,Rn=class{constructor(e){let t=Uf*G0*1e3,i=Math.cos(e*Uf),n=1/(1-Vf*(1-i*i)),o=Math.sqrt(n);this.kx=t*o*i,this.ky=t*o*n*(1-Vf)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(e,t){let i=1/0,n,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,h=(e[l+1][1]-c)*this.ky,f=0;(p!==0||h!==0)&&(f=(this.wrap(t[0]-u)*this.kx*p+(t[1]-c)*this.ky*h)/(p*p+h*h),f>1?(u=e[l+1][0],c=e[l+1][1]):f>0&&(u+=p/this.kx*f,c+=h/this.ky*f)),p=this.wrap(t[0]-u)*this.kx,h=(t[1]-c)*this.ky;let d=p*p+h*h;d<i&&(i=d,n=u,o=c,a=l,s=f)}return{point:[n,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Jc=100,Yc=50;function dm(r,e){return e[0]-r[0]}function ss(r){return r[1]-r[0]+1}function rr(r,e){return r[1]>=r[0]&&r[1]<e}function Qc(r,e){if(r[0]>r[1])return[null,null];let t=ss(r);if(e){if(t===2)return[r,null];let n=Math.floor(t/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}if(t===1)return[r,null];let i=Math.floor(t/2)-1;return[[r[0],r[0]+i],[r[0]+i+1,r[1]]]}function ep(r,e){if(!rr(e,r.length))return[1/0,1/0,-1/0,-1/0];let t=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)Gn(t,r[i]);return t}function tp(r){let e=[1/0,1/0,-1/0,-1/0];for(let t of r)for(let i of t)Gn(e,i);return e}function Nf(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function sp(r,e,t){if(!Nf(r)||!Nf(e))return NaN;let i=0,n=0;return r[2]<e[0]&&(i=e[0]-r[2]),r[0]>e[2]&&(i=r[0]-e[2]),r[1]>e[3]&&(n=r[1]-e[3]),r[3]<e[1]&&(n=e[1]-r[3]),t.distance([0,0],[i,n])}function $r(r,e,t){let i=t.pointOnLine(e,r);return t.distance(r,i.point)}function lp(r,e,t,i,n){let o=Math.min($r(r,[t,i],n),$r(e,[t,i],n)),a=Math.min($r(t,[r,e],n),$r(i,[r,e],n));return Math.min(o,a)}function q0(r,e,t,i,n){if(!(rr(e,r.length)&&rr(i,t.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=r[s],u=r[s+1];for(let c=i[0];c<i[1];++c){let p=t[c],h=t[c+1];if(ys(l,u,p,h))return 0;a=Math.min(a,lp(l,u,p,h,n))}}return a}function j0(r,e,t,i,n){if(!(rr(e,r.length)&&rr(i,t.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=i[0];l<=i[1];++l)if(a=Math.min(a,n.distance(r[s],t[l])),a===0)return a;return a}function Z0(r,e,t){if(Fi(r,e,!0))return 0;let i=1/0;for(let n of e){let o=n[0],a=n[n.length-1];if(o!==a&&(i=Math.min(i,$r(r,[a,o],t)),i===0))return i;let s=t.pointOnLine(n,r);if(i=Math.min(i,t.distance(r,s.point)),i===0)return i}return i}function H0(r,e,t,i){if(!rr(e,r.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Fi(r[o],t,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){let a=r[o],s=r[o+1];for(let l of t)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let h=l[p],f=l[u];if(ys(a,s,h,f))return 0;n=Math.min(n,lp(a,s,h,f,i))}}return n}function Gf(r,e){for(let t of r)for(let i of t)if(Fi(i,e,!0))return!0;return!1}function $0(r,e,t,i=1/0){let n=tp(r),o=tp(e);if(i!==1/0&&sp(n,o,t)>=i)return i;if(zn(n,o)){if(Gf(r,e))return 0}else if(Gf(e,r))return 0;let a=1/0;for(let s of r)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],h=s[l];for(let f of e)for(let d=0,y=f.length,g=y-1;d<y;g=d++){let x=f[g],v=f[d];if(ys(p,h,x,v))return 0;a=Math.min(a,lp(p,h,x,v,t))}}return a}function qf(r,e,t,i,n,o){if(!o)return;let a=sp(ep(i,o),n,t);a<e&&r.push([a,o,[0,0]])}function Ka(r,e,t,i,n,o,a){if(!o||!a)return;let s=sp(ep(i,o),ep(n,a),t);s<e&&r.push([s,o,a])}function ls(r,e,t,i,n=1/0){let o=Math.min(i.distance(r[0],t[0][0]),n);if(o===0)return o;let a=new as([[0,[0,r.length-1],[0,0]]],dm),s=tp(t);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Yc:Jc;if(ss(u)<=c){if(!rr(u,r.length))return NaN;if(e){let p=H0(r,u,t,i);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let h=Z0(r[p],t,i);if(o=Math.min(o,h),o===0)return 0}}else{let p=Qc(u,e);qf(a,o,i,r,s,p[0]),qf(a,o,i,r,s,p[1])}}return o}function us(r,e,t,i,n,o=1/0){let a=Math.min(o,n.distance(r[0],t[0]));if(a===0)return a;let s=new as([[0,[0,r.length-1],[0,t.length-1]]],dm);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Yc:Jc,h=i?Yc:Jc;if(ss(u)<=p&&ss(c)<=h){if(!rr(u,r.length)&&rr(c,t.length))return NaN;let f;if(e&&i)f=q0(r,u,t,c,n),a=Math.min(a,f);else if(e&&!i){let d=r.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(f=$r(t[y],d,n),a=Math.min(a,f),a===0)return a}else if(!e&&i){let d=t.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(f=$r(r[y],d,n),a=Math.min(a,f),a===0)return a}else f=j0(r,u,t,c,n),a=Math.min(a,f)}else{let f=Qc(u,e),d=Qc(c,i);Ka(s,a,n,r,t,f[0],d[0]),Ka(s,a,n,r,t,f[0],d[1]),Ka(s,a,n,r,t,f[1],d[0]),Ka(s,a,n,r,t,f[1],d[1])}}return a}function W0(r,e){let t=r.geometry(),i=t.flat().map(a=>op([a.x,a.y],r.canonical));if(t.length===0)return NaN;let n=new Rn(i[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,us(i,!1,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,us(i,!1,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ls(i,!1,a.coordinates,n,o));break}if(o===0)return o}return o}function X0(r,e){let t=r.geometry(),i=t.flat().map(a=>op([a.x,a.y],r.canonical));if(t.length===0)return NaN;let n=new Rn(i[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,us(i,!0,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,us(i,!0,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ls(i,!0,a.coordinates,n,o));break}if(o===0)return o}return o}function K0(r,e){let t=r.geometry();if(t.length===0||t[0].length===0)return NaN;let i=V0(t,0).map(a=>a.map(s=>s.map(l=>op([l.x,l.y],r.canonical)))),n=new Rn(i[0][0][0][1]),o=1/0;for(let a of e)for(let s of i){switch(a.type){case"Point":o=Math.min(o,ls([a.coordinates],!1,s,n,o));break;case"LineString":o=Math.min(o,ls(a.coordinates,!0,s,n,o));break;case"Polygon":o=Math.min(o,$0(s,a.coordinates,n,o));break}if(o===0)return o}return o}function Oc(r){return r.type==="MultiPolygon"?r.coordinates.map(e=>({type:"Polygon",coordinates:e})):r.type==="MultiLineString"?r.coordinates.map(e=>({type:"LineString",coordinates:e})):r.type==="MultiPoint"?r.coordinates.map(e=>({type:"Point",coordinates:e})):[r]}var Bn=class r{constructor(e,t){this.type=q,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error("'distance' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(Ln(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new r(i,i.features.map(n=>Oc(n.geometry)).flat());if(i.type==="Feature")return new r(i,Oc(i.geometry));if("type"in i&&"coordinates"in i)return new r(i,Oc(i))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W0(e,this.geometries);if(e.geometryType()==="LineString")return X0(e,this.geometries);if(e.geometryType()==="Polygon")return K0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Qr={"==":g0,"!=":x0,">":_0,"<":b0,">=":w0,"<=":v0,array:Dt,at:Gc,boolean:Dt,case:Hc,coalesce:ns,collator:os,format:Dn,image:Xc,in:qc,"index-of":jc,interpolate:vt,"interpolate-hcl":vt,"interpolate-lab":vt,length:Kc,let:ts,literal:gr,match:Zc,number:Dt,"number-format":Wc,object:Dt,slice:$c,step:Ei,string:Dt,"to-boolean":yr,"to-color":yr,"to-number":yr,"to-string":yr,var:rs,within:Fn,distance:Bn},Vt=class r{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let i=e[0],n=r.definitions[i];if(!n)return t.error('Unknown expression "'.concat(i,'". If you wanted a literal array, use ["literal", [...]].'),0);let o=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new es(t.registry,cs,t.path,null,t.scope);let p=[],h=!1;for(let f=1;f<e.length;f++){let d=e[f],y=Array.isArray(u)?u[f-1]:u.type,g=l.parse(d,1+p.length,y);if(!g){h=!0;break}p.push(g)}if(!h){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let f=0;f<p.length;f++){let d=Array.isArray(u)?u[f]:u.type,y=p[f];l.concat(f+1).checkSubtype(d,y.type)}if(l.errors.length===0)return new r(i,o,c,p)}}if(s.length===1)t.errors.push(...l.errors);else{let c=(s.length?s:a).map(([h])=>Y0(h)).join(" | "),p=[];for(let h=1;h<e.length;h++){let f=t.parse(e[h],1+p.length);if(!f)return null;p.push(Fe(f.type))}t.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(e,t){r.definitions=t;for(let i in t)e[i]=r}};function jf(r,[e,t,i,n]){e=e.evaluate(r),t=t.evaluate(r),i=i.evaluate(r);let o=n?n.evaluate(r):1,a=lm(e,t,i,o);if(a)throw new Re(a);return new W(e/255,t/255,i/255,o,!1)}function Zf(r,e){return r in e}function Vc(r,e){let t=e[r];return typeof t>"u"?null:t}function J0(r,e,t,i){for(;t<=i;){let n=t+i>>1;if(e[n]===r)return!0;e[n]>r?i=n-1:t=n+1}return!1}function Hr(r){return{type:r}}Vt.register(Qr,{error:[Uv,[ce],(r,[e])=>{throw new Re(e.evaluate(r))}],typeof:[ce,[se],(r,[e])=>Fe(Ze(e.evaluate(r)))],"to-rgba":[_t(q,4),[Mt],(r,[e])=>{let[t,i,n,o]=e.evaluate(r).rgb;return[t*255,i*255,n*255,o]}],rgb:[Mt,[q,q,q],jf],rgba:[Mt,[q,q,q,q],jf],has:{type:ae,overloads:[[[ce],(r,[e])=>Zf(e.evaluate(r),r.properties())],[[ce,Mi],(r,[e,t])=>Zf(e.evaluate(r),t.evaluate(r))]]},get:{type:se,overloads:[[[ce],(r,[e])=>Vc(e.evaluate(r),r.properties())],[[ce,Mi],(r,[e,t])=>Vc(e.evaluate(r),t.evaluate(r))]]},"feature-state":[se,[ce],(r,[e])=>Vc(e.evaluate(r),r.featureState||{})],properties:[Mi,[],r=>r.properties()],"geometry-type":[ce,[],r=>r.geometryType()],id:[se,[],r=>r.id()],zoom:[q,[],r=>r.globals.zoom],"heatmap-density":[q,[],r=>r.globals.heatmapDensity||0],"line-progress":[q,[],r=>r.globals.lineProgress||0],accumulated:[se,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[q,Hr(q),(r,e)=>{let t=0;for(let i of e)t+=i.evaluate(r);return t}],"*":[q,Hr(q),(r,e)=>{let t=1;for(let i of e)t*=i.evaluate(r);return t}],"-":{type:q,overloads:[[[q,q],(r,[e,t])=>e.evaluate(r)-t.evaluate(r)],[[q],(r,[e])=>-e.evaluate(r)]]},"/":[q,[q,q],(r,[e,t])=>e.evaluate(r)/t.evaluate(r)],"%":[q,[q,q],(r,[e,t])=>e.evaluate(r)%t.evaluate(r)],ln2:[q,[],()=>Math.LN2],pi:[q,[],()=>Math.PI],e:[q,[],()=>Math.E],"^":[q,[q,q],(r,[e,t])=>Math.pow(e.evaluate(r),t.evaluate(r))],sqrt:[q,[q],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[q,[q],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[q,[q],(r,[e])=>Math.log(e.evaluate(r))],log2:[q,[q],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[q,[q],(r,[e])=>Math.sin(e.evaluate(r))],cos:[q,[q],(r,[e])=>Math.cos(e.evaluate(r))],tan:[q,[q],(r,[e])=>Math.tan(e.evaluate(r))],asin:[q,[q],(r,[e])=>Math.asin(e.evaluate(r))],acos:[q,[q],(r,[e])=>Math.acos(e.evaluate(r))],atan:[q,[q],(r,[e])=>Math.atan(e.evaluate(r))],min:[q,Hr(q),(r,e)=>Math.min(...e.map(t=>t.evaluate(r)))],max:[q,Hr(q),(r,e)=>Math.max(...e.map(t=>t.evaluate(r)))],abs:[q,[q],(r,[e])=>Math.abs(e.evaluate(r))],round:[q,[q],(r,[e])=>{let t=e.evaluate(r);return t<0?-Math.round(-t):Math.round(t)}],floor:[q,[q],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[q,[q],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[ae,[ce,se],(r,[e,t])=>r.properties()[e.value]===t.value],"filter-id-==":[ae,[se],(r,[e])=>r.id()===e.value],"filter-type-==":[ae,[ce],(r,[e])=>r.geometryType()===e.value],"filter-<":[ae,[ce,se],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i<n}],"filter-id-<":[ae,[se],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t<i}],"filter->":[ae,[ce,se],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i>n}],"filter-id->":[ae,[se],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t>i}],"filter-<=":[ae,[ce,se],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[ae,[se],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t<=i}],"filter->=":[ae,[ce,se],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[ae,[se],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t>=i}],"filter-has":[ae,[se],(r,[e])=>e.value in r.properties()],"filter-has-id":[ae,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[ae,[_t(ce)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[ae,[_t(se)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[ae,[ce,_t(se)],(r,[e,t])=>t.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[ae,[ce,_t(se)],(r,[e,t])=>J0(r.properties()[e.value],t.value,0,t.value.length-1)],all:{type:ae,overloads:[[[ae,ae],(r,[e,t])=>e.evaluate(r)&&t.evaluate(r)],[Hr(ae),(r,e)=>{for(let t of e)if(!t.evaluate(r))return!1;return!0}]]},any:{type:ae,overloads:[[[ae,ae],(r,[e,t])=>e.evaluate(r)||t.evaluate(r)],[Hr(ae),(r,e)=>{for(let t of e)if(t.evaluate(r))return!0;return!1}]]},"!":[ae,[ae],(r,[e])=>!e.evaluate(r)],"is-supported-script":[ae,[ce],(r,[e])=>{let t=r.globals&&r.globals.isSupportedScript;return t?t(e.evaluate(r)):!0}],upcase:[ce,[ce],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ce,[ce],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ce,Hr(se),(r,e)=>e.map(t=>Mn(t.evaluate(r))).join("")],"resolved-locale":[ce,[hs],(r,[e])=>e.evaluate(r).resolvedLocale()]});function Y0(r){return Array.isArray(r)?"(".concat(r.map(Fe).join(", "),")"):"(".concat(Fe(r.type),"...)")}function cs(r){if(r instanceof rs)return cs(r.boundExpression);if(r instanceof Vt&&r.name==="error")return!1;if(r instanceof os)return!1;if(r instanceof Fn)return!1;if(r instanceof Bn)return!1;let e=r instanceof yr||r instanceof Dt,t=!0;return r.eachChild(i=>{e?t=t&&cs(i):t=t&&i instanceof gr}),t?gs(r)&&xs(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function gs(r){if(r instanceof Vt){if(r.name==="get"&&r.args.length===1)return!1;if(r.name==="feature-state")return!1;if(r.name==="has"&&r.args.length===1)return!1;if(r.name==="properties"||r.name==="geometry-type"||r.name==="id")return!1;if(/^filter-/.test(r.name))return!1}if(r instanceof Fn||r instanceof Bn)return!1;let e=!0;return r.eachChild(t=>{e&&!gs(t)&&(e=!1)}),e}function On(r){if(r instanceof Vt&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(t=>{e&&!On(t)&&(e=!1)}),e}function xs(r,e){if(r instanceof Vt&&e.indexOf(r.name)>=0)return!1;let t=!0;return r.eachChild(i=>{t&&!xs(i,e)&&(t=!1)}),t}function rp(r){return{result:"success",value:r}}function Ai(r){return{result:"error",value:r}}function xr(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function ym(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function up(r){return!!r.expression&&r.expression.interpolated}function ge(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function bs(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Q0(r){return r}function gm(r,e){let t=e.type==="color",i=r.stops&&typeof r.stops[0][0]=="object",n=i||r.property!==void 0,o=i||!n,a=r.type||(up(e)?"exponential":"interval");if(t||e.type==="padding"){let c=t?W.parse:zt.parse;r=Ci({},r),r.stops&&(r.stops=r.stops.map(p=>[p[0],c(p[1])])),r.default?r.default=c(r.default):r.default=c(e.default)}if(r.colorSpace&&!r0(r.colorSpace))throw new Error('Unknown color space: "'.concat(r.colorSpace,'"'));let s,l,u;if(a==="exponential")s=Hf;else if(a==="interval")s=t1;else if(a==="categorical"){s=e1,l=Object.create(null);for(let c of r.stops)l[c[0]]=c[1];u=typeof r.stops[0][0]}else if(a==="identity")s=r1;else throw new Error('Unknown function type "'.concat(a,'"'));if(i){let c={},p=[];for(let d=0;d<r.stops.length;d++){let y=r.stops[d],g=y[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:r.type,property:r.property,default:r.default,stops:[]},p.push(g)),c[g].stops.push([y[0].value,y[1]])}let h=[];for(let d of p)h.push([c[d].zoom,gm(c[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:vt.interpolationFactor.bind(void 0,f),zoomStops:h.map(d=>d[0]),evaluate({zoom:d},y){return Hf({stops:h,base:r.base},e,d).evaluate(d,y)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:vt.interpolationFactor.bind(void 0,c),zoomStops:r.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(r,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let h=p&&p.properties?p.properties[r.property]:void 0;return h===void 0?qn(r.default,e.default):s(r,e,h,l,u)}}}function qn(r,e,t){if(r!==void 0)return r;if(e!==void 0)return e;if(t!==void 0)return t}function e1(r,e,t,i,n){let o=typeof t===n?i[t]:void 0;return qn(o,r.default,e.default)}function t1(r,e,t){if(ge(t)!=="number")return qn(r.default,e.default);let i=r.stops.length;if(i===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[i-1][0])return r.stops[i-1][1];let n=ds(r.stops.map(o=>o[0]),t);return r.stops[n][1]}function Hf(r,e,t){let i=r.base!==void 0?r.base:1;if(ge(t)!=="number")return qn(r.default,e.default);let n=r.stops.length;if(n===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[n-1][0])return r.stops[n-1][1];let o=ds(r.stops.map(c=>c[0]),t),a=i1(t,i,r.stops[o][0],r.stops[o+1][0]),s=r.stops[o][1],l=r.stops[o+1][1],u=Se[e.type]||Q0;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),h=l.evaluate.apply(void 0,c);if(!(p===void 0||h===void 0))return u(p,h,a,r.colorSpace)}}:u(s,l,a,r.colorSpace)}function r1(r,e,t){switch(e.type){case"color":t=W.parse(t);break;case"formatted":t=wt.fromString(t.toString());break;case"resolvedImage":t=ht.fromString(t.toString());break;case"padding":t=zt.parse(t);break;default:ge(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return qn(t,r.default,e.default)}function i1(r,e,t,i){let n=i-t,o=r-t;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}var Kr=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Qa,this._defaultValue=t?o1(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,o,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new Re("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function ei(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Qr}function cp(r,e){let t=new es(Qr,cs,[],e?n1(e):void 0),i=t.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?rp(new Kr(i,e)):Ai(t.errors)}var br=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!On(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,a)}evaluate(e,t,i,n,o,a){return this._styleExpression.evaluate(e,t,i,n,o,a)}},_r=class{constructor(e,t,i,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!On(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,a)}evaluate(e,t,i,n,o,a){return this._styleExpression.evaluate(e,t,i,n,o,a)}interpolationFactor(e,t,i){return this.interpolationType?vt.interpolationFactor(this.interpolationType,e,t,i):0}};function xm(r,e){let t=cp(r,e);if(t.result==="error")return t;let i=t.value.expression,n=gs(i);if(!n&&!xr(e))return Ai([new Tt("","data expressions not supported")]);let o=xs(i,["zoom"]);if(!o&&!ym(e))return Ai([new Tt("","zoom expressions not supported")]);let a=Ya(i);if(!a&&!o)return Ai([new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Tt)return Ai([a]);if(a instanceof vt&&!up(e))return Ai([new Tt("",'"interpolate" expressions cannot be used with this property')]);if(!a)return rp(n?new br("constant",t.value):new br("source",t.value));let s=a instanceof vt?a.interpolation:void 0;return rp(n?new _r("camera",t.value,a.labels,s):new _r("composite",t.value,a.labels,s))}var Vn=class r{constructor(e,t){this._parameters=e,this._specification=t,Ci(this,gm(this._parameters,this._specification))}static deserialize(e){return new r(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function bm(r,e){if(bs(r))return new Vn(r,e);if(ei(r)){let t=xm(r,e);if(t.result==="error")throw new Error(t.value.map(i=>"".concat(i.key,": ").concat(i.message)).join(", "));return t.value}else{let t=r;return e.type==="color"&&typeof r=="string"?t=W.parse(r):e.type==="padding"&&(typeof r=="number"||Array.isArray(r))?t=zt.parse(r):e.type==="variableAnchorOffsetCollection"&&Array.isArray(r)&&(t=tr.parse(r)),{kind:"constant",evaluate:()=>t}}}function Ya(r){let e=null;if(r instanceof ts)e=Ya(r.result);else if(r instanceof ns){for(let t of r.args)if(e=Ya(t),e)break}else(r instanceof Ei||r instanceof vt)&&r.input instanceof Vt&&r.input.name==="zoom"&&(e=r);return e instanceof Tt||r.eachChild(t=>{let i=Ya(t);i instanceof Tt?e=i:!e&&i?e=new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function n1(r){let e={color:Mt,string:ce,number:q,enum:ce,boolean:ae,formatted:Di,padding:fs,resolvedImage:Nn,variableAnchorOffsetCollection:ms};return r.type==="array"?_t(e[r.value]||se,r.length):e[r.type]}function o1(r){return r.type==="color"&&bs(r.default)?new W(0,0,0,0):r.type==="color"?W.parse(r.default)||null:r.type==="padding"?zt.parse(r.default)||null:r.type==="variableAnchorOffsetCollection"?tr.parse(r.default)||null:r.default===void 0?null:r.default}function pp(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(let e of r.slice(1))if(!pp(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var a1={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function jn(r){if(r==null)return{filter:()=>!0,needGeometry:!1};pp(r)||(r=ps(r));let e=cp(r,a1);if(e.result==="error")throw new Error(e.value.map(t=>"".concat(t.key,": ").concat(t.message)).join(", "));{let t=_m(r);return{filter:(i,n,o)=>e.value.evaluate(i,n,{},o),needGeometry:t}}}function s1(r,e){return r<e?-1:r>e?1:0}function _m(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(_m(r[e]))return!0;return!1}function ps(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?Uc(r[1],r[2],"=="):e==="!="?Ja(Uc(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Uc(r[1],r[2],e):e==="any"?l1(r.slice(1)):e==="all"?["all"].concat(r.slice(1).map(ps)):e==="none"?["all"].concat(r.slice(1).map(ps).map(Ja)):e==="in"?$f(r[1],r.slice(2)):e==="!in"?Ja($f(r[1],r.slice(2))):e==="has"?Wf(r[1]):e==="!has"?Ja(Wf(r[1])):!0}function Uc(r,e,t){switch(r){case"$type":return["filter-type-".concat(t),e];case"$id":return["filter-id-".concat(t),e];default:return["filter-".concat(t),r,e]}}function l1(r){return["any"].concat(r.map(ps))}function $f(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",r,["literal",e.sort(s1)]]:["filter-in-small",r,["literal",e]]}}function Wf(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Ja(r){return["!",r]}function vm(){let r={},e=A.$version;for(let t in A.$root){let i=A.$root[t];if(i.required){let n=null;t==="version"?n=e:i.type==="array"?n=[]:n={},n!=null&&(r[t]=n)}}return r}function wm(r){let e=r.key,t=r.value;return t?[new R(e,t,"constants have been deprecated as of v8")]:[]}function Ve(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Jr(r){if(Array.isArray(r))return r.map(Jr);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let t in r)e[t]=Jr(r[t]);return e}return Ve(r)}function At(r){let e=r.key,t=r.value,i=r.valueSpec||{},n=r.objectElementValidators||{},o=r.style,a=r.styleSpec,s=r.validateSpec,l=[],u=ge(t);if(u!=="object")return[new R(e,t,"object expected, ".concat(u," found"))];for(let c in t){let p=c.split(".")[0],h=i[p]||i["*"],f;if(n[p])f=n[p];else if(i[p])f=s;else if(n["*"])f=n["*"];else if(i["*"])f=s;else{l.push(new R(e,t[c],'unknown property "'.concat(c,'"')));continue}l=l.concat(f({key:(e&&"".concat(e,"."))+c,value:t[c],valueSpec:h,style:o,styleSpec:a,object:t,objectKey:c,validateSpec:s},t))}for(let c in i)n[c]||i[c].required&&i[c].default===void 0&&t[c]===void 0&&l.push(new R(e,t,'missing required property "'.concat(c,'"')));return l}function hp(r){let e=r.value,t=r.valueSpec,i=r.validateSpec,n=r.style,o=r.styleSpec,a=r.key,s=r.arrayElementValidator||i;if(ge(e)!=="array")return[new R(a,e,"array expected, ".concat(ge(e)," found"))];if(t.length&&e.length!==t.length)return[new R(a,e,"array length ".concat(t.length," expected, length ").concat(e.length," found"))];if(t["min-length"]&&e.length<t["min-length"])return[new R(a,e,"array length at least ".concat(t["min-length"]," expected, length ").concat(e.length," found"))];let l={type:t.value,values:t.values};o.$version<7&&(l.function=t.function),ge(t.value)==="object"&&(l=t.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:r.validateSpec,style:n,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function fp(r){let e=r.key,t=r.value,i=r.valueSpec,n=ge(t);return n==="number"&&t!==t&&(n="NaN"),n!=="number"?[new R(e,t,"number expected, ".concat(n," found"))]:"minimum"in i&&t<i.minimum?[new R(e,t,"".concat(t," is less than the minimum value ").concat(i.minimum))]:"maximum"in i&&t>i.maximum?[new R(e,t,"".concat(t," is greater than the maximum value ").concat(i.maximum))]:[]}function Sm(r){let e=r.valueSpec,t=Ve(r.value.type),i,n={},o,a,s=t!=="categorical"&&r.value.property===void 0,l=!s,u=ge(r.value.stops)==="array"&&ge(r.value.stops[0])==="array"&&ge(r.value.stops[0][0])==="object",c=At({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:p,default:d}});return t==="identity"&&s&&c.push(new R(r.key,r.value,'missing required property "property"')),t!=="identity"&&!r.value.stops&&c.push(new R(r.key,r.value,'missing required property "stops"')),t==="exponential"&&r.valueSpec.expression&&!up(r.valueSpec)&&c.push(new R(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(l&&!xr(r.valueSpec)?c.push(new R(r.key,r.value,"property functions not supported")):s&&!ym(r.valueSpec)&&c.push(new R(r.key,r.value,"zoom functions not supported"))),(t==="categorical"||u)&&r.value.property===void 0&&c.push(new R(r.key,r.value,'"property" property is required')),c;function p(y){if(t==="identity")return[new R(y.key,y.value,'identity function may not have a "stops" property')];let g=[],x=y.value;return g=g.concat(hp({key:y.key,value:x,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:h})),ge(x)==="array"&&x.length===0&&g.push(new R(y.key,x,"array must have at least one stop")),g}function h(y){let g=[],x=y.value,v=y.key;if(ge(x)!=="array")return[new R(v,x,"array expected, ".concat(ge(x)," found"))];if(x.length!==2)return[new R(v,x,"array length 2 expected, length ".concat(x.length," found"))];if(u){if(ge(x[0])!=="object")return[new R(v,x,"object expected, ".concat(ge(x[0])," found"))];if(x[0].zoom===void 0)return[new R(v,x,"object stop key must have zoom")];if(x[0].value===void 0)return[new R(v,x,"object stop key must have value")];if(a&&a>Ve(x[0].zoom))return[new R(v,x[0].zoom,"stop zoom values must appear in ascending order")];Ve(x[0].zoom)!==a&&(a=Ve(x[0].zoom),o=void 0,n={}),g=g.concat(At({key:"".concat(v,"[0]"),value:x[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:fp,value:f}}))}else g=g.concat(f({key:"".concat(v,"[0]"),value:x[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},x));return ei(Jr(x[1]))?g.concat([new R("".concat(v,"[1]"),x[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:"".concat(v,"[1]"),value:x[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,g){let x=ge(y.value),v=Ve(y.value),b=y.value!==null?y.value:g;if(!i)i=x;else if(x!==i)return[new R(y.key,b,"".concat(x," stop domain type must match previous stop domain type ").concat(i))];if(x!=="number"&&x!=="string"&&x!=="boolean")return[new R(y.key,b,"stop domain value must be a number, string, or boolean")];if(x!=="number"&&t!=="categorical"){let w="number expected, ".concat(x," found");return xr(e)&&t===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new R(y.key,b,w)]}return t==="categorical"&&x==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new R(y.key,b,"integer expected, found ".concat(v))]:t!=="categorical"&&x==="number"&&o!==void 0&&v<o?[new R(y.key,b,"stop domain values must appear in ascending order")]:(o=v,t==="categorical"&&v in n?[new R(y.key,b,"stop domain values must be unique")]:(n[v]=!0,[]))}function d(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function ki(r){let e=(r.expressionContext==="property"?xm:cp)(Jr(r.value),r.valueSpec);if(e.result==="error")return e.value.map(i=>new R("".concat(r.key).concat(i.key),r.value,i.message));let t=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!t.outputDefined())return[new R(r.key,r.value,'Invalid data expression for "'.concat(r.propertyKey,'". Output values must be contained as literals within the expression.'))];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!On(t))return[new R(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!On(t))return[new R(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!xs(t,["zoom","feature-state"]))return[new R(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!gs(t))return[new R(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function u1(r){let e=r.value,t=r.key,i=ge(e);return i!=="boolean"?[new R(t,e,"boolean expected, ".concat(i," found"))]:[]}function c1(r){let e=r.key,t=r.value,i=ge(t);return i!=="string"?[new R(e,t,"color expected, ".concat(i," found"))]:W.parse(String(t))?[]:[new R(e,t,'color expected, "'.concat(t,'" found'))]}function Un(r){let e=r.key,t=r.value,i=r.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Ve(t))===-1&&n.push(new R(e,t,"expected one of [".concat(i.values.join(", "),"], ").concat(JSON.stringify(t)," found"))):Object.keys(i.values).indexOf(Ve(t))===-1&&n.push(new R(e,t,"expected one of [".concat(Object.keys(i.values).join(", "),"], ").concat(JSON.stringify(t)," found"))),n}function mp(r){return pp(Jr(r.value))?ki(Ci({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Pm(r)}function Pm(r){let e=r.value,t=r.key;if(ge(e)!=="array")return[new R(t,e,"array expected, ".concat(ge(e)," found"))];let i=r.styleSpec,n,o=[];if(e.length<1)return[new R(t,e,"filter array must have at least 1 element")];switch(o=o.concat(Un({key:"".concat(t,"[0]"),value:e[0],valueSpec:i.filter_operator,style:r.style,styleSpec:r.styleSpec})),Ve(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ve(e[1])==="$type"&&o.push(new R(t,e,'"$type" cannot be use with operator "'.concat(e[0],'"')));case"==":case"!=":e.length!==3&&o.push(new R(t,e,'filter array for operator "'.concat(e[0],'" must have 3 elements')));case"in":case"!in":e.length>=2&&(n=ge(e[1]),n!=="string"&&o.push(new R("".concat(t,"[1]"),e[1],"string expected, ".concat(n," found"))));for(let a=2;a<e.length;a++)n=ge(e[a]),Ve(e[1])==="$type"?o=o.concat(Un({key:"".concat(t,"[").concat(a,"]"),value:e[a],valueSpec:i.geometry_type,style:r.style,styleSpec:r.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&o.push(new R("".concat(t,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(n," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(Pm({key:"".concat(t,"[").concat(a,"]"),value:e[a],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":n=ge(e[1]),e.length!==2?o.push(new R(t,e,'filter array for "'.concat(e[0],'" operator must have 2 elements'))):n!=="string"&&o.push(new R("".concat(t,"[1]"),e[1],"string expected, ".concat(n," found")));break}return o}function Tm(r,e){let t=r.key,i=r.validateSpec,n=r.style,o=r.styleSpec,a=r.value,s=r.objectKey,l=o["".concat(e,"_").concat(r.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:t,value:a,valueSpec:o.transition,style:n,styleSpec:o});let c=r.valueSpec||l[s];if(!c)return[new R(t,a,'unknown property "'.concat(s,'"'))];let p;if(ge(a)==="string"&&xr(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new R(t,a,'"'.concat(s,'" does not support interpolation syntax\n')+'Use an identity property function instead: `{ "type": "identity", "property": '.concat(JSON.stringify(p[1])," }`."))];let h=[];return r.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&h.push(new R(t,a,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&bs(Jr(a))&&Ve(a.type)==="identity"&&h.push(new R(t,a,'"text-font" does not support identity functions'))),h.concat(i({key:r.key,value:a,valueSpec:c,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Am(r){return Tm(r,"paint")}function Mm(r){return Tm(r,"layout")}function Im(r){let e=[],t=r.value,i=r.key,n=r.style,o=r.styleSpec;!t.type&&!t.ref&&e.push(new R(i,t,'either "type" or "ref" is required'));let a=Ve(t.type),s=Ve(t.ref);if(t.id){let l=Ve(t.id);for(let u=0;u<r.arrayIndex;u++){let c=n.layers[u];Ve(c.id)===l&&e.push(new R(i,t.id,'duplicate layer id "'.concat(t.id,'", previously used at line ').concat(c.id.__line__)))}}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(u=>{u in t&&e.push(new R(i,t[u],'"'.concat(u,'" is prohibited for ref layers')))});let l;n.layers.forEach(u=>{Ve(u.id)===s&&(l=u)}),l?l.ref?e.push(new R(i,t.ref,"ref cannot reference another ref layer")):a=Ve(l.type):e.push(new R(i,t.ref,'ref layer "'.concat(s,'" not found')))}else if(a!=="background")if(!t.source)e.push(new R(i,t,'missing required property "source"'));else{let l=n.sources&&n.sources[t.source],u=l&&Ve(l.type);l?u==="vector"&&a==="raster"?e.push(new R(i,t.source,'layer "'.concat(t.id,'" requires a raster source'))):u!=="raster-dem"&&a==="hillshade"?e.push(new R(i,t.source,'layer "'.concat(t.id,'" requires a raster-dem source'))):u==="raster"&&a!=="raster"?e.push(new R(i,t.source,'layer "'.concat(t.id,'" requires a vector source'))):u==="vector"&&!t["source-layer"]?e.push(new R(i,t,'layer "'.concat(t.id,'" must specify a "source-layer"'))):u==="raster-dem"&&a!=="hillshade"?e.push(new R(i,t.source,"raster-dem source can only be used with layer type 'hillshade'.")):a==="line"&&t.paint&&t.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new R(i,t,'layer "'.concat(t.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):e.push(new R(i,t.source,'source "'.concat(t.source,'" not found')))}return e=e.concat(At({key:i,value:t,valueSpec:o.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*"(){return[]},type(){return r.validateSpec({key:"".concat(i,".type"),value:t.type,valueSpec:o.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:t,objectKey:"type"})},filter:mp,layout(l){return At({layer:t,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Mm(Ci({layerType:a},u))}}})},paint(l){return At({layer:t,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Am(Ci({layerType:a},u))}}})}}})),e}function Yr(r){let e=r.value,t=r.key,i=ge(e);return i!=="string"?[new R(t,e,"string expected, ".concat(i," found"))]:[]}function p1(r){var e;let t=(e=r.sourceName)!==null&&e!==void 0?e:"",i=r.value,n=r.styleSpec,o=n.source_raster_dem,a=r.style,s=[],l=ge(i);if(i===void 0)return s;if(l!=="object")return s.push(new R("source_raster_dem",i,"object expected, ".concat(l," found"))),s;let c=Ve(i.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],h=r.value.encoding?'"'.concat(r.value.encoding,'"'):"Default";for(let f in i)!c&&p.includes(f)?s.push(new R(f,i[f],'In "'.concat(t,'": "').concat(f,'" is only valid when "encoding" is set to "custom". ').concat(h," encoding found"))):o[f]?s=s.concat(r.validateSpec({key:f,value:i[f],valueSpec:o[f],validateSpec:r.validateSpec,style:a,styleSpec:n})):s.push(new R(f,i[f],'unknown property "'.concat(f,'"')));return s}var Xf={promoteId:h1};function Cm(r){let e=r.value,t=r.key,i=r.styleSpec,n=r.style,o=r.validateSpec;if(!e.type)return[new R(t,e,'"type" is required')];let a=Ve(e.type),s;switch(a){case"vector":case"raster":return s=At({key:t,value:e,valueSpec:i["source_".concat(a.replace("-","_"))],style:r.style,styleSpec:i,objectElementValidators:Xf,validateSpec:o}),s;case"raster-dem":return s=p1({sourceName:t,value:e,style:r.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=At({key:t,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:Xf}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...ki({key:"".concat(t,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...ki({key:"".concat(t,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return At({key:t,value:e,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return At({key:t,value:e,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new R(t,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Un({key:"".concat(t,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:i})}}function h1({key:r,value:e}){if(ge(e)==="string")return Yr({key:r,value:e});{let t=[];for(let i in e)t.push(...Yr({key:"".concat(r,".").concat(i),value:e[i]}));return t}}function Em(r){let e=r.value,t=r.styleSpec,i=t.light,n=r.style,o=[],a=ge(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new R("light",e,"object expected, ".concat(a," found"))]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&i[l[1]]&&i[l[1]].transition?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:t.transition,validateSpec:r.validateSpec,style:n,styleSpec:t})):i[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:r.validateSpec,style:n,styleSpec:t})):o=o.concat([new R(s,e[s],'unknown property "'.concat(s,'"'))])}return o}function km(r){let e=r.value,t=r.styleSpec,i=t.sky,n=r.style,o=ge(e);if(e===void 0)return[];if(o!=="object")return[new R("sky",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)i[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:t})):a=a.concat([new R(s,e[s],'unknown property "'.concat(s,'"'))]);return a}function Lm(r){let e=r.value,t=r.styleSpec,i=t.terrain,n=r.style,o=[],a=ge(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new R("terrain",e,"object expected, ".concat(a," found"))]),o;for(let s in e)i[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:r.validateSpec,style:n,styleSpec:t})):o=o.concat([new R(s,e[s],'unknown property "'.concat(s,'"'))]);return o}function f1(r){return Yr(r).length===0?[]:ki(r)}function m1(r){return Yr(r).length===0?[]:ki(r)}function d1(r){let e=r.key,t=r.value;if(ge(t)==="array"){if(t.length<1||t.length>4)return[new R(e,t,"padding requires 1 to 4 values; ".concat(t.length," values found"))];let n={type:"number"},o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:t[a],validateSpec:r.validateSpec,valueSpec:n}));return o}else return fp({key:e,value:t,valueSpec:{}})}function y1(r){let e=r.key,t=r.value,i=ge(t),n=r.styleSpec;if(i!=="array"||t.length<1||t.length%2!==0)return[new R(e,t,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<t.length;a+=2)o=o.concat(Un({key:"".concat(e,"[").concat(a,"]"),value:t[a],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(hp({key:"".concat(e,"[").concat(a+1,"]"),value:t[a+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:n}));return o}function Dm(r){let e=[],t=r.value,i=r.key;if(Array.isArray(t)){let n=[],o=[];for(let a in t){t[a].id&&n.includes(t[a].id)&&e.push(new R(i,t,"all the sprites' ids must be unique, but ".concat(t[a].id," is duplicated"))),n.push(t[a].id),t[a].url&&o.includes(t[a].url)&&e.push(new R(i,t,"all the sprites' URLs must be unique, but ".concat(t[a].url," is duplicated"))),o.push(t[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(At({key:"".concat(i,"[").concat(a,"]"),value:t[a],valueSpec:s,validateSpec:r.validateSpec}))}return e}else return Yr({key:i,value:t})}function g1(r){let e=r.value,t=r.styleSpec,i=t.projection,n=r.style,o=ge(e);if(e===void 0)return[];if(o!=="object")return[new R("projection",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)i[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:t})):a=a.concat([new R(s,e[s],'unknown property "'.concat(s,'"'))]);return a}var Kf={"*"(){return[]},array:hp,boolean:u1,number:fp,color:c1,constants:wm,enum:Un,filter:mp,function:Sm,layer:Im,object:At,source:Cm,light:Em,sky:km,terrain:Lm,projection:g1,string:Yr,formatted:f1,resolvedImage:m1,padding:d1,variableAnchorOffsetCollection:y1,sprite:Dm};function In(r){let e=r.value,t=r.valueSpec,i=r.styleSpec;return r.validateSpec=In,t.expression&&bs(Ve(e))?Sm(r):t.expression&&ei(Jr(e))?ki(r):t.type&&Kf[t.type]?Kf[t.type](r):At(Ci({},r,{valueSpec:t.type?i[t.type]:t}))}function zm(r){let e=r.value,t=r.key,i=Yr(r);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new R(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&i.push(new R(t,e,'"glyphs" url must include a "{range}" token'))),i}function It(r,e=A){let t=[];return t=t.concat(In({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:In,objectElementValidators:{glyphs:zm,"*"(){return[]}}})),r.constants&&(t=t.concat(wm({key:"constants",value:r.constants,style:r,styleSpec:e,validateSpec:In}))),Fm(t)}It.source=Nt(Ut(Cm));It.sprite=Nt(Ut(Dm));It.glyphs=Nt(Ut(zm));It.light=Nt(Ut(Em));It.sky=Nt(Ut(km));It.terrain=Nt(Ut(Lm));It.layer=Nt(Ut(Im));It.filter=Nt(Ut(mp));It.paintProperty=Nt(Ut(Am));It.layoutProperty=Nt(Ut(Mm));function Ut(r){return function(e){return r(Gr(Bt({},e),{validateSpec:In}))}}function Fm(r){return[].concat(r).sort((e,t)=>e.line-t.line)}function Nt(r){return function(...e){return Fm(r.apply(this,e))}}m();var Ue=It,GI=Ue.source,Rm=Ue.light,qI=Ue.terrain,jI=Ue.filter,Bm=Ue.paintProperty,Om=Ue.layoutProperty;function Ri(r,e){let t=!1;if(e&&e.length)for(let i of e)r.fire(new Z(new Error(i.message))),t=!0;return t}m();m();m();var ti=class r{constructor(e,t,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],i=a[2],this.d=t+2*i;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];n.push(c===p?null:a.subarray(c,p))}let s=a[3+n.length],l=a[3+n.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let a=0;a<this.d*this.d;a++)n.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;let o=i/t*e;this.min=-o,this.max=e+o}insert(e,t,i,n,o){this._forEachCell(t,i,n,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,n,o,a){this.cells[o].push(a)}query(e,t,i,n,o){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=i&&s<=n&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,t,i,n,this._queryCell,l,u,o),l}}_queryCell(e,t,i,n,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let h=0;h<u.length;h++){let f=u[h];if(s[f]===void 0){let d=f*4;(l?l(p[d+0],p[d+1],p[d+2],p[d+3]):e<=p[d+2]&&t<=p[d+3]&&i>=p[d+0]&&n>=p[d+1])?(s[f]=!0,a.push(c[f])):s[f]=!1}}}}_forEachCell(e,t,i,n,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(t),p=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let f=u;f<=p;f++)for(let d=c;d<=h;d++){let y=this.d*d+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&o.call(this,e,t,i,n,y,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,i=0;for(let a=0;a<this.cells.length;a++)i+=this.cells[a].length;let n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let o=t;for(let a=0;a<e.length;a++){let s=e[a];n[3+a]=o,n.set(s,o),o+=s.length}return n[3+e.length]=o,n.set(this.keys,o),o+=this.keys.length,n[3+e.length+1]=o,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer}static serialize(e,t){let i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new r(e.buffer)}};var vr={};function U(r,e,t={}){if(vr[r])throw new Error("".concat(r," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),vr[r]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}U("Object",Object);U("TransferableGridIndex",ti);U("Color",W);U("Error",Error);U("AJAXError",jr);U("ResolvedImage",ht);U("StylePropertyFunction",Vn);U("StyleExpression",Kr,{omit:["_evaluator"]});U("ZoomDependentExpression",_r);U("ZoomConstantExpression",br);U("CompoundExpression",Vt,{omit:["_evaluate"]});for(let r in Qr)Qr[r]._classRegistryKey||U("Expression_".concat(r),Qr[r]);function Vm(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Bi(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error)return r;if(Vm(r)||pt(r))return e&&e.push(r),r;if(ArrayBuffer.isView(r)){let t=r;return e&&e.push(t.buffer),t}if(r instanceof ImageData)return e&&e.push(r.data.buffer),r;if(Array.isArray(r)){let t=[];for(let i of r)t.push(Bi(i,e));return t}if(typeof r=="object"){let t=r.constructor,i=t._classRegistryKey;if(!i)throw new Error("can't serialize object of unregistered class ".concat(t.name));if(!vr[i])throw new Error("".concat(i," is not registered."));let n=t.serialize?t.serialize(r,e):{};if(t.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let o in r){if(!r.hasOwnProperty(o)||vr[i].omit.indexOf(o)>=0)continue;let a=r[o];n[o]=vr[i].shallow.indexOf(o)>=0?a:Bi(a,e)}r instanceof Error&&(n.message=r.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}throw new Error("can't serialize object of type ".concat(typeof r))}function Oi(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Vm(r)||pt(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Oi);if(typeof r=="object"){let e=r.$name||"Object";if(!vr[e])throw new Error("can't deserialize unregistered class ".concat(e));let{klass:t}=vr[e];if(!t)throw new Error("can't deserialize unregistered class ".concat(e));if(t.deserialize)return t.deserialize(r);let i=Object.create(t.prototype);for(let n of Object.keys(r)){if(n==="$name")continue;let o=r[n];i[n]=vr[e].shallow.indexOf(n)>=0?o:Oi(o)}return i}throw new Error("can't deserialize object of type ".concat(typeof r))}m();m();var Vi=class{constructor(){this.first=!0}update(e,t){let i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=i,!0):!1)}};m();m();var pe={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function dp(r){for(let e of r)if(Um(e.charCodeAt(0)))return!0;return!1}function Um(r){return r===746||r===747?!0:r<4352?!1:!!(pe["Bopomofo Extended"](r)||pe.Bopomofo(r)||pe["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||pe["CJK Compatibility Ideographs"](r)||pe["CJK Compatibility"](r)||pe["CJK Radicals Supplement"](r)||pe["CJK Strokes"](r)||pe["CJK Symbols and Punctuation"](r)&&!(r>=12296&&r<=12305)&&!(r>=12308&&r<=12319)&&r!==12336||pe["CJK Unified Ideographs Extension A"](r)||pe["CJK Unified Ideographs"](r)||pe["Enclosed CJK Letters and Months"](r)||pe["Hangul Compatibility Jamo"](r)||pe["Hangul Jamo Extended-A"](r)||pe["Hangul Jamo Extended-B"](r)||pe["Hangul Jamo"](r)||pe["Hangul Syllables"](r)||pe.Hiragana(r)||pe["Ideographic Description Characters"](r)||pe.Kanbun(r)||pe["Kangxi Radicals"](r)||pe["Katakana Phonetic Extensions"](r)||pe.Katakana(r)&&r!==12540||pe["Halfwidth and Fullwidth Forms"](r)&&r!==65288&&r!==65289&&r!==65293&&!(r>=65306&&r<=65310)&&r!==65339&&r!==65341&&r!==65343&&!(r>=65371&&r<=65503)&&r!==65507&&!(r>=65512&&r<=65519)||pe["Small Form Variants"](r)&&!(r>=65112&&r<=65118)&&!(r>=65123&&r<=65126)||pe["Unified Canadian Aboriginal Syllabics"](r)||pe["Unified Canadian Aboriginal Syllabics Extended"](r)||pe["Vertical Forms"](r)||pe["Yijing Hexagram Symbols"](r)||pe["Yi Syllables"](r)||pe["Yi Radicals"](r))}function Nm(r){return r>=1424&&r<=2303||pe["Arabic Presentation Forms-A"](r)||pe["Arabic Presentation Forms-B"](r)}function x1(r,e){return!(!e&&Nm(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||pe.Khmer(r))}function Gm(r){for(let e of r)if(Nm(e.charCodeAt(0)))return!0;return!1}function qm(r,e){for(let t of r)if(!x1(t.charCodeAt(0),e))return!1;return!0}m();var yp=class{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}},ir=new yp;var de=class{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Vi,this.transition={})}isSupportedScript(e){return qm(e,ir.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}};var Ui=class{constructor(e,t){this.property=e,this.value=t,this.expression=bm(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}},Zn=class{constructor(e){this.property=e,this.value=new Ui(e,void 0)}transitioned(e,t){return new _s(this.property,this.value,t,O({},e.transition,this.transition),e.now)}untransitioned(){return new _s(this.property,this.value,null,{},0)}},Ni=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return ct(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zn(this._values[e].property)),this._values[e].value=new Ui(this._values[e].property,t===null?void 0:ct(t))}getTransition(e){return ct(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zn(this._values[e].property)),this._values[e].transition=ct(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i);let n=this.getTransition(t);n!==void 0&&(e["".concat(t,"-transition")]=n)}return e}transitioned(e,t){let i=new vs(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){let e=new vs(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},_s=class{constructor(e,t,i,n,o){this.property=e,this.value=t,this.begin=o+n.delay||0,this.end=this.begin+n.duration||0,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let n=e.now||0,o=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(n>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return a.possiblyEvaluate(e,t,i);{let s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),o,lf(s))}}else return o}},vs=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let n=new wr(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i);return n}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},ws=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return ct(this._values[e].value)}setValue(e,t){this._values[e]=new Ui(this._values[e].property,t===null?void 0:ct(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let n=new wr(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i);return n}},ot=class{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,i,n){return this.property.evaluate(this.value,this.parameters,e,t,i,n)}},wr=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},j=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let n=this.specification.type,o=Se[n];return o?o(e,t,i):e}},H=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,n){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ot(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,n)},t):new ot(this,e.expression,t)}interpolate(e,t,i){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new ot(this,{kind:"constant",value:void 0},e.parameters);let n=this.specification.type,o=Se[n];if(o){let a=o(e.value.value,t.value.value,i);return new ot(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,i,n,o,a){return e.kind==="constant"?e.value:e.evaluate(t,i,n,o,a)}},nr=class extends H{possiblyEvaluate(e,t,i,n){if(e.value===void 0)return new ot(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},i,n),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,t);return new ot(this,{kind:"constant",value:l},t)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new ot(this,{kind:"constant",value:o},t)}else return new ot(this,e.expression,t)}evaluate(e,t,i,n,o,a){if(e.kind==="source"){let s=e.evaluate(t,i,n,o,a);return this._calculate(s,s,s,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,n),e.evaluate({zoom:Math.floor(t.zoom)},i,n),e.evaluate({zoom:Math.floor(t.zoom)+1},i,n),t):e.value}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},ri=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},i,n);return this._calculate(o,o,o,t)}else return this._calculate(e.expression.evaluate(new de(Math.floor(t.zoom-1),t)),e.expression.evaluate(new de(Math.floor(t.zoom),t)),e.expression.evaluate(new de(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},ii=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){return!!e.expression.evaluate(t,null,{},i,n)}interpolate(){return!1}},Le=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let i=e[t];i.specification.overridable&&this.overridableProperties.push(t);let n=this.defaultPropertyValues[t]=new Ui(i,void 0),o=this.defaultTransitionablePropertyValues[t]=new Zn(i);this.defaultTransitioningPropertyValues[t]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=n.possiblyEvaluate({})}}};U("DataDrivenProperty",H);U("DataConstantProperty",j);U("CrossFadedDataDrivenProperty",nr);U("CrossFadedProperty",ri);U("ColorRampProperty",ii);var Ss="-transition",Ne=class extends me{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new ws(t.layout)),t.paint)){this._transitionablePaint=new Ni(t.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new wr(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){if(t!=null){let n="layers.".concat(this.id,".layout.").concat(e);if(this._validate(Om,n,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(Ss)?this._transitionablePaint.getTransition(e.slice(0,-Ss.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let n="layers.".concat(this.id,".paint.").concat(e);if(this._validate(Bm,n,e,t,i))return!1}if(e.endsWith(Ss))return this._transitionablePaint.setTransition(e.slice(0,-Ss.length),t||void 0),!1;{let n=this._transitionablePaint._values[e],o=n.property.specification["property-type"]==="cross-faded-data-driven",a=n.value.isDataDriven(),s=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,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()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Na(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,n,o={}){return o&&o.validate===!1?!1:Ri(this,e.call(Ue,{key:t,layerType:this.type,objectKey:i,value:n,styleSpec:A,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(!(!(t instanceof ot)||!xr(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}};m();m();m();var b1={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Sr=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},_1=128,v1=5,De=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*v1),_1),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function be(r,e=1){let t=0,i=0,n=r.map(a=>{let s=w1(a.type),l=t=jm(t,Math.max(e,s)),u=a.components||1;return i=Math.max(i,s),t+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=jm(t,Math.max(i,e));return{members:n,size:o,alignment:e}}function w1(r){return b1[r].BYTES_PER_ELEMENT}function jm(r,e){return Math.ceil(r/e)*e}var Zm=oe(ye(),1),ni=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let n=e*2;return this.int16[n+0]=t,this.int16[n+1]=i,e}};ni.prototype.bytesPerElement=4;U("StructArrayLayout2i4",ni);var Gi=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,e}};Gi.prototype.bytesPerElement=6;U("StructArrayLayout3i6",Gi);var Hn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=o,e}};Hn.prototype.bytesPerElement=8;U("StructArrayLayout4i8",Hn);var $n=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let l=e*6;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};$n.prototype.bytesPerElement=12;U("StructArrayLayout2i4i12",$n);var Wn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[u+4]=n,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};Wn.prototype.bytesPerElement=8;U("StructArrayLayout2i4ub8",Wn);var Pr=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let n=e*2;return this.float32[n+0]=t,this.float32[n+1]=i,e}};Pr.prototype.bytesPerElement=8;U("StructArrayLayout2f8",Pr);var Xn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,n,o,a,s,l,u,c)}emplace(e,t,i,n,o,a,s,l,u,c,p){let h=e*10;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=o,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=l,this.uint16[h+7]=u,this.uint16[h+8]=c,this.uint16[h+9]=p,e}};Xn.prototype.bytesPerElement=20;U("StructArrayLayout10ui20",Xn);var Kn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u,c,p,h){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,i,n,o,a,s,l,u,c,p,h)}emplace(e,t,i,n,o,a,s,l,u,c,p,h,f){let d=e*12;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=n,this.int16[d+3]=o,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=l,this.uint16[d+7]=u,this.int16[d+8]=c,this.int16[d+9]=p,this.int16[d+10]=h,this.int16[d+11]=f,e}};Kn.prototype.bytesPerElement=24;U("StructArrayLayout4i4ui4i24",Kn);var Jn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,e}};Jn.prototype.bytesPerElement=12;U("StructArrayLayout3f12",Jn);var Yn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint32[i+0]=t,e}};Yn.prototype.bytesPerElement=4;U("StructArrayLayout1ul4",Yn);var Qn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,n,o,a,s,l,u)}emplace(e,t,i,n,o,a,s,l,u,c){let p=e*10,h=e*5;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[h+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Qn.prototype.bytesPerElement=20;U("StructArrayLayout6i1ul2ui20",Qn);var eo=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let l=e*6;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};eo.prototype.bytesPerElement=12;U("StructArrayLayout2i2i2i12",eo);var to=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,o)}emplace(e,t,i,n,o,a){let s=e*4,l=e*8;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[l+6]=o,this.int16[l+7]=a,e}};to.prototype.bytesPerElement=16;U("StructArrayLayout2f1f2i16",to);var ro=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*12,s=e*3;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[s+1]=n,this.float32[s+2]=o,e}};ro.prototype.bytesPerElement=12;U("StructArrayLayout2ub2f12",ro);var qi=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=n,e}};qi.prototype.bytesPerElement=6;U("StructArrayLayout3ui6",qi);var io=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x){let v=this.length;return this.resize(v+1),this.emplace(v,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x)}emplace(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v){let b=e*24,w=e*12,S=e*48;return this.int16[b+0]=t,this.int16[b+1]=i,this.uint16[b+2]=n,this.uint16[b+3]=o,this.uint32[w+2]=a,this.uint32[w+3]=s,this.uint32[w+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[w+7]=h,this.float32[w+8]=f,this.uint8[S+36]=d,this.uint8[S+37]=y,this.uint8[S+38]=g,this.uint32[w+10]=x,this.int16[b+22]=v,e}};io.prototype.bytesPerElement=48;U("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",io);var no=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,k,I,C,M,F,D){let E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,k,I,C,M,F,D)}emplace(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,k,I,C,M,F,D,E){let T=e*32,N=e*16;return this.int16[T+0]=t,this.int16[T+1]=i,this.int16[T+2]=n,this.int16[T+3]=o,this.int16[T+4]=a,this.int16[T+5]=s,this.int16[T+6]=l,this.int16[T+7]=u,this.uint16[T+8]=c,this.uint16[T+9]=p,this.uint16[T+10]=h,this.uint16[T+11]=f,this.uint16[T+12]=d,this.uint16[T+13]=y,this.uint16[T+14]=g,this.uint16[T+15]=x,this.uint16[T+16]=v,this.uint16[T+17]=b,this.uint16[T+18]=w,this.uint16[T+19]=S,this.uint16[T+20]=P,this.uint16[T+21]=k,this.uint16[T+22]=I,this.uint32[N+12]=C,this.float32[N+13]=M,this.float32[N+14]=F,this.uint16[T+30]=D,this.uint16[T+31]=E,e}};no.prototype.bytesPerElement=64;U("StructArrayLayout8i15ui1ul2f2ui64",no);var oi=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.float32[i+0]=t,e}};oi.prototype.bytesPerElement=4;U("StructArrayLayout1f4",oi);var oo=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*6,a=e*3;return this.uint16[o+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,e}};oo.prototype.bytesPerElement=12;U("StructArrayLayout1ui2f12",oo);var ao=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*2,a=e*4;return this.uint32[o+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=n,e}};ao.prototype.bytesPerElement=8;U("StructArrayLayout1ul2ui8",ao);var so=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let n=e*2;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}};so.prototype.bytesPerElement=4;U("StructArrayLayout2ui4",so);var lo=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint16[i+0]=t,e}};lo.prototype.bytesPerElement=2;U("StructArrayLayout1ui2",lo);var ji=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.float32[a+3]=o,e}};ji.prototype.bytesPerElement=16;U("StructArrayLayout4f16",ji);var Ps=class extends Sr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Zm.default(this.anchorPointX,this.anchorPointY)}};Ps.prototype.size=20;var uo=class extends Qn{get(e){return new Ps(this,e)}};U("CollisionBoxArray",uo);var Ts=class extends Sr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};Ts.prototype.size=48;var co=class extends io{get(e){return new Ts(this,e)}};U("PlacedSymbolArray",co);var As=class extends Sr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};As.prototype.size=64;var po=class extends no{get(e){return new As(this,e)}};U("SymbolInstanceArray",po);var ho=class extends oi{getoffsetX(e){return this.float32[e*1+0]}};U("GlyphOffsetArray",ho);var fo=class extends Gi{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};U("SymbolLineVertexArray",fo);var Ms=class extends Sr{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Ms.prototype.size=12;var mo=class extends oo{get(e){return new Ms(this,e)}};U("TextAnchorOffsetArray",mo);var Is=class extends Sr{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]}};Is.prototype.size=8;var yo=class extends ao{get(e){return new Is(this,e)}};U("FeatureIndexArray",yo);var Tr=class extends ni{},Cs=class extends Gi{},Zi=class extends Hn{},Es=class extends ni{},ks=class extends ni{},Ls=class extends $n{};var Ds=class extends Wn{},zs=class extends Pr{},or=class extends Xn{},Fs=class extends Kn{},Rs=class extends Jn{},Bs=class extends Yn{},go=class extends eo{},Os=class extends to{},Vs=class extends ro{},Us=class extends qi{},rt=class extends qi{},Ar=class extends so{},xo=class extends lo{};m();var S1=be([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Hm,size:HC,alignment:$C}=S1;m();var fe=class r{constructor(e=[]){this.segments=e}prepareSegment(e,t,i,n){let o=this.segments[this.segments.length-1];return e>r.MAX_VERTEX_ARRAY_LENGTH&&ke("Max vertices per segment is ".concat(r.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e)),(!o||o.vertexLength+e>r.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==n)&&(o={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},n!==void 0&&(o.sortKey=n),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new r([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};fe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;U("SegmentVector",fe);m();m();function gp(r,e){return r=Ae(Math.floor(r),0,255),e=Ae(Math.floor(e),0,255),256*r+e}m();var bo=be([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);m();var Jm=oe(_p(),1);var _o=class r{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(Km(e)),this.positions.push(t,i,n)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=Km(e),i=0,n=this.ids.length-1;for(;i<n;){let a=i+n>>1;this.ids[a]>=t?n=a:i=a+1}let o=[];for(;this.ids[i]===t;){let a=this.positions[3*i],s=this.positions[3*i+1],l=this.positions[3*i+2];o.push({index:a,start:s,end:l}),i++}return o}static serialize(e,t){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return vp(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let t=new r;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}};function Km(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Jm.default)(String(r))}function vp(r,e,t,i){for(;t<i;){let n=r[t+i>>1],o=t-1,a=i+1;for(;;){do o++;while(r[o]<n);do a--;while(r[a]>n);if(o>=a)break;Gs(r,o,a),Gs(e,3*o,3*a),Gs(e,3*o+1,3*a+1),Gs(e,3*o+2,3*a+2)}a-t<i-a?(vp(r,e,t,a),t=a+1):(vp(r,e,a+1,i),i=a)}}function Gs(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}U("FeaturePositionMap",_o);m();var ar=class{constructor(e,t){this.gl=e.gl,this.location=t}},Y=class extends ar{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},V=class extends ar{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},ee=class extends ar{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},st=class extends ar{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},Mr=class extends ar{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},Ct=class extends ar{constructor(e,t){super(e,t),this.current=W.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},M1=new Float32Array(16),te=class extends ar{constructor(e,t){super(e,t),this.current=M1}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function wp(r){return[gp(255*r.r,255*r.g),gp(255*r.b,255*r.a)]}var ai=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map(n=>"u_".concat(n)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new Ct(e,t):new V(e,t)}},Ir=class{constructor(e,t){this.uniformNames=t.map(i=>"u_".concat(i)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,n){let o=n==="u_pattern_to"?this.patternTo:n==="u_pattern_from"?this.patternFrom:n==="u_pixel_ratio_to"?this.pixelRatioTo:n==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,t,i){return i.substr(0,9)==="u_pattern"?new Mr(e,t):new V(e,t)}},Ft=class{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:"a_".concat(o),type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new de(0),t,{},n,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,i,n){let o=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if(this.type==="color"){let n=wp(i);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},St=class{constructor(e,t,i,n,o,a){this.expression=e,this.uniformNames=t.map(s=>"u_".concat(s,"_t")),this.type=i,this.useIntegerZoom=n,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:"a_".concat(s),type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i,n,o){let a=this.expression.evaluate(new de(this.zoom),t,{},n,[],o),s=this.expression.evaluate(new de(this.zoom+1),t,{},n,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,t,i,n){let o=this.expression.evaluate({zoom:this.zoom},i,n),a=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,i,n){if(this.type==="color"){let o=wp(i),a=wp(n);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,n=Ae(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(n)}getBinding(e,t,i){return new V(e,t)}},Gt=class{constructor(e,t,i,n,o,a){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=n,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,t,i){let n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,n,o){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,n){if(!n||!i)return;let{min:o,mid:a,max:s}=i,l=n[o],u=n[a],c=n[s];if(!(!l||!u||!c))for(let p=e;p<t;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,bo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,bo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},qs=class{constructor(e,t,i){this.binders={},this._buffers=[];let n=[];for(let o in e.paint._values){if(!i(o))continue;let a=e.paint.get(o);if(!(a instanceof ot)||!xr(a.property.specification))continue;let s=I1(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],h=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=h?new Ir(l.value,s):new ai(l.value,s,u),n.push("/u_".concat(o));else if(l.kind==="source"||h){let f=Ym(o,u,"source");this.binders[o]=h?new Gt(l,u,c,t,f,e.id):new Ft(l,s,u,f),n.push("/a_".concat(o))}else{let f=Ym(o,u,"composite");this.binders[o]=new St(l,s,u,c,t,f),n.push("/z_".concat(o))}}this.cacheKey=n.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Ft||t instanceof St?t.maxValue:0}populatePaintArrays(e,t,i,n,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Ft||s instanceof St||s instanceof Gt)&&s.populatePaintArray(e,t,i,n,o)}}setConstantPatternPositions(e,t){for(let i in this.binders){let n=this.binders[i];n instanceof Ir&&n.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,n,o){let a=!1;for(let s in e){let l=t.getPositions(s);for(let u of l){let c=i.feature(u.index);for(let p in this.binders){let h=this.binders[p];if((h instanceof Ft||h instanceof St||h instanceof Gt)&&h.expression.isStateDependent===!0){let f=n.paint.get(p);h.expression=f.value,h.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof ai||i instanceof Ir)&&e.push(...i.uniformNames.map(n=>"#define HAS_UNIFORM_".concat(n)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Ft||i instanceof St)for(let n=0;n<i.paintVertexAttributes.length;n++)e.push(i.paintVertexAttributes[n].name);else if(i instanceof Gt)for(let n=0;n<bo.members.length;n++)e.push(bo.members[n].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof ai||i instanceof Ir||i instanceof St)for(let n of i.uniformNames)e.push(n)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let n in this.binders){let o=this.binders[n];if(o instanceof ai||o instanceof Ir||o instanceof St){for(let a of o.uniformNames)if(t[a]){let s=o.getBinding(e,t[a],a);i.push({name:a,property:n,binding:s})}}}return i}setUniforms(e,t,i,n){for(let{name:o,property:a,binding:s}of t)this.binders[a].setUniform(s,n,i.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof Gt){let n=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;n&&this._buffers.push(n)}else(i instanceof Ft||i instanceof St)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Ft||i instanceof St||i instanceof Gt)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Ft||t instanceof St||t instanceof Gt)&&t.destroy()}}},ft=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let n of e)this.programConfigurations[n.id]=new qs(n,t,i);this.needsUpload=!1,this._featureMap=new _o,this._bufferOffset=0}populatePaintArrays(e,t,i,n,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,n,o,a);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n){for(let o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,n)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function I1(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"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"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace("".concat(e,"-"),"").replace(/-/g,"_")]}function C1(r){return{"line-pattern":{source:or,composite:or},"fill-pattern":{source:or,composite:or},"fill-extrusion-pattern":{source:or,composite:or}}[r]}function Ym(r,e,t){let i={color:{source:Pr,composite:ji},number:{source:oi,composite:Pr}},n=C1(r);return n&&n[t]||i[e][t]}U("ConstantBinder",ai);U("CrossFadedConstantBinder",Ir);U("SourceExpressionBinder",Ft);U("CrossFadedCompositeBinder",Gt);U("CompositeExpressionBinder",St);U("ProgramConfiguration",qs,{omit:["_buffers"]});U("ProgramConfigurationSet",ft);m();m();m();var E1=15,Sp=Math.pow(2,E1-1)-1,Qm=-Sp-1;function mt(r){let e=8192/r.extent,t=r.loadGeometry();for(let i=0;i<t.length;i++){let n=t[i];for(let o=0;o<n.length;o++){let a=n[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=Ae(s,Qm,Sp),a.y=Ae(l,Qm,Sp),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ke("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}m();function dt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?mt(r):[]}}function js(r,e,t,i,n){r.emplaceBack(e*2+(i+1)/2,t*2+(n+1)/2)}var si=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Es,this.indexArray=new rt,this.segments=new fe,this.programConfigurations=new ft(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){let n=this.layers[0],o=[],a=null,s=!1;n.type==="circle"&&(a=n.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of e){let h=this.layers[0]._featureFilter.needGeometry,f=dt(l,h);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),f,i))continue;let d=s?a.evaluate(f,{},i):void 0,y={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:mt(l),patterns:{},sortKey:d};o.push(y)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,h=e[c].feature;this.addFeature(l,u,c,i),t.featureIndex.insert(h,u,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,n){for(let o of t)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=u.vertexLength;js(this.layoutVertexArray,s,l,-1,-1),js(this.layoutVertexArray,s,l,1,-1),js(this.layoutVertexArray,s,l,1,1),js(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},n)}};U("CircleBucket",si,{omit:["layers"]});m();var vo=oe(ye(),1);function Zs(r,e){for(let t=0;t<r.length;t++)if(Hi(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(Hi(r,e[t]))return!0;return!!Tp(r,e)}function td(r,e,t){return!!(Hi(r,e)||Pp(e,r,t))}function Hs(r,e){if(r.length===1)return ed(e,r[0]);for(let t=0;t<e.length;t++){let i=e[t];for(let n=0;n<i.length;n++)if(Hi(r,i[n]))return!0}for(let t=0;t<r.length;t++)if(ed(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(Tp(r,e[t]))return!0;return!1}function rd(r,e,t){for(let i=0;i<e.length;i++){let n=e[i];if(r.length>=3){for(let o=0;o<n.length;o++)if(Hi(r,n[o]))return!0}if(k1(r,n,t))return!0}return!1}function k1(r,e,t){if(r.length>1){if(Tp(r,e))return!0;for(let i=0;i<e.length;i++)if(Pp(e[i],r,t))return!0}for(let i=0;i<r.length;i++)if(Pp(r[i],e,t))return!0;return!1}function Tp(r,e){if(r.length===0||e.length===0)return!1;for(let t=0;t<r.length-1;t++){let i=r[t],n=r[t+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(L1(i,n,a,s))return!0}}return!1}function L1(r,e,t,i){return Qt(r,t,i)!==Qt(e,t,i)&&Qt(r,e,t)!==Qt(r,e,i)}function Pp(r,e,t){let i=t*t;if(e.length===1)return r.distSqr(e[0])<i;for(let n=1;n<e.length;n++){let o=e[n-1],a=e[n];if(id(r,o,a)<i)return!0}return!1}function id(r,e,t){let i=e.distSqr(t);if(i===0)return r.distSqr(e);let n=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/i;return n<0?r.distSqr(e):n>1?r.distSqr(t):r.distSqr(t.sub(e)._mult(n)._add(e))}function ed(r,e){let t=!1,i,n,o;for(let a=0;a<r.length;a++){i=r[a];for(let s=0,l=i.length-1;s<i.length;l=s++)n=i[s],o=i[l],n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(t=!t)}return t}function Hi(r,e){let t=!1;for(let i=0,n=r.length-1;i<r.length;n=i++){let o=r[i],a=r[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(t=!t)}return t}function nd(r,e,t,i,n){for(let a of r)if(e<=a.x&&t<=a.y&&i>=a.x&&n>=a.y)return!0;let o=[new vo.default(e,t),new vo.default(e,n),new vo.default(i,n),new vo.default(i,t)];if(r.length>2){for(let a of o)if(Hi(r,a))return!0}for(let a=0;a<r.length-1;a++){let s=r[a],l=r[a+1];if(D1(s,l,o))return!0}return!1}function D1(r,e,t){let i=t[0],n=t[2];if(r.x<i.x&&e.x<i.x||r.x>n.x&&e.x>n.x||r.y<i.y&&e.y<i.y||r.y>n.y&&e.y>n.y)return!1;let o=Qt(r,e,t[0]);return o!==Qt(r,e,t[1])||o!==Qt(r,e,t[2])||o!==Qt(r,e,t[3])}m();var $s=oe(ye(),1);function li(r,e,t){let i=e.paint.get(r).value;return i.kind==="constant"?i.value:t.programConfigurations.get(e.id).getMaxValue(r)}function Cr(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Er(r,e,t,i,n){if(!e[0]&&!e[1])return r;let o=$s.default.convert(e)._mult(n);t==="viewport"&&o._rotate(-i);let a=[];for(let s=0;s<r.length;s++){let l=r[s];a.push(l.sub(o))}return a}function od(r,e){let t=[];for(let i=0;i<r.length;i++){let n=r[i],o=[];for(let a=0;a<n.length;a++){let s=n[a-1],l=n[a],u=n[a+1],c=a===0?new $s.default(0,0):l.sub(s)._unit()._perp(),p=a===n.length-1?new $s.default(0,0):u.sub(l)._unit()._perp(),h=c._add(p)._unit(),f=h.x*p.x+h.y*p.y;f!==0&&h._mult(1/f),o.push(h._mult(e)._add(l))}t.push(o)}return t}m();var ad,F1=()=>ad=ad||new Le({"circle-sort-key":new H(A.layout_circle["circle-sort-key"])}),sd,R1=()=>sd=sd||new Le({"circle-radius":new H(A.paint_circle["circle-radius"]),"circle-color":new H(A.paint_circle["circle-color"]),"circle-blur":new H(A.paint_circle["circle-blur"]),"circle-opacity":new H(A.paint_circle["circle-opacity"]),"circle-translate":new j(A.paint_circle["circle-translate"]),"circle-translate-anchor":new j(A.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new j(A.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new j(A.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new H(A.paint_circle["circle-stroke-width"]),"circle-stroke-color":new H(A.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new H(A.paint_circle["circle-stroke-opacity"])}),ld={get paint(){return R1()},get layout(){return F1()}};m();m();var ne=1e-6,ve=typeof Float32Array<"u"?Float32Array:Array,qt=Math.random;var dk=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var wo={};vi(wo,{LDU:()=>Q1,add:()=>ew,adjoint:()=>Z1,clone:()=>O1,copy:()=>V1,create:()=>B1,determinant:()=>H1,equals:()=>rw,exactEquals:()=>tw,frob:()=>Y1,fromRotation:()=>X1,fromScaling:()=>K1,fromValues:()=>N1,identity:()=>U1,invert:()=>j1,mul:()=>ow,multiply:()=>ud,multiplyScalar:()=>iw,multiplyScalarAndAdd:()=>nw,rotate:()=>$1,scale:()=>W1,set:()=>G1,str:()=>J1,sub:()=>aw,subtract:()=>cd,transpose:()=>q1});m();function B1(){var r=new ve(4);return ve!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function O1(r){var e=new ve(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function V1(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function U1(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function N1(r,e,t,i){var n=new ve(4);return n[0]=r,n[1]=e,n[2]=t,n[3]=i,n}function G1(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function q1(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}function j1(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t*o-n*i;return a?(a=1/a,r[0]=o*a,r[1]=-i*a,r[2]=-n*a,r[3]=t*a,r):null}function Z1(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}function H1(r){return r[0]*r[3]-r[2]*r[1]}function ud(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=t[0],l=t[1],u=t[2],c=t[3];return r[0]=i*s+o*l,r[1]=n*s+a*l,r[2]=i*u+o*c,r[3]=n*u+a*c,r}function $1(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(t),l=Math.cos(t);return r[0]=i*l+o*s,r[1]=n*l+a*s,r[2]=i*-s+o*l,r[3]=n*-s+a*l,r}function W1(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=t[0],l=t[1];return r[0]=i*s,r[1]=n*s,r[2]=o*l,r[3]=a*l,r}function X1(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=-t,r[3]=i,r}function K1(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}function J1(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function Y1(r){return Math.hypot(r[0],r[1],r[2],r[3])}function Q1(r,e,t,i){return r[2]=i[2]/i[0],t[0]=i[0],t[1]=i[1],t[3]=i[3]-r[2]*t[1],[r,e,t]}function ew(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function cd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function tw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function rw(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(t-a)<=ne*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(i-s)<=ne*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=ne*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-u)<=ne*Math.max(1,Math.abs(o),Math.abs(u))}function iw(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function nw(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r}var ow=ud,aw=cd;var So={};vi(So,{add:()=>Ew,adjoint:()=>yw,clone:()=>uw,copy:()=>cw,create:()=>sw,determinant:()=>gw,equals:()=>zw,exactEquals:()=>Dw,frob:()=>Cw,fromMat2d:()=>Pw,fromMat4:()=>lw,fromQuat:()=>Tw,fromRotation:()=>ww,fromScaling:()=>Sw,fromTranslation:()=>vw,fromValues:()=>pw,identity:()=>fw,invert:()=>dw,mul:()=>Fw,multiply:()=>pd,multiplyScalar:()=>kw,multiplyScalarAndAdd:()=>Lw,normalFromMat4:()=>Aw,projection:()=>Mw,rotate:()=>bw,scale:()=>_w,set:()=>hw,str:()=>Iw,sub:()=>Rw,subtract:()=>hd,translate:()=>xw,transpose:()=>mw});m();function sw(){var r=new ve(9);return ve!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function lw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function uw(r){var e=new ve(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function cw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function pw(r,e,t,i,n,o,a,s,l){var u=new ve(9);return u[0]=r,u[1]=e,u[2]=t,u[3]=i,u[4]=n,u[5]=o,u[6]=a,u[7]=s,u[8]=l,u}function hw(r,e,t,i,n,o,a,s,l,u){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r[4]=o,r[5]=a,r[6]=s,r[7]=l,r[8]=u,r}function fw(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function mw(r,e){if(r===e){var t=e[1],i=e[2],n=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=i,r[7]=n}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function dw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=c*a-s*u,h=-c*o+s*l,f=u*o-a*l,d=t*p+i*h+n*f;return d?(d=1/d,r[0]=p*d,r[1]=(-c*i+n*u)*d,r[2]=(s*i-n*a)*d,r[3]=h*d,r[4]=(c*t-n*l)*d,r[5]=(-s*t+n*o)*d,r[6]=f*d,r[7]=(-u*t+i*l)*d,r[8]=(a*t-i*o)*d,r):null}function yw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return r[0]=a*c-s*u,r[1]=n*u-i*c,r[2]=i*s-n*a,r[3]=s*l-o*c,r[4]=t*c-n*l,r[5]=n*o-t*s,r[6]=o*u-a*l,r[7]=i*l-t*u,r[8]=t*a-i*o,r}function gw(r){var e=r[0],t=r[1],i=r[2],n=r[3],o=r[4],a=r[5],s=r[6],l=r[7],u=r[8];return e*(u*o-a*l)+t*(-u*n+a*s)+i*(l*n-o*s)}function pd(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=t[0],f=t[1],d=t[2],y=t[3],g=t[4],x=t[5],v=t[6],b=t[7],w=t[8];return r[0]=h*i+f*a+d*u,r[1]=h*n+f*s+d*c,r[2]=h*o+f*l+d*p,r[3]=y*i+g*a+x*u,r[4]=y*n+g*s+x*c,r[5]=y*o+g*l+x*p,r[6]=v*i+b*a+w*u,r[7]=v*n+b*s+w*c,r[8]=v*o+b*l+w*p,r}function xw(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=t[0],f=t[1];return r[0]=i,r[1]=n,r[2]=o,r[3]=a,r[4]=s,r[5]=l,r[6]=h*i+f*a+u,r[7]=h*n+f*s+c,r[8]=h*o+f*l+p,r}function bw(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=Math.sin(t),f=Math.cos(t);return r[0]=f*i+h*a,r[1]=f*n+h*s,r[2]=f*o+h*l,r[3]=f*a-h*i,r[4]=f*s-h*n,r[5]=f*l-h*o,r[6]=u,r[7]=c,r[8]=p,r}function _w(r,e,t){var i=t[0],n=t[1];return r[0]=i*e[0],r[1]=i*e[1],r[2]=i*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function vw(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function ww(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=0,r[3]=-t,r[4]=i,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Sw(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Pw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}function Tw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t+t,s=i+i,l=n+n,u=t*a,c=i*a,p=i*s,h=n*a,f=n*s,d=n*l,y=o*a,g=o*s,x=o*l;return r[0]=1-p-d,r[3]=c-x,r[6]=h+g,r[1]=c+x,r[4]=1-u-d,r[7]=f-y,r[2]=h-g,r[5]=f+y,r[8]=1-u-p,r}function Aw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],y=e[13],g=e[14],x=e[15],v=t*s-i*a,b=t*l-n*a,w=t*u-o*a,S=i*l-n*s,P=i*u-o*s,k=n*u-o*l,I=c*y-p*d,C=c*g-h*d,M=c*x-f*d,F=p*g-h*y,D=p*x-f*y,E=h*x-f*g,T=v*E-b*D+w*F+S*M-P*C+k*I;return T?(T=1/T,r[0]=(s*E-l*D+u*F)*T,r[1]=(l*M-a*E-u*C)*T,r[2]=(a*D-s*M+u*I)*T,r[3]=(n*D-i*E-o*F)*T,r[4]=(t*E-n*M+o*C)*T,r[5]=(i*M-t*D-o*I)*T,r[6]=(y*k-g*P+x*S)*T,r[7]=(g*w-d*k-x*b)*T,r[8]=(d*P-y*w+x*v)*T,r):null}function Mw(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function Iw(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function Cw(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function Ew(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}function hd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}function kw(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}function Lw(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r[4]=e[4]+t[4]*i,r[5]=e[5]+t[5]*i,r[6]=e[6]+t[6]*i,r[7]=e[7]+t[7]*i,r[8]=e[8]+t[8]*i,r}function Dw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}function zw(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],l=r[6],u=r[7],c=r[8],p=e[0],h=e[1],f=e[2],d=e[3],y=e[4],g=e[5],x=e[6],v=e[7],b=e[8];return Math.abs(t-p)<=ne*Math.max(1,Math.abs(t),Math.abs(p))&&Math.abs(i-h)<=ne*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-f)<=ne*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-d)<=ne*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(a-y)<=ne*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(s-g)<=ne*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-x)<=ne*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(u-v)<=ne*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(c-b)<=ne*Math.max(1,Math.abs(c),Math.abs(b))}var Fw=pd,Rw=hd;var G={};vi(G,{add:()=>_S,adjoint:()=>jw,clone:()=>Ow,copy:()=>Vw,create:()=>Bw,determinant:()=>Zw,equals:()=>PS,exactEquals:()=>SS,frob:()=>bS,fromQuat:()=>uS,fromQuat2:()=>nS,fromRotation:()=>eS,fromRotationTranslation:()=>dd,fromRotationTranslationScale:()=>sS,fromRotationTranslationScaleOrigin:()=>lS,fromScaling:()=>Qw,fromTranslation:()=>Yw,fromValues:()=>Uw,fromXRotation:()=>tS,fromYRotation:()=>rS,fromZRotation:()=>iS,frustum:()=>cS,getRotation:()=>aS,getScaling:()=>yd,getTranslation:()=>oS,identity:()=>fd,invert:()=>qw,lookAt:()=>yS,mul:()=>TS,multiply:()=>md,multiplyScalar:()=>vS,multiplyScalarAndAdd:()=>wS,ortho:()=>mS,orthoNO:()=>xd,orthoZO:()=>dS,perspective:()=>pS,perspectiveFromFieldOfView:()=>fS,perspectiveNO:()=>gd,perspectiveZO:()=>hS,rotate:()=>Ww,rotateX:()=>Xw,rotateY:()=>Kw,rotateZ:()=>Jw,scale:()=>$w,set:()=>Nw,str:()=>xS,sub:()=>AS,subtract:()=>bd,targetTo:()=>gS,translate:()=>Hw,transpose:()=>Gw});m();function Bw(){var r=new ve(16);return ve!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function Ow(r){var e=new ve(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function Vw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Uw(r,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y){var g=new ve(16);return g[0]=r,g[1]=e,g[2]=t,g[3]=i,g[4]=n,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=u,g[10]=c,g[11]=p,g[12]=h,g[13]=f,g[14]=d,g[15]=y,g}function Nw(r,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r[4]=o,r[5]=a,r[6]=s,r[7]=l,r[8]=u,r[9]=c,r[10]=p,r[11]=h,r[12]=f,r[13]=d,r[14]=y,r[15]=g,r}function fd(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Gw(r,e){if(r===e){var t=e[1],i=e[2],n=e[3],o=e[6],a=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=i,r[9]=o,r[11]=e[14],r[12]=n,r[13]=a,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function qw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],y=e[13],g=e[14],x=e[15],v=t*s-i*a,b=t*l-n*a,w=t*u-o*a,S=i*l-n*s,P=i*u-o*s,k=n*u-o*l,I=c*y-p*d,C=c*g-h*d,M=c*x-f*d,F=p*g-h*y,D=p*x-f*y,E=h*x-f*g,T=v*E-b*D+w*F+S*M-P*C+k*I;return T?(T=1/T,r[0]=(s*E-l*D+u*F)*T,r[1]=(n*D-i*E-o*F)*T,r[2]=(y*k-g*P+x*S)*T,r[3]=(h*P-p*k-f*S)*T,r[4]=(l*M-a*E-u*C)*T,r[5]=(t*E-n*M+o*C)*T,r[6]=(g*w-d*k-x*b)*T,r[7]=(c*k-h*w+f*b)*T,r[8]=(a*D-s*M+u*I)*T,r[9]=(i*M-t*D-o*I)*T,r[10]=(d*P-y*w+x*v)*T,r[11]=(p*w-c*P-f*v)*T,r[12]=(s*C-a*F-l*I)*T,r[13]=(t*F-i*C+n*I)*T,r[14]=(y*b-d*S-g*v)*T,r[15]=(c*S-p*b+h*v)*T,r):null}function jw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],y=e[13],g=e[14],x=e[15];return r[0]=s*(h*x-f*g)-p*(l*x-u*g)+y*(l*f-u*h),r[1]=-(i*(h*x-f*g)-p*(n*x-o*g)+y*(n*f-o*h)),r[2]=i*(l*x-u*g)-s*(n*x-o*g)+y*(n*u-o*l),r[3]=-(i*(l*f-u*h)-s*(n*f-o*h)+p*(n*u-o*l)),r[4]=-(a*(h*x-f*g)-c*(l*x-u*g)+d*(l*f-u*h)),r[5]=t*(h*x-f*g)-c*(n*x-o*g)+d*(n*f-o*h),r[6]=-(t*(l*x-u*g)-a*(n*x-o*g)+d*(n*u-o*l)),r[7]=t*(l*f-u*h)-a*(n*f-o*h)+c*(n*u-o*l),r[8]=a*(p*x-f*y)-c*(s*x-u*y)+d*(s*f-u*p),r[9]=-(t*(p*x-f*y)-c*(i*x-o*y)+d*(i*f-o*p)),r[10]=t*(s*x-u*y)-a*(i*x-o*y)+d*(i*u-o*s),r[11]=-(t*(s*f-u*p)-a*(i*f-o*p)+c*(i*u-o*s)),r[12]=-(a*(p*g-h*y)-c*(s*g-l*y)+d*(s*h-l*p)),r[13]=t*(p*g-h*y)-c*(i*g-n*y)+d*(i*h-n*p),r[14]=-(t*(s*g-l*y)-a*(i*g-n*y)+d*(i*l-n*s)),r[15]=t*(s*h-l*p)-a*(i*h-n*p)+c*(i*l-n*s),r}function Zw(r){var e=r[0],t=r[1],i=r[2],n=r[3],o=r[4],a=r[5],s=r[6],l=r[7],u=r[8],c=r[9],p=r[10],h=r[11],f=r[12],d=r[13],y=r[14],g=r[15],x=e*a-t*o,v=e*s-i*o,b=e*l-n*o,w=t*s-i*a,S=t*l-n*a,P=i*l-n*s,k=u*d-c*f,I=u*y-p*f,C=u*g-h*f,M=c*y-p*d,F=c*g-h*d,D=p*g-h*y;return x*D-v*F+b*M+w*C-S*I+P*k}function md(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],y=e[12],g=e[13],x=e[14],v=e[15],b=t[0],w=t[1],S=t[2],P=t[3];return r[0]=b*i+w*s+S*p+P*y,r[1]=b*n+w*l+S*h+P*g,r[2]=b*o+w*u+S*f+P*x,r[3]=b*a+w*c+S*d+P*v,b=t[4],w=t[5],S=t[6],P=t[7],r[4]=b*i+w*s+S*p+P*y,r[5]=b*n+w*l+S*h+P*g,r[6]=b*o+w*u+S*f+P*x,r[7]=b*a+w*c+S*d+P*v,b=t[8],w=t[9],S=t[10],P=t[11],r[8]=b*i+w*s+S*p+P*y,r[9]=b*n+w*l+S*h+P*g,r[10]=b*o+w*u+S*f+P*x,r[11]=b*a+w*c+S*d+P*v,b=t[12],w=t[13],S=t[14],P=t[15],r[12]=b*i+w*s+S*p+P*y,r[13]=b*n+w*l+S*h+P*g,r[14]=b*o+w*u+S*f+P*x,r[15]=b*a+w*c+S*d+P*v,r}function Hw(r,e,t){var i=t[0],n=t[1],o=t[2],a,s,l,u,c,p,h,f,d,y,g,x;return e===r?(r[12]=e[0]*i+e[4]*n+e[8]*o+e[12],r[13]=e[1]*i+e[5]*n+e[9]*o+e[13],r[14]=e[2]*i+e[6]*n+e[10]*o+e[14],r[15]=e[3]*i+e[7]*n+e[11]*o+e[15]):(a=e[0],s=e[1],l=e[2],u=e[3],c=e[4],p=e[5],h=e[6],f=e[7],d=e[8],y=e[9],g=e[10],x=e[11],r[0]=a,r[1]=s,r[2]=l,r[3]=u,r[4]=c,r[5]=p,r[6]=h,r[7]=f,r[8]=d,r[9]=y,r[10]=g,r[11]=x,r[12]=a*i+c*n+d*o+e[12],r[13]=s*i+p*n+y*o+e[13],r[14]=l*i+h*n+g*o+e[14],r[15]=u*i+f*n+x*o+e[15]),r}function $w(r,e,t){var i=t[0],n=t[1],o=t[2];return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[7]=e[7]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,r[11]=e[11]*o,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Ww(r,e,t,i){var n=i[0],o=i[1],a=i[2],s=Math.hypot(n,o,a),l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,k,I,C,M,F,D,E,T,N;return s<ne?null:(s=1/s,n*=s,o*=s,a*=s,l=Math.sin(t),u=Math.cos(t),c=1-u,p=e[0],h=e[1],f=e[2],d=e[3],y=e[4],g=e[5],x=e[6],v=e[7],b=e[8],w=e[9],S=e[10],P=e[11],k=n*n*c+u,I=o*n*c+a*l,C=a*n*c-o*l,M=n*o*c-a*l,F=o*o*c+u,D=a*o*c+n*l,E=n*a*c+o*l,T=o*a*c-n*l,N=a*a*c+u,r[0]=p*k+y*I+b*C,r[1]=h*k+g*I+w*C,r[2]=f*k+x*I+S*C,r[3]=d*k+v*I+P*C,r[4]=p*M+y*F+b*D,r[5]=h*M+g*F+w*D,r[6]=f*M+x*F+S*D,r[7]=d*M+v*F+P*D,r[8]=p*E+y*T+b*N,r[9]=h*E+g*T+w*N,r[10]=f*E+x*T+S*N,r[11]=d*E+v*T+P*N,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function Xw(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],h=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=o*n+u*i,r[5]=a*n+c*i,r[6]=s*n+p*i,r[7]=l*n+h*i,r[8]=u*n-o*i,r[9]=c*n-a*i,r[10]=p*n-s*i,r[11]=h*n-l*i,r}function Kw(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],h=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*n-u*i,r[1]=a*n-c*i,r[2]=s*n-p*i,r[3]=l*n-h*i,r[8]=o*i+u*n,r[9]=a*i+c*n,r[10]=s*i+p*n,r[11]=l*i+h*n,r}function Jw(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],h=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*n+u*i,r[1]=a*n+c*i,r[2]=s*n+p*i,r[3]=l*n+h*i,r[4]=u*n-o*i,r[5]=c*n-a*i,r[6]=p*n-s*i,r[7]=h*n-l*i,r}function Yw(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Qw(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function eS(r,e,t){var i=t[0],n=t[1],o=t[2],a=Math.hypot(i,n,o),s,l,u;return a<ne?null:(a=1/a,i*=a,n*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,r[0]=i*i*u+l,r[1]=n*i*u+o*s,r[2]=o*i*u-n*s,r[3]=0,r[4]=i*n*u-o*s,r[5]=n*n*u+l,r[6]=o*n*u+i*s,r[7]=0,r[8]=i*o*u+n*s,r[9]=n*o*u-i*s,r[10]=o*o*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function tS(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=i,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function rS(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=i,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function iS(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=i,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function dd(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=i+i,l=n+n,u=o+o,c=i*s,p=i*l,h=i*u,f=n*l,d=n*u,y=o*u,g=a*s,x=a*l,v=a*u;return r[0]=1-(f+y),r[1]=p+v,r[2]=h-x,r[3]=0,r[4]=p-v,r[5]=1-(c+y),r[6]=d+g,r[7]=0,r[8]=h+x,r[9]=d-g,r[10]=1-(c+f),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function nS(r,e){var t=new ve(3),i=-e[0],n=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=i*i+n*n+o*o+a*a;return p>0?(t[0]=(s*a+c*i+l*o-u*n)*2/p,t[1]=(l*a+c*n+u*i-s*o)*2/p,t[2]=(u*a+c*o+s*n-l*i)*2/p):(t[0]=(s*a+c*i+l*o-u*n)*2,t[1]=(l*a+c*n+u*i-s*o)*2,t[2]=(u*a+c*o+s*n-l*i)*2),dd(r,e,t),r}function oS(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function yd(r,e){var t=e[0],i=e[1],n=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],c=e[10];return r[0]=Math.hypot(t,i,n),r[1]=Math.hypot(o,a,s),r[2]=Math.hypot(l,u,c),r}function aS(r,e){var t=new ve(3);yd(t,e);var i=1/t[0],n=1/t[1],o=1/t[2],a=e[0]*i,s=e[1]*n,l=e[2]*o,u=e[4]*i,c=e[5]*n,p=e[6]*o,h=e[8]*i,f=e[9]*n,d=e[10]*o,y=a+c+d,g=0;return y>0?(g=Math.sqrt(y+1)*2,r[3]=.25*g,r[0]=(p-f)/g,r[1]=(h-l)/g,r[2]=(s-u)/g):a>c&&a>d?(g=Math.sqrt(1+a-c-d)*2,r[3]=(p-f)/g,r[0]=.25*g,r[1]=(s+u)/g,r[2]=(h+l)/g):c>d?(g=Math.sqrt(1+c-a-d)*2,r[3]=(h-l)/g,r[0]=(s+u)/g,r[1]=.25*g,r[2]=(p+f)/g):(g=Math.sqrt(1+d-a-c)*2,r[3]=(s-u)/g,r[0]=(h+l)/g,r[1]=(p+f)/g,r[2]=.25*g),r}function sS(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=e[3],l=n+n,u=o+o,c=a+a,p=n*l,h=n*u,f=n*c,d=o*u,y=o*c,g=a*c,x=s*l,v=s*u,b=s*c,w=i[0],S=i[1],P=i[2];return r[0]=(1-(d+g))*w,r[1]=(h+b)*w,r[2]=(f-v)*w,r[3]=0,r[4]=(h-b)*S,r[5]=(1-(p+g))*S,r[6]=(y+x)*S,r[7]=0,r[8]=(f+v)*P,r[9]=(y-x)*P,r[10]=(1-(p+d))*P,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function lS(r,e,t,i,n){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,h=o*u,f=o*c,d=o*p,y=a*c,g=a*p,x=s*p,v=l*u,b=l*c,w=l*p,S=i[0],P=i[1],k=i[2],I=n[0],C=n[1],M=n[2],F=(1-(y+x))*S,D=(f+w)*S,E=(d-b)*S,T=(f-w)*P,N=(1-(h+x))*P,X=(g+v)*P,ie=(d+b)*k,K=(g-v)*k,$=(1-(h+y))*k;return r[0]=F,r[1]=D,r[2]=E,r[3]=0,r[4]=T,r[5]=N,r[6]=X,r[7]=0,r[8]=ie,r[9]=K,r[10]=$,r[11]=0,r[12]=t[0]+I-(F*I+T*C+ie*M),r[13]=t[1]+C-(D*I+N*C+K*M),r[14]=t[2]+M-(E*I+X*C+$*M),r[15]=1,r}function uS(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t+t,s=i+i,l=n+n,u=t*a,c=i*a,p=i*s,h=n*a,f=n*s,d=n*l,y=o*a,g=o*s,x=o*l;return r[0]=1-p-d,r[1]=c+x,r[2]=h-g,r[3]=0,r[4]=c-x,r[5]=1-u-d,r[6]=f+y,r[7]=0,r[8]=h+g,r[9]=f-y,r[10]=1-u-p,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function cS(r,e,t,i,n,o,a){var s=1/(t-e),l=1/(n-i),u=1/(o-a);return r[0]=o*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o*2*l,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(n+i)*l,r[10]=(a+o)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=a*o*2*u,r[15]=0,r}function gd(r,e,t,i,n){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,n!=null&&n!==1/0?(a=1/(i-n),r[10]=(n+i)*a,r[14]=2*n*i*a):(r[10]=-1,r[14]=-2*i),r}var pS=gd;function hS(r,e,t,i,n){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,n!=null&&n!==1/0?(a=1/(i-n),r[10]=n*a,r[14]=n*i*a):(r[10]=-1,r[14]=-i),r}function fS(r,e,t,i){var n=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(n+o);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((a-s)*l*.5),r[9]=(n-o)*u*.5,r[10]=i/(t-i),r[11]=-1,r[12]=0,r[13]=0,r[14]=i*t/(t-i),r[15]=0,r}function xd(r,e,t,i,n,o,a){var s=1/(e-t),l=1/(i-n),u=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(e+t)*s,r[13]=(n+i)*l,r[14]=(a+o)*u,r[15]=1,r}var mS=xd;function dS(r,e,t,i,n,o,a){var s=1/(e-t),l=1/(i-n),u=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(e+t)*s,r[13]=(n+i)*l,r[14]=o*u,r[15]=1,r}function yS(r,e,t,i){var n,o,a,s,l,u,c,p,h,f,d=e[0],y=e[1],g=e[2],x=i[0],v=i[1],b=i[2],w=t[0],S=t[1],P=t[2];return Math.abs(d-w)<ne&&Math.abs(y-S)<ne&&Math.abs(g-P)<ne?fd(r):(c=d-w,p=y-S,h=g-P,f=1/Math.hypot(c,p,h),c*=f,p*=f,h*=f,n=v*h-b*p,o=b*c-x*h,a=x*p-v*c,f=Math.hypot(n,o,a),f?(f=1/f,n*=f,o*=f,a*=f):(n=0,o=0,a=0),s=p*a-h*o,l=h*n-c*a,u=c*o-p*n,f=Math.hypot(s,l,u),f?(f=1/f,s*=f,l*=f,u*=f):(s=0,l=0,u=0),r[0]=n,r[1]=s,r[2]=c,r[3]=0,r[4]=o,r[5]=l,r[6]=p,r[7]=0,r[8]=a,r[9]=u,r[10]=h,r[11]=0,r[12]=-(n*d+o*y+a*g),r[13]=-(s*d+l*y+u*g),r[14]=-(c*d+p*y+h*g),r[15]=1,r)}function gS(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=i[0],l=i[1],u=i[2],c=n-t[0],p=o-t[1],h=a-t[2],f=c*c+p*p+h*h;f>0&&(f=1/Math.sqrt(f),c*=f,p*=f,h*=f);var d=l*h-u*p,y=u*c-s*h,g=s*p-l*c;return f=d*d+y*y+g*g,f>0&&(f=1/Math.sqrt(f),d*=f,y*=f,g*=f),r[0]=d,r[1]=y,r[2]=g,r[3]=0,r[4]=p*g-h*y,r[5]=h*d-c*g,r[6]=c*y-p*d,r[7]=0,r[8]=c,r[9]=p,r[10]=h,r[11]=0,r[12]=n,r[13]=o,r[14]=a,r[15]=1,r}function xS(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function bS(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function _S(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function bd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function vS(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function wS(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r[4]=e[4]+t[4]*i,r[5]=e[5]+t[5]*i,r[6]=e[6]+t[6]*i,r[7]=e[7]+t[7]*i,r[8]=e[8]+t[8]*i,r[9]=e[9]+t[9]*i,r[10]=e[10]+t[10]*i,r[11]=e[11]+t[11]*i,r[12]=e[12]+t[12]*i,r[13]=e[13]+t[13]*i,r[14]=e[14]+t[14]*i,r[15]=e[15]+t[15]*i,r}function SS(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function PS(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],l=r[6],u=r[7],c=r[8],p=r[9],h=r[10],f=r[11],d=r[12],y=r[13],g=r[14],x=r[15],v=e[0],b=e[1],w=e[2],S=e[3],P=e[4],k=e[5],I=e[6],C=e[7],M=e[8],F=e[9],D=e[10],E=e[11],T=e[12],N=e[13],X=e[14],ie=e[15];return Math.abs(t-v)<=ne*Math.max(1,Math.abs(t),Math.abs(v))&&Math.abs(i-b)<=ne*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(n-w)<=ne*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(o-S)<=ne*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-P)<=ne*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(s-k)<=ne*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(l-I)<=ne*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(u-C)<=ne*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-M)<=ne*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(p-F)<=ne*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(h-D)<=ne*Math.max(1,Math.abs(h),Math.abs(D))&&Math.abs(f-E)<=ne*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(d-T)<=ne*Math.max(1,Math.abs(d),Math.abs(T))&&Math.abs(y-N)<=ne*Math.max(1,Math.abs(y),Math.abs(N))&&Math.abs(g-X)<=ne*Math.max(1,Math.abs(g),Math.abs(X))&&Math.abs(x-ie)<=ne*Math.max(1,Math.abs(x),Math.abs(ie))}var TS=md,AS=bd;var yt={};vi(yt,{add:()=>kS,angle:()=>QS,bezier:()=>ZS,ceil:()=>LS,clone:()=>MS,copy:()=>CS,create:()=>_d,cross:()=>GS,dist:()=>s2,distance:()=>Td,div:()=>a2,divide:()=>Pd,dot:()=>Id,equals:()=>i2,exactEquals:()=>r2,floor:()=>DS,forEach:()=>p2,fromValues:()=>IS,hermite:()=>jS,inverse:()=>US,len:()=>u2,length:()=>vd,lerp:()=>qS,max:()=>FS,min:()=>zS,mul:()=>o2,multiply:()=>Sd,negate:()=>VS,normalize:()=>NS,random:()=>HS,rotateX:()=>KS,rotateY:()=>JS,rotateZ:()=>YS,round:()=>RS,scale:()=>BS,scaleAndAdd:()=>OS,set:()=>ES,sqrDist:()=>l2,sqrLen:()=>c2,squaredDistance:()=>Ad,squaredLength:()=>Md,str:()=>t2,sub:()=>n2,subtract:()=>wd,transformMat3:()=>WS,transformMat4:()=>$S,transformQuat:()=>XS,zero:()=>e2});m();function _d(){var r=new ve(3);return ve!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function MS(r){var e=new ve(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function vd(r){var e=r[0],t=r[1],i=r[2];return Math.hypot(e,t,i)}function IS(r,e,t){var i=new ve(3);return i[0]=r,i[1]=e,i[2]=t,i}function CS(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function ES(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}function kS(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function wd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function Sd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Pd(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function LS(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function DS(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function zS(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function FS(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function RS(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function BS(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function OS(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}function Td(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2];return Math.hypot(t,i,n)}function Ad(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2];return t*t+i*i+n*n}function Md(r){var e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}function VS(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function US(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function NS(r,e){var t=e[0],i=e[1],n=e[2],o=t*t+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}function Id(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function GS(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[0],s=t[1],l=t[2];return r[0]=n*l-o*s,r[1]=o*a-i*l,r[2]=i*s-n*a,r}function qS(r,e,t,i){var n=e[0],o=e[1],a=e[2];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r[2]=a+i*(t[2]-a),r}function jS(r,e,t,i,n,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return r[0]=e[0]*s+t[0]*l+i[0]*u+n[0]*c,r[1]=e[1]*s+t[1]*l+i[1]*u+n[1]*c,r[2]=e[2]*s+t[2]*l+i[2]*u+n[2]*c,r}function ZS(r,e,t,i,n,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,p=3*l*a,h=l*o;return r[0]=e[0]*u+t[0]*c+i[0]*p+n[0]*h,r[1]=e[1]*u+t[1]*c+i[1]*p+n[1]*h,r[2]=e[2]*u+t[2]*c+i[2]*p+n[2]*h,r}function HS(r,e){e=e||1;var t=qt()*2*Math.PI,i=qt()*2-1,n=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*n,r[1]=Math.sin(t)*n,r[2]=i*e,r}function $S(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[3]*i+t[7]*n+t[11]*o+t[15];return a=a||1,r[0]=(t[0]*i+t[4]*n+t[8]*o+t[12])/a,r[1]=(t[1]*i+t[5]*n+t[9]*o+t[13])/a,r[2]=(t[2]*i+t[6]*n+t[10]*o+t[14])/a,r}function WS(r,e,t){var i=e[0],n=e[1],o=e[2];return r[0]=i*t[0]+n*t[3]+o*t[6],r[1]=i*t[1]+n*t[4]+o*t[7],r[2]=i*t[2]+n*t[5]+o*t[8],r}function XS(r,e,t){var i=t[0],n=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=n*u-o*l,p=o*s-i*u,h=i*l-n*s,f=n*h-o*p,d=o*c-i*h,y=i*p-n*c,g=a*2;return c*=g,p*=g,h*=g,f*=2,d*=2,y*=2,r[0]=s+c+f,r[1]=l+p+d,r[2]=u+h+y,r}function KS(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function JS(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function YS(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function QS(r,e){var t=r[0],i=r[1],n=r[2],o=e[0],a=e[1],s=e[2],l=Math.sqrt(t*t+i*i+n*n),u=Math.sqrt(o*o+a*a+s*s),c=l*u,p=c&&Id(r,e)/c;return Math.acos(Math.min(Math.max(p,-1),1))}function e2(r){return r[0]=0,r[1]=0,r[2]=0,r}function t2(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function r2(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function i2(r,e){var t=r[0],i=r[1],n=r[2],o=e[0],a=e[1],s=e[2];return Math.abs(t-o)<=ne*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(i-a)<=ne*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-s)<=ne*Math.max(1,Math.abs(n),Math.abs(s))}var n2=wd,o2=Sd,a2=Pd,s2=Td,l2=Ad,u2=vd,c2=Md,p2=function(){var r=_d();return function(e,t,i,n,o,a){var s,l;for(t||(t=3),i||(i=0),n?l=Math.min(n*t+i,e.length):l=e.length,s=i;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();var Ge={};vi(Ge,{add:()=>y2,ceil:()=>g2,clone:()=>h2,copy:()=>m2,create:()=>Cd,cross:()=>I2,dist:()=>U2,distance:()=>Dd,div:()=>V2,divide:()=>Ld,dot:()=>M2,equals:()=>R2,exactEquals:()=>F2,floor:()=>x2,forEach:()=>j2,fromValues:()=>f2,inverse:()=>T2,len:()=>G2,length:()=>Fd,lerp:()=>C2,max:()=>_2,min:()=>b2,mul:()=>O2,multiply:()=>kd,negate:()=>P2,normalize:()=>A2,random:()=>E2,round:()=>v2,scale:()=>w2,scaleAndAdd:()=>S2,set:()=>d2,sqrDist:()=>N2,sqrLen:()=>q2,squaredDistance:()=>zd,squaredLength:()=>Rd,str:()=>z2,sub:()=>B2,subtract:()=>Ed,transformMat4:()=>k2,transformQuat:()=>L2,zero:()=>D2});m();function Cd(){var r=new ve(4);return ve!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function h2(r){var e=new ve(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function f2(r,e,t,i){var n=new ve(4);return n[0]=r,n[1]=e,n[2]=t,n[3]=i,n}function m2(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function d2(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function y2(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Ed(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function kd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}function Ld(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}function g2(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}function x2(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}function b2(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}function _2(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}function v2(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}function w2(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function S2(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r}function Dd(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2],o=e[3]-r[3];return Math.hypot(t,i,n,o)}function zd(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2],o=e[3]-r[3];return t*t+i*i+n*n+o*o}function Fd(r){var e=r[0],t=r[1],i=r[2],n=r[3];return Math.hypot(e,t,i,n)}function Rd(r){var e=r[0],t=r[1],i=r[2],n=r[3];return e*e+t*t+i*i+n*n}function P2(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}function T2(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}function A2(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t*t+i*i+n*n+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=t*a,r[1]=i*a,r[2]=n*a,r[3]=o*a,r}function M2(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function I2(r,e,t,i){var n=t[0]*i[1]-t[1]*i[0],o=t[0]*i[2]-t[2]*i[0],a=t[0]*i[3]-t[3]*i[0],s=t[1]*i[2]-t[2]*i[1],l=t[1]*i[3]-t[3]*i[1],u=t[2]*i[3]-t[3]*i[2],c=e[0],p=e[1],h=e[2],f=e[3];return r[0]=p*u-h*l+f*s,r[1]=-(c*u)+h*a-f*o,r[2]=c*l-p*a+f*n,r[3]=-(c*s)+p*o-h*n,r}function C2(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=e[3];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r[2]=a+i*(t[2]-a),r[3]=s+i*(t[3]-s),r}function E2(r,e){e=e||1;var t,i,n,o,a,s;do t=qt()*2-1,i=qt()*2-1,a=t*t+i*i;while(a>=1);do n=qt()*2-1,o=qt()*2-1,s=n*n+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return r[0]=e*t,r[1]=e*i,r[2]=e*n*l,r[3]=e*o*l,r}function k2(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3];return r[0]=t[0]*i+t[4]*n+t[8]*o+t[12]*a,r[1]=t[1]*i+t[5]*n+t[9]*o+t[13]*a,r[2]=t[2]*i+t[6]*n+t[10]*o+t[14]*a,r[3]=t[3]*i+t[7]*n+t[11]*o+t[15]*a,r}function L2(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[0],s=t[1],l=t[2],u=t[3],c=u*i+s*o-l*n,p=u*n+l*i-a*o,h=u*o+a*n-s*i,f=-a*i-s*n-l*o;return r[0]=c*u+f*-a+p*-l-h*-s,r[1]=p*u+f*-s+h*-a-c*-l,r[2]=h*u+f*-l+c*-s-p*-a,r[3]=e[3],r}function D2(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function z2(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function F2(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function R2(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(t-a)<=ne*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(i-s)<=ne*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=ne*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-u)<=ne*Math.max(1,Math.abs(o),Math.abs(u))}var B2=Ed,O2=kd,V2=Ld,U2=Dd,N2=zd,G2=Fd,q2=Rd,j2=function(){var r=Cd();return function(e,t,i,n,o,a){var s,l;for(t||(t=4),i||(i=0),n?l=Math.min(n*t+i,e.length):l=e.length,s=i;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();var Wi={};vi(Wi,{add:()=>X2,angle:()=>dP,ceil:()=>K2,clone:()=>Z2,copy:()=>$2,create:()=>Bd,cross:()=>sP,dist:()=>PP,distance:()=>Nd,div:()=>SP,divide:()=>Ud,dot:()=>aP,equals:()=>bP,exactEquals:()=>xP,floor:()=>J2,forEach:()=>MP,fromValues:()=>H2,inverse:()=>nP,len:()=>_P,length:()=>qd,lerp:()=>lP,max:()=>Q2,min:()=>Y2,mul:()=>wP,multiply:()=>Vd,negate:()=>iP,normalize:()=>oP,random:()=>uP,rotate:()=>mP,round:()=>eP,scale:()=>tP,scaleAndAdd:()=>rP,set:()=>W2,sqrDist:()=>TP,sqrLen:()=>AP,squaredDistance:()=>Gd,squaredLength:()=>jd,str:()=>gP,sub:()=>vP,subtract:()=>Od,transformMat2:()=>cP,transformMat2d:()=>pP,transformMat3:()=>hP,transformMat4:()=>fP,zero:()=>yP});m();function Bd(){var r=new ve(2);return ve!=Float32Array&&(r[0]=0,r[1]=0),r}function Z2(r){var e=new ve(2);return e[0]=r[0],e[1]=r[1],e}function H2(r,e){var t=new ve(2);return t[0]=r,t[1]=e,t}function $2(r,e){return r[0]=e[0],r[1]=e[1],r}function W2(r,e,t){return r[0]=e,r[1]=t,r}function X2(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function Od(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function Vd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function Ud(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function K2(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function J2(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function Y2(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function Q2(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function eP(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function tP(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function rP(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r}function Nd(r,e){var t=e[0]-r[0],i=e[1]-r[1];return Math.hypot(t,i)}function Gd(r,e){var t=e[0]-r[0],i=e[1]-r[1];return t*t+i*i}function qd(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function jd(r){var e=r[0],t=r[1];return e*e+t*t}function iP(r,e){return r[0]=-e[0],r[1]=-e[1],r}function nP(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function oP(r,e){var t=e[0],i=e[1],n=t*t+i*i;return n>0&&(n=1/Math.sqrt(n)),r[0]=e[0]*n,r[1]=e[1]*n,r}function aP(r,e){return r[0]*e[0]+r[1]*e[1]}function sP(r,e,t){var i=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=i,r}function lP(r,e,t,i){var n=e[0],o=e[1];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r}function uP(r,e){e=e||1;var t=qt()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function cP(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n,r[1]=t[1]*i+t[3]*n,r}function pP(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n+t[4],r[1]=t[1]*i+t[3]*n+t[5],r}function hP(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[3]*n+t[6],r[1]=t[1]*i+t[4]*n+t[7],r}function fP(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[4]*n+t[12],r[1]=t[1]*i+t[5]*n+t[13],r}function mP(r,e,t,i){var n=e[0]-t[0],o=e[1]-t[1],a=Math.sin(i),s=Math.cos(i);return r[0]=n*s-o*a+t[0],r[1]=n*a+o*s+t[1],r}function dP(r,e){var t=r[0],i=r[1],n=e[0],o=e[1],a=Math.sqrt(t*t+i*i)*Math.sqrt(n*n+o*o),s=a&&(t*n+i*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function yP(r){return r[0]=0,r[1]=0,r}function gP(r){return"vec2("+r[0]+", "+r[1]+")"}function xP(r,e){return r[0]===e[0]&&r[1]===e[1]}function bP(r,e){var t=r[0],i=r[1],n=e[0],o=e[1];return Math.abs(t-n)<=ne*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=ne*Math.max(1,Math.abs(i),Math.abs(o))}var _P=qd,vP=Od,wP=Vd,SP=Ud,PP=Nd,TP=Gd,AP=jd,MP=function(){var r=Bd();return function(e,t,i,n,o,a){var s,l;for(t||(t=2),i||(i=0),n?l=Math.min(n*t+i,e.length):l=e.length,s=i;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],o(r,r,a),e[s]=r[0],e[s+1]=r[1];return e}}();var Zd=oe(ye(),1),Ws=class extends Ne{constructor(e){super(e,ld)}createBucket(e){return new si(e)}queryRadius(e){let t=e;return li("circle-radius",this,t)+li("circle-stroke-width",this,t)+Cr(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s,l){let u=Er(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),c=this.paint.get("circle-radius").evaluate(t,i),p=this.paint.get("circle-stroke-width").evaluate(t,i),h=c+p,f=this.paint.get("circle-pitch-alignment")==="map",d=f?u:IP(u,l),y=f?h*s:h;for(let g of n)for(let x of g){let v=f?x:Hd(x,l),b=y,w=Ge.transformMat4([],[x.x,x.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=w[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=a.cameraToCenterDistance/w[3]),td(d,v,b))return!0}return!1}};function Hd(r,e){let t=Ge.transformMat4([],[r.x,r.y,0,1],e);return new Zd.default(t[0]/t[3],t[1]/t[3])}function IP(r,e){return r.map(t=>Hd(t,e))}m();m();var Po=class extends si{};U("HeatmapBucket",Po,{omit:["layers"]});m();var $d,CP=()=>$d=$d||new Le({"heatmap-radius":new H(A.paint_heatmap["heatmap-radius"]),"heatmap-weight":new H(A.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new j(A.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ii(A.paint_heatmap["heatmap-color"]),"heatmap-opacity":new j(A.paint_heatmap["heatmap-opacity"])}),Wd={get paint(){return CP()}};m();m();function Ap(r,{width:e,height:t},i,n){if(!n)n=new Uint8Array(e*t*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*t*i)throw new RangeError("mismatched image size. expected: ".concat(n.length," but got: ").concat(e*t*i));return r.width=e,r.height=t,r.data=n,r}function Xd(r,{width:e,height:t},i){if(e===r.width&&t===r.height)return;let n=Ap({},{width:e,height:t},i);Mp(r,n,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,t)},i),r.width=e,r.height=t,r.data=n.data}function Mp(r,e,t,i,n,o){if(n.width===0||n.height===0)return e;if(n.width>r.width||n.height>r.height||t.x>r.width-n.width||t.y>r.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");let a=r.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((t.y+l)*r.width+t.x)*o,c=((i.y+l)*e.width+i.x)*o;for(let p=0;p<n.width*o;p++)s[c+p]=a[u+p]}return e}var ui=class r{constructor(e,t){Ap(this,e,1,t)}resize(e){Xd(this,e,1)}clone(){return new r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,o){Mp(e,t,i,n,o,1)}},we=class r{constructor(e,t){Ap(this,e,4,t)}resize(e){Xd(this,e,4)}replace(e,t){t?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,o){Mp(e,t,i,n,o,4)}};U("AlphaImage",ui);U("RGBAImage",we);function Xs(r){let e={},t=r.resolution||256,i=r.clips?r.clips.length:1,n=r.image||new we({width:t,height:i});if(!cf(t))throw new Error("width is not a power of 2 - ".concat(t));let o=(a,s,l)=>{e[r.evaluationKey]=l;let u=r.expression.evaluate(e);n.data[a+s+0]=Math.floor(u.r*255/u.a),n.data[a+s+1]=Math.floor(u.g*255/u.a),n.data[a+s+2]=Math.floor(u.b*255/u.a),n.data[a+s+3]=Math.floor(u.a*255)};if(r.clips)for(let a=0,s=0;a<i;++a,s+=t*4)for(let l=0,u=0;l<t;l++,u+=4){let c=l/(t-1),{start:p,end:h}=r.clips[a],f=p*(1-c)+h*c;o(s,u,f)}else for(let a=0,s=0;a<t;a++,s+=4){let l=a/(t-1);o(0,s,l)}return n}var Ks=class extends Ne{createBucket(e){return new Po(e)}constructor(e){super(e,Wd),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Xs({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};m();m();var Kd,EP=()=>Kd=Kd||new Le({"hillshade-illumination-direction":new j(A.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new j(A.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new j(A.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new j(A.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new j(A.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new j(A.paint_hillshade["hillshade-accent-color"])}),Jd={get paint(){return EP()}};var Js=class extends Ne{constructor(e){super(e,Jd)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};m();m();m();var kP=be([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Yd,size:PL,alignment:TL}=kP;var ny=oe(Lp(),1);m();m();function Dp(r,e,t,i,n){iy(r,e,t||0,i||r.length-1,n||$P)}function iy(r,e,t,i,n){for(;i>t;){if(i-t>600){var o=i-t+1,a=e-t+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(t,Math.floor(e-a*l/o+u)),p=Math.min(i,Math.floor(e+(o-a)*l/o+u));iy(r,e,c,p,n)}var h=r[e],f=t,d=i;for(Io(r,t,e),n(r[i],h)>0&&Io(r,t,i);f<d;){for(Io(r,f,d),f++,d--;n(r[f],h)<0;)f++;for(;n(r[d],h)>0;)d--}n(r[t],h)===0?Io(r,t,d):(d++,Io(r,d,i)),d<=e&&(t=d+1),e<=d&&(i=d-1)}}function Io(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}function $P(r,e){return r<e?-1:r>e?1:0}function Co(r,e){let t=r.length;if(t<=1)return[r];let i=[],n,o;for(let a=0;a<t;a++){let s=mf(r[a]);s!==0&&(r[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(n&&i.push(n),n=[r[a]]):n.push(r[a]))}if(n&&i.push(n),e>1)for(let a=0;a<i.length;a++)i[a].length<=e||(Dp(i[a],e,1,i[a].length-1,WP),i[a]=i[a].slice(0,e));return i}function WP(r,e){return e.area-r.area}m();function Ki(r,e,t){let i=t.patternDependencies,n=!1;for(let o of e){let a=o.paint.get("".concat(r,"-pattern"));a.isConstant()||(n=!0);let s=a.constantOr(null);s&&(n=!0,i[s.to]=!0,i[s.from]=!0)}return n}function Ji(r,e,t,i,n){let o=n.patternDependencies;for(let a of e){let l=a.paint.get("".concat(r,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:i-1},t,{},n.availableImages),c=l.evaluate({zoom:i},t,{},n.availableImages),p=l.evaluate({zoom:i+1},t,{},n.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,t.patterns[a.id]={min:u,mid:c,max:p}}}return t}var XP=500,Eo=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ks,this.indexArray=new rt,this.indexArray2=new Ar,this.programConfigurations=new ft(e.layers,e.zoom),this.segments=new fe,this.segments2=new fe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=Ki("fill",this.layers,t);let n=this.layers[0].layout.get("fill-sort-key"),o=!n.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,h=dt(s,p);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),h,i))continue;let f=o?n.evaluate(h,{},i,t.availableImages):void 0,d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:mt(s),patterns:{},sortKey:f};a.push(d)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let h=Ji("fill",this.layers,s,this.zoom,t);this.patternFeatures.push(h)}else this.addFeature(s,l,u,i,{});let p=e[u].feature;t.featureIndex.insert(p,l,u,c,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yd),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,i,n,o){for(let a of Co(t,XP)){let s=0;for(let f of a)s+=f.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let f of a){if(f.length===0)continue;f!==a[0]&&p.push(c.length/2);let d=this.segments2.prepareSegment(f.length,this.layoutVertexArray,this.indexArray2),y=d.vertexLength;this.layoutVertexArray.emplaceBack(f[0].x,f[0].y),this.indexArray2.emplaceBack(y+f.length-1,y),c.push(f[0].x),c.push(f[0].y);for(let g=1;g<f.length;g++)this.layoutVertexArray.emplaceBack(f[g].x,f[g].y),this.indexArray2.emplaceBack(y+g-1,y+g),c.push(f[g].x),c.push(f[g].y);d.vertexLength+=f.length,d.primitiveLength+=f.length}let h=(0,ny.default)(c,p);for(let f=0;f<h.length;f+=3)this.indexArray.emplaceBack(u+h[f],u+h[f+1],u+h[f+2]);l.vertexLength+=s,l.primitiveLength+=h.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}};U("FillBucket",Eo,{omit:["layers","patternFeatures"]});m();var oy,KP=()=>oy=oy||new Le({"fill-sort-key":new H(A.layout_fill["fill-sort-key"])}),ay,JP=()=>ay=ay||new Le({"fill-antialias":new j(A.paint_fill["fill-antialias"]),"fill-opacity":new H(A.paint_fill["fill-opacity"]),"fill-color":new H(A.paint_fill["fill-color"]),"fill-outline-color":new H(A.paint_fill["fill-outline-color"]),"fill-translate":new j(A.paint_fill["fill-translate"]),"fill-translate-anchor":new j(A.paint_fill["fill-translate-anchor"]),"fill-pattern":new nr(A.paint_fill["fill-pattern"])}),sy={get paint(){return JP()},get layout(){return KP()}};var rl=class extends Ne{constructor(e){super(e,sy)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Eo(e)}queryRadius(){return Cr(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s){let l=Er(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return Hs(l,n)}isTileClipped(){return!0}};m();m();m();var YP=be([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ly=be([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:uy,size:dD,alignment:yD}=YP;var dy=oe(Lp(),1),yy=oe(ko(),1);var cT=yy.default.VectorTileFeature.types,pT=500,Rp=Math.pow(2,13);function Lo(r,e,t,i,n,o,a,s){r.emplaceBack(e,t,Math.floor(i*Rp)*2+a,n*Rp*2,o*Rp*2,Math.round(s))}var Do=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ls,this.centroidVertexArray=new Tr,this.indexArray=new rt,this.programConfigurations=new ft(e.layers,e.zoom),this.segments=new fe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=Ki("fill-extrusion",this.layers,t);for(let{feature:n,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=dt(n,l);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),u,i))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:mt(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Ji("fill-extrusion",this.layers,c,this.zoom,t)):this.addFeature(c,c.geometry,a,i,{}),t.featureIndex.insert(n,c.geometry,a,s,this.index,!0)}}addFeatures(e,t,i){for(let n of this.features){let{geometry:o}=n;this.addFeature(n,o,n.index,t,i)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uy),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ly.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,n,o){let a={x:0,y:0,vertexCount:0};for(let s of Co(t,pT)){let l=0;for(let d of s)l+=d.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let d of s){if(d.length===0||fT(d))continue;let y=0;for(let g=0;g<d.length;g++){let x=d[g];if(g>=1){let v=d[g-1];if(!hT(x,v)){u.vertexLength+4>fe.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=x.sub(v)._perp()._unit(),w=v.dist(x);y+w>32768&&(y=0),Lo(this.layoutVertexArray,x.x,x.y,b.x,b.y,0,0,y),Lo(this.layoutVertexArray,x.x,x.y,b.x,b.y,0,1,y),a.x+=2*x.x,a.y+=2*x.y,a.vertexCount+=2,y+=w,Lo(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,y),Lo(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,y),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let S=u.vertexLength;this.indexArray.emplaceBack(S,S+2,S+1),this.indexArray.emplaceBack(S+1,S+2,S+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>fe.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),cT[e.type]!=="Polygon")continue;let c=[],p=[],h=u.vertexLength;for(let d of s)if(d.length!==0){d!==s[0]&&p.push(c.length/2);for(let y=0;y<d.length;y++){let g=d[y];Lo(this.layoutVertexArray,g.x,g.y,0,0,1,1,0),a.x+=g.x,a.y+=g.y,a.vertexCount+=1,c.push(g.x),c.push(g.y)}}let f=(0,dy.default)(c,p);for(let d=0;d<f.length;d+=3)this.indexArray.emplaceBack(h+f[d],h+f[d+2],h+f[d+1]);u.primitiveLength+=f.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}};U("FillExtrusionBucket",Do,{omit:["layers","features"]});function hT(r,e){return r.x===e.x&&(r.x<0||r.x>8192)||r.y===e.y&&(r.y<0||r.y>8192)}function fT(r){return r.every(e=>e.x<0)||r.every(e=>e.x>8192)||r.every(e=>e.y<0)||r.every(e=>e.y>8192)}m();var gy,mT=()=>gy=gy||new Le({"fill-extrusion-opacity":new j(A["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new H(A["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new j(A["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new j(A["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new nr(A["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new H(A["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new H(A["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new j(A["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),xy={get paint(){return mT()}};var nl=oe(ye(),1);var ol=class extends Ne{constructor(e){super(e,xy)}createBucket(e){return new Do(e)}queryRadius(){return Cr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,i,n,o,a,s,l){let u=Er(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(t,i),p=this.paint.get("fill-extrusion-base").evaluate(t,i),h=gT(u,l,a,0),f=yT(n,p,c,l),d=f[0],y=f[1];return dT(d,y,h)}};function zo(r,e){return r.x*e.x+r.y*e.y}function by(r,e){if(r.length===1){let t=0,i=e[t++],n;for(;!n||i.equals(n);)if(n=e[t++],!n)return 1/0;for(;t<e.length;t++){let o=e[t],a=r[0],s=n.sub(i),l=o.sub(i),u=a.sub(i),c=zo(s,s),p=zo(s,l),h=zo(l,l),f=zo(u,s),d=zo(u,l),y=c*h-p*p,g=(h*f-p*d)/y,x=(c*d-p*f)/y,v=1-g-x,b=i.z*v+n.z*g+o.z*x;if(isFinite(b))return b}return 1/0}else{let t=1/0;for(let i of e)t=Math.min(t,i.z);return t}}function dT(r,e,t){let i=1/0;Hs(t,e)&&(i=by(t,e[0]));for(let n=0;n<e.length;n++){let o=e[n],a=r[n];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],h=[l,u,p,c,l];Zs(t,h)&&(i=Math.min(i,by(t,h)))}}return i===1/0?!1:i}function yT(r,e,t,i){let n=[],o=[],a=i[8]*e,s=i[9]*e,l=i[10]*e,u=i[11]*e,c=i[8]*t,p=i[9]*t,h=i[10]*t,f=i[11]*t;for(let d of r){let y=[],g=[];for(let x of d){let v=x.x,b=x.y,w=i[0]*v+i[4]*b+i[12],S=i[1]*v+i[5]*b+i[13],P=i[2]*v+i[6]*b+i[14],k=i[3]*v+i[7]*b+i[15],I=w+a,C=S+s,M=P+l,F=k+u,D=w+c,E=S+p,T=P+h,N=k+f,X=new nl.default(I/F,C/F);X.z=M/F,y.push(X);let ie=new nl.default(D/N,E/N);ie.z=T/N,g.push(ie)}n.push(y),o.push(g)}return[n,o]}function gT(r,e,t,i){let n=[];for(let o of r){let a=[o.x,o.y,i,1];Ge.transformMat4(a,a,e),n.push(new nl.default(a[0]/a[3],a[1]/a[3]))}return n}m();m();m();var xT=be([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:_y,size:az,alignment:sz}=xT;m();var bT=be([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:vy,size:pz,alignment:hz}=bT;var Py=oe(ko(),1);var _T=Py.default.VectorTileFeature.types,wy=63,vT=Math.cos(75/2*(Math.PI/180)),wT=15,ST=20,PT=15,Ty=1/2,Sy=Math.pow(2,PT-1)/Ty,Fo=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new Ds,this.layoutVertexArray2=new zs,this.indexArray=new rt,this.programConfigurations=new ft(e.layers,e.zoom),this.segments=new fe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=Ki("line",this.layers,t);let n=this.layers[0].layout.get("line-sort-key"),o=!n.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,h=dt(s,p);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),h,i))continue;let f=o?n.evaluate(h,{},i):void 0,d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:mt(s),patterns:{},sortKey:f};a.push(d)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let h=Ji("line",this.layers,s,this.zoom,t);this.patternFeatures.push(h)}else this.addFeature(s,l,u,i,{});let p=e[u].feature;t.featureIndex.insert(p,l,u,c,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,vy)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_y),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let t=+e.properties.mapbox_clip_start,i=+e.properties.mapbox_clip_end;return{start:t,end:i}}}addFeature(e,t,i,n,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let p of t)this.addLine(p,e,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}addLine(e,t,i,n,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let x=0;x<e.length-1;x++)this.totalDistance+=e[x].dist(e[x+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=_T[t.type]==="Polygon",l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(s?3:2))return;i==="bevel"&&(o=1.05);let c=this.overscaling<=16?wT*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),h,f,d,y,g;this.e1=this.e2=-1,s&&(h=e[l-2],g=e[u].sub(h)._unit()._perp());for(let x=u;x<l;x++){if(d=x===l-1?s?e[u+1]:void 0:e[x+1],d&&e[x].equals(d))continue;g&&(y=g),h&&(f=h),h=e[x],g=d?d.sub(h)._unit()._perp():y,y=y||g;let v=y.add(g);(v.x!==0||v.y!==0)&&v._unit();let b=y.x*g.x+y.y*g.y,w=v.x*g.x+v.y*g.y,S=w!==0?1/w:1/0,P=2*Math.sqrt(2-2*w),k=w<vT&&f&&d,I=y.x*g.y-y.y*g.x>0;if(k&&x>u){let F=h.dist(f);if(F>2*c){let D=h.sub(h.sub(f)._mult(c/F)._round());this.updateDistance(f,D),this.addCurrentVertex(D,y,0,0,p),f=D}}let C=f&&d,M=C?i:s?"butt":n;if(C&&M==="round"&&(S<a?M="miter":S<=2&&(M="fakeround")),M==="miter"&&S>o&&(M="bevel"),M==="bevel"&&(S>2&&(M="flipbevel"),S<o&&(M="miter")),f&&this.updateDistance(f,h),M==="miter")v._mult(S),this.addCurrentVertex(h,v,0,0,p);else if(M==="flipbevel"){if(S>100)v=g.mult(-1);else{let F=S*y.add(g).mag()/y.sub(g).mag();v._perp()._mult(F*(I?-1:1))}this.addCurrentVertex(h,v,0,0,p),this.addCurrentVertex(h,v.mult(-1),0,0,p)}else if(M==="bevel"||M==="fakeround"){let F=-Math.sqrt(S*S-1),D=I?F:0,E=I?0:F;if(f&&this.addCurrentVertex(h,y,D,E,p),M==="fakeround"){let T=Math.round(P*180/Math.PI/ST);for(let N=1;N<T;N++){let X=N/T;if(X!==.5){let K=X-.5,$=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),Je=.848013+b*(-1.06021+b*.215638);X=X+X*K*(X-1)*($*K*K+Je)}let ie=g.sub(y)._mult(X)._add(y)._unit()._mult(I?-1:1);this.addHalfVertex(h,ie.x,ie.y,!1,I,0,p)}}d&&this.addCurrentVertex(h,g,-D,-E,p)}else if(M==="butt")this.addCurrentVertex(h,v,0,0,p);else if(M==="square"){let F=f?1:-1;this.addCurrentVertex(h,v,F,F,p)}else M==="round"&&(f&&(this.addCurrentVertex(h,y,0,0,p),this.addCurrentVertex(h,y,1,1,p,!0)),d&&(this.addCurrentVertex(h,g,-1,-1,p,!0),this.addCurrentVertex(h,g,0,0,p)));if(k&&x<l-1){let F=h.dist(d);if(F>2*c){let D=h.add(d.sub(h)._mult(c/F)._round());this.updateDistance(h,D),this.addCurrentVertex(D,g,0,0,p),h=D}}}}addCurrentVertex(e,t,i,n,o,a=!1){let s=t.x+t.y*i,l=t.y-t.x*i,u=-t.x+t.y*n,c=-t.y-t.x*n;this.addHalfVertex(e,s,l,a,!1,i,o),this.addHalfVertex(e,u,c,a,!0,-n,o),this.distance>Sy/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,n,o,a))}addHalfVertex({x:e,y:t},i,n,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(Sy-1):this.scaledDistance)*Ty;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(t<<1)+(a?1:0),Math.round(wy*i)+128,Math.round(wy*n)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,f=this.lineClips.end-this.lineClips.start,d=h/f;this.layoutVertexArray2.emplaceBack(d,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};U("LineBucket",Fo,{omit:["layers","patternFeatures"]});m();var Ay,TT=()=>Ay=Ay||new Le({"line-cap":new j(A.layout_line["line-cap"]),"line-join":new H(A.layout_line["line-join"]),"line-miter-limit":new j(A.layout_line["line-miter-limit"]),"line-round-limit":new j(A.layout_line["line-round-limit"]),"line-sort-key":new H(A.layout_line["line-sort-key"])}),My,AT=()=>My=My||new Le({"line-opacity":new H(A.paint_line["line-opacity"]),"line-color":new H(A.paint_line["line-color"]),"line-translate":new j(A.paint_line["line-translate"]),"line-translate-anchor":new j(A.paint_line["line-translate-anchor"]),"line-width":new H(A.paint_line["line-width"]),"line-gap-width":new H(A.paint_line["line-gap-width"]),"line-offset":new H(A.paint_line["line-offset"]),"line-blur":new H(A.paint_line["line-blur"]),"line-dasharray":new ri(A.paint_line["line-dasharray"]),"line-pattern":new nr(A.paint_line["line-pattern"]),"line-gradient":new ii(A.paint_line["line-gradient"])}),Bp={get paint(){return AT()},get layout(){return TT()}};var Op=class extends H{possiblyEvaluate(e,t){return t=new de(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=O({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}},al,sl=class extends Ne{constructor(e){super(e,Bp),this.gradientVersion=0,al||(al=new Op(Bp.paint.properties["line-width"].specification),al.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();ei(t)?this.stepInterpolant=t._styleExpression.expression instanceof Ei:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=al.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Fo(e)}queryRadius(e){let t=e,i=Iy(li("line-width",this,t),li("line-gap-width",this,t)),n=li("line-offset",this,t);return i/2+Math.abs(n)+Cr(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s){let l=Er(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Iy(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(n=od(n,c*s)),rd(l,n,u)}isTileClipped(){return!0}};function Iy(r,e){return e>0?e+2*r:r}m();m();m();var Cy=be([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ey=be([{name:"a_projected_pos",components:3,type:"Float32"}],4),Qz=be([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ky=be([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),eF=be([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Vp=be([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ly=be([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),tF=be([{name:"triangle",components:3,type:"Uint16"}]),rF=be([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),iF=be([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),nF=be([{type:"Float32",name:"offsetX"}]),oF=be([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),aF=be([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Oo=oe(ye(),1);m();function MT(r,e,t){let i=e.layout.get("text-transform").evaluate(t,{});return i==="uppercase"?r=r.toLocaleUpperCase():i==="lowercase"&&(r=r.toLocaleLowerCase()),ir.applyArabicShaping&&(r=ir.applyArabicShaping(r)),r}function Dy(r,e,t){return r.sections.forEach(i=>{i.text=MT(i.text,e,t)}),r}m();function zy(r){let e={},t={},i=[],n=0;function o(u){i.push(r[u]),n++}function a(u,c,p){let h=t[u];return delete t[u],t[c]=h,i[h].geometry[0].pop(),i[h].geometry[0]=i[h].geometry[0].concat(p[0]),h}function s(u,c,p){let h=e[c];return delete e[c],e[u]=h,i[h].geometry[0].shift(),i[h].geometry[0]=p[0].concat(i[h].geometry[0]),h}function l(u,c,p){let h=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(h.x,":").concat(h.y)}for(let u=0;u<r.length;u++){let c=r[u],p=c.geometry,h=c.text?c.text.toString():null;if(!h){o(u);continue}let f=l(h,p),d=l(h,p,!0);if(f in t&&d in e&&t[f]!==e[d]){let y=s(f,d,p),g=a(f,d,i[y].geometry);delete e[f],delete t[d],t[l(h,i[g].geometry,!0)]=g,i[y].geometry=null}else f in t?a(f,d,p):d in e?s(f,d,p):(o(u),e[f]=n-1,t[d]=n-1)}return i.filter(u=>u.geometry)}m();m();var Fy={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};m();var kr=24;m();var qy=oe(Gp(),1),Gy=3;function ZT(r,e,t){r===1&&t.readMessage(HT,e)}function HT(r,e,t){if(r===3){let{id:i,bitmap:n,width:o,height:a,left:s,top:l,advance:u}=t.readMessage($T,{});e.push({id:i,bitmap:new ui({width:o+2*Gy,height:a+2*Gy},n),metrics:{width:o,height:a,left:s,top:l,advance:u}})}}function $T(r,e,t){r===1?e.id=t.readVarint():r===2?e.bitmap=t.readBytes():r===3?e.width=t.readVarint():r===4?e.height=t.readVarint():r===5?e.left=t.readSVarint():r===6?e.top=t.readSVarint():r===7&&(e.advance=t.readVarint())}function jy(r){return new qy.default(r).readFields(ZT,[])}m();m();function Ro(r){let e=0,t=0;for(let s of r)e+=s.w*s.h,t=Math.max(t,s.w);r.sort((s,l)=>l.h-s.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}],o=0,a=0;for(let s of r)for(let l=n.length-1;l>=0;l--){let u=n[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=n.pop();l<n.length&&(n[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(n.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var gt=1;var tn=class{constructor(e,{pixelRatio:t,version:i,stretchX:n,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=o,this.content=a,this.version=i}get tl(){return[this.paddedRect.x+gt,this.paddedRect.y+gt]}get br(){return[this.paddedRect.x+this.paddedRect.w-gt,this.paddedRect.y+this.paddedRect.h-gt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-gt*2)/this.pixelRatio,(this.paddedRect.h-gt*2)/this.pixelRatio]}},qp=class{constructor(e,t){let i={},n={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,i,o),this.addImages(t,n,o);let{w:a,h:s}=Ro(o),l=new we({width:a||1,height:s||1});for(let u in e){let c=e[u],p=i[u].paddedRect;we.copy(c.data,l,{x:0,y:0},{x:p.x+gt,y:p.y+gt},c.data)}for(let u in t){let c=t[u],p=n[u].paddedRect,h=p.x+gt,f=p.y+gt,d=c.data.width,y=c.data.height;we.copy(c.data,l,{x:0,y:0},{x:h,y:f},c.data),we.copy(c.data,l,{x:0,y:y-1},{x:h,y:f-1},{width:d,height:1}),we.copy(c.data,l,{x:0,y:0},{x:h,y:f+y},{width:d,height:1}),we.copy(c.data,l,{x:d-1,y:0},{x:h-1,y:f},{width:1,height:y}),we.copy(c.data,l,{x:0,y:0},{x:h+d,y:f},{width:1,height:y})}this.image=l,this.iconPositions=i,this.patternPositions=n}addImages(e,t,i){for(let n in e){let o=e[n],a={x:0,y:0,w:o.data.width+2*gt,h:o.data.height+2*gt};i.push(a),t[n]=new tn(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t||e.version===t.version)return;e.version=t.version;let[n,o]=e.tl;i.update(t.data,void 0,{x:n,y:o})}};U("ImagePosition",tn);U("ImageAtlas",qp);var pi=(n=>(n[n.none=0]="none",n[n.horizontal=1]="horizontal",n[n.vertical=2]="vertical",n[n.horizontalOnly=3]="horizontalOnly",n))(pi||{});function cl(r){let e=.5,t=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(r){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0;break}return{horizontalAlign:e,verticalAlign:t}}var $y=oe(ko(),1);m();var Zy=255,Bo=128,pl=Zy*Bo;function jp(r,e){let{expression:t}=e;if(t.kind==="constant")return{kind:"constant",layoutSize:t.evaluate(new de(r+1))};if(t.kind==="source")return{kind:"source"};{let{zoomStops:i,interpolationType:n}=t,o=0;for(;o<i.length&&i[o]<=r;)o++;o=Math.max(0,o-1);let a=o;for(;a<i.length&&i[a]<r+1;)a++;a=Math.min(i.length-1,a);let s=i[o],l=i[a];if(t.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n};let u=t.evaluate(new de(s)),c=t.evaluate(new de(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:n}}}function rn(r,{uSize:e,uSizeT:t},{lowerSize:i,upperSize:n}){return r.kind==="source"?i/Bo:r.kind==="composite"?Se.number(i/Bo,n/Bo,t):e}function hi(r,e){let t=0,i=0;if(r.kind==="constant")i=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:n,minZoom:o,maxZoom:a}=r,s=n?Ae(vt.interpolationFactor(n,e,o,a),0,1):0;r.kind==="camera"?i=Se.number(r.minSize,r.maxSize,s):t=s}return{uSizeT:t,uSize:i}}m();function nn(r,e,t){let i="never",n=r.get(e);return n?i=n:r.get(t)&&(i="always"),i}var XT=$y.default.VectorTileFeature.types,KT=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hl(r,e,t,i,n,o,a,s,l,u,c,p,h){let f=s?Math.min(pl,Math.round(s[0])):0,d=s?Math.min(pl,Math.round(s[1])):0;r.emplaceBack(e,t,Math.round(i*32),Math.round(n*32),o,a,(f<<1)+(l?1:0),d,u*16,c*16,p*256,h*256)}function fi(r,e,t){r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t)}function JT(r){for(let e of r.sections)if(Gm(e.text))return!0;return!1}var Vo=class{constructor(e){this.layoutVertexArray=new Fs,this.indexArray=new rt,this.programConfigurations=e,this.segments=new fe,this.dynamicLayoutVertexArray=new Rs,this.opacityVertexArray=new Bs,this.hasVisibleVertices=!1,this.placedSymbolArray=new co}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Cy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ey.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,KT,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};U("SymbolBuffers",Vo);var Uo=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new fe,this.collisionVertexArray=new Vs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ky.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};U("CollisionBuffers",Uo);var Rt=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=G.identity([]),this.placementViewportMatrix=G.identity([]);let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=jp(this.zoom,i["text-size"]),this.iconSizeData=jp(this.zoom,i["icon-size"]);let n=this.layers[0].layout,o=n.get("symbol-sort-key"),a=n.get("symbol-z-order");this.canOverlap=nn(n,"text-overlap","text-allow-overlap")!=="never"||nn(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(l=>pi[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Vo(new ft(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Vo(new ft(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new ho,this.lineVertexArray=new fo,this.symbolInstances=new po,this.textAnchorOffsets=new mo}calculateGlyphDependencies(e,t,i,n,o){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(i||n)&&o){let s=Fy[e.charAt(a)];s&&(t[s.charCodeAt(0)]=!0)}}populate(e,t,i){let n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof wt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let h=t.iconDependencies,f=t.glyphDependencies,d=t.availableImages,y=new de(this.zoom);for(let{feature:g,id:x,index:v,sourceLayerIndex:b}of e){let w=n._featureFilter.needGeometry,S=dt(g,w);if(!n._featureFilter.filter(y,S,i))continue;w||(S.geometry=mt(g));let P;if(u){let M=n.getValueAndResolveTokens("text-field",S,i,d),F=wt.factory(M),D=this.hasRTLText=this.hasRTLText||JT(F);(!D||ir.getRTLTextPluginStatus()==="unavailable"||D&&ir.isParsed())&&(P=Dy(F,n,S))}let k;if(c){let M=n.getValueAndResolveTokens("icon-image",S,i,d);M instanceof ht?k=M:k=ht.fromString(M)}if(!P&&!k)continue;let I=this.sortFeaturesByKey?p.evaluate(S,{},i):void 0,C={id:x,text:P,icon:k,index:v,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:XT[g.type],sortKey:I};if(this.features.push(C),k&&(h[k.name]=!0),P){let M=a.evaluate(S,{},i).join(","),F=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let D of P.sections)if(D.image)h[D.image.name]=!0;else{let E=dp(P.toString()),T=D.fontStack||M,N=f[T]=f[T]||{};this.calculateGlyphDependencies(D.text,N,F,this.allowVerticalPlacement,E)}}}o.get("symbol-placement")==="line"&&(this.features=zy(this.features)),this.sortFeaturesByKey&&this.features.sort((g,x)=>g.sortKey-x.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let i=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),o=e.dist(t[e.segment]),a={};for(let s=e.segment+1;s<t.length;s++)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:n},s<t.length-1&&(n+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,n,o,a,s,l,u,c,p,h){let f=e.indexArray,d=e.layoutVertexArray,y=e.segments.prepareSegment(4*t.length,d,f,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,x=y.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let w=0;w<t.length;w++){let{tl:S,tr:P,bl:k,br:I,tex:C,pixelOffsetTL:M,pixelOffsetBR:F,minFontScaleX:D,minFontScaleY:E,glyphOffset:T,isSDF:N,sectionIndex:X}=t[w],ie=y.vertexLength,K=T[1];hl(d,l.x,l.y,S.x,K+S.y,C.x,C.y,i,N,M.x,M.y,D,E),hl(d,l.x,l.y,P.x,K+P.y,C.x+C.w,C.y,i,N,F.x,M.y,D,E),hl(d,l.x,l.y,k.x,K+k.y,C.x,C.y+C.h,i,N,M.x,F.y,D,E),hl(d,l.x,l.y,I.x,K+I.y,C.x+C.w,C.y+C.h,i,N,F.x,F.y,D,E),fi(e.dynamicLayoutVertexArray,l,v),f.emplaceBack(ie,ie+1,ie+2),f.emplaceBack(ie+1,ie+2,ie+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(T[0]),(w===t.length-1||X!==t[w+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},h,b&&b[X])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,x,u,c,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,t,i,n,o,a){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,n,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,i,n,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,h=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(c,p,a,h,f,new Oo.default(e,t)),this._addCollisionDebugVertex(c,p,a,h,f,new Oo.default(i,t)),this._addCollisionDebugVertex(c,p,a,h,f,new Oo.default(i,n)),this._addCollisionDebugVertex(c,p,a,h,f,new Oo.default(e,n)),l.vertexLength+=4;let d=o.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,n){for(let o=e;o<t;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,n?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Uo(go,Vp.members,Ar),this.iconCollisionBox=new Uo(go,Vp.members,Ar);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,n,o,a,s,l,u){let c={};for(let p=t;p<i;p++){let h=e.get(p);c.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.textFeatureIndex=h.featureIndex;break}for(let p=n;p<o;p++){let h=e.get(p);c.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalTextFeatureIndex=h.featureIndex;break}for(let p=a;p<s;p++){let h=e.get(p);c.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.iconFeatureIndex=h.featureIndex;break}for(let p=l;p<u;p++){let h=e.get(p);c.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalIconFeatureIndex=h.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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}addIndicesForPlacedSymbol(e,t){let i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+i.numGlyphs*4;for(let o=i.vertexStartIndex;o<n;o+=4)e.indexArray.emplaceBack(o,o+1,o+2),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),n=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);n.push(Math.round(t*l.anchorX+i*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>n[s]-n[l]||o[l]-o[s]),a}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((n,o,a)=>{n>=0&&a.indexOf(n)===o&&this.addIndicesForPlacedSymbol(this.text,n)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};U("SymbolBucket",Rt,{omit:["layers","collisionBoxArray","features","compareText"]});Rt.MAX_GLYPHS=65535;Rt.addDynamicAttributes=fi;m();function Wy(r,e){return e.replace(/{([^{}]+)}/g,(t,i)=>r&&i in r?String(r[i]):"")}m();var Xy,YT=()=>Xy=Xy||new Le({"symbol-placement":new j(A.layout_symbol["symbol-placement"]),"symbol-spacing":new j(A.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new j(A.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new H(A.layout_symbol["symbol-sort-key"]),"symbol-z-order":new j(A.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new j(A.layout_symbol["icon-allow-overlap"]),"icon-overlap":new j(A.layout_symbol["icon-overlap"]),"icon-ignore-placement":new j(A.layout_symbol["icon-ignore-placement"]),"icon-optional":new j(A.layout_symbol["icon-optional"]),"icon-rotation-alignment":new j(A.layout_symbol["icon-rotation-alignment"]),"icon-size":new H(A.layout_symbol["icon-size"]),"icon-text-fit":new j(A.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new j(A.layout_symbol["icon-text-fit-padding"]),"icon-image":new H(A.layout_symbol["icon-image"]),"icon-rotate":new H(A.layout_symbol["icon-rotate"]),"icon-padding":new H(A.layout_symbol["icon-padding"]),"icon-keep-upright":new j(A.layout_symbol["icon-keep-upright"]),"icon-offset":new H(A.layout_symbol["icon-offset"]),"icon-anchor":new H(A.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new j(A.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new j(A.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new j(A.layout_symbol["text-rotation-alignment"]),"text-field":new H(A.layout_symbol["text-field"]),"text-font":new H(A.layout_symbol["text-font"]),"text-size":new H(A.layout_symbol["text-size"]),"text-max-width":new H(A.layout_symbol["text-max-width"]),"text-line-height":new j(A.layout_symbol["text-line-height"]),"text-letter-spacing":new H(A.layout_symbol["text-letter-spacing"]),"text-justify":new H(A.layout_symbol["text-justify"]),"text-radial-offset":new H(A.layout_symbol["text-radial-offset"]),"text-variable-anchor":new j(A.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new H(A.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new H(A.layout_symbol["text-anchor"]),"text-max-angle":new j(A.layout_symbol["text-max-angle"]),"text-writing-mode":new j(A.layout_symbol["text-writing-mode"]),"text-rotate":new H(A.layout_symbol["text-rotate"]),"text-padding":new j(A.layout_symbol["text-padding"]),"text-keep-upright":new j(A.layout_symbol["text-keep-upright"]),"text-transform":new H(A.layout_symbol["text-transform"]),"text-offset":new H(A.layout_symbol["text-offset"]),"text-allow-overlap":new j(A.layout_symbol["text-allow-overlap"]),"text-overlap":new j(A.layout_symbol["text-overlap"]),"text-ignore-placement":new j(A.layout_symbol["text-ignore-placement"]),"text-optional":new j(A.layout_symbol["text-optional"])}),Ky,QT=()=>Ky=Ky||new Le({"icon-opacity":new H(A.paint_symbol["icon-opacity"]),"icon-color":new H(A.paint_symbol["icon-color"]),"icon-halo-color":new H(A.paint_symbol["icon-halo-color"]),"icon-halo-width":new H(A.paint_symbol["icon-halo-width"]),"icon-halo-blur":new H(A.paint_symbol["icon-halo-blur"]),"icon-translate":new j(A.paint_symbol["icon-translate"]),"icon-translate-anchor":new j(A.paint_symbol["icon-translate-anchor"]),"text-opacity":new H(A.paint_symbol["text-opacity"]),"text-color":new H(A.paint_symbol["text-color"],{runtimeType:Mt,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new H(A.paint_symbol["text-halo-color"]),"text-halo-width":new H(A.paint_symbol["text-halo-width"]),"text-halo-blur":new H(A.paint_symbol["text-halo-blur"]),"text-translate":new j(A.paint_symbol["text-translate"]),"text-translate-anchor":new j(A.paint_symbol["text-translate-anchor"])}),fl={get paint(){return QT()},get layout(){return YT()}};m();var No=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Li,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};U("FormatSectionOverride",No,{omit:["defaultValue"]});var ml=class r extends Ne{constructor(e){super(e,fl)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let n=[];for(let o of i)n.indexOf(o)<0&&n.push(o);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){let o=this.layout.get(e).evaluate(t,{},i,n),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!ei(a.value)&&o?Wy(t.properties,o):o}createBucket(e){return new Rt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of fl.paint.overridableProperties){if(!r.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),i=new No(t),n=new Kr(i,t.property.specification),o=null;t.value.kind==="constant"||t.value.kind==="source"?o=new br("source",n):o=new _r("composite",n,t.value.zoomStops),this.paint._values[e]=new ot(t.property,o,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!this.layout||t.isDataDriven()||i.isDataDriven()?!1:r.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let i=e.get("text-field"),n=fl.paint.properties[t],o=!1,a=s=>{for(let l of s)if(n.overrides&&n.overrides.hasOverride(l)){o=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof wt)a(i.value.value.sections);else if(i.value.kind==="source"){let s=u=>{if(!o)if(u instanceof gr&&Ze(u.value)===Di){let c=u.value;a(c.sections)}else u instanceof Dn?a(u.sections):u.eachChild(s)},l=i.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};m();m();var Jy,eA=()=>Jy=Jy||new Le({"background-color":new j(A.paint_background["background-color"]),"background-pattern":new ri(A.paint_background["background-pattern"]),"background-opacity":new j(A.paint_background["background-opacity"])}),Yy={get paint(){return eA()}};var dl=class extends Ne{constructor(e){super(e,Yy)}};m();m();var Qy,tA=()=>Qy=Qy||new Le({"raster-opacity":new j(A.paint_raster["raster-opacity"]),"raster-hue-rotate":new j(A.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new j(A.paint_raster["raster-brightness-min"]),"raster-brightness-max":new j(A.paint_raster["raster-brightness-max"]),"raster-saturation":new j(A.paint_raster["raster-saturation"]),"raster-contrast":new j(A.paint_raster["raster-contrast"]),"raster-resampling":new j(A.paint_raster["raster-resampling"]),"raster-fade-duration":new j(A.paint_raster["raster-fade-duration"])}),eg={get paint(){return tA()}};var yl=class extends Ne{constructor(e){super(e,eg)}};m();function tg(r){let e=[],t=r.id;return t===void 0&&e.push({message:"layers.".concat(t,': missing required property "id"')}),r.render===void 0&&e.push({message:"layers.".concat(t,': missing required method "render"')}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:"layers.".concat(t,': property "renderingMode" must be either "2d" or "3d"')}),e}var gl=class extends Ne{constructor(t){super(t,{});this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)};this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)};this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function xl(r){if(r.type==="custom")return new gl(r);switch(r.type){case"background":return new dl(r);case"circle":return new Ws(r);case"fill":return new rl(r);case"fill-extrusion":return new ol(r);case"heatmap":return new Ks(r);case"hillshade":return new Js(r);case"line":return new sl(r);case"raster":return new yl(r);case"symbol":return new ml(r)}}m();m();function on(r){let e=[];if(typeof r=="string")e.push({id:"default",url:r});else if(r&&r.length>0){let t=[];for(let{id:i,url:n}of r){let o="".concat(i).concat(n);t.indexOf(o)===-1&&(t.push(o),e.push({id:i,url:n}))}}return e}async function rg(r,e,t,i){let n=on(r),o=t>1?"@2x":"",a={},s={};for(let{id:l,url:u}of n){let c=e.transformRequest(e.normalizeSpriteURL(u,o,".json"),"SpriteJSON");a[l]=dr(c,i);let p=e.transformRequest(e.normalizeSpriteURL(u,o,".png"),"SpriteImage");s[l]=at.getImage(p,i)}return await Promise.all([...Object.values(a),...Object.values(s)]),rA(a,s)}async function rA(r,e){let t={};for(let i in r){t[i]={};let n=J.getImageCanvasContext((await e[i]).data),o=(await r[i]).data;for(let a in o){let{width:s,height:l,x:u,y:c,sdf:p,pixelRatio:h,stretchX:f,stretchY:d,content:y}=o[a],g={width:s,height:l,x:u,y:c,context:n};t[i][a]={data:null,pixelRatio:h,sdf:p,stretchX:f,stretchY:d,content:y,spriteData:g}}}return t}m();m();var _e=class{constructor(e,t,i,n){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,n)}update(e,t,i){let{width:n,height:o}=e,a=(!this.size||this.size[0]!==n||this.size[1]!==o)&&!i,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(t&&t.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||pt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||pt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,n,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,i){let{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),i===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(i=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};m();function ig(r){let{userImage:e}=r;return e&&e.render&&e.render()?(r.data.replace(new Uint8Array(e.data.buffer)),!0):!1}var bl=1,_l=class extends me{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new we({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let i=t.spriteData;t.data=new we({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let i=!0,n=t.data||t.spriteData;return this._validateStretch(t.stretchX,n&&n.width)||(this.fire(new Z(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(t.stretchY,n&&n.height)||(this.fire(new Z(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(t.content,t)||(this.fire(new Z(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let n of e){if(n[0]<i||n[1]<n[0]||t<n[1])return!1;i=n[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,n=i&&i.width||t.data.width,o=i&&i.height||t.data.height;return!(e[0]<0||n<e[0]||e[1]<0||o<e[1]||e[2]<0||n<e[2]||e[3]<0||o<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let n=this.getImage(e);if(i&&(n.data.width!==t.data.width||n.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(n.data.width,"x").concat(n.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=n.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let n=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(n=!1);this.isLoaded()||n?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let i of e){let n=this.getImage(i);n||(this.fire(new z("styleimagemissing",{id:i})),n=this.getImage(i)),n?t[i]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,hasRenderCallback:!!(n.userImage&&n.userImage.render)}:ke('Image "'.concat(i,'" 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.'))}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],i=this.getImage(e);if(!i)return null;if(t&&t.position.version===i.version)return t.position;if(t)t.position.version=i.version;else{let n=i.data.width+bl*2,o=i.data.height+bl*2,a={w:n,h:o,x:0,y:0},s=new tn(a,i);this.patterns[e]={bin:a,position:s}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new _e(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let o in this.patterns)e.push(this.patterns[o].bin);let{w:t,h:i}=Ro(e),n=this.atlasImage;n.resize({width:t||1,height:i||1});for(let o in this.patterns){let{bin:a}=this.patterns[o],s=a.x+bl,l=a.y+bl,u=this.getImage(o).data,c=u.width,p=u.height;we.copy(u,n,{x:0,y:0},{x:s,y:l},{width:c,height:p}),we.copy(u,n,{x:0,y:p-1},{x:s,y:l-1},{width:c,height:1}),we.copy(u,n,{x:0,y:0},{x:s,y:l+p},{width:c,height:1}),we.copy(u,n,{x:c-1,y:0},{x:s-1,y:l},{width:1,height:p}),we.copy(u,n,{x:0,y:0},{x:s+c,y:l},{width:1,height:p})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let i=this.getImage(t);i||ke('Image with ID: "'.concat(t,'" was not found')),ig(i)&&this.updateImage(t,i)}}};m();m();async function ng(r,e,t,i){let n=e*256,o=n+255,a=i.transformRequest(t.replace("{fontstack}",r).replace("{range}","".concat(n,"-").concat(o)),"Glyphs"),s=await Sf(a,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(e,", ").concat(n,"-").concat(o));let l={};for(let u of jy(s.data))l[u.id]=u;return l}m();var Go=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:a="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;let l=this.size=e+t*4,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font="".concat(s," ").concat(a," ").concat(e,"px ").concat(o),c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:a}=this.ctx.measureText(e),s=Math.ceil(i),l=0,u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-o))),c=Math.min(this.size-this.buffer,s+Math.ceil(n)),p=u+2*this.buffer,h=c+2*this.buffer,f=Math.max(p*h,0),d=new Uint8ClampedArray(f),y={data:d,width:p,height:h,glyphWidth:u,glyphHeight:c,glyphTop:s,glyphLeft:l,glyphAdvance:t};if(u===0||c===0)return y;let{ctx:g,buffer:x,gridInner:v,gridOuter:b}=this;g.clearRect(x,x,u,c),g.fillText(e,x,x+s);let w=g.getImageData(x,x,u,c);b.fill(1e20,0,f),v.fill(0,0,f);for(let S=0;S<c;S++)for(let P=0;P<u;P++){let k=w.data[4*(S*u+P)+3]/255;if(k===0)continue;let I=(S+x)*p+P+x;if(k===1)b[I]=0,v[I]=1e20;else{let C=.5-k;b[I]=C>0?C*C:0,v[I]=C<0?C*C:0}}og(b,0,0,p,h,p,this.f,this.v,this.z),og(v,x,x,u,c,p,this.f,this.v,this.z);for(let S=0;S<f;S++){let P=Math.sqrt(b[S])-Math.sqrt(v[S]);d[S]=Math.round(255-255*(P/this.radius+this.cutoff))}return y}};function og(r,e,t,i,n,o,a,s,l){for(let u=e;u<e+i;u++)ag(r,t*o+u,o,n,a,s,l);for(let u=t;u<t+n;u++)ag(r,u*o+e,1,i,a,s,l)}function ag(r,e,t,i,n,o,a){o[0]=0,a[0]=-1e20,a[1]=1e20,n[0]=r[e];for(let s=1,l=0,u=0;s<i;s++){n[s]=r[e+s*t];let c=s*s;do{let p=o[l];u=(n[s]-n[p]+c-p*p)/(s-p)/2}while(u<=a[l]&&--l>-1);l++,o[l]=s,a[l]=u,a[l+1]=1e20}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;let u=o[l],c=s-u;r[e+s*t]=n[u]+c*c}}var an=class an{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}async getGlyphs(e){let t=[];for(let o in e)for(let a of e[o])t.push(this._getAndCacheGlyphsPromise(o,a));let i=await Promise.all(t),n={};for(let{stack:o,id:a,glyph:s}of i)n[o]||(n[o]={}),n[o][a]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return n}async _getAndCacheGlyphsPromise(e,t){let i=this.entries[e];i||(i=this.entries[e]={glyphs:{},requests:{},ranges:{}});let n=i.glyphs[t];if(n!==void 0)return{stack:e,id:t,glyph:n};if(n=this._tinySDF(i,e,t),n)return i.glyphs[t]=n,{stack:e,id:t,glyph:n};let o=Math.floor(t/256);if(o*256>65535)throw new Error("glyphs > 65535 not supported");if(i.ranges[o])return{stack:e,id:t,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!i.requests[o]){let s=an.loadGlyphRange(e,o,this.url,this.requestManager);i.requests[o]=s}let a=await i.requests[o];for(let s in a)this._doesCharSupportLocalGlyph(+s)||(i.glyphs[+s]=a[+s]);return i.ranges[o]=!0,{stack:e,id:t,glyph:a[t]||null}}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(pe["CJK Unified Ideographs"](e)||pe["Hangul Syllables"](e)||pe.Hiragana(e)||pe.Katakana(e))}_tinySDF(e,t,i){let n=this.localIdeographFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let o=2,a=e.tinySDF;if(!a){let c="400";/bold/i.test(t)?c="900":/medium/i.test(t)?c="500":/light/i.test(t)&&(c="200"),a=e.tinySDF=new an.TinySDF({fontSize:24*o,buffer:3*o,radius:8*o,cutoff:.25,fontFamily:n,fontWeight:c})}let s=a.draw(String.fromCharCode(i));return{id:i,bitmap:new ui({width:s.width||30*o,height:s.height||30*o},s.data),metrics:{width:s.glyphWidth/o||24,height:s.glyphHeight/o||24,left:s.glyphLeft/o+.5||0,top:s.glyphTop/o-27.5||-8,advance:s.glyphAdvance/o||24,isDoubleResolution:!0}}}};an.loadGlyphRange=ng,an.TinySDF=Go;var vl=an;m();var Hp=class{constructor(){this.specification=A.light.position}possiblyEvaluate(e,t){return df(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Se.number(e.x,t.x,i),y:Se.number(e.y,t.y,i),z:Se.number(e.z,t.z,i)}}},sg="-transition",Zp,wl=class extends me{constructor(e){super(),Zp=Zp||new Le({anchor:new j(A.light.anchor),position:new Hp,color:new j(A.light.color),intensity:new j(A.light.intensity)}),this._transitionable=new Ni(Zp),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(Rm,e,t))for(let i in e){let n=e[i];i.endsWith(sg)?this._transitionable.setTransition(i.slice(0,-sg.length),n):this._transitionable.setValue(i,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return i&&i.validate===!1?!1:Ri(this,e.call(Ue,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:A}))}};m();var Sl=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let n=e.length%2===1,o=[],a=n?-e[e.length-1]*i:0,s=e[0]*i,l=!0;o.push({left:a,right:s,isDash:l,zeroLength:e[0]===0});let u=e[0];for(let c=1;c<e.length;c++){l=!l;let p=e[c];a=u*i,u+=p,s=u*i,o.push({left:a,right:s,isDash:l,zeroLength:p===0})}return o}addRoundDash(e,t,i){let n=t/2;for(let o=-i;o<=i;o++){let a=this.nextRow+i+o,s=this.width*a,l=0,u=e[l];for(let c=0;c<this.width;c++){c/u.right>1&&(u=e[++l]);let p=Math.abs(c-u.left),h=Math.abs(c-u.right),f=Math.min(p,h),d,y=o/i*(n+1);if(u.isDash){let g=n-Math.abs(y);d=Math.sqrt(f*f+g*g)}else d=n-Math.sqrt(f*f+y*y);this.data[s+c]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let l=e[s],u=e[s+1];l.zeroLength?e.splice(s,1):u&&u.isDash===l.isDash&&(u.left=l.left,e.splice(s,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let n=this.width*this.nextRow,o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);let l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u),p=a.isDash?c:-c;this.data[n+s]=Math.max(0,Math.min(255,p+128))}}addDash(e,t){let i=t?7:0,n=2*i+1;if(this.nextRow+n>this.height)return ke("LineAtlas out of space"),null;let o=0;for(let s=0;s<e.length;s++)o+=e[s];if(o!==0){let s=this.width/o,l=this.getDashRanges(e,this.width,s);t?this.addRoundDash(l,s,i):this.addRegularDash(l)}let a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};m();m();m();var Pl=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var Tl=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Pl(()=>this.process()),this.subscription=vf(this.target,"message",i=>this.receive(i),!1),this.globalScope=er(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,n)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[o]={resolve:i,reject:n},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let l={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s=Gr(Bt({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Bi(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){let t=e.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let n=this.abortControllers[i];delete this.abortControllers[i],n&&n.abort();return}if(er(self)||t.mustQueue){this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;t.error?o.reject(Oi(t.error)):o.resolve(Oi(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(t.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let i=Oi(t.data),n=new AbortController;this.abortControllers[e]=n;try{let o=await this.messageHandlers[t.type](t.sourceMapId,i,n);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,t,i){let n=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Bi(t):null,data:Bi(i,n)};this.target.postMessage(o,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};m();m();m();m();var lg='(()=>{var _y=Object.create;var Ti=Object.defineProperty,Iy=Object.defineProperties,Ty=Object.getOwnPropertyDescriptor,Cy=Object.getOwnPropertyDescriptors,ky=Object.getOwnPropertyNames,Bl=Object.getOwnPropertySymbols,My=Object.getPrototypeOf,Rl=Object.prototype.hasOwnProperty,Ey=Object.prototype.propertyIsEnumerable;var zl=(t,e,r)=>e in t?Ti(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dt=(t,e)=>{for(var r in e||(e={}))Rl.call(e,r)&&zl(t,r,e[r]);if(Bl)for(var r of Bl(e))Ey.call(e,r)&&zl(t,r,e[r]);return t},Ci=(t,e)=>Iy(t,Cy(e));var Ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ol=(t,e)=>{for(var r in e)Ti(t,r,{get:e[r],enumerable:!0})},Fy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ky(e))!Rl.call(t,i)&&i!==r&&Ti(t,i,{get:()=>e[i],enumerable:!(n=Ty(e,i))||n.enumerable});return t};var Z=(t,e,r)=>(r=t!=null?_y(My(t)):{},Fy(e||!t||!t.__esModule?Ti(r,"default",{value:t,enumerable:!0}):r,t));var he=Ae((d0,Nl)=>{"use strict";Nl.exports=sr;function sr(t,e){this.x=t,this.y=e}sr.prototype={clone:function(){return new sr(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};sr.convert=function(t){return t instanceof sr?t:Array.isArray(t)?new sr(t[0],t[1]):t}});var Gl=Ae((g0,$l)=>{"use strict";$l.exports=Ul;function Ul(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}Ul.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}}});var Mc=Ae((Yv,Ts)=>{function hd(t,e){var r,n,i,o,a,s,l,u,c,p;for(r=t.length&3,n=t.length-r,i=e,a=3432918353,l=461845907,p=0;p<n;)c=t.charCodeAt(p)&255|(t.charCodeAt(++p)&255)<<8|(t.charCodeAt(++p)&255)<<16|(t.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(t.charCodeAt(p+2)&255)<<16;case 2:c^=(t.charCodeAt(p+1)&255)<<8;case 1:c^=t.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof Ts<"u"&&(Ts.exports=hd)});var Ec=Ae((Qv,Cs)=>{function dd(t,e){for(var r=t.length,n=e^r,i=0,o;r>=4;)o=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(t.charCodeAt(i+2)&255)<<16;case 2:n^=(t.charCodeAt(i+1)&255)<<8;case 1:n^=t.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof Cs!==void 0&&(Cs.exports=dd)});var ks=Ae((e1,Lo)=>{var Fc=Mc(),gd=Ec();Lo.exports=Fc;Lo.exports.murmur3=Fc;Lo.exports.murmur2=gd});var $s=Ae((JP,Us)=>{"use strict";Us.exports=Jo;Us.exports.default=Jo;function Jo(t,e,r){r=r||2;var n=e&&e.length,i=n?e[0]*r:t.length,o=xp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=nx(t,e,o,r)),t.length>80*r){s=u=t[0],l=c=t[1];for(var m=r;m<i;m+=r)p=t[m],f=t[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return Wn(o,a,r,s,l,y,0),a}function xp(t,e,r,n,i){var o,a;if(i===Ns(t,e,r,n)>0)for(o=e;o<r;o+=n)a=gp(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=gp(o,t[o],t[o+1],a);return a&&Zo(a,a.next)&&(Xn(a),a=a.next),a}function tr(t,e){if(!t)return t;e||(e=t);var r=t,n;do if(n=!1,!r.steiner&&(Zo(r,r.next)||oe(r.prev,r,r.next)===0)){if(Xn(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function Wn(t,e,r,n,i,o,a){if(t){!a&&o&&lx(t,n,i,o);for(var s=t,l,u;t.prev!==t.next;){if(l=t.prev,u=t.next,o?ex(t,n,i,o):Qg(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Xn(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=tx(tr(t),e,r),Wn(t,e,r,n,i,o,2)):a===2&&rx(t,e,r,n,i,o):Wn(tr(t),e,r,n,i,o,1);break}}}}function Qg(t){var e=t.prev,r=t,n=t.next;if(oe(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Ir(i,s,o,l,a,u,m.x,m.y)&&oe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ex(t,e,r,n){var i=t.prev,o=t,a=t.next;if(oe(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,h=s>l?s>u?s:u:l>u?l:u,d=c>p?c>f?c:f:p>f?p:f,g=Rs(y,m,e,r,n),b=Rs(h,d,e,r,n),x=t.prevZ,v=t.nextZ;x&&x.z>=g&&v&&v.z<=b;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Ir(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=d&&v!==i&&v!==a&&Ir(s,c,l,p,u,f,v.x,v.y)&&oe(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Ir(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=b;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=d&&v!==i&&v!==a&&Ir(s,c,l,p,u,f,v.x,v.y)&&oe(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function tx(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Zo(i,o)&&bp(i,n,n.next,o)&&Hn(i,o)&&Hn(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Xn(n),Xn(n.next),n=t=o),n=n.next}while(n!==t);return tr(n)}function rx(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&px(a,s)){var l=vp(a,s);a=tr(a,a.next),l=tr(l,l.next),Wn(a,e,r,n,i,o,0),Wn(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function nx(t,e,r,n){var i=[],o,a,s,l,u;for(o=0,a=e.length;o<a;o++)s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=xp(t,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push(cx(u));for(i.sort(ix),o=0;o<i.length;o++)r=ox(i[o],r);return r}function ix(t,e){return t.x-e.x}function ox(t,e){var r=ax(t,e);if(!r)return e;var n=vp(r,t);return tr(n,n.next),tr(r,r.next)}function ax(t,e){var r=e,n=t.x,i=t.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==e);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Ir(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),Hn(r,t)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&sx(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function sx(t,e){return oe(t.prev,t,e.prev)<0&&oe(e.next,t,t.next)<0}function lx(t,e,r,n){var i=t;do i.z===0&&(i.z=Rs(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,ux(i)}function ux(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<u&&(s++,n=n.nextZ,!!n);e++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return t}function Rs(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function cx(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Ir(t,e,r,n,i,o,a,s){return(i-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(n-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function px(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!fx(t,e)&&(Hn(t,e)&&Hn(e,t)&&yx(t,e)&&(oe(t.prev,t,e.prev)||oe(t,e.prev,e))||Zo(t,e)&&oe(t.prev,t,t.next)>0&&oe(e.prev,e,e.next)>0)}function oe(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Zo(t,e){return t.x===e.x&&t.y===e.y}function bp(t,e,r,n){var i=jo(oe(t,e,r)),o=jo(oe(t,e,n)),a=jo(oe(r,n,t)),s=jo(oe(r,n,e));return!!(i!==o&&a!==s||i===0&&qo(t,r,e)||o===0&&qo(t,n,e)||a===0&&qo(r,t,n)||s===0&&qo(r,e,n))}function qo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function jo(t){return t>0?1:t<0?-1:0}function fx(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&bp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Hn(t,e){return oe(t.prev,t,t.next)<0?oe(t,e,t.next)>=0&&oe(t,t.prev,e)>=0:oe(t,e,t.prev)<0||oe(t,t.next,e)<0}function yx(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function vp(t,e){var r=new Os(t.i,t.x,t.y),n=new Os(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function gp(t,e,r,n){var i=new Os(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Xn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Os(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Jo.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(Ns(t,0,o,r));if(i)for(var s=0,l=e.length;s<l;s++){var u=e[s]*r,c=s<l-1?e[s+1]*r:t.length;a-=Math.abs(Ns(t,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((t[f]-t[m])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[m+1]-t[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function Ns(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}Jo.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}});var qs=Ae((kS,Cp)=>{"use strict";var vx=he();Cp.exports=Mr;function Mr(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(Px,this,e)}function Px(t,e,r){t==1?e.id=r.readVarint():t==2?Sx(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function Sx(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}Mr.types=["Unknown","Point","LineString","Polygon"];Mr.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=[],s;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new vx(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};Mr.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};Mr.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,o=this.extent*e,a=this.loadGeometry(),s=Mr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],d=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=wx(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function wx(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=Ax(t[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}function Ax(t){for(var e=0,r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var js=Ae((MS,Mp)=>{"use strict";var _x=qs();Mp.exports=kp;function kp(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ix,this,e),this.length=this._features.length}function Ix(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(Tx(r))}function Tx(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}kp.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new _x(this._pbf,e,this.extent,this._keys,this._values)}});var Fp=Ae((ES,Ep)=>{"use strict";var Cx=js();Ep.exports=kx;function kx(t,e){this.layers=t.readFields(Mx,{},e)}function Mx(t,e,r){if(t===3){var n=new Cx(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Tt=Ae((FS,Ho)=>{Ho.exports.VectorTile=Fp();Ho.exports.VectorTileFeature=qs();Ho.exports.VectorTileLayer=js()});var Qp=Ae(Xs=>{Xs.read=function(t,e,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=t[e+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};Xs.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=h*128}});var ei=Ae((m2,of)=>{"use strict";of.exports=J;var ea=Qp();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var Ks=65536*65536,ef=1/Ks,Hx=12,nf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ta(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=rf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ta(this.buf,this.pos)+ta(this.buf,this.pos+4)*Ks;return this.pos+=8,t},readSFixed64:function(){var t=ta(this.buf,this.pos)+rf(this.buf,this.pos+4)*Ks;return this.pos+=8,t},readFloat:function(){var t=ea.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ea.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Xx(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Hx&&nf?cb(this.buf,e,t):ub(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==J.Bytes)return t.push(this.readVarint(e));var r=ct(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=ct(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Lr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Lr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Lr(this.buf,t&-1,this.pos),Lr(this.buf,Math.floor(t*ef),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Lr(this.buf,t&-1,this.pos),Lr(this.buf,Math.floor(t*ef),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Kx(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=pb(this.buf,t,this.pos);var r=this.pos-e;r>=128&&tf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),ea.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ea.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&tf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,eb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,tb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,ib,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,rb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ob,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ab,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,sb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,lb,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function Xx(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Fr(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function ct(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Fr(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Kx(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Yx(r,n,e),Qx(n,e)}function Yx(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Qx(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function tf(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function eb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function tb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function rb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function nb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function ib(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function ob(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function ab(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function sb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function lb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ta(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Lr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function rf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ub(t,e,r){for(var n="",i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=t[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function cb(t,e,r){return nf.decode(t.subarray(e,r))}function pb(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var ey=Ae((pT,Qf)=>{Qf.exports=Aa;function Aa(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Aa(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Aa(t.geometries[n],e);else if(r==="Feature")Aa(t.geometry,e);else if(r==="Polygon")Kf(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)Kf(t.coordinates[n],e);return t}function Kf(t,e){if(t.length!==0){Yf(t[0],e);for(var r=1;r<t.length;r++)Yf(t[r],!e)}}function Yf(t,e){for(var r=0,n=0,i=0,o=t.length,a=o-1;i<o;a=i++){var s=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!e&&t.reverse()}});var iy=Ae((mT,ny)=>{"use strict";var Zb=he(),Wb=Tt().VectorTileFeature;ny.exports=ry;function ry(t,e){this.options=e||{},this.features=t,this.length=t.length}ry.prototype.feature=function(t){return new Ia(this.features[t],this.options.extent)};function Ia(t,e){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}Ia.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new Zb(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ia.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]};Ia.prototype.toGeoJSON=Wb.prototype.toGeoJSON});var sy=Ae((hT,gi)=>{var Hb=ei(),ay=iy();gi.exports=dl;gi.exports.fromVectorTileJs=dl;gi.exports.fromGeojsonVt=Xb;gi.exports.GeoJSONWrapper=ay;function dl(t){var e=new Hb;return Kb(t,e),e.finish()}function Xb(t,e){e=e||{};var r={};for(var n in t)r[n]=new ay(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return dl({layers:r})}function Kb(t,e){for(var r in t.layers)e.writeMessage(3,Yb,t.layers[r])}function Yb(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Qb,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,r0,o[r])}function Qb(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,e0,t),e.writeVarintField(3,r.type),e.writeMessage(4,t0,r)}function e0(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function hl(t,e){return(e<<3)+(t&7)}function oy(t){return t<<1^t>>31}function t0(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),e.writeVarint(hl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(hl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(oy(f)),e.writeVarint(oy(y)),i+=f,o+=y}n===3&&e.writeVarint(hl(7,1))}}function r0(t,e){var r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1!==0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}});var Ly=Z(he(),1),Zl=Z(Gl(),1);var Oa;function ql(){return Oa==null&&(Oa=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Oa}var ki;function jl(){if(ki==null&&(ki=!1,ql())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<5*5;i++){let o=i*4;r.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(o+2,")"),r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){ki=!0;break}}}return ki||!1}function Wl(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Dy(t,e,r,n){let i=new Zl.default(t,e,r,n);return function(o){return i.solve(o)}}var S0=Dy(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function Hl(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function Pe(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function Xl(t){return Math.log(t)/Math.LN2%1===0}function jr(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function Kl(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?jr(t,nt):t}function Yl(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}var Jl={};function fe(t){Jl[t]||(typeof console<"u"&&console.warn(t),Jl[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Ql(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}function at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function Jr(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Vy(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function By(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Vy(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var Gr,qr;function zy(t,e,r,n,i){let o=t.width,a=t.height;(!Gr||!qr)&&(Gr=new OffscreenCanvas(o,a),qr=Gr.getContext("2d",{willReadFrequently:!0})),Gr.width=o,Gr.height=a,qr.drawImage(t,0,0,o,a);let s=qr.getImageData(e,r,n,i);return qr.clearRect(0,0,o,a),s.data}async function eu(t,e,r,n,i){if(jl())try{return await By(t,e,r,n,i)}catch(o){}return zy(t,e,r,n,i)}function tu(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}var Vt=class t{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,h,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new t(e.buffer)}};var Ry=8,Oy={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Ny={"*":{type:"source"}},Uy=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],$y={type:{required:!0,type:"enum",values:{vector:{}}},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:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gy={type:{required:!0,type:"enum",values:{raster:{}}},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,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},qy={type:{required:!0,type:"enum",values:{"raster-dem":{}}},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,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},jy={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Jy={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Zy={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Wy={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{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"}},Hy=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Xy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ky={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Yy={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},em={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},tm={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},rm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},nm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},im={type:"array",value:"*"},om={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},am={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},sm={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},lm={type:"array",value:"*",minimum:1},um={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},cm={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},pm={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},fm={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},ym=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],mm={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},hm={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},dm={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},gm={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},xm={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},bm={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},vm={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Pm={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Sm={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},wm={"*":{type:"string"}},S={$version:Ry,$root:Oy,sources:Ny,source:Uy,source_vector:$y,source_raster:Gy,source_raster_dem:qy,source_geojson:jy,source_video:Jy,source_image:Zy,layer:Wy,layout:Hy,layout_background:Xy,layout_fill:Ky,layout_circle:Yy,layout_heatmap:Qy,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:em,layout_symbol:tm,layout_raster:rm,layout_hillshade:nm,filter:im,filter_operator:om,geometry_type:am,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:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:sm,expression:lm,light:um,sky:cm,terrain:pm,projection:fm,paint:ym,paint_fill:mm,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:hm,paint_circle:dm,paint_heatmap:gm,paint_symbol:xm,paint_raster:bm,paint_hillshade:vm,paint_background:Pm,transition:Sm,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:wm},Am=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var M=class{constructor(e,r,n,i){this.message=(e?"".concat(e,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function fr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Be=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},Ha=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},hr={kind:"null"},L={kind:"number"},G={kind:"string"},U={kind:"boolean"},Re={kind:"color"},cr={kind:"object"},$={kind:"value"},_m={kind:"error"},Wi={kind:"collator"},dr={kind:"formatted"},Hi={kind:"padding"},cn={kind:"resolvedImage"},Xi={kind:"variableAnchorOffsetCollection"};function Ee(t,e){return{kind:"array",itemType:t,N:e}}function te(t){if(t.kind==="array"){let e=te(t.itemType);return typeof t.N=="number"?"array<".concat(e,", ").concat(t.N,">"):t.itemType.kind==="value"?"array":"array<".concat(e,">")}else return t.kind}var Im=[hr,L,G,U,Re,dr,cr,Ee($),Hi,cn,Xi];function Kr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Kr(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of Im)if(!Kr(r,e))return null}}return"Expected ".concat(te(t)," but found ").concat(te(e)," instead.")}function fs(t,e){return e.some(r=>r.kind===t.kind)}function Rt(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Zr(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var wu=.96422,Au=1,_u=.82521,Iu=4/29,pr=6/29,Tu=3*pr*pr,Tm=pr*pr*pr,Cm=Math.PI/180,km=180/Math.PI;function Cu(t){return t=t%360,t<0&&(t+=360),t}function ku([t,e,r,n]){t=Na(t),e=Na(e),r=Na(r);let i,o,a=Ua((.2225045*t+.7168786*e+.0606169*r)/Au);t===e&&e===r?i=o=a:(i=Ua((.4360747*t+.3850649*e+.1430804*r)/wu),o=Ua((.0139322*t+.0971045*e+.7141733*r)/_u));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function Na(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ua(t){return t>Tm?Math.pow(t,1/3):t/Tu+Iu}function Mu([t,e,r,n]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=Au*Ga(i),o=wu*Ga(o),a=_u*Ga(a),[$a(3.1338561*o-1.6168667*i-.4906146*a),$a(-.9787684*o+1.9161415*i+.033454*a),$a(.0719453*o-.2289914*i+1.4052427*a),n]}function $a(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function Ga(t){return t>pr?t*t*t:Tu*(t-Iu)}function Mm(t){let[e,r,n,i]=ku(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Cu(Math.atan2(n,r)*km):NaN,o,e,i]}function Em([t,e,r,n]){return t=isNaN(t)?0:t*Cm,Mu([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Fm([t,e,r,n]){t=Cu(t),e/=100,r/=100;function i(o){let a=(o+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}function Lm(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Dm[t];if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let o=t.length<6?1:2,a=1;return[Mi(t.slice(a,a+=o)),Mi(t.slice(a,a+=o)),Mi(t.slice(a,a+=o)),Mi(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,d,g]=o,b=[u||" ",f||" ",h].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let x=[l,p,m].join(""),v=x==="%%%"?100:x===""?255:0;if(v){let P=[lr(+s/v,0,1),lr(+c/v,0,1),lr(+y/v,0,1),d?ru(+d,g):1];if(nu(P))return P}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=t.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,lr(+s,0,100),lr(+u,0,100),p?ru(+p,f):1];if(nu(m))return Fm(m)}}}function Mi(t){return parseInt(t.padEnd(2,t),16)/255}function ru(t,e){return lr(e?t/100:t,0,1)}function lr(t,e,r){return Math.min(Math.max(e,t),r)}function nu(t){return!t.some(Number.isNaN)}var Dm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},W=class t{constructor(e,r,n,i=1,o=!0){this.r=e,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=Lm(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Mm(this.rgb))}get lab(){return this.overwriteGetter("lab",ku(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return"rgba(".concat([e,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var Yr=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Qr=class{constructor(e,r,n,i,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Fe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Qr(e,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Ze=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}},Vm=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ne=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Vm.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}},Te=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}};function Eu(t,e,r,n){if(!(typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[t,e,r,n]:[t,e,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([t,e,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function en(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof W||t instanceof Yr||t instanceof Fe||t instanceof Ze||t instanceof Ne||t instanceof Te)return!0;if(Array.isArray(t)){for(let e of t)if(!en(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!en(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return hr;if(typeof t=="string")return G;if(typeof t=="boolean")return U;if(typeof t=="number")return L;if(t instanceof W)return Re;if(t instanceof Yr)return Wi;if(t instanceof Fe)return dr;if(t instanceof Ze)return Hi;if(t instanceof Ne)return Xi;if(t instanceof Te)return cn;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=$;break}}return Ee(r||$,e)}else return cr}function Hr(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof W||t instanceof Fe||t instanceof Ze||t instanceof Ne||t instanceof Te?t.toString():JSON.stringify(t)}var mt=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error("\'literal\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!en(e[1]))return r.error("invalid value");let n=e[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},ie=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},Ei={string:G,number:L,boolean:U,object:cr},je=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Ei)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ei[u],n++}else s=$;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],n++}i=Ee(s,l)}else{if(!Ei[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=Ei[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,$);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(Kr(this.type,ue(n))){if(r===this.args.length-1)throw new ie("Expected value to be of type ".concat(te(this.type),", but found ").concat(te(ue(n))," instead."))}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},iu={"to-boolean":U,"to-color":Re,"to-number":L,"to-string":G},yt=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!iu[n])throw new Error("Can\'t parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=iu[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,$);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof W)return r;if(typeof r=="string"){let o=e.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n="Invalid rgba value ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=Eu(r[0],r[1],r[2],r[3]),!n))return new W(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ie(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ze.parse(r);if(i)return i}throw new ie("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ne.parse(r);if(i)return i}throw new ie("Could not parse variableAnchorOffsetCollection from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ie("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Fe.fromString(Hr(this.args[0].evaluate(e)));case"resolvedImage":return Te.fromString(Hr(this.args[0].evaluate(e)));default:return Hr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Bm=["Unknown","Point","LineString","Polygon"],Vi=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Bm[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||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=W.parse(e)),r}},Bi=class t{constructor(e,r,n=[],i,o=new Ha,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new je(o,[i]):a==="coerce"?new yt(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,\' instead. If you wanted a literal array, use ["literal", [...]].\'),0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof mt)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Vi;try{a=new mt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(i,\'". If you wanted a literal array, use ["literal", [...]].\'),0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error("Expected an array, but found ".concat(typeof e," instead."))}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Be(n,e))}checkSubtype(e,r){let n=Kr(e,r);return n&&this.error(n),n}},zi=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},Ri=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(\'Unknown variable "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Xa=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,L),i=r.parse(e[2],2,Ee(r.expectedType||$));if(!n||!i)return null;let o=i.type;return new t(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new ie("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new ie("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new ie("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ka=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);return!n||!i?null:fs(n.type,[U,G,L,hr,$])?new t(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(n.type)," instead"))}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Rt(r,["boolean","string","number","null"]))throw new ie("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(ue(r))," instead."));if(!Rt(n,["string","array"]))throw new ie("Expected second argument to be of type array or string, but found ".concat(te(ue(n))," instead."));return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Ya=class t{constructor(e,r,n){this.type=L,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);if(!n||!i)return null;if(!fs(n.type,[U,G,L,hr,$]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,L);return o?new t(n,i,o):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Rt(r,["boolean","string","number","null"]))throw new ie("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(ue(r))," instead."));let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Rt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Rt(n,["array"]))return n.indexOf(r,i);throw new ie("Expected second argument to be of type array or string, but found ".concat(te(ue(n))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Qa=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,$);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},es=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},ts=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,L);if(!n||!i)return null;if(!fs(n.type,[Ee($),G,$]))return r.error("Expected first argument to be of type array or string, but found ".concat(te(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,L);return o?new t(n.type,n,i,o):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Rt(r,["string"]))return[...r].slice(n,i).join("");if(Rt(r,["array"]))return r.slice(n,i);throw new ie("Expected first argument to be of type array or string, but found ".concat(te(ue(r))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Ki(t,e){let r=t.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=t[o],s=t[o+1],a<=e){if(o===r||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new ie("Input is not a number.");return 0}var yr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,L);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new t(o,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=Ki(r,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function zm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qa,ou;function Rm(){if(ou)return qa;ou=1,qa=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},qa}var Om=Rm(),Nm=zm(Om);function Um(t){return t==="rgb"||t==="hcl"||t==="lab"}function Ot(t,e,r){return t+r*(e-t)}function $m(t,e,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=Oi(t.rgb,e.rgb,r);return new W(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=t.hcl,[l,u,c,p]=e.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let b=l-i;l>i&&b>180?b-=360:l<i&&i-l>180&&(b+=360),f=i+r*b}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,h,d,g]=Em([f,y!=null?y:Ot(o,u,r),Ot(a,c,r),Ot(s,p,r)]);return new W(m,h,d,g,!1)}case"lab":{let[i,o,a,s]=Mu(Oi(t.lab,e.lab,r));return new W(i,o,a,s,!1)}}}function Oi(t,e,r){return t.map((n,i)=>Ot(n,e[i],r))}function Gm(t,e,r){return new Ze(Oi(t.values,e.values,r))}function qm(t,e,r){let n=t.values,i=e.values;if(n.length!==i.length)throw new ie("Cannot interpolate values of different length. from: ".concat(t.toString(),", to: ").concat(e.toString()));let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new ie("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(n[a],", to[").concat(a,"]: ").concat(i[a]));o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Ot(s,u,r),Ot(l,c,r)])}return new Ne(o)}var Oe={number:Ot,color:$m,array:Oi,padding:Gm,variableAnchorOffsetCollection:qm},Je=class t{constructor(e,r,n,i,o){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let o=0;if(e.name==="exponential")o=ja(r,e.base,n,i);else if(e.name==="linear")o=ja(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Nm(a[0],a[1],a[2],a[3]).solve(ja(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,L),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=Re:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Zr(l,L)&&!Zr(l,Re)&&!Zr(l,Hi)&&!Zr(l,Xi)&&!Zr(l,Ee(L))?r.error("Type ".concat(te(l)," is not interpolatable.")):new t(l,n,i,o,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=Ki(r,i),s=r[a],l=r[a+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":return Oe[this.type.kind](c,p,u);case"interpolate-hcl":return Oe.color(c,p,u,"hcl");case"interpolate-lab":return Oe.color(c,p,u,"lab")}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function ja(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Ni=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>Kr(i,s.type))?new t($,o):new t(n,o)}evaluate(e){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof Te&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function au(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function jm(t,e,r){return e===r}function Jm(t,e,r){return e!==r}function Zm(t,e,r){return e<r}function Wm(t,e,r){return e>r}function Hm(t,e,r){return e<=r}function Xm(t,e,r){return e>=r}function Fu(t,e,r,n){return n.compare(e,r)===0}function Km(t,e,r,n){return!Fu(t,e,r,n)}function Ym(t,e,r,n){return n.compare(e,r)<0}function Qm(t,e,r,n){return n.compare(e,r)>0}function eh(t,e,r,n){return n.compare(e,r)<=0}function th(t,e,r,n){return n.compare(e,r)>=0}function gr(t,e,r){let n=t!=="=="&&t!=="!=";return class Lu{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,$);if(!l)return null;if(!au(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(te(l.type),"\'."));let u=a.parse(o[2],2,$);if(!u)return null;if(!au(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(te(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(te(l.type),"\' and \'").concat(te(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new je(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new je(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,Wi),!c)return null}return new Lu(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ie(\'Expected arguments for "\'.concat(t,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var rh=gr("==",jm,Fu),nh=gr("!=",Jm,Km),ih=gr("<",Zm,Ym),oh=gr(">",Wm,Qm),ah=gr("<=",Hm,eh),sh=gr(">=",Xm,th),Ui=class t{constructor(e,r,n){this.type=Wi,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,G),!a)?null:new t(i,o,a)}evaluate(e){return new Yr(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},rs=class t{constructor(e,r,n,i,o){this.type=G,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,L);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,G),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,G),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,L),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,L),!l)?null:new t(n,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},tn=class t{constructor(e){this.type=dr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,L),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ee(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,Re),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(e[a],1,$);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===cn?new Qr("",i,null,null,null):new Qr(Hr(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)};return new Fe(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}},ns=class t{constructor(e){this.type=cn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,G);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Te.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},is=class t{constructor(e){this.type=L,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error("Expected argument of type string or array, but found ".concat(te(n.type)," instead.")):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ie("Expected value to be of type string or array, but found ".concat(te(ue(r))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}},Xe=8192;function lh(t,e){let r=uh(t[0]),n=ph(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*Xe),Math.round(n*i*Xe)]}function ys(t,e){let r=Math.pow(2,e.z),n=(t[0]/Xe+e.x)/r,i=(t[1]/Xe+e.y)/r;return[ch(n),fh(i)]}function uh(t){return(180+t)/360}function ch(t){return t*360-180}function ph(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function fh(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function pn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function rn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function yh(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function mh(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function Yi(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return xh(o,i)===0?!1:!!(su(t,e,r,n)&&su(r,n,t,e))}function hh(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Yi(t,e,n[i],n[i+1]))return!0;return!1}function xr(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(mh(t,i[o],i[o+1]))return r;yh(t,i[o],i[o+1])&&(n=!n)}return n}function dh(t,e){for(let r of e)if(xr(t,r))return!0;return!1}function Du(t,e){for(let r of t)if(!xr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(hh(t[r],t[r+1],e))return!1;return!0}function gh(t,e){for(let r of e)if(Du(t,r))return!0;return!1}function xh(t,e){return t[0]*e[1]-t[1]*e[0]}function su(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function ms(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=[];for(let a=0;a<t[i].length;a++){let s=lh(t[i][a],r);pn(e,s),o.push(s)}n.push(o)}return n}function Vu(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=ms(t[i],e,r);n.push(o)}return n}function Bu(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;o===0&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}pn(e,t)}function bh(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function lu(t,e,r,n){let i=Math.pow(2,n.z)*Xe,o=[n.x*Xe,n.y*Xe],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];Bu(u,e,r,i),a.push(u)}return a}function uu(t,e,r,n){let i=Math.pow(2,n.z)*Xe,o=[n.x*Xe,n.y*Xe],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];pn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){bh(e);for(let s of a)for(let l of s)Bu(l,e,r,i)}return a}function vh(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=ms(e.coordinates,n,i),a=lu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!xr(s,o))return!1}if(e.type==="MultiPolygon"){let o=Vu(e.coordinates,n,i),a=lu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!dh(s,o))return!1}return!0}function Ph(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=ms(e.coordinates,n,i),a=uu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!Du(s,o))return!1}if(e.type==="MultiPolygon"){let o=Vu(e.coordinates,n,i),a=uu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!gh(s,o))return!1}return!0}var nn=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error("\'within\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(en(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return vh(e,this.geometries);if(e.geometryType()==="LineString")return Ph(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},$i=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function Sh(t,e,r,n,i){zu(t,e,r,n||t.length-1,i||wh)}function zu(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(e-a*l/o+u)),p=Math.min(n,Math.floor(e+(o-a)*l/o+u));zu(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Wr(t,r,e),i(t[n],f)>0&&Wr(t,r,n);y<m;){for(Wr(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Wr(t,r,m):(m++,Wr(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Wr(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function wh(t,e){return t<e?-1:t>e?1:0}function Ah(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=Ih(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(Sh(n[a],e,1,n[a].length-1,_h),n[a]=n[a].slice(0,e));return n}function _h(t,e){return e.area-t.area}function Ih(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}var Th=6378.137,cu=1/298.257223563,pu=cu*(2-cu),fu=Math.PI/180,on=class{constructor(e){let r=fu*Th*1e3,n=Math.cos(e*fu),i=1/(1-pu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-pu)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},os=100,as=50;function Ru(t,e){return e[0]-t[0]}function Gi(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function ss(t,e){if(t[0]>t[1])return[null,null];let r=Gi(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function ls(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)pn(r,t[n]);return r}function us(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)pn(e,n);return e}function yu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function hs(t,e,r){if(!yu(t)||!yu(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function zt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function ds(t,e,r,n,i){let o=Math.min(zt(t,[r,n],i),zt(e,[r,n],i)),a=Math.min(zt(r,[t,e],i),zt(n,[t,e],i));return Math.min(o,a)}function Ch(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(Yi(l,u,p,f))return 0;a=Math.min(a,ds(l,u,p,f,i))}}return a}function kh(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function Mh(t,e,r){if(xr(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,zt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Eh(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(xr(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(Yi(a,s,f,y))return 0;i=Math.min(i,ds(a,s,f,y,n))}}return i}function mu(t,e){for(let r of t)for(let n of r)if(xr(n,e,!0))return!0;return!1}function Fh(t,e,r,n=1/0){let i=us(t),o=us(e);if(n!==1/0&&hs(i,o,r)>=n)return n;if(rn(i,o)){if(mu(t,e))return 0}else if(mu(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,d=h-1;m<h;d=m++){let g=y[d],b=y[m];if(Yi(p,f,g,b))return 0;a=Math.min(a,ds(p,f,g,b,r))}}return a}function hu(t,e,r,n,i,o){if(!o)return;let a=hs(ls(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Fi(t,e,r,n,i,o,a){if(!o||!a)return;let s=hs(ls(n,o),ls(i,a),r);s<e&&t.push([s,o,a])}function qi(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new $i([[0,[0,t.length-1],[0,0]]],Ru),s=us(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?as:os;if(Gi(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Eh(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=Mh(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=ss(u,e);hu(a,o,n,t,s,p[0]),hu(a,o,n,t,s,p[1])}}return o}function ji(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new $i([[0,[0,t.length-1],[0,r.length-1]]],Ru);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?as:os,f=n?as:os;if(Gi(u)<=p&&Gi(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Ch(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=zt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=zt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=kh(t,u,r,c,i),a=Math.min(a,y)}else{let y=ss(u,e),m=ss(c,n);Fi(s,a,i,t,r,y[0],m[0]),Fi(s,a,i,t,r,y[0],m[1]),Fi(s,a,i,t,r,y[1],m[0]),Fi(s,a,i,t,r,y[1],m[1])}}return a}function Lh(t,e){let r=t.geometry(),n=r.flat().map(a=>ys([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new on(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,ji(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,ji(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,qi(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Dh(t,e){let r=t.geometry(),n=r.flat().map(a=>ys([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new on(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,ji(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,ji(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,qi(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Vh(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Ah(r,0).map(a=>a.map(s=>s.map(l=>ys([l.x,l.y],t.canonical)))),i=new on(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,qi([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,qi(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,Fh(s,a.coordinates,i,o));break}if(o===0)return o}return o}function Ja(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var an=class t{constructor(e,r){this.type=L,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error("\'distance\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(en(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>Ja(i.geometry)).flat());if(n.type==="Feature")return new t(n,Ja(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,Ja(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Lh(e,this.geometries);if(e.geometryType()==="LineString")return Dh(e,this.geometries);if(e.geometryType()==="Polygon")return Vh(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Gt={"==":rh,"!=":nh,">":oh,"<":ih,">=":sh,"<=":ah,array:je,at:Xa,boolean:je,case:es,coalesce:Ni,collator:Ui,format:tn,image:ns,in:Ka,"index-of":Ya,interpolate:Je,"interpolate-hcl":Je,"interpolate-lab":Je,length:is,let:zi,literal:mt,match:Qa,number:je,"number-format":rs,object:je,slice:ts,step:yr,string:je,"to-boolean":yt,"to-color":yt,"to-number":yt,"to-string":yt,var:Ri,within:nn,distance:an},Ke=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(\'Unknown expression "\'.concat(n,\'". If you wanted a literal array, use ["literal", [...]].\'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new Bi(r.registry,Ji,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,d=l.parse(m,1+p.length,h);if(!d){f=!0;break}p.push(d)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>zh(f)).join(" | "),p=[];for(let f=1;f<e.length;f++){let y=r.parse(e[f],1+p.length);if(!y)return null;p.push(te(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function du(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let o=i?i.evaluate(t):1,a=Eu(e,r,n,o);if(a)throw new ie(a);return new W(e/255,r/255,n/255,o,!1)}function gu(t,e){return t in e}function Za(t,e){let r=e[t];return typeof r>"u"?null:r}function Bh(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function Bt(t){return{type:t}}Ke.register(Gt,{error:[_m,[G],(t,[e])=>{throw new ie(e.evaluate(t))}],typeof:[G,[$],(t,[e])=>te(ue(e.evaluate(t)))],"to-rgba":[Ee(L,4),[Re],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[Re,[L,L,L],du],rgba:[Re,[L,L,L,L],du],has:{type:U,overloads:[[[G],(t,[e])=>gu(e.evaluate(t),t.properties())],[[G,cr],(t,[e,r])=>gu(e.evaluate(t),r.evaluate(t))]]},get:{type:$,overloads:[[[G],(t,[e])=>Za(e.evaluate(t),t.properties())],[[G,cr],(t,[e,r])=>Za(e.evaluate(t),r.evaluate(t))]]},"feature-state":[$,[G],(t,[e])=>Za(e.evaluate(t),t.featureState||{})],properties:[cr,[],t=>t.properties()],"geometry-type":[G,[],t=>t.geometryType()],id:[$,[],t=>t.id()],zoom:[L,[],t=>t.globals.zoom],"heatmap-density":[L,[],t=>t.globals.heatmapDensity||0],"line-progress":[L,[],t=>t.globals.lineProgress||0],accumulated:[$,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[L,Bt(L),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[L,Bt(L),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:L,overloads:[[[L,L],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[L],(t,[e])=>-e.evaluate(t)]]},"/":[L,[L,L],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[L,[L,L],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[L,[],()=>Math.LN2],pi:[L,[],()=>Math.PI],e:[L,[],()=>Math.E],"^":[L,[L,L],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[L,[L],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[L,[L],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[L,[L],(t,[e])=>Math.log(e.evaluate(t))],log2:[L,[L],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[L,[L],(t,[e])=>Math.sin(e.evaluate(t))],cos:[L,[L],(t,[e])=>Math.cos(e.evaluate(t))],tan:[L,[L],(t,[e])=>Math.tan(e.evaluate(t))],asin:[L,[L],(t,[e])=>Math.asin(e.evaluate(t))],acos:[L,[L],(t,[e])=>Math.acos(e.evaluate(t))],atan:[L,[L],(t,[e])=>Math.atan(e.evaluate(t))],min:[L,Bt(L),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[L,Bt(L),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[L,[L],(t,[e])=>Math.abs(e.evaluate(t))],round:[L,[L],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[L,[L],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[L,[L],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[G,$],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[$],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[G],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[$],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ee(G)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ee($)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[G,Ee($)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[G,Ee($)],(t,[e,r])=>Bh(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Bt(U),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Bt(U),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[G],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[G,[G],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[G,[G],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[G,Bt($),(t,e)=>e.map(r=>Hr(r.evaluate(t))).join("")],"resolved-locale":[G,[Wi],(t,[e])=>e.evaluate(t).resolvedLocale()]});function zh(t){return Array.isArray(t)?"(".concat(t.map(te).join(", "),")"):"(".concat(te(t.type),"...)")}function Ji(t){if(t instanceof Ri)return Ji(t.boundExpression);if(t instanceof Ke&&t.name==="error")return!1;if(t instanceof Ui)return!1;if(t instanceof nn)return!1;if(t instanceof an)return!1;let e=t instanceof yt||t instanceof je,r=!0;return t.eachChild(n=>{e?r=r&&Ji(n):r=r&&n instanceof mt}),r?Qi(t)&&eo(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Qi(t){if(t instanceof Ke){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof nn||t instanceof an)return!1;let e=!0;return t.eachChild(r=>{e&&!Qi(r)&&(e=!1)}),e}function sn(t){if(t instanceof Ke&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!sn(r)&&(e=!1)}),e}function eo(t,e){if(t instanceof Ke&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!eo(n,e)&&(r=!1)}),r}function cs(t){return{result:"success",value:t}}function ur(t){return{result:"error",value:t}}function ht(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Ou(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function gs(t){return!!t.expression&&t.expression.interpolated}function j(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function to(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Rh(t){return t}function Nu(t,e){let r=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",i=n||t.property!==void 0,o=n||!i,a=t.type||(gs(e)?"exponential":"interval");if(r||e.type==="padding"){let c=r?W.parse:Ze.parse;t=fr({},t),t.stops&&(t.stops=t.stops.map(p=>[p[0],c(p[1])])),t.default?t.default=c(t.default):t.default=c(e.default)}if(t.colorSpace&&!Um(t.colorSpace))throw new Error(\'Unknown color space: "\'.concat(t.colorSpace,\'"\'));let s,l,u;if(a==="exponential")s=xu;else if(a==="interval")s=Nh;else if(a==="categorical"){s=Oh,l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}else if(a==="identity")s=Uh;else throw new Error(\'Unknown function type "\'.concat(a,\'"\'));if(n){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],d=h[0].zoom;c[d]===void 0&&(c[d]={zoom:d,type:t.type,property:t.property,default:t.default,stops:[]},p.push(d)),c[d].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Nu(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:Je.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return xu({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Je.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[t.property]:void 0;return f===void 0?fn(t.default,e.default):s(t,e,f,l,u)}}}function fn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Oh(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return fn(o,t.default,e.default)}function Nh(t,e,r){if(j(r)!=="number")return fn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=Ki(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function xu(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return fn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let o=Ki(t.stops.map(c=>c[0]),r),a=$h(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Oe[e.type]||Rh;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function Uh(t,e,r){switch(e.type){case"color":r=W.parse(r);break;case"formatted":r=Fe.fromString(r.toString());break;case"resolvedImage":r=Te.fromString(r.toString());break;case"padding":r=Ze.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return fn(r,t.default,e.default)}function $h(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Nt=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Vi,this._defaultValue=r?qh(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ie("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function qt(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Gt}function jt(t,e){let r=new Bi(Gt,Ji,[],e?Gh(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?cs(new Nt(n,e)):ur(r.errors)}var dt=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!sn(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}},gt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!sn(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}interpolationFactor(e,r,n){return this.interpolationType?Je.interpolationFactor(this.interpolationType,e,r,n):0}};function Uu(t,e){let r=jt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Qi(n);if(!i&&!ht(e))return ur([new Be("","data expressions not supported")]);let o=eo(n,["zoom"]);if(!o&&!Ou(e))return ur([new Be("","zoom expressions not supported")]);let a=Di(n);if(!a&&!o)return ur([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return ur([a]);if(a instanceof Je&&!gs(e))return ur([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return cs(i?new dt("constant",r.value):new dt("source",r.value));let s=a instanceof Je?a.interpolation:void 0;return cs(i?new gt("camera",r.value,a.labels,s):new gt("composite",r.value,a.labels,s))}var ln=class t{constructor(e,r){this._parameters=e,this._specification=r,fr(this,Nu(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function $u(t,e){if(to(t))return new ln(t,e);if(qt(t)){let r=Uu(t,e);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=W.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Ze.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)&&(r=Ne.parse(t)),{kind:"constant",evaluate:()=>r}}}function Di(t){let e=null;if(t instanceof zi)e=Di(t.result);else if(t instanceof Ni){for(let r of t.args)if(e=Di(r),e)break}else(t instanceof yr||t instanceof Je)&&t.input instanceof Ke&&t.input.name==="zoom"&&(e=t);return e instanceof Be||t.eachChild(r=>{let n=Di(r);n instanceof Be?e=n:!e&&n?e=new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Be("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function Gh(t){let e={color:Re,string:G,number:L,enum:G,boolean:U,formatted:dr,padding:Hi,resolvedImage:cn,variableAnchorOffsetCollection:Xi};return t.type==="array"?Ee(e[t.value]||$,t.length):e[t.type]}function qh(t){return t.type==="color"&&to(t.default)?new W(0,0,0,0):t.type==="color"?W.parse(t.default)||null:t.type==="padding"?Ze.parse(t.default)||null:t.type==="variableAnchorOffsetCollection"?Ne.parse(t.default)||null:t.default===void 0?null:t.default}function xs(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!xs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var jh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yn(t){if(t==null)return{filter:()=>!0,needGeometry:!1};xs(t)||(t=Zi(t));let e=jt(t,jh);if(e.result==="error")throw new Error(e.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=Gu(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r}}}function Jh(t,e){return t<e?-1:t>e?1:0}function Gu(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(Gu(t[e]))return!0;return!1}function Zi(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?Wa(t[1],t[2],"=="):e==="!="?Li(Wa(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Wa(t[1],t[2],e):e==="any"?Zh(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Zi)):e==="none"?["all"].concat(t.slice(1).map(Zi).map(Li)):e==="in"?bu(t[1],t.slice(2)):e==="!in"?Li(bu(t[1],t.slice(2))):e==="has"?vu(t[1]):e==="!has"?Li(vu(t[1])):!0}function Wa(t,e,r){switch(t){case"$type":return["filter-type-".concat(r),e];case"$id":return["filter-id-".concat(r),e];default:return["filter-".concat(r),t,e]}}function Zh(t){return["any"].concat(t.map(Zi))}function bu(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Jh)]]:["filter-in-small",t,["literal",e]]}}function vu(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Li(t){return["!",t]}function ps(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+="".concat(ps(o),",");return"".concat(i,"]")}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(ps(t[r[i]]),",");return"".concat(n,"}")}function Wh(t){let e="";for(let r of Am)e+="/".concat(ps(t[r]));return e}function qu(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||Wh(t[i]);e&&(e[t[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(t[i])}let n=[];for(let i in r)n.push(r[i]);return n}function ju(t){let e=t.key,r=t.value;return r?[new M(e,r,"constants have been deprecated as of v8")]:[]}function ae(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ut(t){if(Array.isArray(t))return t.map(Ut);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Ut(t[r]);return e}return ae(t)}function ze(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec,l=[],u=j(r);if(u!=="object")return[new M(e,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new M(e,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(e&&"".concat(e,"."))+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new M(e,r,\'missing required property "\'.concat(c,\'"\')));return l}function bs(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.key,s=t.arrayElementValidator||n;if(j(e)!=="array")return[new M(a,e,"array expected, ".concat(j(e)," found"))];if(r.length&&e.length!==r.length)return[new M(a,e,"array length ".concat(r.length," expected, length ").concat(e.length," found"))];if(r["min-length"]&&e.length<r["min-length"])return[new M(a,e,"array length at least ".concat(r["min-length"]," expected, length ").concat(e.length," found"))];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function vs(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new M(e,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new M(e,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new M(e,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function Ju(t){let e=t.valueSpec,r=ae(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=j(t.value.stops)==="array"&&j(t.value.stops[0])==="array"&&j(t.value.stops[0][0])==="object",c=ze({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new M(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new M(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!gs(t.valueSpec)&&c.push(new M(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ht(t.valueSpec)?c.push(new M(t.key,t.value,"property functions not supported")):s&&!Ou(t.valueSpec)&&c.push(new M(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new M(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new M(h.key,h.value,\'identity function may not have a "stops" property\')];let d=[],g=h.value;return d=d.concat(bs({key:h.key,value:g,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&d.push(new M(h.key,g,"array must have at least one stop")),d}function f(h){let d=[],g=h.value,b=h.key;if(j(g)!=="array")return[new M(b,g,"array expected, ".concat(j(g)," found"))];if(g.length!==2)return[new M(b,g,"array length 2 expected, length ".concat(g.length," found"))];if(u){if(j(g[0])!=="object")return[new M(b,g,"object expected, ".concat(j(g[0])," found"))];if(g[0].zoom===void 0)return[new M(b,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new M(b,g,"object stop key must have value")];if(a&&a>ae(g[0].zoom))return[new M(b,g[0].zoom,"stop zoom values must appear in ascending order")];ae(g[0].zoom)!==a&&(a=ae(g[0].zoom),o=void 0,i={}),d=d.concat(ze({key:"".concat(b,"[0]"),value:g[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:vs,value:y}}))}else d=d.concat(y({key:"".concat(b,"[0]"),value:g[0],valueSpec:{},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},g));return qt(Ut(g[1]))?d.concat([new M("".concat(b,"[1]"),g[1],"expressions are not allowed in function stops.")]):d.concat(h.validateSpec({key:"".concat(b,"[1]"),value:g[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,d){let g=j(h.value),b=ae(h.value),x=h.value!==null?h.value:d;if(!n)n=g;else if(g!==n)return[new M(h.key,x,"".concat(g," stop domain type must match previous stop domain type ").concat(n))];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new M(h.key,x,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let v="number expected, ".concat(g," found");return ht(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new M(h.key,x,v)]}return r==="categorical"&&g==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new M(h.key,x,"integer expected, found ".concat(b))]:r!=="categorical"&&g==="number"&&o!==void 0&&b<o?[new M(h.key,x,"stop domain values must appear in ascending order")]:(o=b,r==="categorical"&&b in i?[new M(h.key,x,"stop domain values must be unique")]:(i[b]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function mr(t){let e=(t.expressionContext==="property"?Uu:jt)(Ut(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new M("".concat(t.key).concat(n.key),t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new M(t.key,t.value,\'Invalid data expression for "\'.concat(t.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!sn(r))return[new M(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!sn(r))return[new M(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!eo(r,["zoom","feature-state"]))return[new M(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Qi(r))return[new M(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hh(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new M(r,e,"boolean expected, ".concat(n," found"))]:[]}function Xh(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new M(e,r,"color expected, ".concat(n," found"))]:W.parse(String(r))?[]:[new M(e,r,\'color expected, "\'.concat(r,\'" found\'))]}function un(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(ae(r))===-1&&i.push(new M(e,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(ae(r))===-1&&i.push(new M(e,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Ps(t){return xs(Ut(t.value))?mr(fr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zu(t)}function Zu(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new M(r,e,"array expected, ".concat(j(e)," found"))];let n=t.styleSpec,i,o=[];if(e.length<1)return[new M(r,e,"filter array must have at least 1 element")];switch(o=o.concat(un({key:"".concat(r,"[0]"),value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),ae(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ae(e[1])==="$type"&&o.push(new M(r,e,\'"$type" cannot be use with operator "\'.concat(e[0],\'"\')));case"==":case"!=":e.length!==3&&o.push(new M(r,e,\'filter array for operator "\'.concat(e[0],\'" must have 3 elements\')));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new M("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found"))));for(let a=2;a<e.length;a++)i=j(e[a]),ae(e[1])==="$type"?o=o.concat(un({key:"".concat(r,"[").concat(a,"]"),value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new M("".concat(r,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(Zu({key:"".concat(r,"[").concat(a,"]"),value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new M(r,e,\'filter array for "\'.concat(e[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new M("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found")));break}return o}function Wu(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["".concat(e,"_").concat(t.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new M(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&ht(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new M(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new M(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&to(Ut(a))&&ae(a.type)==="identity"&&f.push(new M(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Hu(t){return Wu(t,"paint")}function Xu(t){return Wu(t,"layout")}function Ku(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;!r.type&&!r.ref&&e.push(new M(n,r,\'either "type" or "ref" is required\'));let a=ae(r.type),s=ae(r.ref);if(r.id){let l=ae(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];ae(c.id)===l&&e.push(new M(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new M(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{ae(u.id)===s&&(l=u)}),l?l.ref?e.push(new M(n,r.ref,"ref cannot reference another ref layer")):a=ae(l.type):e.push(new M(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)e.push(new M(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&ae(l.type);l?u==="vector"&&a==="raster"?e.push(new M(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u!=="raster-dem"&&a==="hillshade"?e.push(new M(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster-dem source\'))):u==="raster"&&a!=="raster"?e.push(new M(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?e.push(new M(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"?e.push(new M(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new M(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):e.push(new M(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return e=e.concat(ze({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ps,layout(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Xu(fr({layerType:a},u))}}})},paint(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Hu(fr({layerType:a},u))}}})}}})),e}function $t(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new M(r,e,"string expected, ".concat(n," found"))]:[]}function Kh(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new M("source_raster_dem",n,"object expected, ".concat(l," found"))),s;let c=ae(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?\'"\'.concat(t.value.encoding,\'"\'):"Default";for(let y in n)!c&&p.includes(y)?s.push(new M(y,n[y],\'In "\'.concat(r,\'": "\').concat(y,\'" is only valid when "encoding" is set to "custom". \').concat(f," encoding found"))):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new M(y,n[y],\'unknown property "\'.concat(y,\'"\')));return s}var Pu={promoteId:Yh};function Yu(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new M(r,e,\'"type" is required\')];let a=ae(e.type),s;switch(a){case"vector":case"raster":return s=ze({key:r,value:e,valueSpec:n["source_".concat(a.replace("-","_"))],style:t.style,styleSpec:n,objectElementValidators:Pu,validateSpec:o}),s;case"raster-dem":return s=Kh({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=ze({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Pu}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...mr({key:"".concat(r,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...mr({key:"".concat(r,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return ze({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return ze({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new M(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return un({key:"".concat(r,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Yh({key:t,value:e}){if(j(e)==="string")return $t({key:t,value:e});{let r=[];for(let n in e)r.push(...$t({key:"".concat(t,".").concat(n),value:e[n]}));return r}}function Qu(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new M("light",e,"object expected, ".concat(a," found"))]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new M(s,e[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function ec(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new M("sky",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new M(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return a}function tc(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new M("terrain",e,"object expected, ".concat(a," found"))]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new M(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function Qh(t){return $t(t).length===0?[]:mr(t)}function ed(t){return $t(t).length===0?[]:mr(t)}function td(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new M(e,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return vs({key:e,value:r,valueSpec:{}})}function rd(t){let e=t.key,r=t.value,n=j(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new M(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(un({key:"".concat(e,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(bs({key:"".concat(e,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function rc(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&e.push(new M(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new M(n,r,"all the sprites\' URLs must be unique, but ".concat(r[a].url," is duplicated"))),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(ze({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return $t({key:n,value:r})}function nd(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new M("projection",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new M(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return a}var Su={"*"(){return[]},array:bs,boolean:Hh,number:vs,color:Xh,constants:ju,enum:un,filter:Ps,function:Ju,layer:Ku,object:ze,source:Yu,light:Qu,sky:ec,terrain:tc,projection:nd,string:$t,formatted:Qh,resolvedImage:ed,padding:td,variableAnchorOffsetCollection:rd,sprite:rc};function Xr(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=Xr,r.expression&&to(ae(e))?Ju(t):r.expression&&qt(Ut(e))?mr(t):r.type&&Su[r.type]?Su[r.type](t):ze(fr({},t,{valueSpec:r.type?n[r.type]:r}))}function nc(t){let e=t.value,r=t.key,n=$t(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new M(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new M(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Ue(t,e=S){let r=[];return r=r.concat(Xr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xr,objectElementValidators:{glyphs:nc,"*"(){return[]}}})),t.constants&&(r=r.concat(ju({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Xr}))),ic(r)}Ue.source=Qe(Ye(Yu));Ue.sprite=Qe(Ye(rc));Ue.glyphs=Qe(Ye(nc));Ue.light=Qe(Ye(Qu));Ue.sky=Qe(Ye(ec));Ue.terrain=Qe(Ye(tc));Ue.layer=Qe(Ye(Ku));Ue.filter=Qe(Ye(Ps));Ue.paintProperty=Qe(Ye(Hu));Ue.layoutProperty=Qe(Ye(Xu));function Ye(t){return function(e){return t(Ci(Dt({},e),{validateSpec:Xr}))}}function ic(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function Qe(t){return function(...e){return ic(t.apply(this,e))}}var oc="AbortError";function ac(t){return t.message===oc}function Ss(){return new Error(oc)}var ro={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function sc(t){return ro.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function lc(t,e){ro.REGISTERED_PROTOCOLS[t]=e}function uc(t){delete ro.REGISTERED_PROTOCOLS[t]}var cc="global-dispatcher",br=class extends Error{constructor(e,r,n,i){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(n)),this.status=e,this.statusText=r,this.url=n,this.body=i}},fc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,id=t=>/^file:/.test(t)||/^file:/.test(fc())&&!/^\\w+:/.test(t);async function od(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:fc(),signal:e.signal});t.type==="json"&&r.headers.set("Accept","application/json");let n=await fetch(r);if(!n.ok){let a=await n.blob();throw new br(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Ss();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ad(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new br(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Ss())}),i.send(t.body)})}var yc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=sc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:cc},e)}if(!id(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return od(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:cc},e)}return ad(t,e)},mc=(t,e)=>yc(Pe(t,{type:"json"}),e),hc=(t,e)=>yc(Pe(t,{type:"arrayBuffer"}),e);var xt={};function C(t,e,r={}){if(xt[t])throw new Error("".concat(t," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),xt[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}C("Object",Object);C("TransferableGridIndex",Vt);C("Color",W);C("Error",Error);C("AJAXError",br);C("ResolvedImage",Te);C("StylePropertyFunction",ln);C("StyleExpression",Nt,{omit:["_evaluator"]});C("ZoomDependentExpression",gt);C("ZoomConstantExpression",dt);C("CompoundExpression",Ke,{omit:["_evaluate"]});for(let t in Gt)Gt[t]._classRegistryKey||C("Expression_".concat(t),Gt[t]);function dc(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function vr(t,e){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error)return t;if(dc(t)||Jr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){let r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let r=[];for(let n of t)r.push(vr(n,e));return r}if(typeof t=="object"){let r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class ".concat(r.name));if(!xt[n])throw new Error("".concat(n," is not registered."));let i=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o)||xt[n].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=xt[n].shallow.indexOf(o)>=0?a:vr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error("can\'t serialize object of type ".concat(typeof t))}function Pr(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||dc(t)||Jr(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Pr);if(typeof t=="object"){let e=t.$name||"Object";if(!xt[e])throw new Error("can\'t deserialize unregistered class ".concat(e));let{klass:r}=xt[e];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(e));if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=xt[e].shallow.indexOf(i)>=0?o:Pr(o)}return n}throw new Error("can\'t deserialize object of type ".concat(typeof t))}var no=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var io=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new no(()=>this.process()),this.subscription=tu(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[o]={resolve:n,reject:i},r&&r.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let l={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s=Ci(Dt({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:vr(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(Pr(r.error)):o.resolve(Pr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(r.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let n=Pr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?vr(r):null,data:vr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function gc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function ws(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var oo=class{constructor(e,r={}){Pe(this,r),this.type=e}},mn=class extends oo{constructor(e,r={}){super("error",Pe({error:e},r))}},ao=class{on(e,r){return this._listeners=this._listeners||{},gc(e,r,this._listeners),this}off(e,r){return ws(e,r,this._listeners),ws(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},gc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new oo(e,r||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)ws(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(Pe(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof mn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}};var bt=Ue,tv=bt.source,rv=bt.light,nv=bt.terrain,iv=bt.filter,xc=bt.paintProperty,bc=bt.layoutProperty;function vc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new mn(new Error(n.message))),r=!0;return r}var so=class{constructor(){this.first=!0}update(e,r){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};var D={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function hn(t){for(let e of t)if(lo(e.charCodeAt(0)))return!0;return!1}function Pc(t){for(let e of t)if(!sd(e.charCodeAt(0)))return!1;return!0}function sd(t){return!(D.Arabic(t)||D["Arabic Supplement"](t)||D["Arabic Extended-A"](t)||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t))}function Sc(t){return t<11904?!1:!!(D["Bopomofo Extended"](t)||D.Bopomofo(t)||D["CJK Compatibility Forms"](t)||D["CJK Compatibility Ideographs"](t)||D["CJK Compatibility"](t)||D["CJK Radicals Supplement"](t)||D["CJK Strokes"](t)||D["CJK Symbols and Punctuation"](t)||D["CJK Unified Ideographs Extension A"](t)||D["CJK Unified Ideographs"](t)||D["Enclosed CJK Letters and Months"](t)||D["Halfwidth and Fullwidth Forms"](t)||D.Hiragana(t)||D["Ideographic Description Characters"](t)||D["Kangxi Radicals"](t)||D["Katakana Phonetic Extensions"](t)||D.Katakana(t)||D["Vertical Forms"](t)||D["Yi Radicals"](t)||D["Yi Syllables"](t))}function lo(t){return t===746||t===747?!0:t<4352?!1:!!(D["Bopomofo Extended"](t)||D.Bopomofo(t)||D["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||D["CJK Compatibility Ideographs"](t)||D["CJK Compatibility"](t)||D["CJK Radicals Supplement"](t)||D["CJK Strokes"](t)||D["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||D["CJK Unified Ideographs Extension A"](t)||D["CJK Unified Ideographs"](t)||D["Enclosed CJK Letters and Months"](t)||D["Hangul Compatibility Jamo"](t)||D["Hangul Jamo Extended-A"](t)||D["Hangul Jamo Extended-B"](t)||D["Hangul Jamo"](t)||D["Hangul Syllables"](t)||D.Hiragana(t)||D["Ideographic Description Characters"](t)||D.Kanbun(t)||D["Kangxi Radicals"](t)||D["Katakana Phonetic Extensions"](t)||D.Katakana(t)&&t!==12540||D["Halfwidth and Fullwidth Forms"](t)&&t!==65288&&t!==65289&&t!==65293&&!(t>=65306&&t<=65310)&&t!==65339&&t!==65341&&t!==65343&&!(t>=65371&&t<=65503)&&t!==65507&&!(t>=65512&&t<=65519)||D["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||D["Unified Canadian Aboriginal Syllabics"](t)||D["Unified Canadian Aboriginal Syllabics Extended"](t)||D["Vertical Forms"](t)||D["Yijing Hexagram Symbols"](t)||D["Yi Syllables"](t)||D["Yi Radicals"](t))}function ld(t){return!!(D["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||D["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||D["Letterlike Symbols"](t)||D["Number Forms"](t)||D["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||D["Control Pictures"](t)&&t!==9251||D["Optical Character Recognition"](t)||D["Enclosed Alphanumerics"](t)||D["Geometric Shapes"](t)||D["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||D["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||D["CJK Symbols and Punctuation"](t)||D.Katakana(t)||D["Private Use Area"](t)||D["CJK Compatibility Forms"](t)||D["Small Form Variants"](t)||D["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function As(t){return!(lo(t)||ld(t))}function wc(t){return D.Arabic(t)||D["Arabic Supplement"](t)||D["Arabic Extended-A"](t)||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t)}function Ac(t){return t>=1424&&t<=2303||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t)}function ud(t,e){return!(!e&&Ac(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||D.Khmer(t))}function _c(t){for(let e of t)if(Ac(e.charCodeAt(0)))return!0;return!1}function Ic(t,e){for(let r of t)if(!ud(r.charCodeAt(0),e))return!1;return!0}var _s=class{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}},ye=new _s;var q=class{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new so,this.transition={})}isSupportedScript(e){return Ic(e,ye.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var Sr=class{constructor(e,r){this.property=e,this.value=r,this.expression=$u(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},dn=class{constructor(e){this.property=e,this.value=new Sr(e,void 0)}transitioned(e,r){return new co(this.property,this.value,r,Pe({},e.transition,this.transition),e.now)}untransitioned(){return new co(this.property,this.value,null,{},0)}},uo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new dn(this._values[e].property)),this._values[e].value=new Sr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new dn(this._values[e].property)),this._values[e].transition=nt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e["".concat(r,"-transition")]=i)}return e}transitioned(e,r){let n=new po(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,r._values[i]);return n}untransitioned(){let e=new po(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},co=class{constructor(e,r,n,i,o){this.property=e,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,r,n),o,Wl(s))}}else return o}},po=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},fo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new Sr(this._values[e].property,r===null?void 0:nt(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},Se=class{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,i){return this.property.evaluate(this.value,this.parameters,e,r,n,i)}},vt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},B=class{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){let i=this.specification.type,o=Oe[i];return o?o(e,r,n):e}},R=class{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Se(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new Se(this,e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Se(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Oe[i];if(o){let a=o(e.value.value,r.value.value,n);return new Se(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,r,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(r,n,i,o,a)}},lt=class extends R{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new Se(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new Se(this,{kind:"constant",value:l},r)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Se(this,{kind:"constant",value:o},r)}else return new Se(this,e.expression,r)}evaluate(e,r,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,i),e.evaluate({zoom:Math.floor(r.zoom)},n,i),e.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):e.value}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},Jt=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(e.expression.evaluate(new q(Math.floor(r.zoom-1),r)),e.expression.evaluate(new q(Math.floor(r.zoom),r)),e.expression.evaluate(new q(Math.floor(r.zoom+1),r)),r)}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},Zt=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},re=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in e){let n=e[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new Sr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new dn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",R);C("DataConstantProperty",B);C("CrossFadedDataDrivenProperty",lt);C("CrossFadedProperty",Jt);C("ColorRampProperty",Zt);var yo="-transition",se=class extends ao{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new fo(r.layout)),r.paint)){this._transitionablePaint=new uo(r.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vt(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".layout.").concat(e);if(this._validate(bc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(yo)?this._transitionablePaint.getTransition(e.slice(0,-yo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(xc,i,e,r,n))return!1}if(e.endsWith(yo))return this._transitionablePaint.setTransition(e.slice(0,-yo.length),r||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,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()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Kl(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:vc(this,e.call(bt,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:S,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof Se)||!ht(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var cd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Pt=class{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},pd=128,fd=5,ee=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*fd),pd),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function Y(t,e=1){let r=0,n=0,i=t.map(a=>{let s=yd(a.type),l=r=Tc(r,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=Tc(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function yd(t){return cd[t].BYTES_PER_ELEMENT}function Tc(t,e){return Math.ceil(t/e)*e}var Cc=Z(he(),1),Wt=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.int16[i+0]=r,this.int16[i+1]=n,e}};Wt.prototype.bytesPerElement=4;C("StructArrayLayout2i4",Wt);var gn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=i,e}};gn.prototype.bytesPerElement=6;C("StructArrayLayout3i6",gn);var mo=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};mo.prototype.bytesPerElement=8;C("StructArrayLayout4i8",mo);var xn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};xn.prototype.bytesPerElement=12;C("StructArrayLayout2i4i12",xn);var bn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=r,this.int16[l+1]=n,this.uint8[u+4]=i,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};bn.prototype.bytesPerElement=8;C("StructArrayLayout2i4ub8",bn);var St=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.float32[i+0]=r,this.float32[i+1]=n,e}};St.prototype.bytesPerElement=8;C("StructArrayLayout2f8",St);var vn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,i,o,a,s,l,u,c)}emplace(e,r,n,i,o,a,s,l,u,c,p){let f=e*10;return this.uint16[f+0]=r,this.uint16[f+1]=n,this.uint16[f+2]=i,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,e}};vn.prototype.bytesPerElement=20;C("StructArrayLayout10ui20",vn);var Pn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f){let y=this.length;return this.resize(y+1),this.emplace(y,e,r,n,i,o,a,s,l,u,c,p,f)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y){let m=e*12;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=f,this.int16[m+11]=y,e}};Pn.prototype.bytesPerElement=24;C("StructArrayLayout4i4ui4i24",Pn);var Sn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=i,e}};Sn.prototype.bytesPerElement=12;C("StructArrayLayout3f12",Sn);var wn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint32[n+0]=r,e}};wn.prototype.bytesPerElement=4;C("StructArrayLayout1ul4",wn);var An=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,i,o,a,s,l,u)}emplace(e,r,n,i,o,a,s,l,u,c){let p=e*10,f=e*5;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=i,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[f+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};An.prototype.bytesPerElement=20;C("StructArrayLayout6i1ul2ui20",An);var _n=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};_n.prototype.bytesPerElement=12;C("StructArrayLayout2i2i2i12",_n);var ho=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,n,i,o)}emplace(e,r,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};ho.prototype.bytesPerElement=16;C("StructArrayLayout2f1f2i16",ho);var In=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*12,s=e*3;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[s+1]=i,this.float32[s+2]=o,e}};In.prototype.bytesPerElement=12;C("StructArrayLayout2ub2f12",In);var Tn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};Tn.prototype.bytesPerElement=6;C("StructArrayLayout3ui6",Tn);var Cn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g){let b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b){let x=e*24,v=e*12,P=e*48;return this.int16[x+0]=r,this.int16[x+1]=n,this.uint16[x+2]=i,this.uint16[x+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[x+10]=u,this.uint16[x+11]=c,this.uint16[x+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[P+36]=m,this.uint8[P+37]=h,this.uint8[P+38]=d,this.uint32[v+10]=g,this.int16[x+22]=b,e}};Cn.prototype.bytesPerElement=48;C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Cn);var kn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k){let V=this.length;return this.resize(V+1),this.emplace(V,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k,V){let A=e*32,z=e*16;return this.int16[A+0]=r,this.int16[A+1]=n,this.int16[A+2]=i,this.int16[A+3]=o,this.int16[A+4]=a,this.int16[A+5]=s,this.int16[A+6]=l,this.int16[A+7]=u,this.uint16[A+8]=c,this.uint16[A+9]=p,this.uint16[A+10]=f,this.uint16[A+11]=y,this.uint16[A+12]=m,this.uint16[A+13]=h,this.uint16[A+14]=d,this.uint16[A+15]=g,this.uint16[A+16]=b,this.uint16[A+17]=x,this.uint16[A+18]=v,this.uint16[A+19]=P,this.uint16[A+20]=w,this.uint16[A+21]=T,this.uint16[A+22]=F,this.uint32[z+12]=E,this.float32[z+13]=_,this.float32[z+14]=I,this.uint16[A+30]=k,this.uint16[A+31]=V,e}};kn.prototype.bytesPerElement=64;C("StructArrayLayout8i15ui1ul2f2ui64",kn);var Ht=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.float32[n+0]=r,e}};Ht.prototype.bytesPerElement=4;C("StructArrayLayout1f4",Ht);var Mn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};Mn.prototype.bytesPerElement=12;C("StructArrayLayout1ui2f12",Mn);var En=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};En.prototype.bytesPerElement=8;C("StructArrayLayout1ul2ui8",En);var Fn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.uint16[i+0]=r,this.uint16[i+1]=n,e}};Fn.prototype.bytesPerElement=4;C("StructArrayLayout2ui4",Fn);var go=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint16[n+0]=r,e}};go.prototype.bytesPerElement=2;C("StructArrayLayout1ui2",go);var wr=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};wr.prototype.bytesPerElement=16;C("StructArrayLayout4f16",wr);var xo=class extends Pt{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Cc.default(this.anchorPointX,this.anchorPointY)}};xo.prototype.size=20;var Ln=class extends An{get(e){return new xo(this,e)}};C("CollisionBoxArray",Ln);var bo=class extends Pt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};bo.prototype.size=48;var Dn=class extends Cn{get(e){return new bo(this,e)}};C("PlacedSymbolArray",Dn);var vo=class extends Pt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};vo.prototype.size=64;var Vn=class extends kn{get(e){return new vo(this,e)}};C("SymbolInstanceArray",Vn);var Bn=class extends Ht{getoffsetX(e){return this.float32[e*1+0]}};C("GlyphOffsetArray",Bn);var zn=class extends gn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};C("SymbolLineVertexArray",zn);var Po=class extends Pt{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Po.prototype.size=12;var Rn=class extends Mn{get(e){return new Po(this,e)}};C("TextAnchorOffsetArray",Rn);var So=class extends Pt{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]}};So.prototype.size=8;var On=class extends En{get(e){return new So(this,e)}};C("FeatureIndexArray",On);var wo=class extends Wt{};var Ao=class extends Wt{},_o=class extends Wt{},Io=class extends xn{};var To=class extends bn{},Co=class extends St{},ut=class extends vn{},ko=class extends Pn{},Mo=class extends Sn{},Eo=class extends wn{},Nn=class extends _n{};var Fo=class extends In{};var Le=class extends Tn{},wt=class extends Fn{};var md=Y([{name:"a_pos",components:2,type:"Int16"}],4);var{members:kc,size:$v,alignment:Gv}=md;var me=class t{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&fe("Max vertices per segment is ".concat(t.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e)),(!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,i){return new t([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;C("SegmentVector",me);function Is(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Un=Y([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Dc=Z(ks(),1);var $n=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(Lc(e)),this.positions.push(r,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=Lc(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(e,r){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return Ms(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new t;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Lc(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Dc.default)(String(t))}function Ms(t,e,r,n){for(;r<n;){let i=t[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(t[o]<i);do a--;while(t[a]>i);if(o>=a)break;Do(t,o,a),Do(e,3*o,3*a),Do(e,3*o+1,3*a+1),Do(e,3*o+2,3*a+2)}a-r<n-a?(Ms(t,e,r,a),r=a+1):(Ms(t,e,a+1,n),n=a)}}function Do(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}C("FeaturePositionMap",$n);var Gn=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Ar=class extends Gn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var Vo=class extends Gn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},Bo=class extends Gn{constructor(e,r){super(e,r),this.current=W.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},i1=new Float32Array(16);function Es(t){return[Is(255*t.r,255*t.g),Is(255*t.b,255*t.a)]}var Xt=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new Bo(e,r):new Ar(e,r)}},At=class{constructor(e,r){this.uniformNames=r.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new Vo(e,r):new Ar(e,r)}},We=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new q(0),r,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,r,o)}_setPaintValue(e,r,n){if(this.type==="color"){let i=Es(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new q(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new q(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,r,o,a)}_setPaintValue(e,r,n,i){if(this.type==="color"){let o=Es(n),a=Es(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new Ar(e,r)}},et=class{constructor(e,r,n,i,o,a){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,i,o){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=e;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Un.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Un.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},zo=class{constructor(e,r,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof Se)||!ht(a.property.specification))continue;let s=xd(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new At(l.value,s):new Xt(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=Vc(o,u,"source");this.binders[o]=f?new et(l,u,c,r,y,e.id):new We(l,s,u,y),i.push("/a_".concat(o))}else{let y=Vc(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof et)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof At&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof et)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let r in this.binders){let n=this.binders[r];(n instanceof Xt||n instanceof At)&&e.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof et)for(let i=0;i<Un.members.length;i++)e.push(Un.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Xt||n instanceof At||n instanceof De)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof Xt||o instanceof At||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(e,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(e&&n instanceof et){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof et)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof et)&&r.destroy()}}},Ce=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new zo(i,r,n);this.needsUpload=!1,this._featureMap=new $n,this._bufferOffset=0}populatePaintArrays(e,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,r,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function xd(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"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"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace("".concat(e,"-"),"").replace(/-/g,"_")]}function bd(t){return{"line-pattern":{source:ut,composite:ut},"fill-pattern":{source:ut,composite:ut},"fill-extrusion-pattern":{source:ut,composite:ut}}[t]}function Vc(t,e,r){let n={color:{source:St,composite:wr},number:{source:Ht,composite:St}},i=bd(t);return i&&i[r]||n[e][r]}C("ConstantBinder",Xt);C("CrossFadedConstantBinder",At);C("SourceExpressionBinder",We);C("CrossFadedCompositeBinder",et);C("CompositeExpressionBinder",De);C("ProgramConfiguration",zo,{omit:["_buffers"]});C("ProgramConfigurationSet",Ce);var vd=15,Fs=Math.pow(2,vd-1)-1,Bc=-Fs-1;function ke(t){let e=8192/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=it(s,Bc,Fs),a.y=it(l,Bc,Fs),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&fe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function $e(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ke(t):[]}}function Ro(t,e,r,n,i){t.emplaceBack(e*2+(n+1)/2,r*2+(i+1)/2)}var Kt=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ao,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new Ce(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of e){let f=this.layers[0]._featureFilter.needGeometry,y=$e(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,h={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:ke(l),patterns:{},sortKey:m};o.push(h)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=e[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,i){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=u.vertexLength;Ro(this.layoutVertexArray,s,l,-1,-1),Ro(this.layoutVertexArray,s,l,1,-1),Ro(this.layoutVertexArray,s,l,1,1),Ro(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};C("CircleBucket",Kt,{omit:["layers"]});var qn=Z(he(),1);function Rc(t,e){for(let r=0;r<t.length;r++)if(_r(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(_r(t,e[r]))return!0;return!!Ds(t,e)}function Oc(t,e,r){return!!(_r(t,e)||Ls(e,t,r))}function Oo(t,e){if(t.length===1)return zc(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(_r(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(zc(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Ds(t,e[r]))return!0;return!1}function Nc(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];if(t.length>=3){for(let o=0;o<i.length;o++)if(_r(t,i[o]))return!0}if(Pd(t,i,r))return!0}return!1}function Pd(t,e,r){if(t.length>1){if(Ds(t,e))return!0;for(let n=0;n<e.length;n++)if(Ls(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Ls(t[n],e,r))return!0;return!1}function Ds(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(Sd(n,i,a,s))return!0}}return!1}function Sd(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function Ls(t,e,r){let n=r*r;if(e.length===1)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(Vs(t,o,a)<n)return!0}return!1}function Vs(t,e,r){let n=e.distSqr(r);if(n===0)return t.distSqr(e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function zc(t,e){let r=!1,n,i,o;for(let a=0;a<t.length;a++){n=t[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function _r(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){let o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function Uc(t,e,r,n,i){for(let a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new qn.default(e,r),new qn.default(e,i),new qn.default(n,i),new qn.default(n,r)];if(t.length>2){for(let a of o)if(_r(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(wd(s,l,o))return!0}return!1}function wd(t,e,r){let n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var No=Z(he(),1);function Yt(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function _t(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function It(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=No.default.convert(e)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<t.length;s++){let l=t[s];a.push(l.sub(o))}return a}function $c(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new No.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new No.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(e)._add(l))}r.push(o)}return r}var Gc,Ad=()=>Gc=Gc||new re({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),qc,_d=()=>qc=qc||new re({"circle-radius":new R(S.paint_circle["circle-radius"]),"circle-color":new R(S.paint_circle["circle-color"]),"circle-blur":new R(S.paint_circle["circle-blur"]),"circle-opacity":new R(S.paint_circle["circle-opacity"]),"circle-translate":new B(S.paint_circle["circle-translate"]),"circle-translate-anchor":new B(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new B(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new B(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new R(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new R(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new R(S.paint_circle["circle-stroke-opacity"])}),jc={get paint(){return _d()},get layout(){return Ad()}};var Q=1e-6,Ge=typeof Float32Array<"u"?Float32Array:Array,jn=Math.random;var X1=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Jn={};Ol(Jn,{add:()=>ug,adjoint:()=>Ld,clone:()=>Td,copy:()=>Cd,create:()=>Id,determinant:()=>Dd,equals:()=>yg,exactEquals:()=>fg,frob:()=>lg,fromQuat:()=>Yd,fromQuat2:()=>Zd,fromRotation:()=>Gd,fromRotationTranslation:()=>Hc,fromRotationTranslationScale:()=>Xd,fromRotationTranslationScaleOrigin:()=>Kd,fromScaling:()=>$d,fromTranslation:()=>Ud,fromValues:()=>kd,fromXRotation:()=>qd,fromYRotation:()=>jd,fromZRotation:()=>Jd,frustum:()=>Qd,getRotation:()=>Hd,getScaling:()=>Xc,getTranslation:()=>Wd,identity:()=>Zc,invert:()=>Fd,lookAt:()=>og,mul:()=>mg,multiply:()=>Wc,multiplyScalar:()=>cg,multiplyScalarAndAdd:()=>pg,ortho:()=>ng,orthoNO:()=>Yc,orthoZO:()=>ig,perspective:()=>eg,perspectiveFromFieldOfView:()=>rg,perspectiveNO:()=>Kc,perspectiveZO:()=>tg,rotate:()=>zd,rotateX:()=>Rd,rotateY:()=>Od,rotateZ:()=>Nd,scale:()=>Bd,set:()=>Md,str:()=>sg,sub:()=>hg,subtract:()=>Qc,targetTo:()=>ag,translate:()=>Vd,transpose:()=>Ed});function Id(){var t=new Ge(16);return Ge!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Td(t){var e=new Ge(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Cd(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function kd(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h){var d=new Ge(16);return d[0]=t,d[1]=e,d[2]=r,d[3]=n,d[4]=i,d[5]=o,d[6]=a,d[7]=s,d[8]=l,d[9]=u,d[10]=c,d[11]=p,d[12]=f,d[13]=y,d[14]=m,d[15]=h,d}function Md(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=p,t[11]=f,t[12]=y,t[13]=m,t[14]=h,t[15]=d,t}function Zc(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ed(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Fd(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15],b=r*s-n*a,x=r*l-i*a,v=r*u-o*a,P=n*l-i*s,w=n*u-o*s,T=i*u-o*l,F=c*h-p*m,E=c*d-f*m,_=c*g-y*m,I=p*d-f*h,k=p*g-y*h,V=f*g-y*d,A=b*V-x*k+v*I+P*_-w*E+T*F;return A?(A=1/A,t[0]=(s*V-l*k+u*I)*A,t[1]=(i*k-n*V-o*I)*A,t[2]=(h*T-d*w+g*P)*A,t[3]=(f*w-p*T-y*P)*A,t[4]=(l*_-a*V-u*E)*A,t[5]=(r*V-i*_+o*E)*A,t[6]=(d*v-m*T-g*x)*A,t[7]=(c*T-f*v+y*x)*A,t[8]=(a*k-s*_+u*F)*A,t[9]=(n*_-r*k-o*F)*A,t[10]=(m*w-h*v+g*b)*A,t[11]=(p*v-c*w-y*b)*A,t[12]=(s*E-a*I-l*F)*A,t[13]=(r*I-n*E+i*F)*A,t[14]=(h*x-m*P-d*b)*A,t[15]=(c*P-p*x+f*b)*A,t):null}function Ld(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15];return t[0]=s*(f*g-y*d)-p*(l*g-u*d)+h*(l*y-u*f),t[1]=-(n*(f*g-y*d)-p*(i*g-o*d)+h*(i*y-o*f)),t[2]=n*(l*g-u*d)-s*(i*g-o*d)+h*(i*u-o*l),t[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),t[4]=-(a*(f*g-y*d)-c*(l*g-u*d)+m*(l*y-u*f)),t[5]=r*(f*g-y*d)-c*(i*g-o*d)+m*(i*y-o*f),t[6]=-(r*(l*g-u*d)-a*(i*g-o*d)+m*(i*u-o*l)),t[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),t[8]=a*(p*g-y*h)-c*(s*g-u*h)+m*(s*y-u*p),t[9]=-(r*(p*g-y*h)-c*(n*g-o*h)+m*(n*y-o*p)),t[10]=r*(s*g-u*h)-a*(n*g-o*h)+m*(n*u-o*s),t[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),t[12]=-(a*(p*d-f*h)-c*(s*d-l*h)+m*(s*f-l*p)),t[13]=r*(p*d-f*h)-c*(n*d-i*h)+m*(n*f-i*p),t[14]=-(r*(s*d-l*h)-a*(n*d-i*h)+m*(n*l-i*s)),t[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),t}function Dd(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],f=t[11],y=t[12],m=t[13],h=t[14],d=t[15],g=e*a-r*o,b=e*s-n*o,x=e*l-i*o,v=r*s-n*a,P=r*l-i*a,w=n*l-i*s,T=u*m-c*y,F=u*h-p*y,E=u*d-f*y,_=c*h-p*m,I=c*d-f*m,k=p*d-f*h;return g*k-b*I+x*_+v*E-P*F+w*T}function Wc(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],f=e[9],y=e[10],m=e[11],h=e[12],d=e[13],g=e[14],b=e[15],x=r[0],v=r[1],P=r[2],w=r[3];return t[0]=x*n+v*s+P*p+w*h,t[1]=x*i+v*l+P*f+w*d,t[2]=x*o+v*u+P*y+w*g,t[3]=x*a+v*c+P*m+w*b,x=r[4],v=r[5],P=r[6],w=r[7],t[4]=x*n+v*s+P*p+w*h,t[5]=x*i+v*l+P*f+w*d,t[6]=x*o+v*u+P*y+w*g,t[7]=x*a+v*c+P*m+w*b,x=r[8],v=r[9],P=r[10],w=r[11],t[8]=x*n+v*s+P*p+w*h,t[9]=x*i+v*l+P*f+w*d,t[10]=x*o+v*u+P*y+w*g,t[11]=x*a+v*c+P*m+w*b,x=r[12],v=r[13],P=r[14],w=r[15],t[12]=x*n+v*s+P*p+w*h,t[13]=x*i+v*l+P*f+w*d,t[14]=x*o+v*u+P*y+w*g,t[15]=x*a+v*c+P*m+w*b,t}function Vd(t,e,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,h,d,g;return e===t?(t[12]=e[0]*n+e[4]*i+e[8]*o+e[12],t[13]=e[1]*n+e[5]*i+e[9]*o+e[13],t[14]=e[2]*n+e[6]*i+e[10]*o+e[14],t[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(a=e[0],s=e[1],l=e[2],u=e[3],c=e[4],p=e[5],f=e[6],y=e[7],m=e[8],h=e[9],d=e[10],g=e[11],t[0]=a,t[1]=s,t[2]=l,t[3]=u,t[4]=c,t[5]=p,t[6]=f,t[7]=y,t[8]=m,t[9]=h,t[10]=d,t[11]=g,t[12]=a*n+c*i+m*o+e[12],t[13]=s*n+p*i+h*o+e[13],t[14]=l*n+f*i+d*o+e[14],t[15]=u*n+y*i+g*o+e[15]),t}function Bd(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function zd(t,e,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k,V,A,z;return s<Q?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=e[0],f=e[1],y=e[2],m=e[3],h=e[4],d=e[5],g=e[6],b=e[7],x=e[8],v=e[9],P=e[10],w=e[11],T=i*i*c+u,F=o*i*c+a*l,E=a*i*c-o*l,_=i*o*c-a*l,I=o*o*c+u,k=a*o*c+i*l,V=i*a*c+o*l,A=o*a*c-i*l,z=a*a*c+u,t[0]=p*T+h*F+x*E,t[1]=f*T+d*F+v*E,t[2]=y*T+g*F+P*E,t[3]=m*T+b*F+w*E,t[4]=p*_+h*I+x*k,t[5]=f*_+d*I+v*k,t[6]=y*_+g*I+P*k,t[7]=m*_+b*I+w*k,t[8]=p*V+h*A+x*z,t[9]=f*V+d*A+v*z,t[10]=y*V+g*A+P*z,t[11]=m*V+b*A+w*z,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Rd(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+p*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=p*i-s*n,t[11]=f*i-l*n,t}function Od(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-p*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+p*i,t[11]=l*n+f*i,t}function Nd(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+p*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=p*i-s*n,t[7]=f*i-l*n,t}function Ud(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function $d(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Gd(t,e,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<Q?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,t[0]=n*n*u+l,t[1]=i*n*u+o*s,t[2]=o*n*u-i*s,t[3]=0,t[4]=n*i*u-o*s,t[5]=i*i*u+l,t[6]=o*i*u+n*s,t[7]=0,t[8]=n*o*u+i*s,t[9]=i*o*u-n*s,t[10]=o*o*u+l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function qd(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function jd(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jd(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Hc(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,f=n*u,y=i*l,m=i*u,h=o*u,d=a*s,g=a*l,b=a*u;return t[0]=1-(y+h),t[1]=p+b,t[2]=f-g,t[3]=0,t[4]=p-b,t[5]=1-(c+h),t[6]=m+d,t[7]=0,t[8]=f+g,t[9]=m-d,t[10]=1-(c+y),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Zd(t,e){var r=new Ge(3),n=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),Hc(t,e,r),t}function Wd(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Xc(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],c=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(l,u,c),t}function Hd(t,e){var r=new Ge(3);Xc(r,e);var n=1/r[0],i=1/r[1],o=1/r[2],a=e[0]*n,s=e[1]*i,l=e[2]*o,u=e[4]*n,c=e[5]*i,p=e[6]*o,f=e[8]*n,y=e[9]*i,m=e[10]*o,h=a+c+m,d=0;return h>0?(d=Math.sqrt(h+1)*2,t[3]=.25*d,t[0]=(p-y)/d,t[1]=(f-l)/d,t[2]=(s-u)/d):a>c&&a>m?(d=Math.sqrt(1+a-c-m)*2,t[3]=(p-y)/d,t[0]=.25*d,t[1]=(s+u)/d,t[2]=(f+l)/d):c>m?(d=Math.sqrt(1+c-a-m)*2,t[3]=(f-l)/d,t[0]=(s+u)/d,t[1]=.25*d,t[2]=(p+y)/d):(d=Math.sqrt(1+m-a-c)*2,t[3]=(s-u)/d,t[0]=(f+l)/d,t[1]=(p+y)/d,t[2]=.25*d),t}function Xd(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,p=i*l,f=i*u,y=i*c,m=o*u,h=o*c,d=a*c,g=s*l,b=s*u,x=s*c,v=n[0],P=n[1],w=n[2];return t[0]=(1-(m+d))*v,t[1]=(f+x)*v,t[2]=(y-b)*v,t[3]=0,t[4]=(f-x)*P,t[5]=(1-(p+d))*P,t[6]=(h+g)*P,t[7]=0,t[8]=(y+b)*w,t[9]=(h-g)*w,t[10]=(1-(p+m))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Kd(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,f=o*u,y=o*c,m=o*p,h=a*c,d=a*p,g=s*p,b=l*u,x=l*c,v=l*p,P=n[0],w=n[1],T=n[2],F=i[0],E=i[1],_=i[2],I=(1-(h+g))*P,k=(y+v)*P,V=(m-x)*P,A=(y-v)*w,z=(1-(f+g))*w,O=(d+b)*w,N=(m+x)*T,K=(d-b)*T,xe=(1-(f+h))*T;return t[0]=I,t[1]=k,t[2]=V,t[3]=0,t[4]=A,t[5]=z,t[6]=O,t[7]=0,t[8]=N,t[9]=K,t[10]=xe,t[11]=0,t[12]=r[0]+F-(I*F+A*E+N*_),t[13]=r[1]+E-(k*F+z*E+K*_),t[14]=r[2]+_-(V*F+O*E+xe*_),t[15]=1,t}function Yd(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,f=i*a,y=i*s,m=i*l,h=o*a,d=o*s,g=o*l;return t[0]=1-p-m,t[1]=c+g,t[2]=f-d,t[3]=0,t[4]=c-g,t[5]=1-u-m,t[6]=y+h,t[7]=0,t[8]=f+d,t[9]=y-h,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Qd(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=o*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t}function Kc(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=(i+n)*a,t[14]=2*i*n*a):(t[10]=-1,t[14]=-2*n),t}var eg=Kc;function tg(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=i*a,t[14]=i*n*a):(t[10]=-1,t[14]=-n),t}function rg(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function Yc(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t}var ng=Yc;function ig(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=o*u,t[15]=1,t}function og(t,e,r,n){var i,o,a,s,l,u,c,p,f,y,m=e[0],h=e[1],d=e[2],g=n[0],b=n[1],x=n[2],v=r[0],P=r[1],w=r[2];return Math.abs(m-v)<Q&&Math.abs(h-P)<Q&&Math.abs(d-w)<Q?Zc(t):(c=m-v,p=h-P,f=d-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=b*f-x*p,o=x*c-g*f,a=g*p-b*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(s=0,l=0,u=0),t[0]=i,t[1]=s,t[2]=c,t[3]=0,t[4]=o,t[5]=l,t[6]=p,t[7]=0,t[8]=a,t[9]=u,t[10]=f,t[11]=0,t[12]=-(i*m+o*h+a*d),t[13]=-(s*m+l*h+u*d),t[14]=-(c*m+p*h+f*d),t[15]=1,t)}function ag(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,h=u*c-s*f,d=s*p-l*c;return y=m*m+h*h+d*d,y>0&&(y=1/Math.sqrt(y),m*=y,h*=y,d*=y),t[0]=m,t[1]=h,t[2]=d,t[3]=0,t[4]=p*d-f*h,t[5]=f*m-c*d,t[6]=c*h-p*m,t[7]=0,t[8]=c,t[9]=p,t[10]=f,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function sg(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function lg(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function ug(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function Qc(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function cg(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function pg(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function fg(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function yg(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15],b=e[0],x=e[1],v=e[2],P=e[3],w=e[4],T=e[5],F=e[6],E=e[7],_=e[8],I=e[9],k=e[10],V=e[11],A=e[12],z=e[13],O=e[14],N=e[15];return Math.abs(r-b)<=Q*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-x)<=Q*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-v)<=Q*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-P)<=Q*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=Q*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-T)<=Q*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-F)<=Q*Math.max(1,Math.abs(l),Math.abs(F))&&Math.abs(u-E)<=Q*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-_)<=Q*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(p-I)<=Q*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-k)<=Q*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(y-V)<=Q*Math.max(1,Math.abs(y),Math.abs(V))&&Math.abs(m-A)<=Q*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-z)<=Q*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(d-O)<=Q*Math.max(1,Math.abs(d),Math.abs(O))&&Math.abs(g-N)<=Q*Math.max(1,Math.abs(g),Math.abs(N))}var mg=Wc,hg=Qc;var Qt={};Ol(Qt,{add:()=>vg,ceil:()=>Pg,clone:()=>dg,copy:()=>xg,create:()=>ep,cross:()=>Fg,dist:()=>qg,distance:()=>ip,div:()=>Gg,divide:()=>np,dot:()=>Eg,equals:()=>Ng,exactEquals:()=>Og,floor:()=>Sg,forEach:()=>Wg,fromValues:()=>gg,inverse:()=>kg,len:()=>Jg,length:()=>ap,lerp:()=>Lg,max:()=>Ag,min:()=>wg,mul:()=>$g,multiply:()=>rp,negate:()=>Cg,normalize:()=>Mg,random:()=>Dg,round:()=>_g,scale:()=>Ig,scaleAndAdd:()=>Tg,set:()=>bg,sqrDist:()=>jg,sqrLen:()=>Zg,squaredDistance:()=>op,squaredLength:()=>sp,str:()=>Rg,sub:()=>Ug,subtract:()=>tp,transformMat4:()=>Vg,transformQuat:()=>Bg,zero:()=>zg});function ep(){var t=new Ge(4);return Ge!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function dg(t){var e=new Ge(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function gg(t,e,r,n){var i=new Ge(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function xg(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function bg(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function vg(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function tp(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function rp(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function np(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function Pg(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function Sg(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function wg(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function Ag(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function _g(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function Ig(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function Tg(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function ip(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function op(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function ap(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function sp(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function Cg(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function kg(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function Mg(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function Eg(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Fg(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],p=e[1],f=e[2],y=e[3];return t[0]=p*u-f*l+y*s,t[1]=-(c*u)+f*a-y*o,t[2]=c*l-p*a+y*i,t[3]=-(c*s)+p*o-f*i,t}function Lg(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function Dg(t,e){e=e||1;var r,n,i,o,a,s;do r=jn()*2-1,n=jn()*2-1,a=r*r+n*n;while(a>=1);do i=jn()*2-1,o=jn()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*o*l,t}function Vg(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function Bg(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return t[0]=c*u+y*-a+p*-l-f*-s,t[1]=p*u+y*-s+f*-a-c*-l,t[2]=f*u+y*-l+c*-s-p*-a,t[3]=e[3],t}function zg(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Rg(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Og(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Ng(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=Q*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Q*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Q*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Q*Math.max(1,Math.abs(o),Math.abs(u))}var Ug=tp,$g=rp,Gg=np,qg=ip,jg=op,Jg=ap,Zg=sp,Wg=function(){var t=ep();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}();var lp=Z(he(),1),Uo=class extends se{constructor(e){super(e,jc)}createBucket(e){return new Kt(e)}queryRadius(e){let r=e;return Yt("circle-radius",this,r)+Yt("circle-stroke-width",this,r)+_t(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=It(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),c=this.paint.get("circle-radius").evaluate(r,n),p=this.paint.get("circle-stroke-width").evaluate(r,n),f=c+p,y=this.paint.get("circle-pitch-alignment")==="map",m=y?u:Hg(u,l),h=y?f*s:f;for(let d of i)for(let g of d){let b=y?g:up(g,l),x=h,v=Qt.transformMat4([],[g.x,g.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?x*=v[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(x*=a.cameraToCenterDistance/v[3]),Oc(m,b,x))return!0}return!1}};function up(t,e){let r=Qt.transformMat4([],[t.x,t.y,0,1],e);return new lp.default(r[0]/r[3],r[1]/r[3])}function Hg(t,e){return t.map(r=>up(r,e))}var Zn=class extends Kt{};C("HeatmapBucket",Zn,{omit:["layers"]});var cp,Xg=()=>cp=cp||new re({"heatmap-radius":new R(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new R(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new B(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Zt(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new B(S.paint_heatmap["heatmap-opacity"])}),pp={get paint(){return Xg()}};function Bs(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(e*r*n));return t.width=e,t.height=r,t.data=i,t}function fp(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=Bs({},{width:e,height:r},n);zs(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function zs(t,e,r,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*t.width+r.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return e}var er=class t{constructor(e,r){Bs(this,e,1,r)}resize(e){fp(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){zs(e,r,n,i,o,1)}},de=class t{constructor(e,r){Bs(this,e,4,r)}resize(e){fp(this,e,4)}replace(e,r){r?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){zs(e,r,n,i,o,4)}};C("AlphaImage",er);C("RGBAImage",de);function yp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new de({width:r,height:n});if(!Xl(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};if(t.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=t.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var $o=class extends se{createBucket(e){return new Zn(e)}constructor(e){super(e,pp),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=yp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var mp,Kg=()=>mp=mp||new re({"hillshade-illumination-direction":new B(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new B(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new B(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new B(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new B(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new B(S.paint_hillshade["hillshade-accent-color"])}),hp={get paint(){return Kg()}};var Go=class extends se{constructor(e){super(e,hp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Yg=Y([{name:"a_pos",components:2,type:"Int16"}],4);var{members:dp,size:GP,alignment:qP}=Yg;var Sp=Z($s(),1);function Gs(t,e,r,n,i){Pp(t,e,r||0,n||t.length-1,i||mx)}function Pp(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(e-a*l/o+u)),p=Math.min(n,Math.floor(e+(o-a)*l/o+u));Pp(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Kn(t,r,e),i(t[n],f)>0&&Kn(t,r,n);y<m;){for(Kn(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Kn(t,r,m):(m++,Kn(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Kn(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function mx(t,e){return t<e?-1:t>e?1:0}function Tr(t,e){let r=t.length;if(r<=1)return[t];let n=[],i,o;for(let a=0;a<r;a++){let s=Ql(t[a]);s!==0&&(t[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[t[a]]):i.push(t[a]))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(Gs(n[a],e,1,n[a].length-1,hx),n[a]=n[a].slice(0,e));return n}function hx(t,e){return e.area-t.area}function Cr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get("".concat(t,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function kr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get("".concat(t,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var dx=500,rr=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new _o,this.indexArray=new Le,this.indexArray2=new wt,this.programConfigurations=new Ce(e.layers,e.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Cr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=$e(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:ke(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=kr("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,n,i,o){for(let a of Tr(r,dx)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),h=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(h+y.length-1,h),c.push(y[0].x),c.push(y[0].y);for(let d=1;d<y.length;d++)this.layoutVertexArray.emplaceBack(y[d].x,y[d].y),this.indexArray2.emplaceBack(h+d-1,h+d),c.push(y[d].x),c.push(y[d].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,Sp.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};C("FillBucket",rr,{omit:["layers","patternFeatures"]});var wp,gx=()=>wp=wp||new re({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),Ap,xx=()=>Ap=Ap||new re({"fill-antialias":new B(S.paint_fill["fill-antialias"]),"fill-opacity":new R(S.paint_fill["fill-opacity"]),"fill-color":new R(S.paint_fill["fill-color"]),"fill-outline-color":new R(S.paint_fill["fill-outline-color"]),"fill-translate":new B(S.paint_fill["fill-translate"]),"fill-translate-anchor":new B(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new lt(S.paint_fill["fill-pattern"])}),_p={get paint(){return xx()},get layout(){return gx()}};var Wo=class extends se{constructor(e){super(e,_p)}recalculate(e,r){super.recalculate(e,r);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new rr(e)}queryRadius(){return _t(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=It(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return Oo(l,i)}isTileClipped(){return!0}};var bx=Y([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ip=Y([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Tp,size:IS,alignment:TS}=bx;var Lp=Z($s(),1),Dp=Z(Tt(),1);var Ex=Dp.default.VectorTileFeature.types,Fx=500,Js=Math.pow(2,13);function Yn(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*Js)*2+a,i*Js*2,o*Js*2,Math.round(s))}var nr=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Io,this.centroidVertexArray=new wo,this.indexArray=new Le,this.programConfigurations=new Ce(e.layers,e.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Cr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=$e(i,l);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:ke(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(kr("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Tp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ip.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,i,o){let a={x:0,y:0,vertexCount:0};for(let s of Tr(r,Fx)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||Dx(m))continue;let h=0;for(let d=0;d<m.length;d++){let g=m[d];if(d>=1){let b=m[d-1];if(!Lx(g,b)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let x=g.sub(b)._perp()._unit(),v=b.dist(g);h+v>32768&&(h=0),Yn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,0,h),Yn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,1,h),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,h+=v,Yn(this.layoutVertexArray,b.x,b.y,x.x,x.y,0,0,h),Yn(this.layoutVertexArray,b.x,b.y,x.x,x.y,0,1,h),a.x+=2*b.x,a.y+=2*b.y,a.vertexCount+=2;let P=u.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),Ex[e.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let h=0;h<m.length;h++){let d=m[h];Yn(this.layoutVertexArray,d.x,d.y,0,0,1,1,0),a.x+=d.x,a.y+=d.y,a.vertexCount+=1,c.push(d.x),c.push(d.y)}}let y=(0,Lp.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};C("FillExtrusionBucket",nr,{omit:["layers","features"]});function Lx(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Dx(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Vp,Vx=()=>Vp=Vp||new re({"fill-extrusion-opacity":new B(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new R(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new B(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new B(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new lt(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new R(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new R(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new B(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Bp={get paint(){return Vx()}};var Xo=Z(he(),1);var Ko=class extends se{constructor(e){super(e,Bp)}createBucket(e){return new nr(e)}queryRadius(){return _t(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=It(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(r,n),p=this.paint.get("fill-extrusion-base").evaluate(r,n),f=Rx(u,l,a,0),y=zx(i,p,c,l),m=y[0],h=y[1];return Bx(m,h,f)}};function Qn(t,e){return t.x*e.x+t.y*e.y}function zp(t,e){if(t.length===1){let r=0,n=e[r++],i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=Qn(s,s),p=Qn(s,l),f=Qn(l,l),y=Qn(u,s),m=Qn(u,l),h=c*f-p*p,d=(f*y-p*m)/h,g=(c*m-p*y)/h,b=1-d-g,x=n.z*b+i.z*d+o.z*g;if(isFinite(x))return x}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Bx(t,e,r){let n=1/0;Oo(r,e)&&(n=zp(r,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=t[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];Rc(r,f)&&(n=Math.min(n,zp(r,f)))}}return n===1/0?!1:n}function zx(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let h=[],d=[];for(let g of m){let b=g.x,x=g.y,v=n[0]*b+n[4]*x+n[12],P=n[1]*b+n[5]*x+n[13],w=n[2]*b+n[6]*x+n[14],T=n[3]*b+n[7]*x+n[15],F=v+a,E=P+s,_=w+l,I=T+u,k=v+c,V=P+p,A=w+f,z=T+y,O=new Xo.default(F/I,E/I);O.z=_/I,h.push(O);let N=new Xo.default(k/z,V/z);N.z=A/z,d.push(N)}i.push(h),o.push(d)}return[i,o]}function Rx(t,e,r,n){let i=[];for(let o of t){let a=[o.x,o.y,n,1];Qt.transformMat4(a,a,e),i.push(new Xo.default(a[0]/a[3],a[1]/a[3]))}return i}var Ox=Y([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Rp,size:uw,alignment:cw}=Ox;var Nx=Y([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Op,size:yw,alignment:mw}=Nx;var $p=Z(Tt(),1);var Ux=$p.default.VectorTileFeature.types,Np=63,$x=Math.cos(75/2*(Math.PI/180)),Gx=15,qx=20,jx=15,Gp=1/2,Up=Math.pow(2,jx-1)/Gp,ir=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new To,this.layoutVertexArray2=new Co,this.indexArray=new Le,this.programConfigurations=new Ce(e.layers,e.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Cr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=$e(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:ke(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=kr("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Op)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rp),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let r=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(e,r,n,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let p of r)this.addLine(p,e,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<e.length-1;g++)this.totalDistance+=e[g].dist(e[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=Ux[r.type]==="Polygon",l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?Gx*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,h,d;this.e1=this.e2=-1,s&&(f=e[l-2],d=e[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?e[u+1]:void 0:e[g+1],m&&e[g].equals(m))continue;d&&(h=d),f&&(y=f),f=e[g],d=m?m.sub(f)._unit()._perp():h,h=h||d;let b=h.add(d);(b.x!==0||b.y!==0)&&b._unit();let x=h.x*d.x+h.y*d.y,v=b.x*d.x+b.y*d.y,P=v!==0?1/v:1/0,w=2*Math.sqrt(2-2*v),T=v<$x&&y&&m,F=h.x*d.y-h.y*d.x>0;if(T&&g>u){let I=f.dist(y);if(I>2*c){let k=f.sub(f.sub(y)._mult(c/I)._round());this.updateDistance(y,k),this.addCurrentVertex(k,h,0,0,p),y=k}}let E=y&&m,_=E?n:s?"butt":i;if(E&&_==="round"&&(P<a?_="miter":P<=2&&(_="fakeround")),_==="miter"&&P>o&&(_="bevel"),_==="bevel"&&(P>2&&(_="flipbevel"),P<o&&(_="miter")),y&&this.updateDistance(y,f),_==="miter")b._mult(P),this.addCurrentVertex(f,b,0,0,p);else if(_==="flipbevel"){if(P>100)b=d.mult(-1);else{let I=P*h.add(d).mag()/h.sub(d).mag();b._perp()._mult(I*(F?-1:1))}this.addCurrentVertex(f,b,0,0,p),this.addCurrentVertex(f,b.mult(-1),0,0,p)}else if(_==="bevel"||_==="fakeround"){let I=-Math.sqrt(P*P-1),k=F?I:0,V=F?0:I;if(y&&this.addCurrentVertex(f,h,k,V,p),_==="fakeround"){let A=Math.round(w*180/Math.PI/qx);for(let z=1;z<A;z++){let O=z/A;if(O!==.5){let K=O-.5,xe=1.0904+x*(-3.2452+x*(3.55645-x*1.43519)),X=.848013+x*(-1.06021+x*.215638);O=O+O*K*(O-1)*(xe*K*K+X)}let N=d.sub(h)._mult(O)._add(h)._unit()._mult(F?-1:1);this.addHalfVertex(f,N.x,N.y,!1,F,0,p)}}m&&this.addCurrentVertex(f,d,-k,-V,p)}else if(_==="butt")this.addCurrentVertex(f,b,0,0,p);else if(_==="square"){let I=y?1:-1;this.addCurrentVertex(f,b,I,I,p)}else _==="round"&&(y&&(this.addCurrentVertex(f,h,0,0,p),this.addCurrentVertex(f,h,1,1,p,!0)),m&&(this.addCurrentVertex(f,d,-1,-1,p,!0),this.addCurrentVertex(f,d,0,0,p)));if(T&&g<l-1){let I=f.dist(m);if(I>2*c){let k=f.add(m.sub(f)._mult(c/I)._round());this.updateDistance(f,k),this.addCurrentVertex(k,d,0,0,p),f=k}}}}addCurrentVertex(e,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>Up/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,i,o,a))}addHalfVertex({x:e,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(Up-1):this.scaledDistance)*Gp;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(Np*n)+128,Math.round(Np*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}};C("LineBucket",ir,{omit:["layers","patternFeatures"]});var qp,Jx=()=>qp=qp||new re({"line-cap":new B(S.layout_line["line-cap"]),"line-join":new R(S.layout_line["line-join"]),"line-miter-limit":new B(S.layout_line["line-miter-limit"]),"line-round-limit":new B(S.layout_line["line-round-limit"]),"line-sort-key":new R(S.layout_line["line-sort-key"])}),jp,Zx=()=>jp=jp||new re({"line-opacity":new R(S.paint_line["line-opacity"]),"line-color":new R(S.paint_line["line-color"]),"line-translate":new B(S.paint_line["line-translate"]),"line-translate-anchor":new B(S.paint_line["line-translate-anchor"]),"line-width":new R(S.paint_line["line-width"]),"line-gap-width":new R(S.paint_line["line-gap-width"]),"line-offset":new R(S.paint_line["line-offset"]),"line-blur":new R(S.paint_line["line-blur"]),"line-dasharray":new Jt(S.paint_line["line-dasharray"]),"line-pattern":new lt(S.paint_line["line-pattern"]),"line-gradient":new Zt(S.paint_line["line-gradient"])}),Zs={get paint(){return Zx()},get layout(){return Jx()}};var Ws=class extends R{possiblyEvaluate(e,r){return r=new q(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,i){return r=Pe({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Yo,Qo=class extends se{constructor(e){super(e,Zs),this.gradientVersion=0,Yo||(Yo=new Ws(Zs.paint.properties["line-width"].specification),Yo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();qt(r)?this.stepInterpolant=r._styleExpression.expression instanceof yr:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Yo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ir(e)}queryRadius(e){let r=e,n=Jp(Yt("line-width",this,r),Yt("line-gap-width",this,r)),i=Yt("line-offset",this,r);return n/2+Math.abs(i)+_t(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=It(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Jp(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),c=this.paint.get("line-offset").evaluate(r,n);return c&&(i=$c(i,c*s)),Nc(l,i,u)}isTileClipped(){return!0}};function Jp(t,e){return e>0?e+2*t:t}var Zp=Y([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Wp=Y([{name:"a_projected_pos",components:3,type:"Float32"}],4),Kw=Y([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Hp=Y([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Yw=Y([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Hs=Y([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Qw=Y([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),e2=Y([{name:"triangle",components:3,type:"Uint16"}]),t2=Y([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),r2=Y([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),n2=Y([{type:"Float32",name:"offsetX"}]),i2=Y([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),o2=Y([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var oi=Z(he(),1);function Wx(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),ye.applyArabicShaping&&(t=ye.applyArabicShaping(t)),t}function Xp(t,e,r){return t.sections.forEach(n=>{n.text=Wx(n.text,e,r)}),t}function Kp(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(f.x,":").concat(f.y)}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let h=s(y,m,p),d=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[d].geometry,!0)]=d,n[h].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Er={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Yp(t){let e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;(!n||!As(n)||Er[t[r+1]])&&(!i||!As(i)||Er[t[r-1]])&&Er[t[r]]?e+=Er[t[r]]:e+=t[r]}return e}var ne=24;var fb=Z(ei(),1),yb=3;var ra=yb;function ti(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],o=0,a=0;for(let s of t)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var ge=1;var na=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+ge,this.paddedRect.y+ge]}get br(){return[this.paddedRect.x+this.paddedRect.w-ge,this.paddedRect.y+this.paddedRect.h-ge]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-ge*2)/this.pixelRatio,(this.paddedRect.h-ge*2)/this.pixelRatio]}},ri=class{constructor(e,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(r,i,o);let{w:a,h:s}=ti(o),l=new de({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;de.copy(c.data,l,{x:0,y:0},{x:p.x+ge,y:p.y+ge},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+ge,y=p.y+ge,m=c.data.width,h=c.data.height;de.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),de.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),de.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),de.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),de.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*ge,h:o.data.height+2*ge};n.push(a),r[i]=new na(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;let[i,o]=e.tl;n.update(r.data,void 0,{x:i,y:o})}};C("ImagePosition",na);C("ImageAtlas",ri);var aa=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(aa||{}),Dr=-17;function mb(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var af=57344,sf=63743,ia=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){let n=new t;return n.scale=e||1,n.fontStack=r,n}static forImage(e){let r=new t;return r.imageName=e,r}},ni=class t{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new t;for(let i=0;i<e.sections.length;i++){let o=e.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=Yp(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&oa[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&oa[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){let n=new t;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(ia.forText(e.scale,e.fontStack||r));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){fe("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){fe("Reached maximum number of images ".concat(sf-af+2));return}this.text+=String.fromCharCode(n),this.sections.push(ia.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=sf?null:++this.imageSectionID:(this.imageSectionID=af,this.imageSectionID)}};function hb(t,e){let r=[],n=t.text,i=0;for(let o of e)r.push(t.substring(i,o)),i=o;return i<n.length&&r.push(t.substring(i,n.length)),r}function ii(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h){let d=ni.fromFeature(t,i);p===2&&d.verticalizePunctuation();let g,{processBidirectionalText:b,processStyledBidirectionalText:x}=ye;if(b&&d.sections.length===1){g=[];let w=b(d.toString(),Ys(d,u,o,e,n,y,m));for(let T of w){let F=new ni;F.text=T,F.sections=d.sections;for(let E=0;E<T.length;E++)F.sectionIndex.push(0);g.push(F)}}else if(x){g=[];let w=x(d.text,d.sectionIndex,Ys(d,u,o,e,n,y,m));for(let T of w){let F=new ni;F.text=T[0],F.sectionIndex=T[1],F.sections=d.sections,g.push(F)}}else g=hb(d,Ys(d,u,o,e,n,y,m));let v=[],P={positionedLines:v,text:d.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return bb(P,e,r,n,g,a,s,l,p,u,f,h),mb(v)?!1:P}var oa={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},db={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 cf(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ne/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function gb(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=cf(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function lf(t,e,r,n){let i=Math.pow(t-e,2);return n?t<e?i/2:i*2:i+Math.abs(r)*r}function xb(t,e,r){let n=0;return t===10&&(n-=1e4),r&&(n+=150),(t===40||t===65288)&&(n+=50),(e===41||e===65289)&&(n+=50),n}function uf(t,e,r,n,i,o){let a=null,s=lf(e,r,i,o);for(let l of n){let u=e-l.x,c=lf(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function pf(t){return t?pf(t.priorBreak).concat(t.index):[]}function Ys(t,e,r,n,i,o,a){if(o!=="point")return[];if(!t)return[];let s=[],l=gb(t,e,r,n,i,a),u=t.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<t.length();p++){let f=t.getSection(p),y=t.getCharCode(p);if(oa[y]||(c+=cf(y,f,n,i,e,a)),p<t.length()-1){let m=Sc(y);(db[y]||m||f.imageName)&&s.push(uf(p+1,c,l,s,xb(y,t.getCharCode(p+1),m&&u),!1))}}return pf(uf(t.length(),c,l,s,0,!0))}function ff(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:e,verticalAlign:r}}function bb(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=Dr,m=0,h=0,d=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),T=(w-1)*ne,F={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=F;let E=F.positionedGlyphs,_=0;if(!P.length()){y+=o,++g;continue}for(let k=0;k<P.length();k++){let V=P.getSection(k),A=P.getSectionIndex(k),z=P.getCharCode(k),O=0,N=null,K=null,xe=null,X=ne,le=!(l===1||!c&&!lo(z)||c&&(oa[z]||wc(z)));if(V.imageName){let ce=n[V.imageName];if(!ce)continue;xe=V.imageName,t.iconsInText=t.iconsInText||!0,K=ce.paddedRect;let pe=ce.displaySize;V.scale=V.scale*ne/p,N={width:pe[0],height:pe[1],left:ge,top:-ra,advance:le?pe[1]:pe[0]};let _e=ne-pe[1]*V.scale;O=T+_e,X=N.advance;let be=le?pe[0]*V.scale-ne*w:pe[1]*V.scale-ne*w;be>0&&be>_&&(_=be)}else{let ce=r[V.fontStack],pe=ce&&ce[z];if(pe&&pe.rect)K=pe.rect,N=pe.metrics;else{let _e=e[V.fontStack],be=_e&&_e[z];if(!be)continue;N=be.metrics}O=(w-V.scale)*ne}le?(t.verticalizable=!0,E.push({glyph:z,imageName:xe,x:f,y:y+O,vertical:le,scale:V.scale,fontStack:V.fontStack,sectionIndex:A,metrics:N,rect:K}),f+=X*V.scale+u):(E.push({glyph:z,imageName:xe,x:f,y:y+O,vertical:le,scale:V.scale,fontStack:V.fontStack,sectionIndex:A,metrics:N,rect:K}),f+=N.advance*V.scale+u)}if(E.length!==0){let k=f-u;m=Math.max(k,m),vb(E,0,E.length-1,d,_)}f=0;let I=o*w+_;F.lineOffset=Math.max(_,T),y+=I,h=Math.max(I,h),++g}let b=y-Dr,{horizontalAlign:x,verticalAlign:v}=ff(a);Pb(t.positionedLines,d,x,v,m,h,o,b,i.length),t.top+=-v*b,t.bottom=t.top+b,t.left+=-x*m,t.right=t.left+m}function vb(t,e,r,n,i){if(!n&&!i)return;let o=t[r],a=o.metrics.advance*o.scale,s=(t[r].x+a)*n;for(let l=e;l<=r;l++)t[l].x-=s,t[l].y+=i}function Pb(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-Dr:c=(-n*l+.5)*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function yf(t,e,r){let{horizontalAlign:n,verticalAlign:i}=ff(r),o=e[0],a=e[1],s=o-t.displaySize[0]*n,l=s+t.displaySize[0],u=a-t.displaySize[1]*i,c=u+t.displaySize[1];return{image:t,top:u,bottom:c,left:s,right:l}}function Qs(t,e,r,n,i,o){let a=t.image,s;if(a.content){let d=a.content,g=a.pixelRatio||1;s=[d[0]/g,d[1]/g,a.displaySize[0]-d[2]/g,a.displaySize[1]-d[3]/g]}let l=e.left*o,u=e.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=e.top*o,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var mf=Z(Tt(),1);var Vr=255,Ct=128,tt=Vr*Ct;function el(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new q(t+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=t;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new q(s)),c=r.evaluate(new q(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function tl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var Sb=mf.default.VectorTileFeature.types,wb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function sa(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(tt,Math.round(s[0])):0,m=s?Math.min(tt,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function hf(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Ab(t){for(let e of t.sections)if(_c(e.text))return!0;return!1}var ai=class{constructor(e){this.layoutVertexArray=new ko,this.indexArray=new Le,this.programConfigurations=e,this.segments=new me,this.dynamicLayoutVertexArray=new Mo,this.opacityVertexArray=new Eo,this.hasVisibleVertices=!1,this.placedSymbolArray=new Dn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Zp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Wp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,wb,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};C("SymbolBuffers",ai);var si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new Fo}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Hp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};C("CollisionBuffers",si);var He=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Jn.identity([]),this.placementViewportMatrix=Jn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=el(this.zoom,n["text-size"]),this.iconSizeData=el(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=tl(i,"text-overlap","text-allow-overlap")!=="never"||tl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>aa[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new ai(new Ce(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new ai(new Ce(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Bn,this.lineVertexArray=new zn,this.symbolInstances=new Vn,this.textAnchorOffsets=new Rn}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=Er[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Fe&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new q(this.zoom);for(let{feature:d,id:g,index:b,sourceLayerIndex:x}of e){let v=i._featureFilter.needGeometry,P=$e(d,v);if(!i._featureFilter.filter(h,P,n))continue;v||(P.geometry=ke(d));let w;if(u){let _=i.getValueAndResolveTokens("text-field",P,n,m),I=Fe.factory(_),k=this.hasRTLText=this.hasRTLText||Ab(I);(!k||ye.getRTLTextPluginStatus()==="unavailable"||k&&ye.isParsed())&&(w=Xp(I,i,P))}let T;if(c){let _=i.getValueAndResolveTokens("icon-image",P,n,m);_ instanceof Te?T=_:T=Te.fromString(_)}if(!w&&!T)continue;let F=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,E={id:g,text:w,icon:T,index:b,sourceLayerIndex:x,geometry:P.geometry,properties:d.properties,type:Sb[d.type],sortKey:F};if(this.features.push(E),T&&(f[T.name]=!0),w){let _=a.evaluate(P,{},n).join(","),I=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let k of w.sections)if(k.image)f[k.image.name]=!0;else{let V=hn(w.toString()),A=k.fontStack||_,z=y[A]=y[A]||{};this.calculateGlyphDependencies(k.text,z,I,this.allowVerticalPlacement,V)}}}o.get("symbol-placement")==="line"&&(this.features=Kp(this.features)),this.sortFeaturesByKey&&this.features.sort((d,g)=>d.sortKey-g.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(r[e.segment+1]),o=e.dist(r[e.segment]),a={};for(let s=e.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,i,o,a,s,l,u,c,p,f){let y=e.indexArray,m=e.layoutVertexArray,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),d=this.glyphOffsetArray.length,g=h.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:P,tr:w,bl:T,br:F,tex:E,pixelOffsetTL:_,pixelOffsetBR:I,minFontScaleX:k,minFontScaleY:V,glyphOffset:A,isSDF:z,sectionIndex:O}=r[v],N=h.vertexLength,K=A[1];sa(m,l.x,l.y,P.x,K+P.y,E.x,E.y,n,z,_.x,_.y,k,V),sa(m,l.x,l.y,w.x,K+w.y,E.x+E.w,E.y,n,z,I.x,_.y,k,V),sa(m,l.x,l.y,T.x,K+T.y,E.x,E.y+E.h,n,z,_.x,I.y,k,V),sa(m,l.x,l.y,F.x,K+F.y,E.x+E.w,E.y+E.h,n,z,I.x,I.y,k,V),hf(e.dynamicLayoutVertexArray,l,b),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(v===r.length-1||O!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,x&&x[O])}e.placedSymbolArray.emplaceBack(l.x,l.y,d,this.glyphOffsetArray.length-d,g,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,r,n,i,o,a){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new oi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new oi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new oi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new oi.default(e,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,i){for(let o=e;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new si(Nn,Hs.members,wt),this.iconCollisionBox=new si(Nn,Hs.members,wt);for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=e.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=e.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=e.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=e.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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}addIndicesForPlacedSymbol(e,r){let n=e.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+1,o+2),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(e,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",He,{omit:["layers","collisionBoxArray","features","compareText"]});He.MAX_GLYPHS=65535;He.addDynamicAttributes=hf;function df(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var gf,_b=()=>gf=gf||new re({"symbol-placement":new B(S.layout_symbol["symbol-placement"]),"symbol-spacing":new B(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new B(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new R(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new B(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new B(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new B(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new B(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new B(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new B(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new R(S.layout_symbol["icon-size"]),"icon-text-fit":new B(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new B(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new R(S.layout_symbol["icon-image"]),"icon-rotate":new R(S.layout_symbol["icon-rotate"]),"icon-padding":new R(S.layout_symbol["icon-padding"]),"icon-keep-upright":new B(S.layout_symbol["icon-keep-upright"]),"icon-offset":new R(S.layout_symbol["icon-offset"]),"icon-anchor":new R(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new B(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new B(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new B(S.layout_symbol["text-rotation-alignment"]),"text-field":new R(S.layout_symbol["text-field"]),"text-font":new R(S.layout_symbol["text-font"]),"text-size":new R(S.layout_symbol["text-size"]),"text-max-width":new R(S.layout_symbol["text-max-width"]),"text-line-height":new B(S.layout_symbol["text-line-height"]),"text-letter-spacing":new R(S.layout_symbol["text-letter-spacing"]),"text-justify":new R(S.layout_symbol["text-justify"]),"text-radial-offset":new R(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new B(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new R(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new R(S.layout_symbol["text-anchor"]),"text-max-angle":new B(S.layout_symbol["text-max-angle"]),"text-writing-mode":new B(S.layout_symbol["text-writing-mode"]),"text-rotate":new R(S.layout_symbol["text-rotate"]),"text-padding":new B(S.layout_symbol["text-padding"]),"text-keep-upright":new B(S.layout_symbol["text-keep-upright"]),"text-transform":new R(S.layout_symbol["text-transform"]),"text-offset":new R(S.layout_symbol["text-offset"]),"text-allow-overlap":new B(S.layout_symbol["text-allow-overlap"]),"text-overlap":new B(S.layout_symbol["text-overlap"]),"text-ignore-placement":new B(S.layout_symbol["text-ignore-placement"]),"text-optional":new B(S.layout_symbol["text-optional"])}),xf,Ib=()=>xf=xf||new re({"icon-opacity":new R(S.paint_symbol["icon-opacity"]),"icon-color":new R(S.paint_symbol["icon-color"]),"icon-halo-color":new R(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new R(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new R(S.paint_symbol["icon-halo-blur"]),"icon-translate":new B(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new B(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new R(S.paint_symbol["text-opacity"]),"text-color":new R(S.paint_symbol["text-color"],{runtimeType:Re,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new R(S.paint_symbol["text-halo-color"]),"text-halo-width":new R(S.paint_symbol["text-halo-width"]),"text-halo-blur":new R(S.paint_symbol["text-halo-blur"]),"text-translate":new B(S.paint_symbol["text-translate"]),"text-translate-anchor":new B(S.paint_symbol["text-translate-anchor"])}),la={get paint(){return Ib()},get layout(){return _b()}};var li=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:hr,this.defaultValue=e}evaluate(e){if(e.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;e(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};C("FormatSectionOverride",li,{omit:["defaultValue"]});var ua=class t extends se{constructor(e){super(e,la)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,i){let o=this.layout.get(e).evaluate(r,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!qt(a.value)&&o?df(r.properties,o):o}createBucket(e){return new He(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of la.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new li(r),i=new Nt(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new dt("source",i):o=new gt("composite",i,r.value.zoomStops),this.paint._values[e]=new Se(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:t.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=la.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof Fe)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof mt&&ue(u.value)===dr){let c=u.value;a(c.sections)}else u instanceof tn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function bf(t,e,r,n=1){let i=t.get("icon-padding").evaluate(e,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var vf,Tb=()=>vf=vf||new re({"background-color":new B(S.paint_background["background-color"]),"background-pattern":new Jt(S.paint_background["background-pattern"]),"background-opacity":new B(S.paint_background["background-opacity"])}),Pf={get paint(){return Tb()}};var ca=class extends se{constructor(e){super(e,Pf)}};var Sf,Cb=()=>Sf=Sf||new re({"raster-opacity":new B(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new B(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new B(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new B(S.paint_raster["raster-brightness-max"]),"raster-saturation":new B(S.paint_raster["raster-saturation"]),"raster-contrast":new B(S.paint_raster["raster-contrast"]),"raster-resampling":new B(S.paint_raster["raster-resampling"]),"raster-fade-duration":new B(S.paint_raster["raster-fade-duration"])}),wf={get paint(){return Cb()}};var pa=class extends se{constructor(e){super(e,wf)}};var fa=class extends se{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Af(t){if(t.type==="custom")return new fa(t);switch(t.type){case"background":return new ca(t);case"circle":return new Uo(t);case"fill":return new Wo(t);case"fill-extrusion":return new Ko(t);case"heatmap":return new $o(t);case"hillshade":return new Go(t);case"line":return new Qo(t);case"raster":return new pa(t);case"symbol":return new ua(t)}}var ya=class{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(e,r){for(let i of e){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Af(i);o._featureFilter=yn(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=qu(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var Hf=Z(Tt(),1),Xf=Z(ei(),1);var Br=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};var Tf=Z(Tt(),1),Cf=Z(ei(),1);var ma=class{constructor(e,r,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(e[r]=this[r]);return e}};var ui=class{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Vt(8192,16,0),this.grid3D=new Vt(8192,16,0),this.featureIndexArray=new On,this.promoteId=r}insert(e,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Tf.default.VectorTile(new Cf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Br(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params||{},a=8192/e.tileSize/e.scale,s=yn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=If(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=If(e.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(d,g,b,x)=>Uc(e.cameraQueryGeometry,d-u,g-u,b+u,x+u));for(let d of y)p.push(d);p.sort(kb);let m={},h;for(let d=0;d<p.length;d++){let g=p[d];if(g===h)continue;h=g;let b=this.featureIndexArray.get(g),x=null;this.loadMatchingFeature(m,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,P,w)=>(x||(x=ke(v)),P.queryIntersectsFeature(l,v,w,x,this.z,e.transform,a,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!Yl(a,f))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let g=$e(h,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),h))return;let d=this.getId(h,y);for(let g=0;g<f.length;g++){let b=f[g];if(a&&a.indexOf(b)<0)continue;let x=l[b];if(!x)continue;let v={};d&&c&&(v=c.getState(x.sourceLayer||"_geojsonTileLayer",d));let P=Pe({},u[b]);P.paint=_f(P.paint,x.paint,h,v,s),P.layout=_f(P.layout,x.layout,h,v,s);let w=!p||p(h,x,v);if(!w)continue;let T=new ma(h,this.z,this.x,this.y,d);T.layer=P;let F=e[b];F===void 0&&(F=e[b]=[]),F.push({featureIndex:i,feature:T,intersectionZ:w})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=yn(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(e){for(let r of this.bucketLayerIDs)for(let n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n))}return n}};C("FeatureIndex",ui,{omit:["rawTileData","sourceLayerCoder"]});function _f(t,e,r,n,i){return jr(t,(o,a)=>{let s=e instanceof vt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function If(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return{minX:e,minY:r,maxX:n,maxY:i}}function kb(t,e){return e-t}var kf=Z(he(),1);var rt=class t extends kf.default{constructor(e,r,n,i){super(e,r),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};C("Anchor",rt);function rl(t,e,r,n,i){if(e.segment===void 0||r===0)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=t[a-1],p=t[a],f=t[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Mf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Ef(t,e,r){return t?3/5*e*r:0}function Ff(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Lf(t,e,r,n,i,o){let a=Ef(r,i,o),s=Ff(r,n)*o,l=0,u=Mf(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=Oe.number(p.x,f.x,m),d=Oe.number(p.y,f.y,m),g=new rt(h,d,f.angleTo(p),c);return g._round(),!a||rl(t,g,s,a,e)?g:void 0}l+=y}}function Df(t,e,r,n,i,o,a,s,l){let u=Ef(n,o,a),c=Ff(n,i),p=c*a,f=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-p<e/4&&(e=p+e/4);let y=o*2,m=f?e/2*s%e:(c/2+y)*a*s%e;return Vf(t,m,e,u,r,p,f,!1,l)}function Vf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Mf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],d=t[m+1],g=h.dist(d),b=d.angleTo(h);for(;f+r<p+g;){f+=r;let x=(f-p)/g,v=Oe.number(h.x,d.x,x),P=Oe.number(h.y,d.y,x);if(v>=0&&v<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new rt(v,P,b,m);w._round(),(!n||rl(t,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Vf(t,p/2,r,n,i,o,a,!0,l)),y}var pt=Z(he(),1);function Bf(t,e,r,n,i){let o=[];for(let a=0;a<t.length;a++){let s=t[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new pt.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new pt.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new pt.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new pt.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new pt.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new pt.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new pt.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new pt.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var we=Z(he(),1);var zr=ge;function nl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*zr,l=o.paddedRect.h-2*zr,u=t.right-t.left,c=t.bottom-t.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(I,k)=>I+k[1]-k[0],m=p.reduce(y,0),h=f.reduce(y,0),d=s-m,g=l-h,b=0,x=m,v=0,P=h,w=0,T=d,F=0,E=g;if(o.content&&n){let I=o.content;b=ha(p,0,I[0]),v=ha(f,0,I[1]),x=ha(p,I[0],I[2]),P=ha(f,I[1],I[3]),w=I[0]-b,F=I[1]-v,T=I[2]-I[0]-x,E=I[3]-I[1]-P}let _=(I,k,V,A)=>{let z=da(I.stretch-b,x,u,t.left),O=ga(I.fixed-w,T,I.stretch,m),N=da(k.stretch-v,P,c,t.top),K=ga(k.fixed-F,E,k.stretch,h),xe=da(V.stretch-b,x,u,t.left),X=ga(V.fixed-w,T,V.stretch,m),le=da(A.stretch-v,P,c,t.top),ce=ga(A.fixed-F,E,A.stretch,h),pe=new we.default(z,N),_e=new we.default(xe,N),be=new we.default(xe,le),Ai=new we.default(z,le),Da=new we.default(O/a,K/a),Va=new we.default(X/a,ce/a),Ur=e*Math.PI/180;if(Ur){let Ie=Math.sin(Ur),ve=Math.cos(Ur),Ve=[ve,-Ie,Ie,ve];pe._matMult(Ve),_e._matMult(Ve),Ai._matMult(Ve),be._matMult(Ve)}let _i=I.stretch+I.fixed,Me=V.stretch+V.fixed,Ft=k.stretch+k.fixed,Ii=A.stretch+A.fixed,Ba={x:o.paddedRect.x+zr+_i,y:o.paddedRect.y+zr+Ft,w:Me-_i,h:Ii-Ft},za=T/a/u,Ra=E/a/c;return{tl:pe,tr:_e,bl:Ai,br:be,tex:Ba,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Da,pixelOffsetBR:Va,minFontScaleX:za,minFontScaleY:Ra,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(_({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let I=zf(p,d,m),k=zf(f,g,h);for(let V=0;V<I.length-1;V++){let A=I[V],z=I[V+1];for(let O=0;O<k.length-1;O++){let N=k[O],K=k[O+1];i.push(_(A,N,z,K))}}}return i}function ha(t,e,r){let n=0;for(let i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function zf(t,e,r){let n=[{fixed:-zr,stretch:0}];for(let[i,o]of t){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:e+zr,stretch:r}),n}function da(t,e,r,n){return t/e*r+n}function ga(t,e,r,n){return t-e*r/n}function Rf(t,e,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of e.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=ra+1,h=!0,d=1,g=0,b=(i||s)&&p.vertical,x=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ne,le=(ne-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-le:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,d=X.pixelRatio,m=ge/d}let v=i?[p.x+x,p.y]:[0,0],P=i?[0,0]:[p.x+x+r[0],p.y+r[1]-g],w=[0,0];b&&(w=P,P=[0,0]);let T=p.metrics.isDoubleResolution?2:1,F=(p.metrics.left-m)*p.scale-x+P[0],E=(-p.metrics.top-m)*p.scale+P[1],_=F+f.w/T*p.scale/d,I=E+f.h/T*p.scale/d,k=new we.default(F,E),V=new we.default(_,E),A=new we.default(F,I),z=new we.default(_,I);if(b){let X=new we.default(-x,x-Dr),le=-Math.PI/2,ce=ne/2-x,pe=p.imageName?ce:0,_e=new we.default(5-Dr-ce,-pe),be=new we.default(...w);k._rotateAround(le,X)._add(_e)._add(be),V._rotateAround(le,X)._add(_e)._add(be),A._rotateAround(le,X)._add(_e)._add(be),z._rotateAround(le,X)._add(_e)._add(be)}if(l){let X=Math.sin(l),le=Math.cos(l),ce=[le,-X,X,le];k._matMult(ce),V._matMult(ce),A._matMult(ce),z._matMult(ce)}let O=new we.default(0,0),N=new we.default(0,0);u.push({tl:k,tr:V,bl:A,br:z,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:O,pixelOffsetBR:N,minFontScaleX:0,minFontScaleY:0})}return u}var ci=Z(he(),1),or=class{constructor(e,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=e.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],h=a.collisionPadding;if(h&&(y-=h[0]*s,p-=h[1]*s,m+=h[2]*s,f+=h[3]*s),c){let d=new ci.default(y,p),g=new ci.default(m,p),b=new ci.default(y,f),x=new ci.default(m,f),v=c*Math.PI/180;d._rotate(v),g._rotate(v),b._rotate(v),x._rotate(v),y=Math.min(d.x,g.x,b.x,x.x),m=Math.max(d.x,g.x,b.x,x.x),p=Math.min(d.y,g.y,b.y,x.y),f=Math.max(d.y,g.y,b.y,x.y)}e.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=e.length}};var pi=class{constructor(e=[],r=Mb){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[e]=s,e=a}r[e]=o}};function Mb(t,e){return t<e?-1:t>e?1:0}var il=Z(he(),1);function Of(t,e=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=t[0];for(let h=0;h<s.length;h++){let d=s[h];(!h||d.x<n)&&(n=d.x),(!h||d.y<i)&&(i=d.y),(!h||d.x>o)&&(o=d.x),(!h||d.y>a)&&(a=d.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new pi([],Eb);if(c===0)return new il.default(n,i);for(let h=n;h<o;h+=c)for(let d=i;d<a;d+=c)f.push(new Rr(h+p,d+p,p,t));let y=Lb(t),m=f.length;for(;f.length;){let h=f.pop();(h.d>y.d||!y.d)&&(y=h,r&&console.log("found best %d after %d probes",Math.round(1e4*h.d)/1e4,m)),!(h.max-y.d<=e)&&(p=h.h/2,f.push(new Rr(h.p.x-p,h.p.y-p,p,t)),f.push(new Rr(h.p.x+p,h.p.y-p,p,t)),f.push(new Rr(h.p.x-p,h.p.y+p,p,t)),f.push(new Rr(h.p.x+p,h.p.y+p,p,t)),m+=4)}return r&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(y.d))),y.p}function Eb(t,e){return e.max-t.max}function Rr(t,e,r,n){this.p=new il.default(t,e),this.h=r,this.d=Fb(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Fb(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){let o=e[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,Vs(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Lb(t){let e=0,r=0,n=0,i=t[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,e+=c*3}return new Rr(r/e,n/e,0,t)}var ll=Z(ks(),1);var ol=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(ol||{}),kt=7,xa=Number.POSITIVE_INFINITY;function al(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-kt;break;case"bottom-right":case"bottom-left":s=-l+kt;break;case"bottom":s=-o+kt;break;case"top":s=o-kt;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-kt;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+kt;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return e[1]!==xa?n(t,e[0],e[1]):r(t,e[0])}function sl(t,e,r){var a;let n=t.layout,i=(a=n.get("text-variable-anchor-offset"))==null?void 0:a.evaluate(e,{},r);if(i){let s=i.values,l=[];for(let u=0;u<s.length;u+=2){let c=l[u]=s[u],p=s[u+1].map(f=>f*ne);c.startsWith("top")?p[1]-=kt:c.startsWith("bottom")&&(p[1]+=kt),l[u+1]=p}return new Ne(l)}let o=n.get("text-variable-anchor");if(o){let s;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?s=[n.get("text-radial-offset").evaluate(e,{},r)*ne,xa]:s=n.get("text-offset").evaluate(e,{},r).map(c=>c*ne);let u=[];for(let c of o)u.push(c,al(c,s));return new Ne(u)}return null}function $f(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new q(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new q(c),t.canonical),i["text-size"].possiblyEvaluate(new q(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new q(c),t.canonical),i["icon-size"].possiblyEvaluate(new q(p),t.canonical)]}let a=n.get("text-line-height")*ne,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},d=c.text,g=[0,0];if(d){let P=d.toString(),w=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ne,T=Pc(P)?w:0,F=n.get("text-anchor").evaluate(c,{},t.canonical),E=sl(r,c,t.canonical);if(!E){let A=n.get("text-radial-offset").evaluate(c,{},t.canonical);A?g=al(F,[A*ne,xa]):g=n.get("text-offset").evaluate(c,{},t.canonical).map(z=>z*ne)}let _=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),I=n.get("symbol-placement"),k=I==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ne:0,V=()=>{t.bucket.allowVerticalPlacement&&hn(P)&&(h.vertical=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,"left",T,g,2,!0,I,y,f))};if(!s&&E){let A=new Set;if(_==="auto")for(let O=0;O<E.values.length;O+=2)A.add(Nf(E.values[O]));else A.add(_);let z=!1;for(let O of A)if(!h.horizontal[O])if(z)h.horizontal[O]=h.horizontal[0];else{let N=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,"center",O,T,g,1,!1,I,y,f);N&&(h.horizontal[O]=N,z=N.positionedLines.length===1)}V()}else{_==="auto"&&(_=Nf(F));let A=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,_,T,g,1,!1,I,y,f);A&&(h.horizontal[_]=A),V(),hn(P)&&s&&l&&(h.vertical=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,_,T,g,2,!1,I,y,f))}}let b,x=!1;if(c.icon&&c.icon.name){let P=t.imageMap[c.icon.name];P&&(b=yf(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),x=!!P.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&fe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=Gf(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||b)&&Db(t.bucket,c,h,b,t.imageMap,o,y,m,g,x,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Nf(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Db(t,e,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(e,{});p===void 0&&(p=a);let f=t.layers[0].layout,y=f.get("icon-offset").evaluate(e,{},c),m=Gf(r.horizontal),h=24,d=a/h,g=t.tilePixelRatio*d,b=t.tilePixelRatio*p/h,x=t.tilePixelRatio*s,v=t.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*t.tilePixelRatio,w=bf(f,e,c,t.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,F=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",E=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",_=f.get("symbol-placement"),I=v/2,k=f.get("icon-text-fit"),V;n&&k!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(V=Qs(n,r.vertical,k,f.get("icon-text-fit-padding"),y,d)),m&&(n=Qs(n,m,k,f.get("icon-text-fit-padding"),y,d)));let A=(z,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||Bb(t,O,z,r,n,i,V,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[P,P,P,P],F,l,x,w,E,y,e,o,u,c,a)};if(_==="line")for(let z of Bf(e.geometry,0,0,8192,8192)){let O=Df(z,v,T,r.vertical||m,n,h,b,t.overscaling,8192);for(let N of O){let K=m;(!K||!zb(t,K.text,I,N))&&A(z,N)}}else if(_==="line-center"){for(let z of e.geometry)if(z.length>1){let O=Lf(z,T,r.vertical||m,n,h,b);O&&A(z,O)}}else if(e.type==="Polygon")for(let z of Tr(e.geometry,0)){let O=Of(z,16);A(z[0],new rt(O.x,O.y,0))}else if(e.type==="LineString")for(let z of e.geometry)A(z,new rt(z[0].x,z[0].y,0));else if(e.type==="Point")for(let z of e.geometry)for(let O of z)A([O],new rt(O.x,O.y,0))}function Vb(t,e){let r=t.length,n=e==null?void 0:e.values;if((n==null?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){let o=ol[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function Uf(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=Rf(e,r,s,i,o,a,n,t.allowVerticalPlacement),d=t.textSizeData,g=null;d.kind==="source"?(g=[Ct*i.layout.get("text-size").evaluate(a,{})],g[0]>tt&&fe("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Vr,\'. Reduce your "text-size".\'))):d.kind==="composite"&&(g=[Ct*y.compositeTextSizes[0].evaluate(a,{},m),Ct*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>tt||g[1]>tt)&&fe("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Vr,\'. Reduce your "text-size".\'))),t.addSymbols(t.text,h,g,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return h.length*4}function Gf(t){for(let e in t)return t[e];return null}function Bb(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F){let E=t.addToLineVertexArray(e,r),_,I,k,V,A=0,z=0,O=0,N=0,K=-1,xe=-1,X={},le=(0,ll.default)("");if(t.allowVerticalPlacement&&n.vertical){let ve=s.layout.get("text-rotate").evaluate(v,{},T)+90,Ve=n.vertical;k=new or(l,e,u,c,p,Ve,f,y,m,ve),a&&(V=new or(l,e,u,c,p,a,d,g,m,ve))}if(i){let Ie=s.layout.get("icon-rotate").evaluate(v,{}),ve=s.layout.get("icon-text-fit")!=="none",Ve=nl(i,Ie,w,ve),$r=a?nl(a,Ie,w,ve):void 0;I=new or(l,e,u,c,p,i,d,g,!1,Ie),A=Ve.length*4;let Vl=t.iconSizeData,Lt=null;Vl.kind==="source"?(Lt=[Ct*s.layout.get("icon-size").evaluate(v,{})],Lt[0]>tt&&fe("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Vr,\'. Reduce your "icon-size".\'))):Vl.kind==="composite"&&(Lt=[Ct*P.compositeIconSizes[0].evaluate(v,{},T),Ct*P.compositeIconSizes[1].evaluate(v,{},T)],(Lt[0]>tt||Lt[1]>tt)&&fe("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Vr,\'. Reduce your "icon-size".\'))),t.addSymbols(t.icon,Ve,Lt,x,b,v,0,e,E.lineStartIndex,E.lineLength,-1,T),K=t.icon.placedSymbolArray.length-1,$r&&(z=$r.length*4,t.addSymbols(t.icon,$r,Lt,x,b,v,2,e,E.lineStartIndex,E.lineLength,-1,T),xe=t.icon.placedSymbolArray.length-1)}let ce=Object.keys(n.horizontal);for(let Ie of ce){let ve=n.horizontal[Ie];if(!_){le=(0,ll.default)(ve.text);let $r=s.layout.get("text-rotate").evaluate(v,{},T);_=new or(l,e,u,c,p,ve,f,y,m,$r)}let Ve=ve.positionedLines.length===1;if(O+=Uf(t,e,ve,o,s,m,v,h,E,n.vertical?1:3,Ve?ce:[Ie],X,K,P,T),Ve)break}n.vertical&&(N+=Uf(t,e,n.vertical,o,s,m,v,h,E,2,["vertical"],X,xe,P,T));let pe=_?_.boxStartIndex:t.collisionBoxArray.length,_e=_?_.boxEndIndex:t.collisionBoxArray.length,be=k?k.boxStartIndex:t.collisionBoxArray.length,Ai=k?k.boxEndIndex:t.collisionBoxArray.length,Da=I?I.boxStartIndex:t.collisionBoxArray.length,Va=I?I.boxEndIndex:t.collisionBoxArray.length,Ur=V?V.boxStartIndex:t.collisionBoxArray.length,_i=V?V.boxEndIndex:t.collisionBoxArray.length,Me=-1,Ft=(Ie,ve)=>Ie&&Ie.circleDiameter?Math.max(Ie.circleDiameter,ve):ve;Me=Ft(_,Me),Me=Ft(k,Me),Me=Ft(I,Me),Me=Ft(V,Me);let Ii=Me>-1?1:0;Ii&&(Me*=F/ne),t.glyphOffsetArray.length>=He.MAX_GLYPHS&&fe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let Ba=sl(s,v,T),[za,Ra]=Vb(t.textAnchorOffsets,Ba);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,K,xe,le,pe,_e,be,Ai,Da,Va,Ur,_i,u,O,N,A,z,Ii,0,f,Me,za,Ra)}function zb(t,e,r,n){let i=t.compareText;if(!(e in i))i[e]=[];else{let o=i[e];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[e].push(n),!1}var ba=1,fi=class{constructor(e){let r={},n=[];for(let s in e){let l=e[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*ba,h:p.bitmap.height+2*ba};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=ti(n),a=new er({width:i||1,height:o||1});for(let s in e){let l=e[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;er.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ba,y:p.y+ba},c.bitmap)}}this.image=a,this.positions=r}};C("GlyphAtlas",fi);function jf(t,e,r){e=Math.pow(2,r)-e-1;var n=qf(t*256,e*256,r),i=qf((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function qf(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var Wf=Z(he(),1);var ul=63710088e-1,yi=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(r,")"));if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(Hl(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return ul*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new t(Number("lng"in e?e.lng:e.lon),Number(e.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>]")}};var Jf=2*Math.PI*ul;function Zf(t){return Jf*Math.cos(t*Math.PI/180)}function Rb(t){return(180+t)/360}function Ob(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Nb(t,e){return t/Zf(e)}function Ub(t){return t*360-180}function cl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function $b(t,e){return t*Zf(cl(e))}function Gb(t){return 1/Math.cos(t*Math.PI/180)}var va=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=yi.convert(e);return new t(Rb(n.lng),Ob(n.lat),Nb(r,n.lat))}toLngLat(){return new yi(Ub(this.x),cl(this.y))}toAltitude(){return $b(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Jf*Gb(cl(this.y))}};var Pa=class{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," 0<=z<=25 "));this.z=e,this.x=r,this.y=n,this.key=mi(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){let i=jf(this.x,this.y,this.z),o=qb(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){let r=Math.pow(2,this.z);return new Wf.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},pl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=mi(e,r.z,r.z,r.x,r.y)}},hi=class t{constructor(e,r,n,i,o){if(e<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(n));this.overscaledZ=e,this.wrap=r,this.canonical=new Pa(n,+i,+o),this.key=mi(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-e;return e>this.canonical.z?mi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):mi(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new t(r,this.wrap,r,n,i),new t(r,this.wrap,r,n+1,i),new t(r,this.wrap,r,n,i+1),new t(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new pl(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new va(e.x-this.wrap,e.y))}};function mi(t,e,r,n,i){t*=2,t<0&&(t=t*-1-1);let o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}function qb(t,e,r){let n="",i;for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}C("CanonicalTileID",Pa);C("OverscaledTileID",hi,{omit:["posMatrix"]});var Sa=class{constructor(e){this.tileID=new hi(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}async parse(e,r,n,i){this.status="parsing",this.data=e,this.collisionBoxArray=new Ln;let o=new Br(Object.keys(e.layers).sort()),a=new ui(this.tileID,this.promoteId);a.bucketLayerIDs=[];let s={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},u=r.familiesBySource[this.source];for(let P in u){let w=e.layers[P];if(!w)continue;w.version===1&&fe(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(P,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let T=o.encode(P),F=[];for(let E=0;E<w.length;E++){let _=w.feature(E),I=a.getId(_,P);F.push({feature:_,id:I,index:E,sourceLayerIndex:T})}for(let E of u[P]){let _=E[0];if(_.source!==this.source&&fe("layer.source = ".concat(_.source," does not equal this.source = ").concat(this.source)),_.minzoom&&this.zoom<Math.floor(_.minzoom)||_.maxzoom&&this.zoom>=_.maxzoom||_.visibility==="none")continue;fl(E,this.zoom,n),(s[_.id]=_.createBucket({index:a.bucketLayerIDs.length,layers:E,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source})).populate(F,l,this.tileID.canonical),a.bucketLayerIDs.push(E.map(k=>k.id))}}let c=jr(l.glyphDependencies,P=>Object.keys(P).map(Number));this.inFlightDependencies.forEach(P=>P==null?void 0:P.abort()),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(c).length){let P=new AbortController;this.inFlightDependencies.push(P),p=i.sendAsync({type:"GG",data:{stacks:c,source:this.source,tileID:this.tileID,type:"glyphs"}},P)}let f=Object.keys(l.iconDependencies),y=Promise.resolve({});if(f.length){let P=new AbortController;this.inFlightDependencies.push(P),y=i.sendAsync({type:"GI",data:{icons:f,source:this.source,tileID:this.tileID,type:"icons"}},P)}let m=Object.keys(l.patternDependencies),h=Promise.resolve({});if(m.length){let P=new AbortController;this.inFlightDependencies.push(P),h=i.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"patterns"}},P)}let[d,g,b]=await Promise.all([p,y,h]),x=new fi(d),v=new ri(g,b);for(let P in s){let w=s[P];w instanceof He?(fl(w.layers,this.zoom,n),$f({bucket:w,glyphMap:d,glyphPositions:x.positions,imageMap:g,imagePositions:v.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):w.hasPattern&&(w instanceof ir||w instanceof rr||w instanceof nr)&&(fl(w.layers,this.zoom,n),w.addFeatures(l,this.tileID.canonical,v.patternPositions))}return this.status="done",{buckets:Object.values(s).filter(P=>!P.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:v,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?x.positions:null}}};function fl(t,e,r){let n=new q(e);for(let i of t)i.recalculate(n,r)}var jb=60,HI=1e3/jb;var Or=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};var Nr=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await hc(e.request,r);try{return{vectorTile:new Hf.default.VectorTile(new Xf.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s="Unable to parse the tile at ".concat(e.request.url,", ");throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+="got error: ".concat(i.messge),new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new Or(e.request):!1,i=new Sa(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return Pe({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=Pe({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var di=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){fe(\'"\'.concat(n,\'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".\'));return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new de({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};C("DEMData",di);var wa=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=Jr(i)?new de({width:u,height:c},await eu(i,-1,-1,u,c)):i,f=new di(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var wy=Z(ey(),1);var yl=Z(he(),1),ty=Z(Tt(),1);var Jb=ty.default.VectorTileFeature.prototype.toGeoJSON,ml=class{constructor(e){this._feature=e,this.extent=8192,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(this._feature.type===1){let e=[];for(let r of this._feature.geometry)e.push([new yl.default(r[0],r[1])]);return e}else{let e=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new yl.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Jb.call(this,e,r,n)}},_a=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new ml(this._features[e])}};var Ay=Z(sy(),1);var ly=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],gl=1,xi=8,vi=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==gl)throw new Error("Got v".concat(i," data when expected v").concat(gl,"."));let o=ly[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=ly.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,xi,e),this.coords=new this.ArrayType(this.data,xi+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(xi+a+s+l),this.ids=new this.IndexArrayType(this.data,xi,e),this.coords=new this.ArrayType(this.data,xi+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(gl<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return bl(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let d=f;d<=p;d++){let g=a[2*d],b=a[2*d+1];g>=e&&g<=n&&b>=r&&b<=i&&u.push(o[d])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let d=f;d<=p;d++)uy(o[2*d],o[2*d+1],e,r)<=u&&l.push(i[d]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];uy(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function bl(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;cy(t,e,a,n,i,o),bl(t,e,r,n,a-1,1-o),bl(t,e,r,a+1,i,1-o)}function cy(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));cy(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(bi(t,e,n,r),e[2*i+o]>a&&bi(t,e,n,i);s<l;){for(bi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?bi(t,e,n,l):(l++,bi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function bi(t,e,r,n){xl(t,r,n),xl(e,2*r,2*n),xl(e,2*r+1,2*n+1)}function xl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function uy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var n0={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},py=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),ar=2,Et=3,vl=4,Mt=5,yy=6,Pi=class{constructor(e){this.options=Object.assign(Object.create(n0),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o="prepare ".concat(e.length," points");r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=py(Ta(c)),y=py(Ca(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(Ta(n),Ca(a),Ta(o),Ca(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Mt]>1?fy(u,f,this.clusterProps):this.points[u[f+Et]])}return c}getChildren(e){let r=this._getOriginId(e),n=this._getOriginZoom(e),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+vl]===e&&p.push(a[y+Mt]>1?fy(a,y,this.clusterProps):this.points[a[y+Et]])}if(p.length===0)throw new Error(i);return p}getLeaves(e,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,e,r,n,0),i}getTile(e,r,n){let i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(e,l.cluster_id,n,i,o):o<i?o++:e.push(s),e.length===n)break}return o}_createTree(e){let r=new vi(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,i,o,a){for(let s of e){let l=s*this.stride,u=r[l+Mt]>1,c,p,f;if(u)c=my(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Et]];c=h.properties;let[d,g]=h.geometry.coordinates;p=Ta(d),f=Ca(g)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Et]:m=this.points[r[l+Et]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=e.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+ar]<=r)continue;l[p+ar]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Mt],d=h;for(let g of m){let b=g*c;l[b+ar]>r&&(d+=l[b+Mt])}if(d>h&&d>=a){let g=f*h,b=y*h,x,v=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let T=w*c;if(l[T+ar]<=r)continue;l[T+ar]=r;let F=l[T+Mt];g+=l[T]*F,b+=l[T+1]*F,l[T+vl]=P,o&&(x||(x=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(x)),o(x,this._map(l,T)))}l[p+vl]=P,u.push(g/d,b/d,1/0,P,-1,d),o&&u.push(v)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(d>1)for(let g of m){let b=g*c;if(!(l[b+ar]<=r)){l[b+ar]=r;for(let x=0;x<c;x++)u.push(l[b+x])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Mt]>1){let a=this.clusterProps[e[r+yy]];return n?Object.assign({},a):a}let i=this.points[e[r+Et]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function fy(t,e,r){return{type:"Feature",id:t[e+Et],properties:my(t,e,r),geometry:{type:"Point",coordinates:[i0(t[e]),o0(t[e+1])]}}}function my(t,e,r){let n=t[e+Mt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=t[e+yy],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Et],point_count:n,point_count_abbreviated:i})}function Ta(t){return t/360+.5}function Ca(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function i0(t){return(t-.5)*360}function o0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Si(t,e,r,n){for(var i=n,o=r-e>>1,a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1],f=e+3;f<r;f+=3){var y=a0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&Si(t,e,s,n),t[s+2]=i,r-s>3&&Si(t,s,r,n))}function a0(t,e,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=t-r,s=e-n,a*a+s*s}function ft(t,e,r,n){var i={id:typeof t>"u"?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return s0(i),i}function s0(t){var e=t.geometry,r=t.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Pl(t,e);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<e.length;n++)Pl(t,e[n]);else if(r==="MultiPolygon")for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)Pl(t,e[n][i])}function Pl(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Al(t,e){var r=[];if(t.type==="FeatureCollection")for(var n=0;n<t.features.length;n++)ka(r,t.features[n],e,n);else t.type==="Feature"?ka(r,t,e):ka(r,{geometry:t},e);return r}function ka(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")hy(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)hy(i[u],s);else if(o==="LineString")wl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],wl(i[u],s,a,!1),t.push(ft(l,"LineString",s,e.properties));return}else Sl(i,s,a,!1);else if(o==="Polygon")Sl(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];Sl(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<e.geometry.geometries.length;u++)ka(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(ft(l,o,s,e.properties))}}function hy(t,e){e.push(dy(t[0])),e.push(gy(t[1])),e.push(0)}function wl(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var l=dy(t[s][0]),u=gy(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,Si(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Sl(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];wl(t[i],o,r,n),e.push(o)}}function dy(t){return t/360+.5}function gy(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function qe(t,e,r,n,i,o,a,s){if(r/=e,n/=e,o>=r&&a<n)return t;if(a<r||o>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var h=[];if(f==="Point"||f==="MultiPoint")l0(p,h,r,n,i);else if(f==="LineString")by(p,h,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")_l(p,h,r,n,i,!1);else if(f==="Polygon")_l(p,h,r,n,i,!0);else if(f==="MultiPolygon")for(var d=0;d<p.length;d++){var g=[];_l(p[d],g,r,n,i,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&f==="LineString"){for(d=0;d<h.length;d++)l.push(ft(c.id,f,h[d],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(ft(c.id,f,h,c.tags))}}return l.length?l:null}function l0(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function by(t,e,r,n,i,o,a){for(var s=xy(t),l=i===0?u0:c0,u=t.start,c,p,f=0;f<t.length-3;f+=3){var y=t[f],m=t[f+1],h=t[f+2],d=t[f+3],g=t[f+4],b=i===0?y:m,x=i===0?d:g,v=!1;a&&(c=Math.sqrt(Math.pow(y-d,2)+Math.pow(m-g,2))),b<r?x>r&&(p=l(s,y,m,d,g,r),a&&(s.start=u+c*p)):b>n?x<n&&(p=l(s,y,m,d,g,n),a&&(s.start=u+c*p)):Il(s,y,m,h),x<r&&b>=r&&(p=l(s,y,m,d,g,r),v=!0),x>n&&b<=n&&(p=l(s,y,m,d,g,n),v=!0),!o&&v&&(a&&(s.end=u+c*p),e.push(s),s=xy(t)),a&&(u+=c)}var P=t.length-3;y=t[P],m=t[P+1],h=t[P+2],b=i===0?y:m,b>=r&&b<=n&&Il(s,y,m,h),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Il(s,s[0],s[1],s[2]),s.length&&e.push(s)}function xy(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function _l(t,e,r,n,i,o){for(var a=0;a<t.length;a++)by(t[a],e,r,n,i,o,!1)}function Il(t,e,r,n){t.push(e),t.push(r),t.push(n)}function u0(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function c0(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function Cl(t,e){var r=e.buffer/e.extent,n=t,i=qe(t,1,-1-r,r,0,-1,2,e),o=qe(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=qe(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=vy(i,1).concat(n)),o&&(n=n.concat(vy(o,-1)))),n}function vy(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Tl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Tl(i.geometry[s],e))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(Tl(i.geometry[s][u],e));a.push(l)}r.push(ft(i.id,o,a,i.tags))}return r}function Tl(t,e){var r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function Ma(t,e){if(t.transformed)return t;var r=1<<t.z,n=t.x,i=t.y,o,a,s;for(o=0;o<t.features.length;o++){var l=t.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(Py(u[a],u[a+1],e,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(Py(u[a][s],u[a][s+1],e,r,n,i));l.geometry.push(p)}}return t.transformed=!0,t}function Py(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function Ml(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,p0(a,t[s],o,i);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function p0(t,e,r,n){var i=e.geometry,o=e.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")kl(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)kl(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)kl(a,u[s],t,r,!0,s===0)}if(a.length){var c=e.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in e.tags)c[p]=e.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};e.id!==null&&(f.id=e.id),t.features.push(f)}}function kl(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}for(var s=[],l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&f0(s,o),t.push(s)}function f0(t,e){for(var r=0,n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}function Fl(t,e){return new Ea(t,e)}function Ea(t,e){e=this.options=y0(Object.create(this.options),e);var r=e.debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=Al(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=Cl(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}Ea.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};Ea.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,p=El(e,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=Ml(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+e;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=t,i){if(e===l.maxZoom||e===i)continue;var m=1<<i-e;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,t.length!==0){u>1&&console.time("clipping");var h=.5*l.buffer/l.extent,d=.5-h,g=.5+h,b=1+h,x,v,P,w,T,F;x=v=P=w=null,T=qe(t,c,r-h,r+g,0,f.minX,f.maxX,l),F=qe(t,c,r+d,r+b,0,f.minX,f.maxX,l),t=null,T&&(x=qe(T,c,n-h,n+g,1,f.minY,f.maxY,l),v=qe(T,c,n+d,n+b,1,f.minY,f.maxY,l),T=null),F&&(P=qe(F,c,n-h,n+g,1,f.minY,f.maxY,l),w=qe(F,c,n+d,n+b,1,f.minY,f.maxY,l),F=null),u>1&&console.timeEnd("clipping"),s.push(x||[],e+1,r*2,n*2),s.push(v||[],e+1,r*2,n*2+1),s.push(P||[],e+1,r*2+1,n*2),s.push(w||[],e+1,r*2+1,n*2+1)}}};Ea.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t;e=(e%a+a)%a;var s=El(t,e,r);if(this.tiles[s])return Ma(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l=t,u=e,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[El(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Ma(this.tiles[s],i):null)};function El(t,e,r){return((1<<t)*r+e)*32+t}function y0(t,e){for(var r in e)t[r]=e[r];return t}function wi(t,e){return e?t.properties[e]:t.id}function Ll(t,e){if(t==null)return!0;if(t.type==="Feature")return wi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=wi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function Dl(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(wi(t,e),t);else for(let n of t.features)r.set(wi(n,e),n);return r}function Sy(t,e,r){var n,i,o,a;if(e.removeAll&&t.clear(),e.remove)for(let s of e.remove)t.delete(s);if(e.add)for(let s of e.add){let l=wi(s,r);l!=null&&t.set(l,s)}if(e.update)for(let s of e.update){let l=t.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l=Dt({},l),t.set(s.id,l),c&&(l.properties=Dt({},l.properties))),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}var Fa=class extends Nr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new _a(o.features),s=(0,Ay.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){var i;(i=this._pendingRequest)==null||i.abort();let n=r&&r.request&&r.request.collectResourceTiming?new Or(r.request):!1;this._pendingRequest=new AbortController;try{let o=await this.loadGeoJSON(r,this._pendingRequest);if(delete this._pendingRequest,typeof o!="object")throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if((0,wy.default)(o,!0),r.filter){let s=jt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(s.result==="error")throw new Error(s.value.map(u=>"".concat(u.key,": ").concat(u.message)).join(", "));o={type:"FeatureCollection",features:o.features.filter(u=>s.value.evaluate({zoom:0},u))}}this._geoJSONIndex=r.cluster?new Pi(m0(r)).load(o.features):Fl(o,r.geojsonVtOptions),this.loaded={};let a={};if(n){let s=n.finish();s&&(a.resourceTiming={},a.resourceTiming[r.source]=JSON.parse(JSON.stringify(s)))}return a}catch(o){if(delete this._pendingRequest,ac(o))return{abandoned:!0};throw o}}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await mc(r.request,n);return this._dataUpdateable=Ll(o.data,i)?Dl(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=Ll(o,i)?Dl(o,i):void 0,o}catch(o){throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."))}if(!r.dataDiff)throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if(!this._dataUpdateable)throw new Error("Cannot update existing geojson data in ".concat(r.source));return Sy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function m0({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=jt(u),p=jt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var La=class{constructor(e){this.self=e,this.actor=new io(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(\'Worker source with name "\'.concat(r,\'" already registered.\'));this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=lc,this.self.removeProtocol=uc,this.self.registerRTLTextPlugin=r=>{if(ye.isParsed())throw new Error("RTL text plugin already registered.");ye.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){if(ye.isParsed())return ye.getState();if(r.pluginStatus!=="loading")return ye.setState(r),r;let n=r.pluginURL;if(this.self.importScripts(n),ye.isParsed()){let o={pluginStatus:"loaded",pluginURL:n};return ye.setState(o),o}throw ye.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(n))}_getAvailableImages(e){let r=this.availableImages[e];return r||(r=[]),r}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new ya),r}_getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Nr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new Fa(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}return this.workerSources[e][r][n]}_getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new wa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new La(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var iA=()=>Xe.WORKER_URL?Xe.WORKER_URL:URL.createObjectURL(new Blob([lg],{type:"text/javascript"}));function ug(){return new Worker(iA())}var Al="maplibre_preloaded_worker_pool",Lr=class r{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<r.workerCount;)this.workers.push(ug());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Al]}numActive(){return Object.keys(this.active).length}},nA=Math.floor(J.hardwareConcurrency/2);Lr.workerCount=gf(globalThis)?Math.max(Math.min(nA,3),1):1;var qo;function jo(){return qo||(qo=new Lr),qo}function oA(){jo().acquire(Al)}function aA(){let r=qo;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(Al),qo=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()"))}var Zo=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let i=this.workerPool.acquire(t);for(let n=0;n<i.length;n++){let o=i[n],a=new Tl(o,t);a.name="Worker ".concat(n),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let i=[];for(let n of this.actors)i.push(n.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}},Ml;function Il(){return Ml||(Ml=new Zo(jo(),ja),Ml.registerMessageHandler("GR",(r,e,t)=>Si(e,t))),Ml}m();function sA(r,e){let t=G.create();return G.translate(t,t,[1,1,0]),G.scale(t,t,[r.width*.5,r.height*.5,1]),G.multiply(t,t,r.calculatePosMatrix(e.toUnwrapped()))}function lA(r,e,t){if(r)for(let i of r){let n=e[i];if(n&&n.source===t&&n.type==="fill-extrusion")return!0}else for(let i in e){let n=e[i];if(n.source===t&&n.type==="fill-extrusion")return!0}return!1}function cg(r,e,t,i,n,o){let a=lA(n&&n.layers,e,r.id),s=o.maxPitchScaleFactor(),l=r.tilesIn(i,s,a);l.sort(fg);let u=[];for(let p of l)u.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,t,r._state,p.queryGeometry,p.cameraQueryGeometry,p.scale,n,o,s,sA(r.transform,p.tileID))});let c=uA(u);for(let p in c)c[p].forEach(h=>{let f=h.feature,d=r.getFeatureState(f.layer["source-layer"],f.id);f.source=f.layer.source,f.layer["source-layer"]&&(f.sourceLayer=f.layer["source-layer"]),f.state=d});return c}function pg(r,e,t,i,n,o,a){let s={},l=o.queryRenderedSymbols(i),u=[];for(let c of Object.keys(l).map(Number))u.push(a[c]);u.sort(fg);for(let c of u){let p=c.featureIndex.lookupSymbolFeatures(l[c.bucketInstanceId],e,c.bucketIndex,c.sourceLayerIndex,n.filter,n.layers,n.availableImages,r);for(let h in p){let f=s[h]=s[h]||[],d=p[h];d.sort((y,g)=>{let x=c.featureSortOrder;if(x){let v=x.indexOf(y.featureIndex);return x.indexOf(g.featureIndex)-v}else return g.featureIndex-y.featureIndex});for(let y of d)f.push(y)}}for(let c in s)s[c].forEach(p=>{let h=p.feature,f=r[c],y=t[f.source].getFeatureState(h.layer["source-layer"],h.id);h.source=h.layer.source,h.layer["source-layer"]&&(h.sourceLayer=h.layer["source-layer"]),h.state=y});return s}function hg(r,e){let t=r.getRenderableIds().map(o=>r.getTileByID(o)),i=[],n={};for(let o=0;o<t.length;o++){let a=t[o],s=a.tileID.canonical.key;n[s]||(n[s]=!0,a.querySourceFeatures(i,e))}return i}function fg(r,e){let t=r.tileID,i=e.tileID;return t.overscaledZ-i.overscaledZ||t.canonical.y-i.canonical.y||t.wrap-i.wrap||t.canonical.x-i.canonical.x}function uA(r){let e={},t={};for(let i of r){let n=i.queryResults,o=i.wrappedTileID,a=t[o]=t[o]||{};for(let s in n){let l=n[s],u=a[s]=a[s]||{},c=e[s]=e[s]||[];for(let p of l)u[p.featureIndex]||(u[p.featureIndex]=!0,c.push(p))}}return e}m();m();m();m();async function Cl(r,e,t){let i=r;if(r.url?i=(await dr(e.transformRequest(r.url,"Source"),t)).data:await J.frameAsync(t),!i)return null;let n=mr(O(i,r),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in i&&i.vector_layers&&(n.vectorLayerIds=i.vector_layers.map(o=>o.id)),n}m();m();m();var Ho=63710088e-1,re=class r{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(t,")"));if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new r(Yt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let t=Math.PI/180,i=this.lat*t,n=e.lat*t,o=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return Ho*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof r)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new r(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new r(Number("lng"in e?e.lng:e.lon),Number(e.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>]")}};var lt=class r{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof re?new re(e.lng,e.lat):re.convert(e),this}setSouthWest(e){return this._sw=e instanceof re?new re(e.lng,e.lat):re.convert(e),this}extend(e){let t=this._sw,i=this._ne,n,o;if(e instanceof re)n=e,o=e;else if(e instanceof r){if(n=e._sw,o=e._ne,!n||!o)return this}else{if(Array.isArray(e))if(e.length===4||e.every(Array.isArray)){let a=e;return this.extend(r.convert(a))}else{let a=e;return this.extend(re.convert(a))}else if(e&&("lng"in e||"lon"in e)&&"lat"in e)return this.extend(re.convert(e));return this}return!t&&!i?(this._sw=new re(n.lng,n.lat),this._ne=new re(o.lng,o.lat)):(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)),this}getCenter(){return new re((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 re(this.getWest(),this.getNorth())}getSouthEast(){return new re(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:i}=re.convert(e),n=this._sw.lat<=i&&i<=this._ne.lat,o=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=t&&t>=this._ne.lng),n&&o}static convert(e){return e instanceof r||!e?e:new r(e)}static fromLngLat(e,t=0){let n=360*t/40075017,o=n/Math.cos(Math.PI/180*e.lat);return new r(new re(e.lng-o,e.lat-n),new re(e.lng+o,e.lat+n))}};m();var mg=2*Math.PI*Ho;function dg(r){return mg*Math.cos(r*Math.PI/180)}function Dr(r){return(180+r)/360}function zr(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function El(r,e){return r/dg(e)}function cA(r){return r*360-180}function $p(r){let e=180-r*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function pA(r,e){return r*dg($p(e))}function hA(r){return 1/Math.cos(r*Math.PI/180)}var ze=class r{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){let i=re.convert(e);return new r(Dr(i.lng),zr(i.lat),El(t,i.lat))}toLngLat(){return new re(cA(this.x),$p(this.y))}toAltitude(){return pA(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/mg*hA($p(this.y))}};var sn=class{constructor(e,t,i){this.bounds=lt.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),i={minX:Math.floor(Dr(this.bounds.getWest())*t),minY:Math.floor(zr(this.bounds.getNorth())*t),maxX:Math.ceil(Dr(this.bounds.getEast())*t),maxY:Math.ceil(zr(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}};var $o=class extends me{constructor(e,t,i,n){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,O(this,mr(t,["url","scheme","tileSize","promoteId"])),this._options=O({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await Cl(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(O(this,e),e.bounds&&(this.tileBounds=new sn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new Z(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return O({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.request.collectResourceTiming=this._collectResourceTiming;let n="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),n="LT";else if(e.state==="loading")return new Promise((o,a)=>{e.reloadPromise={resolve:o,reject:a}});e.abortController=new AbortController;try{let o=await e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,o)}catch(o){if(delete e.abortController,e.aborted)return;if(o&&o.status!==404)throw o;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}};m();var mi=class extends me{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=O({type:"raster"},t),O(this,mr(t,["url","scheme","tileSize"]))}async load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await Cl(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(O(this,e),e.bounds&&(this.tileBounds=new sn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new Z(e))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return O({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let i=await at.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let n=this.map.painter.context,o=n.gl,a=i.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new _e(n,a,o.RGBA,{useMipmap:!0}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};m();m();m();function gg(r,e,t){e=Math.pow(2,t)-e-1;var i=yg(r*256,e*256,t),n=yg((r+1)*256,(e+1)*256,t);return i[0]+","+i[1]+","+n[0]+","+n[1]}function yg(r,e,t){var i=2*Math.PI*6378137/256/Math.pow(2,t),n=r*i-2*Math.PI*6378137/2,o=e*i-2*Math.PI*6378137/2;return[n,o]}var xg=oe(ye(),1);var ln=class{constructor(e,t,i){if(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))throw new Error("x=".concat(t,", y=").concat(i,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," 0<=z<=25 "));this.z=e,this.x=t,this.y=i,this.key=Wo(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){let n=gg(this.x,this.y,this.z),o=fA(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,n)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new xg.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},un=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Wo(e,t.z,t.z,t.x,t.y)}},Ke=class r{constructor(e,t,i,n,o){if(e<i)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(i));this.overscaledZ=e,this.wrap=t,this.canonical=new ln(i,+n,+o),this.key=Wo(t,e,i,n,o)}clone(){return new r(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let t=this.canonical.z-e;return e>this.canonical.z?new r(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new r(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let i=this.canonical.z-e;return e>this.canonical.z?Wo(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Wo(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new r(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new r(t,this.wrap,t,i,n),new r(t,this.wrap,t,i+1,n),new r(t,this.wrap,t,i,n+1),new r(t,this.wrap,t,i+1,n+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new r(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new r(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new un(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new ze(e.x-this.wrap,e.y))}};function Wo(r,e,t,i,n){r*=2,r<0&&(r=r*-1-1);let o=1<<t;return(o*o*r+o*n+i).toString(36)+t.toString(36)+e.toString(36)}function fA(r,e,t){let i="",n;for(let o=r;o>0;o--)n=1<<o-1,i+=(e&n?1:0)+(t&n?2:0);return i}U("CanonicalTileID",ln);U("OverscaledTileID",Ke,{omit:["posMatrix"]});m();var Wp=class{constructor(e,t,i,n=1,o=1,a=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){ke('"'.concat(i,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=t.height;let l=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,t){let i=new Uint8Array(this.data.buffer),n=this._idx(e,t)*4;return this.unpack(i[n],i[n+1],i[n+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new we({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,o=t*this.dim+this.dim,a=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:n=o-1;break;case 1:o=n+1;break}switch(i){case-1:a=s-1;break;case 1:s=a+1;break}let l=-t*this.dim,u=-i*this.dim;for(let c=a;c<s;c++)for(let p=n;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};U("DEMData",Wp);var Xo=class extends mi{constructor(e,t,i,n){super(e,t,i,n),this.type="raster-dem",this.maxzoom=22,this._options=O({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=await at.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(n&&n.data){let o=n.data;this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let s=pt(o)&&Oa()?o:await this.readImageNow(o),l={type:this.type,uid:e.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let u=await e.actor.sendAsync({type:"LDT",data:l});e.dem=u,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}}async readImageNow(e){if(typeof VideoFrame<"u"&&Tc()){let t=e.width+2,i=e.height+2;try{return new we({width:t,height:i},await _f(e,-1,-1,t,i))}catch(n){}}return J.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,i=Math.pow(2,t.z),n=(t.x-1+i)%i,o=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+i)%i,s=t.x+1===i?e.wrap+1:e.wrap,l={};return l[new Ke(e.overscaledZ,o,t.z,n,t.y).key]={backfilled:!1},l[new Ke(e.overscaledZ,s,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(l[new Ke(e.overscaledZ,o,t.z,n,t.y-1).key]={backfilled:!1},l[new Ke(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},l[new Ke(e.overscaledZ,s,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(l[new Ke(e.overscaledZ,o,t.z,n,t.y+1).key]={backfilled:!1},l[new Ke(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},l[new Ke(e.overscaledZ,s,t.z,a,t.y+1).key]={backfilled:!1}),l}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};m();var Ko=class extends me{constructor(e,t,i,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(n),this._data=t.data,this._options=O({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;let o=8192/this.tileSize;this.workerOptions=O({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*o,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*o,extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:(t.clusterRadius||50)*o,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(e){let t=O({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(J.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new z("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new z("dataabort",{dataType:"source"}));return}let n=null;i.resourceTiming&&i.resourceTiming[this.id]&&(n=i.resourceTiming[this.id].slice(0));let o={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&O(o,{resourceTiming:n}),this.fire(new z("data",Gr(Bt({},o),{sourceDataType:"metadata"}))),this.fire(new z("data",Gr(Bt({},o),{sourceDataType:"content"})))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new z("dataabort",{dataType:"source"}));return}this.fire(new Z(i))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let n=await this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return O({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};m();m();m();var Fr=be([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var Et=class extends me{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t}async load(e){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await at.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new Z(t))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(ze.fromLngLat);this.tileID=mA(t),this.minzoom=this.maxzoom=this.tileID.z;let i=t.map(n=>this.tileID.getTilePoint(n)._round());return this._boundsArray=new Zi,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,8192,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,8192),this._boundsArray.emplaceBack(i[2].x,i[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Fr.members)),this.boundsSegments||(this.boundsSegments=fe.simpleSegment(0,0,4,2)),this.texture||(this.texture=new _e(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}};function mA(r){let e=1/0,t=1/0,i=-1/0,n=-1/0;for(let c of r)e=Math.min(e,c.x),t=Math.min(t,c.y),i=Math.max(i,c.x),n=Math.max(n,c.y);let o=i-e,a=n-t,s=Math.max(o,a),l=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),u=Math.pow(2,l);return new ln(l,Math.floor((e+i)/2*u),Math.floor((t+n)/2*u))}var Jo=class extends Et{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await Pf(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new Z(t))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new Z(new R("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Fr.members)),this.boundsSegments||(this.boundsSegments=fe.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new _e(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}};m();var Yo=class extends Et{constructor(e,t,i,n){super(e,t,i,n),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(o=>!Array.isArray(o)||o.length!==2||o.some(a=>typeof a!="number")))&&this.fire(new Z(new R("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Z(new R("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new Z(new R("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new Z(new R("sources.".concat(e),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 Z(new R("sources.".concat(e),null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(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 Z(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Fr.members)),this.boundsSegments||(this.boundsSegments=fe.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new _e(t,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,n=!0)}n&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};var bg={},_g=(r,e,t,i)=>{let n=vg(e.type),o=new n(r,e,t,i);if(o.id!==r)throw new Error("Expected Source id to be ".concat(r," instead of ").concat(o.id));return o},vg=r=>{switch(r){case"geojson":return Ko;case"image":return Et;case"raster":return mi;case"raster-dem":return Xo;case"vector":return $o;case"video":return Jo;case"canvas":return Yo}return bg[r]},dA=(r,e)=>{bg[r]=e},yA=async(r,e)=>{if(vg(r))throw new Error('A source type called "'.concat(r,'" already exists.'));dA(r,e)};m();m();function wg(r,e){let t={};if(!e)return t;for(let i of r){let n=i.layerIds.map(o=>e.getLayer(o)).filter(Boolean);if(n.length!==0){i.layers=n,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(o=>n.filter(a=>a.id===o)[0]));for(let o of n)t[o.id]=i}}return t}m();m();var kl=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};var Tg=oe(ko(),1),Ag=oe(Gp(),1);m();var cn=class{constructor(e,t,i,n,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=n,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}};var Xp=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ti(8192,16,0),this.grid3D=new ti(8192,16,0),this.featureIndexArray=new yo,this.promoteId=t}insert(e,t,i,n,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,o);let l=a?this.grid3D:this.grid;for(let u=0;u<t.length;u++){let c=t[u],p=[1/0,1/0,-1/0,-1/0];for(let h=0;h<c.length;h++){let f=c[h];p[0]=Math.min(p[0],f.x),p[1]=Math.min(p[1],f.y),p[2]=Math.max(p[2],f.x),p[3]=Math.max(p[3],f.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Tg.default.VectorTile(new Ag.default(this.rawTileData)).layers,this.sourceLayerCoder=new kl(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,n){this.loadVTLayers();let o=e.params||{},a=8192/e.tileSize/e.scale,s=jn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=Pg(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),h=Pg(e.cameraQueryGeometry),f=this.grid3D.query(h.minX-u,h.minY-u,h.maxX+u,h.maxY+u,(g,x,v,b)=>nd(e.cameraQueryGeometry,g-u,x-u,v+u,b+u));for(let g of f)p.push(g);p.sort(gA);let d={},y;for(let g=0;g<p.length;g++){let x=p[g];if(x===y)continue;y=x;let v=this.featureIndexArray.get(x),b=null;this.loadMatchingFeature(d,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,t,i,n,(w,S,P)=>(b||(b=mt(w)),S.queryIntersectsFeature(l,w,P,b,this.z,e.transform,a,e.pixelPosMatrix)))}return d}loadMatchingFeature(e,t,i,n,o,a,s,l,u,c,p){let h=this.bucketLayerIDs[t];if(a&&!hf(a,h))return;let f=this.sourceLayerCoder.decode(i),y=this.vtLayers[f].feature(n);if(o.needGeometry){let x=dt(y,!0);if(!o.filter(new de(this.tileID.overscaledZ),x,this.tileID.canonical))return}else if(!o.filter(new de(this.tileID.overscaledZ),y))return;let g=this.getId(y,f);for(let x=0;x<h.length;x++){let v=h[x];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let w={};g&&c&&(w=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=O({},u[v]);S.paint=Sg(S.paint,b.paint,y,w,s),S.layout=Sg(S.layout,b.layout,y,w,s);let P=!p||p(y,b,w);if(!P)continue;let k=new cn(y,this.z,this.x,this.y,g);k.layer=S;let I=e[v];I===void 0&&(I=e[v]=[]),I.push({featureIndex:n,feature:k,intersectionZ:P})}}lookupSymbolFeatures(e,t,i,n,o,a,s,l){let u={};this.loadVTLayers();let c=jn(o);for(let p of e)this.loadMatchingFeature(u,i,n,p,c,a,s,l,t);return u}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){let i=e.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[n],typeof i=="boolean"&&(i=Number(i))}return i}};U("FeatureIndex",Xp,{omit:["rawTileData","sourceLayerCoder"]});function Sg(r,e,t,i,n){return wn(r,(o,a)=>{let s=e instanceof wr?e.get(a):null;return s&&s.evaluate?s.evaluate(t,i,n):s})}function Pg(r){let e=1/0,t=1/0,i=-1/0,n=-1/0;for(let o of r)e=Math.min(e,o.x),t=Math.min(t,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{minX:e,minY:t,maxX:i,maxY:n}}function gA(r,e){return e-r}m();m();var Qo="RTLPluginLoaded";var Jp=class extends me{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=Il()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,i=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=J.resolveURL(t),!this.url)throw new Error("requested url ".concat(t," is invalid"));if(this.status==="unavailable")if(i)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new z(Qo))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},Kp=null;function Rr(){return Kp||(Kp=new Jp),Kp}var xA=3e4,pn=class{constructor(e,t){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=Ua(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new uo;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=wg(e.buckets,t.style),this.hasSymbolBuckets=!1;for(let n in this.buckets){let o=this.buckets[n];if(o instanceof Rt)if(this.hasSymbolBuckets=!0,i)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let n in this.buckets){let o=this.buckets[n];if(o instanceof Rt&&o.hasRTLText){this.hasRTLText=!0,Rr().lazyLoad();break}}this.queryPadding=0;for(let n in this.buckets){let o=this.buckets[n];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(n).queryRadius(o))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let n=this.buckets[i];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new _e(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new _e(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,o,a,s,l,u,c){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:s,queryPadding:this.queryPadding*u},e,t,i)}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;let n=i.loadVTLayers(),o=t&&t.sourceLayer?t.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;let s=jn(t&&t.filter),{z:l,x:u,y:c}=this.tileID.canonical,p={z:l,x:u,y:c};for(let h=0;h<a.length;h++){let f=a.feature(h);if(s.needGeometry){let g=dt(f,!0);if(!s.filter(new de(this.tileID.overscaledZ),g,this.tileID.canonical))continue}else if(!s.filter(new de(this.tileID.overscaledZ),f))continue;let d=i.getId(f,o),y=new cn(f,l,u,c,d);y.tile=p,e.push(y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let i=yf(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),n=!1;if(this.expirationTime>i)n=!1;else if(!t)n=!0;else if(this.expirationTime<t)n=!0;else{let o=this.expirationTime-t;o?this.expirationTime=i+Math.max(o,xA):n=!0}n?(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(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let i=this.latestFeatureIndex.loadVTLayers();for(let n in this.buckets){if(!t.style.hasLayer(n))continue;let o=this.buckets[n],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=i[a],l=e[a];if(!s||!l||Object.keys(l).length===0)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let u=t&&t.style&&t.style.getLayer(n);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<J.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=J.now()+e}setDependencies(e,t){let i={};for(let n of t)i[n]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let n=this.dependencies[i];if(n){for(let o of t)if(n[o])return!0}}return!1}};m();var Ll=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){let n=e.wrapped().key;this.data[n]===void 0&&(this.data[n]=[]);let o={value:t,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout(()=>{this.remove(e,o)},i)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,n=t===void 0?0:this.data[i].indexOf(t),o=this.data[i][n];return this.data[i].splice(n,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let i in this.data)for(let n of this.data[i])e(n.value)||t.push(n);for(let i of t)this.remove(i.value.tileID,i)}};var Yp=oe(ye(),1);m();var Dl=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){let n=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},O(this.stateChanges[e][n],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let o in this.state[e])o!==n&&(this.deletedStates[e][o]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][n]===null){this.deletedStates[e][n]={};for(let a in this.state[e][n])i[a]||(this.deletedStates[e][n][a]=null)}else for(let a in i)this.deletedStates[e]&&this.deletedStates[e][n]&&this.deletedStates[e][n][a]===null&&delete this.deletedStates[e][n][a]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let o=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&t!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][i]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o]){this.deletedStates[e][o]={};for(i in this.stateChanges[e][o])this.deletedStates[e][o][i]=null}else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),n=this.state[e]||{},o=this.stateChanges[e]||{},a=O({},n[i],o[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let i={};for(let n in this.stateChanges){this.state[n]=this.state[n]||{};let o={};for(let a in this.stateChanges[n])this.state[n][a]||(this.state[n][a]={}),O(this.state[n][a],this.stateChanges[n][a]),o[a]=this.state[n][a];i[n]=o}for(let n in this.deletedStates){this.state[n]=this.state[n]||{};let o={};if(this.deletedStates[n]===null)for(let a in this.state[n])o[a]={},this.state[n][a]={};else for(let a in this.deletedStates[n]){if(this.deletedStates[n][a]===null)this.state[n][a]={};else for(let l of Object.keys(this.deletedStates[n][a]))delete this.state[n][a][l];o[a]=this.state[n][a]}i[n]=i[n]||{},O(i[n],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let n in e)e[n].setFeatureState(i,t)}};var lr=class r extends me{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=_g(e,t,i,this),this._tiles={},this._cache=new Ll(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Dl,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if(t.state!=="loaded"&&t.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,i){try{await this._source.loadTile(e),this._tileLoaded(e,t,i)}catch(n){e.state="errored",n.status!==404?this._source.fire(new Z(n,{tile:e})):this.update(this.transform,this.terrain)}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new z("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Mg).map(e=>e.key)}getRenderableIds(e){let t=[];for(let i in this._tiles)this._isIdRenderable(i,e)&&t.push(this._tiles[i]);return e?t.sort((i,n)=>{let o=i.tileID,a=n.tileID,s=new Yp.default(o.canonical.x,o.canonical.y)._rotate(this.transform.angle),l=new Yp.default(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return o.overscaledZ-a.overscaledZ||l.y-s.y||l.x-s.x}).map(i=>i.tileID.key):t.map(i=>i.tileID).sort(Mg).map(i=>i.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return t?this._isIdRenderable(t.tileID.key):!1}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}async _reloadTile(e,t){let i=this._tiles[e];i&&(i.state!=="loading"&&(i.state=t),await this._loadTile(i,e,t))}_tileLoaded(e,t,i){e.timeAdded=J.now(),i==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new z("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let n=0;n<t.length;n++){let o=t[n];if(e.neighboringTiles&&e.neighboringTiles[o]){let a=this.getTileByID(o);i(e,a),i(a,e)}}function i(n,o){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let a=o.tileID.canonical.x-n.tileID.canonical.x,s=o.tileID.canonical.y-n.tileID.canonical.y,l=Math.pow(2,n.tileID.canonical.z),u=o.tileID.key;a===0&&s===0||Math.abs(s)>1||(Math.abs(a)>1&&(Math.abs(a+l)===1?a+=l:Math.abs(a-l)===1&&(a-=l)),!(!o.dem||!n.dem)&&(n.dem.backfillBorder(o.dem,a,s),n.neighboringTiles&&n.neighboringTiles[u]&&(n.neighboringTiles[u].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(let o in this._tiles){let a=this._tiles[o];if(n[o]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>i)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let u=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[u.key],a&&a.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>t;)if(l=l.scaledTo(l.overscaledZ-1),e[l.key]){n[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){let n=e.scaledTo(i),o=this._getLoadedTile(n);if(o)return o}}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let t=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,n=t*i,o=this._maxTileCacheZoomLevels===null?Xe.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(n*o),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(s)}handleWrapJump(e){let t=this._prevLng===void 0?e:this._prevLng,n=(e-t)/360,o=Math.round(n);if(this._prevLng=e,o){let a={};for(let s in this._tiles){let l=this._tiles[s];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+o),a[l.tileID.key]=l}this._tiles=a;for(let s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(let s in this._tiles){let l=this._tiles[s];this._setTileReloadTimer(s,l)}}}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(c=>new Ke(c.canonical.z,c.wrap,c.canonical.z,c.canonical.x,c.canonical.y)):(i=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t}),this._source.hasTile&&(i=i.filter(c=>this._source.hasTile(c))));let n=e.coveringZoomLevel(this._source),o=Math.max(n-r.maxOverzooming,this._source.minzoom),a=Math.max(n+r.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let c={};for(let p of i)if(p.canonical.z>this._source.minzoom){let h=p.scaledTo(p.canonical.z-1);c[h.key]=h;let f=p.scaledTo(Math.max(this._source.minzoom,Math.min(p.canonical.z,5)));c[f.key]=f}i=i.concat(Object.values(c))}let s=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new z("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(i,n);if(Ig(this._source.type)){let c={},p={},h=Object.keys(l),f=J.now();for(let d of h){let y=l[d],g=this._tiles[d];if(!g||g.fadeEndTime!==0&&g.fadeEndTime<=f)continue;let x=this.findLoadedParent(y,o);x&&(this._addTile(x.tileID),c[x.tileID.key]=x.tileID),p[d]=y}this._retainLoadedChildren(p,n,a,l);for(let d in c)l[d]||(this._coveredTiles[d]=!0,l[d]=c[d]);if(t){let d={},y={};for(let g of i)this._tiles[g.key].hasData()?d[g.key]=g:y[g.key]=g;for(let g in y){let x=y[g].children(this._source.maxzoom);this._tiles[x[0].key]&&this._tiles[x[1].key]&&this._tiles[x[2].key]&&this._tiles[x[3].key]&&(d[x[0].key]=l[x[0].key]=x[0],d[x[1].key]=l[x[1].key]=x[1],d[x[2].key]=l[x[2].key]=x[2],d[x[3].key]=l[x[3].key]=x[3],delete y[g])}for(let g in y){let x=this.findLoadedParent(y[g],this._source.minzoom);if(x){d[x.tileID.key]=l[x.tileID.key]=x.tileID;for(let v in d)d[v].isChildOf(x.tileID)&&delete d[v]}}for(let g in this._tiles)d[g]||(this._coveredTiles[g]=!0)}}for(let c in l)this._tiles[c].clearFadeHold();let u=uf(this._tiles,l);for(let c of u){let p=this._tiles[c];p.hasSymbolBuckets&&!p.holdingForFade()?p.setHoldDuration(this.map._fadeDuration):(!p.hasSymbolBuckets||p.symbolFadeFinished())&&this._removeTile(c)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let i={},n={},o=Math.max(t-r.maxOverzooming,this._source.minzoom),a=Math.max(t+r.maxUnderzooming,this._source.minzoom),s={};for(let l of e){let u=this._addTile(l);i[l.key]=l,!u.hasData()&&t<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,t,a,i);for(let l of e){let u=this._tiles[l.key];if(u.hasData())continue;if(t+1>this._source.maxzoom){let p=l.children(this._source.maxzoom)[0],h=this.getTile(p);if(h&&h.hasData()){i[p.key]=p;continue}}else{let p=l.children(this._source.maxzoom);if(i[p[0].key]&&i[p[1].key]&&i[p[2].key]&&i[p[3].key])continue}let c=u.wasRequested();for(let p=l.overscaledZ-1;p>=o;--p){let h=l.scaledTo(p);if(n[h.key])break;if(n[h.key]=!0,u=this.getTile(h),!u&&c&&(u=this._addTile(h)),u){let f=u.hasData();if((c||f)&&(i[h.key]=h),c=u.wasRequested(),f)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);let o=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(o),i)break;n=o}for(let o of t)this._loadedParentTiles[o]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));let i=t;return t||(t=new pn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state)),t.uses++,this._tiles[e.key]=t,i||this._source.fire(new z("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)&&(t.hasData()&&t.state!=="reloading"?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType==="source"&&t==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&t==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,i){let n=[],o=this.transform;if(!o)return n;let a=i?o.getCameraQueryGeometry(e):e,s=e.map(d=>o.pointCoordinate(d,this.terrain)),l=a.map(d=>o.pointCoordinate(d,this.terrain)),u=this.getIds(),c=1/0,p=1/0,h=-1/0,f=-1/0;for(let d of l)c=Math.min(c,d.x),p=Math.min(p,d.y),h=Math.max(h,d.x),f=Math.max(f,d.y);for(let d=0;d<u.length;d++){let y=this._tiles[u[d]];if(y.holdingForFade())continue;let g=y.tileID,x=Math.pow(2,o.zoom-y.tileID.overscaledZ),v=t*y.queryPadding*8192/y.tileSize/x,b=[g.getTilePoint(new ze(c,p)),g.getTilePoint(new ze(h,f))];if(b[0].x-v<8192&&b[0].y-v<8192&&b[1].x+v>=0&&b[1].y+v>=0){let w=s.map(P=>g.getTilePoint(P)),S=l.map(P=>g.getTilePoint(P));n.push({tile:y,tileID:g,queryGeometry:w,cameraQueryGeometry:S,scale:x})}}return n}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(i=>this._tiles[i].tileID);for(let i of t)i.posMatrix=this.transform.calculatePosMatrix(i.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Ig(this._source.type)){let e=J.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,i){e=e||"_geojsonTileLayer",this._state.updateState(e,t,i)}removeFeatureState(e,t,i){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,i)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,i){let n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}};lr.maxOverzooming=10;lr.maxUnderzooming=3;function Mg(r,e){let t=Math.abs(r.wrap*2)-+(r.wrap<0),i=Math.abs(e.wrap*2)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||i-t||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x}function Ig(r){return r==="raster"||r==="image"||r==="video"}m();m();m();var Zt=oe(ye(),1);m();var ur=oe(ye(),1);function Qp(r,e,t,i,n){let o=[];for(let a=0;a<r.length;a++){let s=r[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new ur.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ur.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<t&&p.y<t)&&(c.y<t?c=new ur.default(c.x+(p.x-c.x)*((t-c.y)/(p.y-c.y)),t)._round():p.y<t&&(p=new ur.default(c.x+(p.x-c.x)*((t-c.y)/(p.y-c.y)),t)._round()),!(c.x>=i&&p.x>=i)&&(c.x>=i?c=new ur.default(i,c.y+(p.y-c.y)*((i-c.x)/(p.x-c.x)))._round():p.x>=i&&(p=new ur.default(i,c.y+(p.y-c.y)*((i-c.x)/(p.x-c.x)))._round()),!(c.y>=n&&p.y>=n)&&(c.y>=n?c=new ur.default(c.x+(p.x-c.x)*((n-c.y)/(p.y-c.y)),n)._round():p.y>=n&&(p=new ur.default(c.x+(p.x-c.x)*((n-c.y)/(p.y-c.y)),n)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}m();var zl=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=Ae(e,0,1);let t=1,i=this._distances[t],n=e*this.paddedLength+this.padding;for(;i<n&&t<this._distances.length;)i=this._distances[++t];let o=t-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[t].mult(l))}};m();function Fl(r,e){let t=!0;return r==="always"||(r==="never"||e==="never")&&(t=!1),t}var ea=class{constructor(e,t,i){let n=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let a=0;a<this.xCellCount*this.yCellCount;a++)n.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,n,o){this._forEachCell(t,i,n,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}insertCircle(e,t,i,n){this._forEachCell(t-n,i-n,t+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(n)}_insertBoxCell(e,t,i,n,o,a){this.boxCells[o].push(a)}_insertCircleCell(e,t,i,n,o,a){this.circleCells[o].push(a)}_query(e,t,i,n,o,a,s){if(i<0||e>this.width||n<0||t>this.height)return[];let l=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(o)return[{key:null,x1:e,y1:t,x2:i,y2:n}];for(let u=0;u<this.boxKeys.length;u++)l.push({key:this.boxKeys[u],x1:this.bboxes[u*4],y1:this.bboxes[u*4+1],x2:this.bboxes[u*4+2],y2:this.bboxes[u*4+3]});for(let u=0;u<this.circleKeys.length;u++){let c=this.circles[u*3],p=this.circles[u*3+1],h=this.circles[u*3+2];l.push({key:this.circleKeys[u],x1:c-h,y1:p-h,x2:c+h,y2:p+h})}}else{let u={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,n,this._queryCell,l,u,s)}return l}query(e,t,i,n){return this._query(e,t,i,n,!1,null)}hitTest(e,t,i,n,o,a){return this._query(e,t,i,n,!0,o,a).length>0}hitTestCircle(e,t,i,n,o){let a=e-i,s=e+i,l=t-i,u=t+i;if(s<0||a>this.width||u<0||l>this.height)return!1;let c=[],p={hitTest:!0,overlapMode:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,u,this._queryCellCircle,c,p,o),c.length>0}_queryCell(e,t,i,n,o,a,s,l){let{seenUids:u,hitTest:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let d=this.bboxes;for(let y of h)if(!u.box[y]){u.box[y]=!0;let g=y*4,x=this.boxKeys[y];if(e<=d[g+2]&&t<=d[g+3]&&i>=d[g+0]&&n>=d[g+1]&&(!l||l(x))&&(!c||!Fl(p,x.overlapMode))&&(a.push({key:x,x1:d[g],y1:d[g+1],x2:d[g+2],y2:d[g+3]}),c))return!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let y of f)if(!u.circle[y]){u.circle[y]=!0;let g=y*3,x=this.circleKeys[y];if(this._circleAndRectCollide(d[g],d[g+1],d[g+2],e,t,i,n)&&(!l||l(x))&&(!c||!Fl(p,x.overlapMode))){let v=d[g],b=d[g+1],w=d[g+2];if(a.push({key:x,x1:v-w,y1:b-w,x2:v+w,y2:b+w}),c)return!0}}}return!1}_queryCellCircle(e,t,i,n,o,a,s,l){let{circle:u,seenUids:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let d=this.bboxes;for(let y of h)if(!c.box[y]){c.box[y]=!0;let g=y*4,x=this.boxKeys[y];if(this._circleAndRectCollide(u.x,u.y,u.radius,d[g+0],d[g+1],d[g+2],d[g+3])&&(!l||l(x))&&!Fl(p,x.overlapMode))return a.push(!0),!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let y of f)if(!c.circle[y]){c.circle[y]=!0;let g=y*3,x=this.circleKeys[y];if(this._circlesCollide(d[g],d[g+1],d[g+2],u.x,u.y,u.radius)&&(!l||l(x))&&!Fl(p,x.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,n,o,a,s,l){let u=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),p=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let f=u;f<=p;f++)for(let d=c;d<=h;d++){let y=this.xCellCount*d+f;if(o.call(this,e,t,i,n,y,a,s,l))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,o,a){let s=n-e,l=o-t,u=i+a;return u*u>s*s+l*l}_circleAndRectCollide(e,t,i,n,o,a,s){let l=(a-n)/2,u=Math.abs(e-(n+l));if(u>l+i)return!1;let c=(s-o)/2,p=Math.abs(t-(o+c));if(p>c+i)return!1;if(u<=l||p<=c)return!0;let h=u-l,f=p-c;return h*h+f*f<=i*i}};m();var hn=oe(ye(),1);function ta(r,e,t,i,n){let o=G.create();return e?(G.scale(o,o,[1/n,1/n,1]),t||G.rotateZ(o,o,i.angle)):G.multiply(o,i.labelPlaneMatrix,r),o}function Bl(r,e,t,i,n){if(e){let o=G.clone(r);return G.scale(o,o,[n,n,1]),t||G.rotateZ(o,o,-i.angle),o}else return i.glCoordMatrix}function xt(r,e,t){let i;t?(i=[r.x,r.y,t(r.x,r.y),1],Ge.transformMat4(i,i,e)):(i=[r.x,r.y,0,1],Ol(i,i,e));let n=i[3];return{point:new hn.default(i[0]/n,i[1]/n),signedDistanceFromCamera:n}}function ra(r,e){return .5+.5*(r/e)}function bA(r,e){let t=r[0]/r[3],i=r[1]/r[3];return t>=-e[0]&&t<=e[0]&&i>=-e[1]&&i<=e[1]}function kg(r,e,t,i,n,o,a,s,l,u){let c=i?r.textSizeData:r.iconSizeData,p=hi(c,t.transform.zoom),h=[256/t.width*2+1,256/t.height*2+1],f=i?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;f.clear();let d=r.lineVertexArray,y=i?r.text.placedSymbolArray:r.icon.placedSymbolArray,g=t.transform.width/t.transform.height,x=!1;for(let v=0;v<y.length;v++){let b=y.get(v);if(b.hidden||b.writingMode===2&&!x){di(b.numGlyphs,f);continue}x=!1;let w;if(u?(w=[b.anchorX,b.anchorY,u(b.anchorX,b.anchorY),1],Ge.transformMat4(w,w,e)):(w=[b.anchorX,b.anchorY,0,1],Ol(w,w,e)),!bA(w,h)){di(b.numGlyphs,f);continue}let S=w[3],P=ra(t.transform.cameraToCenterDistance,S),k=rn(c,p,b),I=a?k/P:k*P,C=new hn.default(b.anchorX,b.anchorY),M=xt(C,n,u).point,F={projections:{},offsets:{}},D=Eg(b,I,!1,s,e,n,o,r.glyphOffsetArray,d,f,M,C,F,g,l,u);x=D.useVertical,(D.notEnoughRoom||x||D.needsFlipping&&Eg(b,I,!0,s,e,n,o,r.glyphOffsetArray,d,f,M,C,F,g,l,u).notEnoughRoom)&&di(b.numGlyphs,f)}i?r.text.dynamicLayoutVertexBuffer.updateData(f):r.icon.dynamicLayoutVertexBuffer.updateData(f)}function rh(r,e,t,i,n,o,a,s,l,u,c,p,h){let f=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,y=s.lineStartIndex+s.lineLength,g=e.getoffsetX(s.glyphStartIndex),x=e.getoffsetX(f-1),v=Rl(r*g,t,i,n,o,a,s.segment,d,y,l,u,c,p,h);if(!v)return null;let b=Rl(r*x,t,i,n,o,a,s.segment,d,y,l,u,c,p,h);return b?{first:v,last:b}:null}function Cg(r,e,t,i){if(r===1){let n=Math.abs(t.y-e.y),o=Math.abs(t.x-e.x)*i;if(n>o)return{useVertical:!0}}return(r===2?e.y<t.y:e.x>t.x)?{needsFlipping:!0}:null}function Eg(r,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y){let g=e/24,x=r.lineOffsetX*g,v=r.lineOffsetY*g,b;if(r.numGlyphs>1){let w=r.glyphStartIndex+r.numGlyphs,S=r.lineStartIndex,P=r.lineStartIndex+r.lineLength,k=rh(g,s,x,v,t,c,p,r,l,o,h,d,y);if(!k)return{notEnoughRoom:!0};let I=xt(k.first.point,a,y).point,C=xt(k.last.point,a,y).point;if(i&&!t){let M=Cg(r.writingMode,I,C,f);if(M)return M}b=[k.first];for(let M=r.glyphStartIndex+1;M<w-1;M++){let F=Rl(g*s.getoffsetX(M),x,v,t,c,p,r.segment,S,P,l,o,h,d,y);if(F==null)return{notEnoughRoom:!0};b.push(F)}b.push(k.last)}else{if(i&&!t){let S=xt(p,n,y).point,P=r.lineStartIndex+r.segment+1,k=new hn.default(l.getx(P),l.gety(P)),I=xt(k,n,y),C=I.signedDistanceFromCamera>0?I.point:Lg(p,k,S,1,n,y),M=Cg(r.writingMode,S,C,f);if(M)return M}let w=Rl(g*s.getoffsetX(r.glyphStartIndex),x,v,t,c,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,l,o,h,d,y);if(!w)return{notEnoughRoom:!0};b=[w]}for(let w of b)fi(u,w.point,w.angle);return{}}function Lg(r,e,t,i,n,o){let a=xt(r.add(r.sub(e)._unit()),n,o).point,s=t.sub(a);return t.add(s._mult(i/s.mag()))}function eh(r,e){let{projectionCache:t,lineVertexArray:i,labelPlaneMatrix:n,tileAnchorPoint:o,distanceFromAnchor:a,getElevation:s,previousVertex:l,direction:u,absOffsetX:c}=e;if(t.projections[r])return t.projections[r];let p=new hn.default(i.getx(r),i.gety(r)),h=xt(p,n,s);if(h.signedDistanceFromCamera>0)return t.projections[r]=h.point,h.point;let f=r-u,d=a===0?o:new hn.default(i.getx(f),i.gety(f));return Lg(d,p,l,c-a+1,n,s)}function th(r,e,t){return r._unit()._perp()._mult(e*t)}function _A(r,e,t,i,n,o,a,s){let{projectionCache:l,direction:u}=s;if(l.offsets[r])return l.offsets[r];let c=t.add(e);if(r+u<i||r+u>=n)return l.offsets[r]=c,c;let p=eh(r+u,s),h=th(p.sub(t),a,u),f=t.add(h),d=p.add(h);return l.offsets[r]=ff(o,c,f,d)||c,l.offsets[r]}function Rl(r,e,t,i,n,o,a,s,l,u,c,p,h,f){let d=i?r-e:r+e,y=d>0?1:-1,g=0;i&&(y*=-1,g=Math.PI),y<0&&(g+=Math.PI);let x=y>0?s+a:s+a+1,v=n,b=n,w,S,P=0,k=0,I=Math.abs(d),C=[],M;for(;P+k<=I;){if(x+=y,x<s||x>=l)return null;P+=k,b=v,S=w;let T={projectionCache:p,lineVertexArray:u,labelPlaneMatrix:c,tileAnchorPoint:o,distanceFromAnchor:P,getElevation:f,previousVertex:b,direction:y,absOffsetX:I};if(v=eh(x,T),t===0)C.push(b),M=v.sub(b);else{let N,X=v.sub(b);if(X.mag()===0){let ie=eh(x+y,T);N=th(ie.sub(v),t,y)}else N=th(X,t,y);S||(S=b.add(N)),w=_A(x,N,v,s,l,S,t,T),C.push(S),M=w.sub(S)}k=M.mag()}let F=(I-P)/k,D=M._mult(F)._add(S||b),E=g+Math.atan2(v.y-b.y,v.x-b.x);return C.push(D),{point:D,angle:h?E:0,path:C}}var vA=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function di(r,e){for(let t=0;t<r;t++){let i=e.length;e.resize(i+4),e.float32.set(vA,i*3)}}function Ol(r,e,t){let i=e[0],n=e[1];return r[0]=t[0]*i+t[4]*n+t[12],r[1]=t[1]*i+t[5]*n+t[13],r[3]=t[3]*i+t[7]*n+t[15],r}var We=100,Vl=class{constructor(e,t=new ea(e.width+2*We,e.height+2*We,25),i=new ea(e.width+2*We,e.height+2*We,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+We,this.screenBottomBoundary=e.height+We,this.gridRightBoundary=e.width+2*We,this.gridBottomBoundary=e.height+2*We,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,n,o,a){let s=this.projectAndGetPerspectiveRatio(n,e.anchorPointX,e.anchorPointY,a),l=i*s.perspectiveRatio,u=e.x1*l+s.point.x,c=e.y1*l+s.point.y,p=e.x2*l+s.point.x,h=e.y2*l+s.point.y;return!this.isInsideGrid(u,c,p,h)||t!=="always"&&this.grid.hitTest(u,c,p,h,t,o)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[u,c,p,h],offscreen:this.isOffscreen(u,c,p,h)}}placeCollisionCircles(e,t,i,n,o,a,s,l,u,c,p,h,f,d){let y=[],g=new Zt.default(t.anchorX,t.anchorY),x=xt(g,a,d),v=ra(this.transform.cameraToCenterDistance,x.signedDistanceFromCamera),w=(c?o/v:o*v)/kr,S=xt(g,s,d).point,P={projections:{},offsets:{}},k=t.lineOffsetX*w,I=t.lineOffsetY*w,C=rh(w,n,k,I,!1,S,g,t,i,s,P,!1,d),M=!1,F=!1,D=!0;if(C){let E=h*.5*v+f,T=new Zt.default(-We,-We),N=new Zt.default(this.screenRightBoundary,this.screenBottomBoundary),X=new zl,ie=C.first,K=C.last,$=[];for(let ue=ie.path.length-1;ue>=1;ue--)$.push(ie.path[ue]);for(let ue=1;ue<K.path.length;ue++)$.push(K.path[ue]);let Je=E*2.5;if(l){let ue=$.map(Te=>xt(Te,l,d));ue.some(Te=>Te.signedDistanceFromCamera<=0)?$=[]:$=ue.map(Te=>Te.point)}let Oe=[];if($.length>0){let ue=$[0].clone(),Te=$[0].clone();for(let Ye=1;Ye<$.length;Ye++)ue.x=Math.min(ue.x,$[Ye].x),ue.y=Math.min(ue.y,$[Ye].y),Te.x=Math.max(Te.x,$[Ye].x),Te.y=Math.max(Te.y,$[Ye].y);ue.x>=T.x&&Te.x<=N.x&&ue.y>=T.y&&Te.y<=N.y?Oe=[$]:Te.x<T.x||ue.x>N.x||Te.y<T.y||ue.y>N.y?Oe=[]:Oe=Qp([$],T.x,T.y,N.x,N.y)}for(let ue of Oe){X.reset(ue,E*.25);let Te=0;X.length<=.5*E?Te=1:Te=Math.ceil(X.paddedLength/Je)+1;for(let Ye=0;Ye<Te;Ye++){let hr=Ye/Math.max(Te-1,1),fr=X.lerp(hr),Lt=fr.x+We,$t=fr.y+We;y.push(Lt,$t,E,0);let Vr=Lt-E,Wt=$t-E,Xt=Lt+E,Qe=$t+E;if(D=D&&this.isOffscreen(Vr,Wt,Xt,Qe),F=F||this.isInsideGrid(Vr,Wt,Xt,Qe),e!=="always"&&this.grid.hitTestCircle(Lt,$t,E,e,p)&&(M=!0,!u))return{circles:[],offscreen:!1,collisionDetected:M}}}}return{circles:!u&&M||!F||v<this.perspectiveRatioCutoff?[]:y,offscreen:D,collisionDetected:M}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=1/0,n=1/0,o=-1/0,a=-1/0;for(let c of e){let p=new Zt.default(c.x+We,c.y+We);i=Math.min(i,p.x),n=Math.min(n,p.y),o=Math.max(o,p.x),a=Math.max(a,p.y),t.push(p)}let s=this.grid.query(i,n,o,a).concat(this.ignoredGrid.query(i,n,o,a)),l={},u={};for(let c of s){let p=c.key;if(l[p.bucketInstanceId]===void 0&&(l[p.bucketInstanceId]={}),l[p.bucketInstanceId][p.featureIndex])continue;let h=[new Zt.default(c.x1,c.y1),new Zt.default(c.x2,c.y1),new Zt.default(c.x2,c.y2),new Zt.default(c.x1,c.y2)];Zs(t,h)&&(l[p.bucketInstanceId][p.featureIndex]=!0,u[p.bucketInstanceId]===void 0&&(u[p.bucketInstanceId]=[]),u[p.bucketInstanceId].push(p.featureIndex))}return u}insertCollisionBox(e,t,i,n,o,a){let s=i?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:o,collisionGroupID:a,overlapMode:t};s.insert(l,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,n,o,a){let s=i?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:o,collisionGroupID:a,overlapMode:t};for(let u=0;u<e.length;u+=4)s.insertCircle(l,e[u],e[u+1],e[u+2])}projectAndGetPerspectiveRatio(e,t,i,n){let o;return n?(o=[t,i,n(t,i),1],Ge.transformMat4(o,o,e)):(o=[t,i,0,1],Ol(o,o,e)),{point:new Zt.default((o[0]/o[3]+1)/2*this.transform.width+We,(-o[1]/o[3]+1)/2*this.transform.height+We),perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o[3])}}isOffscreen(e,t,i,n){return i<We||e>=this.screenRightBoundary||n<We||t>this.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e<this.gridRightBoundary&&n>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=G.identity([]);return G.translate(e,e,[-We,-We,0]),e}};m();m();var Dg=oe(ye(),1);var ia=class r extends Dg.default{constructor(e,t,i,n){super(e,t),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new r(this.x,this.y,this.angle,this.segment)}};U("Anchor",ia);m();m();m();var wA=oe(ye(),1);m();var SA=oe(ye(),1);m();var PA=oe(zg(),1),TA=oe(ye(),1);var MA=oe(_p(),1);m();var na=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(na||{});var AA=Number.POSITIVE_INFINITY;function Fg(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}m();function He(r,e,t){return e*(8192/(r.tileSize*Math.pow(2,t-r.tileID.overscaledZ)))}var jl=oe(ye(),1);var Nl=class{constructor(e,t,i,n){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=n&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},yi=class{constructor(e,t,i,n,o){this.text=new Nl(e?e.text:null,t,i,o),this.icon=new Nl(e?e.icon:null,t,n,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},Gl=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},sh=class{constructor(){this.invProjMatrix=G.create(),this.viewportMatrix=G.create(),this.circles=[]}},lh=class{constructor(e,t,i,n,o){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=o}},uh=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:i=>i.collisionGroupID===t}}return this.collisionGroups[e]}};function Rg(r,e,t,i,n){let{horizontalAlign:o,verticalAlign:a}=cl(r),s=-(o-.5)*e,l=-(a-.5)*t;return new jl.default(s+i[0]*n,l+i[1]*n)}function ah(r,e,t,i,n,o){let{x1:a,x2:s,y1:l,y2:u,anchorPointX:c,anchorPointY:p}=r,h=new jl.default(e,t);return i&&h._rotate(n?o:-o),{x1:a+h.x,y1:l+h.y,x2:s+h.x,y2:u+h.y,anchorPointX:c,anchorPointY:p}}var ql=class{constructor(e,t,i,n,o){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Vl(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new uh(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,t,i,n){let o=i.getBucket(t),a=i.latestFeatureIndex;if(!o||!a||t.id!==o.layerIds[0])return;let s=i.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),c=i.tileSize/8192,p=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),h=l.get("text-pitch-alignment")==="map",f=l.get("text-rotation-alignment")==="map",d=He(i,1,this.transform.zoom),y=ta(p,h,f,this.transform,d),g=null;if(h){let v=Bl(p,h,f,this.transform,d);g=G.multiply([],this.transform.labelPlaneMatrix,v)}this.retainedQueryData[o.bucketInstanceId]=new lh(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);let x={bucket:o,layout:l,posMatrix:p,textLabelPlaneMatrix:y,labelToScreenMatrix:g,scale:u,textPixelRatio:c,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:hi(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(let v of o.sortKeyRanges){let{sortKey:b,symbolInstanceStart:w,symbolInstanceEnd:S}=v;e.push({sortKey:b,symbolInstanceStart:w,symbolInstanceEnd:S,parameters:x})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:x})}attemptAnchorPlacement(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g){let x=na[e.textAnchor],v=[e.textOffset0,e.textOffset1],b=Rg(x,i,n,v,o),w=this.collisionIndex.placeCollisionBox(ah(t,b.x,b.y,a,s,this.transform.angle),p,l,u,c.predicate,g);if(!(y&&this.collisionIndex.placeCollisionBox(ah(y,b.x,b.y,a,s,this.transform.angle),p,l,u,c.predicate,g).box.length===0)&&w.box.length>0){let S;if(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(S=this.prevPlacement.variableOffsets[h.crossTileID].anchor),h.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[h.crossTileID]={textOffset:v,width:i,height:n,anchor:x,textBoxScale:o,prevAnchor:S},this.markUsedJustification(f,x,h,d),f.allowVerticalPlacement&&(this.markUsedOrientation(f,d,h),this.placedOrientations[h.crossTileID]=d),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(e,t,i){let{bucket:n,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:p,partiallyEvaluatedTextSize:h,collisionGroup:f}=e.parameters,d=o.get("text-optional"),y=o.get("icon-optional"),g=nn(o,"text-overlap","text-allow-overlap"),x=g==="always",v=nn(o,"icon-overlap","icon-allow-overlap"),b=v==="always",w=o.get("text-rotation-alignment")==="map",S=o.get("text-pitch-alignment")==="map",P=o.get("icon-text-fit")!=="none",k=o.get("symbol-z-order")==="viewport-y",I=x&&(b||!n.hasIconData()||y),C=b&&(x||!n.hasTextData()||d);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);let M=this.retainedQueryData[n.bucketInstanceId].tileID,F=this.terrain?(E,T)=>this.terrain.getElevation(M,E,T):null,D=(E,T)=>{var Wt,Xt;if(t[E.crossTileID])return;if(c){this.placements[E.crossTileID]=new Gl(!1,!1,!1);return}let N=!1,X=!1,ie=!0,K=null,$={box:null,offscreen:null},Je={box:null,offscreen:null},Oe=null,ue=null,Te=null,Ye=0,hr=0,fr=0;T.textFeatureIndex?Ye=T.textFeatureIndex:E.useRuntimeCollisionCircles&&(Ye=E.featureIndex),T.verticalTextFeatureIndex&&(hr=T.verticalTextFeatureIndex);let Lt=T.textBox;if(Lt){let Qe=je=>{let ut=1;if(n.allowVerticalPlacement&&!je&&this.prevPlacement){let Kt=this.prevPlacement.placedOrientations[E.crossTileID];Kt&&(this.placedOrientations[E.crossTileID]=Kt,ut=Kt,this.markUsedOrientation(n,ut,E))}return ut},nt=(je,ut)=>{if(n.allowVerticalPlacement&&E.numVerticalGlyphVertices>0&&T.verticalTextBox){for(let Kt of n.writingModes)if(Kt===2?($=ut(),Je=$):$=je(),$&&$.box&&$.box.length)break}else $=je()},et=E.textAnchorOffsetStartIndex,Ur=E.textAnchorOffsetEndIndex;if(Ur===et){let je=(Nr,Ra)=>{let tt=this.collisionIndex.placeCollisionBox(Nr,g,u,a,f.predicate,F);return tt&&tt.box&&tt.box.length&&(this.markUsedOrientation(n,Ra,E),this.placedOrientations[E.crossTileID]=Ra),tt};nt(()=>je(Lt,1),()=>{let Nr=T.verticalTextBox;return n.allowVerticalPlacement&&E.numVerticalGlyphVertices>0&&Nr?je(Nr,2):{box:null,offscreen:null}}),Qe($&&$.box&&$.box.length)}else{let je=na[(Xt=(Wt=this.prevPlacement)==null?void 0:Wt.variableOffsets[E.crossTileID])==null?void 0:Xt.anchor],ut=(tt,vc,C_)=>{let E_=tt.x2-tt.x1,k_=tt.y2-tt.y1,L_=E.textBoxScale,D_=P&&v==="never"?vc:null,_i={box:[],offscreen:!1},Xh=g==="never"?1:2,Kh="never";je&&Xh++;for(let Jh=0;Jh<Xh;Jh++){for(let wc=et;wc<Ur;wc++){let Yh=n.textAnchorOffsets.get(wc);if(je&&Yh.textAnchor!==je)continue;let Sc=this.attemptAnchorPlacement(Yh,tt,E_,k_,L_,w,S,u,a,f,Kh,E,n,C_,D_,F);if(Sc&&(_i=Sc.placedGlyphBoxes,_i&&_i.box&&_i.box.length))return N=!0,K=Sc.shift,_i}je?je=null:Kh=g}return _i};nt(()=>ut(Lt,T.iconBox,1),()=>{let tt=T.verticalTextBox,vc=$&&$.box&&$.box.length;return n.allowVerticalPlacement&&!vc&&E.numVerticalGlyphVertices>0&&tt?ut(tt,T.verticalIconBox,2):{box:null,offscreen:null}}),$&&(N=$.box,ie=$.offscreen);let Ra=Qe($&&$.box);if(!N&&this.prevPlacement){let tt=this.prevPlacement.variableOffsets[E.crossTileID];tt&&(this.variableOffsets[E.crossTileID]=tt,this.markUsedJustification(n,tt.anchor,E,Ra))}}}if(Oe=$,N=Oe&&Oe.box&&Oe.box.length>0,ie=Oe&&Oe.offscreen,E.useRuntimeCollisionCircles){let Qe=n.text.placedSymbolArray.get(E.centerJustifiedTextSymbolIndex),nt=rn(n.textSizeData,h,Qe),et=o.get("text-padding"),Ur=E.collisionCircleDiameter;ue=this.collisionIndex.placeCollisionCircles(g,Qe,n.lineVertexArray,n.glyphOffsetArray,nt,a,s,l,i,S,f.predicate,Ur,et,F),ue.circles.length&&ue.collisionDetected&&!i&&ke("Collisions detected, but collision boxes are not shown"),N=x||ue.circles.length>0&&!ue.collisionDetected,ie=ie&&ue.offscreen}if(T.iconFeatureIndex&&(fr=T.iconFeatureIndex),T.iconBox){let Qe=nt=>{let et=P&&K?ah(nt,K.x,K.y,w,S,this.transform.angle):nt;return this.collisionIndex.placeCollisionBox(et,v,u,a,f.predicate,F)};Je&&Je.box&&Je.box.length&&T.verticalIconBox?(Te=Qe(T.verticalIconBox),X=Te.box.length>0):(Te=Qe(T.iconBox),X=Te.box.length>0),ie=ie&&Te.offscreen}let $t=d||E.numHorizontalGlyphVertices===0&&E.numVerticalGlyphVertices===0,Vr=y||E.numIconVertices===0;if(!$t&&!Vr?X=N=X&&N:Vr?$t||(X=X&&N):N=X&&N,N&&Oe&&Oe.box&&(Je&&Je.box&&hr?this.collisionIndex.insertCollisionBox(Oe.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,hr,f.ID):this.collisionIndex.insertCollisionBox(Oe.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,Ye,f.ID)),X&&Te&&this.collisionIndex.insertCollisionBox(Te.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,fr,f.ID),ue&&(N&&this.collisionIndex.insertCollisionCircles(ue.circles,g,o.get("text-ignore-placement"),n.bucketInstanceId,Ye,f.ID),i)){let Qe=n.bucketInstanceId,nt=this.collisionCircleArrays[Qe];nt===void 0&&(nt=this.collisionCircleArrays[Qe]=new sh);for(let et=0;et<ue.circles.length;et+=4)nt.circles.push(ue.circles[et+0]),nt.circles.push(ue.circles[et+1]),nt.circles.push(ue.circles[et+2]),nt.circles.push(ue.collisionDetected?1:0)}if(E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(n.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[E.crossTileID]=new Gl(N||I,X||C,ie||n.justReloaded),t[E.crossTileID]=!0};if(k){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let E=n.getSortedSymbolIndexes(this.transform.angle);for(let T=E.length-1;T>=0;--T){let N=E[T];D(n.symbolInstances.get(N),n.collisionArrays[N])}}else for(let E=e.symbolInstanceStart;E<e.symbolInstanceEnd;E++)D(n.symbolInstances.get(E),n.collisionArrays[E]);if(i&&n.bucketInstanceId in this.collisionCircleArrays){let E=this.collisionCircleArrays[n.bucketInstanceId];G.invert(E.invProjMatrix,a),E.viewportMatrix=this.collisionIndex.getViewportMatrix()}n.justReloaded=!1}markUsedJustification(e,t,i,n){let o={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},a;n===2?a=i.verticalPlacedTextSymbolIndex:a=o[Fg(t)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?e.text.placedSymbolArray.get(l).crossTileID=0:e.text.placedSymbolArray.get(l).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let n=t===1||t===3?t:0,o=t===2?t:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let s of a)e.text.placedSymbolArray.get(s).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let n=t?t.symbolFadeChange(e):1,o=t?t.opacities:{},a=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let l in this.placements){let u=this.placements[l],c=o[l];c?(this.opacities[l]=new yi(c,n,u.text,u.icon),i=i||u.text!==c.text.placed||u.icon!==c.icon.placed):(this.opacities[l]=new yi(null,n,u.text,u.icon,u.skipFade),i=i||u.text||u.icon)}for(let l in o){let u=o[l];if(!this.opacities[l]){let c=new yi(u,n,!1,!1);c.isHidden()||(this.opacities[l]=c,i=i||u.text.placed||u.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let n of t){let o=n.getBucket(e);o&&n.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,i,n.collisionBoxArray)}}updateBucketOpacities(e,t,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],o=n.layout,a=new yi(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c=o.get("text-rotation-alignment")==="map",p=o.get("text-pitch-alignment")==="map",h=o.get("icon-text-fit")!=="none",f=new yi(null,0,s&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let d=(y,g,x)=>{for(let v=0;v<g/4;v++)y.opacityVertexArray.emplaceBack(x);y.hasVisibleVertices=y.hasVisibleVertices||x!==oa};for(let y=0;y<e.symbolInstances.length;y++){let g=e.symbolInstances.get(y),{numHorizontalGlyphVertices:x,numVerticalGlyphVertices:v,crossTileID:b}=g,w=t[b],S=this.opacities[b];w?S=a:S||(S=f,this.opacities[b]=S),t[b]=!0;let P=x>0||v>0,k=g.numIconVertices>0,I=this.placedOrientations[g.crossTileID],C=I===2,M=I===1||I===3;if(P){let F=Bg(S.text),D=C?oa:F;d(e.text,x,D);let E=M?oa:F;d(e.text,v,E);let T=S.text.isHidden();[g.rightJustifiedTextSymbolIndex,g.centerJustifiedTextSymbolIndex,g.leftJustifiedTextSymbolIndex].forEach(ie=>{ie>=0&&(e.text.placedSymbolArray.get(ie).hidden=T||C?1:0)}),g.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(g.verticalPlacedTextSymbolIndex).hidden=T||M?1:0);let N=this.variableOffsets[g.crossTileID];N&&this.markUsedJustification(e,N.anchor,g,I);let X=this.placedOrientations[g.crossTileID];X&&(this.markUsedJustification(e,"left",g,X),this.markUsedOrientation(e,X,g))}if(k){let F=Bg(S.icon),D=!(h&&g.verticalPlacedIconSymbolIndex&&C);if(g.placedIconSymbolIndex>=0){let E=D?F:oa;d(e.icon,g.numIconVertices,E),e.icon.placedSymbolArray.get(g.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(g.verticalPlacedIconSymbolIndex>=0){let E=D?oa:F;d(e.icon,g.numVerticalIconVertices,E),e.icon.placedSymbolArray.get(g.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let F=e.collisionArrays[y];if(F){let D=new jl.default(0,0);if(F.textBox||F.verticalTextBox){let T=!0;if(u){let N=this.variableOffsets[b];N?(D=Rg(N.anchor,N.width,N.height,N.textOffset,N.textBoxScale),c&&D._rotate(p?this.transform.angle:-this.transform.angle)):T=!1}F.textBox&&Ul(e.textCollisionBox.collisionVertexArray,S.text.placed,!T||C,D.x,D.y),F.verticalTextBox&&Ul(e.textCollisionBox.collisionVertexArray,S.text.placed,!T||M,D.x,D.y)}let E=!!(!M&&F.verticalIconBox);F.iconBox&&Ul(e.iconCollisionBox.collisionVertexArray,S.icon.placed,E,h?D.x:0,h?D.y:0),F.verticalIconBox&&Ul(e.iconCollisionBox.collisionVertexArray,S.icon.placed,!E,h?D.x:0,h?D.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(e.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(e.text.layoutVertexArray.length,") / 4"));if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(e.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(e.icon.layoutVertexArray.length,") / 4"));if(e.bucketInstanceId in this.collisionCircleArrays){let y=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=y.invProjMatrix,e.placementViewportMatrix=y.viewportMatrix,e.collisionCircleArray=y.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function Ul(r,e,t,i,n){r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0)}var IA=Math.pow(2,25),CA=Math.pow(2,24),EA=Math.pow(2,17),kA=Math.pow(2,16),LA=Math.pow(2,9),DA=Math.pow(2,8),zA=Math.pow(2,1);function Bg(r){if(r.opacity===0&&!r.placed)return 0;if(r.opacity===1&&r.placed)return 4294967295;let e=r.placed?1:0,t=Math.floor(r.opacity*127);return t*IA+e*CA+t*EA+e*kA+t*LA+e*DA+t*zA+e}var oa=0;var ch=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,n,o){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(a,n,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,i),this._currentPartIndex++,o())return!0}return!1}},Zl=class{constructor(e,t,i,n,o,a,s,l){this.placement=new ql(e,t,a,s,l),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let n=J.now(),o=()=>this._forceFullPlacement?!1:J.now()-n>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],s=t[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new ch(s)),this._inProgressLayer.continuePlacement(i[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};m();m();var Og=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ph=1,aa=8,la=class r{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,i]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==ph)throw new Error("Got v".concat(n," data when expected v").concat(ph,"."));let o=Og[i&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new r(s,a,o,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=Og.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(i,"."));n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,aa,e),this.coords=new this.ArrayType(this.data,aa+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(aa+a+s+l),this.ids=new this.IndexArrayType(this.data,aa,e),this.coords=new this.ArrayType(this.data,aa+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(ph<<4)+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return fh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,h=l.pop()||0;if(p-h<=s){for(let g=h;g<=p;g++){let x=a[2*g],v=a[2*g+1];x>=e&&x<=i&&v>=t&&v<=n&&u.push(o[g])}continue}let f=h+p>>1,d=a[2*f],y=a[2*f+1];d>=e&&d<=i&&y>=t&&y<=n&&u.push(o[f]),(c===0?e<=d:t<=y)&&(l.push(h),l.push(f-1),l.push(1-c)),(c===0?i>=d:n>=y)&&(l.push(f+1),l.push(p),l.push(1-c))}return u}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[],u=i*i;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,h=s.pop()||0;if(p-h<=a){for(let g=h;g<=p;g++)Vg(o[2*g],o[2*g+1],e,t)<=u&&l.push(n[g]);continue}let f=h+p>>1,d=o[2*f],y=o[2*f+1];Vg(d,y,e,t)<=u&&l.push(n[f]),(c===0?e-i<=d:t-i<=y)&&(s.push(h),s.push(f-1),s.push(1-c)),(c===0?e+i>=d:t+i>=y)&&(s.push(f+1),s.push(p),s.push(1-c))}return l}};function fh(r,e,t,i,n,o){if(n-i<=t)return;let a=i+n>>1;Ug(r,e,a,i,n,o),fh(r,e,t,i,a-1,1-o),fh(r,e,t,a+1,n,1-o)}function Ug(r,e,t,i,n,o){for(;n>i;){if(n-i>600){let u=n-i+1,c=t-i+1,p=Math.log(u),h=.5*Math.exp(2*p/3),f=.5*Math.sqrt(p*h*(u-h)/u)*(c-u/2<0?-1:1),d=Math.max(i,Math.floor(t-c*h/u+f)),y=Math.min(n,Math.floor(t+(u-c)*h/u+f));Ug(r,e,t,d,y,o)}let a=e[2*t+o],s=i,l=n;for(sa(r,e,i,t),e[2*n+o]>a&&sa(r,e,i,n);s<l;){for(sa(r,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*i+o]===a?sa(r,e,i,l):(l++,sa(r,e,l,n)),l<=t&&(i=l+1),t<=l&&(n=l-1)}}function sa(r,e,t,i){hh(r,t,i),hh(e,2*t,2*i),hh(e,2*t+1,2*i+1)}function hh(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}function Vg(r,e,t,i){let n=r-t,o=e-i;return n*n+o*o}var ua=512/8192/2,FA=128,mh=class{constructor(e,t,i){this.tileID=e;this.bucketInstanceId=i;this._symbolsByKey={};let n=new Map;for(let o=0;o<t.length;o++){let a=t.get(o),s=a.key,l=n.get(s);l?l.push(a):n.set(s,[a])}for(let[o,a]of n){let s=a.map(c=>({x:Math.floor(c.anchorX*ua),y:Math.floor(c.anchorY*ua)})),l=a.map(c=>c.crossTileID),u={positions:s,crossTileIDs:l};if(u.positions.length>FA){let c=new la(u.positions.length,16,Uint16Array);for(let{x:p,y:h}of u.positions)c.add(p,h);c.finish(),delete u.positions,u.index=c}this._symbolsByKey[o]=u}}getScaledCoordinates(e,t){let{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=t.canonical,u=l-o,c=ua/Math.pow(2,u),p=(a*8192+e.anchorX)*c,h=(s*8192+e.anchorY)*c,f=i*8192*ua,d=n*8192*ua;return{x:Math.floor(p-f),y:Math.floor(h-d)}}findMatches(e,t,i){let n=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let o=0;o<e.length;o++){let a=e.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let l=this.getScaledCoordinates(a,t);if(s.index){let u=s.index.range(l.x-n,l.y-n,l.x+n,l.y+n).sort();for(let c of u){let p=s.crossTileIDs[c];if(!i[p]){i[p]=!0,a.crossTileID=p;break}}}else if(s.positions)for(let u=0;u<s.positions.length;u++){let c=s.positions[u],p=s.crossTileIDs[u];if(Math.abs(c.x-l.x)<=n&&Math.abs(c.y-l.y)<=n&&!i[p]){i[p]=!0,a.crossTileID=p;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},dh=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},yh=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let i in this.indexes){let n=this.indexes[i],o={};for(let a in n){let s=n[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),o[s.tileID.key]=s}this.indexes[i]=o}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let n=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>e.overscaledZ)for(let s in a){let l=a[s];l.tileID.isChildOf(e)&&l.findMatches(t.symbolInstances,e,n)}else{let s=e.scaledTo(Number(o)),l=a[s.key];l&&l.findMatches(t.symbolInstances,e,n)}}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID||(a.crossTileID=i.generate(),n[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new mh(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let n of i)delete this.usedCrossTileIDs[e][n]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let n=this.indexes[i];for(let o in n)e[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[o]),delete n[o],t=!0)}return t}},fn=class{constructor(){this.layerIndexes={},this.crossTileIDs=new dh,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let n=this.layerIndexes[e.id];n===void 0&&(n=this.layerIndexes[e.id]=new yh);let o=!1,a={};n.handleWrapJump(i);for(let s of t){let l=s.getBucket(e);!l||e.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(s.tileID,l,this.crossTileIDs)&&(o=!0),a[l.bucketInstanceId]=!0)}return n.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){let t={};e.forEach(i=>{t[i]=!0});for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}};var Hl=(r,e)=>Ri(r,e&&e.filter(t=>t.identifier!=="source.canvas")),RA=vm(),mn=class extends me{constructor(t,i={}){super();this._rtlPluginLoaded=()=>{for(let t in this.sourceCaches){let i=this.sourceCaches[t].getSource().type;(i==="vector"||i==="geojson")&&this.sourceCaches[t].reload()}};this.map=t,this.dispatcher=new Zo(jo(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(n,o)=>this.getGlyphs(n,o)),this.dispatcher.registerMessageHandler("GI",(n,o)=>this.getImages(n,o)),this.imageManager=new _l,this.imageManager.setEventedParent(this),this.glyphManager=new vl(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new Sl(256,512),this.crossTileSymbolIndex=new fn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Vi,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",Za()),Rr().on(Qo,this._rtlPluginLoaded),this.on("data",n=>{if(n.dataType!=="source"||n.sourceDataType!=="metadata")return;let o=this.sourceCaches[n.sourceId];if(!o)return;let a=o.getSource();if(!(!a||!a.vectorLayerIds))for(let s in this._layers){let l=this._layers[s];l.source===a.id&&this._validateLayer(l)}})}loadURL(t,i={},n){this.fire(new z("dataloading",{dataType:"style"})),i.validate=typeof i.validate=="boolean"?i.validate:!0;let o=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController,dr(o,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,i,n)}).catch(a=>{this._loadStyleRequest=null,a&&this.fire(new Z(a))})}loadJSON(t,i={},n){this.fire(new z("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,J.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(t,i,n)}).catch(()=>{})}loadEmpty(){this.fire(new z("dataloading",{dataType:"style"})),this._load(RA,{validate:!1})}_load(t,i,n){var a;let o=i.transformStyle?i.transformStyle(n,t):t;if(!(i.validate&&Hl(this,Ue(o)))){this._loaded=!0,this.stylesheet=o;for(let s in o.sources)this.addSource(s,o.sources[s],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new wl(this.stylesheet.light),this.map.setTerrain((a=this.stylesheet.terrain)!=null?a:null),this.fire(new z("data",{dataType:"style"})),this.fire(new z("style.load"))}}_createLayers(){let t=ip(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(i=>i.id),this._layers={},this._serializedLayers=null;for(let i of t){let n=xl(i);n.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=n}}_loadSprite(t,i=!1,n=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let o;rg(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(u=>!(u in a)):[];for(let u of l)this.imageManager.removeImage(u),this._changedImages[u]=!0;for(let u in a[s]){let c=s==="default"?u:"".concat(s,":").concat(u);this._spritesImagesIds[s].push(c),c in this.imageManager.images?this.imageManager.updateImage(c,a[s][u],!1):this.imageManager.addImage(c,a[s][u]),i&&(this._changedImages[c]=!0)}}}).catch(a=>{this._spriteRequest=null,o=a,this.fire(new Z(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"})),n&&n(o)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}_validateLayer(t){let i=this.sourceCaches[t.source];if(!i)return;let n=t.sourceLayer;if(!n)return;let o=i.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(n)===-1)&&this.fire(new Z(new Error('Source layer "'.concat(n,'" ')+'does not exist on source "'.concat(o.id,'" ')+'as specified by style layer "'.concat(t.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){let i=this._serializedAllLayers();if(!t||t.length===0)return Object.values(i);let n=[];for(let o of t)i[o]&&n.push(i[o]);return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let i=Object.keys(this._layers);for(let n of i){let o=this._layers[n];o.type!=="custom"&&(t[n]=o.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let i=this._changed;if(i){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(l))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}let n={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];n[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(t,this._availableImages),!a.isHidden(t.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in n){let a=this.sourceCaches[o];!!n[o]!=!!a.used&&a.fire(new z("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.z=t.zoom,i&&this.fire(new z("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var l;this._checkLoaded();let n=this.serialize();if(t=i.transformStyle?i.transformStyle(n,t):t,((l=i.validate)!=null?l:!0)&&Hl(this,Ue(t)))return!1;t=ct(t),t.layers=ip(t.layers);let a=Qf(n,t),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error("Unimplemented: ".concat(s.unimplemented.join(", "),"."));if(s.operations.length===0)return!1;for(let u of s.operations)u();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){let i=[],n=[];for(let o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":i.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":i.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":i.push(()=>{});break;default:n.push(o.command);break}return{operations:i,unimplemented:n}}addImage(t,i){if(this.getImage(t))return this.fire(new Z(new Error('An image named "'.concat(t,'" already exists.'))));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new Z(new Error('An image named "'.concat(t,'" does not exist.'))));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,n={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error('Source "'.concat(t,'" already exists.'));if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(i).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(Ue.source,"sources.".concat(t),i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);let s=this.sourceCaches[t]=new lr(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(let n in this._layers)if(this._layers[n].source===t)return this.fire(new Z(new Error('Source "'.concat(t,'" cannot be removed while layer "').concat(n,'" is using it.'))));let i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new z("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID=".concat(t));let n=this.sourceCaches[t].getSource();if(n.type!=="geojson")throw new Error("geojsonSource.type is ".concat(n.type,", which is !== 'geojson"));n.setData(i),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,n={}){this._checkLoaded();let o=t.id;if(this.getLayer(o)){this.fire(new Z(new Error('Layer "'.concat(o,'" already exists on this map.'))));return}let a;if(t.type==="custom"){if(Hl(this,tg(t)))return;a=xl(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=ct(t),t=O(t,{source:o})),this._validate(Ue.layer,"layers.".concat(o),t,{arrayIndex:-1},n))return;a=xl(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&s===-1){this.fire(new Z(new Error('Cannot add layer "'.concat(o,'" before non-existing layer "').concat(i,'".'))));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let l=this._removedLayers[o];delete this._removedLayers[o],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t]){this.fire(new Z(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot be moved."))));return}if(t===i)return;let o=this._order.indexOf(t);this._order.splice(o,1);let a=i?this._order.indexOf(i):this._order.length;if(i&&a===-1){this.fire(new Z(new Error('Cannot move layer "'.concat(t,'" before non-existing layer "').concat(i,'".'))));return}this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let i=this._layers[t];if(!i){this.fire(new Z(new Error('Cannot remove non-existing layer "'.concat(t,'".'))));return}i.setEventedParent(null);let n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,n){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new Z(new Error('Cannot set the zoom range of non-existing layer "'.concat(t,'".'))));return}o.minzoom===i&&o.maxzoom===n||(i!=null&&(o.minzoom=i),n!=null&&(o.maxzoom=n),this._updateLayer(o))}setFilter(t,i,n={}){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new Z(new Error('Cannot filter non-existing layer "'.concat(t,'".'))));return}if(!Jt(o.filter,i)){if(i==null){o.filter=void 0,this._updateLayer(o);return}this._validate(Ue.filter,"layers.".concat(o.id,".filter"),i,null,n)||(o.filter=ct(i),this._updateLayer(o))}}getFilter(t){return ct(this.getLayer(t).filter)}setLayoutProperty(t,i,n,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new Z(new Error('Cannot style non-existing layer "'.concat(t,'".'))));return}Jt(a.getLayoutProperty(i),n)||(a.setLayoutProperty(i,n,o),this._updateLayer(a))}getLayoutProperty(t,i){let n=this.getLayer(t);if(!n){this.fire(new Z(new Error('Cannot get style of non-existing layer "'.concat(t,'".'))));return}return n.getLayoutProperty(i)}setPaintProperty(t,i,n,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new Z(new Error('Cannot style non-existing layer "'.concat(t,'".'))));return}if(Jt(a.getPaintProperty(i),n))return;a.setPaintProperty(i,n,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();let n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a===void 0){this.fire(new Z(new Error("The source '".concat(n,"' does not exist in the map's style."))));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new Z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")));return}t.id===void 0&&this.fire(new Z(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,t.id,i)}removeFeatureState(t,i){this._checkLoaded();let n=t.source,o=this.sourceCaches[n];if(o===void 0){this.fire(new Z(new Error("The source '".concat(n,"' does not exist in the map's style."))));return}let a=o.getSource().type,s=a==="vector"?t.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(i&&typeof t.id!="string"&&typeof t.id!="number"){this.fire(new Z(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,t.id,i)}getFeatureState(t){this._checkLoaded();let i=t.source,n=t.sourceLayer,o=this.sourceCaches[i];if(o===void 0){this.fire(new Z(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}if(o.getSource().type==="vector"&&!n){this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return t.id===void 0&&this.fire(new Z(new Error("The feature id parameter must be provided."))),o.getFeatureState(n,t.id)}getTransition(){return O({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let t=wn(this.sourceCaches,a=>a.serialize()),i=this._serializeByIds(this._order),n=this.map.getTerrain()||void 0,o=this.stylesheet;return Na({version:o.version,name:o.name,metadata:o.metadata,light:o.light,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:t,layers:i,terrain:n},a=>a!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=s=>this._layers[s].type==="fill-extrusion",n={},o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(i(l)){n[l]=s;for(let u of t){let c=u[l];if(c)for(let p of c)o.push(p)}}}o.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(i(l))for(let u=o.length-1;u>=0;u--){let c=o[u].feature;if(n[c.layer.id]<s)break;a.push(c),o.pop()}else for(let u of t){let c=u[l];if(c)for(let p of c)a.push(p.feature)}}return a}queryRenderedFeatures(t,i,n){i&&i.filter&&this._validate(Ue.filter,"queryRenderedFeatures.filter",i.filter,null,i);let o={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new Z(new Error("parameters.layers must be an Array."))),[];for(let l of i.layers){let u=this._layers[l];if(!u)return this.fire(new Z(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];o[u.source]=!0}}let a=[];i.availableImages=this._availableImages;let s=this._serializedAllLayers();for(let l in this.sourceCaches)i.layers&&!o[l]||a.push(cg(this.sourceCaches[l],this._layers,s,t,i,n));return this.placement&&a.push(pg(this._layers,s,this.sourceCaches,t,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,i){i&&i.filter&&this._validate(Ue.filter,"querySourceFeatures.filter",i.filter,null,i);let n=this.sourceCaches[t];return n?hg(n,i):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();let n=this.light.getLight(),o=!1;for(let s in t)if(!Jt(t[s],n[s])){o=!0;break}if(!o)return;let a={now:J.now(),transition:O({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(a)}_validate(t,i,n,o,a={}){return a&&a.validate===!1?!1:Hl(this,t.call(Ue,O({key:i,style:this.serialize(),value:n,styleSpec:A},o)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Rr().off(Qo,this._rtlPluginLoaded);for(let i in this._layers)this._layers[i].setEventedParent(null);for(let i in this.sourceCaches){let n=this.sourceCaches[i];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(let i in this.sourceCaches)this.sourceCaches[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,i,n,o,a=!1){let s=!1,l=!1,u={};for(let p of this._order){let h=this._layers[p];if(h.type!=="symbol")continue;if(!u[h.source]){let d=this.sourceCaches[h.source];u[h.source]=d.getRenderableIds(!0).map(y=>d.getTileByID(y)).sort((y,g)=>g.tileID.overscaledZ-y.tileID.overscaledZ||(y.tileID.isLessThan(g.tileID)?-1:1))}let f=this.crossTileSymbolIndex.addLayer(h,u[h.source],t.center.lng);s=s||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||n===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(J.now(),t.zoom))&&(this.pauseablePlacement=new Zl(t,this.map.terrain,this._order,a,i,n,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(J.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let p of this._order){let h=this._layers[p];h.type==="symbol"&&this.placement.updateLayerOpacities(h,u[h.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(J.now())}_releaseSymbolFadeTiles(){for(let t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}async getImages(t,i){let n=await this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,i.icons),n}async getGlyphs(t,i){let n=await this.glyphManager.getGlyphs(i.stacks),o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,[""]),n}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),!(t&&this._validate(Ue.glyphs,"glyphs",t,null,i))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,n={},o){this._checkLoaded();let a=[{id:t,url:i}],s=[...on(this.stylesheet.sprite),...a];this._validate(Ue.sprite,"sprite",s,null,n)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(t){this._checkLoaded();let i=on(this.stylesheet.sprite);if(!i.find(n=>n.id===t)){this.fire(new Z(new Error('Sprite "'.concat(t,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[t])for(let n of this._spritesImagesIds[t])this.imageManager.removeImage(n),this._changedImages[n]=!0;i.splice(i.findIndex(n=>n.id===t),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}getSprite(){return on(this.stylesheet.sprite)}setSprite(t,i={},n){this._checkLoaded(),!(t&&this._validate(Ue.sprite,"sprite",t,null,i))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,n):(this._unloadSprite(),n&&n(null)))}};m();m();var $l=be([{name:"a_pos",type:"Int16",components:2}]);m();m();var Ng="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n";m();var Gg="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\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(unpack_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 float tile_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 (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}";m();var qg="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var jg="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";m();var Zg="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Hg="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}";m();var $g="varying vec3 v_data;varying 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\nvoid 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 extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Wg="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying 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\nvoid 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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";m();var Xg="void main() {gl_FragColor=vec4(1.0);}";m();var Kg="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";m();var Jg="uniform highp float u_intensity;varying 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);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Yg="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying 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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";m();var Qg="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";m();var ex="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}";m();var tx="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";m();var rx="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";m();var ix="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);gl_FragColor=color*alpha*opacity_t;}";m();var nx="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-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(0.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);}";m();var ox="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";m();var ax="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";m();var sx="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var lx="attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}";m();var ux="varying vec2 v_pos;\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);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var cx="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\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\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";m();var px="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var hx="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";m();var fx="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var mx="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}";m();var dx="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var yx="uniform 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;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}";m();var gx="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var xx="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}";m();var bx="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);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((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var _x="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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;}";m();var vx="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(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);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var wx="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";m();var Sx="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Px="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\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\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\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\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;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}";m();var Tx="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Ax="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\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\nvoid main() {\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\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;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}";m();var Mx="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.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);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Ix="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";m();var Cx="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\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);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Ex="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\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 floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\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 floorwidth\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";m();var kx="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Lx="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";m();var Dx="uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var zx="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}";m();var Fx="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\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\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\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Rx="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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_pitch_with_map;uniform highp float u_pitch;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;varying vec2 v_data0;varying vec3 v_data1;\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\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\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}";m();var Bx="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\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\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\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Ox="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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_pitch_with_map;uniform highp float u_pitch;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 vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\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\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\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}";m();var Vx="varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}";m();var Ux="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";m();var Nx="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";m();var Wl="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";var gi={prelude:Ce(Ng,Gg),background:Ce(qg,jg),backgroundPattern:Ce(Zg,Hg),circle:Ce($g,Wg),clippingMask:Ce(Xg,Kg),heatmap:Ce(Jg,Yg),heatmapTexture:Ce(Qg,ex),collisionBox:Ce(tx,rx),collisionCircle:Ce(ix,nx),debug:Ce(ox,ax),fill:Ce(sx,lx),fillOutline:Ce(ux,cx),fillOutlinePattern:Ce(px,hx),fillPattern:Ce(fx,mx),fillExtrusion:Ce(dx,yx),fillExtrusionPattern:Ce(gx,xx),hillshadePrepare:Ce(bx,_x),hillshade:Ce(vx,wx),line:Ce(Sx,Px),lineGradient:Ce(Tx,Ax),linePattern:Ce(Mx,Ix),lineSDF:Ce(Cx,Ex),raster:Ce(kx,Lx),symbolIcon:Ce(Dx,zx),symbolSDF:Ce(Fx,Rx),symbolTextAndIcon:Ce(Bx,Ox),terrain:Ce(Nx,Wl),terrainDepth:Ce(Vx,Wl),terrainCoords:Ce(Ux,Wl)};function Ce(r,e){let t=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=e.match(/attribute ([\w]+) ([\w]+)/g),n=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return r=r.replace(t,(l,u,c,p,h)=>(s[h]=!0,u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nvarying ").concat(c," ").concat(p," ").concat(h,";\n#else\nuniform ").concat(c," ").concat(p," u_").concat(h,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(h,"\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"))),e=e.replace(t,(l,u,c,p,h)=>{let f=p==="float"?"vec2":"vec4",d=h.match(/color/)?"color":f;return s[h]?u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nattribute ").concat(c," ").concat(f," a_").concat(h,";\nvarying ").concat(c," ").concat(p," ").concat(h,";\n#else\nuniform ").concat(c," ").concat(p," u_").concat(h,";\n#endif\n"):d==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = a_").concat(h,";\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = unpack_mix_").concat(d,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"):u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nattribute ").concat(c," ").concat(f," a_").concat(h,";\n#else\nuniform ").concat(c," ").concat(p," u_").concat(h,";\n#endif\n"):d==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(c," ").concat(p," ").concat(h," = a_").concat(h,";\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(c," ").concat(p," ").concat(h," = unpack_mix_").concat(d,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n")}),{fragmentSource:r,vertexSource:e,staticAttributes:i,staticUniforms:a}}m();m();var Xl=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,n,o,a,s,l,u){this.context=e;let c=this.boundPaintVertexBuffers.length!==n.length;for(let h=0;!c&&h<n.length;h++)this.boundPaintVertexBuffers[h]!==n[h]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==u?this.freshBind(t,i,n,o,a,s,l,u):(e.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),l&&l.bind(),u&&u.bind())}freshBind(e,t,i,n,o,a,s,l){let u=e.numAttributes,c=this.context,p=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,t.enableAttributes(p,e);for(let h of i)h.enableAttributes(p,e);a&&a.enableAttributes(p,e),s&&s.enableAttributes(p,e),l&&l.enableAttributes(p,e),t.bind(),t.setVertexAttribPointers(p,e,o);for(let h of i)h.bind(),h.setVertexAttribPointers(p,e,o);a&&(a.bind(),a.setVertexAttribPointers(p,e,o)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(p,e,o)),l&&(l.bind(),l.setVertexAttribPointers(p,e,o)),c.currentNumAttributes=u}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};m();var Gx=(r,e)=>({u_depth:new Y(r,e.u_depth),u_terrain:new Y(r,e.u_terrain),u_terrain_dim:new V(r,e.u_terrain_dim),u_terrain_matrix:new te(r,e.u_terrain_matrix),u_terrain_unpack:new Mr(r,e.u_terrain_unpack),u_terrain_exaggeration:new V(r,e.u_terrain_exaggeration)}),qx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_texture:new Y(r,e.u_texture),u_ele_delta:new V(r,e.u_ele_delta)}),jx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ele_delta:new V(r,e.u_ele_delta)}),Zx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_texture:new Y(r,e.u_texture),u_terrain_coords_id:new V(r,e.u_terrain_coords_id),u_ele_delta:new V(r,e.u_ele_delta)}),Hx=(r,e)=>({u_matrix:r,u_texture:0,u_ele_delta:e}),$x=(r,e)=>({u_matrix:r,u_ele_delta:e}),Wx=(r,e,t)=>({u_matrix:r,u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t});function gh(r){let e=[];for(let t=0;t<r.length;t++){if(r[t]===null)continue;let i=r[t].split(" ");e.push(i.pop())}return e}var Kl=class{constructor(e,t,i,n,o,a){let s=e.gl;this.program=s.createProgram();let l=gh(t.staticAttributes),u=i?i.getBinderAttributes():[],c=l.concat(u),p=gi.prelude.staticUniforms?gh(gi.prelude.staticUniforms):[],h=t.staticUniforms?gh(t.staticUniforms):[],f=i?i.getBinderUniforms():[],d=p.concat(h).concat(f),y=[];for(let P of d)y.indexOf(P)<0&&y.push(P);let g=i?i.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),a&&g.push("#define TERRAIN3D;");let x=g.concat(gi.prelude.fragmentSource,t.fragmentSource).join("\n"),v=g.concat(gi.prelude.vertexSource,t.vertexSource).join("\n"),b=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(b,x),s.compileShader(b),!s.getShaderParameter(b,s.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(s.getShaderInfoLog(b)));s.attachShader(this.program,b);let w=s.createShader(s.VERTEX_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(w,v),s.compileShader(w),!s.getShaderParameter(w,s.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(s.getShaderInfoLog(w)));s.attachShader(this.program,w),this.attributes={};let S={};this.numAttributes=c.length;for(let P=0;P<this.numAttributes;P++)c[P]&&(s.bindAttribLocation(this.program,P,c[P]),this.attributes[c[P]]=P);if(s.linkProgram(this.program),!s.getProgramParameter(this.program,s.LINK_STATUS))throw new Error("Program failed to link: ".concat(s.getProgramInfoLog(this.program)));s.deleteShader(w),s.deleteShader(b);for(let P=0;P<y.length;P++){let k=y[P];if(k&&!S[k]){let I=s.getUniformLocation(this.program,k);I&&(S[k]=I)}}this.fixedUniforms=n(e,S),this.terrainUniforms=Gx(e,S),this.binderUniforms=i?i.getUniforms(e,S):[]}draw(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v){let b=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(o),e.setCullFace(a),l){e.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,l.depthTexture),e.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,l.texture);for(let S in this.terrainUniforms)this.terrainUniforms[S].set(l[S])}for(let S in this.fixedUniforms)this.fixedUniforms[S].set(s[S]);y&&y.setUniforms(e,this.binderUniforms,f,{zoom:d});let w=0;switch(t){case b.LINES:w=2;break;case b.TRIANGLES:w=3;break;case b.LINE_STRIP:w=1;break}for(let S of h.get()){let P=S.vaos||(S.vaos={});(P[u]||(P[u]=new Xl)).bind(e,this,c,y?y.getPaintVertexBuffers():[],p,S.vertexOffset,g,x,v),b.drawElements(t,S.primitiveLength*w,b.UNSIGNED_SHORT,S.primitiveOffset*w*2)}}};m();m();m();function Jl(r,e,t){let i=1/He(t,1,e.transform.tileZoom),n=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(t.tileID.canonical.x+t.tileID.wrap*n),s=o*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_scale:[i,r.fromScale,r.toScale],u_fade:r.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}function Xx(r,e,t,i){let n=t.imageManager.getPattern(r.from.toString()),o=t.imageManager.getPattern(r.to.toString()),{width:a,height:s}=t.imageManager.getPixelSize(),l=Math.pow(2,i.tileID.overscaledZ),u=i.tileSize*Math.pow(2,t.transform.tileZoom)/l,c=u*(i.tileID.canonical.x+i.tileID.wrap*l),p=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/He(i,1,t.transform.tileZoom),u_pixel_coord_upper:[c>>16,p>>16],u_pixel_coord_lower:[c&65535,p&65535]}}var Kx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_lightpos:new st(r,e.u_lightpos),u_lightintensity:new V(r,e.u_lightintensity),u_lightcolor:new st(r,e.u_lightcolor),u_vertical_gradient:new V(r,e.u_vertical_gradient),u_opacity:new V(r,e.u_opacity)}),Jx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_lightpos:new st(r,e.u_lightpos),u_lightintensity:new V(r,e.u_lightintensity),u_lightcolor:new st(r,e.u_lightcolor),u_vertical_gradient:new V(r,e.u_vertical_gradient),u_height_factor:new V(r,e.u_height_factor),u_image:new Y(r,e.u_image),u_texsize:new ee(r,e.u_texsize),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_scale:new st(r,e.u_scale),u_fade:new V(r,e.u_fade),u_opacity:new V(r,e.u_opacity)}),xh=(r,e,t,i)=>{let n=e.style.light,o=n.properties.get("position"),a=[o.x,o.y,o.z],s=So.create();n.properties.get("anchor")==="viewport"&&So.fromRotation(s,-e.transform.angle),yt.transformMat3(a,a,s);let l=n.properties.get("color");return{u_matrix:r,u_lightpos:a,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:i}},Yx=(r,e,t,i,n,o,a)=>O(xh(r,e,t,i),Jl(o,e,a),{u_height_factor:-Math.pow(2,n.overscaledZ)/a.tileSize/8});m();var Qx=(r,e)=>({u_matrix:new te(r,e.u_matrix)}),eb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_image:new Y(r,e.u_image),u_texsize:new ee(r,e.u_texsize),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_scale:new st(r,e.u_scale),u_fade:new V(r,e.u_fade)}),tb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_world:new ee(r,e.u_world)}),rb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_world:new ee(r,e.u_world),u_image:new Y(r,e.u_image),u_texsize:new ee(r,e.u_texsize),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_scale:new st(r,e.u_scale),u_fade:new V(r,e.u_fade)}),bh=r=>({u_matrix:r}),_h=(r,e,t,i)=>O(bh(r),Jl(t,e,i)),ib=(r,e)=>({u_matrix:r,u_world:e}),nb=(r,e,t,i,n)=>O(_h(r,e,t,i),{u_world:n});m();var ob=(r,e)=>({u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_scale_with_map:new Y(r,e.u_scale_with_map),u_pitch_with_map:new Y(r,e.u_pitch_with_map),u_extrude_scale:new ee(r,e.u_extrude_scale),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_matrix:new te(r,e.u_matrix)}),ab=(r,e,t,i)=>{let n=r.transform,o,a;if(i.paint.get("circle-pitch-alignment")==="map"){let s=He(t,1,n.zoom);o=!0,a=[s,s]}else o=!1,a=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_matrix:r.translatePosMatrix(e.posMatrix,t,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:r.pixelRatio,u_extrude_scale:a}};m();var sb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pixels_to_tile_units:new V(r,e.u_pixels_to_tile_units),u_extrude_scale:new ee(r,e.u_extrude_scale),u_overscale_factor:new V(r,e.u_overscale_factor)}),lb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_inv_matrix:new te(r,e.u_inv_matrix),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_viewport_size:new ee(r,e.u_viewport_size)}),ub=(r,e,t)=>{let i=He(t,1,e.zoom),n=Math.pow(2,e.zoom-t.tileID.overscaledZ),o=t.tileID.overscaleFactor();return{u_matrix:r,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[e.pixelsToGLUnits[0]/(i*n),e.pixelsToGLUnits[1]/(i*n)],u_overscale_factor:o}},cb=(r,e,t)=>({u_matrix:r,u_inv_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_viewport_size:[t.width,t.height]});m();var pb=(r,e)=>({u_color:new Ct(r,e.u_color),u_matrix:new te(r,e.u_matrix),u_overlay:new Y(r,e.u_overlay),u_overlay_scale:new V(r,e.u_overlay_scale)}),vh=(r,e,t=1)=>({u_matrix:r,u_color:e,u_overlay:0,u_overlay_scale:t});m();var hb=(r,e)=>({u_matrix:new te(r,e.u_matrix)}),wh=r=>({u_matrix:r});m();var fb=(r,e)=>({u_extrude_scale:new V(r,e.u_extrude_scale),u_intensity:new V(r,e.u_intensity),u_matrix:new te(r,e.u_matrix)}),mb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_world:new ee(r,e.u_world),u_image:new Y(r,e.u_image),u_color_ramp:new Y(r,e.u_color_ramp),u_opacity:new V(r,e.u_opacity)}),db=(r,e,t,i)=>({u_matrix:r,u_extrude_scale:He(e,1,t),u_intensity:i}),yb=(r,e,t,i)=>{let n=G.create();G.ortho(n,0,r.width,r.height,0,0,1);let o=r.context.gl;return{u_matrix:n,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:t,u_color_ramp:i,u_opacity:e.paint.get("heatmap-opacity")}};m();var gb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_image:new Y(r,e.u_image),u_latrange:new ee(r,e.u_latrange),u_light:new ee(r,e.u_light),u_shadow:new Ct(r,e.u_shadow),u_highlight:new Ct(r,e.u_highlight),u_accent:new Ct(r,e.u_accent)}),xb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_image:new Y(r,e.u_image),u_dimension:new ee(r,e.u_dimension),u_zoom:new V(r,e.u_zoom),u_unpack:new Mr(r,e.u_unpack)}),bb=(r,e,t,i)=>{let n=t.paint.get("hillshade-shadow-color"),o=t.paint.get("hillshade-highlight-color"),a=t.paint.get("hillshade-accent-color"),s=t.paint.get("hillshade-illumination-direction")*(Math.PI/180);t.paint.get("hillshade-illumination-anchor")==="viewport"&&(s-=r.transform.angle);let l=!r.options.moving;return{u_matrix:i?i.posMatrix:r.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:BA(r,e.tileID),u_light:[t.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:o,u_accent:a}},_b=(r,e)=>{let t=e.stride,i=G.create();return G.ortho(i,0,8192,-8192,0,0,1),G.translate(i,i,[0,-8192,0]),{u_matrix:i,u_image:1,u_dimension:[t,t],u_zoom:r.overscaledZ,u_unpack:e.getUnpackVector()}};function BA(r,e){let t=Math.pow(2,e.canonical.z),i=e.canonical.y;return[new ze(0,i/t).toLngLat().lat,new ze(0,(i+1)/t).toLngLat().lat]}m();var vb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_units_to_pixels:new ee(r,e.u_units_to_pixels)}),wb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_units_to_pixels:new ee(r,e.u_units_to_pixels),u_image:new Y(r,e.u_image),u_image_height:new V(r,e.u_image_height)}),Sb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_texsize:new ee(r,e.u_texsize),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_image:new Y(r,e.u_image),u_units_to_pixels:new ee(r,e.u_units_to_pixels),u_scale:new st(r,e.u_scale),u_fade:new V(r,e.u_fade)}),Pb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_units_to_pixels:new ee(r,e.u_units_to_pixels),u_patternscale_a:new ee(r,e.u_patternscale_a),u_patternscale_b:new ee(r,e.u_patternscale_b),u_sdfgamma:new V(r,e.u_sdfgamma),u_image:new Y(r,e.u_image),u_tex_y_a:new V(r,e.u_tex_y_a),u_tex_y_b:new V(r,e.u_tex_y_b),u_mix:new V(r,e.u_mix)}),Yl=(r,e,t,i)=>{let n=r.transform;return{u_matrix:Cb(r,e,t,i),u_ratio:1/He(e,1,n.zoom),u_device_pixel_ratio:r.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Tb=(r,e,t,i,n)=>O(Yl(r,e,t,n),{u_image:0,u_image_height:i}),Ab=(r,e,t,i,n)=>{let o=r.transform,a=Ib(e,o);return{u_matrix:Cb(r,e,t,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/He(e,1,o.zoom),u_device_pixel_ratio:r.pixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Mb=(r,e,t,i,n,o)=>{let a=r.transform,s=r.lineAtlas,l=Ib(e,a),u=t.layout.get("line-cap")==="round",c=s.getDash(i.from,u),p=s.getDash(i.to,u),h=c.width*n.fromScale,f=p.width*n.toScale;return O(Yl(r,e,t,o),{u_patternscale_a:[l/h,-c.height/2],u_patternscale_b:[l/f,-p.height/2],u_sdfgamma:s.width/(Math.min(h,f)*256*r.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:p.y,u_mix:n.t})};function Ib(r,e){return 1/He(r,1,e.tileZoom)}function Cb(r,e,t,i){return r.translatePosMatrix(i?i.posMatrix:e.tileID.posMatrix,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}m();var Eb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_tl_parent:new ee(r,e.u_tl_parent),u_scale_parent:new V(r,e.u_scale_parent),u_buffer_scale:new V(r,e.u_buffer_scale),u_fade_t:new V(r,e.u_fade_t),u_opacity:new V(r,e.u_opacity),u_image0:new Y(r,e.u_image0),u_image1:new Y(r,e.u_image1),u_brightness_low:new V(r,e.u_brightness_low),u_brightness_high:new V(r,e.u_brightness_high),u_saturation_factor:new V(r,e.u_saturation_factor),u_contrast_factor:new V(r,e.u_contrast_factor),u_spin_weights:new st(r,e.u_spin_weights)}),kb=(r,e,t,i,n)=>({u_matrix:r,u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:UA(n.paint.get("raster-saturation")),u_contrast_factor:VA(n.paint.get("raster-contrast")),u_spin_weights:OA(n.paint.get("raster-hue-rotate"))});function OA(r){r*=Math.PI/180;let e=Math.sin(r),t=Math.cos(r);return[(2*t+1)/3,(-Math.sqrt(3)*e-t+1)/3,(Math.sqrt(3)*e-t+1)/3]}function VA(r){return r>0?1/(1-r):1+r}function UA(r){return r>0?1-1/(1.001-r):-r}m();var Lb=(r,e)=>({u_is_size_zoom_constant:new Y(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(r,e.u_is_size_feature_constant),u_size_t:new V(r,e.u_size_t),u_size:new V(r,e.u_size),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pitch:new V(r,e.u_pitch),u_rotate_symbol:new Y(r,e.u_rotate_symbol),u_aspect_ratio:new V(r,e.u_aspect_ratio),u_fade_change:new V(r,e.u_fade_change),u_matrix:new te(r,e.u_matrix),u_label_plane_matrix:new te(r,e.u_label_plane_matrix),u_coord_matrix:new te(r,e.u_coord_matrix),u_is_text:new Y(r,e.u_is_text),u_pitch_with_map:new Y(r,e.u_pitch_with_map),u_texsize:new ee(r,e.u_texsize),u_texture:new Y(r,e.u_texture)}),Db=(r,e)=>({u_is_size_zoom_constant:new Y(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(r,e.u_is_size_feature_constant),u_size_t:new V(r,e.u_size_t),u_size:new V(r,e.u_size),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pitch:new V(r,e.u_pitch),u_rotate_symbol:new Y(r,e.u_rotate_symbol),u_aspect_ratio:new V(r,e.u_aspect_ratio),u_fade_change:new V(r,e.u_fade_change),u_matrix:new te(r,e.u_matrix),u_label_plane_matrix:new te(r,e.u_label_plane_matrix),u_coord_matrix:new te(r,e.u_coord_matrix),u_is_text:new Y(r,e.u_is_text),u_pitch_with_map:new Y(r,e.u_pitch_with_map),u_texsize:new ee(r,e.u_texsize),u_texture:new Y(r,e.u_texture),u_gamma_scale:new V(r,e.u_gamma_scale),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_is_halo:new Y(r,e.u_is_halo)}),zb=(r,e)=>({u_is_size_zoom_constant:new Y(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(r,e.u_is_size_feature_constant),u_size_t:new V(r,e.u_size_t),u_size:new V(r,e.u_size),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pitch:new V(r,e.u_pitch),u_rotate_symbol:new Y(r,e.u_rotate_symbol),u_aspect_ratio:new V(r,e.u_aspect_ratio),u_fade_change:new V(r,e.u_fade_change),u_matrix:new te(r,e.u_matrix),u_label_plane_matrix:new te(r,e.u_label_plane_matrix),u_coord_matrix:new te(r,e.u_coord_matrix),u_is_text:new Y(r,e.u_is_text),u_pitch_with_map:new Y(r,e.u_pitch_with_map),u_texsize:new ee(r,e.u_texsize),u_texsize_icon:new ee(r,e.u_texsize_icon),u_texture:new Y(r,e.u_texture),u_texture_icon:new Y(r,e.u_texture_icon),u_gamma_scale:new V(r,e.u_gamma_scale),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_is_halo:new Y(r,e.u_is_halo)}),Sh=(r,e,t,i,n,o,a,s,l,u)=>{let c=n.transform;return{u_is_size_zoom_constant:+(r==="constant"||r==="source"),u_is_size_feature_constant:+(r==="constant"||r==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+t,u_aspect_ratio:c.width/c.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+i,u_texsize:u,u_texture:0}},Ph=(r,e,t,i,n,o,a,s,l,u,c)=>{let p=n.transform;return O(Sh(r,e,t,i,n,o,a,s,l,u),{u_gamma_scale:i?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+c})},Fb=(r,e,t,i,n,o,a,s,l,u)=>O(Ph(r,e,t,i,n,o,a,s,!0,l,!0),{u_texsize_icon:u,u_texture_icon:1});m();var Rb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_opacity:new V(r,e.u_opacity),u_color:new Ct(r,e.u_color)}),Bb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_opacity:new V(r,e.u_opacity),u_image:new Y(r,e.u_image),u_pattern_tl_a:new ee(r,e.u_pattern_tl_a),u_pattern_br_a:new ee(r,e.u_pattern_br_a),u_pattern_tl_b:new ee(r,e.u_pattern_tl_b),u_pattern_br_b:new ee(r,e.u_pattern_br_b),u_texsize:new ee(r,e.u_texsize),u_mix:new V(r,e.u_mix),u_pattern_size_a:new ee(r,e.u_pattern_size_a),u_pattern_size_b:new ee(r,e.u_pattern_size_b),u_scale_a:new V(r,e.u_scale_a),u_scale_b:new V(r,e.u_scale_b),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_tile_units_to_pixels:new V(r,e.u_tile_units_to_pixels)}),Ob=(r,e,t)=>({u_matrix:r,u_opacity:e,u_color:t}),Vb=(r,e,t,i,n,o)=>O(Xx(i,o,t,n),{u_matrix:r,u_opacity:e});var Ub={fillExtrusion:Kx,fillExtrusionPattern:Jx,fill:Qx,fillPattern:eb,fillOutline:tb,fillOutlinePattern:rb,circle:ob,collisionBox:sb,collisionCircle:lb,debug:pb,clippingMask:hb,heatmap:fb,heatmapTexture:mb,hillshade:gb,hillshadePrepare:xb,line:vb,lineGradient:wb,linePattern:Sb,lineSDF:Pb,raster:Eb,symbolIcon:Lb,symbolSDF:Db,symbolTextAndIcon:zb,background:Rb,backgroundPattern:Bb,terrain:qx,terrainDepth:jx,terrainCoords:Zx};m();m();var Ql=class{constructor(e,t,i){this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};m();var NA={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},eu=class{constructor(e,t,i,n){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.context=e;let o=e.gl;this.buffer=o.createBuffer(),e.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){let n=this.attributes[i],o=t.attributes[n.name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,t,i){for(let n=0;n<this.attributes.length;n++){let o=this.attributes[n],a=t.attributes[o.name];a!==void 0&&e.vertexAttribPointer(a,o.components,e[NA[o.type]],!1,this.itemSize,o.offset+this.itemSize*(i||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};m();m();m();var Th=new WeakMap;function dn(r){var e;if(Th.has(r))return Th.get(r);{let t=(e=r.getParameter(r.VERSION))==null?void 0:e.startsWith("WebGL 2.0");return Th.set(r,t),t}}var xe=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},tu=class extends xe{getDefault(){return W.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},ru=class extends xe{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},iu=class extends xe{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},nu=class extends xe{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},ou=class extends xe{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},au=class extends xe{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},su=class extends xe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},lu=class extends xe{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},uu=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},cu=class extends xe{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},pu=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},hu=class extends xe{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},fu=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},mu=class extends xe{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},du=class extends xe{getDefault(){return W.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},yu=class extends xe{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},gu=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},xu=class extends xe{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},bu=class extends xe{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},_u=class extends xe{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},vu=class extends xe{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},wu=class extends xe{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},Su=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},Pu=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},Tu=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},Au=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},Mu=class extends xe{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},Iu=class extends xe{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;let t=this.gl;dn(t)?t.bindVertexArray(e):(i=t.getExtension("OES_vertex_array_object"))==null||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},Cu=class extends xe{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},Eu=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},ku=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},ca=class extends xe{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},Lu=class extends ca{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},Du=class extends ca{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},zu=class extends ca{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};var Fu=class{constructor(e,t,i,n,o){this.context=e,this.width=t,this.height=i;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Lu(e,s),n)this.depthAttachment=o?new zu(e,s):new Du(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}};m();var GA=0,Nb=1,qA=771,Ee=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};Ee.Replace=[Nb,GA];Ee.disabled=new Ee(Ee.Replace,W.transparent,[!1,!1,!1,!1]);Ee.unblended=new Ee(Ee.Replace,W.transparent,[!0,!0,!0,!0]);Ee.alphaBlended=new Ee([Nb,qA],W.transparent,[!0,!0,!0,!0]);var Ru=class{constructor(e){var t,i;if(this.gl=e,this.clearColor=new tu(this),this.clearDepth=new ru(this),this.clearStencil=new iu(this),this.colorMask=new nu(this),this.depthMask=new ou(this),this.stencilMask=new au(this),this.stencilFunc=new su(this),this.stencilOp=new lu(this),this.stencilTest=new uu(this),this.depthRange=new cu(this),this.depthTest=new pu(this),this.depthFunc=new hu(this),this.blend=new fu(this),this.blendFunc=new mu(this),this.blendColor=new du(this),this.blendEquation=new yu(this),this.cullFace=new gu(this),this.cullFaceSide=new xu(this),this.frontFace=new bu(this),this.program=new _u(this),this.activeTexture=new vu(this),this.viewport=new wu(this),this.bindFramebuffer=new Su(this),this.bindRenderbuffer=new Pu(this),this.bindTexture=new Tu(this),this.bindVertexBuffer=new Au(this),this.bindElementBuffer=new Mu(this),this.bindVertexArray=new Iu(this),this.pixelStoreUnpack=new Cu(this),this.pixelStoreUnpackPremultiplyAlpha=new Eu(this),this.pixelStoreUnpackFlipY=new ku(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),dn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let n=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:n==null?void 0:n.RGBA16F_EXT,this.RGB16F=(i=e.RGB16F)!=null?i:n==null?void 0:n.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let n=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=n==null?void 0:n.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new Ql(this,e,t)}createVertexBuffer(e,t,i){return new eu(this,e,t,i)}createRenderbuffer(e,t,i){let n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),o}createFramebuffer(e,t,i,n){return new Fu(this,e,t,i,n)}clear({color:e,depth:t,stencil:i}){let n=this.gl,o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof i<"u"&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Jt(e.blendFunction,Ee.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return dn(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return dn(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};m();var Q=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};Q.ReadOnly=!1;Q.ReadWrite=!0;Q.disabled=new Q(519,Q.ReadOnly,[0,1]);m();var he=class{constructor(e,t,i,n,o,a){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=o,this.pass=a}};he.disabled=new he({func:519,mask:0},0,0,7680,7680,7680);m();var le=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};le.disabled=new le(!1,1029,2305);le.backCCW=new le(!0,1029,2305);m();var Mh=oe(ye(),1);m();var Bu;function Ah(r,e,t,i,n,o,a){let s=r.context,l=s.gl,u=r.useProgram("collisionBox"),c=[],p=0,h=0;for(let v=0;v<i.length;v++){let b=i[v],w=e.getTile(b),S=w.getBucket(t);if(!S)continue;let P=b.posMatrix;(n[0]!==0||n[1]!==0)&&(P=r.translatePosMatrix(b.posMatrix,w,n,o));let k=a?S.textCollisionBox:S.iconCollisionBox,I=S.collisionCircleArray;if(I.length>0){let C=G.create(),M=P;G.mul(C,S.placementInvProjMatrix,r.transform.glCoordMatrix),G.mul(C,C,S.placementViewportMatrix),c.push({circleArray:I,circleOffset:h,transform:M,invTransform:C,coord:b}),p+=I.length/4,h=p}k&&u.draw(s,l.LINES,Q.disabled,he.disabled,r.colorModeForRenderPass(),le.disabled,ub(P,r.transform,w),r.style.map.terrain&&r.style.map.terrain.getTerrainData(b),t.id,k.layoutVertexBuffer,k.indexBuffer,k.segments,null,r.transform.zoom,null,null,k.collisionVertexBuffer)}if(!a||!c.length)return;let f=r.useProgram("collisionCircle"),d=new Os;d.resize(p*4),d._trim();let y=0;for(let v of c)for(let b=0;b<v.circleArray.length/4;b++){let w=b*4,S=v.circleArray[w+0],P=v.circleArray[w+1],k=v.circleArray[w+2],I=v.circleArray[w+3];d.emplace(y++,S,P,k,I,0),d.emplace(y++,S,P,k,I,1),d.emplace(y++,S,P,k,I,2),d.emplace(y++,S,P,k,I,3)}(!Bu||Bu.length<p*2)&&(Bu=jA(p));let g=s.createIndexBuffer(Bu,!0),x=s.createVertexBuffer(d,Ly.members,!0);for(let v of c){let b=cb(v.transform,v.invTransform,r.transform);f.draw(s,l.TRIANGLES,Q.disabled,he.disabled,r.colorModeForRenderPass(),le.disabled,b,r.style.map.terrain&&r.style.map.terrain.getTerrainData(v.coord),t.id,x,g,fe.simpleSegment(0,v.circleOffset*2,v.circleArray.length,v.circleArray.length/2),null,r.transform.zoom,null,null,null)}x.destroy(),g.destroy()}function jA(r){let e=r*2,t=new Us;t.resize(e),t._trim();for(let i=0;i<e;i++){let n=i*6;t.uint16[n+0]=i*4+0,t.uint16[n+1]=i*4+1,t.uint16[n+2]=i*4+2,t.uint16[n+3]=i*4+2,t.uint16[n+4]=i*4+3,t.uint16[n+5]=i*4+0}return t}var ZA=G.identity(new Float32Array(16));function jb(r,e,t,i,n){if(r.renderPass!=="translucent")return;let o=he.disabled,a=r.colorModeForRenderPass();(t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&$A(i,r,t,e,t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),n),t.paint.get("icon-opacity").constantOr(1)!==0&&Gb(r,e,t,i,!1,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),t.layout.get("icon-rotation-alignment"),t.layout.get("icon-pitch-alignment"),t.layout.get("icon-keep-upright"),o,a),t.paint.get("text-opacity").constantOr(1)!==0&&Gb(r,e,t,i,!0,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.layout.get("text-keep-upright"),o,a),e.map.showCollisionBoxes&&(Ah(r,e,t,i,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),!0),Ah(r,e,t,i,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),!1))}function HA(r,e,t,i,n,o){let{horizontalAlign:a,verticalAlign:s}=cl(r),l=-(a-.5)*e,u=-(s-.5)*t;return new Mh.default((l/n+i[0])*o,(u/n+i[1])*o)}function $A(r,e,t,i,n,o,a){let s=e.transform,l=n==="map",u=o==="map";for(let c of r){let p=i.getTile(c),h=p.getBucket(t);if(!h||!h.text||!h.text.segments.get().length)continue;let f=h.textSizeData,d=hi(f,s.zoom),y=He(p,1,e.transform.zoom),g=ta(c.posMatrix,u,l,e.transform,y),x=t.layout.get("icon-text-fit")!=="none"&&h.hasIconData();if(d){let v=Math.pow(2,s.zoom-p.tileID.overscaledZ),b=e.style.map.terrain?(w,S)=>e.style.map.terrain.getElevation(c,w,S):null;WA(h,l,u,a,s,g,c.posMatrix,v,d,x,b)}}}function WA(r,e,t,i,n,o,a,s,l,u,c){let p=r.text.placedSymbolArray,h=r.text.dynamicLayoutVertexArray,f=r.icon.dynamicLayoutVertexArray,d={};h.clear();for(let y=0;y<p.length;y++){let g=p.get(y),x=r.allowVerticalPlacement&&!g.placedOrientation,v=!g.hidden&&g.crossTileID&&!x?i[g.crossTileID]:null;if(!v)di(g.numGlyphs,h);else{let b=new Mh.default(g.anchorX,g.anchorY),w=xt(b,t?a:o,c),S=ra(n.cameraToCenterDistance,w.signedDistanceFromCamera),P=rn(r.textSizeData,l,g)*S/kr;t&&(P*=r.tilePixelRatio/s);let{width:k,height:I,anchor:C,textOffset:M,textBoxScale:F}=v,D=HA(C,k,I,M,F,P),E=t?xt(b.add(D),o,c).point:w.point.add(e?D.rotate(-n.angle):D),T=r.allowVerticalPlacement&&g.placedOrientation===2?Math.PI/2:0;for(let N=0;N<g.numGlyphs;N++)fi(h,E,T);u&&g.associatedIconIndex>=0&&(d[g.associatedIconIndex]={shiftedAnchor:E,angle:T})}}if(u){f.clear();let y=r.icon.placedSymbolArray;for(let g=0;g<y.length;g++){let x=y.get(g);if(x.hidden)di(x.numGlyphs,f);else{let v=d[g];if(!v)di(x.numGlyphs,f);else for(let b=0;b<x.numGlyphs;b++)fi(f,v.shiftedAnchor,v.angle)}}r.icon.dynamicLayoutVertexBuffer.updateData(f)}r.text.dynamicLayoutVertexBuffer.updateData(h)}function XA(r,e,t){return t.iconsInText&&e?"symbolTextAndIcon":r?"symbolSDF":"symbolIcon"}function Gb(r,e,t,i,n,o,a,s,l,u,c,p){let h=r.context,f=h.gl,d=r.transform,y=s==="map",g=l==="map",x=s!=="viewport"&&t.layout.get("symbol-placement")!=="point",v=y&&!g&&!x,b=!t.layout.get("symbol-sort-key").isConstant(),w=!1,S=r.depthModeForSublayer(0,Q.ReadOnly),P=t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"),k=[];for(let I of i){let C=e.getTile(I),M=C.getBucket(t);if(!M)continue;let F=n?M.text:M.icon;if(!F||!F.segments.get().length||!F.hasVisibleVertices)continue;let D=F.programConfigurations.get(t.id),E=n||M.sdfIcons,T=n?M.textSizeData:M.iconSizeData,N=g||d.pitch!==0,X=r.useProgram(XA(E,n,M),D),ie=hi(T,d.zoom),K=r.style.map.terrain&&r.style.map.terrain.getTerrainData(I),$,Je=[0,0],Oe,ue,Te=null,Ye;if(n){if(Oe=C.glyphAtlasTexture,ue=f.LINEAR,$=C.glyphAtlasTexture.size,M.iconsInText){Je=C.imageAtlasTexture.size,Te=C.imageAtlasTexture;let je=T.kind==="composite"||T.kind==="camera";Ye=N||r.options.rotating||r.options.zooming||je?f.LINEAR:f.NEAREST}}else{let je=t.layout.get("icon-size").constantOr(0)!==1||M.iconsNeedLinear;Oe=C.imageAtlasTexture,ue=E||r.options.rotating||r.options.zooming||je||N?f.LINEAR:f.NEAREST,$=C.imageAtlasTexture.size}let hr=He(C,1,r.transform.zoom),fr=ta(I.posMatrix,g,y,r.transform,hr),Lt=Bl(I.posMatrix,g,y,r.transform,hr),$t=P&&M.hasTextData(),Vr=t.layout.get("icon-text-fit")!=="none"&&$t&&M.hasIconData();if(x){let je=r.style.map.terrain?(Kt,Nr)=>r.style.map.terrain.getElevation(I,Kt,Nr):null,ut=t.layout.get("text-rotation-alignment")==="map";kg(M,I.posMatrix,r,n,fr,Lt,g,u,ut,je)}let Wt=r.translatePosMatrix(I.posMatrix,C,o,a),Xt=x||n&&P||Vr?ZA:fr,Qe=r.translatePosMatrix(Lt,C,o,a,!0),nt=E&&t.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,et;E?M.iconsInText?et=Fb(T.kind,ie,v,g,r,Wt,Xt,Qe,$,Je):et=Ph(T.kind,ie,v,g,r,Wt,Xt,Qe,n,$,!0):et=Sh(T.kind,ie,v,g,r,Wt,Xt,Qe,n,$);let Ur={program:X,buffers:F,uniformValues:et,atlasTexture:Oe,atlasTextureIcon:Te,atlasInterpolation:ue,atlasInterpolationIcon:Ye,isSDF:E,hasHalo:nt};if(b&&M.canOverlap){w=!0;let je=F.segments.get();for(let ut of je)k.push({segments:new fe([ut]),sortKey:ut.sortKey,state:Ur,terrainData:K})}else k.push({segments:F.segments,sortKey:0,state:Ur,terrainData:K})}w&&k.sort((I,C)=>I.sortKey-C.sortKey);for(let I of k){let C=I.state;if(h.activeTexture.set(f.TEXTURE0),C.atlasTexture.bind(C.atlasInterpolation,f.CLAMP_TO_EDGE),C.atlasTextureIcon&&(h.activeTexture.set(f.TEXTURE1),C.atlasTextureIcon&&C.atlasTextureIcon.bind(C.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),C.isSDF){let M=C.uniformValues;C.hasHalo&&(M.u_is_halo=1,qb(C.buffers,I.segments,t,r,C.program,S,c,p,M,I.terrainData)),M.u_is_halo=0}qb(C.buffers,I.segments,t,r,C.program,S,c,p,C.uniformValues,I.terrainData)}}function qb(r,e,t,i,n,o,a,s,l,u){let c=i.context,p=c.gl;n.draw(c,p.TRIANGLES,o,a,s,le.disabled,l,u,t.id,r.layoutVertexBuffer,r.indexBuffer,e,t.paint,i.transform.zoom,r.programConfigurations.get(t.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}m();function Zb(r,e,t,i){if(r.renderPass!=="translucent")return;let n=t.paint.get("circle-opacity"),o=t.paint.get("circle-stroke-width"),a=t.paint.get("circle-stroke-opacity"),s=!t.layout.get("circle-sort-key").isConstant();if(n.constantOr(1)===0&&(o.constantOr(1)===0||a.constantOr(1)===0))return;let l=r.context,u=l.gl,c=r.depthModeForSublayer(0,Q.ReadOnly),p=he.disabled,h=r.colorModeForRenderPass(),f=[];for(let d=0;d<i.length;d++){let y=i[d],g=e.getTile(y),x=g.getBucket(t);if(!x)continue;let v=x.programConfigurations.get(t.id),b=r.useProgram("circle",v),w=x.layoutVertexBuffer,S=x.indexBuffer,P=r.style.map.terrain&&r.style.map.terrain.getTerrainData(y),k=ab(r,y,g,t),I={programConfiguration:v,program:b,layoutVertexBuffer:w,indexBuffer:S,uniformValues:k,terrainData:P};if(s){let C=x.segments.get();for(let M of C)f.push({segments:new fe([M]),sortKey:M.sortKey,state:I})}else f.push({segments:x.segments,sortKey:0,state:I})}s&&f.sort((d,y)=>d.sortKey-y.sortKey);for(let d of f){let{programConfiguration:y,program:g,layoutVertexBuffer:x,indexBuffer:v,uniformValues:b,terrainData:w}=d.state,S=d.segments;g.draw(l,u.TRIANGLES,c,p,h,le.disabled,b,w,t.id,x,v,S,t.paint,r.transform.zoom,y)}}m();function Hb(r,e,t,i){if(t.paint.get("heatmap-opacity")!==0)if(r.renderPass==="offscreen"){let n=r.context,o=n.gl,a=he.disabled,s=new Ee([o.ONE,o.ONE],W.transparent,[!0,!0,!0,!0]);KA(n,r,t),n.clear({color:W.transparent});for(let l=0;l<i.length;l++){let u=i[l];if(e.hasRenderableParent(u))continue;let c=e.getTile(u),p=c.getBucket(t);if(!p)continue;let h=p.programConfigurations.get(t.id),f=r.useProgram("heatmap",h),{zoom:d}=r.transform;f.draw(n,o.TRIANGLES,Q.disabled,a,s,le.disabled,db(u.posMatrix,c,d,t.paint.get("heatmap-intensity")),null,t.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,t.paint,r.transform.zoom,h)}n.viewport.set([0,0,r.width,r.height])}else r.renderPass==="translucent"&&(r.context.setColorMode(r.colorModeForRenderPass()),YA(r,t))}function KA(r,e,t){let i=r.gl;r.activeTexture.set(i.TEXTURE1),r.viewport.set([0,0,e.width/4,e.height/4]);let n=t.heatmapFbo;if(n)i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),r.bindFramebuffer.set(n.framebuffer);else{let o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),n=t.heatmapFbo=r.createFramebuffer(e.width/4,e.height/4,!1,!1),JA(r,e,o,n)}}function JA(r,e,t,i){var s,l;let n=r.gl,o=(s=r.HALF_FLOAT)!=null?s:n.UNSIGNED_BYTE,a=(l=r.RGBA16F)!=null?l:n.RGBA;n.texImage2D(n.TEXTURE_2D,0,a,e.width/4,e.height/4,0,n.RGBA,o,null),i.colorAttachment.set(t)}function YA(r,e){let t=r.context,i=t.gl,n=e.heatmapFbo;if(!n)return;t.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),t.activeTexture.set(i.TEXTURE1);let o=e.colorRampTexture;o||(o=e.colorRampTexture=new _e(t,e.colorRamp,i.RGBA)),o.bind(i.LINEAR,i.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(t,i.TRIANGLES,Q.disabled,he.disabled,r.colorModeForRenderPass(),le.disabled,yb(r,e,0,1),null,e.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,e.paint,r.transform.zoom)}m();function $b(r,e,t,i){if(r.renderPass!=="translucent")return;let n=t.paint.get("line-opacity"),o=t.paint.get("line-width");if(n.constantOr(1)===0||o.constantOr(1)===0)return;let a=r.depthModeForSublayer(0,Q.ReadOnly),s=r.colorModeForRenderPass(),l=t.paint.get("line-dasharray"),u=t.paint.get("line-pattern"),c=u.constantOr(1),p=t.paint.get("line-gradient"),h=t.getCrossfadeParameters(),f=c?"linePattern":l?"lineSDF":p?"lineGradient":"line",d=r.context,y=d.gl,g=!0;for(let x of i){let v=e.getTile(x);if(c&&!v.patternsLoaded())continue;let b=v.getBucket(t);if(!b)continue;let w=b.programConfigurations.get(t.id),S=r.context.program.get(),P=r.useProgram(f,w),k=g||P.program!==S,I=r.style.map.terrain&&r.style.map.terrain.getTerrainData(x),C=u.constantOr(null);if(C&&v.imageAtlas){let D=v.imageAtlas,E=D.patternPositions[C.to.toString()],T=D.patternPositions[C.from.toString()];E&&T&&w.setConstantPatternPositions(E,T)}let M=I?x:null,F=c?Ab(r,v,t,h,M):l?Mb(r,v,t,l,h,M):p?Tb(r,v,t,b.lineClipsArray.length,M):Yl(r,v,t,M);if(c)d.activeTexture.set(y.TEXTURE0),v.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),w.updatePaintBuffers(h);else if(l&&(k||r.lineAtlas.dirty))d.activeTexture.set(y.TEXTURE0),r.lineAtlas.bind(d);else if(p){let D=b.gradients[t.id],E=D.texture;if(t.gradientVersion!==D.version){let T=256;if(t.stepInterpolant){let N=e.getSource().maxzoom,X=x.canonical.z===N?Math.ceil(1<<r.transform.maxZoom-x.canonical.z):1,$=b.maxLineLength/8192*1024*X;T=Ae(pf($),256,d.maxTextureSize)}D.gradient=Xs({expression:t.gradientExpression(),evaluationKey:"lineProgress",resolution:T,image:D.gradient||void 0,clips:b.lineClipsArray}),D.texture?D.texture.update(D.gradient):D.texture=new _e(d,D.gradient,y.RGBA),D.version=t.gradientVersion,E=D.texture}d.activeTexture.set(y.TEXTURE0),E.bind(t.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}P.draw(d,y.TRIANGLES,a,r.stencilModeForClipping(x),s,le.disabled,F,I,t.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,t.paint,r.transform.zoom,w,b.layoutVertexBuffer2),g=!1}}m();m();function Ou(r,e,t,i,n){if(!t||!i||!i.imageAtlas)return;let o=i.imageAtlas.patternPositions,a=o[t.to.toString()],s=o[t.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let l=n.getPaintProperty(e);a=o[l],s=o[l]}a&&s&&r.setConstantPatternPositions(a,s)}function Xb(r,e,t,i){let n=t.paint.get("fill-color"),o=t.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let a=r.colorModeForRenderPass(),s=t.paint.get("fill-pattern"),l=r.opaquePassEnabledForLayer()&&!s.constantOr(1)&&n.constantOr(W.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(r.renderPass===l){let u=r.depthModeForSublayer(1,r.renderPass==="opaque"?Q.ReadWrite:Q.ReadOnly);Wb(r,e,t,i,u,a,!1)}if(r.renderPass==="translucent"&&t.paint.get("fill-antialias")){let u=r.depthModeForSublayer(t.getPaintProperty("fill-outline-color")?2:0,Q.ReadOnly);Wb(r,e,t,i,u,a,!0)}}function Wb(r,e,t,i,n,o,a){let s=r.context.gl,l="fill-pattern",u=t.paint.get(l),c=u&&u.constantOr(1),p=t.getCrossfadeParameters(),h,f,d,y,g;a?(f=c&&!t.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=s.LINES):(f=c?"fillPattern":"fill",h=s.TRIANGLES);let x=u.constantOr(null);for(let v of i){let b=e.getTile(v);if(c&&!b.patternsLoaded())continue;let w=b.getBucket(t);if(!w)continue;let S=w.programConfigurations.get(t.id),P=r.useProgram(f,S),k=r.style.map.terrain&&r.style.map.terrain.getTerrainData(v);c&&(r.context.activeTexture.set(s.TEXTURE0),b.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),S.updatePaintBuffers(p)),Ou(S,l,x,b,t);let I=k?v:null,C=I?I.posMatrix:v.posMatrix,M=r.translatePosMatrix(C,b,t.paint.get("fill-translate"),t.paint.get("fill-translate-anchor"));if(!a)y=w.indexBuffer,g=w.segments,d=c?_h(M,r,p,b):bh(M);else{y=w.indexBuffer2,g=w.segments2;let F=[s.drawingBufferWidth,s.drawingBufferHeight];d=f==="fillOutlinePattern"&&c?nb(M,r,p,b,F):ib(M,F)}P.draw(r.context,h,n,r.stencilModeForClipping(v),o,le.disabled,d,k,t.id,w.layoutVertexBuffer,y,g,t.paint,r.transform.zoom,S)}}m();function Kb(r,e,t,i){let n=t.paint.get("fill-extrusion-opacity");if(n!==0&&r.renderPass==="translucent"){let o=new Q(r.context.gl.LEQUAL,Q.ReadWrite,r.depthRangeFor3D);if(n===1&&!t.paint.get("fill-extrusion-pattern").constantOr(1)){let a=r.colorModeForRenderPass();Ih(r,e,t,i,o,he.disabled,a)}else Ih(r,e,t,i,o,he.disabled,Ee.disabled),Ih(r,e,t,i,o,r.stencilModeFor3D(),r.colorModeForRenderPass())}}function Ih(r,e,t,i,n,o,a){let s=r.context,l=s.gl,u="fill-extrusion-pattern",c=t.paint.get(u),p=c.constantOr(1),h=t.getCrossfadeParameters(),f=t.paint.get("fill-extrusion-opacity"),d=c.constantOr(null);for(let y of i){let g=e.getTile(y),x=g.getBucket(t);if(!x)continue;let v=r.style.map.terrain&&r.style.map.terrain.getTerrainData(y),b=x.programConfigurations.get(t.id),w=r.useProgram(p?"fillExtrusionPattern":"fillExtrusion",b);p&&(r.context.activeTexture.set(l.TEXTURE0),g.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),b.updatePaintBuffers(h)),Ou(b,u,d,g,t);let S=r.translatePosMatrix(y.posMatrix,g,t.paint.get("fill-extrusion-translate"),t.paint.get("fill-extrusion-translate-anchor")),P=t.paint.get("fill-extrusion-vertical-gradient"),k=p?Yx(S,r,P,f,y,h,g):xh(S,r,P,f);w.draw(s,s.gl.TRIANGLES,n,o,a,le.backCCW,k,v,t.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,t.paint,r.transform.zoom,b,r.style.map.terrain&&x.centroidVertexBuffer)}}m();function Jb(r,e,t,i){if(r.renderPass!=="offscreen"&&r.renderPass!=="translucent")return;let n=r.context,o=r.depthModeForSublayer(0,Q.ReadOnly),a=r.colorModeForRenderPass(),[s,l]=r.renderPass==="translucent"?r.stencilConfigForOverlap(i):[{},i];for(let u of l){let c=e.getTile(u);typeof c.needsHillshadePrepare<"u"&&c.needsHillshadePrepare&&r.renderPass==="offscreen"?eM(r,c,t,o,he.disabled,a):r.renderPass==="translucent"&&QA(r,u,c,t,o,s[u.overscaledZ],a)}n.viewport.set([0,0,r.width,r.height])}function QA(r,e,t,i,n,o,a){let s=r.context,l=s.gl,u=t.fbo;if(!u)return;let c=r.useProgram("hillshade"),p=r.style.map.terrain&&r.style.map.terrain.getTerrainData(e);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get());let h=p?e:null;c.draw(s,l.TRIANGLES,n,o,a,le.disabled,bb(r,t,i,h),p,i.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments)}function eM(r,e,t,i,n,o){let a=r.context,s=a.gl,l=e.dem;if(l&&l.data){let u=l.dim,c=l.stride,p=l.getPixels();if(a.activeTexture.set(s.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||r.getTileTexture(c),e.demTexture){let f=e.demTexture;f.update(p,{premultiply:!1}),f.bind(s.NEAREST,s.CLAMP_TO_EDGE)}else e.demTexture=new _e(a,p,s.RGBA,{premultiply:!1}),e.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);a.activeTexture.set(s.TEXTURE0);let h=e.fbo;if(!h){let f=new _e(a,{width:u,height:u,data:null},s.RGBA);f.bind(s.LINEAR,s.CLAMP_TO_EDGE),h=e.fbo=a.createFramebuffer(u,u,!0,!1),h.colorAttachment.set(f.texture)}a.bindFramebuffer.set(h.framebuffer),a.viewport.set([0,0,u,u]),r.useProgram("hillshadePrepare").draw(a,s.TRIANGLES,i,n,o,le.disabled,_b(e.tileID,l),null,t.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments),e.needsHillshadePrepare=!1}}m();function Yb(r,e,t,i){if(r.renderPass!=="translucent"||t.paint.get("raster-opacity")===0||!i.length)return;let n=r.context,o=n.gl,a=e.getSource(),s=r.useProgram("raster"),l=r.colorModeForRenderPass(),[u,c]=a instanceof Et?[{},i]:r.stencilConfigForOverlap(i),p=c[c.length-1].overscaledZ,h=!r.options.moving;for(let f of c){let d=r.depthModeForSublayer(f.overscaledZ-p,t.paint.get("raster-opacity")===1?Q.ReadWrite:Q.ReadOnly,o.LESS),y=e.getTile(f);y.registerFadeDuration(t.paint.get("raster-fade-duration"));let g=e.findLoadedParent(f,0),x=tM(y,g,e,t,r.transform,r.style.map.terrain),v,b,w=t.paint.get("raster-resampling")==="nearest"?o.NEAREST:o.LINEAR;n.activeTexture.set(o.TEXTURE0),y.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(o.TEXTURE1),g?(g.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),v=Math.pow(2,g.tileID.overscaledZ-y.tileID.overscaledZ),b=[y.tileID.canonical.x*v%1,y.tileID.canonical.y*v%1]):y.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);let S=r.style.map.terrain&&r.style.map.terrain.getTerrainData(f),P=S?f:null,k=P?P.posMatrix:r.transform.calculatePosMatrix(f.toUnwrapped(),h),I=kb(k,b||[0,0],v||1,x,t);a instanceof Et?s.draw(n,o.TRIANGLES,d,he.disabled,l,le.disabled,I,S,t.id,a.boundsBuffer,r.quadTriangleIndexBuffer,a.boundsSegments):s.draw(n,o.TRIANGLES,d,u[f.overscaledZ],l,le.disabled,I,S,t.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments)}}function tM(r,e,t,i,n,o){let a=i.paint.get("raster-fade-duration");if(!o&&a>0){let s=J.now(),l=(s-r.timeAdded)/a,u=e?(s-e.timeAdded)/a:-1,c=t.getSource(),p=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!e||Math.abs(e.tileID.overscaledZ-p)>Math.abs(r.tileID.overscaledZ-p),f=h&&r.refreshedUponExpiration?1:Ae(h?l:1-u,0,1);return r.refreshedUponExpiration&&l>=1&&(r.refreshedUponExpiration=!1),e?{opacity:1,mix:1-f}:{opacity:f,mix:0}}else return{opacity:1,mix:0}}m();function Qb(r,e,t,i){let n=t.paint.get("background-color"),o=t.paint.get("background-opacity");if(o===0)return;let a=r.context,s=a.gl,l=r.transform,u=l.tileSize,c=t.paint.get("background-pattern");if(r.isPatternMissing(c))return;let p=!c&&n.a===1&&o===1&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==p)return;let h=he.disabled,f=r.depthModeForSublayer(0,p==="opaque"?Q.ReadWrite:Q.ReadOnly),d=r.colorModeForRenderPass(),y=r.useProgram(c?"backgroundPattern":"background"),g=i||l.coveringTiles({tileSize:u,terrain:r.style.map.terrain});c&&(a.activeTexture.set(s.TEXTURE0),r.imageManager.bind(r.context));let x=t.getCrossfadeParameters();for(let v of g){let b=i?v.posMatrix:r.transform.calculatePosMatrix(v.toUnwrapped()),w=c?Vb(b,o,r,c,{tileID:v,tileSize:u},x):Ob(b,o,n),S=r.style.map.terrain&&r.style.map.terrain.getTerrainData(v);y.draw(a,s.TRIANGLES,f,h,d,le.disabled,w,S,t.id,r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}m();var rM=new W(1,0,0,1),iM=new W(0,1,0,1),nM=new W(0,0,1,1),oM=new W(1,0,1,1),aM=new W(0,1,1,1);function r_(r){let e=r.transform.padding,t=3;e_(r,r.transform.height-(e.top||0),t,rM),e_(r,e.bottom||0,t,iM),t_(r,e.left||0,t,nM),t_(r,r.transform.width-(e.right||0),t,oM);let i=r.transform.centerPoint;sM(r,i.x,r.transform.height-i.y,aM)}function sM(r,e,t,i){Vu(r,e-2/2,t-20/2,2,20,i),Vu(r,e-20/2,t-2/2,20,2,i)}function e_(r,e,t,i){Vu(r,0,e+t/2,r.transform.width,t,i)}function t_(r,e,t,i){Vu(r,e-t/2,0,t,r.transform.height,i)}function Vu(r,e,t,i,n,o){let a=r.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*r.pixelRatio,t*r.pixelRatio,i*r.pixelRatio,n*r.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function i_(r,e,t){for(let i=0;i<t.length;i++)lM(r,e,t[i])}function lM(r,e,t){let i=r.context,n=i.gl,o=t.posMatrix,a=r.useProgram("debug"),s=Q.disabled,l=he.disabled,u=r.colorModeForRenderPass(),c="$debug",p=r.style.map.terrain&&r.style.map.terrain.getTerrainData(t);i.activeTexture.set(n.TEXTURE0);let h=e.getTileByID(t.key).latestRawTileData,f=h&&h.byteLength||0,d=Math.floor(f/1024),y=e.getTile(t).tileSize,g=512/Math.min(y,512)*(t.overscaledZ/r.transform.zoom)*.5,x=t.canonical.toString();t.overscaledZ!==t.canonical.z&&(x+=" => ".concat(t.overscaledZ));let v="".concat(x," ").concat(d,"kB");uM(r,v),a.draw(i,n.TRIANGLES,s,l,Ee.alphaBlended,le.disabled,vh(o,W.transparent,g),null,c,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments),a.draw(i,n.LINE_STRIP,s,l,u,le.disabled,vh(o,W.red),p,c,r.debugBuffer,r.tileBorderIndexBuffer,r.debugSegments)}function uM(r,e){r.initDebugOverlayCanvas();let t=r.debugOverlayCanvas,i=r.context.gl,n=r.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,t.width,t.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),r.debugOverlayTexture.update(t),r.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}function n_(r,e){let t=null,n=Object.values(r._layers).flatMap(l=>l.source&&!l.isHidden(e)?[r.sourceCaches[l.source]]:[]),o=n.filter(l=>l.getSource().type==="vector"),a=n.filter(l=>l.getSource().type!=="vector"),s=l=>{(!t||t.getSource().maxzoom<l.getSource().maxzoom)&&(t=l)};return o.forEach(l=>s(l)),t||a.forEach(l=>s(l)),t}m();function o_(r,e,t){let i=r.context,n=t.implementation;if(r.renderPass==="offscreen"){let o=n.prerender;o&&(r.setCustomLayerDefaults(),i.setColorMode(r.colorModeForRenderPass()),o.call(n,i.gl,r.transform.customLayerMatrix()),i.setDirty(),r.setBaseState())}else if(r.renderPass==="translucent"){r.setCustomLayerDefaults(),i.setColorMode(r.colorModeForRenderPass()),i.setStencilMode(he.disabled);let o=n.renderingMode==="3d"?new Q(r.context.gl.LEQUAL,Q.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,Q.ReadOnly);i.setDepthMode(o),n.render(i.gl,r.transform.customLayerMatrix()),i.setDirty(),r.setBaseState(),i.bindFramebuffer.set(null)}}m();function a_(r,e){let t=r.context,i=t.gl,n=Ee.unblended,o=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),a=e.getTerrainMesh(),s=e.sourceCache.getRenderableTiles(),l=r.useProgram("terrainDepth");t.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:W.transparent,depth:1});for(let u of s){let c=e.getTerrainData(u.tileID),p=r.transform.calculatePosMatrix(u.tileID.toUnwrapped()),h=$x(p,e.getMeshFrameDelta(r.transform.zoom));l.draw(t,i.TRIANGLES,o,he.disabled,n,le.backCCW,h,c,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}function s_(r,e){let t=r.context,i=t.gl,n=Ee.unblended,o=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),a=e.getTerrainMesh(),s=e.getCoordsTexture(),l=e.sourceCache.getRenderableTiles(),u=r.useProgram("terrainCoords");t.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:W.transparent,depth:1}),e.coordsIndex=[];for(let c of l){let p=e.getTerrainData(c.tileID);t.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,s.texture);let h=r.transform.calculatePosMatrix(c.tileID.toUnwrapped()),f=Wx(h,255-e.coordsIndex.length,e.getMeshFrameDelta(r.transform.zoom));u.draw(t,i.TRIANGLES,o,he.disabled,n,le.backCCW,f,p,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),e.coordsIndex.push(c.tileID.key)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}function Ch(r,e,t){let i=r.context,n=i.gl,o=r.colorModeForRenderPass(),a=new Q(n.LEQUAL,Q.ReadWrite,r.depthRangeFor3D),s=r.useProgram("terrain"),l=e.getTerrainMesh();i.bindFramebuffer.set(null),i.viewport.set([0,0,r.width,r.height]);for(let u of t){let c=r.renderToTexture.getTexture(u),p=e.getTerrainData(u.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,c.texture);let h=r.transform.calculatePosMatrix(u.tileID.toUnwrapped()),f=Hx(h,e.getMeshFrameDelta(r.transform.zoom));s.draw(i,n.TRIANGLES,a,he.disabled,o,le.backCCW,f,p,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}var Uu=class{constructor(e,t){this.context=new Ru(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:G.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=lr.maxUnderzooming+lr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new fn}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let n of this.style._order)this.style._layers[n].resize()}setup(){let e=this.context,t=new Tr;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,$l.members),this.tileExtentSegments=fe.simpleSegment(0,0,4,2);let i=new Tr;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(i,$l.members),this.debugSegments=fe.simpleSegment(0,0,4,5);let n=new Zi;n.emplaceBack(0,0,0,0),n.emplaceBack(8192,0,8192,0),n.emplaceBack(0,8192,0,8192),n.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(n,Fr.members),this.rasterBoundsSegments=fe.simpleSegment(0,0,4,2);let o=new Tr;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,$l.members),this.viewportSegments=fe.simpleSegment(0,0,4,2);let a=new xo;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);let s=new rt;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new he({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=G.create();G.ortho(i,0,this.width,this.height,0,0,1),G.scale(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,t.TRIANGLES,Q.disabled,this.stencilClearMode,Ee.disabled,le.disabled,wh(i),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source;let i=this.context,n=i.gl;this.nextStencilID+t.length>256&&this.clearStencil(),i.setColorMode(Ee.disabled),i.setDepthMode(Q.disabled);let o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let a of t){let s=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a);o.draw(i,n.TRIANGLES,Q.disabled,new he({func:n.ALWAYS,mask:0},s,255,n.KEEP,n.KEEP,n.REPLACE),Ee.disabled,le.disabled,wh(a.posMatrix),l,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new he({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new he({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){let t=this.context.gl,i=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),n=i[i.length-1].overscaledZ,o=i[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+n]=new he({func:t.GEQUAL,mask:255},s+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=o,[a,i]}return[{[n]:he.disabled},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Ee([e.CONSTANT_COLOR,e.ONE],new W(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ee.unblended:Ee.alphaBlended}depthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return Q.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Q(i||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(J.now()),this.imageManager.beginFrame();let i=this.style._order,n=this.style.sourceCaches,o={},a={},s={};for(let l in n){let u=n[l];u.used&&u.prepare(this.context),o[l]=u.getVisibleCoordinates(),a[l]=o[l].slice().reverse(),s[l]=u.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let l=0;l<i.length;l++){let u=i[l];if(this.style._layers[u].is3D()){this.opaquePassCutoff=l;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let l of i){let u=this.style._layers[l];if(!u.hasOffscreenPass()||u.isHidden(this.transform.zoom))continue;let c=a[u.source];u.type!=="custom"&&!c.length||this.renderLayer(this,n[u.source],u,c)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?W.black:W.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let l=this.style._layers[i[this.currentLayer]],u=n[l.source],c=o[l.source];this._renderTileClippingMasks(l,c),this.renderLayer(this,u,l,c)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let l=this.style._layers[i[this.currentLayer]],u=n[l.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(l))continue;let c=(l.type==="symbol"?s:a)[l.source];this._renderTileClippingMasks(l,o[l.source]),this.renderLayer(this,u,l,c)}if(this.options.showTileBoundaries){let l=n_(this.style,this.transform.zoom);l&&i_(this,l,l.getVisibleCoordinates())}this.options.showPadding&&r_(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,i=this.transform.projMatrix,n=this.terrainFacilitator.dirty;n||(n=e?!G.exactEquals(t,i):!G.equals(t,i)),n||(n=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),n&&(G.copy(t,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,a_(this,this.style.map.terrain),s_(this,this.style.map.terrain))}renderLayer(e,t,i,n){if(!i.isHidden(this.transform.zoom)&&!(i.type!=="background"&&i.type!=="custom"&&!(n||[]).length))switch(this.id=i.id,i.type){case"symbol":jb(e,t,i,n,this.style.placement.variableOffsets);break;case"circle":Zb(e,t,i,n);break;case"heatmap":Hb(e,t,i,n);break;case"line":$b(e,t,i,n);break;case"fill":Xb(e,t,i,n);break;case"fill-extrusion":Kb(e,t,i,n);break;case"hillshade":Jb(e,t,i,n);break;case"raster":Yb(e,t,i,n);break;case"background":Qb(e,t,i,n);break;case"custom":o_(e,t,i);break}}translatePosMatrix(e,t,i,n,o){if(!i[0]&&!i[1])return e;let a=o?n==="map"?this.transform.angle:0:n==="viewport"?-this.transform.angle:0;if(a){let u=Math.sin(a),c=Math.cos(a);i=[i[0]*c-i[1]*u,i[0]*u+i[1]*c]}let s=[o?i[0]:He(t,i[0],this.transform.zoom),o?i[1]:He(t,i[1],this.transform.zoom),0],l=new Float32Array(16);return G.translate(l,e,s),l}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t){this.cache=this.cache||{};let i=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new Kl(this.context,gi[e],t,Ub[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new _e(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};m();var $e=oe(ye(),1);m();var Nu=class r{constructor(e,t){this.points=e;this.planes=t}static fromInvProjectionMatrix(e,t,i){let n=[[-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]],o=Math.pow(2,i),a=n.map(u=>{u=Ge.transformMat4([],u,e);let c=1/u[3]/t*o;return Ge.mul(u,u,[c,c,1/u[3],c])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(u=>{let c=yt.sub([],a[u[0]],a[u[1]]),p=yt.sub([],a[u[2]],a[u[1]]),h=yt.normalize([],yt.cross([],c,p)),f=-yt.dot(h,a[u[1]]);return h.concat(f)});return new r(a,l)}},pa=class r{constructor(e,t){this.min=e,this.max=t,this.center=yt.scale([],yt.add([],this.min,this.max),.5)}quadrant(e){let t=[e%2===0,e<2],i=yt.clone(this.min),n=yt.clone(this.max);for(let o=0;o<t.length;o++)i[o]=t[o]?this.min[o]:this.center[o],n[o]=t[o]?this.center[o]:this.max[o];return n[2]=this.max[2],new r(i,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let t=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],i=!0;for(let n=0;n<e.planes.length;n++){let o=e.planes[n],a=0;for(let s=0;s<t.length;s++)Ge.dot(o,t[s])>=0&&a++;if(a===0)return 0;a!==t.length&&(i=!1)}if(i)return 2;for(let n=0;n<3;n++){let o=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;s<e.points.length;s++){let l=e.points[s][n]-this.min[n];o=Math.min(o,l),a=Math.max(a,l)}if(a<0||o>this.max[n]-this.min[n])return 0}return 1}};m();var l_=oe(ye(),1);var ha=class r{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(e,t,i){return t.top!=null&&e.top!=null&&(this.top=Se.number(e.top,t.top,i)),t.bottom!=null&&e.bottom!=null&&(this.bottom=Se.number(e.bottom,t.bottom,i)),t.left!=null&&e.left!=null&&(this.left=Se.number(e.left,t.left,i)),t.right!=null&&e.right!=null&&(this.right=Se.number(e.right,t.right,i)),this}getCenter(e,t){let i=Ae((this.left+e-this.right)/2,0,e),n=Ae((this.top+t-this.bottom)/2,0,t);return new l_.default(i,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new r(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};var Gu=85.051129,qu=class r{constructor(e,t,i,n,o){this.tileSize=512,this._renderWorldCopies=o===void 0?!0:!!o,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=i==null?0:i,this._maxPitch=n==null?60:n,this.setMaxBounds(),this.width=0,this.height=0,this._center=new re(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ha,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new r(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new $e.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let t=-Yt(e,-180,180)*Math.PI/180;this.angle!==t&&(this._unmodified=!1,this.angle=t,this._calcMatrices(),this.rotationMatrix=wo.create(),wo.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let t=Ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.tileZoom=Math.max(0,Math.floor(t)),this.scale=this.zoomScale(t),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(e){let t=[new un(0,e)];if(this._renderWorldCopies){let i=this.pointCoordinate(new $e.default(0,0)),n=this.pointCoordinate(new $e.default(this.width,0)),o=this.pointCoordinate(new $e.default(this.width,this.height)),a=this.pointCoordinate(new $e.default(0,this.height)),s=Math.floor(Math.min(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),u=1;for(let c=s-u;c<=l+u;c++)c!==0&&t.push(new un(c,e))}return t}coveringTiles(e){var x,v;let t=this.coveringZoomLevel(e),i=t;if(e.minzoom!==void 0&&t<e.minzoom)return[];e.maxzoom!==void 0&&t>e.maxzoom&&(t=e.maxzoom);let n=this.pointCoordinate(this.getCameraPoint()),o=ze.fromLngLat(this.center),a=Math.pow(2,t),s=[a*n.x,a*n.y,0],l=[a*o.x,a*o.y,0],u=Nu.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t),c=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(c=t);let p=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,h=b=>({aabb:new pa([b*a,0,0],[(b+1)*a,a,0]),zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),f=[],d=[],y=t,g=e.reparseOverscaled?i:t;if(this._renderWorldCopies)for(let b=1;b<=3;b++)f.push(h(-b)),f.push(h(b));for(f.push(h(0));f.length>0;){let b=f.pop(),w=b.x,S=b.y,P=b.fullyVisible;if(!P){let D=b.aabb.intersects(u);if(D===0)continue;P=D===2}let k=e.terrain?s:l,I=b.aabb.distanceX(k),C=b.aabb.distanceY(k),M=Math.max(Math.abs(I),Math.abs(C)),F=p+(1<<y-b.zoom)-2;if(b.zoom===y||M>F&&b.zoom>=c){let D=y-b.zoom,E=s[0]-.5-(w<<D),T=s[1]-.5-(S<<D);d.push({tileID:new Ke(b.zoom===y?g:b.zoom,b.wrap,b.zoom,w,S),distanceSq:Wi.sqrLen([l[0]-.5-w,l[1]-.5-S]),tileDistanceToCamera:Math.sqrt(E*E+T*T)});continue}for(let D=0;D<4;D++){let E=(w<<1)+D%2,T=(S<<1)+(D>>1),N=b.zoom+1,X=b.aabb.quadrant(D);if(e.terrain){let ie=new Ke(N,b.wrap,N,E,T),K=e.terrain.getMinMaxElevation(ie),$=(x=K.minElevation)!=null?x:this.elevation,Je=(v=K.maxElevation)!=null?v:this.elevation;X=new pa([X.min[0],X.min[1],$],[X.max[0],X.max[1],Je])}f.push({aabb:X,zoom:N,x:E,y:T,wrap:b.wrap,fullyVisible:P})}}return d.sort((b,w)=>b.distanceSq-w.distanceSq).map(b=>b.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let t=Ae(e.lat,-Gu,Gu);return new $e.default(Dr(e.lng)*this.worldSize,zr(t)*this.worldSize)}unproject(e){return new ze(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){let e=this.pointLocation(this.getCameraPoint()),t=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter;return{lngLat:e,altitude:t+this.elevation}}recalculateZoom(e){let t=this.elevation,i=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,n=this.pointLocation(this.centerPoint,e),o=e.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-o))return;let s=i+t-o,c=Math.cos(this._pitch)*this.cameraToCenterDistance/s/El(1,n.lat)/this.tileSize,p=this.scaleZoom(c);this._elevation=o,this._center=n,this.zoom=p}setLocationAtPoint(e,t){let i=this.pointCoordinate(t),n=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new ze(o.x-(i.x-n.x),o.y-(i.y-n.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),t.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(e){return ze.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,t){if(t){let y=t.pointCoordinate(e);if(y!=null)return y}let i=0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];Ge.transformMat4(n,n,this.pixelMatrixInverse),Ge.transformMat4(o,o,this.pixelMatrixInverse);let a=n[3],s=o[3],l=n[0]/a,u=o[0]/s,c=n[1]/a,p=o[1]/s,h=n[2]/a,f=o[2]/s,d=h===f?0:(i-h)/(f-h);return new ze(Se.number(l,u,d)/this.worldSize,Se.number(c,p,d)/this.worldSize)}coordinatePoint(e,t=0,i=this.pixelMatrix){let n=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Ge.transformMat4(n,n,i),new $e.default(n[0]/n[3],n[1]/n[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new lt().extend(this.pointLocation(new $e.default(0,e))).extend(this.pointLocation(new $e.default(this.width,e))).extend(this.pointLocation(new $e.default(this.width,this.height))).extend(this.pointLocation(new $e.default(0,this.height)))}getMaxBounds(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new lt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-Gu,Gu])}calculatePosMatrix(e,t=!1){let i=e.key,n=t?this._alignedPosMatrixCache:this._posMatrixCache;if(n[i])return n[i];let o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=G.identity(new Float64Array(16));return G.translate(l,l,[s*a,o.y*a,0]),G.scale(l,l,[a/8192,a/8192,1]),G.multiply(l,t?this.alignedProjMatrix:this.projMatrix,l),n[i]=new Float32Array(l),n[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,t){t=Ae(+t,this.minZoom,this.maxZoom);let i={center:new re(e.lng,e.lat),zoom:t},n=this.lngRange;if(!this._renderWorldCopies&&n===null){let b=179.9999999999;n=[-b,b]}let o=this.tileSize*this.zoomScale(i.zoom),a=0,s=o,l=0,u=o,c=0,p=0,{x:h,y:f}=this.size;if(this.latRange){let b=this.latRange;a=zr(b[1])*o,s=zr(b[0])*o,s-a<f&&(c=f/(s-a))}n&&(l=Yt(Dr(n[0])*o,0,o),u=Yt(Dr(n[1])*o,0,o),u<l&&(u+=o),u-l<h&&(p=h/(u-l)));let{x:d,y}=this.project.call({worldSize:o},e),g,x,v=Math.max(p||0,c||0);if(v){let b=new $e.default(p?(u+l)/2:d,c?(s+a)/2:y);return i.center=this.unproject.call({worldSize:o},b).wrap(),i.zoom+=this.scaleZoom(v),i}if(this.latRange){let b=f/2;y-b<a&&(x=a+b),y+b>s&&(x=s-b)}if(n){let b=(l+u)/2,w=d;this._renderWorldCopies&&(w=Yt(d,b-o/2,b+o/2));let S=h/2;w-S<l&&(g=l+S),w+S>u&&(g=u-S)}if(g!==void 0||x!==void 0){let b=new $e.default(g!=null?g:d,x!=null?x:y);i.center=this.unproject.call({worldSize:o},b).wrap()}return i}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.center=t,this.zoom=i,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this._fov/2,t=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(e)*this.height,this._pixelPerMeter=El(1,this.center.lat)*this.worldSize;let o=G.identity(new Float64Array(16));G.scale(o,o,[this.width/2,-this.height/2,1]),G.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=G.identity(new Float64Array(16)),G.scale(o,o,[1,-1,1]),G.translate(o,o,[-1,-1,0]),G.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let a=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),s=Math.min(this.elevation,this.minElevationForCurrentTile),l=a-s*this._pixelPerMeter/Math.cos(this._pitch),u=s<0?l:a,c=Math.PI/2+this._pitch,p=this._fov*(.5+t.y/this.height),h=Math.sin(p)*u/Math.sin(Ae(Math.PI-c-p,.01,Math.PI-.01)),f=this.getHorizon(),y=2*Math.atan(f/this.cameraToCenterDistance)*(.5+t.y/(f*2)),g=Math.sin(y)*u/Math.sin(Ae(Math.PI-c-y,.01,Math.PI-.01)),x=Math.min(h,g),v=(Math.cos(Math.PI/2-this._pitch)*x+u)*1.01,b=this.height/50;o=new Float64Array(16),G.perspective(o,this._fov,this.width/this.height,b,v),o[8]=-t.x*2/this.width,o[9]=t.y*2/this.height,G.scale(o,o,[1,-1,1]),G.translate(o,o,[0,0,-this.cameraToCenterDistance]),G.rotateX(o,o,this._pitch),G.rotateZ(o,o,this.angle),G.translate(o,o,[-i,-n,0]),this.mercatorMatrix=G.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),G.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=G.multiply(new Float64Array(16),this.labelPlaneMatrix,o),G.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=G.invert([],o),this.pixelMatrix3D=G.multiply(new Float64Array(16),this.labelPlaneMatrix,o);let w=this.width%2/2,S=this.height%2/2,P=Math.cos(this.angle),k=Math.sin(this.angle),I=i-Math.round(i)+P*w+k*S,C=n-Math.round(n)+P*S+k*w,M=new Float64Array(o);if(G.translate(M,M,[I>.5?I-1:I,C>.5?C-1:C,0]),this.alignedProjMatrix=M,o=G.invert(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new $e.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Ge.transformMat4(t,t,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=this._pitch,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new $e.default(0,t))}getCameraQueryGeometry(e){let t=this.getCameraPoint();if(e.length===1)return[e[0],t];{let i=t.x,n=t.y,o=t.x,a=t.y;for(let s of e)i=Math.min(i,s.x),n=Math.min(n,s.y),o=Math.max(o,s.x),a=Math.max(a,s.y);return[new $e.default(i,n),new $e.default(o,n),new $e.default(o,a),new $e.default(i,a),new $e.default(i,n)]}}lngLatToCameraDepth(e,t){let i=this.locationCoordinate(e),n=[i.x*this.worldSize,i.y*this.worldSize,t,1];return Ge.transformMat4(n,n,this.projMatrix),n[2]/n[3]}};m();m();function ju(r,e){let t=!1,i=null,n=null,o,a=()=>{i=null,t&&(r.apply(n,o),i=setTimeout(a,e),t=!1)};return(...s)=>(t=!0,n=this,o=s,i||a(),i)}var fa=class{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(t=i)}),(t&&t[1]||"").split("/")}return e.split("/")};this._onHashChange=()=>{let e=this._getCurrentHash();if(e.length>=3&&!e.some(t=>isNaN(t))){let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1};this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch(t){}};this._updateHash=ju(this._updateHashUnthrottled,30*1e3/100);this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),a=Math.round(t.lng*o)/o,s=Math.round(t.lat*o)/o,l=this._map.getBearing(),u=this._map.getPitch(),c="";if(e?c+="/".concat(a,"/").concat(s,"/").concat(i):c+="".concat(i,"/").concat(s,"/").concat(a),(l||u)&&(c+="/".concat(Math.round(l*10)/10)),u&&(c+="/".concat(Math.round(u))),this._hashName){let p=this._hashName,h=!1,f=window.location.hash.slice(1).split("&").map(d=>{let y=d.split("=")[0];return y===p?(h=!0,"".concat(y,"=").concat(c)):d}).filter(d=>d);return h||f.push("".concat(p,"=").concat(c)),"#".concat(f.join("&"))}return"#".concat(c)}};m();m();var u_=oe(ye(),1),Wu={linearity:.3,easing:_n(0,0,.3,1)},cM=O({deceleration:2500,maxSpeed:1400},Wu),pM=O({deceleration:20,maxSpeed:1400},Wu),hM=O({deceleration:1e3,maxSpeed:360},Wu),fM=O({deceleration:1e3,maxSpeed:90},Wu),$u=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:J.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=J.now(),i=160;for(;e.length>0&&t-e[0].time>i;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,pan:new u_.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)t.zoom+=a.zoomDelta||0,t.bearing+=a.bearingDelta||0,t.pitch+=a.pitchDelta||0,a.panDelta&&t.pan._add(a.panDelta),a.around&&(t.around=a.around),a.pinchAround&&(t.pinchAround=a.pinchAround);let n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(t.pan.mag()){let a=Hu(t.pan.mag(),n,O({},cM,e||{}));o.offset=t.pan.mult(a.amount/t.pan.mag()),o.center=this._map.transform.center,Zu(o,a)}if(t.zoom){let a=Hu(t.zoom,n,pM);o.zoom=this._map.transform.zoom+a.amount,Zu(o,a)}if(t.bearing){let a=Hu(t.bearing,n,hM);o.bearing=this._map.transform.bearing+Ae(a.amount,-179,179),Zu(o,a)}if(t.pitch){let a=Hu(t.pitch,n,fM);o.pitch=this._map.transform.pitch+a.amount,Zu(o,a)}if(o.zoom||o.bearing){let a=t.pinchAround===void 0?t.around:t.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),O(o,{noMoveStart:!0})}};function Zu(r,e){(!r.duration||r.duration<e.duration)&&(r.duration=e.duration,r.easing=e.easing)}function Hu(r,e,t){let{maxSpeed:i,linearity:n,deceleration:o}=t,a=Ae(r*n/(e/1e3),-i,i),s=Math.abs(a)/(o*n);return{easing:t.easing,duration:s*1e3,amount:a*(s/2)}}m();m();var c_=oe(ye(),1);var it=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,n={}){let o=L.mousePos(t.getCanvas(),i),a=t.unproject(o);super(e,O({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=t}},Br=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let n=e==="touchend"?i.changedTouches:i.touches,o=L.touchPos(t.getCanvasContainer(),n),a=o.map(u=>t.unproject(u)),s=o.reduce((u,c,p,h)=>u.add(c.div(h.length)),new c_.default(0,0)),l=t.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:l,originalEvent:i}),this._defaultPrevented=!1}},ma=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}};var Xu=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ma(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new it(e.type,this._map,e))}mouseup(e){this._map.fire(new it(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new it(e.type,this._map,e))}dblclick(e){return this._firePreventable(new it(e.type,this._map,e))}mouseover(e){this._map.fire(new it(e.type,this._map,e))}mouseout(e){this._map.fire(new it(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Br(e.type,this._map,e))}touchmove(e){this._map.fire(new Br(e.type,this._map,e))}touchend(e){this._map.fire(new Br(e.type,this._map,e))}touchcancel(e){this._map.fire(new Br(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Ku=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new it(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new it("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new it(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};m();m();var p_=oe(ye(),1),kt=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(p_.default.convert(e),this._map.terrain)}};var da=class{constructor(e,t){this._map=e,this._tr=new kt(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){console.warn("boxZoom will not work. Use SDK interaction events instead.")}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let n=this._startPos;this._lastPos=i,this._box||(this._box=L.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let o=Math.min(n.x,i.x),a=Math.max(n.x,i.x),s=Math.min(n.y,i.y),l=Math.max(n.y,i.y);L.setTransform(this._box,"translate(".concat(o,"px,").concat(s,"px)")),this._box.style.width="".concat(a-o,"px"),this._box.style.height="".concat(l-s,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,n=t;if(this.reset(),L.suppressClick(),i.x===n.x&&i.y===n.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new z("boxzoomend",{originalEvent:e})),{cameraAnimation:o=>o.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new z(e,{originalEvent:t}))}};m();m();var h_=oe(ye(),1);m();function ya(r,e){if(r.length!==e.length)throw new Error("The number of touches and points are not equal - touches ".concat(r.length,", points ").concat(e.length));let t={};for(let i=0;i<r.length;i++)t[r[i].identifier]=e[i];return t}function mM(r){let e=new h_.default(0,0);for(let t of r)e._add(t);return e.div(r.length)}var kh=500,dM=500,Ju=30,Eh=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=mM(t),this.touches=ya(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let n=ya(i,t);for(let o in this.touches){let a=this.touches[o],s=n[o];(!s||s.dist(a)>Ju)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>dM)&&(this.aborted=!0),i.length===0){let n=!this.aborted&&this.centroid;if(this.reset(),n)return n}}},xi=class{constructor(e){this.singleTap=new Eh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let n=this.singleTap.touchend(e,t,i);if(n){let o=e.timeStamp-this.lastTime<kh,a=!this.lastTap||this.lastTap.dist(n)<Ju;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}};var Yu=class{constructor(e){this._tr=new kt(e),this._zoomIn=new xi({numTouches:1,numTaps:2}),this._zoomOut=new xi({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let n=this._zoomIn.touchend(e,t,i),o=this._zoomOut.touchend(e,t,i),a=this._tr;if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(n)},{originalEvent:e})};if(o)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(o)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();m();var cr=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=t.length?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let n=t.length?t[0]:t;if(!(!this._moved&&n.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(i,n)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&L.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};m();var yM=0,gM=2,xM={[yM]:1,[gM]:2};function bM(r,e){let t=xM[e];return r.buttons===void 0||(r.buttons&t)!==t}var yn=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=L.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!bM(e,this._eventButton)}isValidEndEvent(e){return L.mouseButton(e)===this._eventButton}},ga=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){let t=e.targetTouches[0].identifier;this._firstTouch=t}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}};var Lh=0,f_=2,Dh=r=>{r.mousedown=r.dragStart,r.mousemoveWindow=r.dragMove,r.mouseup=r.dragEnd,r.contextmenu=function(e){e.preventDefault()}},m_=({enable:r,clickTolerance:e})=>{let t=new yn({checkCorrectEvent:i=>L.mouseButton(i)===Lh&&!i.ctrlKey});return new cr({clickTolerance:e,move:(i,n)=>({around:n,panDelta:n.sub(i)}),activateOnStart:!0,moveStateManager:t,enable:r,assignEvents:Dh})},Qu=({enable:r,clickTolerance:e,bearingDegreesPerPixelMoved:t=.8})=>{let i=new yn({checkCorrectEvent:n=>L.mouseButton(n)===Lh&&n.ctrlKey||L.mouseButton(n)===f_});return new cr({clickTolerance:e,move:(n,o)=>({bearingDelta:(o.x-n.x)*t}),moveStateManager:i,enable:r,assignEvents:Dh})},ec=({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5})=>{let i=new yn({checkCorrectEvent:n=>L.mouseButton(n)===Lh&&n.ctrlKey||L.mouseButton(n)===f_});return new cr({clickTolerance:e,move:(n,o)=>({pitchDelta:(o.y-n.y)*t}),moveStateManager:i,enable:r,assignEvents:Dh})};m();var tc=oe(ye(),1);var rc=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new tc.default(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(!(!this._active||i.length<this.minTouchs()))return e.preventDefault(),this._calculateTransform(e,t,i)}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this.minTouchs()&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let n=ya(i,t),o=new tc.default(0,0),a=new tc.default(0,0),s=0;for(let c in n){let p=n[c],h=this._touches[c];h&&(o._add(p),a._add(p.sub(h)),s++,n[c]=p)}if(this._touches=n,s<this.minTouchs()||!a.mag())return;let l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var xa=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[n,o]=this._firstTwoTouches,a=ic(i,t,n),s=ic(i,t,o);if(!a||!s)return;let l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[n,o]=this._firstTwoTouches,a=ic(i,t,n),s=ic(i,t,o);a&&s||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function ic(r,e,t){for(let i=0;i<r.length;i++)if(r[i].identifier===t)return e[i]}var _M=.1;function d_(r,e){return Math.log(r/e)/Math.LN2}var ba=class extends xa{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(d_(this._distance,this._startDistance))<_M))return this._active=!0,{zoomDelta:d_(this._distance,i),pinchAround:t}}},vM=25;function y_(r,e){return r.angleWith(e)*180/Math.PI}var _a=class extends xa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let n=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:y_(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,i=vM/t*360,n=y_(e,this._startVector);return Math.abs(n)<i}};function zh(r){return Math.abs(r.y)>Math.abs(r.x)}var wM=100,va=class extends xa{constructor(t){super();this._currentTouchCount=0;this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,n){super.touchstart(t,i,n),this._currentTouchCount=n.length}_start(t){this._lastPoints=t,zh(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,n.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,i,n){if(this._valid!==void 0)return this._valid;let o=2,a=t.mag()>=o,s=i.mag()>=o;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<wM?void 0:!1;let l=t.y>0==i.y>0;return zh(t)&&zh(i)&&l}};m();var SM={panStep:100,bearingStep:15,pitchStep:10},wa=class{constructor(e){this._tr=new kt(e);let t=SM;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,o=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),o=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:PM,zoom:t?Math.round(l.zoom)+t*(e.shiftKey?2:1):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:l.center},{originalEvent:e})}}}enable(){console.warn("maplibre keyboard events are not supported, use SDK keyboard events instead.")}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function PM(r){return r*(2-r)}m();var g_=4.000244140625,TM=1/100,AM=1/450,MM=2,Sa=class{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)};this._map=e,this._tr=new kt(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=TM,this._wheelZoomRate=AM}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){console.log("Enable maplibre scrollZoom events will not work. Use Mappedin SDK interactions events instead.")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!e[this._map.cooperativeGestures._bypassKey])return;let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=J.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%g_===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){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);let t=L.mousePos(this._map.getCanvas(),e),i=this._tr;t.y>i.transform.height/2-i.transform.getHorizon()?this._around=re.convert(this._aroundCenter?i.center:i.unproject(t)):this._around=re.convert(i.center),this._aroundPoint=i.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>g_?this._wheelZoomRate:this._defaultZoomRate,l=MM/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let u=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(u*l))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,i=this._startZoom,n=this._easing,o=!1,a;if(this._type==="wheel"&&i&&n){let s=Math.min((J.now()-this._lastWheelEventTime)/200,1),l=n(s);a=Se.number(i,t,l),s<1?this._frameId||(this._frameId=!0):o=!0}else a=t,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=vn;if(this._prevEase){let i=this._prevEase,n=(J.now()-i.start)/i.duration,o=i.easing(n+.01)-i.easing(n),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.27*.27-a*a);t=_n(a,s,.25,1)}return this._prevEase={start:J.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};m();var Pa=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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()}};m();var nc=class{constructor(e){this._tr=new kt(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var oc=class{constructor(){this._tap=new xi({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,i);else{let n=t[0],o=e.timeStamp-this._tapTime<kh,a=this._tapPoint.dist(n)<Ju;!o||!a?this.reset():i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier)}}touchmove(e,t,i){if(!this._tapTime)this._tap.touchmove(e,t,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=t[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let n=this._tap.touchend(e,t,i);n&&(this._tapTime=e.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var Ta=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){console.log("Maplibre interaction is not supported. Use Mappedin SDK interaction instead")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}};m();var Aa=class{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){console.warn("dragRotate does not work. Use SDK interaction events instead.")}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()}};m();var Ma=class{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}};m();var Ia=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey";this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=L.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=t,this._container.appendChild(n);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=i,this._container.appendChild(o),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(L.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(e){this._onCooperativeGesture(e.touches.length===1)}wheel(e){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!e[this._bypassKey])}_onCooperativeGesture(e){!this._enabled||!e||(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};var x_=oe(ye(),1),ac=r=>r.zoom||r.drag||r.pitch||r.rotate,Rh=class extends z{};function Fh(r){return r.panDelta&&r.panDelta.mag()||r.zoomDelta||r.bearingDelta||r.pitchDelta}var sc=class{constructor(e,t){this.handleWindowEvent=e=>{this.handleEvent(e,"".concat(e.type,"Window"))};this.handleEvent=(e,t)=>{if(e.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let i=e.type==="renderFrame"?void 0:e,n={needsRenderFrame:!1},o={},a={},s=e.touches,l=s?this._getMapTouches(s):void 0,u=l?L.touchPos(this._map.getCanvas(),l):L.mousePos(this._map.getCanvas(),e);for(let{handlerName:h,handler:f,allowed:d}of this._handlers){if(!f.isEnabled())continue;let y;this._blockedByActive(a,d,h)?f.reset():f[t||e.type]&&(y=f[t||e.type](e,u,l),this.mergeHandlerResult(n,o,y,h,i),y&&y.needsRenderFrame&&this._triggerRenderFrame()),(y||f.isActive())&&(a[h]=f)}let c={};for(let h in this._previousActiveHandlers)a[h]||(c[h]=i);this._previousActiveHandlers=a,(Object.keys(c).length||Fh(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(a).length||Fh(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:p}=n;p&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],p(this._map))};this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new $u(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(let[n,o,a]of this._listeners);}destroy(){for(let[e,t,i]of this._listeners)L.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Xu(t,e));let n=t.boxZoom=new da(t,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();let o=t.cooperativeGestures=new Ia(t,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new Yu(t),s=new nc(t);t.doubleClickZoom=new Pa(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let l=new oc;this._add("tapDragZoom",l);let u=t.touchPitch=new va(t);this._add("touchPitch",u),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let c=Qu(e),p=ec(e);t.dragRotate=new Aa(e,c,p),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",p,["mouseRotate"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let h=m_(e),f=new rc(e,t);t.dragPan=new Ta(i,h,f),this._add("mousePan",h),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let d=new _a,y=new ba;t.touchZoomRotate=new Ma(i,y,d,l),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let g=t.scrollZoom=new Sa(t,()=>this._triggerRenderFrame());this._add("scrollZoom",g,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let x=t.keyboard=new wa(t);this._add("keyboard",x),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new Ku(t))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ac(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let n=i.target;this._el.contains(n)&&t.push(i)}return t}mergeHandlerResult(e,t,i,n,o){if(!i)return;O(e,i);let a={handlerName:n,originalEvent:i.originalEvent||o};i.zoomDelta!==void 0&&(t.zoom=a),i.panDelta!==void 0&&(t.drag=a),i.pitchDelta!==void 0&&(t.pitch=a),i.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},i={};for(let[n,o,a]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new x_.default(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.around!==void 0&&(e.around=n.around),n.pinchAround!==void 0&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),O(t,o),O(i,a);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let n=this._map,o=n._getTransformForUpdate(),a=n.terrain;if(!Fh(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,i,!0);let{panDelta:s,zoomDelta:l,bearingDelta:u,pitchDelta:c,around:p,pinchAround:h}=e;h!==void 0&&(p=h),n._stop(!0),p=p||n.transform.centerPoint;let f=o.pointLocation(s?p.sub(s):p);u&&(o.bearing+=u),c&&(o.pitch+=c),l&&(o.zoom+=l),a?!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,o.setLocationAtPoint(f,p),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,o.recalculateZoom(n.terrain)})):t.drag&&this._terrainMovement?o.center=o.pointLocation(o.centerPoint.sub(s)):o.setLocationAtPoint(f,p):o.setLocationAtPoint(f,p),n._applyUpdatedTransform(o),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){let n=ac(this._eventsInProgress),o=ac(e),a={};for(let c in e){let{originalEvent:p}=e[c];this._eventsInProgress[c]||(a["".concat(c,"start")]=p),this._eventsInProgress[c]=e[c]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(let c in a)this._fireEvent(c,a[c]);o&&this._fireEvent("move",o.originalEvent);for(let c in e){let{originalEvent:p}=e[c];this._fireEvent(c,p)}let s={},l;for(let c in this._eventsInProgress){let{handlerName:p,originalEvent:h}=this._eventsInProgress[c];this._handlersById[p].isActive()||(delete this._eventsInProgress[c],l=t[p]||h,s["".concat(c,"end")]=l)}for(let c in s)this._fireEvent(c,s[c]);let u=ac(this._eventsInProgress);if(i&&(n||o)&&!u){this._updatingCamera=!0;let c=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),p=h=>h!==0&&-this._bearingSnap<h&&h<this._bearingSnap;c&&(c.essential||!J.prefersReducedMotion)?(p(c.bearing||this._map.getBearing())&&(c.bearing=0),c.freezeElevation=!0,this._map.easeTo(c,{originalEvent:l})):(this._map.fire(new z("moveend",{originalEvent:l})),p(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new z(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Rh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};m();var Ht=oe(ye(),1);var lc=class extends me{constructor(t,i){super();this._renderFrameCallback=()=>{let t=Math.min((J.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()};this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new re(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}panBy(t,i,n){return t=Ht.default.convert(t).mult(-1),this.panTo(this.transform.center,O({offset:t},i),n)}panTo(t,i,n){return this.easeTo(O({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,i,n){return this.easeTo(O({zoom:t},i),n)}zoomIn(t,i){return this.zoomTo(this.getZoom()+1,t,i),this}zoomOut(t,i){return this.zoomTo(this.getZoom()-1,t,i),this}getBearing(){return this.transform.bearing}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,i,n){return this.easeTo(O({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,O({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(O({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}cameraForBounds(t,i){t=lt.convert(t);let n=i&&i.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),n,i)}_cameraForBoxAndBearing(t,i,n,o){let a={top:0,bottom:0,right:0,left:0};if(o=O({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let ie=o.padding;o.padding={top:ie,bottom:ie,right:ie,left:ie}}o.padding=O(a,o.padding);let s=this.transform,l=s.padding,u=new lt(t,i),c=s.project(u.getNorthWest()),p=s.project(u.getNorthEast()),h=s.project(u.getSouthEast()),f=s.project(u.getSouthWest()),d=Mc(-n),y=c.rotate(d),g=p.rotate(d),x=h.rotate(d),v=f.rotate(d),b=new Ht.default(Math.max(y.x,g.x,v.x,x.x),Math.max(y.y,g.y,v.y,x.y)),w=new Ht.default(Math.min(y.x,g.x,v.x,x.x),Math.min(y.y,g.y,v.y,x.y)),S=b.sub(w),P=(s.width-(l.left+l.right+o.padding.left+o.padding.right))/S.x,k=(s.height-(l.top+l.bottom+o.padding.top+o.padding.bottom))/S.y;if(k<0||P<0){ke("Map cannot fit within canvas with the given bounds, padding, and/or offset.");return}let I=Math.min(s.scaleZoom(s.scale*Math.min(P,k)),o.maxZoom),C=Ht.default.convert(o.offset),M=(o.padding.left-o.padding.right)/2,F=(o.padding.top-o.padding.bottom)/2,E=new Ht.default(M,F).rotate(Mc(n)),N=C.add(E).mult(s.scale/s.zoomScale(I));return{center:s.unproject(c.add(h).div(2).sub(N)),zoom:I,bearing:n}}fitBounds(t,i,n){return this._fitInternal(this.cameraForBounds(t,i),i,n)}fitScreenCoordinates(t,i,n,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(Ht.default.convert(t)),this.transform.pointLocation(Ht.default.convert(i)),n,o),o,a)}_fitInternal(t,i,n){return t?(i=O(t,i),delete i.padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(t,i){this.stop();let n=this._getTransformForUpdate(),o=!1,a=!1,s=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(o=!0,n.zoom=+t.zoom),t.center!==void 0&&(n.center=re.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(a=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(s=!0,n.pitch=+t.pitch),t.padding!=null&&!n.isPaddingEqual(t.padding)&&(n.padding=t.padding),this._applyUpdatedTransform(n),this.fire(new z("movestart",i)).fire(new z("move",i)),o&&this.fire(new z("zoomstart",i)).fire(new z("zoom",i)).fire(new z("zoomend",i)),a&&this.fire(new z("rotatestart",i)).fire(new z("rotate",i)).fire(new z("rotateend",i)),s&&this.fire(new z("pitchstart",i)).fire(new z("pitch",i)).fire(new z("pitchend",i)),this.fire(new z("moveend",i))}calculateCameraOptionsFromTo(t,i,n,o=0){let a=ze.fromLngLat(t,i),s=ze.fromLngLat(n,o),l=s.x-a.x,u=s.y-a.y,c=s.z-a.z,p=Math.hypot(l,u,c);if(p===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(l,u),f=this.transform.scaleZoom(this.transform.cameraToCenterDistance/p/this.transform.tileSize),d=Math.atan2(l,-u)*180/Math.PI,y=Math.acos(h/p)*180/Math.PI;return y=c<0?90-y:90+y,{center:s.toLngLat(),zoom:f,pitch:y,bearing:d}}easeTo(t,i){var k;this._stop(!1,t.easeId),t=O({offset:[0,0],duration:500,easing:vn},t),(t.animate===!1||!t.essential&&J.prefersReducedMotion)&&(t.duration=0);let n=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),u="bearing"in t?this._normalizeBearing(t.bearing,a):a,c="pitch"in t?+t.pitch:s,p="padding"in t?t.padding:n.padding,h=Ht.default.convert(t.offset),f=n.centerPoint.add(h),d=n.pointLocation(f),{center:y,zoom:g}=n.getConstrained(re.convert(t.center||d),(k=t.zoom)!=null?k:o);this._normalizeCenter(y);let x=n.project(d),v=n.project(y).sub(x),b=n.zoomScale(g-o),w,S;t.around&&(w=re.convert(t.around),S=n.locationPoint(w));let P={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||g!==o,this._rotating=this._rotating||a!==u,this._pitching=this._pitching||c!==s,this._padding=!n.isPaddingEqual(p),this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,P),this.terrain&&this._prepareElevation(y),this._ease(I=>{if(this._zooming&&(n.zoom=Se.number(o,g,I)),this._rotating&&(n.bearing=Se.number(a,u,I)),this._pitching&&(n.pitch=Se.number(s,c,I)),this._padding&&(n.interpolatePadding(l,p,I),f=n.centerPoint.add(h)),this.terrain&&!t.freezeElevation&&this._updateElevation(I),w)n.setLocationAtPoint(w,S);else{let C=n.zoomScale(n.zoom-o),M=g>o?Math.min(2,b):Math.max(.5,b),F=Math.pow(M,1-I),D=n.unproject(x.add(v.mult(I*F)).mult(C));n.setLocationAtPoint(n.renderWorldCopies?D.wrap():D,f)}this._applyUpdatedTransform(n),this._fireMoveEvents(i)},I=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,I)},t),this}_prepareEase(t,i,n={}){this._moving=!0,!i&&!n.moving&&this.fire(new z("movestart",t)),this._zooming&&!n.zooming&&this.fire(new z("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new z("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new z("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){let n=this._elevationTarget-this._elevationStart,o=(i-(n*t+this._elevationStart))/(1-t);this._elevationStart+=t*(n-o),this._elevationTarget=i}this.transform.elevation=Se.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;let i=t.clone(),{center:n,zoom:o,pitch:a,bearing:s,elevation:l}=this.transformCameraUpdate(i);n&&(i.center=n),o!==void 0&&(i.zoom=o),a!==void 0&&(i.pitch=a),s!==void 0&&(i.bearing=s),l!==void 0&&(i.elevation=l),this.transform.apply(i)}_fireMoveEvents(t){this.fire(new z("move",t)),this._zooming&&this.fire(new z("zoom",t)),this._rotating&&this.fire(new z("rotate",t)),this._pitching&&this.fire(new z("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let n=this._zooming,o=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new z("zoomend",t)),o&&this.fire(new z("rotateend",t)),a&&this.fire(new z("pitchend",t)),this.fire(new z("moveend",t))}flyTo(t,i){var ie;if(!t.essential&&J.prefersReducedMotion){let K=mr(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(K,i)}this.stop(),t=O({offset:[0,0],speed:1.2,curve:1.42,easing:vn},t);let n=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),u="bearing"in t?this._normalizeBearing(t.bearing,a):a,c="pitch"in t?+t.pitch:s,p="padding"in t?t.padding:n.padding,h=Ht.default.convert(t.offset),f=n.centerPoint.add(h),d=n.pointLocation(f),{center:y,zoom:g}=n.getConstrained(re.convert(t.center||d),(ie=t.zoom)!=null?ie:o);this._normalizeCenter(y);let x=n.zoomScale(g-o),v=n.project(d),b=n.project(y).sub(v),w=t.curve,S=Math.max(n.width,n.height),P=S/x,k=b.mag();if("minZoom"in t){let K=Ae(Math.min(t.minZoom,o,g),n.minZoom,n.maxZoom),$=S/n.zoomScale(K-o);w=Math.sqrt($/k*2)}let I=w*w;function C(K){let $=(P*P-S*S+(K?-1:1)*I*I*k*k)/(2*(K?P:S)*I*k);return Math.log(Math.sqrt($*$+1)-$)}function M(K){return(Math.exp(K)-Math.exp(-K))/2}function F(K){return(Math.exp(K)+Math.exp(-K))/2}function D(K){return M(K)/F(K)}let E=C(!1),T=function(K){return F(E)/F(E+w*K)},N=function(K){return S*((F(E)*D(E+w*K)-M(E))/I)/k},X=(C(!0)-E)/w;if(Math.abs(k)<1e-6||!isFinite(X)){if(Math.abs(S-P)<1e-6)return this.easeTo(t,i);let K=P<S?-1:1;X=Math.abs(Math.log(P/S))/w,N=function(){return 0},T=function($){return Math.exp(K*w*$)}}if("duration"in t)t.duration=+t.duration;else{let K="screenSpeed"in t?+t.screenSpeed/w:+t.speed;t.duration=1e3*X/K}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==s,this._padding=!n.isPaddingEqual(p),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(y),this._ease(K=>{let $=K*X,Je=1/T($);n.zoom=K===1?g:o+n.scaleZoom(Je),this._rotating&&(n.bearing=Se.number(a,u,K)),this._pitching&&(n.pitch=Se.number(s,c,K)),this._padding&&(n.interpolatePadding(l,p,K),f=n.centerPoint.add(h)),this.terrain&&!t.freezeElevation&&this._updateElevation(K);let Oe=K===1?y:n.unproject(v.add(b.mult(N($))).mult(Je));n.setLocationAtPoint(n.renderWorldCopies?Oe.wrap():Oe,f),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,i)}if(!t){let n=this.handlers;n&&n.stop(!1)}return this}_ease(t,i,n){n.animate===!1||n.duration===0?(t(1),i()):(this._easeStart=J.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=Yt(t,-180,180);let n=Math.abs(t-i);return Math.abs(t-360-i)<n&&(t-=360),Math.abs(t+360-i)<n&&(t+=360),t}_normalizeCenter(t){let i=this.transform;if(!i.renderWorldCopies||i.lngRange)return;let n=t.lng-i.center.lng;t.lng+=n>180?-360:n<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(re.convert(t),this.transform.tileZoom)-this.transform.elevation:null}};var pr=oe(ye(),1);m();var Bh={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},Ca=class{constructor(e=Bh){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))};this._updateData=e=>{e&&(e.sourceDataType==="metadata"||e.sourceDataType==="visibility"||e.dataType==="style"||e.type==="terrain")&&this._updateAttributions()};this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))};this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")};this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){L.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let i=this._map._getUIString("AttributionControl.".concat(t));e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(n=>typeof n!="string"?"":n)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let n=this._map.style.stylesheet;this.styleOwner=n.owner,this.styleId=n.id}let t=this._map.style.sourceCaches;for(let n in t){let o=t[n];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(n=>String(n).trim()),e.sort((n,o)=>n.length-o.length),e=e.filter((n,o)=>{for(let a=o+1;a<e.length;a++)if(e[a].indexOf(n)>=0)return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};m();var Ea=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}};this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl");let t=L.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};m();var uc=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let n of i)if(n.id===e){n.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};m();var pc=(i=>(i.create="create",i.load="load",i.fullLoad="fullLoad",i))(pc||{}),cc=null,ka=[],IM=60,Oh=1e3/IM,Vh="loadTime",Uh="fullLoadTime",gn={mark(r){performance.mark(r)},frame(r){let e=r;if(cc!=null){let t=e-cc;ka.push(t)}cc=e},clearMetrics(){cc=null,ka=[],performance.clearMeasures(Vh),performance.clearMeasures(Uh);for(let r in pc)performance.clearMarks(pc[r])},getPerformanceMetrics(){performance.measure(Vh,"create","load"),performance.measure(Uh,"create","fullLoad");let r=performance.getEntriesByName(Vh)[0].duration,e=performance.getEntriesByName(Uh)[0].duration,t=ka.length,n=1/(ka.reduce((s,l)=>s+l,0)/t/1e3),o=ka.filter(s=>s>Oh).reduce((s,l)=>s+(l-Oh)/Oh,0),a=o/(t+o)*100;return{loadTime:r,fullLoadTime:e,fps:n,percentDroppedFrames:a,totalFrames:t}}};m();m();var b_=be([{name:"a_pos3d",type:"Int16",components:3}]);m();var hc=class extends me{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let i={};for(let n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),G.ortho(n.posMatrix,0,8192,0,8192,0,1),this._tiles[n.key]=new pn(n,this.tileSize));for(let n in this._tiles)i[n]||delete this._tiles[n]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let t={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID;if(n.canonical.equals(e.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16),G.ortho(o.posMatrix,0,8192,0,8192,0,1),t[i]=o}else if(n.canonical.isChildOf(e.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16);let a=n.canonical.z-e.canonical.z,s=n.canonical.x-(n.canonical.x>>a<<a),l=n.canonical.y-(n.canonical.y>>a<<a),u=8192>>a;G.ortho(o.posMatrix,0,u,0,u,0,1),G.translate(o.posMatrix,o.posMatrix,[-s*u,-l*u,0]),t[i]=o}else if(e.canonical.isChildOf(n.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16);let a=e.canonical.z-n.canonical.z,s=e.canonical.x-(e.canonical.x>>a<<a),l=e.canonical.y-(e.canonical.y>>a<<a),u=8192>>a;G.ortho(o.posMatrix,0,8192,0,8192,0,1),G.translate(o.posMatrix,o.posMatrix,[s*u,l*u,0]),G.scale(o.posMatrix,o.posMatrix,[1/2**a,1/2**a,0]),t[i]=o}}return t}getSourceTile(e,t){let i=this.sourceCache._source,n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(n).key);let o=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(o&&o.dem)&&t)for(;n>=i.minzoom&&!(o&&o.dem);)o=this.sourceCache.getTileByID(e.scaledTo(n--).key);return o}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(t=>t.timeAdded>=e)}};var fc=class{constructor(e,t,i){this.painter=e,this.sourceCache=new hc(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,i,n=8192){var f;if(!(t>=0&&t<n&&i>=0&&i<n))return 0;let o=this.getTerrainData(e),a=(f=o.tile)==null?void 0:f.dem;if(!a)return 0;let s=Wi.transformMat4([],[t/n*8192,i/n*8192],o.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],u=Math.floor(l[0]),c=Math.floor(l[1]),p=l[0]-u,h=l[1]-c;return a.get(u,c)*(1-p)*(1-h)+a.get(u+1,c)*p*(1-h)+a.get(u,c+1)*(1-p)*h+a.get(u+1,c+1)*p*h}getElevationForLngLatZoom(e,t){let{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,n%8192,o%8192,8192)}getElevation(e,t,i,n=8192){return this.getDEMElevation(e,t,i,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let n=this.painter.context,o=new we({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new _e(n,o,n.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new _e(n,new we({width:1,height:1}),n.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=G.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let n=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new _e(n,t.dem.getPixels(),n.gl.RGBA,{premultiply:!1}),t.demTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t&&t+t.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){let n=this.sourceCache.sourceCache._source.maxzoom,o=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?o=e.canonical.z-n:ke("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>o<<o),s=e.canonical.y-(e.canonical.y>>o<<o),l=G.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);G.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[e.key]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,i=t.width/devicePixelRatio,n=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==n)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new _e(t.context,{width:i,height:n,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new _e(t.context,{width:i,height:n,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)t[a+0]=s&255,t[a+1]=o&255,t[a+2]=s>>8<<4|o>>8,t[a+3]=0;let i=new we({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),n=new _e(e,i,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null);let l=t[0]+(t[2]>>4<<8),u=t[1]+((t[2]&15)<<8),c=this.coordsIndex[255-t[3]],p=c&&this.sourceCache.getTileByID(c);if(!p)return null;let h=this._coordsTextureSize,f=(1<<p.tileID.canonical.z)*h;return new ze((p.tileID.canonical.x*h+l)/f+p.tileID.wrap,(p.tileID.canonical.y*h+u)/f,this.getElevation(p.tileID,l,u,h))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,n=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,t=new Cs,i=new rt,n=this.meshSize,o=8192/n,a=n*n;for(let p=0;p<=n;p++)for(let h=0;h<=n;h++)t.emplaceBack(h*o,p*o,0);for(let p=0;p<a;p+=n+1)for(let h=0;h<n;h++)i.emplaceBack(h+p,n+h+p+1,n+h+p+2),i.emplaceBack(h+p,n+h+p+2,h+p+1);let s=t.length,l=s+(n+1)*2;for(let p of[0,1])for(let h=0;h<=n;h++)for(let f of[0,1])t.emplaceBack(h*o,p*8192,f);for(let p=0;p<n*2;p+=2)i.emplaceBack(l+p,l+p+1,l+p+3),i.emplaceBack(l+p,l+p+3,l+p+2),i.emplaceBack(s+p,s+p+3,s+p+1),i.emplaceBack(s+p,s+p+2,s+p+3);let u=t.length,c=u+(n+1)*2;for(let p of[0,1])for(let h=0;h<=n;h++)for(let f of[0,1])t.emplaceBack(p*8192,h*o,f);for(let p=0;p<n*2;p+=2)i.emplaceBack(u+p,u+p+1,u+p+3),i.emplaceBack(u+p,u+p+3,u+p+2),i.emplaceBack(c+p,c+p+3,c+p+1),i.emplaceBack(c+p,c+p+2,c+p+3);return this._mesh={indexBuffer:e.createIndexBuffer(i),vertexBuffer:e.createVertexBuffer(t,b_.members),segments:fe.simpleSegment(0,0,t.length,i.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*Ho/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,t){var n;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(n=this.getMinMaxElevation(i).minElevation)!=null?n:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=ze.fromLngLat(e.wrap()),n=(1<<t)*8192,o=i.x*n,a=i.y*n,s=Math.floor(o/8192),l=Math.floor(a/8192);return{tileID:new Ke(t,0,t,s,l),mercatorX:o,mercatorY:a}}};m();m();var mc=class{constructor(e,t,i){this._context=e;this._size=t;this._tileSize=i;this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new _e(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(i.texture),{id:e,fbo:t,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}};var xn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},dc=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new mc(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsDescendingInv={};for(let i in e.sourceCaches){this._coordsDescendingInv[i]={};let n=e.sourceCaches[i].getVisibleCoordinates();for(let o of n){let a=this.terrain.sourceCache.getTerrainCoords(o);for(let s in a)this._coordsDescendingInv[i][s]||(this._coordsDescendingInv[i][s]=[]),this._coordsDescendingInv[i][s].push(a[s])}}this._coordsDescendingInvStr={};for(let i of e._order){let n=e._layers[i],o=n.source;if(xn[n.type]&&!this._coordsDescendingInvStr[o]){this._coordsDescendingInvStr[o]={};for(let a in this._coordsDescendingInv[o])this._coordsDescendingInvStr[o][a]=this._coordsDescendingInv[o][a].map(s=>s.key).sort().join()}}for(let i of this._renderableTiles)for(let n in this._coordsDescendingInvStr){let o=this._coordsDescendingInvStr[n][i.tileID.key];o&&o!==i.rttCoords[n]&&(i.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let t=e.type,i=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(xn[t]&&((!this._prevType||!xn[this._prevType])&&this._stacks.push([]),this._prevType=t,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(xn[this._prevType]||xn[t]&&n){this._prevType=t;let o=this._stacks.length-1,a=this._stacks[o]||[];for(let s of this._renderableTiles){if(this.pool.isFull()&&(Ch(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[o]){let u=this.pool.getObjectForId(s.rtt[o].id);if(u.stamp===s.rtt[o].stamp){this.pool.useObject(u);continue}}let l=this.pool.getOrCreateFreeObject();this.pool.useObject(l),this.pool.stampObject(l),s.rtt[o]={id:l.id,stamp:l.stamp},i.context.bindFramebuffer.set(l.fbo.framebuffer),i.context.clear({color:W.transparent,stencil:0}),i.currentStencilSource=void 0;for(let u=0;u<a.length;u++){let c=i.style._layers[a[u]],p=c.source?this._coordsDescendingInv[c.source][s.tileID.key]:[s.tileID];i.context.viewport.set([0,0,l.fbo.width,l.fbo.height]),i._renderTileClippingMasks(c,p),i.renderLayer(i,i.style.sourceCaches[c.source],c,p),c.source&&(s.rttCoords[c.source]=this._coordsDescendingInvStr[c.source][s.tileID.key])}}return Ch(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),xn[t]}return!1}};m();var __={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"};var CM=Ba.version,gc=-2,v_=22,Or=0,w_=80,yc=85,EM={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:gc,maxZoom:v_,minPitch:Or,maxPitch:w_,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:Bh,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Xe.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},Nh=class extends lc{constructor(t){if(gn.mark("create"),t=O({},EM,t),t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<Or)throw new Error("minPitch must be greater than or equal to ".concat(Or));if(t.maxPitch!=null&&t.maxPitch>yc)throw new Error("maxPitch must be less than or equal to ".concat(yc));let i=new qu(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies);super(i,{bearingSnap:t.bearingSnap});this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new z("webglcontextlost",{originalEvent:t}))};this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new z("webglcontextrestored",{originalEvent:t}))};this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1};this._onWindowOnline=()=>{this._update()};if(this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new uc,this._controls=[],this._mapId=Ua(),this._locale=O({},__,t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this._imageQueueHandle=at.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ha(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error("Container '".concat(t.container,"' not found."))}else if(t.container instanceof HTMLElement)this._container=t.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let o=!1,a=ju(s=>{this._trackResize&&!this._removed&&this.resize(s)._update()},50);this._resizeObserver=new ResizeObserver(s=>{if(!o){o=!0;return}a(s)}),this._resizeObserver.observe(this._container)}this.handlers=new sc(this,t);let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash&&new fa(n).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,O({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Ca(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Ea,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new z("".concat(o.dataType,"data"),o))}),this.on("dataloading",o=>{this.fire(new z("".concat(o.dataType,"dataloading"),o))}),this.on("dataabort",o=>{this.fire(new z("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(t,i){if(i===void 0&&(t.getDefaultPosition?i=t.getDefaultPosition():i="top-right"),!t||!t.onAdd)return this.fire(new Z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=t.onAdd(this);this._controls.push(t);let o=this._controlPositions[i];return i.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new Z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,i,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,i,n,o)}resize(t){var l;let i=this._containerDimensions(),n=i[0],o=i[1],a=this._getClampedPixelRatio(n,o);if(this._resizeCanvas(n,o,a),this.painter.resize(n,o,a),this.painter.overLimit()){let u=this.painter.context.gl;this._maxCanvasSize=[u.drawingBufferWidth,u.drawingBufferHeight];let c=this._getClampedPixelRatio(n,o);this._resizeCanvas(n,o,c),this.painter.resize(n,o,c)}this.transform.resize(n,o),(l=this._requestedCameraState)==null||l.resize(n,o);let s=!this._moving;return s&&(this.stop(),this.fire(new z("movestart",t)).fire(new z("move",t))),this.fire(new z("resize",t)),s&&this.fire(new z("moveend",t)),this}_getClampedPixelRatio(t,i){let{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=t*a,l=i*a,u=s>n?n/s:1,c=l>o?o/l:1;return Math.min(u,c)*a}getPixelRatio(){var t;return(t=this._overridePixelRatio)!=null?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(lt.convert(t)),this._update()}setMinZoom(t){if(t=t==null?gc:t,t>=gc&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between ".concat(gc," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if(t=t==null?v_:t,t>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if(t=t==null?Or:t,t<Or)throw new Error("minPitch must be greater than or equal to ".concat(Or));if(t>=Or&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between ".concat(Or," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if(t=t==null?w_:t,t>yc)throw new Error("maxPitch must be less than or equal to ".concat(yc));if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(t){return this.transform.locationPoint(re.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(pr.default.convert(t),this.terrain)}isMoving(){var t;return this._moving||((t=this.handlers)==null?void 0:t.isMoving())}isZooming(){var t;return this._zooming||((t=this.handlers)==null?void 0:t.isZooming())}isRotating(){var t;return this._rotating||((t=this.handlers)==null?void 0:t.isRotating())}_createDelegatedListener(t,i,n){if(t==="mouseenter"||t==="mouseover"){let o=!1;return{layer:i,listener:n,delegates:{mousemove:l=>{let u=this.getLayer(i)?this.queryRenderedFeatures(l.point,{layers:[i]}):[];u.length?o||(o=!0,n.call(this,new it(t,this,l.originalEvent,{features:u}))):o=!1},mouseout:()=>{o=!1}}}}else if(t==="mouseleave"||t==="mouseout"){let o=!1;return{layer:i,listener:n,delegates:{mousemove:l=>{(this.getLayer(i)?this.queryRenderedFeatures(l.point,{layers:[i]}):[]).length?o=!0:o&&(o=!1,n.call(this,new it(t,this,l.originalEvent)))},mouseout:l=>{o&&(o=!1,n.call(this,new it(t,this,l.originalEvent)))}}}}else{let o=a=>{let s=this.getLayer(i)?this.queryRenderedFeatures(a.point,{layers:[i]}):[];s.length&&(a.features=s,n.call(this,a),delete a.features)};return{layer:i,listener:n,delegates:{[t]:o}}}}on(t,i,n){if(n===void 0)return super.on(t,i);let o=this._createDelegatedListener(t,i,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o);for(let a in o.delegates)this.on(a,o.delegates[a]);return this}once(t,i,n){if(n===void 0)return super.once(t,i);let o=this._createDelegatedListener(t,i,n);for(let a in o.delegates)this.once(a,o.delegates[a]);return this}off(t,i,n){if(n===void 0)return super.off(t,i);let o=a=>{let s=a[t];for(let l=0;l<s.length;l++){let u=s[l];if(u.layer===i&&u.listener===n){for(let c in u.delegates)this.off(c,u.delegates[c]);return s.splice(l,1),this}}};return this._delegatedListeners&&this._delegatedListeners[t]&&o(this._delegatedListeners),this}queryRenderedFeatures(t,i){if(!this.style)return[];let n,o=t instanceof pr.default||Array.isArray(t),a=o?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(o?{}:t)||{},a instanceof pr.default||typeof a[0]=="number")n=[pr.default.convert(a)];else{let s=pr.default.convert(a[0]),l=pr.default.convert(a[1]);n=[s,new pr.default(l.x,s.y),l,new pr.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,i){return i=O({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i),i.diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(i==null)throw new Error("Missing UI string '".concat(t,"'"));return i}_updateStyle(t,i){if(i.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(t,i));return}let n=this.style&&i.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)this.style=new mn(this,i||{});else return delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof t=="string"?this.style.loadURL(t,i,n):this.style.loadJSON(t,i,n),this}_lazyInitEmptyStyle(){this.style||(this.style=new mn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if(typeof t=="string"){let n=t,o=this._requestManager.transformRequest(n,"Style");dr(o,new AbortController).then(a=>{this._updateDiff(a.data,i)}).catch(a=>{a&&this.fire(new Z(a))})}else typeof t=="object"&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(n){ke("Unable to perform style diff: ".concat(n.message||n.error||n,". Rebuilding the style from scratch.")),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ke("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){let i=this.style&&this.style.sourceCaches[t];if(i===void 0){this.fire(new Z(new Error("There is no source with ID '".concat(t,"'"))));return}return i.loaded()}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!t)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;else{let i=this.style.sourceCaches[t.source];if(!i)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(t.source));this.terrain===null&&i.reload();for(let n in this.style._layers){let o=this.style._layers[n];o.type==="hillshade"&&o.source===t.source&&ke("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new fc(this.painter,i,t),this.painter.renderToTexture=new dc(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===t.source&&!this._elevationFreeze&&(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new z("terrain",{terrain:t})),this}getTerrain(){var t,i;return(i=(t=this.terrain)==null?void 0:t.options)!=null?i:null}areTilesLoaded(){let t=this.style&&this.style.sourceCaches;for(let i in t){let o=t[i]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,n={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:l,content:u}=n;this._lazyInitEmptyStyle();let c=0;if(i instanceof HTMLImageElement||pt(i)){let{width:p,height:h,data:f}=J.getImageData(i);this.style.addImage(t,{data:new we({width:p,height:h},f),pixelRatio:o,stretchX:s,stretchY:l,content:u,sdf:a,version:c})}else{if(i.width===void 0||i.height===void 0)return this.fire(new Z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:p,height:h,data:f}=i,d=i;return this.style.addImage(t,{data:new we({width:p,height:h},new Uint8Array(f)),pixelRatio:o,stretchX:s,stretchY:l,content:u,sdf:a,version:c,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}}updateImage(t,i){let n=this.style.getImage(t);if(!n)return this.fire(new Z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=i instanceof HTMLImageElement||pt(i)?J.getImageData(i):i,{width:a,height:s,data:l}=o;if(a===void 0||s===void 0)return this.fire(new Z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||s!==n.data.height)return this.fire(new Z(new Error("The width and height of the updated image must be that same as the previous version of the image")));let u=!(i instanceof HTMLImageElement||pt(i));return n.data.replace(l,u),this.style.updateImage(t,n),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new Z(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return at.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,i,n){return this.style.setLayerZoomRange(t,i,n),this._update(!0)}setFilter(t,i,n={}){return this.style.setFilter(t,i,n),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,n,o={}){return this.style.setPaintProperty(t,i,n,o),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,n,o={}){return this.style.setLayoutProperty(t,i,n,o),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,i,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,n,o=>{o||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,n=>{n||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let i=this._canvasContainer=L.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);let a=this._controlContainer=L.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(l=>{s[l]=L.create("div","maplibregl-ctrl-".concat(l," "),a)})}_resizeCanvas(t,i,n){this._canvas.width=Math.floor(n*t),this._canvas.height=Math.floor(n*i),this._canvas.style.width="".concat(t,"px"),this._canvas.style.height="".concat(i,"px")}_setupPainter(){let t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},i=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{i={requestedAttributes:t},o&&(i.statusMessage=o.statusMessage,i.type=o.type)},{once:!0});let n=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!n){let o="Failed to initialize WebGL";throw i?(i.message=o,new Error(JSON.stringify(i))):new Error(o)}this.painter=new Uu(n,this.transform),Pn.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,s=J.now();this.style.zoomHistory.update(a,s);let l=new de(a,{now:s,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),u=l.crossFadingFactor();(u!==1||u!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=u),this.style.update(l)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,gn.mark("load"),this.fire(new z("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new z("idle")),this._loaded&&!this._fullyLoaded&&!o&&(this._fullyLoaded=!0,gn.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var i;this._hash&&this._hash.remove();for(let n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),at.removeThrottleControl(this._imageQueueHandle),(i=this._resizeObserver)==null||i.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),gn.clearMetrics(),this._removed=!0,this.fire(new z("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,J.frameAsync(this._frameRequest).then(t=>{gn.frame(t),this._frameRequest=null,this._render(t)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return CM}getCameraTargetElevation(){return this.transform.elevation}};m();m();var S_=r=>{r.touchstart=r.dragStart,r.touchmoveWindow=r.dragMove,r.touchend=r.dragEnd},P_=({enable:r,clickTolerance:e,bearingDegreesPerPixelMoved:t=.8})=>{let i=new ga;return new cr({clickTolerance:e,move:(n,o)=>({bearingDelta:(o.x-n.x)*t}),moveStateManager:i,enable:r,assignEvents:S_})},T_=({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5})=>{let i=new ga;return new cr({clickTolerance:e,move:(n,o)=>({pitchDelta:(o.y-n.y)*t}),moveStateManager:i,enable:r,assignEvents:S_})};var kM={showCompass:!0,showZoom:!0,visualizePitch:!1},Gh=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())};this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(this._map.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(this._map.transform.angle*(180/Math.PI),"deg)");this._compassIcon.style.transform=e};this._setButtonTitle=(e,t)=>{let i=this._map._getUIString("NavigationControl.".concat(t));e.title=i,e.setAttribute("aria-label",i)};this.options=O({},kM,e),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new qh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let i=L.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},qh=class{constructor(e,t,i=!1){this.mousedown=e=>{this.startMouse(O({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),L.mousePos(this.element,e)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)};this.mousemove=e=>{this.moveMouse(e,L.mousePos(this.element,e))};this.mouseup=e=>{this.mouseRotate.dragEnd(e),this.mousePitch&&this.mousePitch.dragEnd(e),this.offTemp()};this.touchstart=e=>{e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.startTouch(e,this._startPos),L.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.addEventListener(window,"touchend",this.touchend))};this.touchmove=e=>{e.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.moveTouch(e,this._lastPos))};this.touchend=e=>{e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()};this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};this._clickTolerance=10;let n=e.dragRotate._mouseRotate.getClickTolerance(),o=e.dragRotate._mousePitch.getClickTolerance();this.element=t,this.mouseRotate=Qu({clickTolerance:n,enable:!0}),this.touchRotate=P_({clickTolerance:n,enable:!0}),this.map=e,i&&(this.mousePitch=ec({clickTolerance:o,enable:!0}),this.touchPitch=T_({clickTolerance:o,enable:!0})),L.addEventListener(t,"mousedown",this.mousedown),L.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(t,"touchcancel",this.reset)}startMouse(e,t){this.mouseRotate.dragStart(e,t),this.mousePitch&&this.mousePitch.dragStart(e,t),L.disableDrag()}startTouch(e,t){this.touchRotate.dragStart(e,t),this.touchPitch&&this.touchPitch.dragStart(e,t),L.disableDrag()}moveMouse(e,t){let i=this.map,{bearingDelta:n}=this.mouseRotate.dragMove(e,t)||{};if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){let{pitchDelta:o}=this.mousePitch.dragMove(e,t)||{};o&&i.setPitch(i.getPitch()+o)}}moveTouch(e,t){let i=this.map,{bearingDelta:n}=this.touchRotate.dragMove(e,t)||{};if(n&&i.setBearing(i.getBearing()+n),this.touchPitch){let{pitchDelta:o}=this.touchPitch.dragMove(e,t)||{};o&&i.setPitch(i.getPitch()+o)}}off(){let e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend)}};m();m();var bi;async function A_(r=!1){if(bi!==void 0&&!r)return bi;if(window.navigator.permissions===void 0)return bi=!!window.navigator.geolocation,bi;try{bi=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch(e){bi=!!window.navigator.geolocation}return bi}m();var Da=oe(ye(),1);m();function xc(r,e,t){let i=new re(r.lng,r.lat);if(r=new re(r.lng,r.lat),e){let n=new re(r.lng-360,r.lat),o=new re(r.lng+360,r.lat),a=t.locationPoint(r).distSqr(e);t.locationPoint(n).distSqr(e)<a?r=n:t.locationPoint(o).distSqr(e)<a&&(r=o)}for(;Math.abs(r.lng-t.center.lng)>180;){let n=t.locationPoint(r);if(n.x>=0&&n.y>=0&&n.x<=t.width&&n.y<=t.height)break;r.lng>t.center.lng?r.lng-=360:r.lng+=360}return r.lng!==i.lng&&t.locationPoint(r).y>t.height/2-t.getHorizon()?r:i}m();var La={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%)"};function bc(r,e,t){let i=r.classList;for(let n in La)i.remove("maplibregl-".concat(t,"-anchor-").concat(n));i.add("maplibregl-".concat(t,"-anchor-").concat(e))}var bn=class extends me{constructor(t){super();this._onKeyPress=t=>{let i=t.code,n=t.charCode||t.keyCode;(i==="Space"||i==="Enter"||n===32||n===13)&&this.togglePopup()};this._onMapClick=t=>{let i=t.originalEvent.target,n=this._element;this._popup&&(i===n||n.contains(i))&&this.togglePopup()};this._update=t=>{var a;if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();((t==null?void 0:t.type)==="terrain"||(t==null?void 0:t.type)==="render"&&!i)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=xc(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(a=this._lngLat)==null?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n="rotateZ(".concat(this._rotation,"deg)"):this._rotationAlignment==="map"&&(n="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let o="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?o="rotateX(0deg)":this._pitchAlignment==="map"&&(o="rotateX(".concat(this._map.getPitch(),"deg)")),(!t||t.type==="moveend")&&(this._pos=this._pos.round()),L.setTransform(this._element,"".concat(La[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(o," ").concat(n)),J.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&t.type==="moveend")}).catch(()=>{})};this._onMove=t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new z("dragstart"))),this.fire(new z("drag")))};this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new z("dragend")),this._state="inactive"};this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))};if(this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),!t||!t.element){this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");let i=L.createNS("http://www.w3.org/2000/svg","svg"),n=41,o=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height","".concat(n,"px")),i.setAttributeNS(null,"width","".concat(o,"px")),i.setAttributeNS(null,"viewBox","0 0 ".concat(o," ").concat(n));let a=L.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=L.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let l=L.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");let u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let v of u){let b=L.createNS("http://www.w3.org/2000/svg","ellipse");b.setAttributeNS(null,"opacity","0.04"),b.setAttributeNS(null,"cx","10.5"),b.setAttributeNS(null,"cy","5.80029008"),b.setAttributeNS(null,"rx",v.rx),b.setAttributeNS(null,"ry",v.ry),l.appendChild(b)}let c=L.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);let p=L.createNS("http://www.w3.org/2000/svg","path");p.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),c.appendChild(p);let h=L.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");let f=L.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),h.appendChild(f);let d=L.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(6.0, 7.0)"),d.setAttributeNS(null,"fill","#FFFFFF");let y=L.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(8.0, 8.0)");let g=L.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");let x=L.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),y.appendChild(g),y.appendChild(x),s.appendChild(l),s.appendChild(c),s.appendChild(h),s.appendChild(d),s.appendChild(y),i.appendChild(s),i.setAttributeNS(null,"height","".concat(n*this._scale,"px")),i.setAttributeNS(null,"width","".concat(o*this._scale,"px")),this._element.appendChild(i),this._offset=Da.default.convert(t&&t.offset||[0,-14])}else this._element=t.element,this._offset=Da.default.convert(t&&t.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),bc(this._element,this._anchor,"marker"),t&&t.className)for(let i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=re.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let o=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let t=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(t)t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map));else return this;return this}_updateOpacity(t=!1){var d,y;if(!((d=this._map)==null?void 0:d.terrain)){this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity);return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let n=this._map,o=n.terrain.depthAtPoint(this._pos),a=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom),s=n.transform.lngLatToCameraDepth(this._lngLat,a),l=.006;if(s-o<l){this._element.style.opacity=this._opacity;return}let u=-this._offset.y/n.transform._pixelPerMeter,c=Math.sin(n.getPitch()*Math.PI/180)*u,p=n.terrain.depthAtPoint(new Da.default(this._pos.x,this._pos.y-this._offset.y)),f=n.transform.lngLatToCameraDepth(this._lngLat,a+c)-p>l;(y=this._popup)!=null&&y.isOpen()&&f&&this._popup.remove(),this._element.style.opacity=f?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=Da.default.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return t===void 0&&i===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}};var LM={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},_c=0,za=!1,jh=class extends me{constructor(t){super();this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new z("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new z("geolocate",t)),this._finish()}};this._updateCamera=t=>{let i=new re(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,o=this._map.getBearing(),a=O({bearing:o},this.options.fitBoundsOptions),s=lt.fromLngLat(i,n);this._map.fitBounds(s,a,{geolocateSource:!0})};this._updateMarker=t=>{if(t){let i=new re(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()};this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()};this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&za)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new z("error",t)),this._finish()}};this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0};this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){ke("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bn({element:this._dotElement}),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{let n=i.originalEvent&&i.originalEvent.type==="resize";!i.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!n&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new z("trackuserlocationend")))})}};this.options=O({},LM,t)}onAdd(t){return this._map=t,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),A_().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,_c=0,za=!1}_isOutOfMapMaxBounds(t){let i=this._map.getMaxBounds(),n=t.coords;return i&&(n.longitude<i.getWest()||n.longitude>i.getEast()||n.latitude<i.getSouth()||n.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let t=this._map.getBounds(),i=t.getSouthEast(),n=t.getNorthEast(),o=i.distanceTo(n),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width="".concat(s,"px"),this._circleElement.style.height="".concat(s,"px")}trigger(){if(!this._setup)return ke("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 z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":_c--,za=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new z("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),_c++;let t;_c>1?(t={maximumAge:6e5,timeout:0},za=!0):(t=this.options.positionOptions,za=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};m();var DM={maxWidth:100,unit:"metric"},Zh=class{constructor(e){this._onMove=()=>{M_(this._map,this._container,this.options)};this.setUnit=e=>{this.options.unit=e,M_(this._map,this._container,this.options)};this.options=Bt(Bt({},DM),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};function M_(r,e,t){let i=t&&t.maxWidth||100,n=r._container.clientHeight/2,o=r.unproject([0,n]),a=r.unproject([i,n]),s=o.distanceTo(a);if(t&&t.unit==="imperial"){let l=3.2808*s;if(l>5280){let u=l/5280;Fa(e,i,u,r._getUIString("ScaleControl.Miles"))}else Fa(e,i,l,r._getUIString("ScaleControl.Feet"))}else if(t&&t.unit==="nautical"){let l=s/1852;Fa(e,i,l,r._getUIString("ScaleControl.NauticalMiles"))}else s>=1e3?Fa(e,i,s/1e3,r._getUIString("ScaleControl.Kilometers")):Fa(e,i,s,r._getUIString("ScaleControl.Meters"))}function Fa(r,e,t,i){let n=FM(t),o=n/t;r.style.width="".concat(e*o,"px"),r.innerHTML="".concat(n," ").concat(i)}function zM(r){let e=Math.pow(10,Math.ceil(-Math.log(r)/Math.LN10));return Math.round(r*e)/e}function FM(r){let e=Math.pow(10,"".concat(Math.floor(r)).length-1),t=r/e;return t=t>=10?10:t>=5?5:t>=3?3:t>=2?2:t>=1?1:zM(t),e*t}m();var Hh=class extends me{constructor(t={}){super();this._onFullscreenChange=()=>{var i;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;(i=t==null?void 0:t.shadowRoot)!=null&&i.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()};this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()};this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:ke("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new z("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new z("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};m();var $h=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()};this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))};this.options=e}onAdd(e){return this._map=e,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};m();var qe=oe(ye(),1);var RM={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},BM=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Wh=class extends me{constructor(t){super();this.remove=()=>(this._content&&L.remove(this._content),this._container&&(L.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new z("close"))),this);this._onMouseUp=t=>{this._update(t.point)};this._onMouseMove=t=>{this._update(t.point)};this._onDrag=t=>{this._update(t.point)};this._update=t=>{var l;let i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let u of this.options.className.split(" "))this._container.classList.add(u);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=xc(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(l=this._lngLat)==null?void 0:l.wrap(),this._trackPointer&&!t)return;let n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor,a=I_(this.options.offset);if(!o){let u=this._container.offsetWidth,c=this._container.offsetHeight,p;n.y+a.bottom.y<c?p=["top"]:n.y>this._map.transform.height-c?p=["bottom"]:p=[],n.x<u/2?p.push("left"):n.x>this._map.transform.width-u/2&&p.push("right"),p.length===0?o="bottom":o=p.join("-")}let s=n.add(a[o]);this.options.subpixelPositioning||(s=s.round()),L.setTransform(this._container,"".concat(La[o]," translate(").concat(s.x,"px,").concat(s.y,"px)")),bc(this._container,o,"popup")};this._onClose=()=>{this.remove()};this.options=O(Object.create(RM),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new z("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=re.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let i=document.createDocumentFragment(),n=document.createElement("body"),o;for(n.innerHTML=t;o=n.firstChild,!!o;)i.appendChild(o);return this.setDOMContent(i)}getMaxWidth(){var t;return(t=this._container)==null?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector(BM);t&&t.focus()}};function I_(r){if(r)if(typeof r=="number"){let e=Math.round(Math.abs(r)/Math.SQRT2);return{center:new qe.default(0,0),top:new qe.default(0,r),"top-left":new qe.default(e,e),"top-right":new qe.default(-e,e),bottom:new qe.default(0,-r),"bottom-left":new qe.default(e,-e),"bottom-right":new qe.default(-e,-e),left:new qe.default(r,0),right:new qe.default(-r,0)}}else if(r instanceof qe.default||Array.isArray(r)){let e=qe.default.convert(r);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}else return{center:qe.default.convert(r.center||[0,0]),top:qe.default.convert(r.top||[0,0]),"top-left":qe.default.convert(r["top-left"]||[0,0]),"top-right":qe.default.convert(r["top-right"]||[0,0]),bottom:qe.default.convert(r.bottom||[0,0]),"bottom-left":qe.default.convert(r["bottom-left"]||[0,0]),"bottom-right":qe.default.convert(r["bottom-right"]||[0,0]),left:qe.default.convert(r.left||[0,0]),right:qe.default.convert(r.right||[0,0])};else return I_(new qe.default(0,0))}var OM=oe(ye(),1);var VM=Ba.version;function CY(r,e){return Rr().setRTLTextPlugin(r,e)}function EY(){return Rr().getRTLTextPluginStatus()}function kY(){return VM}function LY(){return Lr.workerCount}function DY(r){Lr.workerCount=r}function zY(){return Xe.MAX_PARALLEL_IMAGE_REQUESTS}function FY(r){Xe.MAX_PARALLEL_IMAGE_REQUESTS=r}function RY(){return Xe.WORKER_URL}function BY(r){Xe.WORKER_URL=r}function OY(r){return Il().broadcast("IS",r)}export{zg as a,Xe as b,V_ as c,U_ as d,jr as e,me as f,oA as g,aA as h,re as i,lt as j,ze as k,$o as l,mi as m,Xo as n,Ko as o,Et as p,Jo as q,Yo as r,yA as s,mn as t,ha as u,ju as v,fa as w,it as x,Br as y,ma as z,da as A,ba as B,_a as C,va as D,wa as E,Sa as F,Pa as G,Ta as H,Aa as I,Ma as J,Ia as K,Ca as L,Ea as M,Nh as N,Gh as O,bn as P,jh as Q,Zh as R,Hh as S,$h as T,Wh as U,OM as V,CY as W,EY as X,kY as Y,LY as Z,DY as _,zY as $,FY as aa,RY as ba,BY as ca,OY as da};
|