@poadio/app-vue 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/app-vue.css +14 -0
  3. package/dist/items.d.ts.map +1 -1
  4. package/dist/items.js +344 -85
  5. package/dist/items.js.map +1 -1
  6. package/dist/sections/grid.d.ts.map +1 -1
  7. package/dist/sections/grid.js +11 -2
  8. package/dist/sections/grid.js.map +1 -1
  9. package/package.json +2 -2
  10. package/runtime-dist/app.css +14 -0
  11. package/runtime-dist/app.js +2 -2
  12. package/runtime-dist/c-008ty6rk.js +2 -0
  13. package/runtime-dist/c-05mfa190.js +1 -0
  14. package/runtime-dist/c-0j0qq16x.js +1 -0
  15. package/runtime-dist/c-0q89m260.js +1 -0
  16. package/runtime-dist/{c-4mqnegk0.js → c-0s78cd21.js} +1 -1
  17. package/runtime-dist/{c-770ysy0b.js → c-1ceh9z6n.js} +1 -1
  18. package/runtime-dist/c-1hv05jxf.js +2 -0
  19. package/runtime-dist/c-2ad7era6.js +1 -0
  20. package/runtime-dist/c-2d4zg49c.js +1 -0
  21. package/runtime-dist/c-2e4pej9y.js +1 -0
  22. package/runtime-dist/c-2jaeb7hb.js +1 -0
  23. package/runtime-dist/{c-t31wwv0j.js → c-31k4h9e3.js} +1 -1
  24. package/runtime-dist/{c-6pfxp4ca.js → c-323cmvmr.js} +2 -2
  25. package/runtime-dist/{c-aebecc6a.js → c-38mbqn1q.js} +1 -1
  26. package/runtime-dist/{c-mb798tvv.js → c-3at1wc60.js} +2 -2
  27. package/runtime-dist/{c-0arc0hg5.js → c-3cbct4j0.js} +1 -1
  28. package/runtime-dist/c-4c6bp5ge.js +1 -0
  29. package/runtime-dist/c-4h6g9784.js +1 -0
  30. package/runtime-dist/{c-632d3gvm.js → c-4qan80kf.js} +1 -1
  31. package/runtime-dist/{c-z6dbvc3p.js → c-4xcsa9sp.js} +2 -2
  32. package/runtime-dist/c-5a6mxded.js +1 -0
  33. package/runtime-dist/c-5kyzr3hv.js +2 -0
  34. package/runtime-dist/{c-0x2e39ve.js → c-5vtfap6v.js} +2 -2
  35. package/runtime-dist/{c-hwgt6amh.js → c-5xrh3qmz.js} +2 -2
  36. package/runtime-dist/c-5zfmt59k.js +2 -0
  37. package/runtime-dist/c-6jjary0p.js +1 -0
  38. package/runtime-dist/c-6w1r241j.js +1 -0
  39. package/runtime-dist/{c-00cvgnxc.js → c-770qn5gr.js} +1 -1
  40. package/runtime-dist/{c-dzp10g67.js → c-7dq4rx1n.js} +3 -3
  41. package/runtime-dist/{c-nm6tjep8.js → c-80vaq27v.js} +1 -1
  42. package/runtime-dist/{c-ytpw5gj2.js → c-81zrdysm.js} +1 -1
  43. package/runtime-dist/c-8jrmqdq1.js +1 -0
  44. package/runtime-dist/c-8wdrb81n.js +1 -0
  45. package/runtime-dist/{c-ejgrzqe3.js → c-8wf8b0sr.js} +1 -1
  46. package/runtime-dist/{c-gty08djr.js → c-8zmpdrm5.js} +2 -2
  47. package/runtime-dist/{c-zbts8rvw.js → c-8zzjexhj.js} +2 -2
  48. package/runtime-dist/c-900h0yca.js +1 -0
  49. package/runtime-dist/{c-8cydj5g6.js → c-908e6t37.js} +3 -3
  50. package/runtime-dist/{c-170fz4v2.js → c-90cnzxxw.js} +1 -1
  51. package/runtime-dist/c-996zhc7v.js +1 -0
  52. package/runtime-dist/{c-an1sk7z5.js → c-9q0awp0g.js} +2 -2
  53. package/runtime-dist/c-afwe6e7h.js +1 -0
  54. package/runtime-dist/{c-tjk566f2.js → c-akbde6sp.js} +2 -2
  55. package/runtime-dist/c-bbkx8ha0.js +2 -0
  56. package/runtime-dist/{c-v73qt5av.js → c-bezqdzja.js} +1 -1
  57. package/runtime-dist/c-c6t3xp1f.js +1 -0
  58. package/runtime-dist/{c-m4wr50z4.js → c-d0w2v0ry.js} +1 -1
  59. package/runtime-dist/{c-6nx9xkc1.js → c-d10mvt3y.js} +1 -1
  60. package/runtime-dist/c-d15cp8ae.js +7 -0
  61. package/runtime-dist/{c-xyqqhx8j.js → c-darzv9dx.js} +7 -7
  62. package/runtime-dist/c-dfmaz8kq.js +1 -0
  63. package/runtime-dist/{c-8xc3fha3.js → c-e4eywyqm.js} +2 -2
  64. package/runtime-dist/{c-pager3te.js → c-e71rhzgd.js} +1 -1
  65. package/runtime-dist/{c-93kndqea.js → c-ehvh73gz.js} +1 -1
  66. package/runtime-dist/{c-2z768p0x.js → c-fgymwk56.js} +2 -2
  67. package/runtime-dist/{c-stez1fhk.js → c-fj70dzwc.js} +2 -2
  68. package/runtime-dist/c-fn3ddac2.js +1 -0
  69. package/runtime-dist/{c-zhvsa0wq.js → c-fye4ktyb.js} +2 -2
  70. package/runtime-dist/c-g1sapcjb.js +1 -0
  71. package/runtime-dist/{c-9pzq231t.js → c-gcp7pgzj.js} +1 -1
  72. package/runtime-dist/c-hga6v8y5.js +2 -0
  73. package/runtime-dist/{c-znyeph7c.js → c-hkqab6a9.js} +1 -1
  74. package/runtime-dist/{c-8v7c8j85.js → c-hqcvt3z9.js} +2 -2
  75. package/runtime-dist/{c-kt8hnx3r.js → c-htmgkvv5.js} +1 -1
  76. package/runtime-dist/{c-r539tr5f.js → c-htx6kd3m.js} +1 -1
  77. package/runtime-dist/c-hwv8e548.js +1 -0
  78. package/runtime-dist/{c-f4fpjjsk.js → c-j18jra7n.js} +1 -1
  79. package/runtime-dist/{c-fq9wga43.js → c-j2m0kaz5.js} +1 -1
  80. package/runtime-dist/c-jcnz4p9h.js +1 -0
  81. package/runtime-dist/c-jeke4j5f.js +1 -0
  82. package/runtime-dist/{c-5bxybf9g.js → c-jfhd21m0.js} +2 -2
  83. package/runtime-dist/{c-4w8c01x6.js → c-jgq8c478.js} +2 -2
  84. package/runtime-dist/{c-bbgsrr8m.js → c-jtbbtv7w.js} +1 -1
  85. package/runtime-dist/{c-x0evjwqg.js → c-jz0pz4sa.js} +2 -2
  86. package/runtime-dist/c-k473g4p1.js +1 -0
  87. package/runtime-dist/{c-76450e09.js → c-kge0a8jt.js} +1 -1
  88. package/runtime-dist/{c-n5896ck3.js → c-kkgxaaxx.js} +2 -2
  89. package/runtime-dist/{c-afjwwspe.js → c-kvaqyz6q.js} +1 -1
  90. package/runtime-dist/c-m1a3vb0b.js +1 -0
  91. package/runtime-dist/{c-q9h7pf4v.js → c-m61eyj12.js} +1 -1
  92. package/runtime-dist/c-mc9sevgd.js +1 -0
  93. package/runtime-dist/{c-ckkpv1ab.js → c-mttkd1hb.js} +1 -1
  94. package/runtime-dist/{c-v43kzdgm.js → c-mzfdqh06.js} +1 -1
  95. package/runtime-dist/{c-272dwppe.js → c-n6ngg2xw.js} +1 -1
  96. package/runtime-dist/{c-0x2jfka0.js → c-n77b13je.js} +1 -1
  97. package/runtime-dist/c-nc4950dr.js +1 -0
  98. package/runtime-dist/{c-bbqq1fmz.js → c-ndjpabjd.js} +2 -2
  99. package/runtime-dist/{c-bypwvtv5.js → c-ndqn9k3b.js} +1 -1
  100. package/runtime-dist/{c-hddfmemr.js → c-nh1crnme.js} +2 -2
  101. package/runtime-dist/{c-z00nq4vy.js → c-p1knyfjp.js} +2 -2
  102. package/runtime-dist/{c-d9eczdnp.js → c-p7exw6x4.js} +1 -1
  103. package/runtime-dist/c-p8gmqk2c.js +2 -0
  104. package/runtime-dist/{c-hcd75fdn.js → c-peqr6b73.js} +1 -1
  105. package/runtime-dist/c-pf0hf4z0.js +1 -0
  106. package/runtime-dist/{c-09vj399g.js → c-pwb1zdth.js} +1 -1
  107. package/runtime-dist/{c-22qerref.js → c-q9sz4140.js} +2 -2
  108. package/runtime-dist/c-qancp7fv.js +1 -0
  109. package/runtime-dist/{c-cyvq3zhq.js → c-r8caw0b4.js} +1 -1
  110. package/runtime-dist/{c-ncw09fhf.js → c-ra8vp32m.js} +1 -1
  111. package/runtime-dist/{c-ah4kckw8.js → c-rpantxdv.js} +2 -2
  112. package/runtime-dist/{c-b9npcc8v.js → c-sen28fd3.js} +1 -1
  113. package/runtime-dist/{c-9hk02377.js → c-t3at1w4r.js} +1 -1
  114. package/runtime-dist/c-t77hdys1.js +2 -0
  115. package/runtime-dist/{c-aetcxxs5.js → c-td669s77.js} +2 -2
  116. package/runtime-dist/{c-g0s6z8fh.js → c-tfkx1ms2.js} +1 -1
  117. package/runtime-dist/c-traxh6dd.js +2 -0
  118. package/runtime-dist/c-v13nz4jj.js +1 -0
  119. package/runtime-dist/c-v59gffnx.js +7 -0
  120. package/runtime-dist/c-wcm09eer.js +1 -0
  121. package/runtime-dist/c-wfexgh4m.js +2 -0
  122. package/runtime-dist/{c-sgr6dj0y.js → c-x7f6s1vz.js} +1 -1
  123. package/runtime-dist/{c-jpgfd99h.js → c-y0qqtc02.js} +1 -1
  124. package/runtime-dist/c-ydb0jv9k.js +1 -0
  125. package/runtime-dist/{c-1j1xssd8.js → c-yg69d4wg.js} +2 -2
  126. package/runtime-dist/c-yrfjn186.js +2 -0
  127. package/runtime-dist/{c-pca88tas.js → c-yz4h2z4n.js} +1 -1
  128. package/runtime-dist/{c-nacvp4ca.js → c-z9ry29gh.js} +1 -1
  129. package/runtime-dist/{c-jhscxp68.js → c-zbjpj2yd.js} +1 -1
  130. package/runtime-dist/version.json +1 -1
  131. package/src/items.ts +446 -95
  132. package/src/sections/grid.ts +10 -2
  133. package/runtime-dist/c-1aa5pzps.js +0 -1
  134. package/runtime-dist/c-1h3k0kb8.js +0 -1
  135. package/runtime-dist/c-1n6fcyf0.js +0 -1
  136. package/runtime-dist/c-38nmw75x.js +0 -1
  137. package/runtime-dist/c-3gqmyt95.js +0 -1
  138. package/runtime-dist/c-4s1xdsjj.js +0 -2
  139. package/runtime-dist/c-5crndmh8.js +0 -1
  140. package/runtime-dist/c-7eh8g4bg.js +0 -1
  141. package/runtime-dist/c-8g74gqn9.js +0 -2
  142. package/runtime-dist/c-96a9b7ys.js +0 -1
  143. package/runtime-dist/c-a3jhm7jm.js +0 -1
  144. package/runtime-dist/c-aenj05yt.js +0 -2
  145. package/runtime-dist/c-bemne227.js +0 -1
  146. package/runtime-dist/c-d3jg3nhc.js +0 -1
  147. package/runtime-dist/c-d68hg40s.js +0 -1
  148. package/runtime-dist/c-d8ba6h4e.js +0 -1
  149. package/runtime-dist/c-e5eq2szv.js +0 -2
  150. package/runtime-dist/c-e7rb0mk1.js +0 -1
  151. package/runtime-dist/c-ezj4yg2q.js +0 -1
  152. package/runtime-dist/c-f23v2025.js +0 -2
  153. package/runtime-dist/c-fps4599a.js +0 -1
  154. package/runtime-dist/c-g06g8vzv.js +0 -1
  155. package/runtime-dist/c-g0ncg08s.js +0 -7
  156. package/runtime-dist/c-hqtxax0h.js +0 -1
  157. package/runtime-dist/c-mpvzhygt.js +0 -1
  158. package/runtime-dist/c-mqwew5y8.js +0 -1
  159. package/runtime-dist/c-p1cbp7e1.js +0 -1
  160. package/runtime-dist/c-pp0qxmbz.js +0 -2
  161. package/runtime-dist/c-pttdwpdd.js +0 -1
  162. package/runtime-dist/c-qcz7q5fj.js +0 -2
  163. package/runtime-dist/c-qhv2qby2.js +0 -2
  164. package/runtime-dist/c-r7qgrz3b.js +0 -2
  165. package/runtime-dist/c-ra7b526a.js +0 -1
  166. package/runtime-dist/c-rm3pkjj7.js +0 -1
  167. package/runtime-dist/c-srccgg45.js +0 -2
  168. package/runtime-dist/c-tc2bxsyc.js +0 -1
  169. package/runtime-dist/c-tjqjxwfa.js +0 -1
  170. package/runtime-dist/c-tpa4vh9k.js +0 -1
  171. package/runtime-dist/c-w1cb3r8h.js +0 -1
  172. package/runtime-dist/c-wcha6k7x.js +0 -1
  173. package/runtime-dist/c-x2jj49ts.js +0 -1
  174. package/runtime-dist/c-xhyafw4q.js +0 -1
  175. package/runtime-dist/c-y7f2tjg6.js +0 -7
  176. package/runtime-dist/c-yf86vgtz.js +0 -2
  177. package/runtime-dist/c-yhzkcpdp.js +0 -1
  178. package/runtime-dist/c-zhwr1x02.js +0 -1
@@ -1,4 +1,4 @@
1
- import{Dr,hr}from"./c-g0ncg08s.js";var l0=hr(function(_l,a0){(function(W,Xi){typeof _l=="object"&&typeof a0<"u"?Xi(_l):typeof define=="function"&&define.amd?define(["exports"],Xi):Xi((W=typeof globalThis<"u"?globalThis:W||self).maplibregl={})})(_l,function(W){var Xi,sd,ad="5.24.1";function it(t,e,i,r){return new(i||(i=Promise))(function(n,o){function s(l){try{c(r.next(l))}catch(u){o(u)}}function a(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?n(l.value):(u=l.value,u instanceof i?u:new i(function(h){h(u)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function z(t,e){this.x=t,this.y=e}function ld(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}typeof SuppressedError=="function"&&SuppressedError,z.prototype={clone(){return new z(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround(t,e){let i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:z},z.convert=function(t){if(t instanceof z)return t;if(Array.isArray(t))return new z(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new z(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var c0=function(){if(sd)return Xi;function t(e,i,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=n}return sd=1,Xi=t,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,i){if(i===void 0&&(i=0.000001),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<i)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<0.000001)break;r-=o/s}var a=0,c=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<i));n++)e>o?a=r:c=r,r=0.5*(c-a)+a;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Xi}(),h0=ld(c0);let gl,Wo;function cd(){return gl!=null||(gl=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),gl}var oe=0.000001,Qt=typeof Float32Array<"u"?Float32Array:Array;function hd(){var t=new Qt(4);return Qt!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function ud(){var t=new Qt(9);return Qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Ci(){var t=new Qt(16);return Qt!=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 yl(t){var e=new Qt(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 He(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 Ho(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],_=e[14],y=e[15],v=i*a-r*s,g=i*c-n*s,x=i*l-o*s,b=r*c-n*a,w=r*l-o*a,T=n*l-o*c,P=u*m-h*f,S=u*_-p*f,E=u*y-d*f,I=h*_-p*m,C=h*y-d*m,A=p*y-d*_,M=v*A-g*C+x*I+b*E-w*S+T*P;return M?(t[0]=(a*A-c*C+l*I)*(M=1/M),t[1]=(n*C-r*A-o*I)*M,t[2]=(m*T-_*w+y*b)*M,t[3]=(p*w-h*T-d*b)*M,t[4]=(c*E-s*A-l*S)*M,t[5]=(i*A-n*E+o*S)*M,t[6]=(_*x-f*T-y*g)*M,t[7]=(u*T-p*x+d*g)*M,t[8]=(s*C-a*E+l*P)*M,t[9]=(r*E-i*C-o*P)*M,t[10]=(f*w-m*x+y*v)*M,t[11]=(h*x-u*w-d*v)*M,t[12]=(a*S-s*I-c*P)*M,t[13]=(i*I-r*S+n*P)*M,t[14]=(m*g-f*b-_*v)*M,t[15]=(u*b-h*g+p*v)*M,t):null}function Sr(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],_=e[13],y=e[14],v=e[15],g=i[0],x=i[1],b=i[2],w=i[3];return t[0]=g*r+x*a+b*h+w*m,t[1]=g*n+x*c+b*p+w*_,t[2]=g*o+x*l+b*d+w*y,t[3]=g*s+x*u+b*f+w*v,t[4]=(g=i[4])*r+(x=i[5])*a+(b=i[6])*h+(w=i[7])*m,t[5]=g*n+x*c+b*p+w*_,t[6]=g*o+x*l+b*d+w*y,t[7]=g*s+x*u+b*f+w*v,t[8]=(g=i[8])*r+(x=i[9])*a+(b=i[10])*h+(w=i[11])*m,t[9]=g*n+x*c+b*p+w*_,t[10]=g*o+x*l+b*d+w*y,t[11]=g*s+x*u+b*f+w*v,t[12]=(g=i[12])*r+(x=i[13])*a+(b=i[14])*h+(w=i[15])*m,t[13]=g*n+x*c+b*p+w*_,t[14]=g*o+x*l+b*d+w*y,t[15]=g*s+x*u+b*f+w*v,t}function Ot(t,e,i){var r,n,o,s,a,c,l,u,h,p,d,f,m=i[0],_=i[1],y=i[2];return e===t?(t[12]=e[0]*m+e[4]*_+e[8]*y+e[12],t[13]=e[1]*m+e[5]*_+e[9]*y+e[13],t[14]=e[2]*m+e[6]*_+e[10]*y+e[14],t[15]=e[3]*m+e[7]*_+e[11]*y+e[15]):(n=e[1],o=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=s,t[4]=a,t[5]=c,t[6]=l,t[7]=u,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=r*m+a*_+h*y+e[12],t[13]=n*m+c*_+p*y+e[13],t[14]=o*m+l*_+d*y+e[14],t[15]=s*m+u*_+f*y+e[15]),t}function Wt(t,e,i){var r=i[0],n=i[1],o=i[2];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]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,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 oi(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],p=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*n+l*r,t[5]=s*n+u*r,t[6]=a*n+h*r,t[7]=c*n+p*r,t[8]=l*n-o*r,t[9]=u*n-s*r,t[10]=h*n-a*r,t[11]=p*n-c*r,t}function Xo(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],c=e[3],l=e[8],u=e[9],h=e[10],p=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*n-l*r,t[1]=s*n-u*r,t[2]=a*n-h*r,t[3]=c*n-p*r,t[8]=o*r+l*n,t[9]=s*r+u*n,t[10]=a*r+h*n,t[11]=c*r+p*n,t}function xi(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],c=e[3],l=e[4],u=e[5],h=e[6],p=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*n+l*r,t[1]=s*n+u*r,t[2]=a*n+h*r,t[3]=c*n+p*r,t[4]=l*n-o*r,t[5]=u*n-s*r,t[6]=h*n-a*r,t[7]=p*n-c*r,t}var vl=function(t,e,i,r,n){var o=1/Math.tan(e/2);if(t[0]=o/i,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,n!=null&&n!==1/0){var s=1/(r-n);t[10]=(n+r)*s,t[14]=2*n*r*s}else t[10]=-1,t[14]=-2*r;return t},si=function(t,e,i,r,n,o,s){var a=1/(e-i),c=1/(r-n),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*c,t[14]=(s+o)*l,t[15]=1,t};function dd(){var t=new Qt(3);return Qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function xl(t){var e=new Qt(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Yo(t){var e=t[0],i=t[1],r=t[2];return Math.sqrt(e*e+i*i+r*r)}function pd(t,e,i){var r=new Qt(3);return r[0]=t,r[1]=e,r[2]=i,r}function Be(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Zt(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Xe(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function ce(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ai(t,e,i){var r=e[0],n=e[1],o=e[2],s=i[0],a=i[1],c=i[2];return t[0]=n*c-o*a,t[1]=o*s-r*c,t[2]=r*a-n*s,t}function bl(t,e,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=e[0],c=e[1],l=e[2],u=n*l-o*c,h=o*a-r*l,p=r*c-n*a;return t[0]=a+s*(u+=u)+n*(p+=p)-o*(h+=h),t[1]=c+s*h+o*u-r*p,t[2]=l+s*p+r*h-n*u,t}function Ko(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function An(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function wl(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}var zn,bi=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},Tl=Yo;function Yt(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,t}function fd(){var t=new Qt(4);return Qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function md(t,e,i,r){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",o=Math.PI/360;e*=o,r*=o,i*=o;var s=Math.sin(e),a=Math.cos(e),c=Math.sin(i),l=Math.cos(i),u=Math.sin(r),h=Math.cos(r);switch(n){case"xyz":t[0]=s*l*h+a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h-s*c*u;break;case"xzy":t[0]=s*l*h-a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h+s*c*u;break;case"yxz":t[0]=s*l*h+a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h+s*c*u;break;case"yzx":t[0]=s*l*h+a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h-s*c*u;break;case"zxy":t[0]=s*l*h-a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h-s*c*u;break;case"zyx":t[0]=s*l*h-a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h+s*c*u;break;default:throw Error("Unknown angle order "+n)}return t}function Sl(){var t=new Qt(2);return Qt!=Float32Array&&(t[0]=0,t[1]=0),t}function _d(t,e){var i=new Qt(2);return i[0]=t,i[1]=e,i}function gd(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function yd(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)}function vd(t){return t[0]=0,t[1]=0,t}dd(),zn=new Qt(4),Qt!=Float32Array&&(zn[0]=0,zn[1]=0,zn[2]=0,zn[3]=0),dd(),pd(1,0,0),pd(0,1,0),fd(),fd(),ud();var u0=function(t){var e=t[0],i=t[1];return e*e+i*i};Sl();let F=8192;function Me(t,e,i){return e*(F/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function me(t){return t instanceof Error?t:Error(typeof t=="string"?t:String(t))}function Dn(){return new Float64Array(4)}function Gt(){return new Float64Array(3)}function Ai(){return new Float64Array(16)}function Pr(){let t=new Float64Array(16);return He(t),t}function xd(){let t=new Float32Array(16);return He(t),t}function zi(t,e,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let o=n?r==="map"?-t.bearingInRadians:0:r==="viewport"?t.bearingInRadians:0;if(o){let s=Math.sin(o),a=Math.cos(o);i=[i[0]*a-i[1]*s,i[0]*s+i[1]*a]}return[n?i[0]:Me(e,i[0],t.zoom),n?i[1]:Me(e,i[1],t.zoom)]}function Pl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function Oe(t,e,i){let r=(n=[t[0],t[1],t[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((u=n[8])*(s=n[4])-(a=n[5])*(l=n[7]))+n[1]*(-u*(o=n[3])+a*(c=n[6]))+n[2]*(l*o-s*c);var n,o,s,a,c,l,u;if(r===0)return null;let h=ai([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),p=ai([],[i[0],i[1],i[2]],[t[0],t[1],t[2]]),d=ai([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),f=Zt([],h,-t[3]);return Be(f,f,Zt([],p,-e[3])),Be(f,f,Zt([],d,-i[3])),Zt(f,f,1/r),f}function d0(t,e,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return r===0?null:(-(t[0]*i[0]+t[1]*i[1]+t[2]*i[2])-i[3])/r}function Jo(t,e,i,r){let n=Math.sqrt(t*t+e*e),o=Math.sqrt(i*i+r*r);t/=n,e/=n,i/=o,r/=o;let s=Math.acos(t*i+e*r);return-e*i+t*r>0?s:-s}function Ce(t,e){let i=Ir(t,360),r=Ir(e,360),n=r-i,o=r>i?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o}function Qo(t,e){let i=Ir(t,2*Math.PI),r=Ir(e,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))}function Ir(t,e){return(t%e+e)%e}function ts(t,e,i,r,n){return Er(r,n,_t((t-e)/(i-e),0,1))}function Er(t,e,i){return t*(1-i)+e*i}function p0(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(let o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[e,i,r,n]}function bd(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,i=e*t;return 4*(t<0.5?i:3*(t-e)+i-0.75)}function Il(t,e,i,r){let n=new h0(t,e,i,r);return(o)=>n.solve(o)}let El=Il(0.25,0.1,0.25,1);function _t(t,e,i){return Math.min(i,Math.max(e,t))}function Ye(t,e,i){let r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function G(t,...e){for(let i of e)for(let r in i)t[r]=i[r];return t}function Rn(t,e){let i={};for(let r of e)r in t&&(i[r]=t[r]);return i}let f0=1;function wd(){return f0++}function _e(t){return Math.pow(2,t)}function he(t){return Math.log(t)/Math.LN2}function Ae(t,e,i){if(e<=0)return t;let r=1/e;return i===void 0||Math.abs(i)<0.0000000001?Math.round(t*r)/r:(i>0?Math.ceil(t*r-0.000000001):Math.floor(t*r+0.0000000001))/r}function Ml(t,e,i){let r={};for(let n in t)r[n]=e.call(this,t[n],n,t);return r}function Td(t,e,i){let r={};for(let n in t)e.call(this,t[n],n,t)&&(r[n]=t[n]);return r}function li(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!li(t[i],e[i]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object")return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!li(t[i],e[i]))return!1;return!0}return t===e}function be(t){return Array.isArray(t)?t.map(be):typeof t=="object"&&t?Ml(t,be):t}let Sd={};function Ct(t){Sd[t]||(typeof console<"u"&&console.warn(t),Sd[t]=!0)}function Di(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}let Cl=null;function Yi(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}let Pd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Al(t,e,i,r){return t.addEventListener(e,i,r),{unsubscribe:()=>{t.removeEventListener(e,i,r)}}}function Vt(t){return t*Math.PI/180}function Cr(t){return t/Math.PI*180}function Id(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing}function Ed(t,e,i){let r=_d(e.x-i.x,e.y-i.y),n=_d(t.x-i.x,t.y-i.y);var o,s;return Cr(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(s=n)[0]+o[1]*s[1]))}function Md(t,e,i){let r=new Float64Array(4);return md(r,t,e-90,i),r}let kn=85.051129,Cd={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Ad={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function m0(t,e){var i;if(!Ad[e])return!1;let r=t==null?void 0:t.target,n=((i=r==null?void 0:r.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return t instanceof n.MouseEvent||t instanceof n.WheelEvent}let zl="AbortError";class Ln extends Error{constructor(t=zl){super(t instanceof Error?t.message:t),this.name=zl,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function Ar(t){return t instanceof Error&&t.name===zl}function zd(t){if(t.aborted)throw new Ln(t.reason)}let es,Dl,Rl,ge={frame(t,e,i,r){let n=r||window,o=n.requestAnimationFrame((a)=>{s(),e(a)}),{unsubscribe:s}=Al(t.signal,"abort",()=>{s(),n.cancelAnimationFrame(o),i(new Ln(t.signal.reason))},!1)},frameAsync(t,e){return new Promise((i,r)=>{this.frame(t,i,r,e)})},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){let e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:(t)=>(es||(es=document.createElement("a")),es.href=t,es.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Rl!==void 0?Rl:!!matchMedia&&(Dl!=null||(Dl=matchMedia("(prefers-reduced-motion: reduce)")),Dl.matches)},set prefersReducedMotion(t){Rl=t}},is=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function St(){return is.getCurrentTime()}var kl;let _0=new Set(["a","abbr","b","bdi","bdo","br","cite","code","del","div","em","i","img","ins","kbd","li","mark","ol","p","q","s","samp","small","span","strong","sub","sup","time","u","ul","var","wbr"]),g0=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),y0=new Set(["href","src"]),v0=new Set(["http:","https:","mailto:"]),Ll;function Fl(){return Ll!=null||(Ll={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}),Ll}class N{static create(t,e,i){let r=window.document.createElement(t);return e!==void 0&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){N.docStyle&&N.selectProp&&(N.userSelect=N.docStyle[N.selectProp],N.docStyle[N.selectProp]="none")}static enableDrag(){N.docStyle&&N.selectProp&&(N.docStyle[N.selectProp]=N.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",N.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",N.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",N.suppressClickInternal,!0)},0)}static getScale(t){let e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,e,i){let r=e.boundingClientRect;return new z((i.clientX-r.left)/e.x-t.clientLeft,(i.clientY-r.top)/e.y-t.clientTop)}static mousePos(t,e){let i=N.getScale(t);return N.getPoint(t,i,e)}static touchPos(t,e){let i=[],r=N.getScale(t);for(let n of e)i.push(N.getPoint(t,r,n));return i}static sanitize(t){let e=new DOMParser().parseFromString(t,"text/html").body,{querySelectorAll:i,remove:r}=Fl();for(let o of Array.from(i.call(e,"*")))N.isAllowedElement(o)?N.removeDisallowedAttributes(o):r.call(o);let n=document.createDocumentFragment();return n.append(...e.childNodes),n}static isAllowedElement(t){let{namespaceURI:e,localName:i}=Fl();return e.call(t)==="http://www.w3.org/1999/xhtml"&&_0.has(i.call(t))}static removeDisallowedAttributes(t){let{getAttributeNames:e,getAttribute:i,removeAttribute:r}=Fl();for(let n of e.call(t))N.isAllowedAttribute(n,i.call(t,n))||r.call(t,n)}static isAllowedAttribute(t,e){if(!g0.has(t)&&!t.startsWith("aria-"))return!1;if(!y0.has(t))return!0;try{return v0.has(new URL(e,"https://maplibre.invalid/").protocol)}catch(i){return!1}}}N.docStyle=typeof window<"u"&&((kl=window.document)===null||kl===void 0?void 0:kl.documentElement.style),N.selectProp=!N.docStyle||"userSelect"in N.docStyle?"userSelect":"webkitUserSelect";let ze={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dd(t){return ze.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}let Bl="global-dispatcher";class zr extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}let Ol=()=>{var t;return Mr(self)?(t=self.worker)===null||t===void 0?void 0:t.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},rs=function(t,e){return it(this,void 0,void 0,function*(){var i,r;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=Dd(t.url);if(n){let o=yield n(t,e);return o.data||t.type!=="arrayBuffer"?o:G(o,{data:new ArrayBuffer(0)})}if(Mr(self)&&((i=self.worker)===null||i===void 0?void 0:i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Bl},e)}if(!((n)=>{var o;return n.startsWith("file:")||((o=Ol())===null||o===void 0?void 0:o.startsWith("file:"))&&!/^\w+:/.test(n)})(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(n,o){return it(this,void 0,void 0,function*(){let s=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:Ol(),referrerPolicy:n.referrerPolicy,signal:o.signal}),a,c;n.type!=="json"||s.headers.has("Accept")||s.headers.set("Accept","application/json");try{a=yield fetch(s)}catch(u){if(Ar(u))throw u;throw new zr(0,me(u).message,n.url,new Blob)}if(!a.ok){let u=yield a.blob();throw new zr(a.status,a.statusText,n.url,u)}c=n.type==="arrayBuffer"||n.type==="image"?a.arrayBuffer():n.type==="json"?a.json():a.text();let l=yield c;return zd(o.signal),{data:l,cacheControl:a.headers.get("Cache-Control"),expires:a.headers.get("Expires"),etag:a.headers.get("ETag")}})}(t,e);if(Mr(self)&&((r=self.worker)===null||r===void 0?void 0:r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Bl},e)}return function(n,o){return new Promise((s,a)=>{var c;let l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(l.responseType="arraybuffer");for(let u in n.headers)l.setRequestHeader(u,n.headers[u]);n.type==="json"&&(l.responseType="text",((c=n.headers)===null||c===void 0?void 0:c.Accept)||l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{a(Error(l.statusText))},l.onload=()=>{if(!o.signal.aborted)if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let u=l.response;if(n.type==="json")try{u=JSON.parse(l.response)}catch(h){return void a(h)}s({data:u,cacheControl:l.getResponseHeader("Cache-Control"),expires:l.getResponseHeader("Expires"),etag:l.getResponseHeader("ETag")})}else{let u=new Blob([l.response],{type:l.getResponseHeader("Content-Type")});a(new zr(l.status,l.statusText,n.url,u))}},o.signal.addEventListener("abort",()=>{l.abort(),a(new Ln(o.signal.reason))}),l.send(n.body)})}(t,e)})},ns=(t,e)=>rs(G(t,{type:"json"}),e);function Rd(t){if(!t||t.indexOf("://")<=0||t.startsWith("data:image/")||t.startsWith("blob:"))return!0;let e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}var ci;(function(t){let e,i,r,n;t.resetRequestQueue=()=>{e=[],i=0,r=0,n={}},t.addThrottleControl=(c)=>{let l=r++;return n[l]=c,l},t.removeThrottleControl=(c)=>{delete n[c],s()},t.getImage=(c,l,u=!0)=>new Promise((h,p)=>{c.headers||(c.headers={}),c.headers.accept="image/webp,*/*",G(c,{type:"image"});let d={abortController:l,requestParameters:c,supportImageRefresh:u,state:"queued",onError:(f)=>{p(f)},onSuccess:(f)=>{h(f)}};e.push(d),s()});let o=(c)=>it(this,void 0,void 0,function*(){c.state="running";let{requestParameters:l,supportImageRefresh:u,onError:h,onSuccess:p,abortController:d}=c,f=u===!1&&!Mr(self)&&!Dd(l.url)&&(!l.headers||Object.keys(l.headers).reduce((y,v)=>y&&v==="accept",!0));i++;let m=f?a(l,d):rs(l,d);try{let y=yield m;delete c.abortController,c.state="completed",y.data instanceof HTMLImageElement||Yi(y.data)?p(y):y.data&&p({data:yield(_=y.data,typeof createImageBitmap=="function"?((v)=>it(void 0,void 0,void 0,function*(){if(v.byteLength===0)return createImageBitmap(new ImageData(1,1));let g=new Blob([new Uint8Array(v)],{type:"image/png"});try{return createImageBitmap(g)}catch(x){throw Error(`Could not load image because of ${me(x).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}))(_):((v)=>new Promise((g,x)=>{let b=new Image;b.onload=()=>{g(b),URL.revokeObjectURL(b.src),b.onload=null,window.requestAnimationFrame(()=>b.src=Pd)},b.onerror=()=>x(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 w=new Blob([new Uint8Array(v)],{type:"image/png"});b.src=v.byteLength?URL.createObjectURL(w):Pd}))(_)),cacheControl:y.cacheControl,expires:y.expires})}catch(y){delete c.abortController,h(me(y))}finally{i--,s()}var _}),s=()=>{let c=(()=>{for(let l of Object.keys(n))if(n[l]())return!0;return!1})()?ze.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ze.MAX_PARALLEL_IMAGE_REQUESTS;for(let l=i;l<c&&e.length>0;l++){let u=e.shift();u.abortController.signal.aborted?l--:o(u)}},a=(c,l)=>new Promise((u,h)=>{let p=new Image,{url:d,credentials:f}=c;f&&f==="include"?p.crossOrigin="use-credentials":(f&&f==="same-origin"||!Rd(d))&&(p.crossOrigin="anonymous"),l.signal.addEventListener("abort",()=>{p.src="",h(new Ln(l.signal.reason))}),p.fetchPriority="high",p.onload=()=>{p.onerror=p.onload=null,u({data:p})},p.onerror=()=>{p.onerror=p.onload=null,l.signal.aborted||h(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."))},p.src=d})})(ci||(ci={})),ci.resetRequestQueue();class kd{constructor(t){this._transformRequestFn=t!=null?t:null}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Ld(t,e,i){var r;((r=i[t])===null||r===void 0?void 0:r.includes(e))||(i[t]||(i[t]=[]),i[t].push(e))}function jl(t,e,i){if(i==null?void 0:i[t]){let r=i[t].indexOf(e);r!==-1&&i[t].splice(r,1)}}class R{constructor(t,e={}){G(this,e),this.type=t}}class J extends R{constructor(t,e={}){super("error",G({error:t},e))}}class Ht{on(t,e){return this._listeners||(this._listeners={}),Ld(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return jl(t,e,this._listeners),jl(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),Ld(t,e,this._oneTimeListeners),this):new Promise((i)=>this.once(t,i))}fire(t,e){var i,r;typeof t=="string"&&(t=new R(t,e||{}));let n=t.type;if(this.listens(n)){t.target=this;let o=((i=this._listeners)===null||i===void 0?void 0:i[n])?this._listeners[n].slice():[];for(let c of o)c.call(this,t);let s=((r=this._oneTimeListeners)===null||r===void 0?void 0:r[n])?this._oneTimeListeners[n].slice():[];for(let c of s)jl(n,c,this._oneTimeListeners),c.call(this,t);let a=this._eventedParent;a&&(G(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof J&&console.error(t.error);return this}listens(t){var e,i,r,n,o;return((i=(e=this._listeners)===null||e===void 0?void 0:e[t])===null||i===void 0?void 0:i.length)>0||((n=(r=this._oneTimeListeners)===null||r===void 0?void 0:r[t])===null||n===void 0?void 0:n.length)>0||((o=this._eventedParent)===null||o===void 0?void 0:o.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var D={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"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"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{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:"filter"},tolerance:{type:"number",default:0.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"}},source_video:{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"}}},source_image:{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"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{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:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"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:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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"}},"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:{"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},paint_circle:{"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"}},paint_heatmap:{"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)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.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"}},paint_symbol:{"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"}},paint_raster:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:0.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let x0=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function b0(t,e){let i={};for(let r in t)r!=="ref"&&(i[r]=t[r]);return x0.forEach((r)=>{r in e&&(i[r]=e[r])}),i}function Fd(t){t=t.slice();let e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=b0(t[i],e[t[i].ref]));return t}function bt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!bt(t[i],e[i]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object")return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!bt(t[i],e[i]))return!1;return!0}return t===e}function je(t,e){t.push(e)}function Bd(t,e,i){je(i,{command:"addSource",args:[t,e[t]]})}function Od(t,e,i){je(e,{command:"removeSource",args:[t]}),i[t]=!0}function w0(t,e,i,r){Od(t,i,r),Bd(t,e,i)}function T0(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!bt(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!bt(t[i][r],e[i][r]))return!1;return!0}function os(t,e,i,r,n,o){t=t||{},e=e||{};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(bt(t[s],e[s])||i.push({command:o,args:[r,s,e[s],n]}));for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(bt(t[s],e[s])||i.push({command:o,args:[r,s,e[s],n]}))}function jd(t){return t.id}function Nd(t,e){return t[e.id]=e,t}class j{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),e!=null&&e.__line__&&(this.line=e.__line__)}}function Rr(t,...e){for(let i of e)for(let r in i)t[r]=i[r];return t}class Ke extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Nl{constructor(t,e=[]){this.parent=t,this.bindings={};for(let[i,r]of e)this.bindings[i]=r}concat(t){return new Nl(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let Fn={kind:"null"},V={kind:"number"},ot={kind:"string"},ct={kind:"boolean"},Je={kind:"color"},ss={kind:"projectionDefinition"},Ki={kind:"object"},at={kind:"value"},as={kind:"collator"},Bn={kind:"formatted"},ls={kind:"padding"},On={kind:"colorArray"},cs={kind:"numberArray"},jn={kind:"resolvedImage"},hs={kind:"variableAnchorOffsetCollection"};function ye(t,e){return{kind:"array",itemType:t,N:e}}function kt(t){if(t.kind==="array"){let e=kt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}let S0=[Fn,V,ot,ct,Je,ss,Bn,Ki,ye(at),ls,cs,On,jn,hs];function Nn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Nn(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 i of S0)if(!Nn(i,e))return null}}return`Expected ${kt(t)} but found ${kt(e)} instead.`}function Vl(t,e){return e.some((i)=>i.kind===t.kind)}function Ji(t,e){return e.some((i)=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}function Ri(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}let Vd=0.96422,Ud=0.82521,$d=0.13793103448275862,kr=0.20689655172413793,Zd=3*kr*kr,P0=kr*kr*kr,I0=Math.PI/180,E0=180/Math.PI;function Gd(t){return(t%=360)<0&&(t+=360),t}function qd([t,e,i,r]){let n,o,s=$l((0.2225045*(t=Ul(t))+0.7168786*(e=Ul(e))+0.0606169*(i=Ul(i)))/1);t===e&&e===i?n=o=s:(n=$l((0.4360747*t+0.3850649*e+0.1430804*i)/Vd),o=$l((0.0139322*t+0.0971045*e+0.7141733*i)/Ud));let a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function Ul(t){return t<=0.04045?t/12.92:Math.pow((t+0.055)/1.055,2.4)}function $l(t){return t>P0?Math.pow(t,0.3333333333333333):t/Zd+$d}function Wd([t,e,i,r]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,s=isNaN(i)?n:n-i/200;return n=1*Gl(n),o=Vd*Gl(o),s=Ud*Gl(s),[Zl(3.1338561*o-1.6168667*n-0.4906146*s),Zl(-0.9787684*o+1.9161415*n+0.033454*s),Zl(0.0719453*o-0.2289914*n+1.4052427*s),r]}function Zl(t){return(t=t<=0.00304?12.92*t:1.055*Math.pow(t,0.4166666666666667)-0.055)<0?0:t>1?1:t}function Gl(t){return t>kr?t*t*t:Zd*(t-$d)}let M0=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Vn(t,e){return M0(t,e)?t[e]:void 0}function us(t){return parseInt(t.padEnd(2,t),16)/255}function Hd(t,e){return Lr(e?t/100:t,0,1)}function Lr(t,e,i){return Math.min(Math.max(e,t),i)}function Xd(t){return!t.some(Number.isNaN)}let C0={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]};function ki(t,e,i){return t+i*(e-t)}function Fr(t,e,i){return t.map((r,n)=>ki(r,e[n],i))}class Y{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof Y)return t;if(typeof t!="string")return;let e=function(i){if((i=i.toLowerCase().trim())==="transparent")return[0,0,0,0];let r=Vn(C0,i);if(r){let[o,s,a]=r;return[o/255,s/255,a/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){let o=i.length<6?1:2,s=1;return[us(i.slice(s,s+=o)),us(i.slice(s,s+=o)),us(i.slice(s,s+=o)),us(i.slice(s,s+o)||"ff")]}if(i.startsWith("rgb")){let o=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(o){let[s,a,c,l,u,h,p,d,f,m,_,y]=o,v=[l||" ",p||" ",m].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let g=[c,h,f].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let b=[Lr(+a/x,0,1),Lr(+u/x,0,1),Lr(+d/x,0,1),_?Hd(+_,y):1];if(Xd(b))return b}}return}}let n=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[o,s,a,c,l,u,h,p,d]=n,f=[a||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let m=[+s,Lr(+c,0,100),Lr(+u,0,100),p?Hd(+p,d):1];if(Xd(m))return function([_,y,v,g]){function x(b){let w=(b+_/30)%12,T=y*Math.min(v,1-v);return v-T*Math.max(-1,Math.min(w-3,9-w,1))}return _=Gd(_),y/=100,v/=100,[x(0),x(8),x(4),g]}(m)}}}(t);return e?new Y(...e,!1):void 0}get rgb(){let{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){let[e,i,r,n]=qd(t),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?Gd(Math.atan2(r,i)*E0):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",qd(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){let[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((n)=>Math.round(255*n)).join(",")},${r})`}static interpolate(t,e,i,r="rgb"){switch(r){case"rgb":{let[n,o,s,a]=Fr(t.rgb,e.rgb,i);return new Y(n,o,s,a,!1)}case"hcl":{let[n,o,s,a]=t.hcl,[c,l,u,h]=e.hcl,p,d;if(isNaN(n)||isNaN(c))isNaN(n)?isNaN(c)?p=NaN:(p=c,s!==1&&s!==0||(d=l)):(p=n,u!==1&&u!==0||(d=o));else{let v=c-n;c>n&&v>180?v-=360:c<n&&n-c>180&&(v+=360),p=n+i*v}let[f,m,_,y]=function([v,g,x,b]){return v=isNaN(v)?0:v*I0,Wd([x,Math.cos(v)*g,Math.sin(v)*g,b])}([p,d!=null?d:ki(o,l,i),ki(s,u,i),ki(a,h,i)]);return new Y(f,m,_,y,!1)}case"lab":{let[n,o,s,a]=Wd(Fr(t.lab,e.lab,i));return new Y(n,o,s,a,!1)}}}}Y.black=new Y(0,0,0,1),Y.white=new Y(1,1,1,1),Y.transparent=new Y(0,0,0,0),Y.red=new Y(1,0,0,1);class ds{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let A0=["bottom","center","top"];class ps{constructor(t,e,i,r,n,o){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class De{constructor(t){this.sections=t}static fromString(t){return new De([new ps(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t)=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof De?t:De.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t)=>t.text).join("")}}class ve{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ve)return t;if(typeof t=="number")return new ve([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let e of t)if(typeof e!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ve(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ve(Fr(t.values,e.values,i))}}class xe{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof xe)return t;if(typeof t=="number")return new xe([t]);if(Array.isArray(t)){for(let e of t)if(typeof e!="number")return;return new xe(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new xe(Fr(t.values,e.values,i))}}class se{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof se)return t;if(typeof t=="string"){let i=Y.parse(t);if(!i)return;return new se([i])}if(!Array.isArray(t))return;let e=[];for(let i of t){if(typeof i!="string")return;let r=Y.parse(i);if(!r)return;e.push(r)}return new se(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,r="rgb"){let n=[];if(t.values.length!=e.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)n.push(Y.interpolate(t.values[o],e.values[o],i,r));return new se(n)}}class Lt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}let z0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ne{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ne)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){let i=t[e],r=t[e+1];if(typeof i!="string"||!z0.has(i))return;if(!Array.isArray(r)||r.length!==2||typeof r[0]!="number"||typeof r[1]!="number")return}return new Ne(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){let r=t.values,n=e.values;if(r.length!==n.length)throw new Lt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);let o=[];for(let s=0;s<r.length;s+=2){if(r[s]!==n[s])throw new Lt(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${r[s]}, to[${s}]: ${n[s]}`);o.push(r[s]);let[a,c]=r[s+1],[l,u]=n[s+1];o.push([ki(a,l,i),ki(c,u,i)])}return new Ne(o)}}class Ve{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ve({name:t,available:!1}):null}}class Re{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new Re(t,e,i)}static parse(t){return t instanceof Re?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Re(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Re(t.from,t.to,t.transition):typeof t=="string"?new Re(t,t,1):void 0}}function Yd(t,e,i,r){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Un(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Re||t instanceof Y||t instanceof ds||t instanceof De||t instanceof ve||t instanceof xe||t instanceof se||t instanceof Ne||t instanceof Ve)return!0;if(Array.isArray(t)){for(let e of t)if(!Un(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!Un(t[e]))return!1;return!0}return!1}function qt(t){if(t===null)return Fn;if(typeof t=="string")return ot;if(typeof t=="boolean")return ct;if(typeof t=="number")return V;if(t instanceof Y)return Je;if(t instanceof Re)return ss;if(t instanceof ds)return as;if(t instanceof De)return Bn;if(t instanceof ve)return ls;if(t instanceof xe)return cs;if(t instanceof se)return On;if(t instanceof Ne)return hs;if(t instanceof Ve)return jn;if(Array.isArray(t)){let e=t.length,i;for(let r of t){let n=qt(r);if(i){if(i===n)continue;i=at;break}i=n}return ye(i||at,e)}return Ki}function $n(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Y||t instanceof Re||t instanceof De||t instanceof ve||t instanceof xe||t instanceof se||t instanceof Ne||t instanceof Ve?t.toString():JSON.stringify(t)}class Qi{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(t.length!==2)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Un(t[1]))return e.error("invalid value");let i=t[1],r=qt(i),n=e.expectedType;return r.kind!=="array"||r.N!==0||!n||n.kind!=="array"||typeof n.N=="number"&&n.N!==0||(r=n),new Qi(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let fs={string:ot,number:V,boolean:ct,object:Ki};class Qe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1,n=t[0];if(n==="array"){let s,a;if(t.length>2){let c=t[1];if(typeof c!="string"||!(c in fs)||c==="object")return e.error('The item type argument of "array" must be one of string, number, boolean',1);s=fs[c],r++}else s=at;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}i=ye(s,a)}else{if(!fs[n])throw Error(`Types doesn't contain name = ${n}`);i=fs[n]}let o=[];for(;r<t.length;r++){let s=e.parse(t[r],r,at);if(!s)return null;o.push(s)}return new Qe(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){let i=this.args[e].evaluate(t);if(!Nn(this.type,qt(i)))return i;if(e===this.args.length-1)throw new Lt(`Expected value to be of type ${kt(this.type)}, but found ${kt(qt(i))} instead.`)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}let Kd={"to-boolean":ct,"to-color":Je,"to-number":V,"to-string":ot};class Li{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=t[0];if(!Kd[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&t.length!==2)return e.error("Expected one argument.");let r=Kd[i],n=[];for(let o=1;o<t.length;o++){let s=e.parse(t[o],o,at);if(!s)return null;n.push(s)}return new Li(r,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(let r of this.args){if(e=r.evaluate(t),i=null,e instanceof Y)return e;if(typeof e=="string"){let n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Yd(e[0],e[1],e[2],e[3]),!i))return new Y(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Lt(i||`Could not parse color from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"padding":{let e;for(let i of this.args){e=i.evaluate(t);let r=ve.parse(e);if(r)return r}throw new Lt(`Could not parse padding from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=xe.parse(e);if(r)return r}throw new Lt(`Could not parse numberArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=se.parse(e);if(r)return r}throw new Lt(`Could not parse colorArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(let i of this.args){e=i.evaluate(t);let r=Ne.parse(e);if(r)return r}throw new Lt(`Could not parse variableAnchorOffsetCollection from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(let i of this.args){if(e=i.evaluate(t),e===null)return 0;let r=Number(e);if(!isNaN(r))return r}throw new Lt(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return De.fromString($n(this.args[0].evaluate(t)));case"resolvedImage":return Ve.fromString($n(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return $n(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}let D0=["Unknown","Point","LineString","Polygon"];class ql{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?D0[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(t){let e=this._parseColorCache.get(t);return e||(e=Y.parse(t),this._parseColorCache.set(t,e)),e}}class ms{constructor(t,e,i=[],r,n=new Nl,o=[]){this.registry=t,this.path=i,this.key=i.map((s)=>`[${s}]`).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(r,n,o){return o==="assert"?new Qe(n,[r]):o==="coerce"?new Li(n,[r]):r}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=t[0];if(typeof r!="string")return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[r];if(n){let o=n.parse(t,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,a=o.type;if(s.kind!=="string"&&s.kind!=="number"&&s.kind!=="boolean"&&s.kind!=="object"&&s.kind!=="array"||a.kind!=="value"){if(s.kind==="projectionDefinition"&&["string","array"].includes(a.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(a.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(a.kind)||s.kind==="colorArray"&&["value","string","array"].includes(a.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(a.kind))o=i(o,s,e.typeAnnotation||"coerce");else if(this.checkSubtype(s,a))return null}else o=i(o,s,e.typeAnnotation||"assert")}if(!(o instanceof Qi)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new ql;try{o=new Qi(o.type,o.evaluate(s))}catch(a){return this.error(a.message),null}}return o}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){let r=typeof t=="number"?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new ms(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){let i=`${this.key}${e.map((r)=>`[${r}]`).join("")}`;this.errors.push(new Ke(i,t))}checkSubtype(t,e){let i=Nn(t,e);return i&&this.error(i),i}}class _s{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let n=1;n<t.length-1;n+=2){let o=t[n];if(typeof o!="string")return e.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);let s=e.parse(t[n+1],n+1);if(!s)return null;i.push([o,s])}let r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new _s(i,r):null}outputDefined(){return this.result.outputDefined()}}class gs{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(t.length!==2||typeof t[1]!="string")return e.error("'var' expression requires exactly one string literal argument.");let i=t[1];return e.scope.has(i)?new gs(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Wl{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,V),r=e.parse(t[2],2,ye(e.expectedType||at));return i&&r?new Wl(r.type.itemType,i,r):null}evaluate(t){let e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Lt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Lt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Lt(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Hl{constructor(t,e){this.type=ct,this.needle=t,this.haystack=e}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,at);return i&&r?Vl(i.type,[ct,ot,V,Fn,at])?new Hl(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(i.type)} instead`):null}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Ji(e,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${kt(qt(e))} instead.`);if(!Ji(i,["string","array"]))throw new Lt(`Expected second argument to be of type array or string, but found ${kt(qt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ys{constructor(t,e,i){this.type=V,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,at);if(!i||!r)return null;if(!Vl(i.type,[ct,ot,V,Fn,at]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(i.type)} instead`);if(t.length===4){let n=e.parse(t[3],3,V);return n?new ys(i,r,n):null}return new ys(i,r)}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Ji(e,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${kt(qt(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),Ji(i,["string"])){let n=i.indexOf(e,r);return n===-1?-1:[...i.slice(0,n)].length}if(Ji(i,["array"]))return i.indexOf(e,r);throw new Lt(`Expected second argument to be of type array or string, but found ${kt(qt(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Xl{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&e.expectedType.kind!=="value"&&(r=e.expectedType);let n={},o=[];for(let c=2;c<t.length-1;c+=2){let l=t[c],u=t[c+1];Array.isArray(l)||(l=[l]);let h=e.concat(c);if(l.length===0)return h.error("Expected at least one branch label.");for(let d of l){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 ${Number.MAX_SAFE_INTEGER}.`);if(typeof d=="number"&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,qt(d)))return null}else i=qt(d);if(n[String(d)]!==void 0)return h.error("Branch labels must be unique.");n[String(d)]=o.length}let p=e.parse(u,c,r);if(!p)return null;r=r||p.type,o.push(p)}let s=e.parse(t[1],1,at);if(!s)return null;let a=e.parse(t[t.length-1],t.length-1,r);return a?s.type.kind!=="value"&&e.concat(1).checkSubtype(i,s.type)?null:new Xl(i,r,s,n,o,a):null}evaluate(t){let e=this.input.evaluate(t);return(qt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())&&this.otherwise.outputDefined()}}class Yl{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&e.expectedType.kind!=="value"&&(i=e.expectedType);let r=[];for(let o=1;o<t.length-1;o+=2){let s=e.parse(t[o],o,ct);if(!s)return null;let a=e.parse(t[o+1],o+1,i);if(!a)return null;r.push([s,a]),i=i||a.type}let n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw Error("Can't infer output type");return new Yl(i,r,n)}evaluate(t){for(let[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class vs{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,V);if(!i||!r)return null;if(!Vl(i.type,[ye(at),ot,at]))return e.error(`Expected first argument to be of type array or string, but found ${kt(i.type)} instead`);if(t.length===4){let n=e.parse(t[3],3,V);return n?new vs(i.type,i,r,n):null}return new vs(i.type,i,r)}evaluate(t){let e=this.input.evaluate(t),i=this.beginIndex.evaluate(t),r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),Ji(e,["string"]))return[...e].slice(i,r).join("");if(Ji(e,["array"]))return e.slice(i,r);throw new Lt(`Expected first argument to be of type array or string, but found ${kt(qt(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function xs(t,e){let i=t.length-1,r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=t[a],n=t[a+1],r<=e){if(a===i||e<n)return a;o=a+1}else{if(!(r>e))throw new Lt("Input is not a number.");s=a-1}return 0}class Zn{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(let[r,n]of i)this.labels.push(r),this.outputs.push(n)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");let i=e.parse(t[1],1,V);if(!i)return null;let r=[],n=null;e.expectedType&&e.expectedType.kind!=="value"&&(n=e.expectedType);for(let o=1;o<t.length;o+=2){let s=o===1?-1/0:t[o],a=t[o+1],c=o,l=o+1;if(typeof s!="number")return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(r.length&&r[r.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);let u=e.parse(a,l,n);if(!u)return null;n=n||u.type,r.push([s,u])}return new Zn(n,i,r)}evaluate(t){let e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[xs(e,r)].evaluate(t)}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}}function R0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kl,Jd,k0=function(){if(Jd)return Kl;function t(e,i,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=n}return Jd=1,Kl=t,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,i){if(i===void 0&&(i=0.000001),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<i)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<0.000001)break;r-=o/s}var a=0,c=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<i));n++)e>o?a=r:c=r,r=0.5*(c-a)+a;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Kl}(),L0=R0(k0);class we{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(let[o,s]of n)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,e,i,r){let n=0;if(t.name==="exponential")n=Jl(e,t.base,i,r);else if(t.name==="linear")n=Jl(e,1,i,r);else if(t.name==="cubic-bezier"){let o=t.controlPoints;n=new L0(o[0],o[1],o[2],o[3]).solve(Jl(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||r.length===0)return e.error("Expected an interpolation type expression.",1);if(r[0]==="linear")r={name:"linear"};else if(r[0]==="exponential"){let c=r[1];if(typeof c!="number")return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:c}}else{if(r[0]!=="cubic-bezier")return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let c=r.slice(1);if(c.length!==4||c.some((l)=>typeof l!="number"||l<0||l>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:c}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,V),!n)return null;let s=[],a=null;i!=="interpolate-hcl"&&i!=="interpolate-lab"||e.expectedType==On?e.expectedType&&e.expectedType.kind!=="value"&&(a=e.expectedType):a=Je;for(let c=0;c<o.length;c+=2){let l=o[c],u=o[c+1],h=c+3,p=c+4;if(typeof l!="number")return e.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]>=l)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);let d=e.parse(u,p,a);if(!d)return null;a=a||d.type,s.push([l,d])}return Ri(a,V)||Ri(a,ss)||Ri(a,Je)||Ri(a,ls)||Ri(a,cs)||Ri(a,On)||Ri(a,hs)||Ri(a,ye(V))?new we(a,i,r,n,s):e.error(`Type ${kt(a)} is not interpolatable.`)}evaluate(t){let e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);let o=xs(e,r),s=we.interpolationFactor(this.interpolation,r,e[o],e[o+1]),a=i[o].evaluate(t),c=i[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ki(a,c,s);case"color":return Y.interpolate(a,c,s);case"padding":return ve.interpolate(a,c,s);case"colorArray":return se.interpolate(a,c,s);case"numberArray":return xe.interpolate(a,c,s);case"variableAnchorOffsetCollection":return Ne.interpolate(a,c,s);case"array":return Fr(a,c,s);case"projectionDefinition":return Re.interpolate(a,c,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return Y.interpolate(a,c,s,"hcl");case"colorArray":return se.interpolate(a,c,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Y.interpolate(a,c,s,"lab");case"colorArray":return se.interpolate(a,c,s,"lab")}}}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}}function Jl(t,e,i,r){let n=r-i,o=t-i;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}let Ft={color:Y.interpolate,number:ki,padding:ve.interpolate,numberArray:xe.interpolate,colorArray:se.interpolate,variableAnchorOffsetCollection:Ne.interpolate,array:Fr};class bs{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null,r=e.expectedType;r&&r.kind!=="value"&&(i=r);let n=[];for(let s of t.slice(1)){let a=e.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!a)return null;i=i||a.type,n.push(a)}if(!i)throw Error("No output type");let o=r&&n.some((s)=>Nn(r,s.type));return new bs(o?at:i,n)}evaluate(t){let e,i=null,r=0;for(let n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ve&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}function Qd(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 tp(t,e,i,r){return r.compare(e,i)===0}function Br(t,e,i){let r=t!=="=="&&t!=="!=";return class n{constructor(o,s,a){this.type=ct,this.lhs=o,this.rhs=s,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||s.type.kind==="value"}static parse(o,s){if(o.length!==3&&o.length!==4)return s.error("Expected two or three arguments.");let a=o[0],c=s.parse(o[1],1,at);if(!c)return null;if(!Qd(a,c.type))return s.concat(1).error(`"${a}" comparisons are not supported for type '${kt(c.type)}'.`);let l=s.parse(o[2],2,at);if(!l)return null;if(!Qd(a,l.type))return s.concat(2).error(`"${a}" comparisons are not supported for type '${kt(l.type)}'.`);if(c.type.kind!==l.type.kind&&c.type.kind!=="value"&&l.type.kind!=="value")return s.error(`Cannot compare types '${kt(c.type)}' and '${kt(l.type)}'.`);r&&(c.type.kind==="value"&&l.type.kind!=="value"?c=new Qe(l.type,[c]):c.type.kind!=="value"&&l.type.kind==="value"&&(l=new Qe(c.type,[l])));let u=null;if(o.length===4){if(c.type.kind!=="string"&&l.type.kind!=="string"&&c.type.kind!=="value"&&l.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(u=s.parse(o[3],3,as),!u)return null}return new n(c,l,u)}evaluate(o){let s=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(r&&this.hasUntypedArgument){let c=qt(s),l=qt(a);if(c.kind!==l.kind||c.kind!=="string"&&c.kind!=="number")throw new Lt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${c.kind}, ${l.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let c=qt(s),l=qt(a);if(c.kind!=="string"||l.kind!=="string")return e(o,s,a)}return this.collator?i(o,s,a,this.collator.evaluate(o)):e(o,s,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}let F0=Br("==",function(t,e,i){return e===i},tp),B0=Br("!=",function(t,e,i){return e!==i},function(t,e,i,r){return!tp(0,e,i,r)}),O0=Br("<",function(t,e,i){return e<i},function(t,e,i,r){return r.compare(e,i)<0}),j0=Br(">",function(t,e,i){return e>i},function(t,e,i,r){return r.compare(e,i)>0}),N0=Br("<=",function(t,e,i){return e<=i},function(t,e,i,r){return r.compare(e,i)<=0}),V0=Br(">=",function(t,e,i){return e>=i},function(t,e,i,r){return r.compare(e,i)>=0});class ws{constructor(t,e,i){this.type=as,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(t.length!==2)return e.error("Expected one argument.");let i=t[1];if(typeof i!="object"||Array.isArray(i))return e.error("Collator options argument must be an object.");let r=e.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,ct);if(!r)return null;let n=e.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,ct);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,ot),!o)?null:new ws(r,n,o)}evaluate(t){return new ds(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ql{constructor(t,e,i,r,n,o){this.type=ot,this.number=t,this.locale=e,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(t,e){if(t.length!==3)return e.error("Expected two arguments.");let i=e.parse(t[1],1,V);if(!i)return null;let r=t[2];if(typeof r!="object"||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,ot),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,ot),!o))return null;let s=null;if(r.unit&&(s=e.parse(r.unit,1,ot),!s))return null;if(o&&s)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,V),!a))return null;let c=null;return r["max-fraction-digits"]&&(c=e.parse(r["max-fraction-digits"],1,V),!c)?null:new Ql(i,n,o,s,a,c)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ts{constructor(t){this.type=Bn,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&typeof i=="object")return e.error("First argument must be an image or text section.");let r=[],n=!1;for(let o=1;o<=t.length-1;++o){let s=t[o];if(n&&typeof s=="object"&&!Array.isArray(s)){n=!1;let a=null;if(s["font-scale"]&&(a=e.parse(s["font-scale"],1,V),!a))return null;let c=null;if(s["text-font"]&&(c=e.parse(s["text-font"],1,ye(ot)),!c))return null;let l=null;if(s["text-color"]&&(l=e.parse(s["text-color"],1,Je),!l))return null;let u=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!A0.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(u=e.parse(s["vertical-align"],1,ot),!u)return null}let h=r[r.length-1];h.scale=a,h.font=c,h.textColor=l,h.verticalAlign=u}else{let a=e.parse(t[o],1,at);if(!a)return null;let c=a.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ts(r)}evaluate(t){return new De(this.sections.map((e)=>{let i=e.content.evaluate(t);return qt(i)===jn?new ps("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new ps($n(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class tc{constructor(t){this.type=jn,this.input=t}static parse(t,e){if(t.length!==2)return e.error("Expected two arguments.");let i=e.parse(t[1],1,ot);return i?new tc(i):e.error("No image name provided.")}evaluate(t){let e=this.input.evaluate(t),i=Ve.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class ec{constructor(t){this.type=V,this.input=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=e.parse(t[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?e.error(`Expected argument of type string or array, but found ${kt(i.type)} instead.`):new ec(i):null}evaluate(t){let e=this.input.evaluate(t);if(typeof e=="string")return[...e].length;if(Array.isArray(e))return e.length;throw new Lt(`Expected value to be of type string or array, but found ${kt(qt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let hi=8192;function U0(t,e){let i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*hi),Math.round(r*n*hi)]}function ic(t,e){let i=Math.pow(2,e.z);return[(n=(t[0]/hi+e.x)/i,360*n-180),(r=(t[1]/hi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Gn(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 qn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function $0(t,e,i){let r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Ss(t,e,i,r){return(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]!=0&&!(!ip(t,e,i,r)||!ip(i,r,t,e));var n,o}function Z0(t,e,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(Ss(t,e,r[n],r[n+1]))return!0;return!1}function Or(t,e,i=!1){let r=!1;for(let a of e)for(let c=0;c<a.length-1;c++){if($0(t,a[c],a[c+1]))return i;(o=a[c])[1]>(n=t)[1]!=(s=a[c+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}var n,o,s;return r}function G0(t,e){for(let i of e)if(Or(t,i))return!0;return!1}function ep(t,e){for(let i of t)if(!Or(i,e))return!1;for(let i=0;i<t.length-1;++i)if(Z0(t[i],t[i+1],e))return!1;return!0}function q0(t,e){for(let i of e)if(ep(t,i))return!0;return!1}function ip(t,e,i,r){let n=r[0]-i[0],o=r[1]-i[1],s=(t[0]-i[0])*o-n*(t[1]-i[1]),a=(e[0]-i[0])*o-n*(e[1]-i[1]);return s>0&&a<0||s<0&&a>0}function rc(t,e,i){let r=[];for(let n=0;n<t.length;n++){let o=[];for(let s=0;s<t[n].length;s++){let a=U0(t[n][s],i);Gn(e,a),o.push(a)}r.push(o)}return r}function rp(t,e,i){let r=[];for(let n=0;n<t.length;n++){let o=rc(t[n],e,i);r.push(o)}return r}function np(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){let n=0.5*r,o=t[0]-i[0]>n?-r:i[0]-t[0]>n?r:0;o===0&&(o=t[0]-i[2]>n?-r:i[2]-t[0]>n?r:0),t[0]+=o}Gn(e,t)}function op(t,e,i,r){let n=Math.pow(2,r.z)*hi,o=[r.x*hi,r.y*hi],s=[];for(let a of t)for(let c of a){let l=[c.x+o[0],c.y+o[1]];np(l,e,i,n),s.push(l)}return s}function sp(t,e,i,r){let n=Math.pow(2,r.z)*hi,o=[r.x*hi,r.y*hi],s=[];for(let c of t){let l=[];for(let u of c){let h=[u.x+o[0],u.y+o[1]];Gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(let c of s)for(let l of c)np(l,e,i,n)}var a;return s}class tr{constructor(t,e){this.type=ct,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Un(t[1])){let i=t[1];if(i.type==="FeatureCollection"){let r=[];for(let n of i.features){let{type:o,coordinates:s}=n.geometry;o==="Polygon"&&r.push(s),o==="MultiPolygon"&&r.push(...s)}if(r.length)return new tr(i,{type:"MultiPolygon",coordinates:r})}else if(i.type==="Feature"){let r=i.geometry.type;if(r==="Polygon"||r==="MultiPolygon")return new tr(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new tr(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,i){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if(i.type==="Polygon"){let s=rc(i.coordinates,n,o),a=op(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!Or(c,s))return!1}if(i.type==="MultiPolygon"){let s=rp(i.coordinates,n,o),a=op(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!G0(c,s))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,i){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if(i.type==="Polygon"){let s=rc(i.coordinates,n,o),a=sp(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!ep(c,s))return!1}if(i.type==="MultiPolygon"){let s=rp(i.coordinates,n,o),a=sp(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!q0(c,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class nc{constructor(t=[],e=(i,r)=>i<r?-1:i>r?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,r=e[t];for(;t>0;){let n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){let{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let o=1+(t<<1),s=o+1;if(s<this.length&&i(e[s],e[o])<0&&(o=s),i(e[o],n)>=0)break;e[t]=e[o],t=o}e[t]=n}}function ap(t,e,i=0,r=t.length-1,n=W0){for(;r>i;){if(r-i>600){let c=r-i+1,l=e-i+1,u=Math.log(c),h=0.5*Math.exp(2*u/3),p=0.5*Math.sqrt(u*h*(c-h)/c)*(l-c/2<0?-1:1);ap(t,e,Math.max(i,Math.floor(e-l*h/c+p)),Math.min(r,Math.floor(e+(c-l)*h/c+p)),n)}let o=t[e],s=i,a=r;for(Wn(t,i,e),n(t[r],o)>0&&Wn(t,i,r);s<a;){for(Wn(t,s,a),s++,a--;n(t[s],o)<0;)s++;for(;n(t[a],o)>0;)a--}n(t[i],o)===0?Wn(t,i,a):(a++,Wn(t,a,r)),a<=e&&(i=a+1),e<=a&&(r=a-1)}}function Wn(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function W0(t,e){return t<e?-1:t>e?1:0}function oc(t,e){if(t.length<=1)return[t];let i=[],r,n;for(let o of t){let s=X0(o);s!==0&&(o.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(r&&i.push(r),r=[o]):r.push(o))}if(r&&i.push(r),e>1)for(let o=0;o<i.length;o++)i[o].length<=e||(ap(i[o],e,1,i[o].length-1,H0),i[o]=i[o].slice(0,e));return i}function H0(t,e){return e.area-t.area}function X0(t){let e=0;for(let i,r,n=0,o=t.length,s=o-1;n<o;s=n++)i=t[n],r=t[s],e+=(r.x-i.x)*(i.y+r.y);return e}let lp=0.0033528106647474805,cp=lp*(2-lp),hp=Math.PI/180;class Ps{constructor(t){let e=6378.137*hp*1000,i=Math.cos(t*hp),r=1/(1-cp*(1-i*i)),n=Math.sqrt(r);this.kx=e*n*i,this.ky=e*n*r*(1-cp)}distance(t,e){let i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,n,o,s=1/0;for(let a=0;a<t.length-1;a++){let c=t[a][0],l=t[a][1],u=this.wrap(t[a+1][0]-c)*this.kx,h=(t[a+1][1]-l)*this.ky,p=0;u===0&&h===0||(p=(this.wrap(e[0]-c)*this.kx*u+(e[1]-l)*this.ky*h)/(u*u+h*h),p>1?(c=t[a+1][0],l=t[a+1][1]):p>0&&(c+=u/this.kx*p,l+=h/this.ky*p)),u=this.wrap(e[0]-c)*this.kx,h=(e[1]-l)*this.ky;let d=u*u+h*h;d<s&&(s=d,i=c,r=l,n=a,o=p)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function up(t,e){return e[0]-t[0]}function Is(t){return t[1]-t[0]+1}function wi(t,e){return t[1]>=t[0]&&t[1]<e}function sc(t,e){if(t[0]>t[1])return[null,null];let i=Is(t);if(e){if(i===2)return[t,null];let n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(i===1)return[t,null];let r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function ac(t,e){if(!wi(e,t.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Gn(i,t[r]);return i}function lc(t){let e=[1/0,1/0,-1/0,-1/0];for(let i of t)for(let r of i)Gn(e,r);return e}function dp(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function cc(t,e,i){if(!dp(t)||!dp(e))return NaN;let r=0,n=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),i.distance([0,0],[r,n])}function er(t,e,i){let r=i.pointOnLine(e,t);return i.distance(t,r.point)}function hc(t,e,i,r,n){let o=Math.min(er(t,[i,r],n),er(e,[i,r],n)),s=Math.min(er(i,[t,e],n),er(r,[t,e],n));return Math.min(o,s)}function Y0(t,e,i,r,n){if(!wi(e,t.length)||!wi(r,i.length))return 1/0;let o=1/0;for(let s=e[0];s<e[1];++s){let a=t[s],c=t[s+1];for(let l=r[0];l<r[1];++l){let u=i[l],h=i[l+1];if(Ss(a,c,u,h))return 0;o=Math.min(o,hc(a,c,u,h,n))}}return o}function K0(t,e,i,r,n){if(!wi(e,t.length)||!wi(r,i.length))return NaN;let o=1/0;for(let s=e[0];s<=e[1];++s)for(let a=r[0];a<=r[1];++a)if(o=Math.min(o,n.distance(t[s],i[a])),o===0)return o;return o}function J0(t,e,i){if(Or(t,e,!0))return 0;let r=1/0;for(let n of e){let o=n[0],s=n[n.length-1];if(o!==s&&(r=Math.min(r,er(t,[s,o],i)),r===0))return r;let a=i.pointOnLine(n,t);if(r=Math.min(r,i.distance(t,a.point)),r===0)return r}return r}function Q0(t,e,i,r){if(!wi(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Or(t[o],i,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){let s=t[o],a=t[o+1];for(let c of i)for(let l=0,u=c.length,h=u-1;l<u;h=l++){let p=c[h],d=c[l];if(Ss(s,a,p,d))return 0;n=Math.min(n,hc(s,a,p,d,r))}}return n}function pp(t,e){for(let i of t)for(let r of i)if(Or(r,e,!0))return!0;return!1}function tv(t,e,i,r=1/0){let n=lc(t),o=lc(e);if(r!==1/0&&cc(n,o,i)>=r)return r;if(qn(n,o)){if(pp(t,e))return 0}else if(pp(e,t))return 0;let s=1/0;for(let a of t)for(let c=0,l=a.length,u=l-1;c<l;u=c++){let h=a[u],p=a[c];for(let d of e)for(let f=0,m=d.length,_=m-1;f<m;_=f++){let y=d[_],v=d[f];if(Ss(h,p,y,v))return 0;s=Math.min(s,hc(h,p,y,v,i))}}return s}function fp(t,e,i,r,n,o){if(!o)return;let s=cc(ac(r,o),n,i);s<e&&t.push([s,o,[0,0]])}function Es(t,e,i,r,n,o,s){if(!o||!s)return;let a=cc(ac(r,o),ac(n,s),i);a<e&&t.push([a,o,s])}function Ms(t,e,i,r,n=1/0){let o=Math.min(r.distance(t[0],i[0][0]),n);if(o===0)return o;let s=new nc([[0,[0,t.length-1],[0,0]]],up),a=lc(i);for(;s.length>0;){let c=s.pop();if(c[0]>=o)continue;let l=c[1],u=e?50:100;if(Is(l)<=u){if(!wi(l,t.length))return NaN;if(e){let h=Q0(t,l,i,r);if(isNaN(h)||h===0)return h;o=Math.min(o,h)}else for(let h=l[0];h<=l[1];++h){let p=J0(t[h],i,r);if(o=Math.min(o,p),o===0)return 0}}else{let h=sc(l,e);fp(s,o,r,t,a,h[0]),fp(s,o,r,t,a,h[1])}}return o}function Cs(t,e,i,r,n,o=1/0){let s=Math.min(o,n.distance(t[0],i[0]));if(s===0)return s;let a=new nc([[0,[0,t.length-1],[0,i.length-1]]],up);for(;a.length>0;){let c=a.pop();if(c[0]>=s)continue;let l=c[1],u=c[2],h=e?50:100,p=r?50:100;if(Is(l)<=h&&Is(u)<=p){if(!wi(l,t.length)&&wi(u,i.length))return NaN;let d;if(e&&r)d=Y0(t,l,i,u,n),s=Math.min(s,d);else if(e&&!r){let f=t.slice(l[0],l[1]+1);for(let m=u[0];m<=u[1];++m)if(d=er(i[m],f,n),s=Math.min(s,d),s===0)return s}else if(!e&&r){let f=i.slice(u[0],u[1]+1);for(let m=l[0];m<=l[1];++m)if(d=er(t[m],f,n),s=Math.min(s,d),s===0)return s}else d=K0(t,l,i,u,n),s=Math.min(s,d)}else{let d=sc(l,e),f=sc(u,r);Es(a,s,n,t,i,d[0],f[0]),Es(a,s,n,t,i,d[0],f[1]),Es(a,s,n,t,i,d[1],f[0]),Es(a,s,n,t,i,d[1],f[1])}}return s}function uc(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]}class ir{constructor(t,e){this.type=V,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Un(t[1])){let i=t[1];if(i.type==="FeatureCollection")return new ir(i,i.features.map((r)=>uc(r.geometry)).flat());if(i.type==="Feature")return new ir(i,uc(i.geometry));if("type"in i&&"coordinates"in i)return new ir(i,uc(i))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,i){let r=e.geometry(),n=r.flat().map((a)=>ic([a.x,a.y],e.canonical));if(r.length===0)return NaN;let o=new Ps(n[0][1]),s=1/0;for(let a of i){switch(a.type){case"Point":s=Math.min(s,Cs(n,!1,[a.coordinates],!1,o,s));break;case"LineString":s=Math.min(s,Cs(n,!1,a.coordinates,!0,o,s));break;case"Polygon":s=Math.min(s,Ms(n,!1,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,i){let r=e.geometry(),n=r.flat().map((a)=>ic([a.x,a.y],e.canonical));if(r.length===0)return NaN;let o=new Ps(n[0][1]),s=1/0;for(let a of i){switch(a.type){case"Point":s=Math.min(s,Cs(n,!0,[a.coordinates],!1,o,s));break;case"LineString":s=Math.min(s,Cs(n,!0,a.coordinates,!0,o,s));break;case"Polygon":s=Math.min(s,Ms(n,!0,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries);if(t.geometryType()==="Polygon")return function(e,i){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let n=oc(r,0).map((a)=>a.map((c)=>c.map((l)=>ic([l.x,l.y],e.canonical)))),o=new Ps(n[0][0][0][1]),s=1/0;for(let a of i)for(let c of n){switch(a.type){case"Point":s=Math.min(s,Ms([a.coordinates],!1,c,o,s));break;case"LineString":s=Math.min(s,Ms(a.coordinates,!0,c,o,s));break;case"Polygon":s=Math.min(s,tv(c,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Hn{constructor(t){this.type=at,this.key=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return i==null?e.error("Global state property must be defined."):typeof i!="string"?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Hn(i)}evaluate(t){var e;let i=(e=t.globals)===null||e===void 0?void 0:e.globalState;return i&&Object.keys(i).length!==0?Vn(i,this.key):null}eachChild(){}outputDefined(){return!1}}let jr={"==":F0,"!=":B0,">":j0,"<":O0,">=":V0,"<=":N0,array:Qe,at:Wl,boolean:Qe,case:Yl,coalesce:bs,collator:ws,format:Ts,image:tc,in:Hl,"index-of":ys,interpolate:we,"interpolate-hcl":we,"interpolate-lab":we,length:ec,let:_s,literal:Qi,match:Xl,number:Qe,"number-format":Ql,object:Qe,slice:vs,step:Zn,string:Qe,"to-boolean":Li,"to-color":Li,"to-number":Li,"to-string":Li,var:gs,within:tr,distance:ir,"global-state":Hn};class Ue{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){let i=t[0],r=Ue.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter(([c])=>!Array.isArray(c)||c.length===t.length-1),a=null;for(let[c,l]of s){a=new ms(e.registry,As,e.path,null,e.scope);let u=[],h=!1;for(let p=1;p<t.length;p++){let d=t[p],f=Array.isArray(c)?c[p-1]:c.type,m=a.parse(d,1+u.length,f);if(!m){h=!0;break}u.push(m)}if(!h)if(Array.isArray(c)&&c.length!==u.length)a.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);else{for(let p=0;p<u.length;p++){let d=Array.isArray(c)?c[p]:c.type,f=u[p];a.concat(p+1).checkSubtype(d,f.type)}if(a.errors.length===0)return new Ue(i,n,l,u)}}if(s.length===1)e.errors.push(...a.errors);else{let c=(s.length?s:o).map(([u])=>{return h=u,Array.isArray(h)?`(${h.map(kt).join(", ")})`:`(${kt(h.type)}...)`;var h}).join(" | "),l=[];for(let u=1;u<t.length;u++){let h=e.parse(t[u],1+l.length);if(!h)return null;l.push(kt(h.type))}e.error(`Expected arguments of type ${c}, but found (${l.join(", ")}) instead.`)}return null}static register(t,e){Ue.definitions=e;for(let i in e)t[i]=Ue}}function mp(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);let o=n?n.evaluate(t):1,s=Yd(e,i,r,o);if(s)throw new Lt(s);return new Y(e/255,i/255,r/255,o,!1)}function _p(t,e){return t in e}function dc(t,e){let i=e[t];return i===void 0?null:i}function rr(t){return{type:t}}function As(t){if(t instanceof gs)return As(t.boundExpression);if(t instanceof Ue&&t.name==="error")return!1;if(t instanceof ws)return!1;if(t instanceof tr)return!1;if(t instanceof ir)return!1;if(t instanceof Hn)return!1;let e=t instanceof Li||t instanceof Qe,i=!0;return t.eachChild((r)=>{i=e?i&&As(r):i&&r instanceof Qi}),!!i&&zs(t)&&Ds(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function zs(t){if(t instanceof Ue){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 tr)return!1;if(t instanceof ir)return!1;let e=!0;return t.eachChild((i)=>{e&&!zs(i)&&(e=!1)}),e}function Xn(t){if(t instanceof Ue&&t.name==="feature-state")return!1;let e=!0;return t.eachChild((i)=>{e&&!Xn(i)&&(e=!1)}),e}function Ds(t,e){if(t instanceof Ue&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((r)=>{i&&!Ds(r,e)&&(i=!1)}),i}function gp(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}function Vr(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function yp(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function pc(t){return!!t.expression&&t.expression.interpolated}function ht(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function Rs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&qt(t)===Ki}function ev(t){return t}function vp(t,e){let i=t.stops&&typeof t.stops[0][0]=="object",r=i||!(i||t.property!==void 0),n=t.type||(pc(e)?"exponential":"interval"),o=function(u){switch(u.type){case"color":return Y.parse;case"padding":return ve.parse;case"numberArray":return xe.parse;case"colorArray":return se.parse;default:return null}}(e);if(o&&((t=Rr({},t)).stops&&(t.stops=t.stops.map((u)=>[u[0],o(u[1])])),t.default=o(t.default?t.default:e.default)),t.colorSpace&&(s=t.colorSpace)!=="rgb"&&s!=="hcl"&&s!=="lab")throw Error(`Unknown color space: "${t.colorSpace}"`);var s;let a=function(u){switch(u){case"exponential":return xp;case"interval":return rv;case"categorical":return iv;case"identity":return nv;default:throw Error(`Unknown function type "${u}"`)}}(n),c,l;if(n==="categorical"){c=Object.create(null);for(let u of t.stops)c[u[0]]=u[1];l=typeof t.stops[0][0]}if(i){let u={},h=[];for(let f=0;f<t.stops.length;f++){let m=t.stops[f],_=m[0].zoom;u[_]===void 0&&(u[_]={zoom:_,type:t.type,property:t.property,default:t.default,stops:[]},h.push(_)),u[_].stops.push([m[0].value,m[1]])}let p=[];for(let f of h)p.push([u[f].zoom,vp(u[f],e)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:we.interpolationFactor.bind(void 0,d),zoomStops:p.map((f)=>f[0]),evaluate:({zoom:f},m)=>xp({stops:p,base:t.base},e,f).evaluate(f,m)}}if(r){let u=n==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:u,interpolationFactor:we.interpolationFactor.bind(void 0,u),zoomStops:t.stops.map((h)=>h[0]),evaluate:({zoom:h})=>a(t,e,h,c,l)}}return{kind:"source",evaluate(u,h){let p=h&&h.properties?h.properties[t.property]:void 0;return p===void 0?Yn(t.default,e.default):a(t,e,p,c,l)}}}function Yn(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function iv(t,e,i,r,n){return Yn(typeof i===n?r[i]:void 0,t.default,e.default)}function rv(t,e,i){if(ht(i)!=="number")return Yn(t.default,e.default);let r=t.stops.length;if(r===1)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];let n=xs(t.stops.map((o)=>o[0]),i);return t.stops[n][1]}function xp(t,e,i){let r=t.base!==void 0?t.base:1;if(ht(i)!=="number")return Yn(t.default,e.default);let n=t.stops.length;if(n===1)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];let o=xs(t.stops.map((u)=>u[0]),i),s=function(u,h,p,d){let f=d-p,m=u-p;return f===0?0:h===1?m/f:(Math.pow(h,m)-1)/(Math.pow(h,f)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],c=t.stops[o+1][1],l=Ft[e.type]||ev;return typeof a.evaluate=="function"?{evaluate(...u){let h=a.evaluate.apply(void 0,u),p=c.evaluate.apply(void 0,u);if(h!==void 0&&p!==void 0)return l(h,p,s,t.colorSpace)}}:l(a,c,s,t.colorSpace)}function nv(t,e,i){switch(e.type){case"color":i=Y.parse(i);break;case"formatted":i=De.fromString(i.toString());break;case"resolvedImage":i=Ve.fromString(i.toString());break;case"padding":i=ve.parse(i);break;case"colorArray":i=se.parse(i);break;case"numberArray":i=xe.parse(i);break;default:ht(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Yn(i,t.default,e.default)}Ue.register(jr,{error:[{kind:"error"},[ot],(t,[e])=>{throw new Lt(e.evaluate(t))}],typeof:[ot,[at],(t,[e])=>kt(qt(e.evaluate(t)))],"to-rgba":[ye(V,4),[Je],(t,[e])=>{let[i,r,n,o]=e.evaluate(t).rgb;return[255*i,255*r,255*n,o]}],rgb:[Je,[V,V,V],mp],rgba:[Je,[V,V,V,V],mp],has:{type:ct,overloads:[[[ot],(t,[e])=>_p(e.evaluate(t),t.properties())],[[ot,Ki],(t,[e,i])=>_p(e.evaluate(t),i.evaluate(t))]]},get:{type:at,overloads:[[[ot],(t,[e])=>dc(e.evaluate(t),t.properties())],[[ot,Ki],(t,[e,i])=>dc(e.evaluate(t),i.evaluate(t))]]},"feature-state":[at,[ot],(t,[e])=>dc(e.evaluate(t),t.featureState||{})],properties:[Ki,[],(t)=>t.properties()],"geometry-type":[ot,[],(t)=>t.geometryType()],id:[at,[],(t)=>t.id()],zoom:[V,[],(t)=>t.globals.zoom],"heatmap-density":[V,[],(t)=>t.globals.heatmapDensity||0],elevation:[V,[],(t)=>t.globals.elevation||0],"line-progress":[V,[],(t)=>t.globals.lineProgress||0],accumulated:[at,[],(t)=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[V,rr(V),(t,e)=>{let i=0;for(let r of e)i+=r.evaluate(t);return i}],"*":[V,rr(V),(t,e)=>{let i=1;for(let r of e)i*=r.evaluate(t);return i}],"-":{type:V,overloads:[[[V,V],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[V],(t,[e])=>-e.evaluate(t)]]},"/":[V,[V,V],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[V,[V,V],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[V,[V],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[V,[V],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[V,[V],(t,[e])=>Math.log(e.evaluate(t))],log2:[V,[V],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[V,[V],(t,[e])=>Math.sin(e.evaluate(t))],cos:[V,[V],(t,[e])=>Math.cos(e.evaluate(t))],tan:[V,[V],(t,[e])=>Math.tan(e.evaluate(t))],asin:[V,[V],(t,[e])=>Math.asin(e.evaluate(t))],acos:[V,[V],(t,[e])=>Math.acos(e.evaluate(t))],atan:[V,[V],(t,[e])=>Math.atan(e.evaluate(t))],min:[V,rr(V),(t,e)=>Math.min(...e.map((i)=>i.evaluate(t)))],max:[V,rr(V),(t,e)=>Math.max(...e.map((i)=>i.evaluate(t)))],abs:[V,[V],(t,[e])=>Math.abs(e.evaluate(t))],round:[V,[V],(t,[e])=>{let i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[V,[V],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[V,[V],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ct,[ot,at],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ct,[at],(t,[e])=>t.id()===e.value],"filter-type-==":[ct,[ot],(t,[e])=>t.geometryType()===e.value],"filter-<":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[ct,[at],(t,[e])=>(e.value in t.properties())],"filter-has-id":[ct,[],(t)=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[ct,[ye(ot)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ct,[ye(at)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ct,[ot,ye(at)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ct,[ot,ye(at)],(t,[e,i])=>function(r,n,o,s){for(;o<=s;){let a=o+s>>1;if(n[a]===r)return!0;n[a]>r?s=a-1:o=a+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[rr(ct),(t,e)=>{for(let i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[rr(ct),(t,e)=>{for(let i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ct,[ct],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ct,[ot],(t,[e])=>{let i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ot,[ot],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ot,[ot],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ot,rr(at),(t,e)=>e.map((i)=>$n(i.evaluate(t))).join("")],split:[ye(ot),[ot,ot],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[ot,[ye(ot),ot],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[ot,[as],(t,[e])=>e.evaluate(t).resolvedLocale()]});class ks{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new ql,this._defaultValue=e?function(r){if(r.type==="color"&&Rs(r.default))return new Y(0,0,0,0);switch(r.type){case"color":return Y.parse(r.default)||null;case"padding":return ve.parse(r.default)||null;case"numberArray":return xe.parse(r.default)||null;case"colorArray":return se.parse(r.default)||null;case"variableAnchorOffsetCollection":return Ne.parse(r.default)||null;case"projectionDefinition":return Re.parse(r.default)||null;default:return r.default===void 0?null:r.default}}(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o){this._globalState&&(t=Ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||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 Lt(`Expected value to be one of ${Object.keys(this._enumValues).map((a)=>JSON.stringify(a)).join(", ")}, but found ${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 Ls(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in jr}function Fs(t,e,i){let r=new ms(jr,As,[],e?function(o){let s={color:Je,string:ot,number:V,enum:ot,boolean:ct,formatted:Bn,padding:ls,numberArray:cs,colorArray:On,projectionDefinition:ss,resolvedImage:jn,variableAnchorOffsetCollection:hs};return o.type==="array"?ye(s[o.value]||at,o.length):s[o.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?gp(new ks(n,e,i)):Nr(r.errors)}class Kn{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!Xn(e.expression),this.globalStateRefs=Jn(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,o)}}class Bs{constructor(t,e,i,r,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!Xn(e.expression),this.globalStateRefs=Jn(e.expression),this.interpolationType=r,this._globalState=n}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?we.interpolationFactor(this.interpolationType,t,e,i):0}}function bp(t,e,i){let r=Fs(t,e,i);if(r.result==="error")return r;let n=r.value.expression,o=zs(n);if(!o&&!Vr(e))return Nr([new Ke("","data expressions not supported")]);let s=Ds(n,["zoom"]);if(!s&&!yp(e))return Nr([new Ke("","zoom expressions not supported")]);let a=js(n);return a||s?a instanceof Ke?Nr([a]):a instanceof we&&!pc(e)?Nr([new Ke("",'"interpolate" expressions cannot be used with this property')]):gp(a?new Bs(o?"camera":"composite",r.value,a.labels,a instanceof we?a.interpolation:void 0,i):new Kn(o?"constant":"source",r.value,i)):Nr([new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Os{constructor(t,e){this._parameters=t,this._specification=e,Rr(this,vp(this._parameters,this._specification))}static deserialize(t){return new Os(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function js(t){let e=null;if(t instanceof _s)e=js(t.result);else if(t instanceof bs){for(let i of t.args)if(e=js(i),e)break}else(t instanceof Zn||t instanceof we)&&t.input instanceof Ue&&t.input.name==="zoom"&&(e=t);return e instanceof Ke||t.eachChild((i)=>{let r=js(i);r instanceof Ke?e=r:!e&&r?e=new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new Ke("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Jn(t,e=new Set){return t instanceof Hn&&e.add(t.key),t.eachChild((i)=>{Jn(i,e)}),e}function Ur(t,e){let{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a}=t!=null?t:{};return{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a,globalState:e}}function fc(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(!fc(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}let ov={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Qn(t,e){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};fc(t)||(t=Ns(t));let i=Fs(t,ov,e);if(i.result==="error")throw Error(i.value.map((r)=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,o)=>i.value.evaluate(r,n,{},o),needGeometry:wp(t),getGlobalStateRefs:()=>Jn(i.value.expression)}}function sv(t,e){return t<e?-1:t>e?1:0}function wp(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(wp(t[e]))return!0;return!1}function Ns(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?mc(t[1],t[2],"=="):e==="!="?Vs(mc(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?mc(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(Ns))):e==="all"?["all"].concat(t.slice(1).map(Ns)):e==="none"?["all"].concat(t.slice(1).map(Ns).map(Vs)):e==="in"?Tp(t[1],t.slice(2)):e==="!in"?Vs(Tp(t[1],t.slice(2))):e==="has"?Sp(t[1]):e!=="!has"||Vs(Sp(t[1]));var i}function mc(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Tp(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((i)=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(sv)]]:["filter-in-small",t,["literal",e]]}}function Sp(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Vs(t){return["!",t]}function Pp(t){let e=t.value;return e?[new j(t.key,e,"constants have been deprecated as of v8")]:[]}function Ut(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function nr(t){if(Array.isArray(t))return t.map(nr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let i in t)e[i]=nr(t[i]);return e}return Ut(t)}function ke(t){let{key:e,value:i}=t,r=t.valueSpec||{},n=t.objectElementValidators||{},{style:o,styleSpec:s,validateSpec:a}=t,c=[],l=ht(i);if(l!=="object")return[new j(e,i,`object expected, ${l} found`)];for(let u in i){let h=u.split(".")[0],p=Vn(r,h)||r["*"],d;if(Vn(n,h))d=n[h];else if(Vn(r,h)){if(i[u]===void 0)continue;d=a}else if(n["*"])d=n["*"];else{if(!r["*"]){c.push(new j(e,i[u],`unknown property "${u}"`));continue}d=a}c=c.concat(d({key:(e?`${e}.`:e)+u,value:i[u],valueSpec:p,style:o,styleSpec:s,object:i,objectKey:u,validateSpec:a},i))}for(let u in r)n[u]||r[u].required&&r[u].default===void 0&&i[u]===void 0&&c.push(new j(e,i,`missing required property "${u}"`));return c}function _c(t){let{value:e,valueSpec:i,style:r,styleSpec:n,key:o}=t,s=t.arrayElementValidator||t.validateSpec;if(ht(e)!=="array")return[new j(o,e,`array expected, ${ht(e)} found`)];if(i.length&&e.length!==i.length)return[new j(o,e,`array length ${i.length} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};n.$version<7&&(a.function=i.function),ht(i.value)==="object"&&(a=i.value);let c=[];for(let l=0;l<e.length;l++)c=c.concat(s({array:e,arrayIndex:l,value:e[l],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${o}[${l}]`}));return c}function Us(t){let{key:e,value:i,valueSpec:r}=t,n=ht(i);return n==="number"&&i!=i&&(n="NaN"),n!=="number"?[new j(e,i,`number expected, ${n} found`)]:("minimum"in r)&&i<r.minimum?[new j(e,i,`${i} is less than the minimum value ${r.minimum}`)]:("maximum"in r)&&i>r.maximum?[new j(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function Ip(t){let e=t.valueSpec,i=Ut(t.value.type),r,n,o,s={},a=i!=="categorical"&&t.value.property===void 0,c=!a,l=ht(t.value.stops)==="array"&&ht(t.value.stops[0])==="array"&&ht(t.value.stops[0][0])==="object",u=ke({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(d){if(i==="identity")return[new j(d.key,d.value,'identity function may not have a "stops" property')];let f=[],m=d.value;return f=f.concat(_c({key:d.key,value:m,valueSpec:d.valueSpec,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,arrayElementValidator:h})),ht(m)==="array"&&m.length===0&&f.push(new j(d.key,m,"array must have at least one stop")),f},default:function(d){return d.validateSpec({key:d.key,value:d.value,valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec})}}});return i==="identity"&&a&&u.push(new j(t.key,t.value,'missing required property "property"')),i==="identity"||t.value.stops||u.push(new j(t.key,t.value,'missing required property "stops"')),i==="exponential"&&t.valueSpec.expression&&!pc(t.valueSpec)&&u.push(new j(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!Vr(t.valueSpec)?u.push(new j(t.key,t.value,"property functions not supported")):a&&!yp(t.valueSpec)&&u.push(new j(t.key,t.value,"zoom functions not supported"))),i!=="categorical"&&!l||t.value.property!==void 0||u.push(new j(t.key,t.value,'"property" property is required')),u;function h(d){let f=[],{value:m,key:_}=d;if(ht(m)!=="array")return[new j(_,m,`array expected, ${ht(m)} found`)];if(m.length!==2)return[new j(_,m,`array length 2 expected, length ${m.length} found`)];if(l){if(ht(m[0])!=="object")return[new j(_,m,`object expected, ${ht(m[0])} found`)];if(m[0].zoom===void 0)return[new j(_,m,"object stop key must have zoom")];if(m[0].value===void 0)return[new j(_,m,"object stop key must have value")];if(o&&o>Ut(m[0].zoom))return[new j(_,m[0].zoom,"stop zoom values must appear in ascending order")];Ut(m[0].zoom)!==o&&(o=Ut(m[0].zoom),n=void 0,s={}),f=f.concat(ke({key:`${_}[0]`,value:m[0],valueSpec:{zoom:{}},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{zoom:Us,value:p}}))}else f=f.concat(p({key:`${_}[0]`,value:m[0],validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec},m));return Ls(nr(m[1]))?f.concat([new j(`${_}[1]`,m[1],"expressions are not allowed in function stops.")]):f.concat(d.validateSpec({key:`${_}[1]`,value:m[1],valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec}))}function p(d,f){let m=ht(d.value),_=Ut(d.value),y=d.value!==null?d.value:f;if(r){if(m!==r)return[new j(d.key,y,`${m} stop domain type must match previous stop domain type ${r}`)]}else r=m;if(m!=="number"&&m!=="string"&&m!=="boolean")return[new j(d.key,y,"stop domain value must be a number, string, or boolean")];if(m!=="number"&&i!=="categorical"){let v=`number expected, ${m} found`;return Vr(e)&&i===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new j(d.key,y,v)]}return i!=="categorical"||m!=="number"||isFinite(_)&&Math.floor(_)===_?i!=="categorical"&&m==="number"&&n!==void 0&&_<n?[new j(d.key,y,"stop domain values must appear in ascending order")]:(n=_,i==="categorical"&&(_ in s)?[new j(d.key,y,"stop domain values must be unique")]:(s[_]=!0,[])):[new j(d.key,y,`integer expected, found ${_}`)]}}function $r(t){let e=(t.expressionContext==="property"?bp:Fs)(nr(t.value),t.valueSpec);if(e.result==="error")return e.value.map((r)=>new j(`${t.key}${r.key}`,t.value,r.message));let i=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!i.outputDefined())return[new j(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Xn(i))return[new j(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Xn(i))return[new j(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ds(i,["zoom","feature-state"]))return[new j(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!zs(i))return[new j(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gc(t){let{key:e,value:i}=t,r=ht(i);return r!=="string"?[new j(e,i,`color expected, ${r} found`)]:Y.parse(String(i))?[]:[new j(e,i,`color expected, "${i}" found`)]}function to(t){let{key:e,value:i,valueSpec:r}=t,n=[];return Array.isArray(r.values)?r.values.indexOf(Ut(i))===-1&&n.push(new j(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(Ut(i))===-1&&n.push(new j(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function yc(t){return fc(nr(t.value))?$r(Rr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ep(t)}function Ep(t){let{value:e,key:i}=t;if(ht(e)!=="array")return[new j(i,e,`array expected, ${ht(e)} found`)];let r=t.styleSpec,n,o=[];if(e.length<1)return[new j(i,e,"filter array must have at least 1 element")];switch(o=o.concat(to({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Ut(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ut(e[1])==="$type"&&o.push(new j(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new j(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=ht(e[1]),n!=="string"&&o.push(new j(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=ht(e[s]),Ut(e[1])==="$type"?o=o.concat(to({key:`${i}[${s}]`,value:e[s],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&o.push(new j(`${i}[${s}]`,e[s],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let s=1;s<e.length;s++)o=o.concat(Ep({key:`${i}[${s}]`,value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=ht(e[1]),e.length!==2?o.push(new j(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):n!=="string"&&o.push(new j(`${i}[1]`,e[1],`string expected, ${n} found`))}return o}function Mp(t,e){let{key:i,validateSpec:r,style:n,styleSpec:o,value:s,objectKey:a}=t,c=o[`${e}_${t.layerType}`];if(!c)return[];let l=a.match(/^(.*)-transition$/);if(e==="paint"&&l&&c[l[1]]&&c[l[1]].transition)return r({key:i,value:s,valueSpec:o.transition,style:n,styleSpec:o});let u=t.valueSpec||c[a];if(!u)return[new j(i,s,`unknown property "${a}"`)];let h;if(ht(s)==="string"&&Vr(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new j(i,s,`"${a}" does not support interpolation syntax
1
+ import{Dr,hr}from"./c-d15cp8ae.js";var l0=hr(function(_l,a0){(function(W,Xi){typeof _l=="object"&&typeof a0<"u"?Xi(_l):typeof define=="function"&&define.amd?define(["exports"],Xi):Xi((W=typeof globalThis<"u"?globalThis:W||self).maplibregl={})})(_l,function(W){var Xi,sd,ad="5.24.1";function it(t,e,i,r){return new(i||(i=Promise))(function(n,o){function s(l){try{c(r.next(l))}catch(u){o(u)}}function a(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?n(l.value):(u=l.value,u instanceof i?u:new i(function(h){h(u)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function z(t,e){this.x=t,this.y=e}function ld(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}typeof SuppressedError=="function"&&SuppressedError,z.prototype={clone(){return new z(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround(t,e){let i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:z},z.convert=function(t){if(t instanceof z)return t;if(Array.isArray(t))return new z(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new z(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var c0=function(){if(sd)return Xi;function t(e,i,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=n}return sd=1,Xi=t,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,i){if(i===void 0&&(i=0.000001),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<i)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<0.000001)break;r-=o/s}var a=0,c=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<i));n++)e>o?a=r:c=r,r=0.5*(c-a)+a;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Xi}(),h0=ld(c0);let gl,Wo;function cd(){return gl!=null||(gl=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),gl}var oe=0.000001,Qt=typeof Float32Array<"u"?Float32Array:Array;function hd(){var t=new Qt(4);return Qt!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function ud(){var t=new Qt(9);return Qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Ci(){var t=new Qt(16);return Qt!=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 yl(t){var e=new Qt(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 He(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 Ho(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],_=e[14],y=e[15],v=i*a-r*s,g=i*c-n*s,x=i*l-o*s,b=r*c-n*a,w=r*l-o*a,T=n*l-o*c,P=u*m-h*f,S=u*_-p*f,E=u*y-d*f,I=h*_-p*m,C=h*y-d*m,A=p*y-d*_,M=v*A-g*C+x*I+b*E-w*S+T*P;return M?(t[0]=(a*A-c*C+l*I)*(M=1/M),t[1]=(n*C-r*A-o*I)*M,t[2]=(m*T-_*w+y*b)*M,t[3]=(p*w-h*T-d*b)*M,t[4]=(c*E-s*A-l*S)*M,t[5]=(i*A-n*E+o*S)*M,t[6]=(_*x-f*T-y*g)*M,t[7]=(u*T-p*x+d*g)*M,t[8]=(s*C-a*E+l*P)*M,t[9]=(r*E-i*C-o*P)*M,t[10]=(f*w-m*x+y*v)*M,t[11]=(h*x-u*w-d*v)*M,t[12]=(a*S-s*I-c*P)*M,t[13]=(i*I-r*S+n*P)*M,t[14]=(m*g-f*b-_*v)*M,t[15]=(u*b-h*g+p*v)*M,t):null}function Sr(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],_=e[13],y=e[14],v=e[15],g=i[0],x=i[1],b=i[2],w=i[3];return t[0]=g*r+x*a+b*h+w*m,t[1]=g*n+x*c+b*p+w*_,t[2]=g*o+x*l+b*d+w*y,t[3]=g*s+x*u+b*f+w*v,t[4]=(g=i[4])*r+(x=i[5])*a+(b=i[6])*h+(w=i[7])*m,t[5]=g*n+x*c+b*p+w*_,t[6]=g*o+x*l+b*d+w*y,t[7]=g*s+x*u+b*f+w*v,t[8]=(g=i[8])*r+(x=i[9])*a+(b=i[10])*h+(w=i[11])*m,t[9]=g*n+x*c+b*p+w*_,t[10]=g*o+x*l+b*d+w*y,t[11]=g*s+x*u+b*f+w*v,t[12]=(g=i[12])*r+(x=i[13])*a+(b=i[14])*h+(w=i[15])*m,t[13]=g*n+x*c+b*p+w*_,t[14]=g*o+x*l+b*d+w*y,t[15]=g*s+x*u+b*f+w*v,t}function Ot(t,e,i){var r,n,o,s,a,c,l,u,h,p,d,f,m=i[0],_=i[1],y=i[2];return e===t?(t[12]=e[0]*m+e[4]*_+e[8]*y+e[12],t[13]=e[1]*m+e[5]*_+e[9]*y+e[13],t[14]=e[2]*m+e[6]*_+e[10]*y+e[14],t[15]=e[3]*m+e[7]*_+e[11]*y+e[15]):(n=e[1],o=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=s,t[4]=a,t[5]=c,t[6]=l,t[7]=u,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=r*m+a*_+h*y+e[12],t[13]=n*m+c*_+p*y+e[13],t[14]=o*m+l*_+d*y+e[14],t[15]=s*m+u*_+f*y+e[15]),t}function Wt(t,e,i){var r=i[0],n=i[1],o=i[2];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]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,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 oi(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],p=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*n+l*r,t[5]=s*n+u*r,t[6]=a*n+h*r,t[7]=c*n+p*r,t[8]=l*n-o*r,t[9]=u*n-s*r,t[10]=h*n-a*r,t[11]=p*n-c*r,t}function Xo(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],c=e[3],l=e[8],u=e[9],h=e[10],p=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*n-l*r,t[1]=s*n-u*r,t[2]=a*n-h*r,t[3]=c*n-p*r,t[8]=o*r+l*n,t[9]=s*r+u*n,t[10]=a*r+h*n,t[11]=c*r+p*n,t}function xi(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],c=e[3],l=e[4],u=e[5],h=e[6],p=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*n+l*r,t[1]=s*n+u*r,t[2]=a*n+h*r,t[3]=c*n+p*r,t[4]=l*n-o*r,t[5]=u*n-s*r,t[6]=h*n-a*r,t[7]=p*n-c*r,t}var vl=function(t,e,i,r,n){var o=1/Math.tan(e/2);if(t[0]=o/i,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,n!=null&&n!==1/0){var s=1/(r-n);t[10]=(n+r)*s,t[14]=2*n*r*s}else t[10]=-1,t[14]=-2*r;return t},si=function(t,e,i,r,n,o,s){var a=1/(e-i),c=1/(r-n),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*c,t[14]=(s+o)*l,t[15]=1,t};function dd(){var t=new Qt(3);return Qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function xl(t){var e=new Qt(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Yo(t){var e=t[0],i=t[1],r=t[2];return Math.sqrt(e*e+i*i+r*r)}function pd(t,e,i){var r=new Qt(3);return r[0]=t,r[1]=e,r[2]=i,r}function Be(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Zt(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Xe(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function ce(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ai(t,e,i){var r=e[0],n=e[1],o=e[2],s=i[0],a=i[1],c=i[2];return t[0]=n*c-o*a,t[1]=o*s-r*c,t[2]=r*a-n*s,t}function bl(t,e,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=e[0],c=e[1],l=e[2],u=n*l-o*c,h=o*a-r*l,p=r*c-n*a;return t[0]=a+s*(u+=u)+n*(p+=p)-o*(h+=h),t[1]=c+s*h+o*u-r*p,t[2]=l+s*p+r*h-n*u,t}function Ko(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function An(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function wl(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}var zn,bi=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},Tl=Yo;function Yt(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,t}function fd(){var t=new Qt(4);return Qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function md(t,e,i,r){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",o=Math.PI/360;e*=o,r*=o,i*=o;var s=Math.sin(e),a=Math.cos(e),c=Math.sin(i),l=Math.cos(i),u=Math.sin(r),h=Math.cos(r);switch(n){case"xyz":t[0]=s*l*h+a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h-s*c*u;break;case"xzy":t[0]=s*l*h-a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h+s*c*u;break;case"yxz":t[0]=s*l*h+a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h+s*c*u;break;case"yzx":t[0]=s*l*h+a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h-s*c*u;break;case"zxy":t[0]=s*l*h-a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h-s*c*u;break;case"zyx":t[0]=s*l*h-a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h+s*c*u;break;default:throw Error("Unknown angle order "+n)}return t}function Sl(){var t=new Qt(2);return Qt!=Float32Array&&(t[0]=0,t[1]=0),t}function _d(t,e){var i=new Qt(2);return i[0]=t,i[1]=e,i}function gd(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function yd(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)}function vd(t){return t[0]=0,t[1]=0,t}dd(),zn=new Qt(4),Qt!=Float32Array&&(zn[0]=0,zn[1]=0,zn[2]=0,zn[3]=0),dd(),pd(1,0,0),pd(0,1,0),fd(),fd(),ud();var u0=function(t){var e=t[0],i=t[1];return e*e+i*i};Sl();let F=8192;function Me(t,e,i){return e*(F/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function me(t){return t instanceof Error?t:Error(typeof t=="string"?t:String(t))}function Dn(){return new Float64Array(4)}function Gt(){return new Float64Array(3)}function Ai(){return new Float64Array(16)}function Pr(){let t=new Float64Array(16);return He(t),t}function xd(){let t=new Float32Array(16);return He(t),t}function zi(t,e,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let o=n?r==="map"?-t.bearingInRadians:0:r==="viewport"?t.bearingInRadians:0;if(o){let s=Math.sin(o),a=Math.cos(o);i=[i[0]*a-i[1]*s,i[0]*s+i[1]*a]}return[n?i[0]:Me(e,i[0],t.zoom),n?i[1]:Me(e,i[1],t.zoom)]}function Pl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function Oe(t,e,i){let r=(n=[t[0],t[1],t[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((u=n[8])*(s=n[4])-(a=n[5])*(l=n[7]))+n[1]*(-u*(o=n[3])+a*(c=n[6]))+n[2]*(l*o-s*c);var n,o,s,a,c,l,u;if(r===0)return null;let h=ai([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),p=ai([],[i[0],i[1],i[2]],[t[0],t[1],t[2]]),d=ai([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),f=Zt([],h,-t[3]);return Be(f,f,Zt([],p,-e[3])),Be(f,f,Zt([],d,-i[3])),Zt(f,f,1/r),f}function d0(t,e,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return r===0?null:(-(t[0]*i[0]+t[1]*i[1]+t[2]*i[2])-i[3])/r}function Jo(t,e,i,r){let n=Math.sqrt(t*t+e*e),o=Math.sqrt(i*i+r*r);t/=n,e/=n,i/=o,r/=o;let s=Math.acos(t*i+e*r);return-e*i+t*r>0?s:-s}function Ce(t,e){let i=Ir(t,360),r=Ir(e,360),n=r-i,o=r>i?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o}function Qo(t,e){let i=Ir(t,2*Math.PI),r=Ir(e,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))}function Ir(t,e){return(t%e+e)%e}function ts(t,e,i,r,n){return Er(r,n,_t((t-e)/(i-e),0,1))}function Er(t,e,i){return t*(1-i)+e*i}function p0(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(let o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[e,i,r,n]}function bd(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,i=e*t;return 4*(t<0.5?i:3*(t-e)+i-0.75)}function Il(t,e,i,r){let n=new h0(t,e,i,r);return(o)=>n.solve(o)}let El=Il(0.25,0.1,0.25,1);function _t(t,e,i){return Math.min(i,Math.max(e,t))}function Ye(t,e,i){let r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function G(t,...e){for(let i of e)for(let r in i)t[r]=i[r];return t}function Rn(t,e){let i={};for(let r of e)r in t&&(i[r]=t[r]);return i}let f0=1;function wd(){return f0++}function _e(t){return Math.pow(2,t)}function he(t){return Math.log(t)/Math.LN2}function Ae(t,e,i){if(e<=0)return t;let r=1/e;return i===void 0||Math.abs(i)<0.0000000001?Math.round(t*r)/r:(i>0?Math.ceil(t*r-0.000000001):Math.floor(t*r+0.0000000001))/r}function Ml(t,e,i){let r={};for(let n in t)r[n]=e.call(this,t[n],n,t);return r}function Td(t,e,i){let r={};for(let n in t)e.call(this,t[n],n,t)&&(r[n]=t[n]);return r}function li(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!li(t[i],e[i]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object")return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!li(t[i],e[i]))return!1;return!0}return t===e}function be(t){return Array.isArray(t)?t.map(be):typeof t=="object"&&t?Ml(t,be):t}let Sd={};function Ct(t){Sd[t]||(typeof console<"u"&&console.warn(t),Sd[t]=!0)}function Di(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}let Cl=null;function Yi(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}let Pd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Al(t,e,i,r){return t.addEventListener(e,i,r),{unsubscribe:()=>{t.removeEventListener(e,i,r)}}}function Vt(t){return t*Math.PI/180}function Cr(t){return t/Math.PI*180}function Id(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing}function Ed(t,e,i){let r=_d(e.x-i.x,e.y-i.y),n=_d(t.x-i.x,t.y-i.y);var o,s;return Cr(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(s=n)[0]+o[1]*s[1]))}function Md(t,e,i){let r=new Float64Array(4);return md(r,t,e-90,i),r}let kn=85.051129,Cd={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Ad={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function m0(t,e){var i;if(!Ad[e])return!1;let r=t==null?void 0:t.target,n=((i=r==null?void 0:r.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return t instanceof n.MouseEvent||t instanceof n.WheelEvent}let zl="AbortError";class Ln extends Error{constructor(t=zl){super(t instanceof Error?t.message:t),this.name=zl,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function Ar(t){return t instanceof Error&&t.name===zl}function zd(t){if(t.aborted)throw new Ln(t.reason)}let es,Dl,Rl,ge={frame(t,e,i,r){let n=r||window,o=n.requestAnimationFrame((a)=>{s(),e(a)}),{unsubscribe:s}=Al(t.signal,"abort",()=>{s(),n.cancelAnimationFrame(o),i(new Ln(t.signal.reason))},!1)},frameAsync(t,e){return new Promise((i,r)=>{this.frame(t,i,r,e)})},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){let e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:(t)=>(es||(es=document.createElement("a")),es.href=t,es.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Rl!==void 0?Rl:!!matchMedia&&(Dl!=null||(Dl=matchMedia("(prefers-reduced-motion: reduce)")),Dl.matches)},set prefersReducedMotion(t){Rl=t}},is=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function St(){return is.getCurrentTime()}var kl;let _0=new Set(["a","abbr","b","bdi","bdo","br","cite","code","del","div","em","i","img","ins","kbd","li","mark","ol","p","q","s","samp","small","span","strong","sub","sup","time","u","ul","var","wbr"]),g0=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),y0=new Set(["href","src"]),v0=new Set(["http:","https:","mailto:"]),Ll;function Fl(){return Ll!=null||(Ll={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}),Ll}class N{static create(t,e,i){let r=window.document.createElement(t);return e!==void 0&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){N.docStyle&&N.selectProp&&(N.userSelect=N.docStyle[N.selectProp],N.docStyle[N.selectProp]="none")}static enableDrag(){N.docStyle&&N.selectProp&&(N.docStyle[N.selectProp]=N.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",N.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",N.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",N.suppressClickInternal,!0)},0)}static getScale(t){let e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,e,i){let r=e.boundingClientRect;return new z((i.clientX-r.left)/e.x-t.clientLeft,(i.clientY-r.top)/e.y-t.clientTop)}static mousePos(t,e){let i=N.getScale(t);return N.getPoint(t,i,e)}static touchPos(t,e){let i=[],r=N.getScale(t);for(let n of e)i.push(N.getPoint(t,r,n));return i}static sanitize(t){let e=new DOMParser().parseFromString(t,"text/html").body,{querySelectorAll:i,remove:r}=Fl();for(let o of Array.from(i.call(e,"*")))N.isAllowedElement(o)?N.removeDisallowedAttributes(o):r.call(o);let n=document.createDocumentFragment();return n.append(...e.childNodes),n}static isAllowedElement(t){let{namespaceURI:e,localName:i}=Fl();return e.call(t)==="http://www.w3.org/1999/xhtml"&&_0.has(i.call(t))}static removeDisallowedAttributes(t){let{getAttributeNames:e,getAttribute:i,removeAttribute:r}=Fl();for(let n of e.call(t))N.isAllowedAttribute(n,i.call(t,n))||r.call(t,n)}static isAllowedAttribute(t,e){if(!g0.has(t)&&!t.startsWith("aria-"))return!1;if(!y0.has(t))return!0;try{return v0.has(new URL(e,"https://maplibre.invalid/").protocol)}catch(i){return!1}}}N.docStyle=typeof window<"u"&&((kl=window.document)===null||kl===void 0?void 0:kl.documentElement.style),N.selectProp=!N.docStyle||"userSelect"in N.docStyle?"userSelect":"webkitUserSelect";let ze={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dd(t){return ze.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}let Bl="global-dispatcher";class zr extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}let Ol=()=>{var t;return Mr(self)?(t=self.worker)===null||t===void 0?void 0:t.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},rs=function(t,e){return it(this,void 0,void 0,function*(){var i,r;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=Dd(t.url);if(n){let o=yield n(t,e);return o.data||t.type!=="arrayBuffer"?o:G(o,{data:new ArrayBuffer(0)})}if(Mr(self)&&((i=self.worker)===null||i===void 0?void 0:i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Bl},e)}if(!((n)=>{var o;return n.startsWith("file:")||((o=Ol())===null||o===void 0?void 0:o.startsWith("file:"))&&!/^\w+:/.test(n)})(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(n,o){return it(this,void 0,void 0,function*(){let s=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:Ol(),referrerPolicy:n.referrerPolicy,signal:o.signal}),a,c;n.type!=="json"||s.headers.has("Accept")||s.headers.set("Accept","application/json");try{a=yield fetch(s)}catch(u){if(Ar(u))throw u;throw new zr(0,me(u).message,n.url,new Blob)}if(!a.ok){let u=yield a.blob();throw new zr(a.status,a.statusText,n.url,u)}c=n.type==="arrayBuffer"||n.type==="image"?a.arrayBuffer():n.type==="json"?a.json():a.text();let l=yield c;return zd(o.signal),{data:l,cacheControl:a.headers.get("Cache-Control"),expires:a.headers.get("Expires"),etag:a.headers.get("ETag")}})}(t,e);if(Mr(self)&&((r=self.worker)===null||r===void 0?void 0:r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Bl},e)}return function(n,o){return new Promise((s,a)=>{var c;let l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(l.responseType="arraybuffer");for(let u in n.headers)l.setRequestHeader(u,n.headers[u]);n.type==="json"&&(l.responseType="text",((c=n.headers)===null||c===void 0?void 0:c.Accept)||l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{a(Error(l.statusText))},l.onload=()=>{if(!o.signal.aborted)if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let u=l.response;if(n.type==="json")try{u=JSON.parse(l.response)}catch(h){return void a(h)}s({data:u,cacheControl:l.getResponseHeader("Cache-Control"),expires:l.getResponseHeader("Expires"),etag:l.getResponseHeader("ETag")})}else{let u=new Blob([l.response],{type:l.getResponseHeader("Content-Type")});a(new zr(l.status,l.statusText,n.url,u))}},o.signal.addEventListener("abort",()=>{l.abort(),a(new Ln(o.signal.reason))}),l.send(n.body)})}(t,e)})},ns=(t,e)=>rs(G(t,{type:"json"}),e);function Rd(t){if(!t||t.indexOf("://")<=0||t.startsWith("data:image/")||t.startsWith("blob:"))return!0;let e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}var ci;(function(t){let e,i,r,n;t.resetRequestQueue=()=>{e=[],i=0,r=0,n={}},t.addThrottleControl=(c)=>{let l=r++;return n[l]=c,l},t.removeThrottleControl=(c)=>{delete n[c],s()},t.getImage=(c,l,u=!0)=>new Promise((h,p)=>{c.headers||(c.headers={}),c.headers.accept="image/webp,*/*",G(c,{type:"image"});let d={abortController:l,requestParameters:c,supportImageRefresh:u,state:"queued",onError:(f)=>{p(f)},onSuccess:(f)=>{h(f)}};e.push(d),s()});let o=(c)=>it(this,void 0,void 0,function*(){c.state="running";let{requestParameters:l,supportImageRefresh:u,onError:h,onSuccess:p,abortController:d}=c,f=u===!1&&!Mr(self)&&!Dd(l.url)&&(!l.headers||Object.keys(l.headers).reduce((y,v)=>y&&v==="accept",!0));i++;let m=f?a(l,d):rs(l,d);try{let y=yield m;delete c.abortController,c.state="completed",y.data instanceof HTMLImageElement||Yi(y.data)?p(y):y.data&&p({data:yield(_=y.data,typeof createImageBitmap=="function"?((v)=>it(void 0,void 0,void 0,function*(){if(v.byteLength===0)return createImageBitmap(new ImageData(1,1));let g=new Blob([new Uint8Array(v)],{type:"image/png"});try{return createImageBitmap(g)}catch(x){throw Error(`Could not load image because of ${me(x).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}))(_):((v)=>new Promise((g,x)=>{let b=new Image;b.onload=()=>{g(b),URL.revokeObjectURL(b.src),b.onload=null,window.requestAnimationFrame(()=>b.src=Pd)},b.onerror=()=>x(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 w=new Blob([new Uint8Array(v)],{type:"image/png"});b.src=v.byteLength?URL.createObjectURL(w):Pd}))(_)),cacheControl:y.cacheControl,expires:y.expires})}catch(y){delete c.abortController,h(me(y))}finally{i--,s()}var _}),s=()=>{let c=(()=>{for(let l of Object.keys(n))if(n[l]())return!0;return!1})()?ze.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ze.MAX_PARALLEL_IMAGE_REQUESTS;for(let l=i;l<c&&e.length>0;l++){let u=e.shift();u.abortController.signal.aborted?l--:o(u)}},a=(c,l)=>new Promise((u,h)=>{let p=new Image,{url:d,credentials:f}=c;f&&f==="include"?p.crossOrigin="use-credentials":(f&&f==="same-origin"||!Rd(d))&&(p.crossOrigin="anonymous"),l.signal.addEventListener("abort",()=>{p.src="",h(new Ln(l.signal.reason))}),p.fetchPriority="high",p.onload=()=>{p.onerror=p.onload=null,u({data:p})},p.onerror=()=>{p.onerror=p.onload=null,l.signal.aborted||h(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."))},p.src=d})})(ci||(ci={})),ci.resetRequestQueue();class kd{constructor(t){this._transformRequestFn=t!=null?t:null}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Ld(t,e,i){var r;((r=i[t])===null||r===void 0?void 0:r.includes(e))||(i[t]||(i[t]=[]),i[t].push(e))}function jl(t,e,i){if(i==null?void 0:i[t]){let r=i[t].indexOf(e);r!==-1&&i[t].splice(r,1)}}class R{constructor(t,e={}){G(this,e),this.type=t}}class J extends R{constructor(t,e={}){super("error",G({error:t},e))}}class Ht{on(t,e){return this._listeners||(this._listeners={}),Ld(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return jl(t,e,this._listeners),jl(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),Ld(t,e,this._oneTimeListeners),this):new Promise((i)=>this.once(t,i))}fire(t,e){var i,r;typeof t=="string"&&(t=new R(t,e||{}));let n=t.type;if(this.listens(n)){t.target=this;let o=((i=this._listeners)===null||i===void 0?void 0:i[n])?this._listeners[n].slice():[];for(let c of o)c.call(this,t);let s=((r=this._oneTimeListeners)===null||r===void 0?void 0:r[n])?this._oneTimeListeners[n].slice():[];for(let c of s)jl(n,c,this._oneTimeListeners),c.call(this,t);let a=this._eventedParent;a&&(G(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof J&&console.error(t.error);return this}listens(t){var e,i,r,n,o;return((i=(e=this._listeners)===null||e===void 0?void 0:e[t])===null||i===void 0?void 0:i.length)>0||((n=(r=this._oneTimeListeners)===null||r===void 0?void 0:r[t])===null||n===void 0?void 0:n.length)>0||((o=this._eventedParent)===null||o===void 0?void 0:o.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var D={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"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"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{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:"filter"},tolerance:{type:"number",default:0.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"}},source_video:{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"}}},source_image:{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"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{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:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"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:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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"}},"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:{"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},paint_circle:{"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"}},paint_heatmap:{"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)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.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"}},paint_symbol:{"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"}},paint_raster:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:0.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let x0=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function b0(t,e){let i={};for(let r in t)r!=="ref"&&(i[r]=t[r]);return x0.forEach((r)=>{r in e&&(i[r]=e[r])}),i}function Fd(t){t=t.slice();let e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=b0(t[i],e[t[i].ref]));return t}function bt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!bt(t[i],e[i]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object")return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!bt(t[i],e[i]))return!1;return!0}return t===e}function je(t,e){t.push(e)}function Bd(t,e,i){je(i,{command:"addSource",args:[t,e[t]]})}function Od(t,e,i){je(e,{command:"removeSource",args:[t]}),i[t]=!0}function w0(t,e,i,r){Od(t,i,r),Bd(t,e,i)}function T0(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!bt(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!bt(t[i][r],e[i][r]))return!1;return!0}function os(t,e,i,r,n,o){t=t||{},e=e||{};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(bt(t[s],e[s])||i.push({command:o,args:[r,s,e[s],n]}));for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(bt(t[s],e[s])||i.push({command:o,args:[r,s,e[s],n]}))}function jd(t){return t.id}function Nd(t,e){return t[e.id]=e,t}class j{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),e!=null&&e.__line__&&(this.line=e.__line__)}}function Rr(t,...e){for(let i of e)for(let r in i)t[r]=i[r];return t}class Ke extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Nl{constructor(t,e=[]){this.parent=t,this.bindings={};for(let[i,r]of e)this.bindings[i]=r}concat(t){return new Nl(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let Fn={kind:"null"},V={kind:"number"},ot={kind:"string"},ct={kind:"boolean"},Je={kind:"color"},ss={kind:"projectionDefinition"},Ki={kind:"object"},at={kind:"value"},as={kind:"collator"},Bn={kind:"formatted"},ls={kind:"padding"},On={kind:"colorArray"},cs={kind:"numberArray"},jn={kind:"resolvedImage"},hs={kind:"variableAnchorOffsetCollection"};function ye(t,e){return{kind:"array",itemType:t,N:e}}function kt(t){if(t.kind==="array"){let e=kt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}let S0=[Fn,V,ot,ct,Je,ss,Bn,Ki,ye(at),ls,cs,On,jn,hs];function Nn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Nn(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 i of S0)if(!Nn(i,e))return null}}return`Expected ${kt(t)} but found ${kt(e)} instead.`}function Vl(t,e){return e.some((i)=>i.kind===t.kind)}function Ji(t,e){return e.some((i)=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}function Ri(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}let Vd=0.96422,Ud=0.82521,$d=0.13793103448275862,kr=0.20689655172413793,Zd=3*kr*kr,P0=kr*kr*kr,I0=Math.PI/180,E0=180/Math.PI;function Gd(t){return(t%=360)<0&&(t+=360),t}function qd([t,e,i,r]){let n,o,s=$l((0.2225045*(t=Ul(t))+0.7168786*(e=Ul(e))+0.0606169*(i=Ul(i)))/1);t===e&&e===i?n=o=s:(n=$l((0.4360747*t+0.3850649*e+0.1430804*i)/Vd),o=$l((0.0139322*t+0.0971045*e+0.7141733*i)/Ud));let a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function Ul(t){return t<=0.04045?t/12.92:Math.pow((t+0.055)/1.055,2.4)}function $l(t){return t>P0?Math.pow(t,0.3333333333333333):t/Zd+$d}function Wd([t,e,i,r]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,s=isNaN(i)?n:n-i/200;return n=1*Gl(n),o=Vd*Gl(o),s=Ud*Gl(s),[Zl(3.1338561*o-1.6168667*n-0.4906146*s),Zl(-0.9787684*o+1.9161415*n+0.033454*s),Zl(0.0719453*o-0.2289914*n+1.4052427*s),r]}function Zl(t){return(t=t<=0.00304?12.92*t:1.055*Math.pow(t,0.4166666666666667)-0.055)<0?0:t>1?1:t}function Gl(t){return t>kr?t*t*t:Zd*(t-$d)}let M0=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Vn(t,e){return M0(t,e)?t[e]:void 0}function us(t){return parseInt(t.padEnd(2,t),16)/255}function Hd(t,e){return Lr(e?t/100:t,0,1)}function Lr(t,e,i){return Math.min(Math.max(e,t),i)}function Xd(t){return!t.some(Number.isNaN)}let C0={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]};function ki(t,e,i){return t+i*(e-t)}function Fr(t,e,i){return t.map((r,n)=>ki(r,e[n],i))}class Y{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof Y)return t;if(typeof t!="string")return;let e=function(i){if((i=i.toLowerCase().trim())==="transparent")return[0,0,0,0];let r=Vn(C0,i);if(r){let[o,s,a]=r;return[o/255,s/255,a/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){let o=i.length<6?1:2,s=1;return[us(i.slice(s,s+=o)),us(i.slice(s,s+=o)),us(i.slice(s,s+=o)),us(i.slice(s,s+o)||"ff")]}if(i.startsWith("rgb")){let o=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(o){let[s,a,c,l,u,h,p,d,f,m,_,y]=o,v=[l||" ",p||" ",m].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let g=[c,h,f].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let b=[Lr(+a/x,0,1),Lr(+u/x,0,1),Lr(+d/x,0,1),_?Hd(+_,y):1];if(Xd(b))return b}}return}}let n=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[o,s,a,c,l,u,h,p,d]=n,f=[a||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let m=[+s,Lr(+c,0,100),Lr(+u,0,100),p?Hd(+p,d):1];if(Xd(m))return function([_,y,v,g]){function x(b){let w=(b+_/30)%12,T=y*Math.min(v,1-v);return v-T*Math.max(-1,Math.min(w-3,9-w,1))}return _=Gd(_),y/=100,v/=100,[x(0),x(8),x(4),g]}(m)}}}(t);return e?new Y(...e,!1):void 0}get rgb(){let{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){let[e,i,r,n]=qd(t),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?Gd(Math.atan2(r,i)*E0):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",qd(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){let[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((n)=>Math.round(255*n)).join(",")},${r})`}static interpolate(t,e,i,r="rgb"){switch(r){case"rgb":{let[n,o,s,a]=Fr(t.rgb,e.rgb,i);return new Y(n,o,s,a,!1)}case"hcl":{let[n,o,s,a]=t.hcl,[c,l,u,h]=e.hcl,p,d;if(isNaN(n)||isNaN(c))isNaN(n)?isNaN(c)?p=NaN:(p=c,s!==1&&s!==0||(d=l)):(p=n,u!==1&&u!==0||(d=o));else{let v=c-n;c>n&&v>180?v-=360:c<n&&n-c>180&&(v+=360),p=n+i*v}let[f,m,_,y]=function([v,g,x,b]){return v=isNaN(v)?0:v*I0,Wd([x,Math.cos(v)*g,Math.sin(v)*g,b])}([p,d!=null?d:ki(o,l,i),ki(s,u,i),ki(a,h,i)]);return new Y(f,m,_,y,!1)}case"lab":{let[n,o,s,a]=Wd(Fr(t.lab,e.lab,i));return new Y(n,o,s,a,!1)}}}}Y.black=new Y(0,0,0,1),Y.white=new Y(1,1,1,1),Y.transparent=new Y(0,0,0,0),Y.red=new Y(1,0,0,1);class ds{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let A0=["bottom","center","top"];class ps{constructor(t,e,i,r,n,o){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class De{constructor(t){this.sections=t}static fromString(t){return new De([new ps(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t)=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof De?t:De.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t)=>t.text).join("")}}class ve{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ve)return t;if(typeof t=="number")return new ve([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let e of t)if(typeof e!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ve(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ve(Fr(t.values,e.values,i))}}class xe{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof xe)return t;if(typeof t=="number")return new xe([t]);if(Array.isArray(t)){for(let e of t)if(typeof e!="number")return;return new xe(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new xe(Fr(t.values,e.values,i))}}class se{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof se)return t;if(typeof t=="string"){let i=Y.parse(t);if(!i)return;return new se([i])}if(!Array.isArray(t))return;let e=[];for(let i of t){if(typeof i!="string")return;let r=Y.parse(i);if(!r)return;e.push(r)}return new se(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,r="rgb"){let n=[];if(t.values.length!=e.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)n.push(Y.interpolate(t.values[o],e.values[o],i,r));return new se(n)}}class Lt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}let z0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ne{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ne)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){let i=t[e],r=t[e+1];if(typeof i!="string"||!z0.has(i))return;if(!Array.isArray(r)||r.length!==2||typeof r[0]!="number"||typeof r[1]!="number")return}return new Ne(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){let r=t.values,n=e.values;if(r.length!==n.length)throw new Lt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);let o=[];for(let s=0;s<r.length;s+=2){if(r[s]!==n[s])throw new Lt(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${r[s]}, to[${s}]: ${n[s]}`);o.push(r[s]);let[a,c]=r[s+1],[l,u]=n[s+1];o.push([ki(a,l,i),ki(c,u,i)])}return new Ne(o)}}class Ve{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ve({name:t,available:!1}):null}}class Re{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new Re(t,e,i)}static parse(t){return t instanceof Re?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Re(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Re(t.from,t.to,t.transition):typeof t=="string"?new Re(t,t,1):void 0}}function Yd(t,e,i,r){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Un(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Re||t instanceof Y||t instanceof ds||t instanceof De||t instanceof ve||t instanceof xe||t instanceof se||t instanceof Ne||t instanceof Ve)return!0;if(Array.isArray(t)){for(let e of t)if(!Un(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!Un(t[e]))return!1;return!0}return!1}function qt(t){if(t===null)return Fn;if(typeof t=="string")return ot;if(typeof t=="boolean")return ct;if(typeof t=="number")return V;if(t instanceof Y)return Je;if(t instanceof Re)return ss;if(t instanceof ds)return as;if(t instanceof De)return Bn;if(t instanceof ve)return ls;if(t instanceof xe)return cs;if(t instanceof se)return On;if(t instanceof Ne)return hs;if(t instanceof Ve)return jn;if(Array.isArray(t)){let e=t.length,i;for(let r of t){let n=qt(r);if(i){if(i===n)continue;i=at;break}i=n}return ye(i||at,e)}return Ki}function $n(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Y||t instanceof Re||t instanceof De||t instanceof ve||t instanceof xe||t instanceof se||t instanceof Ne||t instanceof Ve?t.toString():JSON.stringify(t)}class Qi{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(t.length!==2)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Un(t[1]))return e.error("invalid value");let i=t[1],r=qt(i),n=e.expectedType;return r.kind!=="array"||r.N!==0||!n||n.kind!=="array"||typeof n.N=="number"&&n.N!==0||(r=n),new Qi(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let fs={string:ot,number:V,boolean:ct,object:Ki};class Qe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1,n=t[0];if(n==="array"){let s,a;if(t.length>2){let c=t[1];if(typeof c!="string"||!(c in fs)||c==="object")return e.error('The item type argument of "array" must be one of string, number, boolean',1);s=fs[c],r++}else s=at;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}i=ye(s,a)}else{if(!fs[n])throw Error(`Types doesn't contain name = ${n}`);i=fs[n]}let o=[];for(;r<t.length;r++){let s=e.parse(t[r],r,at);if(!s)return null;o.push(s)}return new Qe(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){let i=this.args[e].evaluate(t);if(!Nn(this.type,qt(i)))return i;if(e===this.args.length-1)throw new Lt(`Expected value to be of type ${kt(this.type)}, but found ${kt(qt(i))} instead.`)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}let Kd={"to-boolean":ct,"to-color":Je,"to-number":V,"to-string":ot};class Li{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=t[0];if(!Kd[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&t.length!==2)return e.error("Expected one argument.");let r=Kd[i],n=[];for(let o=1;o<t.length;o++){let s=e.parse(t[o],o,at);if(!s)return null;n.push(s)}return new Li(r,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(let r of this.args){if(e=r.evaluate(t),i=null,e instanceof Y)return e;if(typeof e=="string"){let n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Yd(e[0],e[1],e[2],e[3]),!i))return new Y(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Lt(i||`Could not parse color from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"padding":{let e;for(let i of this.args){e=i.evaluate(t);let r=ve.parse(e);if(r)return r}throw new Lt(`Could not parse padding from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=xe.parse(e);if(r)return r}throw new Lt(`Could not parse numberArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=se.parse(e);if(r)return r}throw new Lt(`Could not parse colorArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(let i of this.args){e=i.evaluate(t);let r=Ne.parse(e);if(r)return r}throw new Lt(`Could not parse variableAnchorOffsetCollection from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(let i of this.args){if(e=i.evaluate(t),e===null)return 0;let r=Number(e);if(!isNaN(r))return r}throw new Lt(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return De.fromString($n(this.args[0].evaluate(t)));case"resolvedImage":return Ve.fromString($n(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return $n(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}let D0=["Unknown","Point","LineString","Polygon"];class ql{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?D0[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(t){let e=this._parseColorCache.get(t);return e||(e=Y.parse(t),this._parseColorCache.set(t,e)),e}}class ms{constructor(t,e,i=[],r,n=new Nl,o=[]){this.registry=t,this.path=i,this.key=i.map((s)=>`[${s}]`).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(r,n,o){return o==="assert"?new Qe(n,[r]):o==="coerce"?new Li(n,[r]):r}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=t[0];if(typeof r!="string")return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[r];if(n){let o=n.parse(t,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,a=o.type;if(s.kind!=="string"&&s.kind!=="number"&&s.kind!=="boolean"&&s.kind!=="object"&&s.kind!=="array"||a.kind!=="value"){if(s.kind==="projectionDefinition"&&["string","array"].includes(a.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(a.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(a.kind)||s.kind==="colorArray"&&["value","string","array"].includes(a.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(a.kind))o=i(o,s,e.typeAnnotation||"coerce");else if(this.checkSubtype(s,a))return null}else o=i(o,s,e.typeAnnotation||"assert")}if(!(o instanceof Qi)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new ql;try{o=new Qi(o.type,o.evaluate(s))}catch(a){return this.error(a.message),null}}return o}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){let r=typeof t=="number"?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new ms(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){let i=`${this.key}${e.map((r)=>`[${r}]`).join("")}`;this.errors.push(new Ke(i,t))}checkSubtype(t,e){let i=Nn(t,e);return i&&this.error(i),i}}class _s{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let n=1;n<t.length-1;n+=2){let o=t[n];if(typeof o!="string")return e.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);let s=e.parse(t[n+1],n+1);if(!s)return null;i.push([o,s])}let r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new _s(i,r):null}outputDefined(){return this.result.outputDefined()}}class gs{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(t.length!==2||typeof t[1]!="string")return e.error("'var' expression requires exactly one string literal argument.");let i=t[1];return e.scope.has(i)?new gs(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Wl{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,V),r=e.parse(t[2],2,ye(e.expectedType||at));return i&&r?new Wl(r.type.itemType,i,r):null}evaluate(t){let e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Lt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Lt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Lt(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Hl{constructor(t,e){this.type=ct,this.needle=t,this.haystack=e}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,at);return i&&r?Vl(i.type,[ct,ot,V,Fn,at])?new Hl(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(i.type)} instead`):null}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Ji(e,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${kt(qt(e))} instead.`);if(!Ji(i,["string","array"]))throw new Lt(`Expected second argument to be of type array or string, but found ${kt(qt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ys{constructor(t,e,i){this.type=V,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,at);if(!i||!r)return null;if(!Vl(i.type,[ct,ot,V,Fn,at]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(i.type)} instead`);if(t.length===4){let n=e.parse(t[3],3,V);return n?new ys(i,r,n):null}return new ys(i,r)}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Ji(e,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${kt(qt(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),Ji(i,["string"])){let n=i.indexOf(e,r);return n===-1?-1:[...i.slice(0,n)].length}if(Ji(i,["array"]))return i.indexOf(e,r);throw new Lt(`Expected second argument to be of type array or string, but found ${kt(qt(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Xl{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&e.expectedType.kind!=="value"&&(r=e.expectedType);let n={},o=[];for(let c=2;c<t.length-1;c+=2){let l=t[c],u=t[c+1];Array.isArray(l)||(l=[l]);let h=e.concat(c);if(l.length===0)return h.error("Expected at least one branch label.");for(let d of l){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 ${Number.MAX_SAFE_INTEGER}.`);if(typeof d=="number"&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,qt(d)))return null}else i=qt(d);if(n[String(d)]!==void 0)return h.error("Branch labels must be unique.");n[String(d)]=o.length}let p=e.parse(u,c,r);if(!p)return null;r=r||p.type,o.push(p)}let s=e.parse(t[1],1,at);if(!s)return null;let a=e.parse(t[t.length-1],t.length-1,r);return a?s.type.kind!=="value"&&e.concat(1).checkSubtype(i,s.type)?null:new Xl(i,r,s,n,o,a):null}evaluate(t){let e=this.input.evaluate(t);return(qt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())&&this.otherwise.outputDefined()}}class Yl{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&e.expectedType.kind!=="value"&&(i=e.expectedType);let r=[];for(let o=1;o<t.length-1;o+=2){let s=e.parse(t[o],o,ct);if(!s)return null;let a=e.parse(t[o+1],o+1,i);if(!a)return null;r.push([s,a]),i=i||a.type}let n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw Error("Can't infer output type");return new Yl(i,r,n)}evaluate(t){for(let[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class vs{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,V);if(!i||!r)return null;if(!Vl(i.type,[ye(at),ot,at]))return e.error(`Expected first argument to be of type array or string, but found ${kt(i.type)} instead`);if(t.length===4){let n=e.parse(t[3],3,V);return n?new vs(i.type,i,r,n):null}return new vs(i.type,i,r)}evaluate(t){let e=this.input.evaluate(t),i=this.beginIndex.evaluate(t),r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),Ji(e,["string"]))return[...e].slice(i,r).join("");if(Ji(e,["array"]))return e.slice(i,r);throw new Lt(`Expected first argument to be of type array or string, but found ${kt(qt(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function xs(t,e){let i=t.length-1,r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=t[a],n=t[a+1],r<=e){if(a===i||e<n)return a;o=a+1}else{if(!(r>e))throw new Lt("Input is not a number.");s=a-1}return 0}class Zn{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(let[r,n]of i)this.labels.push(r),this.outputs.push(n)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");let i=e.parse(t[1],1,V);if(!i)return null;let r=[],n=null;e.expectedType&&e.expectedType.kind!=="value"&&(n=e.expectedType);for(let o=1;o<t.length;o+=2){let s=o===1?-1/0:t[o],a=t[o+1],c=o,l=o+1;if(typeof s!="number")return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(r.length&&r[r.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);let u=e.parse(a,l,n);if(!u)return null;n=n||u.type,r.push([s,u])}return new Zn(n,i,r)}evaluate(t){let e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[xs(e,r)].evaluate(t)}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}}function R0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kl,Jd,k0=function(){if(Jd)return Kl;function t(e,i,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=n}return Jd=1,Kl=t,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,i){if(i===void 0&&(i=0.000001),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<i)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<0.000001)break;r-=o/s}var a=0,c=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<i));n++)e>o?a=r:c=r,r=0.5*(c-a)+a;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Kl}(),L0=R0(k0);class we{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(let[o,s]of n)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,e,i,r){let n=0;if(t.name==="exponential")n=Jl(e,t.base,i,r);else if(t.name==="linear")n=Jl(e,1,i,r);else if(t.name==="cubic-bezier"){let o=t.controlPoints;n=new L0(o[0],o[1],o[2],o[3]).solve(Jl(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||r.length===0)return e.error("Expected an interpolation type expression.",1);if(r[0]==="linear")r={name:"linear"};else if(r[0]==="exponential"){let c=r[1];if(typeof c!="number")return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:c}}else{if(r[0]!=="cubic-bezier")return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let c=r.slice(1);if(c.length!==4||c.some((l)=>typeof l!="number"||l<0||l>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:c}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,V),!n)return null;let s=[],a=null;i!=="interpolate-hcl"&&i!=="interpolate-lab"||e.expectedType==On?e.expectedType&&e.expectedType.kind!=="value"&&(a=e.expectedType):a=Je;for(let c=0;c<o.length;c+=2){let l=o[c],u=o[c+1],h=c+3,p=c+4;if(typeof l!="number")return e.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]>=l)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);let d=e.parse(u,p,a);if(!d)return null;a=a||d.type,s.push([l,d])}return Ri(a,V)||Ri(a,ss)||Ri(a,Je)||Ri(a,ls)||Ri(a,cs)||Ri(a,On)||Ri(a,hs)||Ri(a,ye(V))?new we(a,i,r,n,s):e.error(`Type ${kt(a)} is not interpolatable.`)}evaluate(t){let e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);let o=xs(e,r),s=we.interpolationFactor(this.interpolation,r,e[o],e[o+1]),a=i[o].evaluate(t),c=i[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ki(a,c,s);case"color":return Y.interpolate(a,c,s);case"padding":return ve.interpolate(a,c,s);case"colorArray":return se.interpolate(a,c,s);case"numberArray":return xe.interpolate(a,c,s);case"variableAnchorOffsetCollection":return Ne.interpolate(a,c,s);case"array":return Fr(a,c,s);case"projectionDefinition":return Re.interpolate(a,c,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return Y.interpolate(a,c,s,"hcl");case"colorArray":return se.interpolate(a,c,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Y.interpolate(a,c,s,"lab");case"colorArray":return se.interpolate(a,c,s,"lab")}}}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}}function Jl(t,e,i,r){let n=r-i,o=t-i;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}let Ft={color:Y.interpolate,number:ki,padding:ve.interpolate,numberArray:xe.interpolate,colorArray:se.interpolate,variableAnchorOffsetCollection:Ne.interpolate,array:Fr};class bs{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null,r=e.expectedType;r&&r.kind!=="value"&&(i=r);let n=[];for(let s of t.slice(1)){let a=e.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!a)return null;i=i||a.type,n.push(a)}if(!i)throw Error("No output type");let o=r&&n.some((s)=>Nn(r,s.type));return new bs(o?at:i,n)}evaluate(t){let e,i=null,r=0;for(let n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ve&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}function Qd(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 tp(t,e,i,r){return r.compare(e,i)===0}function Br(t,e,i){let r=t!=="=="&&t!=="!=";return class n{constructor(o,s,a){this.type=ct,this.lhs=o,this.rhs=s,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||s.type.kind==="value"}static parse(o,s){if(o.length!==3&&o.length!==4)return s.error("Expected two or three arguments.");let a=o[0],c=s.parse(o[1],1,at);if(!c)return null;if(!Qd(a,c.type))return s.concat(1).error(`"${a}" comparisons are not supported for type '${kt(c.type)}'.`);let l=s.parse(o[2],2,at);if(!l)return null;if(!Qd(a,l.type))return s.concat(2).error(`"${a}" comparisons are not supported for type '${kt(l.type)}'.`);if(c.type.kind!==l.type.kind&&c.type.kind!=="value"&&l.type.kind!=="value")return s.error(`Cannot compare types '${kt(c.type)}' and '${kt(l.type)}'.`);r&&(c.type.kind==="value"&&l.type.kind!=="value"?c=new Qe(l.type,[c]):c.type.kind!=="value"&&l.type.kind==="value"&&(l=new Qe(c.type,[l])));let u=null;if(o.length===4){if(c.type.kind!=="string"&&l.type.kind!=="string"&&c.type.kind!=="value"&&l.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(u=s.parse(o[3],3,as),!u)return null}return new n(c,l,u)}evaluate(o){let s=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(r&&this.hasUntypedArgument){let c=qt(s),l=qt(a);if(c.kind!==l.kind||c.kind!=="string"&&c.kind!=="number")throw new Lt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${c.kind}, ${l.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let c=qt(s),l=qt(a);if(c.kind!=="string"||l.kind!=="string")return e(o,s,a)}return this.collator?i(o,s,a,this.collator.evaluate(o)):e(o,s,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}let F0=Br("==",function(t,e,i){return e===i},tp),B0=Br("!=",function(t,e,i){return e!==i},function(t,e,i,r){return!tp(0,e,i,r)}),O0=Br("<",function(t,e,i){return e<i},function(t,e,i,r){return r.compare(e,i)<0}),j0=Br(">",function(t,e,i){return e>i},function(t,e,i,r){return r.compare(e,i)>0}),N0=Br("<=",function(t,e,i){return e<=i},function(t,e,i,r){return r.compare(e,i)<=0}),V0=Br(">=",function(t,e,i){return e>=i},function(t,e,i,r){return r.compare(e,i)>=0});class ws{constructor(t,e,i){this.type=as,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(t.length!==2)return e.error("Expected one argument.");let i=t[1];if(typeof i!="object"||Array.isArray(i))return e.error("Collator options argument must be an object.");let r=e.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,ct);if(!r)return null;let n=e.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,ct);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,ot),!o)?null:new ws(r,n,o)}evaluate(t){return new ds(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ql{constructor(t,e,i,r,n,o){this.type=ot,this.number=t,this.locale=e,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(t,e){if(t.length!==3)return e.error("Expected two arguments.");let i=e.parse(t[1],1,V);if(!i)return null;let r=t[2];if(typeof r!="object"||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,ot),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,ot),!o))return null;let s=null;if(r.unit&&(s=e.parse(r.unit,1,ot),!s))return null;if(o&&s)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,V),!a))return null;let c=null;return r["max-fraction-digits"]&&(c=e.parse(r["max-fraction-digits"],1,V),!c)?null:new Ql(i,n,o,s,a,c)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ts{constructor(t){this.type=Bn,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&typeof i=="object")return e.error("First argument must be an image or text section.");let r=[],n=!1;for(let o=1;o<=t.length-1;++o){let s=t[o];if(n&&typeof s=="object"&&!Array.isArray(s)){n=!1;let a=null;if(s["font-scale"]&&(a=e.parse(s["font-scale"],1,V),!a))return null;let c=null;if(s["text-font"]&&(c=e.parse(s["text-font"],1,ye(ot)),!c))return null;let l=null;if(s["text-color"]&&(l=e.parse(s["text-color"],1,Je),!l))return null;let u=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!A0.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(u=e.parse(s["vertical-align"],1,ot),!u)return null}let h=r[r.length-1];h.scale=a,h.font=c,h.textColor=l,h.verticalAlign=u}else{let a=e.parse(t[o],1,at);if(!a)return null;let c=a.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ts(r)}evaluate(t){return new De(this.sections.map((e)=>{let i=e.content.evaluate(t);return qt(i)===jn?new ps("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new ps($n(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class tc{constructor(t){this.type=jn,this.input=t}static parse(t,e){if(t.length!==2)return e.error("Expected two arguments.");let i=e.parse(t[1],1,ot);return i?new tc(i):e.error("No image name provided.")}evaluate(t){let e=this.input.evaluate(t),i=Ve.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class ec{constructor(t){this.type=V,this.input=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=e.parse(t[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?e.error(`Expected argument of type string or array, but found ${kt(i.type)} instead.`):new ec(i):null}evaluate(t){let e=this.input.evaluate(t);if(typeof e=="string")return[...e].length;if(Array.isArray(e))return e.length;throw new Lt(`Expected value to be of type string or array, but found ${kt(qt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let hi=8192;function U0(t,e){let i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*hi),Math.round(r*n*hi)]}function ic(t,e){let i=Math.pow(2,e.z);return[(n=(t[0]/hi+e.x)/i,360*n-180),(r=(t[1]/hi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Gn(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 qn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function $0(t,e,i){let r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Ss(t,e,i,r){return(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]!=0&&!(!ip(t,e,i,r)||!ip(i,r,t,e));var n,o}function Z0(t,e,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(Ss(t,e,r[n],r[n+1]))return!0;return!1}function Or(t,e,i=!1){let r=!1;for(let a of e)for(let c=0;c<a.length-1;c++){if($0(t,a[c],a[c+1]))return i;(o=a[c])[1]>(n=t)[1]!=(s=a[c+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}var n,o,s;return r}function G0(t,e){for(let i of e)if(Or(t,i))return!0;return!1}function ep(t,e){for(let i of t)if(!Or(i,e))return!1;for(let i=0;i<t.length-1;++i)if(Z0(t[i],t[i+1],e))return!1;return!0}function q0(t,e){for(let i of e)if(ep(t,i))return!0;return!1}function ip(t,e,i,r){let n=r[0]-i[0],o=r[1]-i[1],s=(t[0]-i[0])*o-n*(t[1]-i[1]),a=(e[0]-i[0])*o-n*(e[1]-i[1]);return s>0&&a<0||s<0&&a>0}function rc(t,e,i){let r=[];for(let n=0;n<t.length;n++){let o=[];for(let s=0;s<t[n].length;s++){let a=U0(t[n][s],i);Gn(e,a),o.push(a)}r.push(o)}return r}function rp(t,e,i){let r=[];for(let n=0;n<t.length;n++){let o=rc(t[n],e,i);r.push(o)}return r}function np(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){let n=0.5*r,o=t[0]-i[0]>n?-r:i[0]-t[0]>n?r:0;o===0&&(o=t[0]-i[2]>n?-r:i[2]-t[0]>n?r:0),t[0]+=o}Gn(e,t)}function op(t,e,i,r){let n=Math.pow(2,r.z)*hi,o=[r.x*hi,r.y*hi],s=[];for(let a of t)for(let c of a){let l=[c.x+o[0],c.y+o[1]];np(l,e,i,n),s.push(l)}return s}function sp(t,e,i,r){let n=Math.pow(2,r.z)*hi,o=[r.x*hi,r.y*hi],s=[];for(let c of t){let l=[];for(let u of c){let h=[u.x+o[0],u.y+o[1]];Gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(let c of s)for(let l of c)np(l,e,i,n)}var a;return s}class tr{constructor(t,e){this.type=ct,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Un(t[1])){let i=t[1];if(i.type==="FeatureCollection"){let r=[];for(let n of i.features){let{type:o,coordinates:s}=n.geometry;o==="Polygon"&&r.push(s),o==="MultiPolygon"&&r.push(...s)}if(r.length)return new tr(i,{type:"MultiPolygon",coordinates:r})}else if(i.type==="Feature"){let r=i.geometry.type;if(r==="Polygon"||r==="MultiPolygon")return new tr(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new tr(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,i){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if(i.type==="Polygon"){let s=rc(i.coordinates,n,o),a=op(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!Or(c,s))return!1}if(i.type==="MultiPolygon"){let s=rp(i.coordinates,n,o),a=op(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!G0(c,s))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,i){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if(i.type==="Polygon"){let s=rc(i.coordinates,n,o),a=sp(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!ep(c,s))return!1}if(i.type==="MultiPolygon"){let s=rp(i.coordinates,n,o),a=sp(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!q0(c,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class nc{constructor(t=[],e=(i,r)=>i<r?-1:i>r?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,r=e[t];for(;t>0;){let n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){let{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let o=1+(t<<1),s=o+1;if(s<this.length&&i(e[s],e[o])<0&&(o=s),i(e[o],n)>=0)break;e[t]=e[o],t=o}e[t]=n}}function ap(t,e,i=0,r=t.length-1,n=W0){for(;r>i;){if(r-i>600){let c=r-i+1,l=e-i+1,u=Math.log(c),h=0.5*Math.exp(2*u/3),p=0.5*Math.sqrt(u*h*(c-h)/c)*(l-c/2<0?-1:1);ap(t,e,Math.max(i,Math.floor(e-l*h/c+p)),Math.min(r,Math.floor(e+(c-l)*h/c+p)),n)}let o=t[e],s=i,a=r;for(Wn(t,i,e),n(t[r],o)>0&&Wn(t,i,r);s<a;){for(Wn(t,s,a),s++,a--;n(t[s],o)<0;)s++;for(;n(t[a],o)>0;)a--}n(t[i],o)===0?Wn(t,i,a):(a++,Wn(t,a,r)),a<=e&&(i=a+1),e<=a&&(r=a-1)}}function Wn(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function W0(t,e){return t<e?-1:t>e?1:0}function oc(t,e){if(t.length<=1)return[t];let i=[],r,n;for(let o of t){let s=X0(o);s!==0&&(o.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(r&&i.push(r),r=[o]):r.push(o))}if(r&&i.push(r),e>1)for(let o=0;o<i.length;o++)i[o].length<=e||(ap(i[o],e,1,i[o].length-1,H0),i[o]=i[o].slice(0,e));return i}function H0(t,e){return e.area-t.area}function X0(t){let e=0;for(let i,r,n=0,o=t.length,s=o-1;n<o;s=n++)i=t[n],r=t[s],e+=(r.x-i.x)*(i.y+r.y);return e}let lp=0.0033528106647474805,cp=lp*(2-lp),hp=Math.PI/180;class Ps{constructor(t){let e=6378.137*hp*1000,i=Math.cos(t*hp),r=1/(1-cp*(1-i*i)),n=Math.sqrt(r);this.kx=e*n*i,this.ky=e*n*r*(1-cp)}distance(t,e){let i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,n,o,s=1/0;for(let a=0;a<t.length-1;a++){let c=t[a][0],l=t[a][1],u=this.wrap(t[a+1][0]-c)*this.kx,h=(t[a+1][1]-l)*this.ky,p=0;u===0&&h===0||(p=(this.wrap(e[0]-c)*this.kx*u+(e[1]-l)*this.ky*h)/(u*u+h*h),p>1?(c=t[a+1][0],l=t[a+1][1]):p>0&&(c+=u/this.kx*p,l+=h/this.ky*p)),u=this.wrap(e[0]-c)*this.kx,h=(e[1]-l)*this.ky;let d=u*u+h*h;d<s&&(s=d,i=c,r=l,n=a,o=p)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function up(t,e){return e[0]-t[0]}function Is(t){return t[1]-t[0]+1}function wi(t,e){return t[1]>=t[0]&&t[1]<e}function sc(t,e){if(t[0]>t[1])return[null,null];let i=Is(t);if(e){if(i===2)return[t,null];let n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(i===1)return[t,null];let r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function ac(t,e){if(!wi(e,t.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Gn(i,t[r]);return i}function lc(t){let e=[1/0,1/0,-1/0,-1/0];for(let i of t)for(let r of i)Gn(e,r);return e}function dp(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function cc(t,e,i){if(!dp(t)||!dp(e))return NaN;let r=0,n=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),i.distance([0,0],[r,n])}function er(t,e,i){let r=i.pointOnLine(e,t);return i.distance(t,r.point)}function hc(t,e,i,r,n){let o=Math.min(er(t,[i,r],n),er(e,[i,r],n)),s=Math.min(er(i,[t,e],n),er(r,[t,e],n));return Math.min(o,s)}function Y0(t,e,i,r,n){if(!wi(e,t.length)||!wi(r,i.length))return 1/0;let o=1/0;for(let s=e[0];s<e[1];++s){let a=t[s],c=t[s+1];for(let l=r[0];l<r[1];++l){let u=i[l],h=i[l+1];if(Ss(a,c,u,h))return 0;o=Math.min(o,hc(a,c,u,h,n))}}return o}function K0(t,e,i,r,n){if(!wi(e,t.length)||!wi(r,i.length))return NaN;let o=1/0;for(let s=e[0];s<=e[1];++s)for(let a=r[0];a<=r[1];++a)if(o=Math.min(o,n.distance(t[s],i[a])),o===0)return o;return o}function J0(t,e,i){if(Or(t,e,!0))return 0;let r=1/0;for(let n of e){let o=n[0],s=n[n.length-1];if(o!==s&&(r=Math.min(r,er(t,[s,o],i)),r===0))return r;let a=i.pointOnLine(n,t);if(r=Math.min(r,i.distance(t,a.point)),r===0)return r}return r}function Q0(t,e,i,r){if(!wi(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Or(t[o],i,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){let s=t[o],a=t[o+1];for(let c of i)for(let l=0,u=c.length,h=u-1;l<u;h=l++){let p=c[h],d=c[l];if(Ss(s,a,p,d))return 0;n=Math.min(n,hc(s,a,p,d,r))}}return n}function pp(t,e){for(let i of t)for(let r of i)if(Or(r,e,!0))return!0;return!1}function tv(t,e,i,r=1/0){let n=lc(t),o=lc(e);if(r!==1/0&&cc(n,o,i)>=r)return r;if(qn(n,o)){if(pp(t,e))return 0}else if(pp(e,t))return 0;let s=1/0;for(let a of t)for(let c=0,l=a.length,u=l-1;c<l;u=c++){let h=a[u],p=a[c];for(let d of e)for(let f=0,m=d.length,_=m-1;f<m;_=f++){let y=d[_],v=d[f];if(Ss(h,p,y,v))return 0;s=Math.min(s,hc(h,p,y,v,i))}}return s}function fp(t,e,i,r,n,o){if(!o)return;let s=cc(ac(r,o),n,i);s<e&&t.push([s,o,[0,0]])}function Es(t,e,i,r,n,o,s){if(!o||!s)return;let a=cc(ac(r,o),ac(n,s),i);a<e&&t.push([a,o,s])}function Ms(t,e,i,r,n=1/0){let o=Math.min(r.distance(t[0],i[0][0]),n);if(o===0)return o;let s=new nc([[0,[0,t.length-1],[0,0]]],up),a=lc(i);for(;s.length>0;){let c=s.pop();if(c[0]>=o)continue;let l=c[1],u=e?50:100;if(Is(l)<=u){if(!wi(l,t.length))return NaN;if(e){let h=Q0(t,l,i,r);if(isNaN(h)||h===0)return h;o=Math.min(o,h)}else for(let h=l[0];h<=l[1];++h){let p=J0(t[h],i,r);if(o=Math.min(o,p),o===0)return 0}}else{let h=sc(l,e);fp(s,o,r,t,a,h[0]),fp(s,o,r,t,a,h[1])}}return o}function Cs(t,e,i,r,n,o=1/0){let s=Math.min(o,n.distance(t[0],i[0]));if(s===0)return s;let a=new nc([[0,[0,t.length-1],[0,i.length-1]]],up);for(;a.length>0;){let c=a.pop();if(c[0]>=s)continue;let l=c[1],u=c[2],h=e?50:100,p=r?50:100;if(Is(l)<=h&&Is(u)<=p){if(!wi(l,t.length)&&wi(u,i.length))return NaN;let d;if(e&&r)d=Y0(t,l,i,u,n),s=Math.min(s,d);else if(e&&!r){let f=t.slice(l[0],l[1]+1);for(let m=u[0];m<=u[1];++m)if(d=er(i[m],f,n),s=Math.min(s,d),s===0)return s}else if(!e&&r){let f=i.slice(u[0],u[1]+1);for(let m=l[0];m<=l[1];++m)if(d=er(t[m],f,n),s=Math.min(s,d),s===0)return s}else d=K0(t,l,i,u,n),s=Math.min(s,d)}else{let d=sc(l,e),f=sc(u,r);Es(a,s,n,t,i,d[0],f[0]),Es(a,s,n,t,i,d[0],f[1]),Es(a,s,n,t,i,d[1],f[0]),Es(a,s,n,t,i,d[1],f[1])}}return s}function uc(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]}class ir{constructor(t,e){this.type=V,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Un(t[1])){let i=t[1];if(i.type==="FeatureCollection")return new ir(i,i.features.map((r)=>uc(r.geometry)).flat());if(i.type==="Feature")return new ir(i,uc(i.geometry));if("type"in i&&"coordinates"in i)return new ir(i,uc(i))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,i){let r=e.geometry(),n=r.flat().map((a)=>ic([a.x,a.y],e.canonical));if(r.length===0)return NaN;let o=new Ps(n[0][1]),s=1/0;for(let a of i){switch(a.type){case"Point":s=Math.min(s,Cs(n,!1,[a.coordinates],!1,o,s));break;case"LineString":s=Math.min(s,Cs(n,!1,a.coordinates,!0,o,s));break;case"Polygon":s=Math.min(s,Ms(n,!1,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,i){let r=e.geometry(),n=r.flat().map((a)=>ic([a.x,a.y],e.canonical));if(r.length===0)return NaN;let o=new Ps(n[0][1]),s=1/0;for(let a of i){switch(a.type){case"Point":s=Math.min(s,Cs(n,!0,[a.coordinates],!1,o,s));break;case"LineString":s=Math.min(s,Cs(n,!0,a.coordinates,!0,o,s));break;case"Polygon":s=Math.min(s,Ms(n,!0,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries);if(t.geometryType()==="Polygon")return function(e,i){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let n=oc(r,0).map((a)=>a.map((c)=>c.map((l)=>ic([l.x,l.y],e.canonical)))),o=new Ps(n[0][0][0][1]),s=1/0;for(let a of i)for(let c of n){switch(a.type){case"Point":s=Math.min(s,Ms([a.coordinates],!1,c,o,s));break;case"LineString":s=Math.min(s,Ms(a.coordinates,!0,c,o,s));break;case"Polygon":s=Math.min(s,tv(c,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Hn{constructor(t){this.type=at,this.key=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return i==null?e.error("Global state property must be defined."):typeof i!="string"?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Hn(i)}evaluate(t){var e;let i=(e=t.globals)===null||e===void 0?void 0:e.globalState;return i&&Object.keys(i).length!==0?Vn(i,this.key):null}eachChild(){}outputDefined(){return!1}}let jr={"==":F0,"!=":B0,">":j0,"<":O0,">=":V0,"<=":N0,array:Qe,at:Wl,boolean:Qe,case:Yl,coalesce:bs,collator:ws,format:Ts,image:tc,in:Hl,"index-of":ys,interpolate:we,"interpolate-hcl":we,"interpolate-lab":we,length:ec,let:_s,literal:Qi,match:Xl,number:Qe,"number-format":Ql,object:Qe,slice:vs,step:Zn,string:Qe,"to-boolean":Li,"to-color":Li,"to-number":Li,"to-string":Li,var:gs,within:tr,distance:ir,"global-state":Hn};class Ue{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){let i=t[0],r=Ue.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter(([c])=>!Array.isArray(c)||c.length===t.length-1),a=null;for(let[c,l]of s){a=new ms(e.registry,As,e.path,null,e.scope);let u=[],h=!1;for(let p=1;p<t.length;p++){let d=t[p],f=Array.isArray(c)?c[p-1]:c.type,m=a.parse(d,1+u.length,f);if(!m){h=!0;break}u.push(m)}if(!h)if(Array.isArray(c)&&c.length!==u.length)a.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);else{for(let p=0;p<u.length;p++){let d=Array.isArray(c)?c[p]:c.type,f=u[p];a.concat(p+1).checkSubtype(d,f.type)}if(a.errors.length===0)return new Ue(i,n,l,u)}}if(s.length===1)e.errors.push(...a.errors);else{let c=(s.length?s:o).map(([u])=>{return h=u,Array.isArray(h)?`(${h.map(kt).join(", ")})`:`(${kt(h.type)}...)`;var h}).join(" | "),l=[];for(let u=1;u<t.length;u++){let h=e.parse(t[u],1+l.length);if(!h)return null;l.push(kt(h.type))}e.error(`Expected arguments of type ${c}, but found (${l.join(", ")}) instead.`)}return null}static register(t,e){Ue.definitions=e;for(let i in e)t[i]=Ue}}function mp(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);let o=n?n.evaluate(t):1,s=Yd(e,i,r,o);if(s)throw new Lt(s);return new Y(e/255,i/255,r/255,o,!1)}function _p(t,e){return t in e}function dc(t,e){let i=e[t];return i===void 0?null:i}function rr(t){return{type:t}}function As(t){if(t instanceof gs)return As(t.boundExpression);if(t instanceof Ue&&t.name==="error")return!1;if(t instanceof ws)return!1;if(t instanceof tr)return!1;if(t instanceof ir)return!1;if(t instanceof Hn)return!1;let e=t instanceof Li||t instanceof Qe,i=!0;return t.eachChild((r)=>{i=e?i&&As(r):i&&r instanceof Qi}),!!i&&zs(t)&&Ds(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function zs(t){if(t instanceof Ue){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 tr)return!1;if(t instanceof ir)return!1;let e=!0;return t.eachChild((i)=>{e&&!zs(i)&&(e=!1)}),e}function Xn(t){if(t instanceof Ue&&t.name==="feature-state")return!1;let e=!0;return t.eachChild((i)=>{e&&!Xn(i)&&(e=!1)}),e}function Ds(t,e){if(t instanceof Ue&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((r)=>{i&&!Ds(r,e)&&(i=!1)}),i}function gp(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}function Vr(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function yp(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function pc(t){return!!t.expression&&t.expression.interpolated}function ht(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function Rs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&qt(t)===Ki}function ev(t){return t}function vp(t,e){let i=t.stops&&typeof t.stops[0][0]=="object",r=i||!(i||t.property!==void 0),n=t.type||(pc(e)?"exponential":"interval"),o=function(u){switch(u.type){case"color":return Y.parse;case"padding":return ve.parse;case"numberArray":return xe.parse;case"colorArray":return se.parse;default:return null}}(e);if(o&&((t=Rr({},t)).stops&&(t.stops=t.stops.map((u)=>[u[0],o(u[1])])),t.default=o(t.default?t.default:e.default)),t.colorSpace&&(s=t.colorSpace)!=="rgb"&&s!=="hcl"&&s!=="lab")throw Error(`Unknown color space: "${t.colorSpace}"`);var s;let a=function(u){switch(u){case"exponential":return xp;case"interval":return rv;case"categorical":return iv;case"identity":return nv;default:throw Error(`Unknown function type "${u}"`)}}(n),c,l;if(n==="categorical"){c=Object.create(null);for(let u of t.stops)c[u[0]]=u[1];l=typeof t.stops[0][0]}if(i){let u={},h=[];for(let f=0;f<t.stops.length;f++){let m=t.stops[f],_=m[0].zoom;u[_]===void 0&&(u[_]={zoom:_,type:t.type,property:t.property,default:t.default,stops:[]},h.push(_)),u[_].stops.push([m[0].value,m[1]])}let p=[];for(let f of h)p.push([u[f].zoom,vp(u[f],e)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:we.interpolationFactor.bind(void 0,d),zoomStops:p.map((f)=>f[0]),evaluate:({zoom:f},m)=>xp({stops:p,base:t.base},e,f).evaluate(f,m)}}if(r){let u=n==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:u,interpolationFactor:we.interpolationFactor.bind(void 0,u),zoomStops:t.stops.map((h)=>h[0]),evaluate:({zoom:h})=>a(t,e,h,c,l)}}return{kind:"source",evaluate(u,h){let p=h&&h.properties?h.properties[t.property]:void 0;return p===void 0?Yn(t.default,e.default):a(t,e,p,c,l)}}}function Yn(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function iv(t,e,i,r,n){return Yn(typeof i===n?r[i]:void 0,t.default,e.default)}function rv(t,e,i){if(ht(i)!=="number")return Yn(t.default,e.default);let r=t.stops.length;if(r===1)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];let n=xs(t.stops.map((o)=>o[0]),i);return t.stops[n][1]}function xp(t,e,i){let r=t.base!==void 0?t.base:1;if(ht(i)!=="number")return Yn(t.default,e.default);let n=t.stops.length;if(n===1)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];let o=xs(t.stops.map((u)=>u[0]),i),s=function(u,h,p,d){let f=d-p,m=u-p;return f===0?0:h===1?m/f:(Math.pow(h,m)-1)/(Math.pow(h,f)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],c=t.stops[o+1][1],l=Ft[e.type]||ev;return typeof a.evaluate=="function"?{evaluate(...u){let h=a.evaluate.apply(void 0,u),p=c.evaluate.apply(void 0,u);if(h!==void 0&&p!==void 0)return l(h,p,s,t.colorSpace)}}:l(a,c,s,t.colorSpace)}function nv(t,e,i){switch(e.type){case"color":i=Y.parse(i);break;case"formatted":i=De.fromString(i.toString());break;case"resolvedImage":i=Ve.fromString(i.toString());break;case"padding":i=ve.parse(i);break;case"colorArray":i=se.parse(i);break;case"numberArray":i=xe.parse(i);break;default:ht(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Yn(i,t.default,e.default)}Ue.register(jr,{error:[{kind:"error"},[ot],(t,[e])=>{throw new Lt(e.evaluate(t))}],typeof:[ot,[at],(t,[e])=>kt(qt(e.evaluate(t)))],"to-rgba":[ye(V,4),[Je],(t,[e])=>{let[i,r,n,o]=e.evaluate(t).rgb;return[255*i,255*r,255*n,o]}],rgb:[Je,[V,V,V],mp],rgba:[Je,[V,V,V,V],mp],has:{type:ct,overloads:[[[ot],(t,[e])=>_p(e.evaluate(t),t.properties())],[[ot,Ki],(t,[e,i])=>_p(e.evaluate(t),i.evaluate(t))]]},get:{type:at,overloads:[[[ot],(t,[e])=>dc(e.evaluate(t),t.properties())],[[ot,Ki],(t,[e,i])=>dc(e.evaluate(t),i.evaluate(t))]]},"feature-state":[at,[ot],(t,[e])=>dc(e.evaluate(t),t.featureState||{})],properties:[Ki,[],(t)=>t.properties()],"geometry-type":[ot,[],(t)=>t.geometryType()],id:[at,[],(t)=>t.id()],zoom:[V,[],(t)=>t.globals.zoom],"heatmap-density":[V,[],(t)=>t.globals.heatmapDensity||0],elevation:[V,[],(t)=>t.globals.elevation||0],"line-progress":[V,[],(t)=>t.globals.lineProgress||0],accumulated:[at,[],(t)=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[V,rr(V),(t,e)=>{let i=0;for(let r of e)i+=r.evaluate(t);return i}],"*":[V,rr(V),(t,e)=>{let i=1;for(let r of e)i*=r.evaluate(t);return i}],"-":{type:V,overloads:[[[V,V],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[V],(t,[e])=>-e.evaluate(t)]]},"/":[V,[V,V],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[V,[V,V],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[V,[V],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[V,[V],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[V,[V],(t,[e])=>Math.log(e.evaluate(t))],log2:[V,[V],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[V,[V],(t,[e])=>Math.sin(e.evaluate(t))],cos:[V,[V],(t,[e])=>Math.cos(e.evaluate(t))],tan:[V,[V],(t,[e])=>Math.tan(e.evaluate(t))],asin:[V,[V],(t,[e])=>Math.asin(e.evaluate(t))],acos:[V,[V],(t,[e])=>Math.acos(e.evaluate(t))],atan:[V,[V],(t,[e])=>Math.atan(e.evaluate(t))],min:[V,rr(V),(t,e)=>Math.min(...e.map((i)=>i.evaluate(t)))],max:[V,rr(V),(t,e)=>Math.max(...e.map((i)=>i.evaluate(t)))],abs:[V,[V],(t,[e])=>Math.abs(e.evaluate(t))],round:[V,[V],(t,[e])=>{let i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[V,[V],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[V,[V],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ct,[ot,at],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ct,[at],(t,[e])=>t.id()===e.value],"filter-type-==":[ct,[ot],(t,[e])=>t.geometryType()===e.value],"filter-<":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[ct,[at],(t,[e])=>(e.value in t.properties())],"filter-has-id":[ct,[],(t)=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[ct,[ye(ot)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ct,[ye(at)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ct,[ot,ye(at)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ct,[ot,ye(at)],(t,[e,i])=>function(r,n,o,s){for(;o<=s;){let a=o+s>>1;if(n[a]===r)return!0;n[a]>r?s=a-1:o=a+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[rr(ct),(t,e)=>{for(let i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[rr(ct),(t,e)=>{for(let i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ct,[ct],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ct,[ot],(t,[e])=>{let i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ot,[ot],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ot,[ot],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ot,rr(at),(t,e)=>e.map((i)=>$n(i.evaluate(t))).join("")],split:[ye(ot),[ot,ot],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[ot,[ye(ot),ot],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[ot,[as],(t,[e])=>e.evaluate(t).resolvedLocale()]});class ks{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new ql,this._defaultValue=e?function(r){if(r.type==="color"&&Rs(r.default))return new Y(0,0,0,0);switch(r.type){case"color":return Y.parse(r.default)||null;case"padding":return ve.parse(r.default)||null;case"numberArray":return xe.parse(r.default)||null;case"colorArray":return se.parse(r.default)||null;case"variableAnchorOffsetCollection":return Ne.parse(r.default)||null;case"projectionDefinition":return Re.parse(r.default)||null;default:return r.default===void 0?null:r.default}}(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o){this._globalState&&(t=Ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||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 Lt(`Expected value to be one of ${Object.keys(this._enumValues).map((a)=>JSON.stringify(a)).join(", ")}, but found ${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 Ls(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in jr}function Fs(t,e,i){let r=new ms(jr,As,[],e?function(o){let s={color:Je,string:ot,number:V,enum:ot,boolean:ct,formatted:Bn,padding:ls,numberArray:cs,colorArray:On,projectionDefinition:ss,resolvedImage:jn,variableAnchorOffsetCollection:hs};return o.type==="array"?ye(s[o.value]||at,o.length):s[o.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?gp(new ks(n,e,i)):Nr(r.errors)}class Kn{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!Xn(e.expression),this.globalStateRefs=Jn(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,o)}}class Bs{constructor(t,e,i,r,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!Xn(e.expression),this.globalStateRefs=Jn(e.expression),this.interpolationType=r,this._globalState=n}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?we.interpolationFactor(this.interpolationType,t,e,i):0}}function bp(t,e,i){let r=Fs(t,e,i);if(r.result==="error")return r;let n=r.value.expression,o=zs(n);if(!o&&!Vr(e))return Nr([new Ke("","data expressions not supported")]);let s=Ds(n,["zoom"]);if(!s&&!yp(e))return Nr([new Ke("","zoom expressions not supported")]);let a=js(n);return a||s?a instanceof Ke?Nr([a]):a instanceof we&&!pc(e)?Nr([new Ke("",'"interpolate" expressions cannot be used with this property')]):gp(a?new Bs(o?"camera":"composite",r.value,a.labels,a instanceof we?a.interpolation:void 0,i):new Kn(o?"constant":"source",r.value,i)):Nr([new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Os{constructor(t,e){this._parameters=t,this._specification=e,Rr(this,vp(this._parameters,this._specification))}static deserialize(t){return new Os(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function js(t){let e=null;if(t instanceof _s)e=js(t.result);else if(t instanceof bs){for(let i of t.args)if(e=js(i),e)break}else(t instanceof Zn||t instanceof we)&&t.input instanceof Ue&&t.input.name==="zoom"&&(e=t);return e instanceof Ke||t.eachChild((i)=>{let r=js(i);r instanceof Ke?e=r:!e&&r?e=new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new Ke("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Jn(t,e=new Set){return t instanceof Hn&&e.add(t.key),t.eachChild((i)=>{Jn(i,e)}),e}function Ur(t,e){let{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a}=t!=null?t:{};return{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a,globalState:e}}function fc(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(!fc(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}let ov={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Qn(t,e){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};fc(t)||(t=Ns(t));let i=Fs(t,ov,e);if(i.result==="error")throw Error(i.value.map((r)=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,o)=>i.value.evaluate(r,n,{},o),needGeometry:wp(t),getGlobalStateRefs:()=>Jn(i.value.expression)}}function sv(t,e){return t<e?-1:t>e?1:0}function wp(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(wp(t[e]))return!0;return!1}function Ns(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?mc(t[1],t[2],"=="):e==="!="?Vs(mc(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?mc(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(Ns))):e==="all"?["all"].concat(t.slice(1).map(Ns)):e==="none"?["all"].concat(t.slice(1).map(Ns).map(Vs)):e==="in"?Tp(t[1],t.slice(2)):e==="!in"?Vs(Tp(t[1],t.slice(2))):e==="has"?Sp(t[1]):e!=="!has"||Vs(Sp(t[1]));var i}function mc(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Tp(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((i)=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(sv)]]:["filter-in-small",t,["literal",e]]}}function Sp(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Vs(t){return["!",t]}function Pp(t){let e=t.value;return e?[new j(t.key,e,"constants have been deprecated as of v8")]:[]}function Ut(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function nr(t){if(Array.isArray(t))return t.map(nr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let i in t)e[i]=nr(t[i]);return e}return Ut(t)}function ke(t){let{key:e,value:i}=t,r=t.valueSpec||{},n=t.objectElementValidators||{},{style:o,styleSpec:s,validateSpec:a}=t,c=[],l=ht(i);if(l!=="object")return[new j(e,i,`object expected, ${l} found`)];for(let u in i){let h=u.split(".")[0],p=Vn(r,h)||r["*"],d;if(Vn(n,h))d=n[h];else if(Vn(r,h)){if(i[u]===void 0)continue;d=a}else if(n["*"])d=n["*"];else{if(!r["*"]){c.push(new j(e,i[u],`unknown property "${u}"`));continue}d=a}c=c.concat(d({key:(e?`${e}.`:e)+u,value:i[u],valueSpec:p,style:o,styleSpec:s,object:i,objectKey:u,validateSpec:a},i))}for(let u in r)n[u]||r[u].required&&r[u].default===void 0&&i[u]===void 0&&c.push(new j(e,i,`missing required property "${u}"`));return c}function _c(t){let{value:e,valueSpec:i,style:r,styleSpec:n,key:o}=t,s=t.arrayElementValidator||t.validateSpec;if(ht(e)!=="array")return[new j(o,e,`array expected, ${ht(e)} found`)];if(i.length&&e.length!==i.length)return[new j(o,e,`array length ${i.length} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};n.$version<7&&(a.function=i.function),ht(i.value)==="object"&&(a=i.value);let c=[];for(let l=0;l<e.length;l++)c=c.concat(s({array:e,arrayIndex:l,value:e[l],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${o}[${l}]`}));return c}function Us(t){let{key:e,value:i,valueSpec:r}=t,n=ht(i);return n==="number"&&i!=i&&(n="NaN"),n!=="number"?[new j(e,i,`number expected, ${n} found`)]:("minimum"in r)&&i<r.minimum?[new j(e,i,`${i} is less than the minimum value ${r.minimum}`)]:("maximum"in r)&&i>r.maximum?[new j(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function Ip(t){let e=t.valueSpec,i=Ut(t.value.type),r,n,o,s={},a=i!=="categorical"&&t.value.property===void 0,c=!a,l=ht(t.value.stops)==="array"&&ht(t.value.stops[0])==="array"&&ht(t.value.stops[0][0])==="object",u=ke({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(d){if(i==="identity")return[new j(d.key,d.value,'identity function may not have a "stops" property')];let f=[],m=d.value;return f=f.concat(_c({key:d.key,value:m,valueSpec:d.valueSpec,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,arrayElementValidator:h})),ht(m)==="array"&&m.length===0&&f.push(new j(d.key,m,"array must have at least one stop")),f},default:function(d){return d.validateSpec({key:d.key,value:d.value,valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec})}}});return i==="identity"&&a&&u.push(new j(t.key,t.value,'missing required property "property"')),i==="identity"||t.value.stops||u.push(new j(t.key,t.value,'missing required property "stops"')),i==="exponential"&&t.valueSpec.expression&&!pc(t.valueSpec)&&u.push(new j(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!Vr(t.valueSpec)?u.push(new j(t.key,t.value,"property functions not supported")):a&&!yp(t.valueSpec)&&u.push(new j(t.key,t.value,"zoom functions not supported"))),i!=="categorical"&&!l||t.value.property!==void 0||u.push(new j(t.key,t.value,'"property" property is required')),u;function h(d){let f=[],{value:m,key:_}=d;if(ht(m)!=="array")return[new j(_,m,`array expected, ${ht(m)} found`)];if(m.length!==2)return[new j(_,m,`array length 2 expected, length ${m.length} found`)];if(l){if(ht(m[0])!=="object")return[new j(_,m,`object expected, ${ht(m[0])} found`)];if(m[0].zoom===void 0)return[new j(_,m,"object stop key must have zoom")];if(m[0].value===void 0)return[new j(_,m,"object stop key must have value")];if(o&&o>Ut(m[0].zoom))return[new j(_,m[0].zoom,"stop zoom values must appear in ascending order")];Ut(m[0].zoom)!==o&&(o=Ut(m[0].zoom),n=void 0,s={}),f=f.concat(ke({key:`${_}[0]`,value:m[0],valueSpec:{zoom:{}},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{zoom:Us,value:p}}))}else f=f.concat(p({key:`${_}[0]`,value:m[0],validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec},m));return Ls(nr(m[1]))?f.concat([new j(`${_}[1]`,m[1],"expressions are not allowed in function stops.")]):f.concat(d.validateSpec({key:`${_}[1]`,value:m[1],valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec}))}function p(d,f){let m=ht(d.value),_=Ut(d.value),y=d.value!==null?d.value:f;if(r){if(m!==r)return[new j(d.key,y,`${m} stop domain type must match previous stop domain type ${r}`)]}else r=m;if(m!=="number"&&m!=="string"&&m!=="boolean")return[new j(d.key,y,"stop domain value must be a number, string, or boolean")];if(m!=="number"&&i!=="categorical"){let v=`number expected, ${m} found`;return Vr(e)&&i===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new j(d.key,y,v)]}return i!=="categorical"||m!=="number"||isFinite(_)&&Math.floor(_)===_?i!=="categorical"&&m==="number"&&n!==void 0&&_<n?[new j(d.key,y,"stop domain values must appear in ascending order")]:(n=_,i==="categorical"&&(_ in s)?[new j(d.key,y,"stop domain values must be unique")]:(s[_]=!0,[])):[new j(d.key,y,`integer expected, found ${_}`)]}}function $r(t){let e=(t.expressionContext==="property"?bp:Fs)(nr(t.value),t.valueSpec);if(e.result==="error")return e.value.map((r)=>new j(`${t.key}${r.key}`,t.value,r.message));let i=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!i.outputDefined())return[new j(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Xn(i))return[new j(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Xn(i))return[new j(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ds(i,["zoom","feature-state"]))return[new j(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!zs(i))return[new j(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gc(t){let{key:e,value:i}=t,r=ht(i);return r!=="string"?[new j(e,i,`color expected, ${r} found`)]:Y.parse(String(i))?[]:[new j(e,i,`color expected, "${i}" found`)]}function to(t){let{key:e,value:i,valueSpec:r}=t,n=[];return Array.isArray(r.values)?r.values.indexOf(Ut(i))===-1&&n.push(new j(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(Ut(i))===-1&&n.push(new j(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function yc(t){return fc(nr(t.value))?$r(Rr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ep(t)}function Ep(t){let{value:e,key:i}=t;if(ht(e)!=="array")return[new j(i,e,`array expected, ${ht(e)} found`)];let r=t.styleSpec,n,o=[];if(e.length<1)return[new j(i,e,"filter array must have at least 1 element")];switch(o=o.concat(to({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Ut(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ut(e[1])==="$type"&&o.push(new j(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new j(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=ht(e[1]),n!=="string"&&o.push(new j(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=ht(e[s]),Ut(e[1])==="$type"?o=o.concat(to({key:`${i}[${s}]`,value:e[s],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&o.push(new j(`${i}[${s}]`,e[s],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let s=1;s<e.length;s++)o=o.concat(Ep({key:`${i}[${s}]`,value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=ht(e[1]),e.length!==2?o.push(new j(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):n!=="string"&&o.push(new j(`${i}[1]`,e[1],`string expected, ${n} found`))}return o}function Mp(t,e){let{key:i,validateSpec:r,style:n,styleSpec:o,value:s,objectKey:a}=t,c=o[`${e}_${t.layerType}`];if(!c)return[];let l=a.match(/^(.*)-transition$/);if(e==="paint"&&l&&c[l[1]]&&c[l[1]].transition)return r({key:i,value:s,valueSpec:o.transition,style:n,styleSpec:o});let u=t.valueSpec||c[a];if(!u)return[new j(i,s,`unknown property "${a}"`)];let h;if(ht(s)==="string"&&Vr(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new j(i,s,`"${a}" does not support interpolation syntax
2
2
  Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];let p=[];return t.layerType==="symbol"&&a==="text-font"&&Rs(nr(s))&&Ut(s.type)==="identity"&&p.push(new j(i,s,'"text-font" does not support identity functions')),p.concat(r({key:t.key,value:s,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:a}))}function Cp(t){return Mp(t,"paint")}function Ap(t){return Mp(t,"layout")}function zp(t){var e,i;let r=[],{value:n,key:o,style:s,styleSpec:a}=t;if(ht(n)!=="object")return[new j(o,n,`object expected, ${ht(n)} found`)];n.type||n.ref||r.push(new j(o,n,'either "type" or "ref" is required'));let c=Ut(n.type),l=Ut(n.ref);if(n.id){let u=Ut(n.id);for(let h=0;h<t.arrayIndex;h++){let p=s.layers[h];Ut(p.id)===u&&r.push(new j(o,n.id,`duplicate layer id "${n.id}", previously used at line ${p.id.__line__}`))}}if("ref"in n){let u;["type","source","source-layer","filter","layout"].forEach((h)=>{h in n&&r.push(new j(o,n[h],`"${h}" is prohibited for ref layers`))}),s.layers.forEach((h)=>{Ut(h.id)===l&&(u=h)}),u?u.ref?r.push(new j(o,n.ref,"ref cannot reference another ref layer")):c=Ut(u.type):r.push(new j(o,n.ref,`ref layer "${l}" not found`))}else if(c!=="background")if(n.source){let u=s.sources&&s.sources[n.source],h=u&&Ut(u.type);u?h==="vector"&&c==="raster"?r.push(new j(o,n.source,`layer "${n.id}" requires a raster source`)):h!=="raster-dem"&&c==="hillshade"||h!=="raster-dem"&&c==="color-relief"?r.push(new j(o,n.source,`layer "${n.id}" requires a raster-dem source`)):h==="raster"&&c!=="raster"?r.push(new j(o,n.source,`layer "${n.id}" requires a vector source`)):h!=="vector"||n["source-layer"]?h==="raster-dem"&&c!=="hillshade"&&c!=="color-relief"?r.push(new j(o,n.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):c!=="line"||!n.paint||!n.paint["line-gradient"]||h==="geojson"&&u.lineMetrics||r.push(new j(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new j(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new j(o,n.source,`source "${n.source}" not found`))}else r.push(new j(o,n,'missing required property "source"'));return c==="raster"&&((e=n.paint)===null||e===void 0?void 0:e.resampling)&&((i=n.paint)===null||i===void 0?void 0:i["raster-resampling"])&&r.push(new j(o,n.paint,`layer "${n.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(ke({key:o,value:n,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:n,objectKey:"type"}),filter:yc,layout:(u)=>ke({layer:n,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":(h)=>Ap(Rr({layerType:c},h))}}),paint:(u)=>ke({layer:n,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":(h)=>Cp(Rr({layerType:c},h))}})}})),r}function Fi(t){let{value:e,key:i}=t,r=ht(e);return r!=="string"?[new j(i,e,`string expected, ${r} found`)]:[]}let Dp={promoteId:function({key:t,value:e}){if(ht(e)==="string")return Fi({key:t,value:e});{let i=[];for(let r in e)i.push(...Fi({key:`${t}.${r}`,value:e[r]}));return i}}};function Rp(t){let{value:e,key:i,styleSpec:r,style:n,validateSpec:o}=t;if(!e.type)return[new j(i,e,'"type" is required')];let s=Ut(e.type),a;switch(s){case"vector":case"raster":return a=ke({key:i,value:e,valueSpec:r[`source_${s.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:Dp,validateSpec:o}),a;case"raster-dem":return a=function(c){var l;let u=(l=c.sourceName)!==null&&l!==void 0?l:"",{value:h,styleSpec:p}=c,d=p.source_raster_dem,f=c.style,m=[],_=ht(h);if(h===void 0)return m;if(_!=="object")return m.push(new j("source_raster_dem",h,`object expected, ${_} found`)),m;let y=Ut(h.encoding)==="custom",v=["redFactor","greenFactor","blueFactor","baseShift"],g=c.value.encoding?`"${c.value.encoding}"`:"Default";for(let x in h)!y&&v.includes(x)?m.push(new j(x,h[x],`In "${u}": "${x}" is only valid when "encoding" is set to "custom". ${g} encoding found`)):d[x]?m=m.concat(c.validateSpec({key:x,value:h[x],valueSpec:d[x],validateSpec:c.validateSpec,style:f,styleSpec:p})):m.push(new j(x,h[x],`unknown property "${x}"`));return m}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=ke({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Dp}),e.cluster)for(let c in e.clusterProperties){let[l,u]=e.clusterProperties[c],h=typeof l=="string"?[l,["accumulated"],["get",c]]:l;a.push(...$r({key:`${i}.${c}.map`,value:u,expressionContext:"cluster-map"})),a.push(...$r({key:`${i}.${c}.reduce`,value:h,expressionContext:"cluster-reduce"}))}return a;case"video":return ke({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return ke({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new j(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return to({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function kp(t){let{value:e,styleSpec:i}=t,r=i.light,n=t.style,o=[],s=ht(e);if(e===void 0)return o;if(s!=="object")return o=o.concat([new j("light",e,`object expected, ${s} found`)]),o;for(let a in e){let c=a.match(/^(.*)-transition$/);o=o.concat(c&&r[c[1]]&&r[c[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)])}return o}function Lp(t){let{value:e,styleSpec:i}=t,r=i.sky,n=t.style,o=ht(e);if(e===void 0)return[];if(o!=="object")return[new j("sky",e,`object expected, ${o} found`)];let s=[];for(let a in e)s=s.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)]);return s}function Fp(t){let{value:e,styleSpec:i}=t,r=i.terrain,n=t.style,o=[],s=ht(e);if(e===void 0)return o;if(s!=="object")return o=o.concat([new j("terrain",e,`object expected, ${s} found`)]),o;for(let a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)]);return o}function Bp(t){let e=[],{value:i,key:r}=t;if(Array.isArray(i)){let n=[],o=[];for(let s in i)i[s].id&&n.includes(i[s].id)&&e.push(new j(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&e.push(new j(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),e=e.concat(ke({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Fi({key:r,value:i})}function Op(t){return Boolean(t)&&t.constructor===Object}function jp(t){return Op(t.value)?[]:[new j(t.key,t.value,`object expected, ${ht(t.value)} found`)]}let Np={"*":()=>[],array:_c,boolean:function(t){let{value:e,key:i}=t,r=ht(e);return r!=="boolean"?[new j(i,e,`boolean expected, ${r} found`)]:[]},number:Us,color:gc,constants:Pp,enum:to,filter:yc,function:Ip,layer:zp,object:ke,source:Rp,light:kp,sky:Lp,terrain:Fp,projection:function(t){let{value:e,styleSpec:i}=t,r=i.projection,n=t.style,o=ht(e);if(e===void 0)return[];if(o!=="object")return[new j("projection",e,`object expected, ${o} found`)];let s=[];for(let a in e)s=s.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)]);return s},projectionDefinition:function(t){let{key:e,value:i}=t;i=i instanceof String?i.valueOf():i;let r=ht(i);return r!=="array"||function(n){return Array.isArray(n)&&n.length===3&&typeof n[0]=="string"&&typeof n[1]=="string"&&typeof n[2]=="number"}(i)||function(n){return!!["interpolate","step","literal"].includes(n[0])}(i)?["array","string"].includes(r)?[]:[new j(e,i,`projection expected, invalid type "${r}" found`)]:[new j(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Fi,formatted:function(t){return Fi(t).length===0?[]:$r(t)},resolvedImage:function(t){return Fi(t).length===0?[]:$r(t)},padding:function(t){let{key:e,value:i}=t;if(ht(i)==="array"){if(i.length<1||i.length>4)return[new j(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},n=[];for(let o=0;o<i.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:r}));return n}return Us({key:e,value:i,valueSpec:{}})},numberArray:function(t){let{key:e,value:i}=t;if(ht(i)==="array"){let r={type:"number"};if(i.length<1)return[new j(e,i,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<i.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:r}));return n}return Us({key:e,value:i,valueSpec:{}})},colorArray:function(t){let{key:e,value:i}=t;if(ht(i)==="array"){if(i.length<1)return[new j(e,i,"array length at least 1 expected, length 0 found")];let r=[];for(let n=0;n<i.length;n++)r=r.concat(gc({key:`${e}[${n}]`,value:i[n]}));return r}return gc({key:e,value:i})},variableAnchorOffsetCollection:function(t){let{key:e,value:i}=t,r=ht(i),n=t.styleSpec;if(r!=="array"||i.length<1||i.length%2!=0)return[new j(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let s=0;s<i.length;s+=2)o=o.concat(to({key:`${e}[${s}]`,value:i[s],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(_c({key:`${e}[${s+1}]`,value:i[s+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return o},sprite:Bp,state:jp,fontFaces:function(t){let{key:e,value:i,validateSpec:r,styleSpec:n,style:o}=t;if(!Op(i))return[new j(e,i,`object expected, ${ht(i)} found`)];let s=[];for(let a in i){let c=i[a],l=ht(c);if(l==="string")s.push(...Fi({key:`${e}.${a}`,value:c}));else if(l==="array"){let u={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[h,p]of c.entries())s.push(...ke({key:`${e}.${a}[${h}]`,value:p,valueSpec:u,styleSpec:n,style:o,validateSpec:r}))}else s.push(new j(`${e}.${a}`,c,`string or array expected, ${l} found`))}return s}};function $s(t){let{value:e,valueSpec:i,styleSpec:r}=t;return t.validateSpec=$s,i.expression&&Rs(Ut(e))?Ip(t):i.expression&&Ls(nr(e))?$r(t):i.type&&Np[i.type]?Np[i.type](t):ke(Rr({},t,{valueSpec:i.type?r[i.type]:i}))}function Vp(t){let{value:e,key:i}=t,r=Fi(t);return r.length||(e.indexOf("{fontstack}")===-1&&r.push(new j(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&r.push(new j(i,e,'"glyphs" url must include a "{range}" token'))),r}function $e(t,e=D){let i=[];return i=i.concat($s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:$s,objectElementValidators:{glyphs:Vp,"*":()=>[]}})),t.constants&&(i=i.concat(Pp({key:"constants",value:t.constants}))),Up(i)}function ti(t){return function(e){return t(Object.assign({},e,{validateSpec:$s}))}}function Up(t){return[].concat(t).sort((e,i)=>e.line-i.line)}function ei(t){return function(...e){return Up(t.apply(this,e))}}$e.source=ei(ti(Rp)),$e.sprite=ei(ti(Bp)),$e.glyphs=ei(ti(Vp)),$e.light=ei(ti(kp)),$e.sky=ei(ti(Lp)),$e.terrain=ei(ti(Fp)),$e.state=ei(ti(jp)),$e.layer=ei(ti(zp)),$e.filter=ei(ti(yc)),$e.paintProperty=ei(ti(Cp)),$e.layoutProperty=ei(ti(Ap));let av={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class $p{constructor(t,e){this._globalState=e,this.setValue(t)}evaluate(){var t;return(t=this._literalValue)!==null&&t!==void 0?t:this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none")return this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let e=Fs(t,av,this._globalState);if(e.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map((i)=>`${i.key}: ${i.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=Jn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let lv=D,te=$e,{light:cv,sky:hv,paintProperty:uv,layoutProperty:dv}=te;function Zs(t,e){let i=!1;if(e==null?void 0:e.length)for(let r of e)t.fire(new J(Error(r.message))),i=!0;return i}class eo{constructor(t,e,i){let r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(let a=0;a<this.d*this.d;a++){let c=o[3+a],l=o[3+a+1];r.push(c===l?null:o.subarray(c,l))}let s=o[3+r.length+1];this.keys=o.subarray(o[3+r.length],s),this.bboxes=o.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let o=0;o<this.d*this.d;o++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;let n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,o){this.cells[n].push(o)}query(t,e,i,r,n){let o=this.min,s=this.max;if(t<=o&&e<=o&&s<=i&&s<=r&&!n)return[...this.keys];{let a=[];return this._forEachCell(t,e,i,r,this._queryCell,a,{},n),a}}_queryCell(t,e,i,r,n,o,s,a){let c=this.cells[n];if(c!==null){let l=this.keys,u=this.bboxes;for(let h of c)if(s[h]===void 0){let p=4*h;(a?a(u[p+0],u[p+1],u[p+2],u[p+3]):t<=u[p+2]&&e<=u[p+3]&&i>=u[p+0]&&r>=u[p+1])?(s[h]=!0,o.push(l[h])):s[h]=!1}}}_forEachCell(t,e,i,r,n,o,s,a){let c=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r);for(let p=c;p<=u;p++)for(let d=l;d<=h;d++){let f=this.d*d+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&n.call(this,t,e,i,r,f,o,s,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,e=3+this.cells.length+1+1,i=0;for(let o of this.cells)i+=o.length;let r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let o=0;o<t.length;o++){let s=t[o];r[3+o]=n,r.set(s,n),n+=s.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){let i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new eo(t.buffer)}}let Ti={};function U(t,e,i={}){if(Ti[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Ti[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}U("Object",Object),U("Set",Set),U("TransferableGridIndex",eo),U("Color",Y),U("Error",Error),U("AJAXError",zr),U("ResolvedImage",Ve),U("StylePropertyFunction",Os),U("StyleExpression",ks,{omit:["_evaluator"]}),U("ZoomDependentExpression",Bs),U("ZoomConstantExpression",Kn),U("CompoundExpression",Ue,{omit:["_evaluate"]});for(let t in jr)jr[t]._classRegistryKey||U(`Expression_${t}`,jr[t]);function Zp(t){var e;return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||((e=t.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function vc(t){return t.$name||t.constructor._classRegistryKey}function Gp(t){return!function(e){if(e===null||typeof e!="object")return!1;let i=vc(e);return i&&i!=="Object"}(t)&&(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||Zp(t)||Yi(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function io(t,e){if(Gp(t))return(Zp(t)||Yi(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let o=[];for(let s of t)o.push(io(s,e));return o}if(typeof t!="object")throw Error("can't serialize object of type "+typeof t);let i=vc(t);if(!i)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!Ti[i])throw Error(`${i} is not registered.`);let{klass:r}=Ti[i],n=r.serialize?r.serialize(t,e):{};if(r.serialize){if(n===(e==null?void 0:e[e.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o))continue;if(Ti[i].omit.includes(o))continue;let s=t[o];n[o]=Ti[i].shallow.includes(o)?s:io(s,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}function ro(t){if(Gp(t))return t;if(Array.isArray(t))return t.map(ro);if(typeof t!="object")throw Error("can't deserialize object of type "+typeof t);let e=vc(t)||"Object";if(!Ti[e])throw Error(`can't deserialize unregistered class ${e}`);let{klass:i}=Ti[e];if(!i)throw Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);let r=Object.create(i.prototype);for(let n of Object.keys(t)){if(n==="$name")continue;let o=t[n];r[n]=Ti[e].shallow.includes(n)?o:ro(o)}return r}class Gs{constructor(){this.first=!0}update(t,e){let i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}function pv(t){for(let i of t)if(e=i.codePointAt(0),/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e)))return!0;var e;return!1}function qp(t){let e=t.map((i)=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch(r){return null}}).filter((i)=>i);return new RegExp(e.join("|"),"u")}qp(["Arab","Dupl","Mong","Ougr","Syrc"]);let fv=qp(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Wp(t){return fv.test(String.fromCodePoint(t))}function mv(t,e){return!(!e&&Wp(t)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t)))}function _v(t){for(let e of t)if(Wp(e.codePointAt(0)))return!0;return!1}let Zr=new class{constructor(){this.TIMEOUT=5000,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Zr.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,e){return it(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let i=t.pluginURL,r=new Promise((o)=>{this.loadScriptResolve=o});e(i);let n=new Promise((o)=>setTimeout(()=>o(),this.TIMEOUT));if(yield Promise.race([r,n]),this.isParsed()){let o={pluginStatus:"loaded",pluginURL:i};return this.setState(o),o}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)})}};class At{constructor(t,e){this.isSupportedScript=gv,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new Gs,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gs,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:0.5,toScale:1,t:1-(1-i)*e}}}function gv(t){return function(e,i){for(let r of e)if(!mv(r.codePointAt(0),i))return!1;return!0}(t,Zr.getRTLTextPluginStatus()==="loaded")}let no="-transition";class oo{constructor(t,e,i){this.property=t,this.value=e,this.expression=function(r,n,o){if(Rs(r))return new Os(r,n);if(Ls(r)){let s=bp(r,n,o);if(s.result==="error")throw Error(s.value.map((a)=>`${a.key}: ${a.message}`).join(", "));return s.value}{let s=r;return n.type==="color"&&typeof r=="string"?s=Y.parse(r):n.type!=="padding"||typeof r!="number"&&!Array.isArray(r)?n.type!=="numberArray"||typeof r!="number"&&!Array.isArray(r)?n.type!=="colorArray"||typeof r!="string"&&!Array.isArray(r)?n.type==="variableAnchorOffsetCollection"&&Array.isArray(r)?s=Ne.parse(r):n.type==="projectionDefinition"&&typeof r=="string"&&(s=Re.parse(r)):s=se.parse(r):s=xe.parse(r):s=ve.parse(r),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>s}}}(e===void 0?t.specification.default:e,t.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class qs{constructor(t,e){this.property=t,this.value=new oo(t,void 0,e)}transitioned(t,e){return new xc(this.property,this.value,e,G({},t.transition,this.transition),t.now)}untransitioned(){return new xc(this.property,this.value,null,{},0)}}class so{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=e}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return be(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new qs(this._values[t].property,this._globalState)),this._values[t].value=new oo(this._values[t].property,e===null?void 0:be(e),this._globalState)}getTransition(t){return be(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new qs(this._values[t].property,this._globalState)),this._values[t].transition=be(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let i=this.getValue(e);i!==void 0&&(t[e]=i);let r=this.getTransition(e);r!==void 0&&(t[`${e}${no}`]=r)}return t}transitioned(t,e){let i=new bc(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){let t=new bc(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class xc{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){let r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(t,e,i);{let s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),n,bd(s))}}return n}}class bc{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){let r=new ao(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Hp{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=e}hasValue(t){return this._values[t].value!==void 0}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return be(this._values[t].value)}setValue(t,e){this._values[t]=new oo(this._values[t].property,e===null?void 0:be(e),this._globalState)}serialize(){let t={};for(let e of Object.keys(this._values)){let i=this.getValue(e);i!==void 0&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){let r=new ao(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class ii{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class ao{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Z{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){let r=Ft[this.specification.type];return r?r(t,e,i):t}}class K{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new ii(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if(t.value.kind!=="constant"||e.value.kind!=="constant")return t;if(t.value.value===void 0||e.value.value===void 0)return new ii(this,{kind:"constant",value:void 0},t.parameters);let r=Ft[this.specification.type];if(r){let n=r(t.value.value,e.value.value,i);return new ii(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,o){return t.kind==="constant"?t.value:t.evaluate(e,i,r,n,o)}}class Gr extends K{possiblyEvaluate(t,e,i,r){if(t.value===void 0)return new ii(this,{kind:"constant",value:void 0},e);if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},i,r),o=t.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,s=this._calculate(o,o,o,e);return new ii(this,{kind:"constant",value:s},e)}if(t.expression.kind==="camera"){let n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new ii(this,{kind:"constant",value:n},e)}return new ii(this,t.expression,e)}evaluate(t,e,i,r,n,o){if(t.kind==="source"){let s=t.evaluate(e,i,r,n,o);return this._calculate(s,s,s,e)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class wc{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new At(Math.floor(e.zoom-1),e)),t.expression.evaluate(new At(Math.floor(e.zoom),e)),t.expression.evaluate(new At(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class lo{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class ee{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let i=t[e];i.specification.overridable&&this.overridableProperties.push(e);let r=this.defaultPropertyValues[e]=new oo(i,void 0,void 0),n=this.defaultTransitionablePropertyValues[e]=new qs(i,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}U("DataDrivenProperty",K),U("DataConstantProperty",Z),U("CrossFadedDataDrivenProperty",Gr),U("CrossFadedProperty",wc),U("ColorRampProperty",lo);let Xp=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Tc=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Ze extends Ht{constructor(t,e,i){if(super(),this.id=t.id,this.type=t.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(r,n){return new $p(r,n)}(this.visibility,i),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=Qn(t.filter,i)),e.layout&&(this._unevaluatedLayout=new Hp(e.layout,i)),e.paint)){this._transitionablePaint=new so(e.paint,i);for(let r in t.paint)this.setPaintProperty(r,t.paint[r],{validate:!1});for(let r in t.layout)this.setLayoutProperty(r,t.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ao(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=Qn(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if(t==="visibility")return this.visibility;if((e=this._transitionablePaint)===null||e===void 0?void 0:e.hasProperty(t))throw Error(t+Xp);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[e];for(let r of i.getGlobalStateRefs())t.add(r)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var t;let e=new globalThis.Map;if(this._transitionablePaint)for(let i in this._transitionablePaint._values){let r=this._transitionablePaint._values[i].value;for(let n of r.getGlobalStateRefs()){let o=(t=e.get(n))!==null&&t!==void 0?t:[];o.push({name:i,value:r.value}),e.set(n,o)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,i={}){var r;if(t==="visibility")return this.visibility=e,this._visibilityExpression.setValue(e),void this.recalculateVisibility();((r=this._transitionablePaint)===null||r===void 0?void 0:r.hasProperty(t))?this.fire(new J(Error(t+Xp))):e!=null&&this._validate(dv,`layers.${this.id}.layout.${t}`,t,e,i)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,i;if(t.endsWith(no)){let r=t.slice(0,-11);if(r==="visibility"||((e=this._unevaluatedLayout)===null||e===void 0?void 0:e.hasProperty(r)))throw Error(t+Tc);return this._transitionablePaint.getTransition(r)}if(t==="visibility"||((i=this._unevaluatedLayout)===null||i===void 0?void 0:i.hasProperty(t)))throw Error(t+Tc);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){var r;if(t==="visibility"||((r=this._unevaluatedLayout)===null||r===void 0?void 0:r.hasProperty(t)))return this.fire(new J(Error(t+Tc))),!1;if(e!=null&&this._validate(uv,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(no))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let n=this._transitionablePaint._values[t],o=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let c=this._transitionablePaint._values[t].value;return c.isDataDriven()||s||o||this._handleOverridablePaintPropertyUpdate(t,a,c)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t=this.minzoom,e=!1){return!!(this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){var t,e;let i={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:(t=this._unevaluatedLayout)===null||t===void 0?void 0:t.serialize(),paint:(e=this._transitionablePaint)===null||e===void 0?void 0:e.serialize()};return this.visibility&&(i.layout||(i.layout={}),i.layout.visibility=this.visibility),Td(i,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(t,e,i,r,n={}){return(n==null?void 0:n.validate)!==!1&&Zs(this,t.call(te,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:D,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof ii&&Vr(e.property.specification)&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}}let Yp;var yv={get paint(){return Yp=Yp||new ee({"raster-opacity":new Z(D.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(D.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(D.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(D.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(D.paint_raster["raster-saturation"]),"raster-contrast":new Z(D.paint_raster["raster-contrast"]),resampling:new Z(D.paint_raster.resampling),"raster-resampling":new Z(D.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(D.paint_raster["raster-fade-duration"])})}};let Sc=(t)=>t.type==="raster";class Kp extends Ze{constructor(t,e){super(t,yv,e)}}let vv={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class qr{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Rt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function Bt(t,e=1){let i=0,r=0;return{members:t.map((n)=>{let o=vv[n.type].BYTES_PER_ELEMENT,s=i=Jp(i,Math.max(e,o)),a=n.components||1;return r=Math.max(r,o),i+=o*a,{name:n.name,type:n.type,components:a,offset:s}}),size:Jp(i,Math.max(r,e)),alignment:e}}function Jp(t,e){return Math.ceil(t/e)*e}class Wr extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}Wr.prototype.bytesPerElement=4,U("StructArrayLayout2i4",Wr);class co extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}co.prototype.bytesPerElement=6,U("StructArrayLayout3i6",co);class Ws extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){let o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t}}Ws.prototype.bytesPerElement=8,U("StructArrayLayout4i8",Ws);class Hs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,t}}Hs.prototype.bytesPerElement=12,U("StructArrayLayout2i4i12",Hs);class Xs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=4*t,c=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,t}}Xs.prototype.bytesPerElement=8,U("StructArrayLayout2i4ub8",Xs);class Hr extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Hr.prototype.bytesPerElement=8,U("StructArrayLayout2f8",Hr);class Ys extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,r,n,o,s,a,c,l)}emplace(t,e,i,r,n,o,s,a,c,l,u){let h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=c,this.uint16[h+8]=l,this.uint16[h+9]=u,t}}Ys.prototype.bytesPerElement=20,U("StructArrayLayout10ui20",Ys);class Ks extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a){let c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,o,s,a)}emplace(t,e,i,r,n,o,s,a,c){let l=8*t;return this.uint16[l+0]=e,this.uint16[l+1]=i,this.uint16[l+2]=r,this.uint16[l+3]=n,this.uint16[l+4]=o,this.uint16[l+5]=s,this.uint16[l+6]=a,this.uint16[l+7]=c,t}}Ks.prototype.bytesPerElement=16,U("StructArrayLayout8ui16",Ks);class Js extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c,l,u,h){let p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,o,s,a,c,l,u,h)}emplace(t,e,i,r,n,o,s,a,c,l,u,h,p){let d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=s,this.uint16[d+6]=a,this.uint16[d+7]=c,this.int16[d+8]=l,this.int16[d+9]=u,this.int16[d+10]=h,this.int16[d+11]=p,t}}Js.prototype.bytesPerElement=24,U("StructArrayLayout4i4ui4i24",Js);class Qs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Qs.prototype.bytesPerElement=12,U("StructArrayLayout3f12",Qs);class ta extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}ta.prototype.bytesPerElement=4,U("StructArrayLayout1ul4",ta);class ea extends Rt{_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(t,e,i,r,n,o,s,a,c){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,n,o,s,a,c)}emplace(t,e,i,r,n,o,s,a,c,l){let u=10*t,h=5*t;return this.int16[u+0]=e,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.uint32[h+3]=a,this.uint16[u+8]=c,this.uint16[u+9]=l,t}}ea.prototype.bytesPerElement=20,U("StructArrayLayout6i1ul2ui20",ea);class ia extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,t}}ia.prototype.bytesPerElement=12,U("StructArrayLayout2i2i2i12",ia);class ra extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){let o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){let s=4*t,a=8*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,t}}ra.prototype.bytesPerElement=16,U("StructArrayLayout2f1f2i16",ra);class na extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=16*t,c=4*t,l=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[c+1]=r,this.float32[c+2]=n,this.int16[l+6]=o,this.int16[l+7]=s,t}}na.prototype.bytesPerElement=16,U("StructArrayLayout2ub2f2i16",na);class ho extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}ho.prototype.bytesPerElement=6,U("StructArrayLayout3ui6",ho);class oa extends Rt{_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(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_){let y=this.length;return this.resize(y+1),this.emplace(y,t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_)}emplace(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y){let v=24*t,g=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=n,this.uint32[g+2]=o,this.uint32[g+3]=s,this.uint32[g+4]=a,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[g+7]=h,this.float32[g+8]=p,this.uint8[x+36]=d,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[g+10]=_,this.int16[v+22]=y,t}}oa.prototype.bytesPerElement=48,U("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",oa);class sa extends Rt{_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(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P,S,E,I){let C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P,S,E,I)}emplace(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P,S,E,I,C){let A=32*t,M=16*t;return this.int16[A+0]=e,this.int16[A+1]=i,this.int16[A+2]=r,this.int16[A+3]=n,this.int16[A+4]=o,this.int16[A+5]=s,this.int16[A+6]=a,this.int16[A+7]=c,this.uint16[A+8]=l,this.uint16[A+9]=u,this.uint16[A+10]=h,this.uint16[A+11]=p,this.uint16[A+12]=d,this.uint16[A+13]=f,this.uint16[A+14]=m,this.uint16[A+15]=_,this.uint16[A+16]=y,this.uint16[A+17]=v,this.uint16[A+18]=g,this.uint16[A+19]=x,this.uint16[A+20]=b,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[M+12]=P,this.float32[M+13]=S,this.float32[M+14]=E,this.uint16[A+30]=I,this.uint16[A+31]=C,t}}sa.prototype.bytesPerElement=64,U("StructArrayLayout8i15ui1ul2f2ui64",sa);class uo extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}uo.prototype.bytesPerElement=4,U("StructArrayLayout1f4",uo);class aa extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}aa.prototype.bytesPerElement=12,U("StructArrayLayout1ui2f12",aa);class la extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}la.prototype.bytesPerElement=8,U("StructArrayLayout1ul2ui8",la);class ca extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}ca.prototype.bytesPerElement=4,U("StructArrayLayout2ui4",ca);class ha extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}ha.prototype.bytesPerElement=2,U("StructArrayLayout1ui2",ha);class ua extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){let o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t}}ua.prototype.bytesPerElement=16,U("StructArrayLayout4f16",ua);class Pc extends qr{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 z(this.anchorPointX,this.anchorPointY)}}Pc.prototype.size=20;class Ic extends ea{get(t){return new Pc(this,t)}}U("CollisionBoxArray",Ic);class Ec extends qr{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ec.prototype.size=48;class Mc extends oa{get(t){return new Ec(this,t)}}U("PlacedSymbolArray",Mc);class Cc extends qr{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}Cc.prototype.size=64;class Ac extends sa{get(t){return new Cc(this,t)}}U("SymbolInstanceArray",Ac);class zc extends uo{getoffsetX(t){return this.float32[1*t+0]}}U("GlyphOffsetArray",zc);class Dc extends co{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}U("SymbolLineVertexArray",Dc);class Rc extends qr{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]}}Rc.prototype.size=12;class kc extends aa{get(t){return new Rc(this,t)}}U("TextAnchorOffsetArray",kc);class Lc extends qr{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]}}Lc.prototype.size=8;class Fc extends la{get(t){return new Lc(this,t)}}U("FeatureIndexArray",Fc);class ui extends Wr{}class Qp extends co{}class tf extends Ws{}class ef extends Wr{}class rf extends Wr{}class nf extends Hs{}class of extends Xs{}class sf extends Hr{}class or extends Ys{}class Bc extends Ks{}class af extends Js{}class lf extends Qs{}class cf extends ta{}class Oc extends ia{}class hf extends ra{}class uf extends na{}class df extends ho{}class Ge extends ho{}class da extends ca{}class pf extends ha{}let xv=Bt([{name:"a_pos",components:2,type:"Int16"}],4),{members:bv}=xv;class xt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,i,r){let n=this.segments[this.segments.length-1];return t>xt.MAX_VERTEX_ARRAY_LENGTH&&Ct(`Max vertices per segment is ${xt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${xt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>xt.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(e,i,r):n}createNewSegment(t,e,i){let r={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(t,e,i){return this.prepareSegment(0,t,e,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new xt([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function ff(t,e){return 256*(t=_t(Math.floor(t),0,255))+_t(Math.floor(e),0,255)}xt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,U("SegmentVector",xt);let wv=Bt([{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"}]),Tv=Bt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var mf,_f,gf,po={exports:{}},yf={exports:{}},vf={exports:{}},Sv=function(){if(gf)return po.exports;gf=1;var t=(mf||(mf=1,function(i){i.exports=function(r,n){var o,s,a,c,l,u,h,p;for(s=r.length-(o=3&r.length),a=n,l=3432918353,u=461845907,p=0;p<s;)h=255&r.charCodeAt(p)|(255&r.charCodeAt(++p))<<8|(255&r.charCodeAt(++p))<<16|(255&r.charCodeAt(++p))<<24,++p,a=27492+(65535&(c=5*(65535&(a=(a^=h=(65535&(h=(h=(65535&h)*l+(((h>>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*u+(((h>>>16)*u&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(c>>>16)&65535)<<16);switch(h=0,o){case 3:h^=(255&r.charCodeAt(p+2))<<16;case 2:h^=(255&r.charCodeAt(p+1))<<8;case 1:a^=h=(65535&(h=(h=(65535&(h^=255&r.charCodeAt(p)))*l+(((h>>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*u+(((h>>>16)*u&65535)<<16)&4294967295}return a^=r.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}}(yf)),yf.exports),e=(_f||(_f=1,function(i){i.exports=function(r,n){for(var o,s=r.length,a=n^s,c=0;s>=4;)o=1540483477*(65535&(o=255&r.charCodeAt(c)|(255&r.charCodeAt(++c))<<8|(255&r.charCodeAt(++c))<<16|(255&r.charCodeAt(++c))<<24))+((1540483477*(o>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),s-=4,++c;switch(s){case 3:a^=(255&r.charCodeAt(c+2))<<16;case 2:a^=(255&r.charCodeAt(c+1))<<8;case 1:a=1540483477*(65535&(a^=255&r.charCodeAt(c)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}}(vf)),vf.exports);return po.exports=t,po.exports.murmur3=t,po.exports.murmur2=e,po.exports}(),Pv=ld(Sv);class pa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(xf(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let e=xf(t),i=0,r=this.ids.length-1;for(;i<r;){let o=i+r>>1;this.ids[o]>=e?r=o:i=o+1}let n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){let i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return jc(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){let e=new pa;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function xf(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Pv(String(t))}function jc(t,e,i,r){for(;i<r;){let n=t[i+r>>1],o=i-1,s=r+1;for(;;){do o++;while(t[o]<n);do s--;while(t[s]>n);if(o>=s)break;fa(t,o,s),fa(e,3*o,3*s),fa(e,3*o+1,3*s+1),fa(e,3*o+2,3*s+2)}s-i<r-s?(jc(t,e,i,s),i=s+1):(jc(t,e,s+1,r),r=s)}}function fa(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}U("FeaturePositionMap",pa);class di{constructor(t,e){this.gl=t.gl,this.location=e}}class tt extends di{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}}class B extends di{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class et extends di{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}}class Te extends di{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}}class Si extends di{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Pi extends di{constructor(t,e){super(t,e),this.current=Y.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}class Nc extends di{constructor(t,e){super(t,e),this.current=[]}set(t){if(t!=this.current){this.current=t;let e=new Float32Array(4*t.length);for(let i=0;i<t.length;i++)e[4*i]=t[i].r,e[4*i+1]=t[i].g,e[4*i+2]=t[i].b,e[4*i+3]=t[i].a;this.gl.uniform4fv(this.location,e)}}}class Vc extends di{constructor(t,e){super(t,e),this.current=[]}set(t){if(t!=this.current){this.current=t;let e=new Float32Array(t);this.gl.uniform1fv(this.location,e)}}}let Iv=new Float32Array(16);class Se extends di{constructor(t,e){super(t,e),this.current=Iv}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}}function Uc(t){return[ff(255*t.r,255*t.g),ff(255*t.b,255*t.a)]}class Xr{constructor(t,e,i){this.value=t,this.uniformNames=e.map((r)=>`u_${r}`),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return this.type==="color"?new Pi(t,e):new B(t,e)}}class Bi{constructor(t,e){this.uniformNames=e.map((i)=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,i,r){let n=null;r==="u_pattern_to"?n=this.patternTo:r==="u_pattern_from"?n=this.patternFrom:r==="u_dasharray_to"?n=this.dashTo:r==="u_dasharray_from"?n=this.dashFrom:r==="u_pixel_ratio_to"?n=this.pixelRatioTo:r==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new Si(t,e):new B(t,e)}}class pi{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((n)=>({name:`a_${n}`,type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(t,e,i){let r=this.paintVertexArray.length,n=this.expression.evaluate(new At(0,i),e,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(r,t,n)}updatePaintArray(t,e,i,r,n){let o=this.expression.evaluate(new At(0,n),i,r);this._setPaintValue(t,e,o)}_setPaintValue(t,e,i){if(this.type==="color"){let r=Uc(i);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){var e,i;((e=this.paintVertexArray)===null||e===void 0?void 0:e.arrayBuffer.byteLength)&&(((i=this.paintVertexBuffer)===null||i===void 0?void 0:i.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class qe{constructor(t,e,i,r,n,o){this.expression=t,this.uniformNames=e.map((s)=>`u_${s}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((s)=>({name:`a_${s}`,type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,i){let r=this.expression.evaluate(new At(this.zoom,i),e,{},i.canonical,[],i.formattedSection),n=this.expression.evaluate(new At(this.zoom+1,i),e,{},i.canonical,[],i.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,r,n)}updatePaintArray(t,e,i,r,n){let o=this.expression.evaluate(new At(this.zoom,n),i,r),s=this.expression.evaluate(new At(this.zoom+1,n),i,r);this._setPaintValue(t,e,o,s)}_setPaintValue(t,e,i,r){if(this.type==="color"){let n=Uc(i),o=Uc(r);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(t){var e,i;((e=this.paintVertexArray)===null||e===void 0?void 0:e.arrayBuffer.byteLength)&&(((i=this.paintVertexBuffer)===null||i===void 0?void 0:i.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=_t(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new B(t,e)}}class Ii{constructor(t,e,i,r,n,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,this.getPositionIds(e),i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,this.getPositionIds(i),n)}_setPaintValues(t,e,i,r){let n=this.getPositions(r);if(!n||!i)return;let o=n[i.min],s=n[i.mid],a=n[i.max];if(o&&s&&a)for(let c=t;c<e;c++)this.emplace(this.zoomInPaintVertexArray,c,s,o),this.emplace(this.zoomOutPaintVertexArray,c,s,a)}upload(t){var e,i;if(((e=this.zoomInPaintVertexArray)===null||e===void 0?void 0:e.arrayBuffer.byteLength)&&((i=this.zoomOutPaintVertexArray)===null||i===void 0?void 0:i.arrayBuffer.byteLength)){let r=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,r,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,r,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class $c extends Ii{getPositions(t){return t.imagePositions}getPositionIds(t){var e;return(e=t.patterns)===null||e===void 0?void 0:e[this.layerId]}getVertexAttributes(){return wv.members}emplace(t,e,i,r){t.emplace(e,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}}class Zc extends Ii{getPositions(t){return t.dashPositions}getPositionIds(t){var e;return(e=t.dashes)===null||e===void 0?void 0:e[this.layerId]}getVertexAttributes(){return Tv.members}emplace(t,e,i,r){t.emplace(e,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}}class Gc{constructor(t,e,i){this.binders={},this._buffers=[];let r=[];for(let n in t.paint._values){if(!i(n))continue;let o=t.paint.get(n);if(!(o instanceof ii&&Vr(o.property.specification)))continue;let s=Ev(n,t.type),a=o.value,c=o.property.specification.type,l=o.property.useIntegerZoom,u=o.property.specification["property-type"],h=u==="cross-faded"||u==="cross-faded-data-driven";if(a.kind==="constant")this.binders[n]=h?new Bi(a.value,s):new Xr(a.value,s,c),r.push(`/u_${n}`);else if(a.kind==="source"||h){let p=bf(n,c,"source");this.binders[n]=h?n==="line-dasharray"?new Zc(a,c,l,e,p,t.id):new $c(a,c,l,e,p,t.id):new pi(a,s,c,p),r.push(`/a_${n}`)}else{let p=bf(n,c,"composite");this.binders[n]=new qe(a,s,c,l,e,p),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){let e=this.binders[t];return e instanceof pi||e instanceof qe?e.maxValue:0}populatePaintArrays(t,e,i){for(let r in this.binders){let n=this.binders[r];(n instanceof pi||n instanceof qe||n instanceof Ii)&&n.populatePaintArray(t,e,i)}}setConstantPatternPositions(t,e){for(let i in this.binders){let r=this.binders[i];r instanceof Bi&&r.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let i in this.binders){let r=this.binders[i];r instanceof Bi&&r.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let o=!1;for(let s in t){let a=e.getPositions(s);for(let c of a){let l=i.feature(c.index);for(let u in this.binders){let h=this.binders[u];if((h instanceof pi||h instanceof qe||h instanceof Ii)&&h.expression.isStateDependent===!0){let p=r.paint.get(u);h.expression=p.value,h.updatePaintArray(c.start,c.end,l,t[s],n),o=!0}}}}return o}defines(){let t=[];for(let e in this.binders){let i=this.binders[e];(i instanceof Xr||i instanceof Bi)&&t.push(...i.uniformNames.map((r)=>`#define HAS_UNIFORM_${r}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let i=this.binders[e];if(i instanceof pi||i instanceof qe)for(let r of i.paintVertexAttributes)t.push(r.name);else if(i instanceof Ii){let r=i.getVertexAttributes();for(let n of r)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let i=this.binders[e];if(i instanceof Xr||i instanceof Bi||i instanceof qe)for(let r of i.uniformNames)t.push(r)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Xr||n instanceof Bi||n instanceof qe){for(let o of n.uniformNames)if(e[o]){let s=n.getBinding(t,e[o],o);i.push({name:o,property:r,binding:s})}}}return i}setUniforms(t,e,i,r){for(let{name:n,property:o,binding:s}of e)this.binders[o].setUniform(s,r,i.get(o),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let i=this.binders[e];if(t&&i instanceof Ii){let r=t.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof pi||i instanceof qe)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(let e in this.binders){let i=this.binders[e];(i instanceof pi||i instanceof qe||i instanceof Ii)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof pi||e instanceof qe||e instanceof Ii)&&e.destroy()}}}class Oi{constructor(t,e,i=()=>!0){this.programConfigurations={};for(let r of t)this.programConfigurations[r.id]=new Gc(r,e,i);this.needsUpload=!1,this._featureMap=new pa,this._bufferOffset=0}populatePaintArrays(t,e,i,r){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,r);e.id!==void 0&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(let n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ev(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-dasharray":["dasharray_to","dasharray_from"],"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(`${e}-`,"").replace(/-/g,"_")]}function bf(t,e,i){let r={color:{source:Hr,composite:ua},number:{source:uo,composite:Hr}},n=function(o){return{"line-pattern":{source:or,composite:or},"fill-pattern":{source:or,composite:or},"fill-extrusion-pattern":{source:or,composite:or},"line-dasharray":{source:Bc,composite:Bc}}[o]}(t);return(n==null?void 0:n[i])||r[e][i]}U("ConstantBinder",Xr),U("CrossFadedConstantBinder",Bi),U("SourceExpressionBinder",pi),U("CrossFadedPatternBinder",$c),U("CrossFadedDasharrayBinder",Zc),U("CompositeExpressionBinder",qe),U("ProgramConfiguration",Gc,{omit:["_buffers"]}),U("ProgramConfigurationSet",Oi);let qc=Math.pow(2,14)-1,wf=-qc-1;function sr(t){let e=F/t.extent,i=t.loadGeometry();for(let r of i)for(let n of r){let o=Math.round(n.x*e),s=Math.round(n.y*e);n.x=_t(o,wf,qc),n.y=_t(s,wf,qc),(o<n.x||o>n.x+1||s<n.y||s>n.y+1)&&Ct("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function ar(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?sr(t):[]}}let Tf=-32768;function Mv(t,e,i,r,n){t.emplaceBack(Tf+8*e+r,Tf+8*i+n)}class ma{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new ef,this.indexArray=new Ge,this.segments=new xt,this.programConfigurations=new Oi(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){let r=this.layers[0],n=[],o=null,s=!1,a=r.type==="heatmap";if(r.type==="circle"){let l=r;o=l.layout.get("circle-sort-key"),s=!o.isConstant(),a||(a=l.paint.get("circle-pitch-alignment")==="map")}let c=a?e.subdivisionGranularity.circle:1;for(let{feature:l,id:u,index:h,sourceLayerIndex:p}of t){let d=this.layers[0]._featureFilter.needGeometry,f=ar(l,d);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),f,i))continue;let m=s?o.evaluate(f,{},i):void 0,_={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:d?f.geometry:sr(l),patterns:{},sortKey:m};n.push(_)}s&&n.sort((l,u)=>l.sortKey-u.sortKey);for(let l of n){let{geometry:u,index:h,sourceLayerIndex:p}=l,d=t[h].feature;this.addFeature(l,u,h,i,c),e.featureIndex.insert(d,u,h,p,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,bv),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=o.length;for(let a of e)for(let c of a){let{x:l,y:u}=c;if(l<0||l>=F||u<0||u>=F)continue;let h=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=h.vertexLength;for(let d=0;d<s;d++)for(let f=0;f<s;f++)Mv(this.layoutVertexArray,l,u,o[f],o[d]);for(let d=0;d<s-1;d++)for(let f=0;f<s-1;f++){let m=p+d*s+f,_=p+(d+1)*s+f;this.indexArray.emplaceBack(m,_+1,m+1),this.indexArray.emplaceBack(m,_,_+1)}h.vertexLength+=s*s,h.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:{},canonical:r})}}function Sf(t,e){for(let i of t)if(Yr(e,i))return!0;for(let i of e)if(Yr(t,i))return!0;return Wc(t,e)}function _a(t,e,i){return!!Yr(t,e)||Hc(e,t,i)}function Pf(t,e){if(t.length===1)return If(e,t[0]);for(let i of e)for(let r of i)if(Yr(t,r))return!0;for(let i of t)if(If(e,i))return!0;for(let i of e)if(Wc(t,i))return!0;return!1}function Cv(t,e,i){if(t.length>1){if(Wc(t,e))return!0;for(let r of e)if(Hc(r,t,i))return!0}for(let r of t)if(Hc(r,e,i))return!0;return!1}function Wc(t,e){if(t.length===0||e.length===0)return!1;for(let i=0;i<t.length-1;i++){let r=t[i],n=t[i+1];for(let o=0;o<e.length-1;o++)if(Av(r,n,e[o],e[o+1]))return!0}return!1}function Av(t,e,i,r){return Di(t,i,r)!==Di(e,i,r)&&Di(t,e,i)!==Di(t,e,r)}function Hc(t,e,i){let r=i*i;if(e.length===1)return t.distSqr(e[0])<r;for(let n=1;n<e.length;n++)if(zv(t,e[n-1],e[n])<r)return!0;return!1}function zv(t,e,i){let r=e.distSqr(i);if(r===0)return t.distSqr(e);let n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function If(t,e){let i,r,n,o=!1;for(let s of t){i=s;for(let a=0,c=i.length-1;a<i.length;c=a++)r=i[a],n=i[c],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function Yr(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){let o=t[r],s=t[n];o.y>e.y!=s.y>e.y&&e.x<(s.x-o.x)*(e.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function Dv(t,e,i){let r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;let o=Di(t,e,i[0]);return o!==Di(t,e,i[1])||o!==Di(t,e,i[2])||o!==Di(t,e,i[3])}function Kr(t,e,i){let r=e.paint.get(t).value;return r.kind==="constant"?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function ga(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ya(t,e,i,r,n){if(!e[0]&&!e[1])return t;let o=z.convert(e)._mult(n);i==="viewport"&&o._rotate(-r);let s=[];for(let a of t)s.push(a.sub(o));return s}function Rv(t){let e=[];for(let i=0;i<t.length;i++){let r=t[i],n=e.at(-1);(i===0||n&&!r.equals(n))&&e.push(r)}return e}function kv({queryGeometry:t,size:e},i){return _a(t,i,e)}function Lv({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},o){return _a(t,o,e*(i.projectTileCoordinates(o.x,o.y,r,n).signedDistanceFromCamera/i.cameraToCenterDistance))}function Fv({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},o){let s=i.projectTileCoordinates(o.x,o.y,r,n).signedDistanceFromCamera,a=e*(i.cameraToCenterDistance/s);return _a(t,Xc(o,i,r,n),a)}function Bv({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},o){return _a(t,Xc(o,i,r,n),e)}function Ef({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n,pitchAlignment:o="map",pitchScale:s="map"},a){let c=o==="map"?s==="map"?kv:Lv:s==="map"?Fv:Bv,l={queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n};for(let u of a)for(let h of u)if(c(l,h))return!0;return!1}function Xc(t,e,i,r){let n=e.projectTileCoordinates(t.x,t.y,i,r).point;return new z((0.5*n.x+0.5)*e.width,(0.5*-n.y+0.5)*e.height)}let Mf,Cf;U("CircleBucket",ma,{omit:["layers"]});var Ov={get paint(){return Cf=Cf||new ee({"circle-radius":new K(D.paint_circle["circle-radius"]),"circle-color":new K(D.paint_circle["circle-color"]),"circle-blur":new K(D.paint_circle["circle-blur"]),"circle-opacity":new K(D.paint_circle["circle-opacity"]),"circle-translate":new Z(D.paint_circle["circle-translate"]),"circle-translate-anchor":new Z(D.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Z(D.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Z(D.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new K(D.paint_circle["circle-stroke-width"]),"circle-stroke-color":new K(D.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new K(D.paint_circle["circle-stroke-opacity"])})},get layout(){return Mf=Mf||new ee({"circle-sort-key":new K(D.layout_circle["circle-sort-key"])})}};class Af extends Ze{constructor(t,e){super(t,Ov,e)}createBucket(t){return new ma(t)}queryRadius(t){let e=t;return Kr("circle-radius",this,e)+Kr("circle-stroke-width",this,e)+ga(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:a}){let c=ya(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),l=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment"),p,d;return h==="map"?(p=c,d=l*o):(p=function(f,m,_,y){return f.map((v)=>Xc(v,m,_,y))}(c,n,s,a),d=l),Ef({queryGeometry:p,size:d,transform:n,unwrappedTileID:s,getElevation:a,pitchAlignment:h,pitchScale:u},r)}}class Yc extends ma{}let zf;U("HeatmapBucket",Yc,{omit:["layers"]});var jv={get paint(){return zf=zf||new ee({"heatmap-radius":new K(D.paint_heatmap["heatmap-radius"]),"heatmap-weight":new K(D.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Z(D.paint_heatmap["heatmap-intensity"]),"heatmap-color":new lo(D.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Z(D.paint_heatmap["heatmap-opacity"])})}};function Kc(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function Df(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;let n=Kc({},{width:e,height:i},r);Jc(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function Jc(t,e,i,r,n,o){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,a=e.data;if(s===a)throw Error("srcData equals dstData, so image is already copied");for(let c=0;c<n.height;c++){let l=((i.y+c)*t.width+i.x)*o,u=((r.y+c)*e.width+r.x)*o;for(let h=0;h<n.width*o;h++)a[u+h]=s[l+h]}return e}class fo{constructor(t,e){Kc(this,t,1,e)}resize(t){Df(this,t,1)}clone(){return new fo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Jc(t,e,i,r,n,1)}}class It{constructor(t,e){Kc(this,t,4,e)}resize(t){Df(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new It({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Jc(t,e,i,r,n,4)}setPixel(t,e,i){let r=4*(t*this.width+e);this.data[r+0]=Math.round(255*i.r/i.a),this.data[r+1]=Math.round(255*i.g/i.a),this.data[r+2]=Math.round(255*i.b/i.a),this.data[r+3]=Math.round(255*i.a)}}function Rf(t){let e=new Uint8Array(t.length);for(let i=0;i<t.length;i+=4){let r=t[i+3];e[i+0]=Math.round(t[i+0]*r/255),e[i+1]=Math.round(t[i+1]*r/255),e[i+2]=Math.round(t[i+2]*r/255),e[i+3]=r}return e}function kf(t){let e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new It({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${i}`);let o=(s,a,c)=>{e[t.evaluationKey]=c;let l=t.expression.evaluate(e);n.setPixel(s/4/i,a/4,l)};if(t.clips)for(let s=0,a=0;s<r;++s,a+=4*i)for(let c=0,l=0;c<i;c++,l+=4){let u=c/(i-1),{start:h,end:p}=t.clips[s];o(a,l,h*(1-u)+p*u)}else for(let s=0,a=0;s<i;s++,a+=4)o(0,a,s/(i-1));return n}U("AlphaImage",fo),U("RGBAImage",It);let mo="big-fb";class Lf extends Ze{createBucket(t){return new Yc(t)}constructor(t,e){super(t,jv,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=kf({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(mo)&&this.heatmapFbos.delete(mo)}queryRadius(t){return Kr("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:a}){return Ef({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(e,i)*o,transform:n,unwrappedTileID:s,getElevation:a},r)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let Ff;var Nv={get paint(){return Ff=Ff||new ee({"hillshade-illumination-direction":new Z(D.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Z(D.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Z(D.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Z(D.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Z(D.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Z(D.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Z(D.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Z(D.paint_hillshade["hillshade-method"]),resampling:new Z(D.paint_hillshade.resampling)})}};class Bf extends Ze{constructor(t,e){super(t,Nv,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,i.length,r.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));let o=e.map(Vt);return{directionRadians:t.map(Vt),altitudeRadians:o,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Of;var Vv={get paint(){return Of=Of||new ee({"color-relief-opacity":new Z(D["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new lo(D["paint_color-relief"]["color-relief-color"]),resampling:new Z(D["paint_color-relief"].resampling)})}};function jf(t){return"data"in t}class jt{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,r)}update(t,e,i){var r;let{width:n,height:o}=t,s=(((r=this.size)===null||r===void 0?void 0:r[0])!==n||this.size[1]!==o)&&!i,{context:a}=this,{gl:c}=a;this.useMipmap=Boolean(e==null?void 0:e.useMipmap),c.bindTexture(c.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1);let l=this.format===c.RGBA&&(e==null?void 0:e.premultiply)!==!1;if(s)this.size=[n,o],jf(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,n,o,c)):(a.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,c));else{let{x:u,y:h}=i||{x:0,y:0};jf(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,u,h,n,o,c)):(a.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,u,h,c))}this.useMipmap&&this.isSizePowerOfTwo()&&c.generateMipmap(c.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,i,r,n){let{data:o}=t;e&&o&&(o=Rf(o)),n.texImage2D(n.TEXTURE_2D,0,this.format,i,r,0,this.format,n.UNSIGNED_BYTE,o)}_updateDomImage(t,e,i,r){r.texSubImage2D(r.TEXTURE_2D,0,e,i,r.RGBA,r.UNSIGNED_BYTE,t)}_updateRawData(t,e,i,r,n,o,s){let{data:a}=t;e&&a&&(a=Rf(a)),s.texSubImage2D(s.TEXTURE_2D,0,i,r,n,o,s.RGBA,s.UNSIGNED_BYTE,a)}bind(t,e,i){let{context:r}=this,{gl:n}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}function Nf(t,e){let i=e[0],r=e[1],n=e[2],o=e[3],s=Math.min(i,r,n),a=Math.round((t+o)/s);return{r:Math.floor(a*s/i)%256,g:Math.floor(a*s/r)%256,b:Math.floor(a*s/n)%256}}U("DEMData",class{constructor(t,e,i,r=1,n=1,o=1,s=0){if(this.uid=t,e.height!==e.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void Ct(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;let a=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=0.00390625,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=o,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=0.1,this.baseShift=1e4}for(let c=0;c<a;c++)this.data[this._idx(-1,c)]=this.data[this._idx(0,c)],this.data[this._idx(a,c)]=this.data[this._idx(a-1,c)],this.data[this._idx(c,-1)]=this.data[this._idx(c,0)],this.data[this._idx(c,a)]=this.data[this._idx(c,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let c=0;c<a;c++)for(let l=0;l<a;l++){let u=this.get(c,l);u>this.max&&(this.max=u),u<this.min&&(this.min=u)}}get(t,e){let i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${e}, dim: ${this.dim}`);return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return Nf(t,this.getUnpackVector())}getPixels(){return new It({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}let a=-e*this.dim,c=-i*this.dim;for(let l=o;l<s;l++)for(let u=r;u<n;u++)this.data[this._idx(u,l)]=t.data[this._idx(u+a,l+c)]}});class Vf extends Ze{constructor(t,e){super(t,Vv,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof Kn&&i._styleExpression.expression instanceof we){this.colorRampExpression=i;let o=i._styleExpression.expression;e.elevationStops=o.labels,e.colorStops=[];for(let s of e.elevationStops)e.colorStops.push(o.evaluate({globals:{elevation:s}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[Y.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;let r={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let o=0;o<e.elevationStops.length-0.5;o+=n)r.elevationStops.push(e.elevationStops[Math.round(o)]),r.colorStops.push(e.colorStops[Math.round(o)]);return Ct(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(e),n=new It({width:r.colorStops.length,height:1}),o=new It({width:r.colorStops.length,height:1});for(let s=0;s<r.elevationStops.length;s++){let a=Nf(r.elevationStops[s],i);o.setPixel(0,s,new Y(a.r/255,a.g/255,a.b/255,1)),n.setPixel(0,s,r.colorStops[s])}return this.colorRampTextures={elevationTexture:new jt(t,o,t.gl.RGBA),colorTexture:new jt(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let Uv=Bt([{name:"a_pos",components:2,type:"Int16"}],4),{members:$v}=Uv;function va(t,e,i){let r=i.patternDependencies,n=!1;for(let o of e){let s=o.paint.get(`${t}-pattern`);s.isConstant()||(n=!0);let a=s.constantOr(null);a&&(n=!0,r[a.to]=!0,r[a.from]=!0)}return n}function Qc(t,e,i,r,n){let{zoom:o}=r,s=n.patternDependencies;for(let a of e){let c=a.paint.get(`${t}-pattern`).value;if(c.kind!=="constant"){let l=c.evaluate({zoom:o-1},i,{},n.availableImages),u=c.evaluate({zoom:o},i,{},n.availableImages),h=c.evaluate({zoom:o+1},i,{},n.availableImages);l=(l==null?void 0:l.name)?l.name:l,u=(u==null?void 0:u.name)?u.name:u,h=(h==null?void 0:h.name)?h.name:h,s[l]=!0,s[u]=!0,s[h]=!0,i.patterns[a.id]={min:l,mid:u,max:h}}}return i}function Uf(t,e,i,r,n){let o;if(n===function(s,a,c,l){let u=0;for(let h=a,p=c-l;h<c;h+=l)u+=(s[p]-s[h])*(s[h+1]+s[p+1]),p=h;return u}(t,e,i,r)>0)for(let s=e;s<i;s+=r)o=qf(s/r|0,t[s],t[s+1],o);else for(let s=i-r;s>=e;s-=r)o=qf(s/r|0,t[s],t[s+1],o);return o&&Jr(o,o.next)&&(vo(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let i,r=t;do if(i=!1,r.steiner||!Jr(r,r.next)&&Nt(r.prev,r,r.next)!==0)r=r.next;else{if(vo(r),r=e=r.prev,r===r.next)break;i=!0}while(i||r!==e);return e}function _o(t,e,i,r,n,o,s){if(!t)return;!s&&o&&function(c,l,u,h){let p=c;do p.z===0&&(p.z=th(p.x,p.y,l,u,h)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next;while(p!==c);p.prevZ.nextZ=null,p.prevZ=null,function(d){let f,m=1;do{let _,y=d;d=null;let v=null;for(f=0;y;){f++;let g=y,x=0;for(let w=0;w<m&&(x++,g=g.nextZ,g);w++);let b=m;for(;x>0||b>0&&g;)x!==0&&(b===0||!g||y.z<=g.z)?(_=y,y=y.nextZ,x--):(_=g,g=g.nextZ,b--),v?v.nextZ=_:d=_,_.prevZ=v,v=_;y=g}v.nextZ=null,m*=2}while(f>1)}(p)}(t,r,n,o);let a=t;for(;t.prev!==t.next;){let c=t.prev,l=t.next;if(o?Gv(t,r,n,o):Zv(t))e.push(c.i,t.i,l.i),vo(t),t=l.next,a=l.next;else if((t=l)===a){s?s===1?_o(t=qv(lr(t),e),e,i,r,n,o,2):s===2&&Wv(t,e,i,r,n,o):_o(lr(t),e,i,r,n,o,1);break}}}function Zv(t){let e=t.prev,i=t,r=t.next;if(Nt(e,i,r)>=0)return!1;let n=e.x,o=i.x,s=r.x,a=e.y,c=i.y,l=r.y,u=Math.min(n,o,s),h=Math.min(a,c,l),p=Math.max(n,o,s),d=Math.max(a,c,l),f=r.next;for(;f!==e;){if(f.x>=u&&f.x<=p&&f.y>=h&&f.y<=d&&go(n,a,o,c,s,l,f.x,f.y)&&Nt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Gv(t,e,i,r){let n=t.prev,o=t,s=t.next;if(Nt(n,o,s)>=0)return!1;let a=n.x,c=o.x,l=s.x,u=n.y,h=o.y,p=s.y,d=Math.min(a,c,l),f=Math.min(u,h,p),m=Math.max(a,c,l),_=Math.max(u,h,p),y=th(d,f,e,i,r),v=th(m,_,e,i,r),{prevZ:g,nextZ:x}=t;for(;g&&g.z>=y&&x&&x.z<=v;){if(g.x>=d&&g.x<=m&&g.y>=f&&g.y<=_&&g!==n&&g!==s&&go(a,u,c,h,l,p,g.x,g.y)&&Nt(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&go(a,u,c,h,l,p,x.x,x.y)&&Nt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=d&&g.x<=m&&g.y>=f&&g.y<=_&&g!==n&&g!==s&&go(a,u,c,h,l,p,g.x,g.y)&&Nt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=v;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&go(a,u,c,h,l,p,x.x,x.y)&&Nt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function qv(t,e){let i=t;do{let r=i.prev,n=i.next.next;!Jr(r,n)&&Zf(r,i,i.next,n)&&yo(r,n)&&yo(n,r)&&(e.push(r.i,i.i,n.i),vo(i),vo(i.next),i=t=n),i=i.next}while(i!==t);return lr(i)}function Wv(t,e,i,r,n,o){let s=t;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Jv(s,a)){let c=Gf(s,a);return s=lr(s,s.next),c=lr(c,c.next),_o(s,e,i,r,n,o,0),void _o(c,e,i,r,n,o,0)}a=a.next}s=s.next}while(s!==t)}function Hv(t,e){let i=t.x-e.x;return i===0&&(i=t.y-e.y,i===0)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function Xv(t,e){let i=function(n,o){let s=o,{x:a,y:c}=n,l,u=-1/0;if(Jr(n,s))return s;do{if(Jr(n,s.next))return s.next;if(c<=s.y&&c>=s.next.y&&s.next.y!==s.y){let m=s.x+(c-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(m<=a&&m>u&&(u=m,l=s.x<s.next.x?s:s.next,m===a))return l}s=s.next}while(s!==o);if(!l)return null;let h=l,p=l.x,d=l.y,f=1/0;s=l;do{if(a>=s.x&&s.x>=p&&a!==s.x&&$f(c<d?a:u,c,p,d,c<d?u:a,c,s.x,s.y)){let m=Math.abs(c-s.y)/(a-s.x);yo(s,n)&&(m<f||m===f&&(s.x>l.x||s.x===l.x&&Yv(l,s)))&&(l=s,f=m)}s=s.next}while(s!==h);return l}(t,e);if(!i)return e;let r=Gf(i,t);return lr(r,r.next),lr(i,i.next)}function Yv(t,e){return Nt(t.prev,t,e.prev)<0&&Nt(e.next,t,t.next)<0}function th(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Kv(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function $f(t,e,i,r,n,o,s,a){return(n-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(i-s)*(e-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function go(t,e,i,r,n,o,s,a){return!(t===s&&e===a)&&$f(t,e,i,r,n,o,s,a)}function Jv(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,r){let n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&Zf(n,n.next,i,r))return!0;n=n.next}while(n!==i);return!1}(t,e)&&(yo(t,e)&&yo(e,t)&&function(i,r){let n=i,o=!1,s=(i.x+r.x)/2,a=(i.y+r.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&s<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==i);return o}(t,e)&&(Nt(t.prev,t,e.prev)||Nt(t,e.prev,e))||Jr(t,e)&&Nt(t.prev,t,t.next)>0&&Nt(e.prev,e,e.next)>0)}function Nt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Jr(t,e){return t.x===e.x&&t.y===e.y}function Zf(t,e,i,r){let n=ba(Nt(t,e,i)),o=ba(Nt(t,e,r)),s=ba(Nt(i,r,t)),a=ba(Nt(i,r,e));return n!==o&&s!==a||!(n!==0||!xa(t,i,e))||!(o!==0||!xa(t,r,e))||!(s!==0||!xa(i,t,r))||!(a!==0||!xa(i,e,r))}function xa(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ba(t){return t>0?1:t<0?-1:0}function yo(t,e){return Nt(t.prev,t,t.next)<0?Nt(t,e,t.next)>=0&&Nt(t,t.prev,e)>=0:Nt(t,e,t.prev)<0||Nt(t,t.next,e)<0}function Gf(t,e){let i=eh(t.i,t.x,t.y),r=eh(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function qf(t,e,i,r){let n=eh(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function vo(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 eh(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class fi{constructor(t,e){if(e>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Qr{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Qr.noSubdivision=new Qr({fill:new fi(0,0),line:new fi(0,0),tile:new fi(0,0),stencil:new fi(0,0),circle:1}),U("SubdivisionGranularityExpression",fi),U("SubdivisionGranularitySetting",Qr);let cr=-32768,tn=32767;class Wf{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=F/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=0|Math.round(t),r=0|Math.round(e),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(r,n){let o=[];for(let s=0;s<n.length;s+=3){let a=n[s],c=n[s+1],l=n[s+2],u=r[2*a],h=r[2*a+1];(r[2*c]-u)*(r[2*l+1]-h)-(r[2*c+1]-h)*(r[2*l]-u)>0?(o.push(a),o.push(l),o.push(c)):(o.push(a),o.push(c),o.push(l))}return o}(this._vertexBuffer,t);let e=[],i=t.length;for(let r=0;r<i;r+=3){let n=[t[r+0],t[r+1],t[r+2]],o=[this._vertexBuffer[2*t[r+0]+0],this._vertexBuffer[2*t[r+0]+1],this._vertexBuffer[2*t[r+1]+0],this._vertexBuffer[2*t[r+1]+1],this._vertexBuffer[2*t[r+2]+0],this._vertexBuffer[2*t[r+2]+1]],s=1/0,a=1/0,c=-1/0,l=-1/0;for(let f=0;f<3;f++){let m=o[2*f],_=o[2*f+1];s=Math.min(s,m),c=Math.max(c,m),a=Math.min(a,_),l=Math.max(l,_)}if(s===c||a===l)continue;let u=Math.floor(s/this._granularityCellSize),h=Math.ceil(c/this._granularityCellSize),p=Math.floor(a/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(u!==h||p!==d)for(let f=p;f<d;f++){let m=this._scanlineGenerateVertexRingForCellRow(f,o,n);Qv(this._vertexBuffer,m,e)}else e.push(...n)}return e}_scanlineGenerateVertexRingForCellRow(t,e,i){let r=t*this._granularityCellSize,n=r+this._granularityCellSize,o=[];for(let s=0;s<3;s++){let a=e[2*s],c=e[2*s+1],l=e[2*(s+1)%6],u=e[(2*(s+1)+1)%6],h=e[2*(s+2)%6],p=e[(2*(s+2)+1)%6],d=l-a,f=u-c,m=d===0,_=f===0,y=(r-c)/f,v=(n-c)/f,g=Math.min(y,v),x=Math.max(y,v);if(!_&&(g>=1||x<=0)||_&&(c<r||c>n)){u>=r&&u<=n&&o.push(i[(s+1)%3]);continue}!_&&g>0&&o.push(this._vertexToIndex(a+d*g,c+f*g));let b=a+d*Math.max(g,0),w=a+d*Math.min(x,1);m||this._generateIntraEdgeVertices(o,a,c,l,u,b,w),!_&&x<1&&o.push(this._vertexToIndex(a+d*x,c+f*x)),(_||u>=r&&u<=n)&&o.push(i[(s+1)%3]),!_&&(u<=r||u>=n)&&this._generateInterEdgeVertices(o,a,c,l,u,h,p,w,r,n)}return o}_generateIntraEdgeVertices(t,e,i,r,n,o,s){let a=r-e,c=n-i,l=c===0,u=l?Math.min(e,r):Math.min(o,s),h=l?Math.max(e,r):Math.max(o,s),p=Math.floor(u/this._granularityCellSize)+1,d=Math.ceil(h/this._granularityCellSize)-1;if(l?e<r:o<s)for(let f=p;f<=d;f++){let m=f*this._granularityCellSize;t.push(this._vertexToIndex(m,i+c*(m-e)/a))}else for(let f=d;f>=p;f--){let m=f*this._granularityCellSize;t.push(this._vertexToIndex(m,i+c*(m-e)/a))}}_generateInterEdgeVertices(t,e,i,r,n,o,s,a,c,l){let u=n-i,h=o-r,p=s-n,d=(c-n)/p,f=(l-n)/p,m=Math.min(d,f),_=Math.max(d,f),y=r+h*m,v=Math.floor(Math.min(y,a)/this._granularityCellSize)+1,g=Math.ceil(Math.max(y,a)/this._granularityCellSize)-1,x=a<y,b=p===0;if(b&&(s===c||s===l))return;if(b||m>=1||_<=0){let T=i-s,P=o+(e-o)*Math.min((c-s)/T,(l-s)/T);v=Math.floor(Math.min(P,a)/this._granularityCellSize)+1,g=Math.ceil(Math.max(P,a)/this._granularityCellSize)-1,x=a<P}let w=u>0?l:c;if(x)for(let T=v;T<=g;T++)t.push(this._vertexToIndex(T*this._granularityCellSize,w));else for(let T=g;T>=v;T--)t.push(this._vertexToIndex(T*this._granularityCellSize,w))}_generateOutline(t){let e=[];for(let i of t){let r=ih(i,this._granularity,!0),n=this._pointArrayToIndices(r),o=[];for(let s=1;s<n.length;s++)o.push(n[s-1]),o.push(n[s]);e.push(o)}return e}_handlePoles(t){let e=!1,i=!1;this._canonical&&(this._canonical.y===0&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(e||i)&&this._fillPoles(t,e,i)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){let i=t[e+1];i===cr&&(t[e+1]=-32767),i===tn&&(t[e+1]=32766)}}_generatePoleQuad(t,e,i,r,n,o){r>n!=(o===cr)?(t.push(e),t.push(i),t.push(this._vertexToIndex(r,o)),t.push(i),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(r,o))):(t.push(i),t.push(e),t.push(this._vertexToIndex(r,o)),t.push(this._vertexToIndex(n,o)),t.push(i),t.push(this._vertexToIndex(r,o)))}_fillPoles(t,e,i){let r=this._vertexBuffer,n=F,o=t.length;for(let s=2;s<o;s+=3){let a=t[s-2],c=t[s-1],l=t[s],u=r[2*a],h=r[2*a+1],p=r[2*c],d=r[2*c+1],f=r[2*l],m=r[2*l+1];e&&(h===0&&d===0&&this._generatePoleQuad(t,a,c,u,p,cr),d===0&&m===0&&this._generatePoleQuad(t,c,l,p,f,cr),m===0&&h===0&&this._generatePoleQuad(t,l,a,f,u,cr)),i&&(h===n&&d===n&&this._generatePoleQuad(t,a,c,u,p,tn),d===n&&m===n&&this._generatePoleQuad(t,c,l,p,f,tn),m===n&&h===n&&this._generatePoleQuad(t,l,a,f,u,tn))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:r}=function(s){let a=[],c=[];for(let l of s)if(l.length!==0){l!==s[0]&&a.push(c.length/2);for(let u of l)c.push(u.x),c.push(u.y)}return{flattened:c,holeIndices:a}}(t),n;this._initializeVertices(i);try{let s=function(c,l,u=2){let h=l&&l.length,p=h?l[0]*u:c.length,d=Uf(c,0,p,u,!0),f=[];if(!d||d.next===d.prev)return f;let m,_,y;if(h&&(d=function(v,g,x,b){let w=[];for(let T=0,P=g.length;T<P;T++){let S=Uf(v,g[T]*b,T<P-1?g[T+1]*b:v.length,b,!1);S===S.next&&(S.steiner=!0),w.push(Kv(S))}w.sort(Hv);for(let T=0;T<w.length;T++)x=Xv(w[T],x);return x}(c,l,d,u)),c.length>80*u){m=c[0],_=c[1];let v=m,g=_;for(let x=u;x<p;x+=u){let b=c[x],w=c[x+1];b<m&&(m=b),w<_&&(_=w),b>v&&(v=b),w>g&&(g=w)}y=Math.max(v-m,g-_),y=y!==0?32767/y:0}return _o(d,f,u,m,_,y,0),f}(i,r),a=this._convertIndices(i,s);n=this._subdivideTrianglesScanline(a)}catch(s){console.error(s)}let o=[];return e&&(o=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(t,e){let i=[];for(let r of e)i.push(this._vertexToIndex(t[2*r],t[2*r+1]));return i}_pointArrayToIndices(t){let e=[];for(let i of t)e.push(this._vertexToIndex(i.x,i.y));return e}}function Hf(t,e,i,r=!0){return new Wf(i,e).subdividePolygonInternal(t,r)}function ih(t,e,i=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let r=t[0],n=t[t.length-1],o=i&&(r.x!==n.x||r.y!==n.y);if(e<2)return o?[...t,t[0]]:[...t];let s=Math.floor(F/e),a=[];a.push(new z(t[0].x,t[0].y));let c=t.length,l=o?c:c-1;for(let u=0;u<l;u++){let h=t[u],p=u<c-1?t[u+1]:t[0],{x:d,y:f}=h,{x:m,y:_}=p,y=d!==m,v=f!==_;if(!y&&!v)continue;let g=m-d,x=_-f,b=Math.abs(g),w=Math.abs(x),T=d,P=f;for(;;){let E=g>0?(Math.floor(T/s)+1)*s:(Math.ceil(T/s)-1)*s,I=x>0?(Math.floor(P/s)+1)*s:(Math.ceil(P/s)-1)*s,C=Math.abs(T-E),A=Math.abs(P-I),M=Math.abs(T-m),k=Math.abs(P-_),L=y?C/b:Number.POSITIVE_INFINITY,O=v?A/w:Number.POSITIVE_INFINITY;if((M<=C||!y)&&(k<=A||!v))break;if(L<O&&y||!v){T=E,P+=x*L;let q=new z(T,Math.round(P));a[a.length-1].x===q.x&&a[a.length-1].y===q.y||a.push(q)}else{T+=g*O,P=I;let q=new z(Math.round(T),P);a[a.length-1].x===q.x&&a[a.length-1].y===q.y||a.push(q)}}let S=new z(m,_);a[a.length-1].x===S.x&&a[a.length-1].y===S.y||a.push(S)}return a}function Qv(t,e,i){if(e.length===0)throw Error("Subdivision vertex ring is empty.");let r=0,n=t[2*e[0]];for(let c=1;c<e.length;c++){let l=t[2*e[c]];l<n&&(n=l,r=c)}let o=e.length,s=r,a=(s+1)%o;for(;;){let c=s-1>=0?s-1:o-1,l=(a+1)%o,u=t[2*e[c]],h=t[2*e[l]],p=t[2*e[s]],d=t[2*e[s]+1],f=t[2*e[a]+1],m=!1;if(u<h)m=!0;else if(u>h)m=!1;else{let _=f-d,y=-(t[2*e[a]]-p),v=d<f?1:-1;((u-p)*_+(t[2*e[c]+1]-d)*y)*v>((h-p)*_+(t[2*e[l]+1]-d)*y)*v&&(m=!0)}if(m){let _=e[c],y=e[s],v=e[a];_!==y&&_!==v&&y!==v&&i.push(v,y,_),s--,s<0&&(s=o-1)}else{let _=e[l],y=e[s],v=e[a];_!==y&&_!==v&&y!==v&&i.push(v,y,_),a++,a>=o&&(a=0)}if(c===l)break}}function Xf(t,e,i,r,n,o,s,a,c){let l=n.length/2,u=s&&a&&c;if(l<xt.MAX_VERTEX_ARRAY_LENGTH){let h=e.prepareSegment(l,i,r),p=h.vertexLength;for(let m=0;m<o.length;m+=3)r.emplaceBack(p+o[m],p+o[m+1],p+o[m+2]);let d,f;h.vertexLength+=l,h.primitiveLength+=o.length/3,u&&(f=s.prepareSegment(l,i,a),d=f.vertexLength,f.vertexLength+=l);for(let m=0;m<n.length;m+=2)t(n[m],n[m+1]);if(u)for(let m of c){for(let _=1;_<m.length;_+=2)a.emplaceBack(d+m[_-1],d+m[_]);f.primitiveLength+=m.length/2}}else(function(h,p,d,f,m,_){let y=[];for(let w=0;w<f.length/2;w++)y.push(-1);let v={count:0},g=0,x=h.getOrCreateLatestSegment(p,d),b=x.vertexLength;for(let w=2;w<m.length;w+=3){let T=m[w-2],P=m[w-1],S=m[w],E=y[T]<g,I=y[P]<g,C=y[S]<g;x.vertexLength+((E?1:0)+(I?1:0)+(C?1:0))>xt.MAX_VERTEX_ARRAY_LENGTH&&(x=h.createNewSegment(p,d),g=v.count,E=!0,I=!0,C=!0,b=0);let A=xo(y,f,_,v,T,E,x),M=xo(y,f,_,v,P,I,x),k=xo(y,f,_,v,S,C,x);d.emplaceBack(b+A-g,b+M-g,b+k-g),x.primitiveLength++}})(e,i,r,n,o,t),u&&function(h,p,d,f,m,_){let y=[];for(let w=0;w<f.length/2;w++)y.push(-1);let v={count:0},g=0,x=h.getOrCreateLatestSegment(p,d),b=x.vertexLength;for(let w of m)for(let T=1;T<w.length;T+=2){let P=w[T-1],S=w[T],E=y[P]<g,I=y[S]<g;x.vertexLength+((E?1:0)+(I?1:0))>xt.MAX_VERTEX_ARRAY_LENGTH&&(x=h.createNewSegment(p,d),g=v.count,E=!0,I=!0,b=0);let C=xo(y,f,_,v,P,E,x),A=xo(y,f,_,v,S,I,x);d.emplaceBack(b+C-g,b+A-g),x.primitiveLength++}}(s,i,a,n,c,t),e.forceNewSegmentOnNextPrepare(),s==null||s.forceNewSegmentOnNextPrepare()}function xo(t,e,i,r,n,o,s){if(o){let a=r.count;return i(e[2*n],e[2*n+1]),t[n]=r.count,r.count++,s.vertexLength++,a}return t[n]}class rh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new rf,this.indexArray=new Ge,this.indexArray2=new da,this.programConfigurations=new Oi(t.layers,t.zoom),this.segments=new xt,this.segments2=new xt,this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){this.hasDependencies=va("fill",this.layers,e);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(let{feature:s,id:a,index:c,sourceLayerIndex:l}of t){let u=this.layers[0]._featureFilter.needGeometry,h=ar(s,u);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),h,i))continue;let p=n?r.evaluate(h,{},i,e.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:l,index:c,geometry:u?h.geometry:sr(s),patterns:{},sortKey:p};o.push(d)}n&&o.sort((s,a)=>s.sortKey-a.sortKey);for(let s of o){let{geometry:a,index:c,sourceLayerIndex:l}=s;if(this.hasDependencies){let u=Qc("fill",this.layers,s,{zoom:this.zoom},e);this.patternFeatures.push(u)}else this.addFeature(s,a,c,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[c].feature,a,c,l,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}addFeatures(t,e,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$v),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,i,r,n,o){for(let s of oc(e,500)){let a=Hf(s,r,o.fill.getGranularityForZoomLevel(r.z)),c=this.layoutVertexArray;Xf((l,u)=>{c.emplaceBack(l,u)},this.segments,this.layoutVertexArray,this.indexArray,a.verticesFlattened,a.indicesTriangles,this.segments2,this.indexArray2,a.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,canonical:r})}}let Yf,Kf;U("FillBucket",rh,{omit:["layers","patternFeatures"]});var tx={get paint(){return Kf=Kf||new ee({"fill-antialias":new Z(D.paint_fill["fill-antialias"]),"fill-opacity":new K(D.paint_fill["fill-opacity"]),"fill-color":new K(D.paint_fill["fill-color"]),"fill-outline-color":new K(D.paint_fill["fill-outline-color"]),"fill-translate":new Z(D.paint_fill["fill-translate"]),"fill-translate-anchor":new Z(D.paint_fill["fill-translate-anchor"]),"fill-pattern":new Gr(D.paint_fill["fill-pattern"])})},get layout(){return Yf=Yf||new ee({"fill-sort-key":new K(D.layout_fill["fill-sort-key"])})}};class Jf extends Ze{constructor(t,e){super(t,tx,e)}recalculate(t,e){super.recalculate(t,e);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(t){return new rh(t)}queryRadius(){return ga(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:i,pixelsToTileUnits:r}){return Pf(ya(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),e)}isTileClipped(){return!0}}let ex=Bt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ix=Bt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:rx}=ex;class en{constructor(t,e,i,r,n){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n,t.readFields(nx,this,e)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,i=[],r,n=1,o=0,s=0,a=0;for(;t.pos<e;){if(o<=0){let c=t.readVarint();n=7&c,o=c>>3}if(o--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&(r&&i.push(r),r=[]),r&&r.push(new z(s,a));else{if(n!==7)throw Error(`unknown command ${n}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,c=1/0,l=-1/0;for(;t.pos<e;){if(r<=0){let u=t.readVarint();i=7&u,r=u>>3}if(r--,i===1||i===2)n+=t.readSVarint(),o+=t.readSVarint(),n<s&&(s=n),n>a&&(a=n),o<c&&(c=o),o>l&&(l=o);else if(i!==7)throw Error(`unknown command ${i}`)}return[s,c,a,l]}toGeoJSON(t,e,i){let r=this.extent*Math.pow(2,i),n=this.extent*t,o=this.extent*e,s=this.loadGeometry();function a(h){return[360*(h.x+n)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(h.y+o)/r)*Math.PI))-90]}function c(h){return h.map(a)}let l;if(this.type===1){let h=[];for(let d of s)h.push(d[0]);let p=c(h);l=h.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let h=s.map(c);l=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h}}else{if(this.type!==3)throw Error("unknown feature type");{let h=Qf(s),p=[];for(let d of h)p.push(d.map(c));l=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}}let u={type:"Feature",geometry:l,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}function nx(t,e,i){t===1?e.id=i.readVarint():t===2?function(r,n){let o=r.readVarint()+r.pos;for(;r.pos<o;){let s=n._keys[r.readVarint()],a=n._values[r.readVarint()];n.properties[s]=a}}(i,e):t===3?e.type=i.readVarint():t===4&&(e._geometry=i.pos)}function Qf(t){let e=t.length;if(e<=1)return[t];let i=[],r,n;for(let o=0;o<e;o++){let s=ox(t[o]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(r&&i.push(r),r=[t[o]]):r&&r.push(t[o]))}return r&&i.push(r),i}function ox(t){let e=0;for(let i,r,n=0,o=t.length,s=o-1;n<o;s=n++)i=t[n],r=t[s],e+=(r.x-i.x)*(i.y+r.y);return e}en.types=["Unknown","Point","LineString","Polygon"];class tm{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(sx,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new en(this._pbf,e,this.extent,this._keys,this._values)}}function sx(t,e,i){t===15?e.version=i.readVarint():t===1?e.name=i.readString():t===5?e.extent=i.readVarint():t===2?e._features.push(i.pos):t===3?e._keys.push(i.readString()):t===4&&e._values.push(function(r){let n=null,o=r.readVarint()+r.pos;for(;r.pos<o;){let s=r.readVarint()>>3;n=s===1?r.readString():s===2?r.readFloat():s===3?r.readDouble():s===4?r.readVarint64():s===5?r.readVarint():s===6?r.readSVarint():s===7?r.readBoolean():null}if(n==null)throw Error("unknown feature value");return n}(i))}class em{constructor(t,e){this.layers=t.readFields(ax,{},e)}}function ax(t,e,i){if(t===3){let r=new tm(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}let nh=Math.pow(2,13);function bo(t,e,i,r,n,o,s,a){t.emplaceBack(e,i,2*Math.floor(r*nh)+s,n*nh*2,o*nh*2,Math.round(a))}class oh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new nf,this.centroidVertexArray=new ui,this.indexArray=new Ge,this.programConfigurations=new Oi(t.layers,t.zoom),this.segments=new xt,this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){this.features=[],this.hasDependencies=va("fill-extrusion",this.layers,e);for(let{feature:r,id:n,index:o,sourceLayerIndex:s}of t){let a=this.layers[0]._featureFilter.needGeometry,c=ar(r,a);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),c,i))continue;let l={id:n,sourceLayerIndex:s,index:o,geometry:a?c.geometry:sr(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(Qc("fill-extrusion",this.layers,l,{zoom:this.zoom},e)):this.addFeature(l,l.geometry,o,i,{},e.subdivisionGranularity),e.featureIndex.insert(r,l.geometry,o,s,this.index,!0)}}addFeatures(t,e,i){for(let r of this.features){let{geometry:n}=r;this.addFeature(r,n,r.index,e,i,t.subdivisionGranularity)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,ix.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n,o){for(let s of oc(e,500)){let a={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(a,r,t,s,o);let l=this.layoutVertexArray.length-c,u=Math.floor(a.x/a.sampleCount),h=Math.floor(a.y/a.sampleCount);for(let p=0;p<l;p++)this.centroidVertexArray.emplaceBack(u,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,canonical:r})}processPolygon(t,e,i,r,n){if(r.length<1)return;if(im(r[0]))return;for(let u of r)u.length!==0&&lx(t,u);let o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(e.z),a=en.types[i.type]==="Polygon";for(let u of r){if(u.length===0)continue;if(im(u))continue;let h=ih(u,s,a);this._generateSideFaces(h,o)}if(!a)return;let c=Hf(r,e,s,!1),l=this.layoutVertexArray;Xf((u,h)=>{bo(l,u,h,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,c.verticesFlattened,c.indicesTriangles)}_generateSideFaces(t,e){let i=0;for(let r=1;r<t.length;r++){let n=t[r],o=t[r-1];if(cx(n,o))continue;e.segment.vertexLength+4>xt.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(o)._perp()._unit(),a=o.dist(n);i+a>32768&&(i=0),bo(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,i),bo(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,i),i+=a,bo(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,i),bo(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,i);let c=e.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function lx(t,e){for(let i=0;i<e.length;i++){let r=e[i];i===e.length-1&&e[0].x===r.x&&e[0].y===r.y||(t.x+=r.x,t.y+=r.y,t.sampleCount++)}}function cx(t,e){return t.x===e.x&&(t.x<0||t.x>F)||t.y===e.y&&(t.y<0||t.y>F)}function im(t){return t.every((e)=>e.x<0)||t.every((e)=>e.x>F)||t.every((e)=>e.y<0)||t.every((e)=>e.y>F)}let rm;U("FillExtrusionBucket",oh,{omit:["layers","features"]});var hx={get paint(){return rm=rm||new ee({"fill-extrusion-opacity":new Z(D["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new K(D["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(D["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(D["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Gr(D["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new K(D["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new K(D["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(D["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class nm extends Ze{constructor(t,e){super(t,hx,e)}createBucket(t){return new oh(t)}queryRadius(){return ga(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:s}){let a=ya(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(e,i),l=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(p,d){let f=[];for(let m of p){let _=[m.x,m.y,0,1];Yt(_,_,d),f.push(new z(_[0]/_[3],_[1]/_[3]))}return f}(a,s),h=function(p,d,f,m){let _=[],y=[],v=m[8]*d,g=m[9]*d,x=m[10]*d,b=m[11]*d,w=m[8]*f,T=m[9]*f,P=m[10]*f,S=m[11]*f;for(let E of p){let I=[],C=[];for(let A of E){let{x:M,y:k}=A,L=m[0]*M+m[4]*k+m[12],O=m[1]*M+m[5]*k+m[13],q=m[2]*M+m[6]*k+m[14],Q=m[3]*M+m[7]*k+m[15],rt=q+x,nt=Q+b,lt=L+w,pt=O+T,Pt=q+P,yt=Q+S,Dt=new z((L+v)/nt,(O+g)/nt);Dt.z=rt/nt,I.push(Dt);let H=new z(lt/yt,pt/yt);H.z=Pt/yt,C.push(H)}_.push(I),y.push(C)}return[_,y]}(r,l,c,s);return function(p,d,f){let m=1/0;Pf(f,d)&&(m=om(f,d[0]));for(let _=0;_<d.length;_++){let y=d[_],v=p[_];for(let g=0;g<y.length-1;g++){let x=y[g],b=[x,y[g+1],v[g+1],v[g],x];Sf(f,b)&&(m=Math.min(m,om(f,b)))}}return m!==1/0&&m}(h[0],h[1],u)}}function wo(t,e){return t.x*e.x+t.y*e.y}function om(t,e){if(t.length===1){let i=0,r=e[i++],n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){let o=e[i],s=t[0],a=n.sub(r),c=o.sub(r),l=s.sub(r),u=wo(a,a),h=wo(a,c),p=wo(c,c),d=wo(l,a),f=wo(l,c),m=u*p-h*h,_=(p*d-h*f)/m,y=(u*f-h*d)/m,v=r.z*(1-_-y)+n.z*_+o.z*y;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let r of e)i=Math.min(i,r.z);return i}}let sm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class sh{static from(t){if(!(t instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[e,i]=new Uint8Array(t,0,2);if(e!==219)throw Error("Data does not appear to be in a KDBush format.");let r=i>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let n=sm[15&i];if(!n)throw Error("Unrecognized array type.");let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new sh(s,o,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let n=sm.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return ah(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],c=[];for(;a.length;){let l=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let m=h;m<=u;m++){let _=o[2*m],y=o[2*m+1];_>=t&&_<=i&&y>=e&&y<=r&&c.push(n[m])}continue}let p=h+u>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=i&&f>=e&&f<=r&&c.push(n[p]),(l===0?t<=d:e<=f)&&(a.push(h),a.push(p-1),a.push(1-l)),(l===0?i>=d:r>=f)&&(a.push(p+1),a.push(u),a.push(1-l))}return c}within(t,e,i){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],c=i*i;for(;s.length;){let l=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let m=h;m<=u;m++)lm(n[2*m],n[2*m+1],t,e)<=c&&a.push(r[m]);continue}let p=h+u>>1,d=n[2*p],f=n[2*p+1];lm(d,f,t,e)<=c&&a.push(r[p]),(l===0?t-i<=d:e-i<=f)&&(s.push(h),s.push(p-1),s.push(1-l)),(l===0?t+i>=d:e+i>=f)&&(s.push(p+1),s.push(u),s.push(1-l))}return a}}function ah(t,e,i,r,n,o){if(n-r<=i)return;let s=r+n>>1;am(t,e,s,r,n,o),ah(t,e,i,r,s-1,1-o),ah(t,e,i,s+1,n,1-o)}function am(t,e,i,r,n,o){for(;n>r;){if(n-r>600){let l=n-r+1,u=i-r+1,h=Math.log(l),p=0.5*Math.exp(2*h/3),d=0.5*Math.sqrt(h*p*(l-p)/l)*(u-l/2<0?-1:1);am(t,e,i,Math.max(r,Math.floor(i-u*p/l+d)),Math.min(n,Math.floor(i+(l-u)*p/l+d)),o)}let s=e[2*i+o],a=r,c=n;for(To(t,e,r,i),e[2*n+o]>s&&To(t,e,r,n);a<c;){for(To(t,e,a,c),a++,c--;e[2*a+o]<s;)a++;for(;e[2*c+o]>s;)c--}e[2*r+o]===s?To(t,e,r,c):(c++,To(t,e,c,n)),c<=i&&(r=c+1),i<=c&&(n=c-1)}}function To(t,e,i,r){lh(t,i,r),lh(e,2*i,2*r),lh(e,2*i+1,2*r+1)}function lh(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function lm(t,e,i,r){let n=t-i,o=e-r;return n*n+o*o}var cm;(function(t){t[t.X=0]="X",t[t.Y=1]="Y"})(cm||(cm={}));let hm="geojsonvt_clip_start",um="geojsonvt_clip_end",ux=Bt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dx}=ux,px=Bt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:fx}=px,mx=Math.cos(Math.PI/180*37.5),dm=Math.pow(2,14)/0.5;class ch{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new of,this.layoutVertexArray2=new sf,this.indexArray=new Ge,this.programConfigurations=new Oi(t.layers,t.zoom),this.segments=new xt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){this.hasDependencies=va("line",this.layers,e)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(let{feature:s,id:a,index:c,sourceLayerIndex:l}of t){let u=this.layers[0]._featureFilter.needGeometry,h=ar(s,u);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),h,i))continue;let p=n?r.evaluate(h,{},i):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:l,index:c,geometry:u?h.geometry:sr(s),patterns:{},dashes:{},sortKey:p};o.push(d)}n&&o.sort((s,a)=>s.sortKey-a.sortKey);for(let s of o){let{geometry:a,index:c,sourceLayerIndex:l}=s;this.hasDependencies?(va("line",this.layers,e)?Qc("line",this.layers,s,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,s,this.zoom,e),this.patternFeatures.push(s)):this.addFeature(s,a,c,i,{},{},e.subdivisionGranularity),e.featureIndex.insert(t[c].feature,a,c,l,this.index)}}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures(t,e,i,r){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,i,r,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,fx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,dx),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,hm)&&Object.hasOwn(t.properties,um))return{start:+t.properties[hm],end:+t.properties[um]}}addFeature(t,e,i,r,n,o,s){let a=this.layers[0].layout,c=a.get("line-join").evaluate(t,{}),l=a.get("line-cap").evaluate(t,{}),u=a.get("line-miter-limit").evaluate(t,{}),h=a.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,c,l,u,h,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,dashPositions:o,canonical:r})}addLine(t,e,i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=ih(t,s?a.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<t.length-1;v++)this.totalDistance+=t[v].dist(t[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=en.types[e.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let u=0;for(;u<l-1&&t[u].equals(t[u+1]);)u++;if(l<(c?3:2))return;i==="bevel"&&(n=1.05);let h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),d,f,m,_,y;this.e1=this.e2=-1,c&&(d=t[l-2],y=t[u].sub(d)._unit()._perp());for(let v=u;v<l;v++){if(m=v===l-1?c?t[u+1]:void 0:t[v+1],m&&t[v].equals(m))continue;y&&(_=y),d&&(f=d),d=t[v],y=m?m.sub(d)._unit()._perp():_,_||(_=y);let g=_.add(y);g.x===0&&g.y===0||g._unit();let x=_.x*y.x+_.y*y.y,b=g.x*y.x+g.y*y.y,w=b!==0?1/b:1/0,T=2*Math.sqrt(2-2*b),P=b<mx&&f&&m,S=_.x*y.y-_.y*y.x>0;if(P&&v>u){let C=d.dist(f);if(C>2*h){let A=d.sub(d.sub(f)._mult(h/C)._round());this.updateDistance(f,A),this.addCurrentVertex(A,_,0,0,p),f=A}}let E=f&&m,I=E?i:c?"butt":r;if(E&&I==="round"&&(w<o?I="miter":w<=2&&(I="fakeround")),I==="miter"&&w>n&&(I="bevel"),I==="bevel"&&(w>2&&(I="flipbevel"),w<n&&(I="miter")),f&&this.updateDistance(f,d),I==="miter")g._mult(w),this.addCurrentVertex(d,g,0,0,p);else if(I==="flipbevel"){if(w>100)g=y.mult(-1);else{let C=w*_.add(y).mag()/_.sub(y).mag();g._perp()._mult(C*(S?-1:1))}this.addCurrentVertex(d,g,0,0,p),this.addCurrentVertex(d,g.mult(-1),0,0,p)}else if(I==="bevel"||I==="fakeround"){let C=-Math.sqrt(w*w-1),A=S?C:0,M=S?0:C;if(f&&this.addCurrentVertex(d,_,A,M,p),I==="fakeround"){let k=Math.round(180*T/Math.PI/20);for(let L=1;L<k;L++){let O=L/k;if(O!==0.5){let Q=O-0.5;O+=O*Q*(O-1)*((1.0904+x*(x*(3.55645-1.43519*x)-3.2452))*Q*Q+(0.848013+x*(0.215638*x-1.06021)))}let q=y.sub(_)._mult(O)._add(_)._unit()._mult(S?-1:1);this.addHalfVertex(d,q.x,q.y,!1,S,0,p)}}m&&this.addCurrentVertex(d,y,-A,-M,p)}else if(I==="butt")this.addCurrentVertex(d,g,0,0,p);else if(I==="square"){let C=f?1:-1;this.addCurrentVertex(d,g,C,C,p)}else I==="round"&&(f&&(this.addCurrentVertex(d,_,0,0,p),this.addCurrentVertex(d,_,1,1,p,!0)),m&&(this.addCurrentVertex(d,y,-1,-1,p,!0),this.addCurrentVertex(d,y,0,0,p)));if(P&&v<l-1){let C=d.dist(m);if(C>2*h){let A=d.add(m.sub(d)._mult(h/C)._round());this.updateDistance(d,A),this.addCurrentVertex(A,y,0,0,p),d=A}}}}addCurrentVertex(t,e,i,r,n,o=!1){let s=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,s,a,o,!0,-r,n),this.distance>dm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,o))}addHalfVertex({x:t,y:e},i,r,n,o,s,a){let c=0.5*(this.lineClips?this.scaledDistance*(dm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(s===0?0:s<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,l,this.e2),a.primitiveLength++),o?this.e2=l:this.e1=l}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let i=e.paint.get("line-dasharray");if(i&&!i.isConstant())return!0}return!1}addLineDashDependencies(t,e,i,r){for(let n of t){let o=n.paint.get("line-dasharray");if(!o||o.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",a={dasharray:o.value.evaluate({zoom:i-1},e,{}),round:s},c={dasharray:o.value.evaluate({zoom:i},e,{}),round:s},l={dasharray:o.value.evaluate({zoom:i+1},e,{}),round:s},u=`${a.dasharray.join(",")},${a.round}`,h=`${c.dasharray.join(",")},${c.round}`,p=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[u]=a,r.dashDependencies[h]=c,r.dashDependencies[p]=l,e.dashes[n.id]={min:u,mid:h,max:p}}}}let pm,fm;U("LineBucket",ch,{omit:["layers","patternFeatures"]});var mm={get paint(){return fm=fm||new ee({"line-opacity":new K(D.paint_line["line-opacity"]),"line-color":new K(D.paint_line["line-color"]),"line-translate":new Z(D.paint_line["line-translate"]),"line-translate-anchor":new Z(D.paint_line["line-translate-anchor"]),"line-width":new K(D.paint_line["line-width"]),"line-gap-width":new K(D.paint_line["line-gap-width"]),"line-offset":new K(D.paint_line["line-offset"]),"line-blur":new K(D.paint_line["line-blur"]),"line-dasharray":new Gr(D.paint_line["line-dasharray"]),"line-pattern":new Gr(D.paint_line["line-pattern"]),"line-gradient":new lo(D.paint_line["line-gradient"])})},get layout(){return pm=pm||new ee({"line-cap":new K(D.layout_line["line-cap"]),"line-join":new K(D.layout_line["line-join"]),"line-miter-limit":new K(D.layout_line["line-miter-limit"]),"line-round-limit":new K(D.layout_line["line-round-limit"]),"line-sort-key":new K(D.layout_line["line-sort-key"])})}};class _m extends K{possiblyEvaluate(t,e){return e=new At(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=G({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let wa;class gm extends Ze{constructor(t,e){super(t,mm,e),this.gradientVersion=0,wa||(wa=new _m(mm.paint.properties["line-width"].specification),wa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=!!function(i){return i._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof Zn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=wa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ch(t)}queryRadius(t){let e=t,i=ym(Kr("line-width",this,e),Kr("line-gap-width",this,e)),r=Kr("line-offset",this,e);return i/2+Math.abs(r)+ga(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o}){let s=ya(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),a=o/2*ym(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(r=function(l,u){let h=[];for(let p of l){let d=Rv(p),f=[];for(let m=0;m<d.length;m++){let _=d[m],y=d[m-1],v=d[m+1],g=m===0?new z(0,0):_.sub(y)._unit()._perp(),x=m===d.length-1?new z(0,0):v.sub(_)._unit()._perp(),b=g._add(x)._unit(),w=b.x*x.x+b.y*x.y;w!==0&&b._mult(1/w),f.push(b._mult(u)._add(_))}h.push(f)}return h}(r,c*o)),function(l,u,h){for(let p of u){if(l.length>=3){for(let d of p)if(Yr(l,d))return!0}if(Cv(l,p,h))return!0}return!1}(s,r,a)}isTileClipped(){return!0}}function ym(t,e){return e>0?e+2*t:t}let _x=Bt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),gx=Bt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Bt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let yx=Bt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Bt([{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"}]);let vm=Bt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),vx=Bt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function xx(t,e,i){let r=e.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?t=t.toLocaleUpperCase():r==="lowercase"&&(t=t.toLocaleLowerCase()),Zr.applyArabicShaping&&(t=Zr.applyArabicShaping(t)),t}function bx(t,e,i){for(let r of t.sections)r.text=xx(r.text,e,i);return t}Bt([{name:"triangle",components:3,type:"Uint16"}]),Bt([{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"}]),Bt([{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"}]),Bt([{type:"Float32",name:"offsetX"}]),Bt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Bt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let wx={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},hh=4294967296,xm=1/hh,bm=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class uh{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){let r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*hh;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*hh;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,i,r;return r=e[this.pos++],i=127&r,r<128?i:(r=e[this.pos++],i|=(127&r)<<7,r<128?i:(r=e[this.pos++],i|=(127&r)<<14,r<128?i:(r=e[this.pos++],i|=(127&r)<<21,r<128?i:(r=e[this.pos],i|=(15&r)<<28,function(n,o,s){let a=s.buf,c,l;if(l=a[s.pos++],c=(112&l)>>4,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<3,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<10,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<17,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<24,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(1&l)<<31,l<128)return rn(n,c,o);throw Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&bm?bm.decode(this.buf.subarray(e,t)):function(i,r,n){let o="",s=r;for(;s<n;){let a=i[s],c,l,u,h=null,p=a>239?4:a>223?3:a>191?2:1;if(s+p>n)break;p===1?a<128&&(h=a):p===2?(c=i[s+1],(192&c)==128&&(h=(31&a)<<6|63&c,h<=127&&(h=null))):p===3?(c=i[s+1],l=i[s+2],(192&c)==128&&(192&l)==128&&(h=(15&a)<<12|(63&c)<<6|63&l,(h<=2047||h>=55296&&h<=57343)&&(h=null))):p===4&&(c=i[s+1],l=i[s+2],u=i[s+3],(192&c)==128&&(192&l)==128&&(192&u)==128&&(h=(15&a)<<18|(63&c)<<12|(63&l)<<6|63&u,(h<=65535||h>=1114112)&&(h=null))),h===null?(h=65533,p=1):h>65535&&(h-=65536,o+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),o+=String.fromCharCode(h),s+=p}return o}(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(t){let e=7&t;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){let i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*xm),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*xm),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(e,i){let r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552000||e<-18446744073709552000)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(o,s,a){a.buf[a.pos++]=127&o|128,o>>>=7,a.buf[a.pos++]=127&o|128,o>>>=7,a.buf[a.pos++]=127&o|128,o>>>=7,a.buf[a.pos++]=127&o|128,a.buf[a.pos]=127&(o>>>=7)}(r,0,i),function(o,s){let a=(7&o)<<4;s.buf[s.pos++]|=a|((o>>>=3)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o)))))}(n,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;let e=this.pos;this.pos=function(r,n,o){for(let s,a,c=0;c<n.length;c++){if(s=n.charCodeAt(c),s>55295&&s<57344){if(!a){s>56319||c+1===n.length?(r[o++]=239,r[o++]=191,r[o++]=189):a=s;continue}if(s<56320){r[o++]=239,r[o++]=191,r[o++]=189,a=s;continue}s=a-55296<<10|s-56320|65536,a=null}else a&&(r[o++]=239,r[o++]=191,r[o++]=189,a=null);s<128?r[o++]=s:(s<2048?r[o++]=s>>6|192:(s<65536?r[o++]=s>>12|224:(r[o++]=s>>18|240,r[o++]=s>>12&63|128),r[o++]=s>>6&63|128),r[o++]=63&s|128)}return o}(this.buf,t,this.pos);let i=this.pos-e;i>=128&&wm(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;let i=this.pos;t(e,this);let r=this.pos-i;r>=128&&wm(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Tx,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Sx,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Ex,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Px,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Ix,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Mx,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Cx,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Ax,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,zx,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function rn(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function wm(t,e,i){let r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(let n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function Tx(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function Sx(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function Px(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function Ix(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function Ex(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function Mx(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function Cx(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Ax(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function zx(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Dx(t,e,i){t===1&&i.readMessage(Rx,e)}function Rx(t,e,i){if(t===3){let{id:r,bitmap:n,width:o,height:s,left:a,top:c,advance:l}=i.readMessage(kx,{});e.push({id:r,bitmap:new fo({width:o+6,height:s+6},n),metrics:{width:o,height:s,left:a,top:c,advance:l}})}}function kx(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}function Tm(t){let e=0,i=0;for(let s of t)e+=s.w*s.h,i=Math.max(i,s.w);t.sort((s,a)=>a.h-s.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/0.95)),i),h:1/0}],n=0,o=0;for(let s of t)for(let a=r.length-1;a>=0;a--){let c=r[a];if(!(s.w>c.w||s.h>c.h)){if(s.x=c.x,s.y=c.y,o=Math.max(o,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===c.w&&s.h===c.h){let l=r.pop();l&&a<r.length&&(r[a]=l)}else s.h===c.h?(c.x+=s.w,c.w-=s.w):s.w===c.w?(c.y+=s.h,c.h-=s.h):(r.push({x:c.x+s.w,y:c.y,w:c.w-s.w,h:s.h}),c.y+=s.h,c.h-=s.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}class Ta{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:n,content:o,textFitWidth:s,textFitHeight:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i,this.textFitWidth=s,this.textFitHeight=a}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}var $t;function Sm(t){let e=0.5,i=0.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Pm(t,e){let{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new At(t+1))};if(i.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:n}=i,o=0;for(;o<r.length&&r[o]<=t;)o++;o=Math.max(0,o-1);let s=o;for(;s<r.length&&r[s]<t+1;)s++;s=Math.min(r.length-1,s);let a=r[o],c=r[s];return i.kind==="composite"?{kind:"composite",minZoom:a,maxZoom:c,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:c,minSize:i.evaluate(new At(a)),maxSize:i.evaluate(new At(c)),interpolationType:n}}}function dh(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return t.kind==="source"?r/128:t.kind==="composite"?Ft.number(r/128,n/128,i):e}function Sa(t,e){let i=0,r=0;if(t.kind==="constant")r=t.layoutSize;else if(t.kind!=="source"){let{interpolationType:n,minZoom:o,maxZoom:s}=t,a=n?_t(we.interpolationFactor(n,e,o,s),0,1):0;t.kind==="camera"?r=Ft.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:r}}function Pa(t,e,i){let r="never",n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}U("ImagePosition",Ta),U("ImageAtlas",class{constructor(t,e){let i={},r={};this.haveRenderCallbacks=[];let n=[];this.addImages(t,i,n),this.addImages(e,r,n);let{w:o,h:s}=Tm(n),a=new It({width:o||1,height:s||1});for(let c in t){let l=t[c],u=i[c].paddedRect;It.copy(l.data,a,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(let c in e){let l=e[c],u=r[c].paddedRect,h=u.x+1,p=u.y+1,d=l.data.width,f=l.data.height;It.copy(l.data,a,{x:0,y:0},{x:h,y:p},l.data),It.copy(l.data,a,{x:0,y:f-1},{x:h,y:p-1},{width:d,height:1}),It.copy(l.data,a,{x:0,y:0},{x:h,y:p+f},{width:d,height:1}),It.copy(l.data,a,{x:d-1,y:0},{x:h-1,y:p},{width:1,height:f}),It.copy(l.data,a,{x:0,y:0},{x:h+d,y:p},{width:1,height:f})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(let r in t){let n=t[r],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(o),e[r]=new Ta(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;let[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}($t||($t={}));let Lx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ia(t,e,i,r,n,o,s,a,c,l,u,h,p){let d=a?Math.min(32640,Math.round(a[0])):0,f=a?Math.min(32640,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),o,s,(d<<1)+(c?1:0),f,16*l,16*u,256*h,256*p)}function So(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Fx(t){for(let e of t.sections)if(_v(e.text))return!0;return!1}class Ea{constructor(t){this.layoutVertexArray=new af,this.indexArray=new Ge,this.programConfigurations=t,this.segments=new xt,this.dynamicLayoutVertexArray=new lf,this.opacityVertexArray=new cf,this.hasVisibleVertices=!1,this.placedSymbolArray=new Mc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,_x.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,gx.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Lx,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}U("SymbolBuffers",Ea);class Ma{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new xt,this.collisionVertexArray=new uf}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,yx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}U("CollisionBuffers",Ma);class ur{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((o)=>o.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Pm(this.zoom,e["text-size"]),this.iconSizeData=Pm(this.zoom,e["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=Pa(i,"text-overlap","text-allow-overlap")!=="never"||Pa(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!r.isConstant(),this.sortFeaturesByY=(n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map((o)=>$t[o])),this.stateDependentLayerIds=this.layers.filter((o)=>o.isStateDependent()).map((o)=>o.id),this.sourceID=t.sourceID}createArrays(){this.text=new Ea(new Oi(this.layers,this.zoom,(t)=>t.startsWith("text"))),this.icon=new Ea(new Oi(this.layers,this.zoom,(t)=>t.startsWith("icon"))),this.glyphOffsetArray=new zc,this.lineVertexArray=new Dc,this.symbolInstances=new Ac,this.textAnchorOffsets=new kc}calculateGlyphDependencies(t,e,i,r,n){for(let o of t)if(e[o.codePointAt(0)]=!0,(i||r)&&n){let s=wx[o];s&&(e[s.codePointAt(0)]=!0)}}populate(t,e,i){var r;let n=this.layers[0],o=n.layout,s=o.get("text-font"),a=o.get("text-field"),c=o.get("icon-image"),l=(a.value.kind!=="constant"||a.value.value instanceof De&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&(s.value.kind!=="constant"||s.value.value.length>0),u=c.value.kind!=="constant"||!!c.value.value||Object.keys(c.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let{iconDependencies:p,glyphDependencies:d,availableImages:f}=e,m=new At(this.zoom);for(let{feature:_,id:y,index:v,sourceLayerIndex:g}of t){let x=n._featureFilter.needGeometry,b=ar(_,x);if(!n._featureFilter.filter(m,b,i))continue;let w,T;if(x||(b.geometry=sr(_)),l){let S=n.getValueAndResolveTokens("text-field",b,i,f),E=De.factory(S);this.hasRTLText||(this.hasRTLText=Fx(E)),(!this.hasRTLText||Zr.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&Zr.isParsed())&&(w=bx(E,n,b))}if(u){let S=n.getValueAndResolveTokens("icon-image",b,i,f);T=S instanceof Ve?S:Ve.fromString(S)}if(!w&&!T)continue;let P=this.sortFeaturesByKey?h.evaluate(b,{},i):void 0;if(this.features.push({id:y,text:w,icon:T,index:v,sourceLayerIndex:g,geometry:b.geometry,properties:_.properties,type:en.types[_.type],sortKey:P}),T&&(p[T.name]=!0),w){let S=s.evaluate(b,{},i).join(","),E=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=(r=this.writingModes)===null||r===void 0?void 0:r.includes($t.vertical);for(let I of w.sections)if(I.image)p[I.image.name]=!0;else{let C=pv(w.toString()),A=I.fontStack||S;d[A]||(d[A]={}),this.calculateGlyphDependencies(I.text,d[A],E,this.allowVerticalPlacement,C)}}}o.get("symbol-placement")==="line"&&(this.features=function(_){let y={},v={},g=[],x=0;function b(S){g.push(_[S]),x++}function w(S,E,I){let C=v[S];return delete v[S],v[E]=C,g[C].geometry[0].pop(),g[C].geometry[0]=g[C].geometry[0].concat(I[0]),C}function T(S,E,I){let C=y[E];return delete y[E],y[S]=C,g[C].geometry[0].shift(),g[C].geometry[0]=I[0].concat(g[C].geometry[0]),C}function P(S,E,I){let C=I?E[0][E[0].length-1]:E[0][0];return`${S}:${C.x}:${C.y}`}for(let S=0;S<_.length;S++){let E=_[S],I=E.geometry,C=E.text?E.text.toString():null;if(!C){b(S);continue}let A=P(C,I),M=P(C,I,!0);if(A in v&&M in y&&v[A]!==y[M]){let k=T(A,M,I),L=w(A,M,g[k].geometry);delete y[A],delete v[M],v[P(C,g[L].geometry,!0)]=L,g[k].geometry=null}else A in v?w(A,M,I):(M in y)?T(A,M,I):(b(S),y[A]=x-1,v[M]=x-1)}return g.filter((S)=>S.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((_,y)=>_.sortKey-y.sortKey)}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:i}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,e){let i=this.lineVertexArray.length;if(t.segment!==void 0){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),o={};for(let s=t.segment+1;s<e.length;s++)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:r},s<e.length-1&&(r+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let a=o[s];this.lineVertexArray.emplaceBack(a.x,a.y,a.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,e,i,r,n,o,s,a,c,l,u,h){let{indexArray:p,layoutVertexArray:d}=t,f=t.segments.prepareSegment(4*e.length,d,p,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,_=f.vertexLength,y=this.allowVerticalPlacement&&s===$t.vertical?Math.PI/2:0,v=o.text&&o.text.sections;for(let g=0;g<e.length;g++){let{tl:x,tr:b,bl:w,br:T,tex:P,pixelOffsetTL:S,pixelOffsetBR:E,minFontScaleX:I,minFontScaleY:C,glyphOffset:A,isSDF:M,sectionIndex:k}=e[g],L=f.vertexLength,O=A[1];Ia(d,a.x,a.y,x.x,O+x.y,P.x,P.y,i,M,S.x,S.y,I,C),Ia(d,a.x,a.y,b.x,O+b.y,P.x+P.w,P.y,i,M,E.x,S.y,I,C),Ia(d,a.x,a.y,w.x,O+w.y,P.x,P.y+P.h,i,M,S.x,E.y,I,C),Ia(d,a.x,a.y,T.x,O+T.y,P.x+P.w,P.y+P.h,i,M,E.x,E.y,I,C),So(t.dynamicLayoutVertexArray,a,y),p.emplaceBack(L,L+2,L+1),p.emplaceBack(L+1,L+2,L+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),g!==e.length-1&&k===e[g+1].sectionIndex||t.programConfigurations.populatePaintArrays(d.length,o,o.index,{imagePositions:{},canonical:h,formattedSection:v==null?void 0:v[k]})}t.placedSymbolArray.emplaceBack(a.x,a.y,m,this.glyphOffsetArray.length-m,_,c,l,a.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,n,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,r,n,o,s){let a=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=a.vertexLength,{layoutVertexArray:l,collisionVertexArray:u}=n,{anchorX:h,anchorY:p}=s;this._addCollisionDebugVertex(l,u,o,h,p,new z(t,e)),this._addCollisionDebugVertex(l,u,o,h,p,new z(i,e)),this._addCollisionDebugVertex(l,u,o,h,p,new z(i,r)),this._addCollisionDebugVertex(l,u,o,h,p,new z(t,r)),a.vertexLength+=4;let d=n.indexArray;d.emplaceBack(c,c+1),d.emplaceBack(c+1,c+2),d.emplaceBack(c+2,c+3),d.emplaceBack(c+3,c),a.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){let o=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,r?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ma(Oc,vm.members,da),this.iconCollisionBox=new Ma(Oc,vm.members,da);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,o,s,a,c){let l={};for(let u=e;u<i;u++){let h=t.get(u);l.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.textFeatureIndex=h.featureIndex;break}for(let u=r;u<n;u++){let h=t.get(u);l.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.verticalTextFeatureIndex=h.featureIndex;break}for(let u=o;u<s;u++){let h=t.get(u);l.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.iconFeatureIndex=h.featureIndex;break}for(let u=a;u<c;u++){let h=t.get(u);l.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.verticalIconFeatureIndex=h.featureIndex;break}return l}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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(t,e){let i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let n=i.vertexStartIndex;n<r;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),i=Math.cos(t),r=[],n=[],o=[];for(let s=0;s<this.symbolInstances.length;++s){o.push(s);let a=this.symbolInstances.get(s);r.push(0|Math.round(e*a.anchorX+i*a.anchorY)),n.push(a.featureIndex)}return o.sort((s,a)=>r[s]-r[a]||n[a]-n[s]),o}addToSortKeyRanges(t,e){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];(i==null?void 0:i.sortKey)===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let i=this.symbolInstances.get(e);this.featureSortOrder.push(i.featureIndex);let r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let n=0;n<r.length;n++){let o=r[n];o>=0&&r.indexOf(o)===n&&this.addIndicesForPlacedSymbol(this.text,o)}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)}}}let Im,Em;U("SymbolBucket",ur,{omit:["layers","collisionBoxArray","features","compareText"]}),ur.MAX_GLYPHS=65535,ur.addDynamicAttributes=So;var ph={get paint(){return Em=Em||new ee({"icon-opacity":new K(D.paint_symbol["icon-opacity"]),"icon-color":new K(D.paint_symbol["icon-color"]),"icon-halo-color":new K(D.paint_symbol["icon-halo-color"]),"icon-halo-width":new K(D.paint_symbol["icon-halo-width"]),"icon-halo-blur":new K(D.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(D.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(D.paint_symbol["icon-translate-anchor"]),"text-opacity":new K(D.paint_symbol["text-opacity"]),"text-color":new K(D.paint_symbol["text-color"],{runtimeType:Je,getOverride:(t)=>t.textColor,hasOverride:(t)=>!!t.textColor}),"text-halo-color":new K(D.paint_symbol["text-halo-color"]),"text-halo-width":new K(D.paint_symbol["text-halo-width"]),"text-halo-blur":new K(D.paint_symbol["text-halo-blur"]),"text-translate":new Z(D.paint_symbol["text-translate"]),"text-translate-anchor":new Z(D.paint_symbol["text-translate-anchor"])})},get layout(){return Im=Im||new ee({"symbol-placement":new Z(D.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(D.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(D.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new K(D.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(D.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(D.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Z(D.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Z(D.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(D.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(D.layout_symbol["icon-rotation-alignment"]),"icon-size":new K(D.layout_symbol["icon-size"]),"icon-text-fit":new Z(D.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(D.layout_symbol["icon-text-fit-padding"]),"icon-image":new K(D.layout_symbol["icon-image"]),"icon-rotate":new K(D.layout_symbol["icon-rotate"]),"icon-padding":new K(D.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(D.layout_symbol["icon-keep-upright"]),"icon-offset":new K(D.layout_symbol["icon-offset"]),"icon-anchor":new K(D.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(D.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(D.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(D.layout_symbol["text-rotation-alignment"]),"text-field":new K(D.layout_symbol["text-field"]),"text-font":new K(D.layout_symbol["text-font"]),"text-size":new K(D.layout_symbol["text-size"]),"text-max-width":new K(D.layout_symbol["text-max-width"]),"text-line-height":new Z(D.layout_symbol["text-line-height"]),"text-letter-spacing":new K(D.layout_symbol["text-letter-spacing"]),"text-justify":new K(D.layout_symbol["text-justify"]),"text-radial-offset":new K(D.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(D.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new K(D.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new K(D.layout_symbol["text-anchor"]),"text-max-angle":new Z(D.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(D.layout_symbol["text-writing-mode"]),"text-rotate":new K(D.layout_symbol["text-rotate"]),"text-padding":new Z(D.layout_symbol["text-padding"]),"text-keep-upright":new Z(D.layout_symbol["text-keep-upright"]),"text-transform":new K(D.layout_symbol["text-transform"]),"text-offset":new K(D.layout_symbol["text-offset"]),"text-allow-overlap":new Z(D.layout_symbol["text-allow-overlap"]),"text-overlap":new Z(D.layout_symbol["text-overlap"]),"text-ignore-placement":new Z(D.layout_symbol["text-ignore-placement"]),"text-optional":new Z(D.layout_symbol["text-optional"])})}};class fh{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Fn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e==null?void 0:e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}U("FormatSectionOverride",fh,{omit:["defaultValue"]});let Mm=(t)=>t.type==="symbol";class Ca extends Ze{constructor(t,e){super(t,ph,e)}recalculate(t,e){if(super.recalculate(t,e),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="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 r=[];for(let n of i)r.includes(n)||r.push(n);this.layout._values["text-writing-mode"]=r}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){let n=this.layout.get(t).evaluate(e,{},i,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Ls(o.value)||!n?n:function(s,a){return a.replace(/{([^{}]+)}/g,(c,l)=>s&&(l in s)?String(s[l]):"")}(e.properties,n)}createBucket(t){return new ur(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of ph.paint.overridableProperties){if(!Ca.hasPaintOverride(this.layout,t))continue;let e=this.paint.get(t),i=new fh(e),r=new ks(i,e.property.specification),n=null;n=e.value.kind==="constant"||e.value.kind==="source"?new Kn("source",r):new Bs("composite",r,e.value.zoomStops),this.paint._values[t]=new ii(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Ca.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){let i=t.get("text-field"),r=ph.paint.properties[e],n=!1,o=(s)=>{var a;for(let c of s)if((a=r.overrides)===null||a===void 0?void 0:a.hasOverride(c))return void(n=!0)};if(i.value.kind==="constant"&&i.value.value instanceof De)o(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let s=(c)=>{n||(c instanceof Qi&&qt(c.value)===Bn?o(c.value.sections):c instanceof Ts?o(c.sections):c.eachChild(s))},a=i.value;a._styleExpression&&s(a._styleExpression.expression)}return n}}let Cm;var Bx={get paint(){return Cm=Cm||new ee({"background-color":new Z(D.paint_background["background-color"]),"background-pattern":new wc(D.paint_background["background-pattern"]),"background-opacity":new Z(D.paint_background["background-opacity"])})}};class Am extends Ze{constructor(t,e){super(t,Bx,e)}}class zm extends Ze{constructor(t,e){super(t,{},e),this.onAdd=(i)=>{this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)},this.onRemove=(i)=>{this.implementation.onRemove&&this.implementation.onRemove(i,i.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 Error("Custom layers cannot be serialized")}}function mh(t,e){if(t.type==="custom")return new zm(t,e);switch(t.type){case"background":return new Am(t,e);case"circle":return new Af(t,e);case"color-relief":return new Vf(t,e);case"fill":return new Jf(t,e);case"fill-extrusion":return new nm(t,e);case"heatmap":return new Lf(t,e);case"hillshade":return new Bf(t,e);case"line":return new gm(t,e);case"raster":return new Kp(t,e);case"symbol":return new Ca(t,e)}}function Aa(t){let e=[];if(typeof t=="string")e.push({id:"default",url:t});else if(t&&t.length>0){let i=[];for(let{id:r,url:n}of t){let o=`${r}${n}`;i.includes(o)||(i.push(o),e.push({id:r,url:n}))}}return e}function Dm(t,e,i){try{let r=new URL(t);return r.pathname+=`${e}${i}`,r.toString()}catch(r){throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function Ox(t){let{userImage:e}=t;return!(!(e==null?void 0:e.render)||!e.render()||(t.data.replace(new Uint8Array(e.data.buffer)),0))}class Rm extends Ht{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new It({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(let t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new It({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:e,promiseResolve:i}of this.requestors)i(this._getImagesForIds(e));this.requestors=[]}}getImage(t){let e=this.images[t];if(e&&!e.data&&e.spriteData){let i=e.spriteData;e.data=new It({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),e.spriteData=null}return e}addImage(t,e){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,e){let i=!0,r=e.data||e.spriteData;return this._validateStretch(e.stretchX,r==null?void 0:r.width)||(this.fire(new J(Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(e.stretchY,r==null?void 0:r.height)||(this.fire(new J(Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(e.content,e)||(this.fire(new J(Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let i=0;for(let r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(t.length!==4)return!1;let i=e.spriteData,r=(i==null?void 0:i.width)||e.data.width,n=(i==null?void 0:i.height)||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,e,i=!0){let r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){var e;let i=this.images[t];delete this.images[t],delete this.patterns[t],((e=i.userImage)===null||e===void 0?void 0:e.onRemove)&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((e,i)=>{let r=!0;if(!this.isLoaded())for(let n of t)this.images[n]||(r=!1);this.isLoaded()||r?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})})}_getImagesForIds(t){var e;let i={};for(let r of t){let n=this.getImage(r);n||(this.fire(new R("styleimagemissing",{id:r})),n=this.getImage(r)),n?i[r]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,textFitWidth:n.textFitWidth,textFitHeight:n.textFitHeight,hasRenderCallback:Boolean((e=n.userImage)===null||e===void 0?void 0:e.render)}:Ct(`Image "${r}" 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 i}getPixelSize(){let{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){let e=this.patterns[t],i=this.getImage(t);if(!i)return null;if(e&&e.position.version===i.version)return e.position;if(e)e.position.version=i.version;else{let r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},n=new Ta(r,i);this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){let e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new jt(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let n in this.patterns)t.push(this.patterns[n].bin);let{w:e,h:i}=Tm(t),r=this.atlasImage;r.resize({width:e||1,height:i||1});for(let n in this.patterns){let{bin:o}=this.patterns[n],s=o.x+1,a=o.y+1,c=this.getImage(n).data,{width:l,height:u}=c;It.copy(c,r,{x:0,y:0},{x:s,y:a},{width:l,height:u}),It.copy(c,r,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),It.copy(c,r,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),It.copy(c,r,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),It.copy(c,r,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let e of t){if(this.callbackDispatchedThisFrame[e])continue;this.callbackDispatchedThisFrame[e]=!0;let i=this.getImage(e);i||Ct(`Image with ID: "${e}" was not found`),Ox(i)&&this.updateImage(e,i)}}cloneImages(){let t={};for(let e in this.images){let i=this.images[e];t[e]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null})}return t}}let Po=100000000000000000000,_h=new Float64Array(256);for(let t=0;t<256;t++){let e=0.5-Math.pow(t/255,0.45454545454545453);_h[t]=e*Math.abs(e)}function km(t,e,i,r,n,o,s,a,c){for(let l=e;l<e+r;l++)Lm(t,i*o+l,o,n,s,a,c);for(let l=i;l<i+n;l++)Lm(t,l*o+e,1,r,s,a,c)}function Lm(t,e,i,r,n,o,s){o[0]=0,s[0]=-Po,s[1]=Po,n[0]=t[e];for(let a=1,c=0,l=0;a<r;a++){n[a]=t[e+a*i];let u=a*a;do{let h=o[c];l=(n[a]-n[h]+u-h*h)/(a-h)/2}while(l<=s[c]&&--c>-1);c++,o[c]=a,s[c]=l,s[c+1]=Po}for(let a=0,c=0;a<r;a++){for(;s[c+1]<a;)c++;let l=o[c],u=a-l;t[e+a*i]=n[l]+u*u}}_h[255]=-Po;let jx=lv.layout_symbol["text-font"].default.join(",");class nn{constructor(t,e,i){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={},this.lang=i}setURL(t){this.url=t}getGlyphs(t){return it(this,void 0,void 0,function*(){let e=[];for(let n in t)for(let o of t[n])e.push(this._getAndCacheGlyphsPromise(n,o));let i=yield Promise.all(e),r={};for(let{stack:n,id:o,glyph:s}of i)r[n]||(r[n]={}),r[n][o]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return r})}_getAndCacheGlyphsPromise(t,e){return it(this,void 0,void 0,function*(){var i,r;(i=(r=this.entries)[t])!==null&&i!==void 0||(r[t]={glyphs:{},requests:{},ranges:{}});let n=this.entries[t],o=n.glyphs[e];return o!==void 0?{stack:t,id:e,glyph:o}:!this.url||this._charUsesLocalIdeographFontFamily(e)?(o=n.glyphs[e]=this._drawGlyph(n,t,e),{stack:t,id:e,glyph:o}):yield this._downloadAndCacheRangePromise(t,e)})}_downloadAndCacheRangePromise(t,e){return it(this,void 0,void 0,function*(){var i;let r=this.entries[t],n=Math.floor(e/256);if(r.ranges[n])return{stack:t,id:e,glyph:null};(i=r.requests)[n]||(i[n]=nn.loadGlyphRange(t,n,this.url,this.requestManager));try{let o=yield r.requests[n];for(let s in o)r.glyphs[+s]=o[+s];return r.ranges[n]=!0,{stack:t,id:e,glyph:o[e]||null}}catch(o){let s=r.glyphs[e]=this._drawGlyph(r,t,e);return this._warnOnMissingGlyphRange(s,n,e,me(o)),{stack:t,id:e,glyph:s}}})}_warnOnMissingGlyphRange(t,e,i,r){let n=256*e;Ct(`Unable to load glyph range ${e}, ${n}-${n+255}. Rendering codepoint U+${i.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}_drawGlyph(t,e,i){let r=e===jx&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(i),n=r?"ideographTinySDF":"tinySDF";t[n]||(t[n]=this._createTinySDF(r?this.localIdeographFontFamily:e));let o=t[n].draw(String.fromCodePoint(i)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(i));return{id:i,bitmap:new fo({width:o.width||60,height:o.height||60},o.data),metrics:{width:s?0:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+0.5||0,top:o.glyphTop/2-27.5||-8,advance:s?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){let e=t?t.split(","):[];e.push("sans-serif");let i=e.map((r)=>/[-\w]+/.test(r)?r:`'${CSS.escape(r)}'`).join(",");return new nn.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:0.25,fontFamily:i,fontWeight:this._fontWeight(e[0]),fontStyle:this._fontStyle(e[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let e={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},i;for(let[r,n]of Object.entries(e))new RegExp(`\\b${r}\\b`,"i").test(t)&&(i=`${n}`);return i}destroy(){for(let t in this.entries){let e=this.entries[t];e.tinySDF=null,e.ideographTinySDF=null,e.glyphs={},e.requests={},e.ranges={}}this.entries={}}}nn.loadGlyphRange=function(t,e,i,r){return it(this,void 0,void 0,function*(){let n=256*e,o=n+255,s=yield r.transformRequest(i.replace("{fontstack}",t).replace("{range}",`${n}-${o}`),"Glyphs"),a=yield(c=s,l=new AbortController,rs(G(c,{type:"arrayBuffer"}),l));var c,l;if(!(a==null?void 0:a.data))throw Error(`Could not load glyph range. range: ${e}, ${n}-${o}`);let u={};for(let h of new uh(a.data).readFields(Dx,[]))u[h.id]=h;return u})},nn.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=0.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:a=null}={}){this.buffer=e,this.radius=i,this.cutoff=r,this.lang=a;let c=this.size=t+4*e,l=this._createCanvas(c),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${t}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(t){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(t,t);let e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){let{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),a=Math.floor(n),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o)-a)),l=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(r))),u=c+2*this.buffer,h=l+2*this.buffer,p=Math.max(u*h,0),d=new Uint8ClampedArray(p),f={data:d,width:u,height:h,glyphWidth:c,glyphHeight:l,glyphTop:s,glyphLeft:a,glyphAdvance:e};if(c===0||l===0)return f;let{ctx:m,buffer:_,gridInner:y,gridOuter:v}=this;this.lang&&(m.lang=this.lang),m.clearRect(_,_,c,l),m.fillText(t,_-a,_+s);let g=m.getImageData(_,_,c,l);v.fill(Po,0,p),y.fill(0,0,p);let x=3;for(let T=0;T<l;T++){let P=(T+_)*u+_;for(let S=0;S<c;S++,x+=4,P++){let E=g.data[x];if(E===0)continue;let I=_h[E];v[P]=Math.max(0,I),y[P]=Math.max(0,-I)}}km(v,0,0,u,h,u,this.f,this.v,this.z),km(y,_,_,c,l,u,this.f,this.v,this.z);let b=255/this.radius,w=255*(1-this.cutoff);for(let T=0;T<p;T++){let P=Math.sqrt(v[T])-Math.sqrt(y[T]);d[T]=Math.round(w-b*P)}return f}};class Fm{constructor(){this.specification=D.light.position}possiblyEvaluate(t,e){return function([i,r,n]){return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:i*Math.cos(r)*Math.sin(n),y:i*Math.sin(r)*Math.sin(n),z:i*Math.cos(n)}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:Ft.number(t.x,e.x,i),y:Ft.number(t.y,e.y,i),z:Ft.number(t.z,e.z,i)}}}let gh;class Bm extends Ht{constructor(t){super(),gh||(gh=new ee({anchor:new Z(D.light.anchor),position:new Fm,color:new Z(D.light.color),intensity:new Z(D.light.intensity)})),this._transitionable=new so(gh,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,e={}){if(!this._validate(cv,t,e))for(let i in t){let r=t[i];i.endsWith(no)?this._transitionable.setTransition(i.slice(0,-11),r):this._transitionable.setValue(i,r)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,e,i){return(i==null?void 0:i.validate)!==!1&&Zs(this,t.call(te,{value:e,style:{glyphs:!0,sprite:!0},styleSpec:D}))}}let Nx=new ee({"sky-color":new Z(D.sky["sky-color"]),"horizon-color":new Z(D.sky["horizon-color"]),"fog-color":new Z(D.sky["fog-color"]),"fog-ground-blend":new Z(D.sky["fog-ground-blend"]),"horizon-fog-blend":new Z(D.sky["horizon-fog-blend"]),"sky-horizon-blend":new Z(D.sky["sky-horizon-blend"]),"atmosphere-blend":new Z(D.sky["atmosphere-blend"])});class Om extends Ht{constructor(t){super(),this._transitionable=new so(Nx,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new At(0))}setSky(t,e={}){if(!this._validate(hv,t,e)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let i in t){let r=t[i];i.endsWith(no)?this._transitionable.setTransition(i.slice(0,-11),r):this._transitionable.setValue(i,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,e,i={}){return(i==null?void 0:i.validate)!==!1&&Zs(this,t.call(te,G({value:e,style:{glyphs:!0,sprite:!0},styleSpec:D})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class jm{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){var i;let r=t.join(",")+String(e);return(i=this.dashEntry)[r]||(i[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,i){let r=[],n=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,s=!0;r.push({left:n,right:o,isDash:s,zeroLength:t[0]===0});let a=t[0];for(let c=1;c<t.length;c++){s=!s;let l=t[c];n=a*i,a+=l,o=a*i,r.push({left:n,right:o,isDash:s,zeroLength:l===0})}return r}addRoundDash(t,e,i){let r=e/2;for(let n=-i;n<=i;n++){let o=this.width*(this.nextRow+i+n),s=0,a=t[s];for(let c=0;c<this.width;c++){c/a.right>1&&(a=t[++s]);let l=Math.abs(c-a.left),u=Math.abs(c-a.right),h=Math.min(l,u),p,d=n/i*(r+1);if(a.isDash){let f=r-Math.abs(d);p=Math.sqrt(h*h+f*f)}else p=r-Math.sqrt(h*h+d*d);this.data[o+c]=Math.max(0,Math.min(255,p+128))}}}addRegularDash(t){for(let s=t.length-1;s>=0;--s){let a=t[s],c=t[s+1];a.zeroLength?t.splice(s,1):c&&c.isDash===a.isDash&&(c.left=a.left,t.splice(s,1))}let e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);let r=this.width*this.nextRow,n=0,o=t[n];for(let s=0;s<this.width;s++){s/o.right>1&&(o=t[++n]);let a=Math.abs(s-o.left),c=Math.abs(s-o.right),l=Math.min(a,c);this.data[r+s]=Math.max(0,Math.min(255,(o.isDash?l:-l)+128))}}addDash(t,e){let i=e?7:0,r=2*i+1;if(this.nextRow+r>this.height)return Ct("LineAtlas out of space"),null;let n=0;for(let s of t)n+=s;if(n!==0){let s=this.width/n,a=this.getDashRanges(t,this.width,s);e?this.addRoundDash(a,s,i):this.addRegularDash(a)}let o={y:this.nextRow+i,height:2*i,width:n};return this.nextRow+=r,this.dirty=!0,o}bind(t){let e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class Nm{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,(t=this._channel)===null||t===void 0||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let Vx={once:!0};class Vm{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Nm(()=>this.process()),this.subscription=Al(this.target,"message",(i)=>this.receive(i),!1),this.globalScope=Mr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((i,r)=>{let n=Math.round(1000000000000000000*Math.random()).toString(36).substring(0,10),o=e?Al(e.signal,"abort",()=>{o==null||o.unsubscribe(),delete this.resolveRejects[n];let c={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(c)},Vx):null;this.resolveRejects[n]={resolve:(c)=>{o==null||o.unsubscribe(),i(c)},reject:(c)=>{o==null||o.unsubscribe(),r(c)}};let s=[],a=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:io(t.data,s)});this.target.postMessage(a,{transfer:s})})}receive(t){let e=t.data,i=e.id,r=["file://","resource://android","null"],n=[e.origin,location.origin],o=e.origin===location.origin,s=n.some((a)=>r.includes(a));if((o||s)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];let a=this.abortControllers[i];return delete this.abortControllers[i],void(a&&a.abort())}if(Mr(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){return it(this,void 0,void 0,function*(){if(e.type==="<response>"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;return void(e.error?n.reject(me(ro(e.error))):n.resolve(ro(e.data)))}if(!this.messageHandlers[e.type])return void this.completeTask(t,Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let i=ro(e.data),r=new AbortController;this.abortControllers[t]=r;try{let n=yield this.messageHandlers[e.type](e.sourceMapId,i,r);this.completeTask(t,null,n)}catch(n){this.completeTask(t,me(n))}})}completeTask(t,e,i){let r=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?io(e):null,data:io(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}}let yh="maplibre_preloaded_worker_pool";class on{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<on.workerCount;)this.workers.push(new Worker(ze.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[yh]}numActive(){return Object.keys(this.active).length}}let Ux=Math.floor(ge.hardwareConcurrency/2),Io,za;function vh(){return Io||(Io=new on),Io}on.workerCount=function(t){if(Cl==null){let e=t.navigator?t.navigator.userAgent:null;Cl=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Cl}(globalThis)?Math.max(Math.min(Ux,3),1):1;class xh{constructor(t,e){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e;let i=this.workerPool.acquire(e);for(let r=0;r<i.length;r++){let n=new Vm(i[r],e);n.name=`Worker ${r}`,this.actors.push(n)}if(!this.actors.length)throw Error("No actors found")}broadcast(t,e){let i=[];for(let r of this.actors)i.push(r.sendAsync({type:t,data:e}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let e of this.actors)e.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(let i of this.actors)i.registerMessageHandler(t,e)}unregisterMessageHandler(t){for(let e of this.actors)e.unregisterMessageHandler(t)}}function bh(){return za||(za=new xh(vh(),Bl),za.registerMessageHandler("GR",(t,e,i)=>rs(e,i))),za}function $x(t,e){let i=Ci();return Ot(i,i,[1,1,0]),Wt(i,i,[0.5*t.width,0.5*t.height,1]),t.calculatePosMatrix?Sr(i,i,t.calculatePosMatrix(e.toUnwrapped())):i}function Zx(t,e,i,r,n,o,s){var a;let c=function(p,d,f){if(p)for(let m of p){let _=d[m];if((_==null?void 0:_.source)===f&&_.type==="fill-extrusion")return!0}else for(let m in d){let _=d[m];if(_.source===f&&_.type==="fill-extrusion")return!0}return!1}((a=n==null?void 0:n.layers)!==null&&a!==void 0?a:null,e,t.id),l=o.maxPitchScaleFactor(),u=t.tilesIn(r,l,c);u.sort(Um);let h=[];for(let p of u)h.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,i,t.getState(),p.queryGeometry,p.cameraQueryGeometry,p.scale,n,o,l,$x(o,p.tileID),s?(d,f)=>s(p.tileID,d,f):void 0)});return function(p,d){for(let f in p)for(let m of p[f])$m(m,d);return p}(function(p){let d={},f={};for(let{queryResults:m,wrappedTileID:_}of p){f[_]||(f[_]={});let y=f[_];for(let v in m){let g=m[v];y[v]||(y[v]={});let x=y[v];d[v]||(d[v]=[]);for(let b of g)x[b.featureIndex]||(x[b.featureIndex]=!0,d[v].push(b))}}return d}(h),t)}function Um(t,e){let i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function $m(t,e){let i=t.feature,r=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function Zm(t,e,i,r){return it(this,void 0,void 0,function*(){let n=t;if(t.url?n=(yield ns(yield e.transformRequest(t.url,"Source"),i)).data:yield ge.frameAsync(i,r),!n)return null;let o=Rn(G(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((s)=>s.id)),o})}let mi=6371008.8;class X{constructor(t,e){if(isNaN(t)||isNaN(e))throw Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new X(Ye(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return mi*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof X)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new X(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new X(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Kt{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof X?new X(t.lng,t.lat):X.convert(t),this}setSouthWest(t){return this._sw=t instanceof X?new X(t.lng,t.lat):X.convert(t),this}extend(t){let e=this._sw,i=this._ne,r,n;if(t instanceof X)r=t,n=t;else{if(!(t instanceof Kt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Kt.convert(t)):this.extend(X.convert(t)):t&&(("lng"in t)||("lon"in t))&&("lat"in t)?this.extend(X.convert(t)):this;if(r=t._sw,n=t._ne,!r||!n)return this}return e||i?(e.lng=Math.min(r.lng,e.lng),e.lat=Math.min(r.lat,e.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new X(r.lng,r.lat),this._ne=new X(n.lng,n.lat)),this}getCenter(){return new X((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 X(this.getWest(),this.getNorth())}getSouthEast(){return new X(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:e,lat:i}=X.convert(t),r=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}intersects(t){if(!((t=Kt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let e=Math.abs(this.getEast()-this.getWest()),i=Math.abs(t.getEast()-t.getWest());if(e>=360||i>=360)return!0;let r=Ye(this.getWest(),-180,180),n=Ye(this.getEast(),-180,180),o=Ye(t.getWest(),-180,180),s=Ye(t.getEast(),-180,180),a=r>n,c=o>s;return!(!a||!c)||(a?s>=r||o<=n:c?n>=o||r<=s:o<=n&&s>=r)}static convert(t){return t instanceof Kt?t:t?new Kt(t):t}static fromLngLat(t,e=0){let i=360*e/40075017,r=i/Math.cos(Math.PI/180*t.lat);return new Kt(new X(t.lng-r,t.lat-i),new X(t.lng+r,t.lat+i))}adjustAntiMeridian(){let t=new X(this._sw.lng,this._sw.lat),e=new X(this._ne.lng,this._ne.lat);return new Kt(t,t.lng>e.lng?new X(e.lng+360,e.lat):e)}}let Gm=2*Math.PI*mi;function qm(t){return Gm*Math.cos(t*Math.PI/180)}function sn(t){return(180+t)/360}function dr(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ji(t,e){return t/qm(e)}function wh(t){return 360*t-180}function Eo(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Wm(t,e){return t*qm(Eo(e))}class wt{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){let i=X.convert(t);return new wt(sn(i.lng),dr(i.lat),ji(e,i.lat))}toLngLat(){return new X(wh(this.x),Eo(this.y))}toAltitude(){return Wm(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Gm*(t=Eo(this.y),1/Math.cos(t*Math.PI/180));var t}}class Th{constructor(t,e,i){this.bounds=Kt.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let e=Math.pow(2,t.z),i=Math.floor(sn(this.bounds.getWest())*e),r=Math.floor(dr(this.bounds.getNorth())*e),n=Math.ceil(sn(this.bounds.getEast())*e),o=Math.ceil(dr(this.bounds.getSouth())*e);return t.x>=i&&t.x<n&&t.y>=r&&t.y<o}}class Sh extends Ht{constructor(t,e,i,r){if(super(),this.id=t,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,G(this,Rn(e,["url","scheme","tileSize","promoteId","encoding"])),this._options=G({type:"vector"},e),this._collectResourceTiming=e.collectResourceTiming,this.tileSize!==512)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){return it(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new R("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Zm(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,e&&(G(this,e),e.bounds&&(this.tileBounds=new Th(e.bounds,this.minzoom,this.maxzoom)),this.fire(new R("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new R("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Ar(e)||this.fire(new J(me(e)))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return G({},this._options)}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:yield this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((n,o)=>{t.reloadPromise={resolve:n,reject:o}})}else t.actor=this.dispatcher.getActor(),r="LT";t.abortController=new AbortController;try{let n=yield t.actor.sendAsync({type:r,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,n);let o={};return(n==null?void 0:n.etagUnmodified)&&(o.unmodified=!0),o}catch(n){if(delete t.abortController,t.aborted)return;if(n&&n.status!==404)throw n;this._afterTileLoadWorkerResponse(t,null)}})}_getOverzoomParameters(t){return it(this,void 0,void 0,function*(){if(t.tileID.canonical.z<=this.maxzoom)return;if(this.map._zoomLevelsToOverscale===void 0)return;let e=t.tileID.scaledTo(this.maxzoom).canonical,i=e.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:e,overzoomRequest:yield this.map._requestManager.transformRequest(i,"Tile")}})}_afterTileLoadWorkerResponse(t,e){if((e==null?void 0:e.resourceTiming)&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.etag=e==null?void 0:e.etag,t.loadVectorData(e,this.map.painter),t.reloadPromise){let i=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(i.resolve).catch(i.reject)}}abortTile(t){return it(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return it(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Da extends Ht{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=G({type:"raster"},e),G(this,Rn(e,["url","scheme","tileSize"]))}load(){return it(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new R("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Zm(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,e&&(G(this,e),e.bounds&&(this.tileBounds=new Th(e.bounds,this.minzoom,this.maxzoom)),this.fire(new R("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new R("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Ar(e)||this.fire(new J(me(e)))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return G({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{let i=yield ci.getImage(yield this.map._requestManager.transformRequest(e,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i==null?void 0:i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let r=this.map.painter.context,n=r.gl,o=i.data;t.texture=this.map.painter.getTileTexture(o.width),t.texture?t.texture.update(o,{useMipmap:!0}):(t.texture=new jt(r,o,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}})}abortTile(t){return it(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return it(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}function Hm(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}function Xm(t,e){let{x:i,y:r}=wt.fromLngLat(e);return!(t<0||t>25||r<0||r>=1||i<0||i>=1)}class Mo{constructor(t,e,i){if(!function(r,n,o){return!(r<0||r>25||o<0||o>=Math.pow(2,r)||n<0||n>=Math.pow(2,r))}(t,e,i))throw Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=an(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){let r=(o=this.y,s=this.z,a=Hm(256*(n=this.x),256*(o=Math.pow(2,s)-o-1),s),c=Hm(256*(n+1),256*(o+1),s),a[0]+","+a[1]+","+c[0]+","+c[1]);var n,o,s,a,c;let l=function(u,h,p){let d="";for(let f=u;f>0;f--){let m=1<<f-1;d+=(h&m?1:0)+(p&m?2:0)}return d}(this.z,this.x,this.y);return t[(this.x+this.y)%t.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,e>1?"@2x":"").replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=Math.pow(2,this.z);return new z((t.x*e-this.x)*F,(t.y*e-this.y)*F)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Co{constructor(t,e){this.wrap=t,this.canonical=e,this.key=an(t,e.z,e.z,e.x,e.y)}}class Et{constructor(t,e,i,r,n){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Mo(i,+r,+n),this.key=an(e,t,i,r,n)}clone(){return new Et(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let e=this.canonical.z-t;return t>this.canonical.z?new Et(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Et(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,e){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?an(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):an(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;if(this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let e=this.canonical.z-t.canonical.z;return!(e<0)&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Et(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Et(e,this.wrap,e,i,r),new Et(e,this.wrap,e,i+1,r),new Et(e,this.wrap,e,i,r+1),new Et(e,this.wrap,e,i+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Et(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Et(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Co(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new wt(t.x-this.wrap,t.y))}normalizeCoordinates(t,e,i=8192){if(t>=0&&t<i&&e>=0&&e<i)return{tileID:this,x:t,y:e};let r=Math.floor(t/i),n=Math.floor(e/i),o=t-r*i,s=e-n*i,a=this.canonical.z,c=1<<a,l=this.canonical.y+n;if(l<0||l>=c)return null;let u=this.canonical.x+r,h=this.wrap;return u<0?(h-=Math.ceil(-u/c),u=(u%c+c)%c):u>=c&&(h+=Math.floor(u/c),u%=c),{tileID:new Et(this.overscaledZ,h,a,u,l),x:o,y:s}}}function an(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);let o=1<<i;return(o*o*t+o*n+r).toString(36)+i.toString(36)+e.toString(36)}function Ym(t,e){let i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}U("CanonicalTileID",Mo),U("OverscaledTileID",Et,{omit:["terrainRttPosMatrix32f"]});class Ph extends Da{constructor(t,e,i,r){super(t,e,i,r),this.type="raster-dem",this.maxzoom=22,this._options=G({type:"raster-dem"},e),this.encoding=e.encoding||"mapbox",this.redFactor=e.redFactor,this.greenFactor=e.greenFactor,this.blueFactor=e.blueFactor,this.baseShift=e.baseShift}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=yield this.map._requestManager.transformRequest(e,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let r=yield ci.getImage(i,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(r==null?void 0:r.data){let n=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let o=Yi(n)&&cd()?n:yield this.readImageNow(n),s={type:this.type,uid:t.uid,source:this.id,rawImageData:o,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:s}),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(r){if(delete t.abortController,t.aborted)t.state="unloaded";else if(r)throw t.state="errored",r}})}readImageNow(t){return it(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&function(){if(Wo==null&&(Wo=!1,cd())){let i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let n=0;n<25;n++){let o=4*n;i.fillStyle=`rgb(${o},${o+1},${o+2})`,i.fillRect(n%5,Math.floor(n/5),1,1)}let r=i.getImageData(0,0,5,5).data;for(let n=0;n<100;n++)if(n%4!=3&&r[n]!==n){Wo=!0;break}}}return Wo||!1}()){let e=t.width+2,i=t.height+2;try{return new It({width:e,height:i},yield function(r,n,o,s,a){return it(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let c=new VideoFrame(r,{timestamp:0});try{let l=c==null?void 0:c.format;if(!l||!l.startsWith("BGR")&&!l.startsWith("RGB"))throw Error(`Unrecognized format ${l}`);let u=l.startsWith("BGR"),h=new Uint8ClampedArray(s*a*4);if(yield c.copyTo(h,function(p,d,f,m,_){let y=4*Math.max(1,0),v=(Math.max(0,-1)- -1)*m*4+y,g=4*m,x=Math.max(0,-1),b=Math.max(0,-1);return{rect:{x,y:b,width:Math.min(p.width,-1+m)-x,height:Math.min(p.height,-1+_)-b},layout:[{offset:v,stride:g}]}}(r,0,0,s,a)),u)for(let p=0;p<h.length;p+=4){let d=h[p];h[p]=h[p+2],h[p+2]=d}return h}finally{c.close()}})}(t,0,0,e,i))}catch(r){}}return ge.getImageData(t,1)})}_getNeighboringTiles(t){let e=t.canonical,i=Math.pow(2,e.z),r=(e.x-1+i)%i,n=e.x===0?t.wrap-1:t.wrap,o=(e.x+1+i)%i,s=e.x+1===i?t.wrap+1:t.wrap,a={};return a[new Et(t.overscaledZ,n,e.z,r,e.y).key]={backfilled:!1},a[new Et(t.overscaledZ,s,e.z,o,e.y).key]={backfilled:!1},e.y>0&&(a[new Et(t.overscaledZ,n,e.z,r,e.y-1).key]={backfilled:!1},a[new Et(t.overscaledZ,t.wrap,e.z,e.x,e.y-1).key]={backfilled:!1},a[new Et(t.overscaledZ,s,e.z,o,e.y-1).key]={backfilled:!1}),e.y+1<i&&(a[new Et(t.overscaledZ,n,e.z,r,e.y+1).key]={backfilled:!1},a[new Et(t.overscaledZ,t.wrap,e.z,e.x,e.y+1).key]={backfilled:!1},a[new Et(t.overscaledZ,s,e.z,o,e.y+1).key]={backfilled:!1}),a}unloadTile(t){return it(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}function Ih(t,e){return e?t.properties[e]:t.id}function Gx(t,e){let i={id:t.id};if(e.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(let r of e.removeProperties){let n=t.addOrUpdateProperties.findIndex((o)=>o.key===r);n>-1&&t.addOrUpdateProperties.splice(n,1)}return(t.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(t.removeProperties||e.removeProperties)&&(i.removeProperties=[...t.removeProperties||[],...e.removeProperties||[]]),(t.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(t.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||t.newGeometry),i}function Km(t){var e,i;if(!t)return{};let r={};return r.removeAll=t.removeAll,r.remove=new Set(t.remove||[]),r.add=new Map((e=t.add)===null||e===void 0?void 0:e.map((n)=>[n.id,n])),r.update=new Map((i=t.update)===null||i===void 0?void 0:i.map((n)=>[n.id,n])),r}function Jm(t){return t&&t.length!==0?typeof t[0]=="number"?[t]:t.flatMap((e)=>Jm(e)):[]}function Ra(t){return t.type==="GeometryCollection"?t.geometries.flatMap((e)=>Ra(e)):Jm(t.coordinates)}function Qm(t){let e=new Kt,i;switch(t.type){case"FeatureCollection":i=t.features.flatMap((r)=>Ra(r.geometry));break;case"Feature":i=Ra(t.geometry);break;default:i=Ra(t)}if(i.length===0)return e;for(let r of i){let[n,o]=r;e.extend([n,o])}return e}class Eh extends Ht{constructor(t,e,i,r){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:e.data},this.actor=i.getActor(),this.setEventedParent(r),this._data=typeof e.data=="string"?{url:e.data}:{geojson:e.data},this._options=G({},e),this._collectResourceTiming=e.collectResourceTiming,e.maxzoom!==void 0&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type),e.attribution&&(this.attribution=e.attribution),this.promoteId=e.promoteId,e.clusterMaxZoom!==void 0&&this.maxzoom<=e.clusterMaxZoom&&Ct(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${e.clusterMaxZoom}".`),this.workerOptions=G({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(e.buffer!==void 0?e.buffer:128),tolerance:this._pixelsToTileUnits(e.tolerance!==void 0?e.tolerance:0.375),extent:F,maxZoom:this.maxzoom,lineMetrics:e.lineMetrics||!1,generateId:e.generateId||!1,promoteId:typeof e.promoteId=="string"?e.promoteId:void 0,cluster:e.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(e.clusterMaxZoom),minPoints:Math.max(2,e.clusterMinPoints||2),extent:F,radius:this._pixelsToTileUnits(e.clusterRadius||50),log:!1,generateId:e.generateId||!1}},clusterProperties:e.clusterProperties,filter:e.filter},e.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(F/this.tileSize)}_getClusterMaxZoom(t){let e=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||Ct(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${e}"`),e}load(){return it(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t,e){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};let i=this._updateWorkerData();return e?i:this}updateData(t,e){this._pendingWorkerUpdate.diff=function(r,n){if(!r)return n||{};if(!n)return r||{};let o=Km(r),s=Km(n);(function(l,u){u.removeAll&&(l.add.clear(),l.update.clear(),l.remove.clear(),u.remove.clear());for(let h of u.remove)l.add.delete(h),l.update.delete(h);for(let[h,p]of u.update){let d=l.update.get(h);d&&(u.update.set(h,Gx(d,p)),l.update.delete(h))}})(o,s);let a={};if((o.removeAll||s.removeAll)&&(a.removeAll=!0),a.remove=new Set([...o.remove,...s.remove]),a.add=new Map([...o.add,...s.add]),a.update=new Map([...o.update,...s.update]),a.remove.size&&a.add.size)for(let l of a.add.keys())a.remove.delete(l);return function(l){let u={};return l.removeAll&&(u.removeAll=l.removeAll),l.remove&&(u.remove=Array.from(l.remove)),l.add&&(u.add=Array.from(l.add.values())),l.update&&(u.update=Array.from(l.update.values())),u}(a)}(this._pendingWorkerUpdate.diff,t);let i=this._updateWorkerData();return e?i:this}getData(){return it(this,void 0,void 0,function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}})}getBounds(){return it(this,void 0,void 0,function*(){return Qm(yield this.getData())})}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}_updateWorkerData(){return it(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void Ct(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:e,updateCluster:i}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(t,e,i);t!==void 0?this._pendingWorkerUpdate.data=void 0:e?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(r)})}_getLoadGeoJSONParameters(t,e,i){return it(this,void 0,void 0,function*(){let r=G({type:this.type},this.workerOptions);return typeof t=="string"?(r.request=yield this.map._requestManager.transformRequest(ge.resolveURL(t),"Source"),r.request.collectResourceTiming=this._collectResourceTiming,r):t!==void 0?(r.data=t,r):e?(r.dataDiff=e,r):i?(r.updateCluster=!0,r):void 0})}_dispatchWorkerUpdate(t){return it(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new R("dataloading",{dataType:"source"}));try{let e=yield t,i=yield this.actor.sendAsync({type:"LD",data:e});if(this._isUpdatingWorker=!1,this._removed||i.abandoned)return void this.fire(new R("dataabort",{dataType:"source"}));i.data&&(this._data={geojson:i.data});let r=this._applyDiffToSource(e.dataDiff),n=this._getShouldReloadTileOptions(r),o={dataType:"source"};this._applyResourceTiming(o,i),this.fire(new R("data",Object.assign(Object.assign({},o),{sourceDataType:"metadata"}))),this.fire(new R("data",Object.assign(Object.assign({},o),{sourceDataType:"content",shouldReloadTileOptions:n})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new R("dataabort",{dataType:"source"}));this.fire(new J(me(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(t,e){var i;if(!this._collectResourceTiming)return;let r=(i=e.resourceTiming)===null||i===void 0?void 0:i[this.id];if(!r)return;let n=r.slice(0);(n==null?void 0:n.length)&&G(t,{resourceTiming:n})}_applyDiffToSource(t){if(!t)return;let e=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let r=function(n,o){let s=new Map;if(n==null)return s;if(n.type==null)return s;if(n.type==="Feature"){let a=Ih(n,o);if(a==null)return;return s.set(a,n),s}if(n.type==="FeatureCollection"){let a=new Set;for(let c of n.features){let l=Ih(c,o);if(l==null)return;if(a.has(l))return;a.add(l),s.set(l,c)}return s}}(this._data.geojson,e);if(!r)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:r}}if(!this._data.updateable)return;let i=function(r,n,o){var s,a;let c=[];if(n.removeAll)r.clear();else if(n.remove)for(let l of n.remove){let u=r.get(l);u&&(c.push(u.geometry),r.delete(l))}if(n.add)for(let l of n.add){let u=Ih(l,o);if(u==null)continue;let h=r.get(u);h&&c.push(h.geometry),c.push(l.geometry),r.set(u,l)}if(n.update)for(let l of n.update){let u=r.get(l.id);if(!u)continue;let h=!!l.newGeometry,p=l.removeAllProperties||((s=l.removeProperties)===null||s===void 0?void 0:s.length)>0||((a=l.addOrUpdateProperties)===null||a===void 0?void 0:a.length)>0;if(!h&&!p)continue;c.push(u.geometry);let d=Object.assign({},u);if(r.set(l.id,d),h&&(c.push(l.newGeometry),d.geometry=l.newGeometry),p){if(d.properties=l.removeAllProperties?{}:Object.assign({},d.properties||{}),l.removeProperties)for(let f of l.removeProperties)delete d.properties[f];if(l.addOrUpdateProperties)for(let{key:f,value:m}of l.addOrUpdateProperties)d.properties[f]=m}}return c}(this._data.updateable,t,e);return t.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((e)=>Qm(e))}}shouldReloadTile(t,{affectedBounds:e}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;let{buffer:i,extent:r}=this.workerOptions.geojsonVtOptions,n=function({x:o,y:s,z:a},c=0){let l=wh((o-c)/Math.pow(2,a)),u=Eo((s+1+c)/Math.pow(2,a)),h=wh((o+1+c)/Math.pow(2,a)),p=Eo((s-c)/Math.pow(2,a));return new Kt([l,u],[h,p])}(t.tileID.canonical,i/r);for(let o of e)if(n.intersects(o))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.actor?"RT":"LT";t.actor=this.actor;let i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;let r=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(r,this.map.painter,e==="RT")})}abortTile(t){return it(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return it(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.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 G({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Le{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let e=new Le;return e.extend(t(new z(this.minX,this.minY))),e.extend(t(new z(this.maxX,this.minY))),e.extend(t(new z(this.minX,this.maxY))),e.extend(t(new z(this.maxX,this.maxY))),e}static fromPoints(t){let e=new Le;for(let i of t)e.extend(i);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class pr extends Ht{constructor(t,e,i,r){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(t){return it(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new R("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let e=yield ci.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,(e==null?void 0:e.data)&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,Ar(e)||this.fire(new J(me(e)))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>this.texture=null),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new R("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;let e=t.map(wt.fromLngLat);var i;return this.tileID=function(r){let n=Le.fromPoints(r),o=n.width(),s=n.height(),a=Math.max(o,s),c=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,c);return new Mo(c,Math.floor((n.minX+n.maxX)/2*l),Math.floor((n.minY+n.maxY)/2*l))}(e),this.terrainTileRanges=this._getOverlappingTileRanges(e),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=e.map((r)=>this.tileID.getTilePoint(r)._round()),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[0].x)<0,this.fire(new R("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,e=t.gl;this.texture||(this.texture=new jt(t,this.image,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new R("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return it(this,void 0,void 0,function*(){var e;((e=this.tileID)===null||e===void 0?void 0:e.equals(t.tileID.canonical))?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:e,minY:i,maxX:r,maxY:n}=Le.fromPoints(t),o={};for(let s=0;s<=25;s++){let a=Math.pow(2,s),c=Math.floor(e*a),l=Math.floor(i*a),u=Math.floor(r*a),h=Math.floor(n*a),p=(c%a+a)%a,d=u%a,f=Math.floor(c/a),m=Math.floor(u/a);o[s]={minWrap:f,maxWrap:m,minTileXWrapped:p,maxTileXWrapped:d,minTileY:l,maxTileY:h}}return o}}class Mh extends pr{constructor(t,e,i,r){super(t,e,i,r),this._onPlayingHandler=()=>{var n;(n=this.map)===null||n===void 0||n.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=e}load(){return it(this,void 0,void 0,function*(){this._loaded=!1;let t=this.options;this.urls=[];for(let e of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(e,"Source")).url);try{let e=yield((i)=>{let r=window.document.createElement("video");return r.muted=!0,new Promise((n)=>{r.onloadstart=()=>{n(r)};for(let o of i){let s=window.document.createElement("source");Rd(o)||(r.crossOrigin="Anonymous"),s.src=o,r.appendChild(s)}})})(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new J(me(e)))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let e=this.video.seekable;t<e.start(0)||t>e.end(0)?this.fire(new J(new j(`sources.${this.id}`,null,`Playback for this video can be set only between the ${e.start(0)} and ${e.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let t=this.map.painter.context,e=t.gl;this.texture?this.video.paused||(this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.video)):(this.texture=new jt(t,this.video,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new R("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}}class Ch extends pr{constructor(t,e,i,r){super(t,e,i,r),e.coordinates?Array.isArray(e.coordinates)&&e.coordinates.length===4&&!e.coordinates.some((n)=>!Array.isArray(n)||n.length!==2||n.some((o)=>typeof o!="number"))||this.fire(new J(new j(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new J(new j(`sources.${t}`,null,'missing required property "coordinates"'))),e.animate&&typeof e.animate!="boolean"&&this.fire(new J(new j(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),e.canvas?typeof e.canvas=="string"||e.canvas instanceof HTMLCanvasElement||this.fire(new J(new j(`sources.${t}`,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 J(new j(`sources.${t}`,null,'missing required property "canvas"'))),this.options=e,this.animate=e.animate===void 0||e.animate}load(){return it(this,void 0,void 0,function*(){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 J(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(Object.keys(this.tiles).length===0)return;let e=this.map.painter.context,i=e.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new jt(e,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,r=!0)}r&&this.fire(new R("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}let t_={},e_=(t)=>{switch(t){case"geojson":return Eh;case"image":return pr;case"raster":return Da;case"raster-dem":return Ph;case"vector":return Sh;case"video":return Mh;case"canvas":return Ch}return t_[t]};class i_{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Ah{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,this._x=i,this._y=r,this._z=e,this.properties=t.properties,this.id=n}projectPoint(t,e,i,r){return[360*(t.x+e)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+i)/r)*Math.PI))-90]}projectLine(t,e,i,r){return t.map((n)=>this.projectPoint(n,e,i,r))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*Math.pow(2,this._z),i=t.extent*this._x,r=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let o=[];for(let a of n)o.push(a[0]);let s=this.projectLine(o,i,r,e);this._geometry=o.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let o=n.map((s)=>this.projectLine(s,i,r,e));this._geometry=o.length===1?{type:"LineString",coordinates:o[0]}:{type:"MultiLineString",coordinates:o};break}case 3:{let o=Qf(n),s=[];for(let a of o)s.push(a.map((c)=>this.projectLine(c,i,r,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}}class fr{constructor(t,e,i){this._name=t,this.dataBuffer=e,typeof i=="number"?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Ao extends fr{}class ka extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class La extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class zh extends fr{constructor(t,e,i,r){super(t,e,r),this.delta=i}}class Fa extends zh{constructor(t,e,i,r){super(t,Int32Array.of(e),i,r)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class Ba extends fr{constructor(t,e,i,r){super(t,r?Int32Array.of(e):Uint32Array.of(e),i)}getValueFromBuffer(t){return this.dataBuffer[0]}}class r_{constructor(t,e,i,r,n=4096){this._name=t,this._geometryVector=e,this._idVector=i,this._propertyVectors=r,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((e)=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let s=this.idVector.getValue(i);r=this.containsMaxSafeIntegerValues(this.idVector)&&s!==null?Number(s):s}let n={coordinates:e[i],type:this.geometryVector.geometryType(i)},o={};for(let s of this.propertyVectors){if(!s)continue;let a=s.name,c=s.getValue(i);c!==null&&(o[a]=c)}t.push({id:r,geometry:n,properties:o})}return t}containsMaxSafeIntegerValues(t){return t instanceof ka||t instanceof Ba||t instanceof Fa||t instanceof La}}class Dh{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}var ut,Ni;(function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE"})(ut||(ut={})),function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT",t.ALP="ALP"}(Ni||(Ni={}));let Rh=new Uint32Array(33);Rh[0]=0;for(let t=1;t<=32;t++)Rh[t]=t===32?4294967295:4294967295>>>32-t;let kh=Rh,Ei=256;function Lh(t,e){return t-t%e}function qx(t){let e=t>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}let Fh=function(){if(!Number.isFinite(65536))return 65536;let t=Lh(Math.floor(65536),Ei);return t===0?Ei:t}(),Wx=3*Fh/Ei+Fh|0;function n_(){let t=new Uint8Array(Wx);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Hx(t,e,i,r,n){switch(n){case 1:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0;a[l++]=p>>>0&1,a[l++]=p>>>1&1,a[l++]=p>>>2&1,a[l++]=p>>>3&1,a[l++]=p>>>4&1,a[l++]=p>>>5&1,a[l++]=p>>>6&1,a[l++]=p>>>7&1,a[l++]=p>>>8&1,a[l++]=p>>>9&1,a[l++]=p>>>10&1,a[l++]=p>>>11&1,a[l++]=p>>>12&1,a[l++]=p>>>13&1,a[l++]=p>>>14&1,a[l++]=p>>>15&1,a[l++]=p>>>16&1,a[l++]=p>>>17&1,a[l++]=p>>>18&1,a[l++]=p>>>19&1,a[l++]=p>>>20&1,a[l++]=p>>>21&1,a[l++]=p>>>22&1,a[l++]=p>>>23&1,a[l++]=p>>>24&1,a[l++]=p>>>25&1,a[l++]=p>>>26&1,a[l++]=p>>>27&1,a[l++]=p>>>28&1,a[l++]=p>>>29&1,a[l++]=p>>>30&1,a[l++]=p>>>31&1}})(t,e,i,r);break;case 2:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0;a[l++]=p>>>0&3,a[l++]=p>>>2&3,a[l++]=p>>>4&3,a[l++]=p>>>6&3,a[l++]=p>>>8&3,a[l++]=p>>>10&3,a[l++]=p>>>12&3,a[l++]=p>>>14&3,a[l++]=p>>>16&3,a[l++]=p>>>18&3,a[l++]=p>>>20&3,a[l++]=p>>>22&3,a[l++]=p>>>24&3,a[l++]=p>>>26&3,a[l++]=p>>>28&3,a[l++]=p>>>30&3,a[l++]=d>>>0&3,a[l++]=d>>>2&3,a[l++]=d>>>4&3,a[l++]=d>>>6&3,a[l++]=d>>>8&3,a[l++]=d>>>10&3,a[l++]=d>>>12&3,a[l++]=d>>>14&3,a[l++]=d>>>16&3,a[l++]=d>>>18&3,a[l++]=d>>>20&3,a[l++]=d>>>22&3,a[l++]=d>>>24&3,a[l++]=d>>>26&3,a[l++]=d>>>28&3,a[l++]=d>>>30&3}})(t,e,i,r);break;case 3:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0;a[l++]=p>>>0&7,a[l++]=p>>>3&7,a[l++]=p>>>6&7,a[l++]=p>>>9&7,a[l++]=p>>>12&7,a[l++]=p>>>15&7,a[l++]=p>>>18&7,a[l++]=p>>>21&7,a[l++]=p>>>24&7,a[l++]=p>>>27&7,a[l++]=7&(p>>>30|(1&d)<<2),a[l++]=d>>>1&7,a[l++]=d>>>4&7,a[l++]=d>>>7&7,a[l++]=d>>>10&7,a[l++]=d>>>13&7,a[l++]=d>>>16&7,a[l++]=d>>>19&7,a[l++]=d>>>22&7,a[l++]=d>>>25&7,a[l++]=d>>>28&7,a[l++]=7&(d>>>31|(3&f)<<1),a[l++]=f>>>2&7,a[l++]=f>>>5&7,a[l++]=f>>>8&7,a[l++]=f>>>11&7,a[l++]=f>>>14&7,a[l++]=f>>>17&7,a[l++]=f>>>20&7,a[l++]=f>>>23&7,a[l++]=f>>>26&7,a[l++]=f>>>29&7}})(t,e,i,r);break;case 4:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0;a[l++]=p>>>0&15,a[l++]=p>>>4&15,a[l++]=p>>>8&15,a[l++]=p>>>12&15,a[l++]=p>>>16&15,a[l++]=p>>>20&15,a[l++]=p>>>24&15,a[l++]=p>>>28&15,a[l++]=d>>>0&15,a[l++]=d>>>4&15,a[l++]=d>>>8&15,a[l++]=d>>>12&15,a[l++]=d>>>16&15,a[l++]=d>>>20&15,a[l++]=d>>>24&15,a[l++]=d>>>28&15,a[l++]=f>>>0&15,a[l++]=f>>>4&15,a[l++]=f>>>8&15,a[l++]=f>>>12&15,a[l++]=f>>>16&15,a[l++]=f>>>20&15,a[l++]=f>>>24&15,a[l++]=f>>>28&15,a[l++]=m>>>0&15,a[l++]=m>>>4&15,a[l++]=m>>>8&15,a[l++]=m>>>12&15,a[l++]=m>>>16&15,a[l++]=m>>>20&15,a[l++]=m>>>24&15,a[l++]=m>>>28&15}})(t,e,i,r);break;case 5:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0;a[l++]=p>>>0&31,a[l++]=p>>>5&31,a[l++]=p>>>10&31,a[l++]=p>>>15&31,a[l++]=p>>>20&31,a[l++]=p>>>25&31,a[l++]=31&(p>>>30|(7&d)<<2),a[l++]=d>>>3&31,a[l++]=d>>>8&31,a[l++]=d>>>13&31,a[l++]=d>>>18&31,a[l++]=d>>>23&31,a[l++]=31&(d>>>28|(1&f)<<4),a[l++]=f>>>1&31,a[l++]=f>>>6&31,a[l++]=f>>>11&31,a[l++]=f>>>16&31,a[l++]=f>>>21&31,a[l++]=f>>>26&31,a[l++]=31&(f>>>31|(15&m)<<1),a[l++]=m>>>4&31,a[l++]=m>>>9&31,a[l++]=m>>>14&31,a[l++]=m>>>19&31,a[l++]=m>>>24&31,a[l++]=31&(m>>>29|(3&_)<<3),a[l++]=_>>>2&31,a[l++]=_>>>7&31,a[l++]=_>>>12&31,a[l++]=_>>>17&31,a[l++]=_>>>22&31,a[l++]=_>>>27&31}})(t,e,i,r);break;case 6:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0,y=o[u++]>>>0;a[l++]=p>>>0&63,a[l++]=p>>>6&63,a[l++]=p>>>12&63,a[l++]=p>>>18&63,a[l++]=p>>>24&63,a[l++]=63&(p>>>30|(15&d)<<2),a[l++]=d>>>4&63,a[l++]=d>>>10&63,a[l++]=d>>>16&63,a[l++]=d>>>22&63,a[l++]=63&(d>>>28|(3&f)<<4),a[l++]=f>>>2&63,a[l++]=f>>>8&63,a[l++]=f>>>14&63,a[l++]=f>>>20&63,a[l++]=f>>>26&63,a[l++]=m>>>0&63,a[l++]=m>>>6&63,a[l++]=m>>>12&63,a[l++]=m>>>18&63,a[l++]=m>>>24&63,a[l++]=63&(m>>>30|(15&_)<<2),a[l++]=_>>>4&63,a[l++]=_>>>10&63,a[l++]=_>>>16&63,a[l++]=_>>>22&63,a[l++]=63&(_>>>28|(3&y)<<4),a[l++]=y>>>2&63,a[l++]=y>>>8&63,a[l++]=y>>>14&63,a[l++]=y>>>20&63,a[l++]=y>>>26&63}})(t,e,i,r);break;case 7:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0,y=o[u++]>>>0,v=o[u++]>>>0;a[l++]=p>>>0&127,a[l++]=p>>>7&127,a[l++]=p>>>14&127,a[l++]=p>>>21&127,a[l++]=127&(p>>>28|(7&d)<<4),a[l++]=d>>>3&127,a[l++]=d>>>10&127,a[l++]=d>>>17&127,a[l++]=d>>>24&127,a[l++]=127&(d>>>31|(63&f)<<1),a[l++]=f>>>6&127,a[l++]=f>>>13&127,a[l++]=f>>>20&127,a[l++]=127&(f>>>27|(3&m)<<5),a[l++]=m>>>2&127,a[l++]=m>>>9&127,a[l++]=m>>>16&127,a[l++]=m>>>23&127,a[l++]=127&(m>>>30|(31&_)<<2),a[l++]=_>>>5&127,a[l++]=_>>>12&127,a[l++]=_>>>19&127,a[l++]=127&(_>>>26|(1&y)<<6),a[l++]=y>>>1&127,a[l++]=y>>>8&127,a[l++]=y>>>15&127,a[l++]=y>>>22&127,a[l++]=127&(y>>>29|(15&v)<<3),a[l++]=v>>>4&127,a[l++]=v>>>11&127,a[l++]=v>>>18&127,a[l++]=v>>>25&127}})(t,e,i,r);break;case 8:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0,y=o[u++]>>>0,v=o[u++]>>>0,g=o[u++]>>>0;a[l++]=p>>>0&255,a[l++]=p>>>8&255,a[l++]=p>>>16&255,a[l++]=p>>>24&255,a[l++]=d>>>0&255,a[l++]=d>>>8&255,a[l++]=d>>>16&255,a[l++]=d>>>24&255,a[l++]=f>>>0&255,a[l++]=f>>>8&255,a[l++]=f>>>16&255,a[l++]=f>>>24&255,a[l++]=m>>>0&255,a[l++]=m>>>8&255,a[l++]=m>>>16&255,a[l++]=m>>>24&255,a[l++]=_>>>0&255,a[l++]=_>>>8&255,a[l++]=_>>>16&255,a[l++]=_>>>24&255,a[l++]=y>>>0&255,a[l++]=y>>>8&255,a[l++]=y>>>16&255,a[l++]=y>>>24&255,a[l++]=v>>>0&255,a[l++]=v>>>8&255,a[l++]=v>>>16&255,a[l++]=v>>>24&255,a[l++]=g>>>0&255,a[l++]=g>>>8&255,a[l++]=g>>>16&255,a[l++]=g>>>24&255}})(t,e,i,r);break;case 16:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<128;h++){let p=o[u++]>>>0;a[l++]=65535&p,a[l++]=p>>>16&65535}})(t,e,i,r);break;default:(function(o,s,a,c,l){let u=kh[l]>>>0,h=s,p=0,d=o[h]>>>0,f=c;for(let m=0;m<8;m++){for(let _=0;_<32;_++)if(p+l<=32)a[f+_]=d>>>p&u,p+=l,p===32&&(p=0,h++,_!==31&&(d=o[h]>>>0));else{let y=32-p,v=d>>>p;h++,d=o[h]>>>0;let g=l-y;a[f+_]=(v|(d&-1>>>32-g>>>0)<<y)&u,p=g}f+=32,p=0,m<7&&(d=o[h]>>>0)}})(t,e,i,r,n)}return e+(n<<3)|0}function Xx(t,e,i,r){if(i+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);let n=t[i++],o=t[i++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:o,bytePosIn:i}}function Yx(t,e,i,r,n,o,s,a,c){let{maxBits:l,exceptionBitWidth:u,bytePosIn:h}=function(_,y,v,g,x,b){if(v+1>y)throw Error(`FastPFOR decode: exception header underflow at block=${b} (need 1 byte for maxBits, bytePos=${v}, byteSize=${y})`);let w=_[v++];if(w<g||w>32)throw Error(`FastPFOR decode: invalid maxBits=${w} at block=${b} (bitWidth=${g}, expected ${g}..32)`);let T=w-g|0;if(T<1||T>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${T} at block=${b} (bitWidth=${g}, maxBits=${w})`);if(v+x>y)throw Error(`FastPFOR decode: exception positions underflow at block=${b} (need=${x}, have=${y-v})`);return{maxBits:w,exceptionBitWidth:T,bytePosIn:v}}(n,o,s,i,r,c);if(s=h,u===1){let _=1<<i;for(let y=0;y<r;y=y+1|0)t[n[s++]+e|0]|=_;return s}let p=a.dataToBePacked[u];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${i}, maxBits=${l}) at block ${c}`);let d=a.dataPointers,f=0|d[u],m=0|a.exceptionSizes[u];if(f+r>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${f}, need ${r}, size=${m}) at block ${c}`);for(let _=0;_<r;_=_+1|0){let y=n[s++],v=0|p[f++];t[y+e|0]|=v<<i}return d[u]=f,s}function Kx(t,e,i,r,n,o){let s=0|i,a=0|t[s];if(a<=0||s+a>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let c=s+1|0,l=s+a|0,u=t[l]>>>0,h=u+3>>>2,p=l+1,d=p+h;if(d>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${h}, pageStart=${s}, packedEnd=${l}, byteContainerStart=${p}) causes bitmapPos=${d} out of bounds (encoded.length=${t.length})`);let f=function(y,v,g,x){x.byteContainer.length<g&&(x.byteContainer=new Uint8Array(2*g),x.byteContainerI32=void 0);let b=x.byteContainer,w=g>>>2;if(3&b.byteOffset)for(let P=0;P<w;P=P+1|0){let S=0|y[v+P|0],E=P<<2;b[E]=255&S,b[E+1|0]=S>>>8&255,b[E+2|0]=S>>>16&255,b[E+3|0]=S>>>24&255}else{let P=x.byteContainerI32;(!P||P.buffer!==b.buffer||P.byteOffset!==b.byteOffset||P.length<w)&&(P=x.byteContainerI32=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>>2)),P.set(y.subarray(v,v+w))}let T=3&g;if(T>0){let P=0|y[v+w|0],S=w<<2;for(let E=0;E<T;E=E+1|0)b[S+E|0]=P>>>(E<<3)&255}return b}(t,p,u,o),m=u,_=function(y,v,g){let x=0|y[v++],b=g.dataToBePacked;for(let w=2;w<=32;w=w+1|0){if(!(x>>>w-1&1))continue;if(v>=y.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${w}, streamWordIndex=${v}, needWords=1, availableWords=${y.length-v}, encodedWords=${y.length})`);let T=y[v++]>>>0,P=Lh(T+31,32),S=T*w+31>>>5;if(v+S>y.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${w}, size=${T}, streamWordIndex=${v}, needWords=${S}, availableWords=${y.length-v}, encodedWords=${y.length})`);let E=b[w];(!E||E.length<P)&&(E=b[w]=new Uint32Array(P));let I=0;for(;I<T;I=I+32|0)Jx(y,v,E,I,w),v=v+w|0;v=v-((I-T|0)*w>>>5)|0,g.exceptionSizes[w]=T}return v}(t,d,o);return o.dataPointers.fill(0),function(y,v,g,x,b,w,T,P,S,E){let I=0|g,C=0;for(let A=0;A<T;A=A+1|0){let M=Xx(P,S,C,A);C=M.bytePosIn;let{bitWidth:k,exceptionCount:L}=M,O=w+A*Ei|0;switch(k){case 0:b.fill(0,O,O+Ei);break;case 32:for(let q=0;q<Ei;q=q+1|0)b[O+q|0]=0|y[I+q|0];I=I+Ei|0;break;default:I=Hx(y,I,b,O,k)}L>0&&(C=Yx(b,O,k,L,P,S,C,E,A))}if(I!==x)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${v}, packedStart=${g}, consumedPackedEnd=${I}, expectedPackedEnd=${x}, packedWords=${x-g}, encoded.length=${y.length})`)}(t,s,c,l,e,0|r,n/Ei|0,f,m,o),_}function Jx(t,e,i,r,n){switch(n){case 2:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0;h[d++]=f>>>0&3,h[d++]=f>>>2&3,h[d++]=f>>>4&3,h[d++]=f>>>6&3,h[d++]=f>>>8&3,h[d++]=f>>>10&3,h[d++]=f>>>12&3,h[d++]=f>>>14&3,h[d++]=f>>>16&3,h[d++]=f>>>18&3,h[d++]=f>>>20&3,h[d++]=f>>>22&3,h[d++]=f>>>24&3,h[d++]=f>>>26&3,h[d++]=f>>>28&3,h[d++]=f>>>30&3,h[d++]=m>>>0&3,h[d++]=m>>>2&3,h[d++]=m>>>4&3,h[d++]=m>>>6&3,h[d++]=m>>>8&3,h[d++]=m>>>10&3,h[d++]=m>>>12&3,h[d++]=m>>>14&3,h[d++]=m>>>16&3,h[d++]=m>>>18&3,h[d++]=m>>>20&3,h[d++]=m>>>22&3,h[d++]=m>>>24&3,h[d++]=m>>>26&3,h[d++]=m>>>28&3,h[d]=m>>>30&3}(t,e,i,r);case 3:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0;h[d++]=f>>>0&7,h[d++]=f>>>3&7,h[d++]=f>>>6&7,h[d++]=f>>>9&7,h[d++]=f>>>12&7,h[d++]=f>>>15&7,h[d++]=f>>>18&7,h[d++]=f>>>21&7,h[d++]=f>>>24&7,h[d++]=f>>>27&7,h[d++]=7&(f>>>30|(1&m)<<2),h[d++]=m>>>1&7,h[d++]=m>>>4&7,h[d++]=m>>>7&7,h[d++]=m>>>10&7,h[d++]=m>>>13&7,h[d++]=m>>>16&7,h[d++]=m>>>19&7,h[d++]=m>>>22&7,h[d++]=m>>>25&7,h[d++]=m>>>28&7,h[d++]=7&(m>>>31|(3&_)<<1),h[d++]=_>>>2&7,h[d++]=_>>>5&7,h[d++]=_>>>8&7,h[d++]=_>>>11&7,h[d++]=_>>>14&7,h[d++]=_>>>17&7,h[d++]=_>>>20&7,h[d++]=_>>>23&7,h[d++]=_>>>26&7,h[d]=_>>>29&7}(t,e,i,r);case 4:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0;h[d++]=f>>>0&15,h[d++]=f>>>4&15,h[d++]=f>>>8&15,h[d++]=f>>>12&15,h[d++]=f>>>16&15,h[d++]=f>>>20&15,h[d++]=f>>>24&15,h[d++]=f>>>28&15,h[d++]=m>>>0&15,h[d++]=m>>>4&15,h[d++]=m>>>8&15,h[d++]=m>>>12&15,h[d++]=m>>>16&15,h[d++]=m>>>20&15,h[d++]=m>>>24&15,h[d++]=m>>>28&15,h[d++]=_>>>0&15,h[d++]=_>>>4&15,h[d++]=_>>>8&15,h[d++]=_>>>12&15,h[d++]=_>>>16&15,h[d++]=_>>>20&15,h[d++]=_>>>24&15,h[d++]=_>>>28&15,h[d++]=y>>>0&15,h[d++]=y>>>4&15,h[d++]=y>>>8&15,h[d++]=y>>>12&15,h[d++]=y>>>16&15,h[d++]=y>>>20&15,h[d++]=y>>>24&15,h[d]=y>>>28&15}(t,e,i,r);case 5:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0;h[d++]=f>>>0&31,h[d++]=f>>>5&31,h[d++]=f>>>10&31,h[d++]=f>>>15&31,h[d++]=f>>>20&31,h[d++]=f>>>25&31,h[d++]=31&(f>>>30|(7&m)<<2),h[d++]=m>>>3&31,h[d++]=m>>>8&31,h[d++]=m>>>13&31,h[d++]=m>>>18&31,h[d++]=m>>>23&31,h[d++]=31&(m>>>28|(1&_)<<4),h[d++]=_>>>1&31,h[d++]=_>>>6&31,h[d++]=_>>>11&31,h[d++]=_>>>16&31,h[d++]=_>>>21&31,h[d++]=_>>>26&31,h[d++]=31&(_>>>31|(15&y)<<1),h[d++]=y>>>4&31,h[d++]=y>>>9&31,h[d++]=y>>>14&31,h[d++]=y>>>19&31,h[d++]=y>>>24&31,h[d++]=31&(y>>>29|(3&v)<<3),h[d++]=v>>>2&31,h[d++]=v>>>7&31,h[d++]=v>>>12&31,h[d++]=v>>>17&31,h[d++]=v>>>22&31,h[d]=v>>>27&31}(t,e,i,r);case 6:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0;h[d++]=f>>>0&63,h[d++]=f>>>6&63,h[d++]=f>>>12&63,h[d++]=f>>>18&63,h[d++]=f>>>24&63,h[d++]=63&(f>>>30|(15&m)<<2),h[d++]=m>>>4&63,h[d++]=m>>>10&63,h[d++]=m>>>16&63,h[d++]=m>>>22&63,h[d++]=63&(m>>>28|(3&_)<<4),h[d++]=_>>>2&63,h[d++]=_>>>8&63,h[d++]=_>>>14&63,h[d++]=_>>>20&63,h[d++]=_>>>26&63,h[d++]=y>>>0&63,h[d++]=y>>>6&63,h[d++]=y>>>12&63,h[d++]=y>>>18&63,h[d++]=y>>>24&63,h[d++]=63&(y>>>30|(15&v)<<2),h[d++]=v>>>4&63,h[d++]=v>>>10&63,h[d++]=v>>>16&63,h[d++]=v>>>22&63,h[d++]=63&(v>>>28|(3&g)<<4),h[d++]=g>>>2&63,h[d++]=g>>>8&63,h[d++]=g>>>14&63,h[d++]=g>>>20&63,h[d]=g>>>26&63}(t,e,i,r);case 7:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0;h[d++]=f>>>0&127,h[d++]=f>>>7&127,h[d++]=f>>>14&127,h[d++]=f>>>21&127,h[d++]=127&(f>>>28|(7&m)<<4),h[d++]=m>>>3&127,h[d++]=m>>>10&127,h[d++]=m>>>17&127,h[d++]=m>>>24&127,h[d++]=127&(m>>>31|(63&_)<<1),h[d++]=_>>>6&127,h[d++]=_>>>13&127,h[d++]=_>>>20&127,h[d++]=127&(_>>>27|(3&y)<<5),h[d++]=y>>>2&127,h[d++]=y>>>9&127,h[d++]=y>>>16&127,h[d++]=y>>>23&127,h[d++]=127&(y>>>30|(31&v)<<2),h[d++]=v>>>5&127,h[d++]=v>>>12&127,h[d++]=v>>>19&127,h[d++]=127&(v>>>26|(1&g)<<6),h[d++]=g>>>1&127,h[d++]=g>>>8&127,h[d++]=g>>>15&127,h[d++]=g>>>22&127,h[d++]=127&(g>>>29|(15&x)<<3),h[d++]=x>>>4&127,h[d++]=x>>>11&127,h[d++]=x>>>18&127,h[d]=x>>>25&127}(t,e,i,r);case 8:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0;h[d++]=f>>>0&255,h[d++]=f>>>8&255,h[d++]=f>>>16&255,h[d++]=f>>>24&255,h[d++]=m>>>0&255,h[d++]=m>>>8&255,h[d++]=m>>>16&255,h[d++]=m>>>24&255,h[d++]=_>>>0&255,h[d++]=_>>>8&255,h[d++]=_>>>16&255,h[d++]=_>>>24&255,h[d++]=y>>>0&255,h[d++]=y>>>8&255,h[d++]=y>>>16&255,h[d++]=y>>>24&255,h[d++]=v>>>0&255,h[d++]=v>>>8&255,h[d++]=v>>>16&255,h[d++]=v>>>24&255,h[d++]=g>>>0&255,h[d++]=g>>>8&255,h[d++]=g>>>16&255,h[d++]=g>>>24&255,h[d++]=x>>>0&255,h[d++]=x>>>8&255,h[d++]=x>>>16&255,h[d++]=x>>>24&255,h[d++]=b>>>0&255,h[d++]=b>>>8&255,h[d++]=b>>>16&255,h[d]=b>>>24&255}(t,e,i,r);case 9:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0;h[d++]=f>>>0&511,h[d++]=f>>>9&511,h[d++]=f>>>18&511,h[d++]=511&(f>>>27|(15&m)<<5),h[d++]=m>>>4&511,h[d++]=m>>>13&511,h[d++]=m>>>22&511,h[d++]=511&(m>>>31|(255&_)<<1),h[d++]=_>>>8&511,h[d++]=_>>>17&511,h[d++]=511&(_>>>26|(7&y)<<6),h[d++]=y>>>3&511,h[d++]=y>>>12&511,h[d++]=y>>>21&511,h[d++]=511&(y>>>30|(127&v)<<2),h[d++]=v>>>7&511,h[d++]=v>>>16&511,h[d++]=511&(v>>>25|(3&g)<<7),h[d++]=g>>>2&511,h[d++]=g>>>11&511,h[d++]=g>>>20&511,h[d++]=511&(g>>>29|(63&x)<<3),h[d++]=x>>>6&511,h[d++]=x>>>15&511,h[d++]=511&(x>>>24|(1&b)<<8),h[d++]=b>>>1&511,h[d++]=b>>>10&511,h[d++]=b>>>19&511,h[d++]=511&(b>>>28|(31&w)<<4),h[d++]=w>>>5&511,h[d++]=w>>>14&511,h[d]=w>>>23&511}(t,e,i,r);case 10:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0;h[d++]=f>>>0&1023,h[d++]=f>>>10&1023,h[d++]=f>>>20&1023,h[d++]=1023&(f>>>30|(255&m)<<2),h[d++]=m>>>8&1023,h[d++]=m>>>18&1023,h[d++]=1023&(m>>>28|(63&_)<<4),h[d++]=_>>>6&1023,h[d++]=_>>>16&1023,h[d++]=1023&(_>>>26|(15&y)<<6),h[d++]=y>>>4&1023,h[d++]=y>>>14&1023,h[d++]=1023&(y>>>24|(3&v)<<8),h[d++]=v>>>2&1023,h[d++]=v>>>12&1023,h[d++]=v>>>22&1023,h[d++]=g>>>0&1023,h[d++]=g>>>10&1023,h[d++]=g>>>20&1023,h[d++]=1023&(g>>>30|(255&x)<<2),h[d++]=x>>>8&1023,h[d++]=x>>>18&1023,h[d++]=1023&(x>>>28|(63&b)<<4),h[d++]=b>>>6&1023,h[d++]=b>>>16&1023,h[d++]=1023&(b>>>26|(15&w)<<6),h[d++]=w>>>4&1023,h[d++]=w>>>14&1023,h[d++]=1023&(w>>>24|(3&T)<<8),h[d++]=T>>>2&1023,h[d++]=T>>>12&1023,h[d]=T>>>22&1023}(t,e,i,r);case 11:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0,P=l[u+10]>>>0;h[d++]=f>>>0&2047,h[d++]=f>>>11&2047,h[d++]=2047&(f>>>22|(1&m)<<10),h[d++]=m>>>1&2047,h[d++]=m>>>12&2047,h[d++]=2047&(m>>>23|(3&_)<<9),h[d++]=_>>>2&2047,h[d++]=_>>>13&2047,h[d++]=2047&(_>>>24|(7&y)<<8),h[d++]=y>>>3&2047,h[d++]=y>>>14&2047,h[d++]=2047&(y>>>25|(15&v)<<7),h[d++]=v>>>4&2047,h[d++]=v>>>15&2047,h[d++]=2047&(v>>>26|(31&g)<<6),h[d++]=g>>>5&2047,h[d++]=g>>>16&2047,h[d++]=2047&(g>>>27|(63&x)<<5),h[d++]=x>>>6&2047,h[d++]=x>>>17&2047,h[d++]=2047&(x>>>28|(127&b)<<4),h[d++]=b>>>7&2047,h[d++]=b>>>18&2047,h[d++]=2047&(b>>>29|(255&w)<<3),h[d++]=w>>>8&2047,h[d++]=w>>>19&2047,h[d++]=2047&(w>>>30|(511&T)<<2),h[d++]=T>>>9&2047,h[d++]=T>>>20&2047,h[d++]=2047&(T>>>31|(1023&P)<<1),h[d++]=P>>>10&2047,h[d]=P>>>21&2047}(t,e,i,r);case 12:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0,P=l[u+10]>>>0,S=l[u+11]>>>0;h[d++]=f>>>0&4095,h[d++]=f>>>12&4095,h[d++]=4095&(f>>>24|(15&m)<<8),h[d++]=m>>>4&4095,h[d++]=m>>>16&4095,h[d++]=4095&(m>>>28|(255&_)<<4),h[d++]=_>>>8&4095,h[d++]=_>>>20&4095,h[d++]=y>>>0&4095,h[d++]=y>>>12&4095,h[d++]=4095&(y>>>24|(15&v)<<8),h[d++]=v>>>4&4095,h[d++]=v>>>16&4095,h[d++]=4095&(v>>>28|(255&g)<<4),h[d++]=g>>>8&4095,h[d++]=g>>>20&4095,h[d++]=x>>>0&4095,h[d++]=x>>>12&4095,h[d++]=4095&(x>>>24|(15&b)<<8),h[d++]=b>>>4&4095,h[d++]=b>>>16&4095,h[d++]=4095&(b>>>28|(255&w)<<4),h[d++]=w>>>8&4095,h[d++]=w>>>20&4095,h[d++]=T>>>0&4095,h[d++]=T>>>12&4095,h[d++]=4095&(T>>>24|(15&P)<<8),h[d++]=P>>>4&4095,h[d++]=P>>>16&4095,h[d++]=4095&(P>>>28|(255&S)<<4),h[d++]=S>>>8&4095,h[d]=S>>>20&4095}(t,e,i,r);case 16:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0,P=l[u+10]>>>0,S=l[u+11]>>>0,E=l[u+12]>>>0,I=l[u+13]>>>0,C=l[u+14]>>>0,A=l[u+15]>>>0;h[d++]=f>>>0&65535,h[d++]=f>>>16&65535,h[d++]=m>>>0&65535,h[d++]=m>>>16&65535,h[d++]=_>>>0&65535,h[d++]=_>>>16&65535,h[d++]=y>>>0&65535,h[d++]=y>>>16&65535,h[d++]=v>>>0&65535,h[d++]=v>>>16&65535,h[d++]=g>>>0&65535,h[d++]=g>>>16&65535,h[d++]=x>>>0&65535,h[d++]=x>>>16&65535,h[d++]=b>>>0&65535,h[d++]=b>>>16&65535,h[d++]=w>>>0&65535,h[d++]=w>>>16&65535,h[d++]=T>>>0&65535,h[d++]=T>>>16&65535,h[d++]=P>>>0&65535,h[d++]=P>>>16&65535,h[d++]=S>>>0&65535,h[d++]=S>>>16&65535,h[d++]=E>>>0&65535,h[d++]=E>>>16&65535,h[d++]=I>>>0&65535,h[d++]=I>>>16&65535,h[d++]=C>>>0&65535,h[d++]=C>>>16&65535,h[d++]=A>>>0&65535,h[d]=A>>>16&65535}(t,e,i,r);case 32:for(let l=0;l<32;l=l+1|0)i[r+l|0]=0|t[e+l|0];return}let o=kh[n]>>>0,s=e,a=0,c=t[s]>>>0;for(let l=0;l<32;l++)if(a+n<=32)i[r+l]=c>>>a&o,a+=n,a===32&&(a=0,s++,l!==31&&(c=t[s]>>>0));else{let u=32-a,h=c>>>a;s++,c=t[s]>>>0,i[r+l]=(h|(c&kh[n-u]>>>0)<<u)&o,a=n-u}}function ae(t,e,i){let r=new Uint32Array(i),n=0,o=e.get();for(let s=0;s<r.length;s++){let a=t[o++],c=127&a;a<128||(a=t[o++],c|=(127&a)<<7,a<128||(a=t[o++],c|=(127&a)<<14,a<128||(a=t[o++],c|=(127&a)<<21,a<128||(a=t[o++],c|=(15&a)<<28)))),r[n++]=c}return e.set(o),r}function ln(t,e,i){let r=new BigUint64Array(i);for(let n=0;n<r.length;n++)r[n]=Qx(t,e);return r}function Qx(t,e){let i=0n,r=0,n=e.get();for(;n<t.length;){let o=t[n++];if(i|=BigInt(127&o)<<BigInt(r),!(128&o))break;if(r+=7,r>=64)throw Error("Varint too long")}return e.set(n),i}function t1(t,e){let i,r;return r=t[e.get()],e.increment(),i=127&r,r<128?i:(r=t[e.get()],e.increment(),i|=(127&r)<<7,r<128?i:(r=t[e.get()],e.increment(),i|=(127&r)<<14,r<128?i:(r=t[e.get()],e.increment(),i|=(127&r)<<21,r<128?i:(r=t[e.get()],i|=(15&r)<<28,function(n,o,s){let a,c;if(c=o[s.get()],s.increment(),a=(112&c)>>4,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<3,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<10,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<17,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<24,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(1&c)<<31,c<128)return 4294967296*a+(n>>>0);throw Error("Expected varint not more than 10 bytes")}(i,t,e)))))}function Tt(t){return t>>>1^-(1&t)}function ue(t){return t>>1n^-(1n&t)}function cn(t){return t%2==1?(t+1)/-2:t/2}function Bh(t,e,i){if(i===void 0){i=0;for(let o=0;o<e;o++)i+=t[o]}let r=new Uint32Array(i),n=0;for(let o=0;o<e;o++){let s=t[o];r.fill(t[o+e],n,n+s),n+=s}return r}function Oh(t,e,i){if(i===void 0){i=0;for(let o=0;o<e;o++)i+=Number(t[o])}let r=new BigUint64Array(i),n=0;for(let o=0;o<e;o++){let s=Number(t[o]);r.fill(t[o+e],n,n+s),n+=s}return r}function o_(t,e,i){let r=new Float64Array(i),n=0;for(let o=0;o<e;o++){let s=t[o];r.fill(t[o+e],n,n+s),n+=s}return r}function s_(t){let e=new Int32Array(t.length);e[0]=Tt(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let n=t[r+1],o=t[r+2],s=t[r+3];e[r]=Tt(t[r])+e[r-1],e[r+1]=Tt(n)+e[r],e[r+2]=Tt(o)+e[r+1],e[r+3]=Tt(s)+e[r+2]}for(;r!==t.length;++r)e[r]=Tt(t[r])+e[r-1];return e}function a_(t){let e=new BigInt64Array(t.length);e[0]=ue(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let n=t[r+1],o=t[r+2],s=t[r+3];e[r]=ue(t[r])+e[r-1],e[r+1]=ue(n)+e[r],e[r+2]=ue(o)+e[r+1],e[r+3]=ue(s)+e[r+2]}for(;r!==e.length;++r)e[r]=ue(t[r])+e[r-1];return e}function jh(t){let e=t.length/4*4,i=1;if(e>=4)for(let r=t[0];i<e-4;i+=4)r=t[i]+=r,r=t[i+1]+=r,r=t[i+2]+=r,r=t[i+3]+=r;for(;i!==t.length;)t[i]+=t[i-1],++i}var ie,ri,mr,Pe,Mt,Xt,l_,Vi;function de(t,e){let i=function(r,n){let o=r[n.get()],s=Object.values(ie)[o>>4],a=null;switch(s){case ie.DATA:a={dictionaryType:Object.values(ri)[15&o]};break;case ie.OFFSET:a={offsetType:Object.values(mr)[15&o]};break;case ie.LENGTH:a={lengthType:Object.values(Pe)[15&o]}}n.increment();let c=r[n.get()],l=Object.values(ut)[c>>5],u=Object.values(ut)[c>>2&7],h=Object.values(Ni)[3&c];n.increment();let p=ae(r,n,2),d=p[0];return{physicalStreamType:s,logicalStreamType:a,logicalLevelTechnique1:l,logicalLevelTechnique2:u,physicalLevelTechnique:h,numValues:d,byteLength:p[1],decompressedCount:d}}(t,e);return i.logicalLevelTechnique1===ut.MORTON?function(r,n,o){let s=ae(n,o,2);return{physicalStreamType:r.physicalStreamType,logicalStreamType:r.logicalStreamType,logicalLevelTechnique1:r.logicalLevelTechnique1,logicalLevelTechnique2:r.logicalLevelTechnique2,physicalLevelTechnique:r.physicalLevelTechnique,numValues:r.numValues,byteLength:r.byteLength,decompressedCount:r.decompressedCount,numBits:s[0],coordinateShift:s[1]}}(i,t,e):ut.RLE!==i.logicalLevelTechnique1&&ut.RLE!==i.logicalLevelTechnique2||Ni.NONE===i.physicalLevelTechnique?i:function(r,n,o){let s=ae(n,o,2);return{physicalStreamType:r.physicalStreamType,logicalStreamType:r.logicalStreamType,logicalLevelTechnique1:r.logicalLevelTechnique1,logicalLevelTechnique2:r.logicalLevelTechnique2,physicalLevelTechnique:r.physicalLevelTechnique,numValues:r.numValues,byteLength:r.byteLength,decompressedCount:s[1],runs:s[0],numRleValues:s[1]}}(i,t,e)}(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(ie||(ie={})),function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"}(ri||(ri={})),function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"}(mr||(mr={})),function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"}(Pe||(Pe={})),function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Mt||(Mt={}));class We{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8);return(this.values[e]>>t%8&1)==1}set(t,e){let i=Math.floor(t/8);this.values[i]=this.values[i]|(e?1:0)<<t%8}getInt(t){let e=Math.floor(t/8);return this.values[e]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function hn(t,e,i){if(!e)return t;let r=e.size(),n=new t.constructor(r),o=0;for(let s=0;s<r;s++)n[s]=e.get(s)?t[o++]:i;return n}function Nh(t,e,i,r,n){return function(o,s,a,c){let l;switch(s.logicalLevelTechnique1){case ut.DELTA:if(s.logicalLevelTechnique2===ut.RLE){let u=s;if(!c)return function(h,p,d){let f=new Int32Array(d),m=0,_=0;for(let y=0;y<p;y++){let v=h[y],g=Tt(h[y+p]);for(let x=0;x<v;x++)_+=g,f[m++]=_}return f}(o,u.runs,u.numRleValues);l=s_(o=Bh(o,u.runs,u.numRleValues))}else l=s_(o);break;case ut.RLE:l=function(u,h,p){if(p===void 0){p=0;for(let m=0;m<h;m++)p+=u[m]}let d=new Int32Array(p),f=0;for(let m=0;m<h;m++){let _=u[m],y=u[m+h];y=Tt(y),d.fill(y,f,f+_),f+=_}return d}(o,s.runs,s.numRleValues);break;case ut.MORTON:jh(o),l=new Int32Array(o);break;case ut.COMPONENTWISE_DELTA:l=function(u){if(u.length<2)return new Int32Array(u);let h=new Int32Array(u.length);h[0]=Tt(u[0]),h[1]=Tt(u[1]);let p=u.length/4*4,d=2;if(p>=4)for(;d<p-4;d+=4){let f=u[d+1],m=u[d+2],_=u[d+3];h[d]=Tt(u[d])+h[d-2],h[d+1]=Tt(f)+h[d-1],h[d+2]=Tt(m)+h[d],h[d+3]=Tt(_)+h[d+1]}for(;d!==u.length;d+=2)h[d]=Tt(u[d])+h[d-2],h[d+1]=Tt(u[d+1])+h[d-1];return h}(o);break;case ut.NONE:l=function(u){let h=new Int32Array(u.length);for(let p=0;p<u.length;p++)h[p]=Tt(u[p]);return h}(o);break;default:throw Error(`The specified Logical level technique is not supported: ${s.logicalLevelTechnique1}`)}return c?hn(l,c,0):l}(un(t,e,i),i,0,n)}function Ie(t,e,i,r,n){return function(o,s,a,c){let l;switch(s.logicalLevelTechnique1){case ut.DELTA:l=function(u){let h=new Uint32Array(u.length);h[0]=Tt(u[0])>>>0;for(let p=1;p<u.length;p++)h[p]=h[p-1]+Tt(u[p])>>>0;return h}(s.logicalLevelTechnique2===ut.RLE?Bh(o,s.runs,s.numRleValues):o);break;case ut.RLE:l=Bh(o,s.runs,s.numRleValues);break;case ut.MORTON:jh(o),l=o;break;case ut.COMPONENTWISE_DELTA:l=function(u){if(u.length<2)return new Uint32Array(u);let h=new Uint32Array(u.length);h[0]=Tt(u[0])>>>0,h[1]=Tt(u[1])>>>0;for(let p=2;p<u.length;p+=2)h[p]=h[p-2]+Tt(u[p])>>>0,h[p+1]=h[p-1]+Tt(u[p+1])>>>0;return h}(o);break;case ut.NONE:l=o;break;default:throw Error(`The specified Logical level technique is not supported: ${s.logicalLevelTechnique1}`)}return c?hn(l,c,0):l}(un(t,e,i),i,0,n)}function Ui(t,e,i){return function(r,n){if(n.logicalLevelTechnique1===ut.DELTA&&n.logicalLevelTechnique2===ut.NONE)return function(o){let s=new Int32Array(o.length+1);s[0]=0,s[1]=Tt(o[0]);let a=s[1];for(let c=2;c!==s.length;++c)a+=Tt(o[c-1]),s[c]=s[c-1]+a;return new Uint32Array(s)}(r);if(n.logicalLevelTechnique1===ut.RLE&&n.logicalLevelTechnique2===ut.NONE)return function(o,s,a){let c=new Uint32Array(a+1);c[0]=0;let l=1,u=c[0];for(let h=0;h<s;h++){let p=o[h],d=o[h+s];for(let f=l;f<l+p;f++)c[f]=d+u,u=c[f];l+=p}return c}(r,n.runs,n.numRleValues);if(n.logicalLevelTechnique1===ut.NONE&&n.logicalLevelTechnique2===ut.NONE){(function(s){let a=0;for(let c=0;c<s.length;c++)s[c]+=a,a=s[c]})(r);let o=new Uint32Array(n.numValues+1);return o[0]=0,o.set(r,1),o}if(n.logicalLevelTechnique1===ut.DELTA&&n.logicalLevelTechnique2===ut.RLE){let o=function(s,a,c){let l=new Int32Array(c+1);l[0]=0;let u=1,h=l[0];for(let p=0;p<a;p++){let d=s[p],f=s[p+a];f=Tt(f);for(let m=u;m<u+d;m++)l[m]=f+h,h=l[m];u+=d}return l}(r,n.runs,n.numRleValues);return jh(o),new Uint32Array(o)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(un(t,e,i),i)}function un(t,e,i){let r=i.physicalLevelTechnique;switch(r){case Ni.FAST_PFOR:return function(n,o,s,a){return function(c,l,u,h,p){let d=h.get();if(3&u)throw Error(`FastPFOR: invalid encodedByteLength=${u} at offset=${d} (encodedBytes.length=${c.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let f=u>>>2,m=function(y,v){if(v<=y.encodedWords.length)return y.encodedWords;let g=new Uint32Array(Math.max(16,2*v));return y.encodedWords=g,g}(p,f);(function(y,v,g,x){if(v<0||g<0||v+g>y.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${v}, byteLength=${g}, bytes.length=${y.length})`);let b=Math.floor(g/4),w=g%4!=0,T=w?b+1:b;if(x.length<T)throw RangeError(`decodeBigEndianInt32sInto: out.length=${x.length} < ${T}`);if(b>0){let P=y.byteOffset+v;if(3&P)for(let S=0;S<b;S++){let E=v+4*S;x[S]=y[E]<<24|y[E+1]<<16|y[E+2]<<8|y[E+3]}else{let S=new Uint32Array(y.buffer,P,b);for(let E=0;E<b;E++)x[E]=0|qx(S[E])}}if(w){let P=v+4*b,S=g-4*b,E=0;for(let I=0;I<S;I++)E|=y[P+I]<<24-8*I;x[b]=0|E}})(c,d,u,m);let _=function(y,v,g){let x=0,b=0,w=new Uint32Array(v),T=g??n_();if(y.length>0){let P=0|y[x];if(x=x+1|0,255&P)throw Error(`FastPFOR decode: invalid alignedLength=${P} (expected multiple of 256)`);if(b+P>w.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${b}, alignedLength=${P}, out.length=${w.length})`);x=function(S,E,I,C,A,M){let k=C+Lh(A,Ei),L=C,O=I;for(;L!==k;){let q=Math.min(Fh,k-L);O=Kx(S,E,O,L,q,M),L=L+q|0}return O}(y,w,x,b,P,T),b=b+P|0}return function(P,S,E,I,C,A){if(A===0)return S;let M=0,k=S,L=S+E,O=C,q=C,Q=C+A,rt=0,nt=0;for(;k<L&&q<Q;){let lt=P[k]>>>M&255;if(M+=8,k+=M>>>5,M&=31,rt|=(127&lt)<<nt,128&lt)I[q++]=0|rt,rt=0,nt=0;else if(nt+=7,nt>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${nt}, partial=${rt}, decoded=${q-O}/${A}, inPos=${k}, inEnd=${L})`)}if(q!==Q)throw Error(`FastPFOR VByte: truncated stream (decoded=${q-O}, expected=${A}, consumedWords=${k-S}/${E}, vbyteStart=${S}, vbyteEnd=${L})`)}(y,x,y.length-x|0,w,b,v-b|0),w}(m.subarray(0,f),l,p.decoderWorkspace);return h.add(u),_}(n,o,s,a,function(c=16){if(c<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${c}`);let l=Math.max(16,0|c);return{encodedWords:new Uint32Array(l),decoderWorkspace:n_()}}(s>>>2))}(t,i.numValues,i.byteLength,e);case Ni.VARINT:return ae(t,e,i.numValues);case Ni.NONE:{let n=e.get();e.add(i.byteLength);let o=t.subarray(n,e.get());return new Uint32Array(o)}default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Vh(t,e,i){let r=un(t,e,i);return r.length===1?r[0]:function(n){return n[1]}(r)}function c_(t,e,i){return function(r){if(r.length===2){let n=Tt(r[1]);return[n,n]}return[Tt(r[2]),Tt(r[3])]}(un(t,e,i))}function h_(t,e,i){return function(r){if(r.length===2){let n=ue(r[1]);return[n,n]}return[ue(r[2]),ue(r[3])]}(ln(t,e,i.numValues))}function u_(t,e,i,r){return function(n,o,s){let a;switch(o.logicalLevelTechnique1){case ut.DELTA:a=function(c){let l=new BigUint64Array(c.length);l[0]=BigInt.asUintN(64,ue(c[0]));for(let u=1;u<c.length;u++)l[u]=BigInt.asUintN(64,l[u-1]+ue(c[u]));return l}(o.logicalLevelTechnique2===ut.RLE?Oh(n,o.runs,o.numRleValues):n);break;case ut.RLE:a=Oh(n,o.runs,o.numRleValues);break;case ut.NONE:a=n;break;default:throw Error(`The specified Logical level technique is not supported: ${o.logicalLevelTechnique1}`)}return s?hn(a,s,0n):a}(ln(t,e,i.numValues),i,r)}function d_(t,e,i){let r=ln(t,e,i.numValues);return r.length===1?r[0]:function(n){return n[1]}(r)}function Oa(t,e,i,r,n="int32"){let o=t.logicalLevelTechnique1;if(o===ut.RLE)return t.runs===1?Mt.CONST:Mt.FLAT;if(o!==ut.DELTA||t.logicalLevelTechnique2!==ut.RLE)return t.numValues===1?Mt.CONST:Mt.FLAT;let s=e instanceof We?e.size():e;if(t.numRleValues!==s)return Mt.FLAT;if(t.runs===1)return Mt.SEQUENCE;if(t.runs!==2)return t.numValues===1?Mt.CONST:Mt.FLAT;let a=r.get();if(t.physicalLevelTechnique===Ni.VARINT)return function(u,h,p){let d=new Dh(h.get());if(p==="int64"){let m=ln(u,d,4);return m[2]===2n&&m[3]===2n}let f=ae(u,d,4);return f[2]===2&&f[3]===2}(i,r,n)?Mt.SEQUENCE:t.numValues===1?Mt.CONST:Mt.FLAT;let c=r.get(),l=new Int32Array(i.buffer,i.byteOffset+c,4);return r.set(a),l[2]===2&&l[3]===2?Mt.SEQUENCE:t.numValues===1?Mt.CONST:Mt.FLAT}class Uh extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class $h extends zh{constructor(t,e,i,r){super(t,BigInt64Array.of(e),i,r)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}function Zh(t,e,i){return{x:p_(t,e)-i,y:p_(t>>1,e)-i}}function p_(t,e){let i=0;for(let r=0;r<e;r++)i|=(t&1<<2*r)>>r;return i}function dn(t,e,i,r,n,o,s){return t===Vi.MORTON?function(a,c,l,u,h,p){let d=Array(h?u+1:u);for(let f=0;f<u;f++){let m=Zh(a[c[l+f]],p.numBits,p.coordinateShift);d[f]=new z(m.x,m.y)}return h&&(d[d.length-1]=d[0]),d}(e,i,r,n,o,s):function(a,c,l,u,h){let p=Array(h?u+1:u);for(let d=0;d<2*u;d+=2){let f=2*c[l+d/2];p[d/2]=new z(a[f],a[f+1])}return h&&(p[p.length-1]=p[0]),p}(e,i,r,n,o)}function pn(t,e,i,r){let n=Array(r?i+1:i);for(let o=0;o<2*i;o+=2)n[o/2]=new z(t[e+o],t[e+o+1]);return r&&(n[n.length-1]=n[0]),n}(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(Xt||(Xt={})),function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"}(l_||(l_={})),function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"}(Vi||(Vi={}));class Gh{constructor(t,e,i,r,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let i=Zh(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[i.x,i.y]}let e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return function(t){let e=Array(t.numGeometries),i=1,r=1,n=1,o=0,s=0,a=0,{mortonSettings:c,topologyVector:l}=t,{geometryOffsets:u,partOffsets:h,ringOffsets:p}=l,d=t.vertexOffsets,f=!d||d.length===0,m=t.containsPolygonGeometry(),_=t.vertexBuffer;for(let y=0;y<t.numGeometries;y++)switch(t.geometryType(y)){case Xt.POINT:{let v,g;if(f)v=_[s++],g=_[s++];else if(t.vertexBufferType===Vi.MORTON){let x=Zh(_[d[a++]],c.numBits,c.coordinateShift);v=x.x,g=x.y}else{let x=2*d[a++];v=_[x],g=_[x+1]}e[o++]=[[new z(v,g)]],u&&n++,h&&i++,p&&r++}break;case Xt.MULTIPOINT:{let v=u[n]-u[n-1];n++;let g=Array(v);if(f)for(let x=0;x<v;x++){let b=_[s++],w=_[s++];g[x]=new z(b,w)}else for(let x=0;x<v;x++){let b=2*d[a++];g[x]=new z(_[b],_[b+1])}e[o++]=g.map((x)=>[x]),i+=v,r+=v}break;case Xt.LINESTRING:{let v,g;m?(v=p[r]-p[r-1],r++):v=h[i]-h[i-1],i++,f?(g=pn(_,s,v,!1),s+=2*v):(g=dn(t.vertexBufferType,_,d,a,v,!1,c),a+=v),e[o++]=[g],u&&n++}break;case Xt.POLYGON:{let v=h[i]-h[i-1];i++;let g=Array(v-1),x,b=p[r]-p[r-1];if(r++,f){x=pn(_,s,b,!0),s+=2*b;for(let w=0;w<g.length;w++)b=p[r]-p[r-1],r++,g[w]=pn(_,s,b,!0),s+=2*b}else{x=dn(t.vertexBufferType,_,d,a,b,!0,c),a+=b;for(let w=0;w<g.length;w++)b=p[r]-p[r-1],r++,g[w]=dn(t.vertexBufferType,_,d,a,b,!0,c),a+=b}e[o++]=[x].concat(g),u&&n++}break;case Xt.MULTILINESTRING:{let v=u[n]-u[n-1];n++;let g=Array(v);for(let x=0;x<v;x++){let b;if(m?(b=p[r]-p[r-1],r++):b=h[i]-h[i-1],i++,f)g[x]=pn(_,s,b,!1),s+=2*b;else{let w=dn(t.vertexBufferType,_,d,a,b,!1,c);g[x]=w,a+=b}}e[o++]=g}break;case Xt.MULTIPOLYGON:{let v=u[n]-u[n-1];n++;let g=Array(v);for(let x=0;x<v;x++){let b=h[i]-h[i-1],w;i++;let T=Array(b-1),P=p[r]-p[r-1];r++,f?(w=pn(_,s,P,!0),s+=2*P):(w=dn(t.vertexBufferType,_,d,a,P,!0,c),a+=P);for(let S=0;S<T.length;S++){let E=p[r]-p[r-1];r++,f?(T[S]=pn(_,s,E,!0),s+=2*E):(T[S]=dn(t.vertexBufferType,_,d,a,E,!0,c),a+=E)}g[x]=[w].concat(T)}e[o++]=g.flat()}break;default:throw Error("The specified geometry type is currently not supported.")}return e}(this)}get mortonSettings(){return this._mortonSettings}}class qh extends Gh{constructor(t,e,i,r,n,o,s){super(i,r,n,o,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Xt.POLYGON||this._geometryType===Xt.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class Wh extends Gh{constructor(t,e,i,r,n,o){super(t,i,r,n,o),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===Xt.POLYGON||this.geometryType(t)===Xt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Hh{constructor(t,e,i,r){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=Array(this.numGeometries),e=this._topologyVector,{partOffsets:i,ringOffsets:r,geometryOffsets:n}=e,o=0,s=1,a=1,c=1;for(let l=0;l<this.numGeometries;l++)switch(this.geometryType(l)){case Xt.POLYGON:{let u=i[s]-i[s-1];s++;let h=[];for(let p=0;p<u;p++){let d=r[a]-r[a-1];a++;let f=[];for(let m=0;m<d;m++){let _=this._vertexBuffer[o++],y=this._vertexBuffer[o++];f.push(new z(_,y))}f.length>0&&f.push(f[0]),h.push(f)}t[l]=h,n&&c++}break;case Xt.MULTIPOLYGON:{let u=n[c]-n[c-1];c++;let h=[];for(let p=0;p<u;p++){let d=i[s]-i[s-1];s++;for(let f=0;f<d;f++){let m=r[a]-r[a-1];a++;let _=[];for(let y=0;y<m;y++){let v=this._vertexBuffer[o++],g=this._vertexBuffer[o++];_.push(new z(v,g))}_.length>0&&_.push(_[0]),h.push(_)}}t[l]=h}}return t}[Symbol.iterator](){return null}}function f_(t,e,i,r,n,o){return new m_(t,e,i,r,n,o)}class m_ extends Hh{constructor(t,e,i,r,n,o){super(i,r,n,o),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function __(t,e,i,r,n){return new g_(t,e,i,r,n)}class g_ extends Hh{constructor(t,e,i,r,n){super(e,i,r,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function e1(t,e,i,r,n){let o=de(t,i),s,a,c,l;if(Oa(o,r,t,i)===Mt.CONST){let v=Vh(t,i,o),g,x,b,w;for(let T=0;T<e-1;T++){let P=de(t,i);switch(P.physicalStreamType){case ie.LENGTH:switch(P.logicalStreamType.lengthType){case Pe.GEOMETRIES:g=Ui(t,i,P);break;case Pe.PARTS:x=Ui(t,i,P);break;case Pe.RINGS:b=Ui(t,i,P);break;case Pe.TRIANGLES:w=Ui(t,i,P)}break;case ie.OFFSET:switch(P.logicalStreamType.offsetType){case mr.VERTEX:s=Ie(t,i,P);break;case mr.INDEX:l=Ie(t,i,P)}break;case ie.DATA:ri.VERTEX===P.logicalStreamType.dictionaryType?a=Nh(t,i,P):(c={numBits:P.numBits,coordinateShift:P.coordinateShift},a=Ie(t,i,P))}}return l?g!==void 0||x!==void 0?f_(r,v,w,l,a,{geometryOffsets:g,partOffsets:x,ringOffsets:b}):f_(r,v,w,l,a):c===void 0?function(T,P,S,E,I){return new qh(T,P,Vi.VEC_2,S,E,I)}(r,v,{geometryOffsets:g,partOffsets:x,ringOffsets:b},s,a):function(T,P,S,E,I,C){return new qh(T,P,Vi.MORTON,S,E,I,C)}(r,v,{geometryOffsets:g,partOffsets:x,ringOffsets:b},s,a,c)}let u=Ie(t,i,o),h,p,d,f,m,_,y;for(let v=0;v<e-1;v++){let g=de(t,i);switch(g.physicalStreamType){case ie.LENGTH:switch(g.logicalStreamType.lengthType){case Pe.GEOMETRIES:h=Ie(t,i,g);break;case Pe.PARTS:p=Ie(t,i,g);break;case Pe.RINGS:d=Ie(t,i,g);break;case Pe.TRIANGLES:f=Ui(t,i,g)}break;case ie.OFFSET:switch(g.logicalStreamType.offsetType){case mr.VERTEX:s=Ie(t,i,g);break;case mr.INDEX:l=Ie(t,i,g)}break;case ie.DATA:ri.VERTEX===g.logicalStreamType.dictionaryType?a=Nh(t,i,g):(c={numBits:g.numBits,coordinateShift:g.coordinateShift},a=Ie(t,i,g))}}return h?(m=Xh(u,h,2),p&&d?(_=y_(u,m,p,!1),y=function(v,g,x,b){let w=new Uint32Array(x[x.length-1]+1),T=0;w[0]=T;let P=1,S=1,E=0;for(let I=0;I<v.length;I++){let C=v[I],A=g[I+1]-g[I];if(C!==0&&C!==3)for(let M=0;M<A;M++){let k=x[P]-x[P-1];P++;for(let L=0;L<k;L++)T=w[S++]=T+b[E++]}else for(let M=0;M<A;M++)w[S++]=++T,P++}return w}(u,m,_,d)):p&&(_=function(v,g,x){let b=new Uint32Array(g[g.length-1]+1),w=0;b[0]=w;let T=1,P=0;for(let S=0;S<v.length;S++){let E=v[S],I=g[S+1]-g[S];if(E===4||E===1)for(let C=0;C<I;C++)w=b[T++]=w+x[P++];else for(let C=0;C<I;C++)b[T++]=++w}return b}(u,m,p))):p&&d?(_=Xh(u,p,1),y=y_(u,_,d,!0)):p&&(_=Xh(u,p,0)),l&&!_?__(u,f,l,a):l?__(u,f,l,a,{geometryOffsets:m,partOffsets:_,ringOffsets:y}):c===void 0?function(v,g,x,b){return new Wh(Vi.VEC_2,v,g,x,b)}(u,{geometryOffsets:m,partOffsets:_,ringOffsets:y},s,a):function(v,g,x,b,w){return new Wh(Vi.MORTON,v,g,x,b,w)}(u,{geometryOffsets:m,partOffsets:_,ringOffsets:y},s,a,c)}function Xh(t,e,i){let r=new Uint32Array(t.length+1),n=0;r[0]=n;let o=0;for(let s=0;s<t.length;s++)n=r[s+1]=n+(t[s]>i?e[o++]:1);return r}function y_(t,e,i,r){let n=new Uint32Array(e[e.length-1]+1),o=0;n[0]=o;let s=1,a=0;for(let c=0;c<t.length;c++){let l=t[c],u=e[c+1]-e[c];if(l===5||l===2||r&&(l===4||l===1))for(let h=0;h<u;h++)o=n[s++]=o+i[a++];else for(let h=0;h<u;h++)n[s++]=++o}return n}class v_ extends fr{constructor(t,e,i){super(t,e.getBuffer(),i),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}}class x_ extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class Yh extends fr{constructor(t,e,i,r){super(t,r?BigInt64Array.of(e):BigUint64Array.of(e),i)}getValueFromBuffer(t){return this.dataBuffer[0]}}function zo(t,e,i,r,n){let o=function(s,a,c,l){let u=new Uint8Array(a),h=0,p=l.get()+c;for(;h<a&&!(l.get()>=p);){let d=s[l.increment()];if(d<=127){let f=d+3,m=s[l.increment()],_=Math.min(h+f,a);u.fill(m,h,_),h=_}else{let f=256-d;for(let m=0;m<f&&h<a;m++)u[h++]=s[l.increment()]}}return l.set(p),u}(t,Math.ceil(e/8),i,r);return n?function(s,a,c){if(!c)return s;let l=c.size(),u=new We(s,a),h=new We(new Uint8Array(Math.ceil(l/8)),l),p=0;for(let d=0;d<l;d++){let f=!!c.get(d)&&u.get(p++);h.set(d,f)}return h.getBuffer()}(o,e,n):o}let i1=new TextDecoder;function Kh(t,e,i){return i-e>=12?i1.decode(t.subarray(e,i)):function(r,n,o){let s="",a=n;for(;a<o;){let c=r[a],l,u,h,p=null,d=c>239?4:c>223?3:c>191?2:1;if(a+d>o)break;d===1?c<128&&(p=c):d===2?(l=r[a+1],(192&l)==128&&(p=(31&c)<<6|63&l,p<=127&&(p=null))):d===3?(l=r[a+1],u=r[a+2],(192&l)==128&&(192&u)==128&&(p=(15&c)<<12|(63&l)<<6|63&u,(p<=2047||p>=55296&&p<=57343)&&(p=null))):d===4&&(l=r[a+1],u=r[a+2],h=r[a+3],(192&l)==128&&(192&u)==128&&(192&h)==128&&(p=(15&c)<<18|(63&l)<<12|(63&u)<<6|63&h,(p<=65535||p>=1114112)&&(p=null))),p===null?(p=65533,d=1):p>65535&&(p-=65536,s+=String.fromCharCode(p>>>10&1023|55296),p=56320|1023&p),s+=String.fromCharCode(p),a+=d}return s}(t,e,i)}class ja extends fr{constructor(t,e,i,r){super(t,i,r),this.offsetBuffer=e}}class Jh extends ja{constructor(t,e,i,r){super(t,e,i,r??e.length-1)}getValueFromBuffer(t){return Kh(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class _r extends ja{constructor(t,e,i,r,n){super(t,i,r,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t];return Kh(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Qh extends ja{constructor(t,e,i,r,n,o,s){super(t,i,r,s),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=o}getValueFromBuffer(t){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(i,r,n){let o=[],s=Array(r.length).fill(0);for(let a=1;a<r.length;a++)s[a]=s[a-1]+r[a-1];for(let a=0;a<n.length;a++)if(n[a]===255)o.push(n[++a]);else{let c=r[n[a]],l=s[n[a]];for(let u=0;u<c;u++)o.push(i[l+u])}return new Uint8Array(o)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let e=this.indexBuffer[t];return Kh(this.decodedDictionary,this.offsetBuffer[e],this.offsetBuffer[e+1])}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),i=t[0];for(let r=1;r<t.length;r++){let n=t[r];e[r-1]=n-i,i=n}return e}}function r1(t,e,i,r,n,o){return i.type==="scalarType"?function(s,a,c,l,u,h){let p=null;if(s===0)return null;if(h.nullable){let f=de(a,c),m=f.numValues,_=c.get(),y=zo(a,m,f.byteLength,c);c.set(_+f.byteLength),p=new We(y,f.numValues)}let d=p??l;switch(u.physicalType){case 4:case 3:return function(f,m,_,y,v){let g=de(f,m),x=Oa(g,v,f,m),b=y.physicalType===3;if(x===Mt.FLAT){let T=Do(v)?v:void 0,P=b?Nh(f,m,g,0,T):Ie(f,m,g,0,T);return new ka(_.name,P,v)}if(x===Mt.SEQUENCE){let T=c_(f,m,g);return new Fa(_.name,T[0],T[1],g.numRleValues)}let w=b?function(T,P,S){let E=un(T,P,S);return E.length===1?Tt(E[0]):function(I){return Tt(I[1])}(E)}(f,m,g):Vh(f,m,g);return new Ba(_.name,w,v,b)}(a,c,h,u,d);case 9:return function(f,m,_,y,v){let g=null,x=null,b=null,w=null,T=null,P=v??null,S=null,E=null;for(let I=0;I<y;I++){let C=de(m,_);switch(C.physicalStreamType){case ie.PRESENT:{let A=zo(m,C.numValues,C.byteLength,_),M=new We(A,C.numValues);P=v??M;break}case ie.OFFSET:x=Ie(m,_,C,0,P);break;case ie.LENGTH:{let A=Ui(m,_,C);Pe.DICTIONARY===C.logicalStreamType.lengthType?g=A:Pe.SYMBOL===C.logicalStreamType.lengthType?w=A:S=A;break}case ie.DATA:{let A=m.subarray(_.get(),_.get()+C.byteLength);_.add(C.byteLength);let M=C.logicalStreamType.dictionaryType;ri.FSST===M?T=A:ri.SINGLE===M||ri.SHARED===M?b=A:ri.NONE===M&&(E=A);break}}}return function(I,C,A,M,k,L,O){return C?new Qh(I,A,M,k,L,C,O):null}(f,T,x,g,b,w,P)??function(I,C,A,M,k){return C?k?new _r(I,A,M,C,k):new _r(I,A,M,C):null}(f,b,x,g,P)??function(I,C,A,M,k){if(!C||!A)return null;if(M)return k?new _r(I,M,C,A,k):new _r(I,M,C,A);if(k&&k.size()!==C.length-1){let L=new Uint32Array(k.size()),O=0;for(let q=0;q<k.size();q++)L[q]=k.get(q)?O++:0;return new _r(I,L,C,A,k)}return k?new Jh(I,C,A,k):new Jh(I,C,A)}(f,S,E,x,P)}(h.name,a,c,h.nullable?s-1:s,p);case 0:return function(f,m,_,y,v){let g=de(f,m),x=g.numValues,b=m.get(),w=Do(v)?v:void 0,T=zo(f,x,g.byteLength,m,w);m.set(b+g.byteLength);let P=new We(T,x);return new v_(_.name,P,v)}(a,c,h,0,d);case 6:case 5:return function(f,m,_,y,v){let g=de(f,m),x=Oa(g,y,f,m,"int64"),b=v.physicalType===5;if(x===Mt.FLAT){let T=Do(y)?y:void 0,P=b?function(S,E,I,C){return function(A,M,k){let L;switch(M.logicalLevelTechnique1){case ut.DELTA:if(M.logicalLevelTechnique2===ut.RLE){let O=M;if(!k)return function(q,Q,rt){let nt=new BigInt64Array(rt),lt=0,pt=0n;for(let Pt=0;Pt<Q;Pt++){let yt=Number(q[Pt]),Dt=ue(q[Pt+Q]);for(let H=0;H<yt;H++)pt+=Dt,nt[lt++]=pt}return nt}(A,O.runs,O.numRleValues);L=a_(A=Oh(A,O.runs,O.numRleValues))}else L=a_(A);break;case ut.RLE:L=function(O,q,Q){if(Q===void 0){Q=0;for(let lt=0;lt<q;lt++)Q+=Number(O[lt])}let rt=new BigInt64Array(Q),nt=0;for(let lt=0;lt<q;lt++){let pt=Number(O[lt]),Pt=O[lt+q];Pt=ue(Pt),rt.fill(Pt,nt,nt+pt),nt+=pt}return rt}(A,M.runs,M.numRleValues);break;case ut.NONE:L=function(O){let q=new BigInt64Array(O.length);for(let Q=0;Q<O.length;Q++)q[Q]=ue(O[Q]);return q}(A);break;default:throw Error(`The specified Logical level technique is not supported: ${M.logicalLevelTechnique1}`)}return k?hn(L,k,0n):L}(ln(S,E,I.numValues),I,C)}(f,m,g,T):u_(f,m,g,T);return new Uh(_.name,P,y)}if(x===Mt.SEQUENCE){let T=h_(f,m,g);return new $h(_.name,T[0],T[1],g.numRleValues)}let w=b?function(T,P,S){let E=ln(T,P,S.numValues);return E.length===1?ue(E[0]):function(I){return ue(I[1])}(E)}(f,m,g):d_(f,m,g);return new Yh(_.name,w,y,b)}(a,c,h,d,u);case 7:return function(f,m,_,y){let v=de(f,m),g=Do(y)?y:void 0,x=function(b,w,T,P){let S=w.get(),E=S+T*Float32Array.BYTES_PER_ELEMENT,I=new Uint8Array(b.subarray(S,E)).buffer,C=new Float32Array(I);return w.set(E),P?hn(C,P,0):C}(f,m,v.numValues,g);return new x_(_.name,x,y)}(a,c,h,d);case 8:return function(f,m,_,y){let v=de(f,m),g=Do(y)?y:void 0,x=function(b,w,T,P){let S=w.get(),E=S+T*Float64Array.BYTES_PER_ELEMENT,I=new Uint8Array(b.subarray(S,E)).buffer,C=new Float64Array(I);return w.set(E),P?hn(C,P,0):C}(f,m,v.numValues,g);return new La(_.name,x,y)}(a,c,h,d);default:throw Error(`The specified data type for the field is currently not supported: ${u}`)}}(r,t,e,n,i.scalarType,i):r===0?null:function(s,a,c,l){let u=null,h=null,p=null,d=null,f=!1;for(;!f;){let v=de(s,a);switch(v.physicalStreamType){case ie.LENGTH:Pe.DICTIONARY===v.logicalStreamType.lengthType?u=Ui(s,a,v):p=Ui(s,a,v);break;case ie.DATA:ri.SINGLE===v.logicalStreamType.dictionaryType||ri.SHARED===v.logicalStreamType.dictionaryType?(h=s.subarray(a.get(),a.get()+v.byteLength),f=!0):d=s.subarray(a.get(),a.get()+v.byteLength),a.add(v.byteLength)}}let m=c.complexType.children,_=[],y=0;for(let v of m){let g=ae(s,a,1)[0];if(g===0)continue;let x=v.name?`${c.name}${v.name}`:c.name;if(g!==2||v.type!=="scalarField"||v.scalarField.physicalType!==9)throw Error("Currently only optional string fields are implemented for a struct.");let b=de(s,a),w=zo(s,b.numValues,b.byteLength,a),T=de(s,a),P=Ie(s,a,T,0,T.decompressedCount!==l?new We(w,b.numValues):void 0);_[y++]=d?new Qh(x,P,u,h,p,d,new We(w,b.numValues)):new _r(x,P,u,h,new We(w,b.numValues))}return _}(t,e,i,n)}function Do(t){return t instanceof We}function b_(t){switch(t){case 0:case 1:case 2:case 3:{let e={};e.nullable=!!(1&t),e.columnScope=0;let i={type:"logicalType",logicalType:0};return i.longID=!!(2&t),e.scalarType=i,e.type="scalarType",e}case 4:{let e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=i,e}case 30:{let e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=i,e}default:return function(e){let i;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}let r={};r.nullable=!!(1&e),r.columnScope=0;let n={type:"physicalType"};return n.physicalType=i,r.type="scalarType",r.scalarType=n,r}(t)}}function w_(t){return t>=10}function T_(t){return t===30}function n1(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function o1(t){return t.type==="complexType"&&t.complexType?.type==="physicalType"&&t.complexType.physicalType===0}let s1=new TextDecoder;function tu(t,e){let i=ae(t,e,1)[0];if(i===0)return"";let r=e.get(),n=t.subarray(r,r+i);return e.add(i),s1.decode(n)}function S_(t,e){let i=ae(t,e,1)[0]>>>0;if(i<10||i>30)throw Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);let r=b_(i);if(w_(i)&&(r.name=tu(t,e)),T_(i)){let n=ae(t,e,1)[0]>>>0;r.complexType.children=Array(n);for(let o=0;o<n;o++)r.complexType.children[o]=S_(t,e)}return function(n){return{name:n.name,nullable:n.nullable,scalarField:n.scalarType,complexField:n.complexType,type:n.type==="scalarType"?"scalarField":"complexField"}}(r)}function a1(t,e){let i=ae(t,e,1)[0]>>>0,r=b_(i);if(!r)throw Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(w_(i)?r.name=tu(t,e):i>=0&&i<=3?r.name="id":i===4&&(r.name="geometry"),T_(i)){let n=ae(t,e,1)[0]>>>0,o=r.complexType;o.children=Array(n);for(let s=0;s<n;s++)o.children[s]=S_(t,e)}return r}function l1(t,e){let i={featureTables:[]},r={};r.name=tu(t,e);let n=ae(t,e,1)[0]>>>0,o=ae(t,e,1)[0]>>>0;r.columns=Array(o);for(let s=0;s<o;s++)r.columns[s]=a1(t,e);return i.featureTables.push(r),[i,n]}function c1(t,e,i,r,n,o,s=!1){let a=e.scalarType;if(!a||a.type!=="logicalType"||a.logicalType!==0)throw Error(`ID column must be a logical ID scalar type: ${r}`);let c=a.longID?6:4,l=typeof o=="number"?void 0:o,u=Oa(n,o,t,i,c===6?"int64":"int32");if(c===4)switch(u){case Mt.FLAT:{let h=Ie(t,i,n,0,l);return new ka(r,h,o)}case Mt.SEQUENCE:{let h=c_(t,i,n);return new Fa(r,h[0],h[1],n.numRleValues)}case Mt.CONST:{let h=Vh(t,i,n);return new Ba(r,h,o,!1)}}switch(u){case Mt.FLAT:{if(s){let p=function(d,f,m){let _=function(y,v,g){let x=new Float64Array(g);for(let b=0;b<g;b++)x[b]=t1(y,v);return x}(d,f,m.numValues);return function(y,v){switch(v.logicalLevelTechnique1){case ut.DELTA:return v.logicalLevelTechnique2===ut.RLE&&(y=o_(y,v.runs,v.numRleValues)),function(g){g[0]=cn(g[0]);let x=g.length/4*4,b=1;if(x>=4)for(;b<x-4;b+=4){let w=g[b+1],T=g[b+2],P=g[b+3];g[b]=cn(g[b])+g[b-1],g[b+1]=cn(w)+g[b],g[b+2]=cn(T)+g[b+1],g[b+3]=cn(P)+g[b+2]}for(;b!==g.length;++b)g[b]=cn(g[b])+g[b-1]}(y),y;case ut.RLE:return function(g,x){return o_(g,x.runs,x.numRleValues)}(y,v);case ut.NONE:return y;default:throw Error(`The specified Logical level technique is not supported: ${v.logicalLevelTechnique1}`)}}(_,m)}(t,i,n);return new La(r,p,o)}let h=u_(t,i,n,l);return new Uh(r,h,o)}case Mt.SEQUENCE:{let h=h_(t,i,n);return new $h(r,h[0],h[1],n.numRleValues)}case Mt.CONST:{let h=d_(t,i,n);return new Yh(r,h,o,!1)}}throw Error("Vector type not supported for id column.")}class P_{constructor(t,e){var i;switch(this._featureData=t,this.properties=this._featureData.properties||{},(i=this._featureData.geometry)===null||i===void 0?void 0:i.type){case Xt.POINT:case Xt.MULTIPOINT:this.type=1;break;case Xt.LINESTRING:case Xt.MULTILINESTRING:this.type=2;break;case Xt.POLYGON:case Xt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let i=[];for(let r of e)i.push(new z(r.x,r.y));t.push(i)}return t}}class I_{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new P_(this.features[t],this.extent)}}class E_{constructor(t){this.layers={};let e=function(i,r,n=!0){let o=new Dh(0),s=[];for(;o.get()<i.length;){let c=ae(i,o,1)[0]>>>0,l=o.get()+c;if(l>i.length)throw Error(`Block overruns tile: ${l} > ${i.length}`);if(ae(i,o,1)[0]>>>0!=1){o.set(l);continue}let[u,h]=l1(i,o),p=u.featureTables[0],d=null,f=null,m=[],_=0;for(let v of p.columns){let g=v.name;if((a=v).type==="scalarType"&&a.scalarType?.type==="logicalType"&&a.scalarType.logicalType===0){let x=null;if(v.nullable){let w=de(i,o),T=o.get(),P=zo(i,w.numValues,w.byteLength,o);o.set(T+w.byteLength),x=new We(P,w.numValues)}let b=de(i,o);_=x?x.size():b.decompressedCount,d=c1(i,v,o,g,b,x??_,n)}else if(o1(v)){let x=ae(i,o,1)[0];if(_===0){let b=o.get();_=de(i,o).decompressedCount,o.set(b)}f=e1(i,x,o,_)}else{let x=n1(v)?ae(i,o,1)[0]:1;if(x===0)continue;let b=r1(i,o,v,x,_);if(b)if(Array.isArray(b))for(let w of b)m.push(w);else m.push(b)}}let y=new r_(p.name,f,d,m,h);s.push(y),o.set(l)}var a;return s}(new Uint8Array(t));this.layers=e.reduce((i,r)=>Object.assign(Object.assign({},i),{[r.name]:new I_(r)}),{})}}let gr="_geojsonTileLayer";function M_(t,e,i,r,n){return Ml(t,(o,s)=>{let a=e instanceof ao?e.get(s):null;return(a==null?void 0:a.evaluate)?a.evaluate(i,r,n):a})}function h1(t,e){return e-t}U("FeatureIndex",class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new eo(F,16,0),this.grid3D=new eo(F,16,0),this.featureIndexArray=new Fc,this.promoteId=e}insert(t,e,i,r,n,o){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let a=o?this.grid3D:this.grid;for(let c of e){let l=[1/0,1/0,-1/0,-1/0];for(let u of c)l[0]=Math.min(l[0],u.x),l[1]=Math.min(l[1],u.y),l[2]=Math.max(l[2],u.x),l[3]=Math.max(l[3],u.y);l[0]<F&&l[1]<F&&l[2]>=0&&l[3]>=0&&a.insert(s,l[0],l[1],l[2],l[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new em(new uh(this.rawTileData)).layers:new E_(this.rawTileData).layers,this.sourceLayerCoder=new i_(this.vtLayers?Object.keys(this.vtLayers).sort():[gr])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();let n=t.params,o=F/t.tileSize/t.scale,s=Qn(n.filter,n.globalState),a=t.queryGeometry,c=t.queryPadding*o,l=Le.fromPoints(a),u=this.grid.query(l.minX-c,l.minY-c,l.maxX+c,l.maxY+c),h=Le.fromPoints(t.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(m,_,y,v)=>function(g,x,b,w,T){for(let S of g)if(x<=S.x&&b<=S.y&&w>=S.x&&T>=S.y)return!0;let P=[new z(x,b),new z(x,T),new z(w,T),new z(w,b)];if(g.length>2){for(let S of P)if(Yr(g,S))return!0}for(let S=0;S<g.length-1;S++)if(Dv(g[S],g[S+1],P))return!0;return!1}(t.cameraQueryGeometry,m-c,_-c,y+c,v+c));for(let m of p)u.push(m);u.sort(h1);let d={},f;for(let m of u){if(m===f)continue;f=m;let _=this.featureIndexArray.get(m),y=null;this.loadMatchingFeature(d,_.bucketIndex,_.sourceLayerIndex,_.featureIndex,s,n.layers,n.availableImages,e,i,r,(v,g,x)=>(y||(y=sr(v)),g.queryIntersectsFeature({queryGeometry:a,feature:v,featureState:x,geometry:y,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return d}loadMatchingFeature(t,e,i,r,n,o,s,a,c,l,u){let h=this.bucketLayerIDs[e];if(o&&!h.some((m)=>o.has(m)))return;let p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){let m=ar(d,!0);if(!n.filter(new At(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!n.filter(new At(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let m of h){if(o&&!o.has(m))continue;let _=a[m];if(!_)continue;let y={};f&&l&&(y=l.getState(_.sourceLayer||gr,f));let v=G({},c[m]);v.paint=M_(v.paint,_.paint,d,y,s),v.layout=M_(v.layout,_.layout,d,y,s);let g=!u||u(d,_,y);if(!g)continue;let x=new Ah(d,this.z,this.x,this.y,f);x.layer=v;let b=t[m];b===void 0&&(b=t[m]=[]),b.push({featureIndex:r,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,i,r,n,o,s,a){let c={};this.loadVTLayers();let l=Qn(n.filterSpec,n.globalState);for(let u of t)this.loadMatchingFeature(c,i,r,u,l,o,s,a,e);return c}hasLayer(t){for(let e of this.bucketLayerIDs)for(let i of e)if(t===i)return!0;return!1}getId(t,e){var i;let r=t.id;return this.promoteId&&(r=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[e]],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=t.properties)===null||i===void 0?void 0:i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))),r}},{omit:["rawTileData","sourceLayerCoder"]});let eu="RTLPluginLoaded";class C_ extends Ht{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=bh()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((e)=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return it(this,arguments,void 0,function*(e,i=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ge.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status==="unavailable"){if(!i)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return it(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new R(eu))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let iu=null;function Ro(){return iu||(iu=new C_),iu}var $i,_i;(function(t){t[t.Base=0]="Base",t[t.Parent=1]="Parent"})($i||($i={})),function(t){t[t.Departing=0]="Departing",t[t.Incoming=1]="Incoming"}(_i||(_i={}));class ru{constructor(t,e){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=wd(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:e,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=e,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=St(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,e,i){if((t==null?void 0:t.etagUnmodified)!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(r,n){let o={};if(!n)return o;for(let s of r){let a=s.layerIds.map((c)=>n.getLayer(c)).filter(Boolean);if(a.length!==0){s.layers=a,s.stateDependentLayerIds&&(s.stateDependentLayers=s.stateDependentLayerIds.map((c)=>a.filter((l)=>l.id===c)[0]));for(let c of a)o[c.id]=s}}return o}(t.buckets,e==null?void 0:e.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let n=this.buckets[r];if(n instanceof ur){if(this.hasSymbolBuckets=!0,!i)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let n=this.buckets[r];if(n instanceof ur&&n.hasRTLText){this.hasRTLText=!0,Ro().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let n=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(r).queryRadius(n))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new Ic;else this.state="loaded"}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(t)}let e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jt(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jt(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,o,s,a,c,l,u){var h;return((h=this.latestFeatureIndex)===null||h===void 0?void 0:h.rawTileData)?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:l,transform:a,params:s,queryPadding:this.queryPadding*c,getElevation:u},t,e,i):{}}querySourceFeatures(t,e){let i=this.latestFeatureIndex;if(!(i==null?void 0:i.rawTileData))return;let r=i.loadVTLayers(),n=(e==null?void 0:e.sourceLayer)?e.sourceLayer:"",o=r[gr]||r[n];if(!o)return;let s=Qn(e==null?void 0:e.filter,e==null?void 0:e.globalState),{z:a,x:c,y:l}=this.tileID.canonical,u={z:a,x:c,y:l};for(let h=0;h<o.length;h++){let p=o.feature(h);if(s.needGeometry){let m=ar(p,!0);if(!s.filter(new At(this.tileID.overscaledZ),m,this.tileID.canonical))continue}else if(!s.filter(new At(this.tileID.overscaledZ),p))continue;let d=i.getId(p,n),f=new Ah(p,a,c,l,d);f.tile=u,t.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let e=this.expirationTime;if(t.cacheControl){let i=function(r){let n={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,s,a,c)=>{let l=a||c;return n[s]=!l||l.toLowerCase(),""}),n["max-age"]){let o=parseInt(n["max-age"],10);isNaN(o)?delete n["max-age"]:n["max-age"]=o}return n}(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1000*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(e)if(this.expirationTime<e)r=!0;else{let n=this.expirationTime-e;n?this.expirationTime=i+Math.max(n,30000):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1000*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){var i,r,n;if(!((i=this.latestFeatureIndex)===null||i===void 0?void 0:i.rawTileData)||Object.keys(t).length===0)return;let o=this.latestFeatureIndex.loadVTLayers();for(let s in this.buckets){if(!e.style.hasLayer(s))continue;let a=this.buckets[s],c=a.layers[0].sourceLayer||gr,l=o[c],u=t[c];if(!l||!u||Object.keys(u).length===0)continue;a.update(u,l,((r=this.imageAtlas)===null||r===void 0?void 0:r.patternPositions)||{},this.dashPositions||{});let h=(n=e==null?void 0:e.style)===null||n===void 0?void 0:n.getLayer(s);h&&(this.queryPadding=Math.max(this.queryPadding,h.queryRadius(a)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<St()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=St()+t}setDependencies(t,e){let i={};for(let r of e)i[r]=!0;this.dependencies[t]=i}hasDependency(t,e){for(let i of t){let r=this.dependencies[i];if(r){for(let n of e)if(r[n])return!0}}return!1}}class A_{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(let t in this.data)for(let e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){let r=t.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let n={value:e,timeout:void 0};if(i!==void 0&&(n.timeout=setTimeout(()=>{this.remove(t,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){let e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;let i=t.wrapped().key,r=e===void 0?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(t){let e=[];for(let i in this.data)for(let r of this.data[i])t(r.value)||e.push(r);for(let i of e)this.remove(i.value.tileID,i)}}class z_{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,e,i){var r,n,o,s,a;let c=String(e);if((s=this.stateChanges)[t]||(s[t]={}),(a=this.stateChanges[t])[c]||(a[c]={}),G(this.stateChanges[t][c],i),this.deletedStates[t]===null){this.deletedStates[t]={};for(let l in this.state[t])l!==c&&(this.deletedStates[t][l]=null)}else if(((r=this.deletedStates[t])===null||r===void 0?void 0:r[c])===null){this.deletedStates[t][c]={};for(let l in this.state[t][c])i[l]||(this.deletedStates[t][c][l]=null)}else for(let l in i)((o=(n=this.deletedStates[t])===null||n===void 0?void 0:n[c])===null||o===void 0?void 0:o[l])===null&&delete this.deletedStates[t][c][l]}removeFeatureState(t,e,i){var r,n,o;if(this.deletedStates[t]===null)return;let s=String(e);if((n=this.deletedStates)[t]||(n[t]={}),i&&e!==void 0)this.deletedStates[t][s]!==null&&((o=this.deletedStates[t])[s]||(o[s]={}),this.deletedStates[t][s][i]=null);else if(e!==void 0)if((r=this.stateChanges[t])===null||r===void 0?void 0:r[s])for(i in this.deletedStates[t][s]={},this.stateChanges[t][s])this.deletedStates[t][s][i]=null;else this.deletedStates[t][s]=null;else this.deletedStates[t]=null}getState(t,e){let i=String(e),r=G({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let n=this.deletedStates[t][e];if(n===null)return{};for(let o in n)delete r[o]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){var i,r,n;let o={};for(let s in this.stateChanges){(i=this.state)[s]||(i[s]={});let a={};for(let c in this.stateChanges[s])(r=this.state[s])[c]||(r[c]={}),G(this.state[s][c],this.stateChanges[s][c]),a[c]=this.state[s][c];o[s]=a}for(let s in this.deletedStates){(n=this.state)[s]||(n[s]={});let a={};if(this.deletedStates[s]===null)for(let c in this.state[s])a[c]={},this.state[s][c]={};else for(let c in this.deletedStates[s]){if(this.deletedStates[s][c]===null)this.state[s][c]={};else for(let l of Object.keys(this.deletedStates[s][c]))delete this.state[s][c][l];a[c]=this.state[s][c]}o[s]||(o[s]={}),G(o[s],a)}this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0&&(this.revision++,t.setFeatureState(o,e))}}let ko=89.25;function gi(t,e){let i=_t(e.lat,-85.051129,kn);return new z(sn(e.lng)*t,dr(i)*t)}function Lo(t,e){return new wt(e.x/t,e.y/t).toLngLat()}function Fo(t){return t.cameraToCenterDistance*Math.min(0.85*Math.tan(Vt(90-t.pitch)),Math.tan(Vt(ko-t.pitch)))}function nu(t,e){let i=t.canonical,r=e/_e(i.z),n=i.x+Math.pow(2,i.z)*t.wrap,o=He(new Float64Array(16));return Ot(o,o,[n*r,i.y*r,0]),Wt(o,o,[r/F,r/F,1]),o}function D_(t,e,i,r,n){let o=wt.fromLngLat(t,e),s=n*ji(1,t.lat),{x:a,y:c,z:l}=ou(i,r);return new wt(o.x+s*-a,o.y+s*-c,o.z+s*-l)}function ou(t,e){let i=Vt(t),r=Vt(e),n=Math.cos(-i),o=Math.sin(i);return{x:o*Math.sin(r),y:-o*Math.cos(r),z:n}}function u1(t,e,i){let r=e.intersectsFrustum(t);if(!i||r===0)return r;let n=e.intersectsPlane(i);return n===0?0:r===2&&n===2?2:1}function R_(t,e,i){let r=0,n=(i-e)/10;for(let o=0;o<10;o++)r+=n*Math.pow(Math.cos(e+(o+0.5)/10*(i-e)),t);return r}function su(t,e){return function(i,r,n,o,s){let a=2*((t-1)/he(Math.cos(Vt(ko-s))/Math.cos(Vt(ko)))-1),c=Math.acos(n/o),l=2*R_(a-1,0,Vt(s/2)),u=Math.min(Vt(ko),c+Vt(s/2)),h=R_(a-1,Math.min(u,c-Vt(s/2)),u),p=Math.atan(r/n),d=i;return d+=he(o/Math.hypot(r,n)/Math.max(0.5,Math.cos(Vt(s/2)))),d+=a*he(Math.cos(p))/2,d-=he(Math.max(1,h/l/e))/2,d}}let d1=su(9.314,3);function au(t,e){let i=(e.roundZoom?Math.round:Math.floor)(t.zoom+he(t.tileSize/e.tileSize));return Math.max(0,i)}function fn(t,e){let i=t.getCameraFrustum(),r=t.getClippingPlane(),n=t.screenPointToMercatorCoordinate(t.getCameraPoint()),o=wt.fromLngLat(t.center,t.elevation);n.z=o.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;let s=t.getCoveringTilesDetailsProvider(),a=s.allowVariableZoom(t,e),c=au(t,e),l=e.minzoom||0,u=e.maxzoom!==void 0?e.maxzoom:t.maxZoom,h=Math.min(Math.max(0,c),u),p=Math.pow(2,h),d=[p*n.x,p*n.y,0],f=[p*o.x,p*o.y,0],m=Math.hypot(o.x-n.x,o.y-n.y),_=Math.abs(o.z-n.z),y=Math.hypot(m,_),v=(b)=>({zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),g=[],x=[];if(t.renderWorldCopies&&s.allowWorldCopies())for(let b=1;b<=3;b++)g.push(v(-b)),g.push(v(b));for(g.push(v(0));g.length>0;){let b=g.pop(),{x:w,y:T,fullyVisible:P}=b,S={x:w,y:T,z:b.zoom},E=s.getTileBoundingVolume(S,b.wrap,t.elevation,e);if(!P){let M=u1(i,E,r);if(M===0)continue;P=M===2}let I=s.distanceToTile2d(n.x,n.y,S,E),C=c;a&&(C=(e.calculateTileZoom||d1)(t.zoom+he(t.tileSize/e.tileSize),I,_,y,t.fov)),C=(e.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);let A=Math.min(C,u);if(b.wrap=s.getWrap(o,S,b.wrap),b.zoom>=A){if(b.zoom<l)continue;let M=h-b.zoom,k=d[0]-0.5-(w<<M),L=d[1]-0.5-(T<<M),O=e.reparseOverscaled?Math.max(b.zoom,C):b.zoom;x.push({tileID:new Et(b.zoom===u?O:b.zoom,b.wrap,b.zoom,w,T),distanceSq:u0([f[0]-0.5-w,f[1]-0.5-T]),tileDistanceToCamera:Math.sqrt(k*k+L*L)})}else for(let M=0;M<4;M++)g.push({zoom:b.zoom+1,x:(w<<1)+M%2,y:(T<<1)+(M>>1),wrap:b.wrap,fullyVisible:P})}return x.sort((b,w)=>b.distanceSq-w.distanceSq).map((b)=>b.tileID)}let p1=Le.fromPoints([new z(0,0),new z(F,F)]);function k_(t){return t==="raster"||t==="image"||t==="video"}function f1(t,e,i,r,n,o,s){if(!e.hasData())return!1;let{tileID:a,fadingRole:c,fadingDirection:l,fadingParentID:u}=e;if(c===$i.Base&&l===_i.Incoming&&u)return i[u.key]=u,!0;let h=Math.max(a.overscaledZ-n,o);for(let p=a.overscaledZ-1;p>=h;p--){let d=a.scaledTo(p),f=t.getLoadedTile(d);if(f)return e.setCrossFadeLogic({fadingRole:$i.Base,fadingDirection:_i.Incoming,fadingParentID:f.tileID,fadeEndTime:r+s}),f.setCrossFadeLogic({fadingRole:$i.Parent,fadingDirection:_i.Departing,fadeEndTime:r+s}),i[d.key]=d,!0}return!1}function m1(t,e,i,r,n,o){if(!e.hasData())return!1;let s=e.tileID.children(n),a=L_(t,e,s,i,r,n,o);if(a)return!0;for(let c of s)L_(t,e,c.children(n),i,r,n,o)&&(a=!0);return a}function L_(t,e,i,r,n,o,s){if(i[0].overscaledZ>=o)return!1;let a=!1;for(let c of i){let l=t.getLoadedTile(c);if(!l)continue;let{fadingRole:u,fadingDirection:h,fadingParentID:p}=l;u===$i.Base&&h===_i.Departing&&p||(l.setCrossFadeLogic({fadingRole:$i.Base,fadingDirection:_i.Departing,fadingParentID:e.tileID,fadeEndTime:n+s}),e.setCrossFadeLogic({fadingRole:$i.Parent,fadingDirection:_i.Incoming,fadeEndTime:n+s})),r[c.key]=c,a=!0}return a}function _1(t,e,i,r){let n=t.tileID;return!!t.selfFading||!t.hasData()&&!!e.has(n)&&(t.setSelfFadeLogic(i+r),!0)}function F_(t,e){var i;t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let r=e.tileID.canonical.x-t.tileID.canonical.x,n=e.tileID.canonical.y-t.tileID.canonical.y,o=Math.pow(2,t.tileID.canonical.z),s=e.tileID.key;r===0&&n===0||Math.abs(n)>1||(Math.abs(r)>1&&(Math.abs(r+o)===1?r+=o:Math.abs(r-o)===1&&(r-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),((i=t.neighboringTiles)===null||i===void 0?void 0:i[s])&&(t.neighboringTiles[s].backfilled=!0)))}class lu{constructor(){this._tiles={}}handleWrapJump(t){let e={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e}setFeatureState(t,e){for(let i in this._tiles)this._tiles[i].setFeatureState(t,e)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((e)=>e.tileID).sort(Ym).map((e)=>e.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,e){this._tiles[t]=e}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let e=this.getTileById(t.key);return(e==null?void 0:e.hasData())?e:null}isIdRenderable(t,e=!1){var i;return(i=this.getTileById(t))===null||i===void 0?void 0:i.isRenderable(e)}getRenderableIds(t=0,e){let i=[];for(let r of this.getAllIds())this.isIdRenderable(r,e)&&i.push(this.getTileById(r));return e?i.sort((r,n)=>{let o=r.tileID,s=n.tileID,a=new z(o.canonical.x,o.canonical.y)._rotate(-t),c=new z(s.canonical.x,s.canonical.y)._rotate(-t);return o.overscaledZ-s.overscaledZ||c.y-a.y||c.x-a.x}).map((r)=>r.tileID.key):i.map((r)=>r.tileID).sort(Ym).map((r)=>r.key)}}class Zi extends Ht{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(r)=>{this._dataHandler(r)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((r,n,o,s)=>{let a=new(e_(n.type))(r,n,o,s);if(a.id!==r)throw Error(`Expected Source id to be ${r} instead of ${a.id}`);return a})(t,e,i,this),this._inViewTiles=new lu,this._outOfViewCache=new A_(0,(r)=>this._unloadTile(r)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new z_,this._didEmitContent=!1,this._updated=!1}onAdd(t){var e;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,((e=this._source)===null||e===void 0?void 0:e.onAdd)&&this._source.onAdd(t)}onRemove(t){var e;for(let i of this._inViewTiles.getAllTiles())i.unloadVectorData();this.clearTiles(),((e=this._source)===null||e===void 0?void 0:e.onRemove)&&this._source.onRemove(t),this._inViewTiles=new lu}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!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 t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e,i){return it(this,void 0,void 0,function*(){try{let r=yield this._source.loadTile(t);this._tileLoaded(t,e,i,r)}catch(r){t.state="errored",r.status!==404?this._source.fire(new J(me(r),{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new R("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let e of this._inViewTiles.getAllTiles())e.upload(t),e.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var e;return this._inViewTiles.getRenderableIds((e=this.transform)===null||e===void 0?void 0:e.bearingInRadians,t)}hasRenderableParent(t){let e=t.overscaledZ-1;if(e>=this._source.minzoom){let i=this.getLoadedTile(t.scaledTo(e));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(t,e=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);e&&!this._source.shouldReloadTile(r,e)||(t?this._reloadTile(i,"expired"):r.state!=="errored"&&this._reloadTile(i,"reloading"))}}}_reloadTile(t,e){return it(this,void 0,void 0,function*(){let i=this._inViewTiles.getTileById(t);i&&(i.state!=="loading"&&(i.state=e),yield this._loadTile(i,t,e))})}_tileLoaded(t,e,i,r){t.timeAdded=St(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),i==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),(r==null?void 0:r.unmodified)||(this.getSource().type==="raster-dem"&&t.dem&&function(n,o){var s,a,c;let l=o.getRenderableIds();for(let u of l){if(!((s=n.neighboringTiles)===null||s===void 0?void 0:s[u]))continue;let h=o.getTileById(u);n.neighboringTiles[u].backfilled||F_(n,h),((c=(a=h.neighboringTiles)===null||a===void 0?void 0:a[n.tileID.key])===null||c===void 0?void 0:c.backfilled)||F_(h,n)}}(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new R("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,e){let i=this._getLoadedDescendents(e),r=new Set;for(let n of e){let o=i[n.key];if(!(o==null?void 0:o.length)){r.add(n);continue}let s=n.overscaledZ+Zi.maxOverzooming,a=o.filter((u)=>u.tileID.overscaledZ<=s);if(!a.length){r.add(n);continue}let c=Math.min(...a.map((u)=>u.tileID.overscaledZ)),l=a.filter((u)=>u.tileID.overscaledZ===c).map((u)=>u.tileID);for(let u of l)t[u.key]=u;this._areDescendentsComplete(l,c,n.overscaledZ)||r.add(n)}return r}_getLoadedDescendents(t){var e;let i={};for(let r of this._inViewTiles.getAllTiles().filter((n)=>n.hasData()))for(let n of t)r.tileID.isChildOf(n)&&(i[e=n.key]||(i[e]=[]),i[n.key].push(r));return i}_areDescendentsComplete(t,e,i){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===e:Math.pow(4,e-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*i*(this._maxTileCacheZoomLevels===null?ze.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),n=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(n)}handleWrapJump(t){let e=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,e&&(this._inViewTiles.handleWrapJump(e),this._resetTileReloadTimers())}update(t,e){if(!this._sourceLoaded||this._paused)return;let i;this.transform=t,this.terrain=e,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((a)=>new Et(a.canonical.z,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y)):(i=fn(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:e,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter((a)=>this._source.hasTile(a)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let r=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,r&&this.fire(new R("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let n=au(t,this._source),o=this._updateRetainedTiles(i,n),s=k_(this._source.type);s&&this._rasterFadeDuration>0&&!e&&function(a,c,l,u,h,p,d){let f=St(),m=function(_){if(!_.length)return new Set;let y=Math.max(..._.map((P)=>P.canonical.z)),v=1/0,g=-1/0,x=1/0,b=-1/0,w=[];for(let P of _){let{x:S,y:E,z:I}=P.canonical,C=Math.pow(2,y-I),A=S*C,M=E*C;w.push({id:P,x:A,y:M}),A<v&&(v=A),A>g&&(g=A),M<x&&(x=M),M>b&&(b=M)}let T=new Set;for(let P of w)P.x!==v&&P.x!==g&&P.y!==x&&P.y!==b||T.add(P.id);return T}(c);for(let _ of c){let y=a.getTileById(_.key);y.fadingDirection!==_i.Departing&&y.fadeOpacity!==0||y.resetFadeLogic(),f1(a,y,l,f,u,h,d)||m1(a,y,l,f,p,d)||_1(y,m,f,d)||y.resetFadeLogic()}}(this._inViewTiles,i,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}_cleanUpRasterTiles(t){for(let e of this._inViewTiles.getAllIds())t[e]||this._removeTile(e)}_cleanUpVectorTiles(t){for(let e of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(e);t[e]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(e):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(e)}}_addTerrainIdealTiles(t){let e=[];for(let i of t)if(i.canonical.z>this._source.minzoom){let r=i.scaledTo(i.canonical.z-1);e.push(r);let n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));e.push(n)}return t.concat(e)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var i;let r=new Set;for(let c of t)this._addTile(c).hasData()||r.add(c);let n=t.reduce((c,l)=>(c[l.key]=l,c),{}),o=this._retainLoadedChildren(n,r),s={},a=Math.max(e-Zi.maxUnderzooming,this._source.minzoom);for(let c of o){let l=this._inViewTiles.getTileById(c.key),u=l==null?void 0:l.wasRequested();for(let h=c.overscaledZ-1;h>=a;--h){let p=c.scaledTo(h);if(s[p.key])break;if(s[p.key]=!0,l=this.getTile(p),!l&&u&&(l=this._addTile(p)),l){let d=l.hasData();if((d||!((i=this.map)===null||i===void 0?void 0:i.cancelPendingTileRequestsWhileZooming)||u)&&(n[p.key]=p),u=l.wasRequested(),d)break}}}return n}_addTile(t){let e=this._inViewTiles.getTileById(t.key);if(e)return e;e=this._outOfViewCache.getAndRemove(t),e&&(e.resetFadeLogic(),this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null));let i=e;return e||(e=new ru(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(e,t.key,e.state)),e.uses++,this._inViewTiles.setTile(t.key,e),i||this._source.fire(new R("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e}_setTileReloadTimer(t,e){this._clearTileReloadTimer(t);let i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},i))}_clearTileReloadTimer(t){let e=this._timers[t];e&&(clearTimeout(e),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let e=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,e)}}refreshTiles(t){for(let e of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(e);(this._inViewTiles.isIdRenderable(e)||i.state=="errored")&&t.some((r)=>r.equals(i.tileID.canonical))&&this._reloadTile(e,"expired")}}_removeTile(t){let e=this._inViewTiles.getTileById(t);e&&(e.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),e.uses>0||(e.hasData()&&e.state!=="reloading"?this._outOfViewCache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,e,i){let r=[],n=this.transform;if(!n)return r;let o=n.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?n.getCameraQueryGeometry(t):t,a=(p)=>n.screenPointToMercatorCoordinate(p,this.terrain),c=this.transformBbox(t,a,!o),l=this.transformBbox(s,a,!o),u=this.getIds(),h=Le.fromPoints(l);for(let p of u){let d=this._inViewTiles.getTileById(p);if(d.holdingForSymbolFade())continue;let f=o?[d.tileID]:[d.tileID.unwrapTo(-1),d.tileID.unwrapTo(0)],m=Math.pow(2,n.zoom-d.tileID.overscaledZ),_=e*d.queryPadding*F/d.tileSize/m;for(let y of f){let v=h.map((g)=>y.getTilePoint(new wt(g.x,g.y)));if(v.expandBy(_),v.intersects(p1)){let g=c.map((b)=>y.getTilePoint(b)),x=l.map((b)=>y.getTilePoint(b));r.push({tile:d,tileID:o?y:y.unwrapTo(0),queryGeometry:g,cameraQueryGeometry:x,scale:m})}}}return r}transformBbox(t,e,i){let r=t.map(e);if(i){let n=Le.fromPoints(t);n.shrinkBy(0.001*Math.min(n.width(),n.height()));let o=n.map(e);Le.fromPoints(r).covers(o)||(r=r.map((s)=>s.x>0.5?new wt(s.x-1,s.y,s.z):s))}return r}getVisibleCoordinates(t){let e=this.getRenderableIds(t).map((i)=>this._inViewTiles.getTileById(i).tileID);return this.transform&&this.transform.populateCache(e),e}hasTransition(){return!!this._source.hasTransition()||k_(this._source.type)&&function(t,e){if(e<=0)return!1;let i=St();for(let r of t.getAllTiles())if(r.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,e,i){t||(t=gr),this._state.updateState(t,e,i)}removeFeatureState(t,e,i){t||(t=gr),this._state.removeFeatureState(t,e,i)}getFeatureState(t,e){return t||(t=gr),this._state.getState(t,e)}setDependencies(t,e,i){let r=this._inViewTiles.getTileById(t);r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,e)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter((i)=>!i.hasDependency(t,e))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Zi.maxUnderzooming=10,Zi.maxOverzooming=3;class B_{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],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(e||0,0.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=_t(t,0,1);let e=1,i=this._distances[e],r=t*this.paddedLength+this.padding;for(;i<r&&e<this._distances.length;)i=this._distances[++e];let n=e-1,o=this._distances[n],s=i-o,a=s>0?(r-o)/s:0;return this.points[n].mult(1-a).add(this.points[e].mult(a))}}function Na(t,e){let i=!0;return t==="always"||t!=="never"&&e!=="never"||(i=!1),i}class cu{constructor(t,e,i){let r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,i,r,n,o){this.circleCells[n].push(o)}_query(t,e,i,r,n,o,s){if(i<0||t>this.width||r<0||e>this.height)return[];let a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let c=0;c<this.boxKeys.length;c++)a.push({key:this.boxKeys[c],x1:this.bboxes[4*c],y1:this.bboxes[4*c+1],x2:this.bboxes[4*c+2],y2:this.bboxes[4*c+3]});for(let c=0;c<this.circleKeys.length;c++){let l=this.circles[3*c],u=this.circles[3*c+1],h=this.circles[3*c+2];a.push({key:this.circleKeys[c],x1:l-h,y1:u-h,x2:l+h,y2:u+h})}}else this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},s);return a}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,o){return this._query(t,e,i,r,!0,n,o).length>0}hitTestCircle(t,e,i,r,n){let o=t-i,s=t+i,a=e-i,c=e+i;if(s<0||o>this.width||c<0||a>this.height)return!1;let l=[];return this._forEachCell(o,a,s,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),l.length>0}_queryCell(t,e,i,r,n,o,s,a){let{seenUids:c,hitTest:l,overlapMode:u}=s,h=this.boxCells[n];if(h!==null){let f=this.bboxes;for(let m of h)if(!c.box[m]){c.box[m]=!0;let _=4*m,y=this.boxKeys[m];if(t<=f[_+2]+0.000001&&e<=f[_+3]+0.000001&&i>=f[_+0]-0.000001&&r>=f[_+1]-0.000001&&(!a||a(y))&&(!l||!Na(u,y.overlapMode))&&(o.push({key:y,x1:f[_],y1:f[_+1],x2:f[_+2],y2:f[_+3]}),l))return!0}}let d=this.circleCells[n];if(d!==null){let f=this.circles;for(let m of d)if(!c.circle[m]){c.circle[m]=!0;let _=3*m,y=this.circleKeys[m];if(this._circleAndRectCollide(f[_],f[_+1],f[_+2],t,e,i,r)&&(!a||a(y))&&(!l||!Na(u,y.overlapMode))){let v=f[_],g=f[_+1],x=f[_+2];if(o.push({key:y,x1:v-x,y1:g-x,x2:v+x,y2:g+x}),l)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,o,s,a){let{circle:c,seenUids:l,overlapMode:u}=s,h=this.boxCells[n];if(h!==null){let d=this.bboxes;for(let f of h)if(!l.box[f]){l.box[f]=!0;let m=4*f,_=this.boxKeys[f];if(this._circleAndRectCollide(c.x,c.y,c.radius,d[m+0],d[m+1],d[m+2],d[m+3])&&(!a||a(_))&&!Na(u,_.overlapMode))return o.push(!0),!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!l.circle[f]){l.circle[f]=!0;let m=3*f,_=this.circleKeys[f];if(this._circlesCollide(d[m],d[m+1],d[m+2],c.x,c.y,c.radius)&&(!a||a(_))&&!Na(u,_.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,r,n,o,s,a){let c=this._convertToXCellCoord(t),l=this._convertToYCellCoord(e),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let p=c;p<=u;p++)for(let d=l;d<=h;d++)if(n.call(this,t,e,i,r,this.xCellCount*d+p,o,s,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,o){let s=r-t,a=n-e,c=i+o;return c*c>s*s+a*a}_circleAndRectCollide(t,e,i,r,n,o,s){let a=(o-r)/2,c=Math.abs(t-(r+a));if(c>a+i)return!1;let l=(s-n)/2,u=Math.abs(e-(n+l));if(u>l+i)return!1;if(c<=a||u<=l)return!0;let h=c-a,p=u-l;return h*h+p*p<=i*i}}function g1(t,e){let i=1/(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=1/(e[8]*e[8]+e[9]*e[9]+e[10]*e[10]),n=e[0]*i,o=e[4]*i,s=e[8]*r,a=e[1]*i,c=e[5]*i,l=e[9]*r,u=e[2]*i,h=e[6]*i,p=e[10]*r;t[0]=n,t[1]=o,t[2]=s,t[4]=a,t[5]=c,t[6]=l,t[8]=u,t[9]=h,t[10]=p;let d=e[12],f=e[13],m=e[14];return t[12]=-n*d-a*f-u*m,t[13]=-o*d-c*f-h*m,t[14]=-s*d-l*f-p*m,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}let y1=Ci();function hu(t,e,i){let r=Ci();if(!t){let{vecSouth:h,vecEast:p}=uu(e),d=hd();d[0]=p[0],d[1]=p[1],d[2]=h[0],d[3]=h[1],n=d,(u=(s=(o=d)[0])*(l=o[3])-(c=o[2])*(a=o[1]))&&(n[0]=l*(u=1/u),n[1]=-a*u,n[2]=-c*u,n[3]=s*u),r[0]=d[0],r[1]=d[1],r[4]=d[2],r[5]=d[3]}var n,o,s,a,c,l,u;return Wt(r,r,[1/i,1/i,1]),r}function v1(t,e,i,r){if(t){let n=Ci();if(!e){let{vecSouth:o,vecEast:s}=uu(i);n[0]=s[0],n[1]=s[1],n[4]=o[0],n[5]=o[1]}return Wt(n,n,[r,r,1]),n}return i.pixelsToClipSpaceMatrix}function uu(t){let e=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),r=Math.cos(t.pitchInRadians),n=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),s=Sl();s[0]=-n*r*i-o*e,s[1]=-o*r*i+n*e;let a=yd(s);a<0.000000001?vd(s):gd(s,s,1/a);let c=Sl();c[0]=n*r*e-o*i,c[1]=o*r*e+n*i;let l=yd(c);return l<0.000000001?vd(c):gd(c,c,1/l),{vecEast:c,vecSouth:s}}function du(t,e,i,r){let n;r?(n=[t,e,r(t,e),1],Yt(n,n,i)):(n=[t,e,0,1],mu(n,n,i));let o=n[3];return{point:new z(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function O_(t,e){return 0.5+t/e*0.5}function x1(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function b1(t,e,i,r,n,o,s,a,c,l,u,h,p){let d=i?t.textSizeData:t.iconSizeData,f=Sa(d,e.transform.zoom),m=[256/e.width*2+1,256/e.height*2+1],_=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();let y=t.lineVertexArray,v=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=e.transform.width/e.transform.height,x=!1;for(let b=0;b<v.length;b++){let w=v.get(b);if(w.hidden||w.writingMode===$t.vertical&&!x){mn(w.numGlyphs,_);continue}x=!1;let T=new z(w.anchorX,w.anchorY),P={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:y,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:T,unwrappedTileID:c,width:l,height:u,translation:h},S=$_(w.anchorX,w.anchorY,P);if(!x1(S.point,m)){mn(w.numGlyphs,_);continue}let E=O_(e.transform.cameraToCenterDistance,S.signedDistanceFromCamera),I=dh(d,f,w),C=o?I*e.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/E:I*E,A=V_({projectionContext:P,pitchedLabelPlaneMatrixInverse:n,symbol:w,fontSize:C,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:g,rotateToLine:a});x=A.useVertical,(A.notEnoughRoom||x||A.needsFlipping&&V_({projectionContext:P,pitchedLabelPlaneMatrixInverse:n,symbol:w,fontSize:C,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:g,rotateToLine:a}).notEnoughRoom)&&mn(w.numGlyphs,_)}i?t.text.dynamicLayoutVertexBuffer.updateData(_):t.icon.dynamicLayoutVertexBuffer.updateData(_)}function j_(t,e,i,r,n,o,s,a){let c=o.glyphStartIndex+o.numGlyphs,l=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=e.getoffsetX(o.glyphStartIndex),p=e.getoffsetX(c-1),d=Ua(t*h,i,r,n,o.segment,l,u,a,s);if(!d)return null;let f=Ua(t*p,i,r,n,o.segment,l,u,a,s);return f?a.projectionCache.anyProjectionOccluded?null:{first:d,last:f}:null}function N_(t,e,i,r){return t===$t.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*r?{useVertical:!0}:(t===$t.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function V_(t){let{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:n,flip:o,keepUpright:s,glyphOffsetArray:a,dynamicLayoutVertexArray:c,aspectRatio:l,rotateToLine:u}=t,h=n/24,p=r.lineOffsetX*h,d=r.lineOffsetY*h,f;if(r.numGlyphs>1){let m=r.glyphStartIndex+r.numGlyphs,_=r.lineStartIndex,y=r.lineStartIndex+r.lineLength,v=j_(h,a,p,d,o,r,u,e);if(!v)return{notEnoughRoom:!0};let g=Va(v.first.point.x,v.first.point.y,e,i),x=Va(v.last.point.x,v.last.point.y,e,i);if(s&&!o){let b=N_(r.writingMode,g,x,l);if(b)return b}f=[v.first];for(let b=r.glyphStartIndex+1;b<m-1;b++){let w=Ua(h*a.getoffsetX(b),p,d,o,r.segment,_,y,e,u);if(!w)return{notEnoughRoom:!0};f.push(w)}f.push(v.last)}else{if(s&&!o){let _=yr(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,y=r.lineStartIndex+r.segment+1,v=new z(e.lineVertexArray.getx(y),e.lineVertexArray.gety(y)),g=yr(v.x,v.y,e),x=g.signedDistanceFromCamera>0?g.point:U_(e.tileAnchorPoint,v,_,1,e),b=Va(_.x,_.y,e,i),w=Va(x.x,x.y,e,i),T=N_(r.writingMode,b,w,l);if(T)return T}let m=Ua(h*a.getoffsetX(r.glyphStartIndex),p,d,o,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,e,u);if(!m||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[m]}for(let m of f)So(c,m.point,m.angle);return{}}function U_(t,e,i,r,n){let o=t.add(t.sub(e)._unit()),s=yr(o.x,o.y,n).point,a=i.sub(s);return i.add(a._mult(r/a.mag()))}function pu(t,e,i){let r=e.projectionCache;if(r.projections[t])return r.projections[t];let n=new z(e.lineVertexArray.getx(t),e.lineVertexArray.gety(t)),o=yr(n.x,n.y,e);if(o.signedDistanceFromCamera>0)return r.projections[t]=o.point,r.anyProjectionOccluded||(r.anyProjectionOccluded=o.isOccluded),o.point;let s=t-i.direction;return U_(i.distanceFromAnchor===0?e.tileAnchorPoint:new z(e.lineVertexArray.getx(s),e.lineVertexArray.gety(s)),n,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function yr(t,e,i){let r=t+i.translation[0],n=e+i.translation[1],o;return i.pitchWithMap?(o=du(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(0.5*o.point.x+0.5)*i.width,o.point.y=(0.5*-o.point.y+0.5)*i.height),o}function Va(t,e,i,r){if(i.pitchWithMap){let n=[t,e,0,1];return Yt(n,n,r),i.transform.projectTileCoordinates(n[0]/n[3],n[1]/n[3],i.unwrappedTileID,i.getElevation).point}return{x:t/i.width*2-1,y:1-e/i.height*2}}function $_(t,e,i){return i.transform.projectTileCoordinates(t,e,i.unwrappedTileID,i.getElevation)}function fu(t,e,i){return t._unit()._perp()._mult(e*i)}function w1(t,e,i,r,n,o,s,a,c){if(a.projectionCache.offsets[t])return a.projectionCache.offsets[t];let l=i.add(e);if(t+c.direction<r||t+c.direction>=n)return a.projectionCache.offsets[t]=l,l;let u=pu(t+c.direction,a,c),h=fu(u.sub(i),s,c.direction),p=i.add(h),d=u.add(h);return a.projectionCache.offsets[t]=function(f,m,_,y){let v=m.y-f.y,g=m.x-f.x,x=y.y-_.y,b=y.x-_.x,w=x*g-b*v;if(w===0)return null;let T=(b*(f.y-_.y)-x*(f.x-_.x))/w;return new z(f.x+T*g,f.y+T*v)}(o,l,p,d)||l,a.projectionCache.offsets[t]}function Ua(t,e,i,r,n,o,s,a,c){let l=r?t-e:t+e,u=l>0?1:-1,h=0;r&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let p,d=u>0?o+n:o+n+1;a.projectionCache.cachedAnchorPoint?p=a.projectionCache.cachedAnchorPoint:(p=yr(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=p);let f,m,_=p,y=p,v=0,g=0,x=Math.abs(l),b=[],w;for(;v+g<=x;){if(d+=u,d<o||d>=s)return null;v+=g,y=_,m=f;let S={absOffsetX:x,direction:u,distanceFromAnchor:v,previousVertex:y};if(_=pu(d,a,S),i===0)b.push(y),w=_.sub(y);else{let E,I=_.sub(y);E=I.mag()===0?fu(pu(d+u,a,S).sub(_),i,u):fu(I,i,u),m||(m=y.add(E)),f=w1(d,E,_,o,s,m,i,a,S),b.push(m),w=f.sub(m)}g=w.mag()}let T=w._mult((x-v)/g)._add(m||y),P=h+Math.atan2(_.y-y.y,_.x-y.x);return b.push(T),{point:T,angle:c?P:0,path:b}}let T1=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function mn(t,e){for(let i=0;i<t;i++){let r=e.length;e.resize(r+4),e.float32.set(T1,3*r)}}function mu(t,e,i){let r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}let re=100;class Z_{constructor(t,e=new cu(t.width+200,t.height+200,25),i=new cu(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+re,this.screenBottomBoundary=t.height+re,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=0.6}placeCollisionBox(t,e,i,r,n,o,s,a,c,l,u,h){let p=this.projectAndGetPerspectiveRatio(t.anchorPointX+a[0],t.anchorPointY+a[1],n,l,h),d=i*p.perspectiveRatio,f;if(o||s)f=this._projectCollisionBox(t,d,r,n,o,s,a,p,l,u,h);else{let b=p.x+(u?u.x*d:0),w=p.y+(u?u.y*d:0);f={allPointsOccluded:!1,box:[b+t.x1*d,w+t.y1*d,b+t.x2*d,w+t.y2*d]}}let[m,_,y,v]=f.box,g=o?f.allPointsOccluded:p.isOccluded,x=g;return x||(x=p.perspectiveRatio<this.perspectiveRatioCutoff),x||(x=!this.isInsideGrid(m,_,y,v)),x||e!=="always"&&this.grid.hitTest(m,_,y,v,e,c)?{box:[m,_,y,v],placeable:!1,offscreen:!1,occluded:g}:{box:[m,_,y,v],placeable:!0,offscreen:this.isOffscreen(m,_,y,v),occluded:g}}placeCollisionCircles(t,e,i,r,n,o,s,a,c,l,u,h,p,d){let f=[],m=new z(e.anchorX,e.anchorY),_=this.getPerspectiveRatio(m.x,m.y,o,d),y=(c?n*this.transform.getPitchedTextCorrection(e.anchorX,e.anchorY,o)/_:n*_)/24,v={getElevation:d,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:m,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:p},g=j_(y,r,e.lineOffsetX*y,e.lineOffsetY*y,!1,e,!1,v),x=!1,b=!1,w=!0;if(g){let T=0.5*u*_+h,P=new z(-100,-100),S=new z(this.screenRightBoundary,this.screenBottomBoundary),E=new B_,{first:I,last:C}=g,A=[];for(let L=I.path.length-1;L>=1;L--)A.push(I.path[L]);for(let L=1;L<C.path.length;L++)A.push(C.path[L]);let M=2.5*T;if(c){let L=this.projectPathToScreenSpace(A,v);A=L.some((O)=>O.signedDistanceFromCamera<=0)?[]:L.map((O)=>O.point)}let k=[];if(A.length>0){let L=A[0].clone(),O=A[0].clone();for(let q=1;q<A.length;q++)L.x=Math.min(L.x,A[q].x),L.y=Math.min(L.y,A[q].y),O.x=Math.max(O.x,A[q].x),O.y=Math.max(O.y,A[q].y);k=L.x>=P.x&&O.x<=S.x&&L.y>=P.y&&O.y<=S.y?[A]:O.x<P.x||L.x>S.x||O.y<P.y||L.y>S.y?[]:function(q,Q,rt,nt,lt){let pt=[];for(let Pt of q){let yt;for(let Dt=0;Dt<Pt.length-1;Dt++){let H=Pt[Dt],ft=Pt[Dt+1];H.x<Q&&ft.x<Q||(H.x<Q?H=new z(Q,H.y+(Q-H.x)/(ft.x-H.x)*(ft.y-H.y))._round():ft.x<Q&&(ft=new z(Q,H.y+(Q-H.x)/(ft.x-H.x)*(ft.y-H.y))._round()),H.y<rt&&ft.y<rt||(H.y<rt?H=new z(H.x+(rt-H.y)/(ft.y-H.y)*(ft.x-H.x),rt)._round():ft.y<rt&&(ft=new z(H.x+(rt-H.y)/(ft.y-H.y)*(ft.x-H.x),rt)._round()),H.x>=nt&&ft.x>=nt||(H.x>=nt?H=new z(nt,H.y+(nt-H.x)/(ft.x-H.x)*(ft.y-H.y))._round():ft.x>=nt&&(ft=new z(nt,H.y+(nt-H.x)/(ft.x-H.x)*(ft.y-H.y))._round()),H.y>=lt&&ft.y>=lt||(H.y>=lt?H=new z(H.x+(lt-H.y)/(ft.y-H.y)*(ft.x-H.x),lt)._round():ft.y>=lt&&(ft=new z(H.x+(lt-H.y)/(ft.y-H.y)*(ft.x-H.x),lt)._round()),yt&&H.equals(yt[yt.length-1])||(yt=[H],pt.push(yt)),yt.push(ft)))))}}return pt}([A],P.x,P.y,S.x,S.y)}for(let L of k){E.reset(L,0.25*T);let O=0;O=E.length<=0.5*T?1:Math.ceil(E.paddedLength/M)+1;for(let q=0;q<O;q++){let Q=q/Math.max(O-1,1),rt=E.lerp(Q),nt=rt.x+re,lt=rt.y+re;f.push(nt,lt,T,0);let pt=nt-T,Pt=lt-T,yt=nt+T,Dt=lt+T;if(w&&(w=this.isOffscreen(pt,Pt,yt,Dt)),b||(b=this.isInsideGrid(pt,Pt,yt,Dt)),t!=="always"&&this.grid.hitTestCircle(nt,lt,T,t,l)&&(x=!0,!a))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!a&&x||!b||_<this.perspectiveRatioCutoff?[]:f,offscreen:w,collisionDetected:x}}projectPathToScreenSpace(t,e){let i=function(r,n){let o=y1;return function(s,a){let c=1/(a[0]*a[5]-a[1]*a[4]);s[0]=a[5]*c,s[1]=-a[1]*c,s[2]=0,s[3]=0,s[4]=-a[4]*c,s[5]=a[0]*c,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1/a[10],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1/a[15]}(o,n.pitchedLabelPlaneMatrix),r.map((s)=>{let a=du(s.x,s.y,o,n.getElevation),c=n.transform.projectTileCoordinates(a.point.x,a.point.y,n.unwrappedTileID,n.getElevation);return c.point.x=(0.5*c.point.x+0.5)*n.width,c.point.y=(0.5*-c.point.y+0.5)*n.height,c})}(t,e);return function(r){let n=0,o=0,s=0,a=0;for(let c=0;c<r.length;c++)r[c].isOccluded?(s=c+1,a=0):(a++,a>o&&(o=a,n=s));return r.slice(n,n+o)}(i)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let e=[],i=new Le;for(let u of t){let h=new z(u.x+re,u.y+re);i.extend(h),e.push(h)}let{minX:r,minY:n,maxX:o,maxY:s}=i,a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),c={},l={};for(let u of a){let h=u.key;c[h.bucketInstanceId]===void 0&&(c[h.bucketInstanceId]={}),c[h.bucketInstanceId][h.featureIndex]||Sf(e,[new z(u.x1,u.y1),new z(u.x2,u.y1),new z(u.x2,u.y2),new z(u.x1,u.y2)])&&(c[h.bucketInstanceId][h.featureIndex]=!0,l[h.bucketInstanceId]===void 0&&(l[h.bucketInstanceId]=[]),l[h.bucketInstanceId].push(h.featureIndex))}return l}insertCollisionBox(t,e,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,o){let s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let c=0;c<t.length;c+=4)s.insertCircle(a,t[c],t[c+1],t[c+2])}projectAndGetPerspectiveRatio(t,e,i,r,n){if(n){let o;r?(o=[t,e,r(t,e),1],Yt(o,o,n)):(o=[t,e,0,1],mu(o,o,n));let s=o[3];return{x:(o[0]/s+1)/2*this.transform.width+re,y:(-o[1]/s+1)/2*this.transform.height+re,perspectiveRatio:0.5+this.transform.cameraToCenterDistance/s*0.5,isOccluded:!1,signedDistanceFromCamera:s}}{let o=this.transform.projectTileCoordinates(t,e,i,r);return{x:(o.point.x+1)/2*this.transform.width+re,y:(1-o.point.y)/2*this.transform.height+re,perspectiveRatio:0.5+this.transform.cameraToCenterDistance/o.signedDistanceFromCamera*0.5,isOccluded:o.isOccluded,signedDistanceFromCamera:o.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,i,r){let n=this.transform.projectTileCoordinates(t,e,i,r);return 0.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*0.5}isOffscreen(t,e,i,r){return i<re||t>=this.screenRightBoundary||r<re||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){let t=He([]);return Ot(t,t,[-100,-100,0]),t}_projectCollisionBox(t,e,i,r,n,o,s,a,c,l,u){let h=1,p=0,d=0,f=1,m=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(o&&!n){let A=this.projectAndGetPerspectiveRatio(m+1,_,r,c,u),M=A.x-a.x,k=Math.atan((A.y-a.y)/M)+(M<0?Math.PI:0),L=Math.sin(k),O=Math.cos(k);h=O,p=L,d=-L,f=O}else if(!o&&n){let A=uu(this.transform);h=A.vecEast[0],p=A.vecEast[1],d=A.vecSouth[0],f=A.vecSouth[1]}let{x:y,y:v}=a,g=e;n&&(y=m,v=_,g=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),g*=this.transform.getPitchedTextCorrection(m,_,r),l||(g*=_t(0.5+a.signedDistanceFromCamera/this.transform.cameraToCenterDistance*0.5,0,4))),l&&(y+=h*l.x*g+d*l.y*g,v+=p*l.x*g+f*l.y*g);let x=t.x1*g,b=t.x2*g,w=(x+b)/2,T=t.y1*g,P=t.y2*g,S=(T+P)/2,E=[{offsetX:x,offsetY:T},{offsetX:w,offsetY:T},{offsetX:b,offsetY:T},{offsetX:b,offsetY:S},{offsetX:b,offsetY:P},{offsetX:w,offsetY:P},{offsetX:x,offsetY:P},{offsetX:x,offsetY:S}],I=[];for(let{offsetX:A,offsetY:M}of E)I.push(new z(y+h*A+d*M,v+p*A+f*M));let C=!1;if(n){let A=I.map((M)=>this.projectAndGetPerspectiveRatio(M.x,M.y,r,c,u));C=A.some((M)=>!M.isOccluded),I=A.map((M)=>new z(M.x,M.y))}else C=!0;return{box:p0(I),allPointsOccluded:!C}}}class _u extends z{constructor(t,e,i,r){super(t,e),this.angle=i,r!==void 0&&(this.segment=r)}clone(){return new _u(this.x,this.y,this.angle,this.segment)}}var $a;U("Anchor",_u),function(t){t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right"}($a||($a={}));class gu{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}}class _n{constructor(t,e,i,r,n){this.text=new gu(t?t.text:null,e,i,n),this.icon=new gu(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class yu{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class G_{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class q_{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:(i)=>i.collisionGroupID===e}}return this.collisionGroups[t]}}function W_(t,e,i,r,n){let{horizontalAlign:o,verticalAlign:s}=Sm(t);return new z(-(o-0.5)*e+r[0]*n,-(s-0.5)*i+r[1]*n)}class H_{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Z_(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new q_(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let e=this.terrain;return e?(i,r)=>e.getElevation(t,i,r):null}getBucketParts(t,e,i,r){let n=i.getBucket(e),o=i.latestFeatureIndex;if(!n||!o||e.id!==n.layerIds[0])return;let s=i.collisionBoxArray,a=n.layers[0].layout,c=n.layers[0].paint,l=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/F,h=i.tileID.toUnwrapped(),p=a.get("text-rotation-alignment")==="map",d=Me(i,1,this.transform.zoom),f=zi(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),m=zi(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),_=hu(p,this.transform,d);this.retainedQueryData[n.bucketInstanceId]=new G_(n.bucketInstanceId,o,n.sourceLayerIndex,n.index,i.tileID);let y={bucket:n,layout:a,translationText:f,translationIcon:m,unwrappedTileID:h,pitchedLabelPlaneMatrix:_,scale:l,textPixelRatio:u,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Sa(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(let v of n.sortKeyRanges){let{sortKey:g,symbolInstanceStart:x,symbolInstanceEnd:b}=v;t.push({sortKey:g,symbolInstanceStart:x,symbolInstanceEnd:b,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g){var x,b,w;let T=$a[t.textAnchor],P=[t.textOffset0,t.textOffset1],S=W_(T,i,r,P,n),E=this.collisionIndex.placeCollisionBox(e,h,a,c,l,s,o,m,u.predicate,v,S,g);if((!y||this.collisionIndex.placeCollisionBox(y,h,a,c,l,s,o,_,u.predicate,v,S,g).placeable)&&E.placeable){let I;if(((x=this.prevPlacement)===null||x===void 0?void 0:x.variableOffsets[p.crossTileID])&&((w=(b=this.prevPlacement)===null||b===void 0?void 0:b.placements[p.crossTileID])===null||w===void 0?void 0:w.text)&&(I=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:P,width:i,height:r,anchor:T,textBoxScale:n,prevAnchor:I},this.markUsedJustification(d,T,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:S,placedGlyphBoxes:E}}}placeLayerBucketPart(t,e,i){let{bucket:r,layout:n,translationText:o,translationIcon:s,unwrappedTileID:a,pitchedLabelPlaneMatrix:c,textPixelRatio:l,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:d}=t.parameters,f=n.get("text-optional"),m=n.get("icon-optional"),_=Pa(n,"text-overlap","text-allow-overlap"),y=_==="always",v=Pa(n,"icon-overlap","icon-allow-overlap"),g=v==="always",x=n.get("text-rotation-alignment")==="map",b=n.get("text-pitch-alignment")==="map",w=n.get("icon-text-fit")!=="none",T=n.get("symbol-z-order")==="viewport-y",P=y&&(g||!r.hasIconData()||m),S=g&&(y||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);let E=this.retainedQueryData[r.bucketInstanceId].tileID,I=this._getTerrainElevationFunc(E),C=this.transform.getFastPathSimpleProjectionMatrix(E),A=(M,k,L)=>{var O,q;if(e[M.crossTileID])return;if(u)return void(this.placements[M.crossTileID]=new yu(!1,!1,!1));let Q=!1,rt=!1,nt=!0,lt=null,pt={box:null,placeable:!1,offscreen:null,occluded:!1},Pt={placeable:!1},yt=null,Dt=null,H=null,ft=0,Sn=0,qo=0;k.textFeatureIndex?ft=k.textFeatureIndex:M.useRuntimeCollisionCircles&&(ft=M.featureIndex),k.verticalTextFeatureIndex&&(Sn=k.verticalTextFeatureIndex);let br=k.textBox;if(br){let vi=(le)=>{let fe=$t.horizontal;if(r.allowVerticalPlacement&&!le&&this.prevPlacement){let Fe=this.prevPlacement.placedOrientations[M.crossTileID];Fe&&(this.placedOrientations[M.crossTileID]=Fe,fe=Fe,this.markUsedOrientation(r,fe,M))}return fe},Wi=(le,fe)=>{if(r.allowVerticalPlacement&&M.numVerticalGlyphVertices>0&&k.verticalTextBox){for(let Fe of r.writingModes)if(Fe===$t.vertical?(pt=fe(),Pt=pt):pt=le(),pt==null?void 0:pt.placeable)break}else pt=le()},{textAnchorOffsetStartIndex:Mn,textAnchorOffsetEndIndex:wr}=M;if(wr===Mn){let le=(fe,Fe)=>{let Jt=this.collisionIndex.placeCollisionBox(fe,_,l,E,a,b,x,o,d.predicate,I,void 0,C);return(Jt==null?void 0:Jt.placeable)&&(this.markUsedOrientation(r,Fe,M),this.placedOrientations[M.crossTileID]=Fe),Jt};Wi(()=>le(br,$t.horizontal),()=>{let fe=k.verticalTextBox;return r.allowVerticalPlacement&&M.numVerticalGlyphVertices>0&&fe?le(fe,$t.vertical):{box:null,offscreen:null}}),vi(pt==null?void 0:pt.placeable)}else{let le=$a[(q=(O=this.prevPlacement)===null||O===void 0?void 0:O.variableOffsets[M.crossTileID])===null||q===void 0?void 0:q.anchor],fe=(Jt,Hi,Cn)=>{let td=Jt.x2-Jt.x1,ed=Jt.y2-Jt.y1,id=M.textBoxScale,$b=w&&v==="never"?Hi:null,Tr=null,r0=_==="never"?1:2,n0="never";le&&r0++;for(let o0=0;o0<r0;o0++){for(let rd=Mn;rd<wr;rd++){let s0=r.textAnchorOffsets.get(rd);if(le&&s0.textAnchor!==le)continue;let nd=this.attemptAnchorPlacement(s0,Jt,td,ed,id,x,b,l,E,a,d,n0,M,r,Cn,o,s,$b,I);if(nd&&(Tr=nd.placedGlyphBoxes,Tr==null?void 0:Tr.placeable))return Q=!0,lt=nd.shift,Tr}le?le=null:n0=_}return i&&!Tr&&(Tr={box:this.collisionIndex.placeCollisionBox(br,"always",l,E,a,b,x,o,d.predicate,I,void 0,C).box,offscreen:!1,placeable:!1,occluded:!1}),Tr};Wi(()=>fe(br,k.iconBox,$t.horizontal),()=>{let Jt=k.verticalTextBox;return r.allowVerticalPlacement&&!(pt==null?void 0:pt.placeable)&&M.numVerticalGlyphVertices>0&&Jt?fe(Jt,k.verticalIconBox,$t.vertical):{box:null,occluded:!0,offscreen:null}}),pt&&(Q=pt.placeable,nt=pt.offscreen);let Fe=vi(pt==null?void 0:pt.placeable);if(!Q&&this.prevPlacement){let Jt=this.prevPlacement.variableOffsets[M.crossTileID];Jt&&(this.variableOffsets[M.crossTileID]=Jt,this.markUsedJustification(r,Jt.anchor,M,Fe))}}}if(yt=pt,Q=yt==null?void 0:yt.placeable,nt=yt==null?void 0:yt.offscreen,M.useRuntimeCollisionCircles&&M.centerJustifiedTextSymbolIndex>=0){let vi=r.text.placedSymbolArray.get(M.centerJustifiedTextSymbolIndex),Wi=dh(r.textSizeData,p,vi),Mn=n.get("text-padding");Dt=this.collisionIndex.placeCollisionCircles(_,vi,r.lineVertexArray,r.glyphOffsetArray,Wi,a,c,i,b,d.predicate,M.collisionCircleDiameter,Mn,o,I),Dt.circles.length&&Dt.collisionDetected&&!i&&Ct("Collisions detected, but collision boxes are not shown"),Q=y||Dt.circles.length>0&&!Dt.collisionDetected,nt&&(nt=Dt.offscreen)}if(k.iconFeatureIndex&&(qo=k.iconFeatureIndex),k.iconBox){let vi=(Wi)=>this.collisionIndex.placeCollisionBox(Wi,v,l,E,a,b,x,s,d.predicate,I,w&&lt?lt:void 0,C);Pt&&Pt.placeable&&k.verticalIconBox?(H=vi(k.verticalIconBox),rt=H.placeable):(H=vi(k.iconBox),rt=H.placeable),nt&&(nt=H.offscreen)}let Pn=f||M.numHorizontalGlyphVertices===0&&M.numVerticalGlyphVertices===0,In=m||M.numIconVertices===0;Pn||In?In?Pn||rt&&(rt=Q):Q=rt&&Q:rt=Q=rt&&Q;let En=rt&&H.placeable;if(Q&&yt.placeable&&this.collisionIndex.insertCollisionBox(yt.box,_,n.get("text-ignore-placement"),r.bucketInstanceId,Pt&&Pt.placeable&&Sn?Sn:ft,d.ID),En&&this.collisionIndex.insertCollisionBox(H.box,v,n.get("icon-ignore-placement"),r.bucketInstanceId,qo,d.ID),Dt&&Q&&this.collisionIndex.insertCollisionCircles(Dt.circles,_,n.get("text-ignore-placement"),r.bucketInstanceId,ft,d.ID),i&&this.storeCollisionData(r.bucketInstanceId,L,k,yt,H,Dt),M.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw Error("bucket.bucketInstanceId can't be 0");this.placements[M.crossTileID]=new yu((Q||P)&&!(yt==null?void 0:yt.occluded),(rt||S)&&!(H==null?void 0:H.occluded),nt||r.justReloaded),e[M.crossTileID]=!0};if(T){if(t.symbolInstanceStart!==0)throw Error("bucket.bucketInstanceId should be 0");let M=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let k=M.length-1;k>=0;--k){let L=M[k];A(r.symbolInstances.get(L),r.collisionArrays[L],L)}}else for(let M=t.symbolInstanceStart;M<t.symbolInstanceEnd;M++)A(r.symbolInstances.get(M),r.collisionArrays[M],M);r.justReloaded=!1}storeCollisionData(t,e,i,r,n,o){if(i.textBox||i.iconBox){let s,a;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(e)?a=s.get(e):(a={text:null,icon:null},s.set(e,a)),i.textBox&&(a.text=r.box),i.iconBox&&(a.icon=n.box)}if(o){let s=this.collisionCircleArrays[t];s===void 0&&(s=this.collisionCircleArrays[t]=[]);for(let a=0;a<o.circles.length;a+=4)s.push(o.circles[a+0]-re),s.push(o.circles[a+1]-re),s.push(o.circles[a+2]),s.push(o.collisionDetected?1:0)}}markUsedJustification(t,e,i,r){let n;n=r===$t.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[function(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}(e)];let o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let s of o)s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=n>=0&&s!==n?0:i.crossTileID)}markUsedOrientation(t,e,i){let r=e===$t.horizontal||e===$t.horizontalOnly?e:0,n=e===$t.vertical?e:0,o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let s of o)t.text.placedSymbolArray.get(s).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let e=this.prevPlacement,i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;let r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(let a in this.placements){let c=this.placements[a],l=n[a];l?(this.opacities[a]=new _n(l,r,c.text,c.icon),i||(i=c.text!==l.text.placed),i||(i=c.icon!==l.icon.placed)):(this.opacities[a]=new _n(null,r,c.text,c.icon,c.skipFade),i||(i=c.text||c.icon))}for(let a in n){let c=n[a];if(!this.opacities[a]){let l=new _n(c,r,!1,!1);l.isHidden()||(this.opacities[a]=l,i||(i=c.text.placed),i||(i=c.icon.placed))}}for(let a in o)this.variableOffsets[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.variableOffsets[a]=o[a]);for(let a in s)this.placedOrientations[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.placedOrientations[a]=s[a]);if(e&&e.lastPlacementChangeTime===void 0)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){let i={};for(let r of e){let n=r.getBucket(t);n&&r.latestFeatureIndex&&t.id===n.layerIds[0]&&this.updateBucketOpacities(n,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(t,e,i,r){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let n=t.layers[0],o=n.layout,s=new _n(null,0,!1,!1,!0),a=o.get("text-allow-overlap"),c=o.get("icon-allow-overlap"),l=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u=o.get("text-rotation-alignment")==="map",h=o.get("text-pitch-alignment")==="map",p=o.get("icon-text-fit")!=="none",d=new _n(null,0,a&&(c||!t.hasIconData()||o.get("icon-optional")),c&&(a||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let f=(_,y,v)=>{for(let g=0;g<y/4;g++)_.opacityVertexArray.emplaceBack(v);_.hasVisibleVertices||(_.hasVisibleVertices=v!==Bo)},m=this.collisionBoxArrays.get(t.bucketInstanceId);for(let _=0;_<t.symbolInstances.length;_++){let y=t.symbolInstances.get(_),{numHorizontalGlyphVertices:v,numVerticalGlyphVertices:g,crossTileID:x}=y,b=this.opacities[x];i[x]?b=s:b||(b=d,this.opacities[x]=b),i[x]=!0;let w=y.numIconVertices>0,T=this.placedOrientations[y.crossTileID],P=T===$t.vertical,S=T===$t.horizontal||T===$t.horizontalOnly;if(v>0||g>0){let I=Y_(b.text);f(t.text,v,P?Bo:I),f(t.text,g,S?Bo:I);let C=b.text.isHidden(),A=[y.rightJustifiedTextSymbolIndex,y.centerJustifiedTextSymbolIndex,y.leftJustifiedTextSymbolIndex];for(let L of A)L>=0&&(t.text.placedSymbolArray.get(L).hidden=C||P?1:0);y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(y.verticalPlacedTextSymbolIndex).hidden=C||S?1:0);let M=this.variableOffsets[y.crossTileID];M&&this.markUsedJustification(t,M.anchor,y,T);let k=this.placedOrientations[y.crossTileID];k&&(this.markUsedJustification(t,"left",y,k),this.markUsedOrientation(t,k,y))}if(w){let I=Y_(b.icon),C=!(p&&y.verticalPlacedIconSymbolIndex&&P);y.placedIconSymbolIndex>=0&&(f(t.icon,y.numIconVertices,C?I:Bo),t.icon.placedSymbolArray.get(y.placedIconSymbolIndex).hidden=b.icon.isHidden()),y.verticalPlacedIconSymbolIndex>=0&&(f(t.icon,y.numVerticalIconVertices,C?Bo:I),t.icon.placedSymbolArray.get(y.verticalPlacedIconSymbolIndex).hidden=b.icon.isHidden())}let E=(m==null?void 0:m.has(_))?m.get(_):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let I=t.collisionArrays[_];if(I){let C=new z(0,0);if(I.textBox||I.verticalTextBox){let A=!0;if(l){let M=this.variableOffsets[x];M?(C=W_(M.anchor,M.width,M.height,M.textOffset,M.textBoxScale),u&&C._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):A=!1}if(I.textBox||I.verticalTextBox){let M;I.textBox&&(M=P),I.verticalTextBox&&(M=S),X_(t.textCollisionBox.collisionVertexArray,b.text.placed,!A||M,E.text,C.x,C.y)}}if(I.iconBox||I.verticalIconBox){let A=Boolean(!S&&I.verticalIconBox),M;I.iconBox&&(M=A),I.verticalIconBox&&(M=!A),X_(t.iconCollisionBox.collisionVertexArray,b.icon.placed,M,E.icon,p?C.x:0,p?C.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){let i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function X_(t,e,i,r,n,o){r&&r.length!==0||(r=[0,0,0,0]);let s=r[0]-re,a=r[1]-re,c=r[2]-re,l=r[3]-re;t.emplaceBack(e?1:0,i?1:0,n||0,o||0,s,a),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,c,a),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,c,l),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,s,l)}let S1=Math.pow(2,25),P1=Math.pow(2,24),I1=Math.pow(2,17),E1=Math.pow(2,16),M1=Math.pow(2,9),C1=Math.pow(2,8),A1=Math.pow(2,1);function Y_(t){if(t.opacity===0&&!t.placed)return 0;if(t.opacity===1&&t.placed)return 4294967295;let e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*S1+e*P1+i*I1+e*E1+i*M1+e*C1+i*A1+e}let Bo=0;class K_{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){let o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((s,a)=>s.sortKey-a.sortKey));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class J_{constructor(t,e,i,r,n,o,s,a){this.placement=new H_(t,e,o,s,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,i){let r=St(),n=()=>!this._forceFullPlacement&&St()-r>2;for(;this._currentPlacementIndex>=0;){let o=e[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(Mm(o)&&o.layout&&(!o.minzoom||o.minzoom<=s)&&(!o.maxzoom||o.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new K_(o)),this._inProgressLayer.continuePlacement(i[o.source],this.placement,this._showCollisionBoxes,o,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}let Oo=0.03125;class Q_{constructor(t,e,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let n=0;n<e.length;n++){let o=e.get(n),s=o.key,a=r.get(s);a?a.push(o):r.set(s,[o])}for(let[n,o]of r){let s={positions:o.map((a)=>({x:Math.floor(a.anchorX*Oo),y:Math.floor(a.anchorY*Oo)})),crossTileIDs:o.map((a)=>a.crossTileID)};if(s.positions.length>128){let a=new sh(s.positions.length,16,Uint16Array);for(let{x:c,y:l}of s.positions)a.add(c,l);a.finish(),delete s.positions,s.index=a}this._symbolsByKey[n]=s}}getScaledCoordinates(t,e){let{x:i,y:r,z:n}=this.tileID.canonical,{x:o,y:s,z:a}=e.canonical,c=Oo/Math.pow(2,a-n),l=(s*F+t.anchorY)*c,u=r*F*Oo;return{x:Math.floor((o*F+t.anchorX)*c-i*F*Oo),y:Math.floor(l-u)}}findMatches(t,e,i){let r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){let o=t.get(n);if(o.crossTileID)continue;let s=this._symbolsByKey[o.key];if(!s)continue;let a=this.getScaledCoordinates(o,e);if(s.index){let c=s.index.range(a.x-r,a.y-r,a.x+r,a.y+r).sort();for(let l of c){let u=s.crossTileIDs[l];if(!i[u]){i[u]=!0,o.crossTileID=u;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let l=s.positions[c],u=s.crossTileIDs[c];if(Math.abs(l.x-a.x)<=r&&Math.abs(l.y-a.y)<=r&&!i[u]){i[u]=!0,o.crossTileID=u;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class tg{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class eg{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let e=Math.round((t-this.lng)/360);if(e!==0)for(let i in this.indexes){let r=this.indexes[i],n={};for(let o in r){let s=r[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),n[s.tileID.key]=s}this.indexes[i]=n}this.lng=t}addBucket(t,e,i){var r,n,o;if((r=this.indexes[t.overscaledZ])===null||r===void 0?void 0:r[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let a=0;a<e.symbolInstances.length;a++)e.symbolInstances.get(a).crossTileID=0;(n=this.usedCrossTileIDs)[o=t.overscaledZ]||(n[o]={});let s=this.usedCrossTileIDs[t.overscaledZ];for(let a in this.indexes){let c=this.indexes[a];if(Number(a)>t.overscaledZ)for(let l in c){let u=c[l];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,s)}else{let l=c[t.scaledTo(Number(a)).key];l&&l.findMatches(e.symbolInstances,t,s)}}for(let a=0;a<e.symbolInstances.length;a++){let c=e.symbolInstances.get(a);c.crossTileID||(c.crossTileID=i.generate(),s[c.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Q_(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(let i of e.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[t][r]}removeStaleBuckets(t){let e=!1;for(let i in this.indexes){let r=this.indexes[i];for(let n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class vu{constructor(){this.layerIndexes={},this.crossTileIDs=new tg,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];r===void 0&&(r=this.layerIndexes[t.id]=new eg);let n=!1,o={};r.handleWrapJump(i);for(let s of e){let a=s.getBucket(t);t.id===(a==null?void 0:a.layerIds[0])&&(a.bucketInstanceId||(this.maxBucketInstanceId+=1,a.bucketInstanceId=this.maxBucketInstanceId),r.addBucket(s.tileID,a,this.crossTileIDs)&&(n=!0),o[a.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){let e={};for(let i of t)e[i]=!0;for(let i in this.layerIndexes)e[i]||delete this.layerIndexes[i]}}var ig="void main() {fragColor=vec4(1.0);}";let yi={prelude:dt(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else