wacomm 2.16.0 → 2.19.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 (150) hide show
  1. package/dist/ShowMore.stories.d.ts +1 -1
  2. package/dist/Tabs.d.ts +3 -2
  3. package/dist/TextareaAutosize.d.ts +2 -1
  4. package/dist/{alertWrapper → alerts}/AlertWrapper.stories.d.ts +1 -1
  5. package/dist/{alertWrapper → alerts}/ChatAlert.stories.d.ts +1 -1
  6. package/dist/alerts/MessageAlert.d.ts +10 -0
  7. package/dist/alerts/MessageAlert.stories.d.ts +9 -0
  8. package/dist/{alertWrapper → alerts}/NotificationAlert.stories.d.ts +1 -1
  9. package/dist/{alertWrapper → alerts}/index.d.ts +1 -0
  10. package/dist/avatar/Avatar.stories.d.ts +1 -1
  11. package/dist/avatar/AvatarTag.stories.d.ts +1 -1
  12. package/dist/avatar/AvatarTimeTag.stories.d.ts +1 -1
  13. package/dist/blockUser/BlockUser.d.ts +9 -0
  14. package/dist/blockUser/BlockUser.stories.d.ts +7 -0
  15. package/dist/blockUser/BlockUser.test.d.ts +0 -0
  16. package/dist/blockUser/index.d.ts +1 -0
  17. package/dist/buttons/AddButton.stories.d.ts +1 -1
  18. package/dist/buttons/Button.stories.d.ts +1 -1
  19. package/dist/buttons/CacheButton.stories.d.ts +1 -1
  20. package/dist/buttons/ModalButton.stories.d.ts +1 -1
  21. package/dist/buttons/SaveCancelButtons.stories.d.ts +1 -1
  22. package/dist/buttons/StyledButton.stories.d.ts +1 -1
  23. package/dist/buttons/SvgButton.stories.d.ts +1 -1
  24. package/dist/buttons/ToggleButton.stories.d.ts +1 -1
  25. package/dist/carousel/Carousel.stories.d.ts +1 -1
  26. package/dist/checkboxGroup/Checkbox.stories.d.ts +1 -1
  27. package/dist/checkboxGroup/CheckboxGroup.stories.d.ts +1 -1
  28. package/dist/commentReply/CommentReplyCount.stories.d.ts +1 -1
  29. package/dist/commentReply/CommentsSection.stories.d.ts +1 -1
  30. package/dist/commentReply/RepliesSection.stories.d.ts +1 -1
  31. package/dist/containers/Column.stories.d.ts +1 -1
  32. package/dist/containers/Container.stories.d.ts +1 -1
  33. package/dist/containers/Row.stories.d.ts +1 -1
  34. package/dist/contentViolation/ContentViolationForm.d.ts +10 -0
  35. package/dist/contentViolation/ContentViolationReporter.d.ts +9 -0
  36. package/dist/contentViolation/ContentViolationReporter.stories.d.ts +7 -0
  37. package/dist/contentViolation/ContentViolationReporter.test.d.ts +0 -0
  38. package/dist/contentViolation/index.d.ts +2 -0
  39. package/dist/coordinates/CoordinateUpdater.stories.d.ts +1 -1
  40. package/dist/coordinates/Coordinates.stories.d.ts +1 -1
  41. package/dist/coordinates/CoordinatesUpdater.stories.d.ts +1 -1
  42. package/dist/coordinates/MyGeolocationUpdater.stories.d.ts +1 -1
  43. package/dist/datetime/DateDisplay.stories.d.ts +1 -1
  44. package/dist/datetime/DatePicker.stories.d.ts +1 -1
  45. package/dist/html/Heading.stories.d.ts +1 -1
  46. package/dist/html/input/PasswordSetup.stories.d.ts +1 -1
  47. package/dist/images/imageCropper/ImageCropper.stories.d.ts +1 -1
  48. package/dist/images/imageGrid/ImageGrid.stories.d.ts +1 -1
  49. package/dist/images/imageGrid/ImageGridUpload.stories.d.ts +1 -1
  50. package/dist/images/mediaUpload/MediaUpload.stories.d.ts +1 -1
  51. package/dist/index.d.ts +5 -1
  52. package/dist/interests/CategoryTag.stories.d.ts +1 -1
  53. package/dist/interests/interestIcon/CardGamesInterestIcons.stories.d.ts +1 -1
  54. package/dist/interests/interestIcon/LeisureInterestIcons.stories.d.ts +1 -1
  55. package/dist/interests/interestIcon/MusicInterestIcons.stories.d.ts +1 -1
  56. package/dist/interests/interestIcon/PetsInterestIcons.stories.d.ts +1 -1
  57. package/dist/interests/interestIcon/SportsInterestIcons.stories.d.ts +1 -1
  58. package/dist/interests/interestIcon/TravelInterestIcons.stories.d.ts +1 -1
  59. package/dist/interests/interestIconTooltip/CardGamesInterestIconTooltips.stories.d.ts +1 -1
  60. package/dist/interests/interestIconTooltip/LeisureInterestIconTooltips.stories.d.ts +1 -1
  61. package/dist/interests/interestIconTooltip/MusicInterestIconTooltips.stories.d.ts +1 -1
  62. package/dist/interests/interestIconTooltip/PetsInterestIconTooltips.stories.d.ts +1 -1
  63. package/dist/interests/interestIconTooltip/SportsInterestIconTooltips.stories.d.ts +1 -1
  64. package/dist/interests/interestIconTooltip/TravelInterestIconTooltips.stories.d.ts +1 -1
  65. package/dist/interests/interestTag/CardGamesInterestTags.stories.d.ts +1 -1
  66. package/dist/interests/interestTag/InterestTag.stories.d.ts +1 -1
  67. package/dist/interests/interestTag/LeisureInterestTags.stories.d.ts +1 -1
  68. package/dist/interests/interestTag/MusicInterestTags.stories.d.ts +1 -1
  69. package/dist/interests/interestTag/PetsInterestTags.stories.d.ts +1 -1
  70. package/dist/interests/interestTag/SportsInterestTags.stories.d.ts +1 -1
  71. package/dist/interests/interestTag/TravelInterestTags.stories.d.ts +1 -1
  72. package/dist/inviteByEmails/EmailAddForm.stories.d.ts +1 -1
  73. package/dist/inviteByEmails/EmailEntryItem.stories.d.ts +1 -1
  74. package/dist/inviteByEmails/EmailEntryList.stories.d.ts +1 -1
  75. package/dist/inviteByEmails/InviteByEmails.stories.d.ts +1 -1
  76. package/dist/likes/LikeSection.stories.d.ts +1 -1
  77. package/dist/mapbox-gl-B3Paeapq.js +2956 -0
  78. package/dist/mapbox-gl-Dh7H8Npu.mjs +45578 -0
  79. package/dist/maplibre-gl-CkvIIBTt.mjs +25777 -0
  80. package/dist/maplibre-gl-DY_E7Ht0.js +527 -0
  81. package/dist/message/MessageButton.d.ts +8 -0
  82. package/dist/message/MessageButton.stories.d.ts +20 -0
  83. package/dist/message/MessageInput.d.ts +7 -0
  84. package/dist/message/MessageInput.stories.d.ts +15 -0
  85. package/dist/message/index.d.ts +2 -0
  86. package/dist/modal/Modal.stories.d.ts +1 -1
  87. package/dist/modal/ModalItem.stories.d.ts +1 -1
  88. package/dist/moreActions/MoreActions.d.ts +11 -0
  89. package/dist/moreActions/MoreActions.stories.d.ts +7 -0
  90. package/dist/moreActions/MoreActions.test.d.ts +0 -0
  91. package/dist/moreActions/index.d.ts +1 -0
  92. package/dist/radioGroup/Radio.stories.d.ts +1 -1
  93. package/dist/radioGroup/RadioGroup.stories.d.ts +1 -1
  94. package/dist/rolldown-runtime-DY7j01NX.mjs +30 -0
  95. package/dist/rolldown-runtime-D_FWMvbo.js +1 -0
  96. package/dist/svgTags/BlockTag.d.ts +9 -0
  97. package/dist/svgTags/BlockTag.stories.d.ts +7 -0
  98. package/dist/svgTags/BuddyTag.stories.d.ts +1 -1
  99. package/dist/svgTags/CalendarTag.stories.d.ts +1 -1
  100. package/dist/svgTags/CommentTag.stories.d.ts +1 -1
  101. package/dist/svgTags/CopyTag.stories.d.ts +1 -1
  102. package/dist/svgTags/CreateTag.stories.d.ts +1 -1
  103. package/dist/svgTags/ExploreTag.stories.d.ts +1 -1
  104. package/dist/svgTags/GoBackTag.stories.d.ts +1 -1
  105. package/dist/svgTags/HomeTag.stories.d.ts +1 -1
  106. package/dist/svgTags/LogoutTag.stories.d.ts +1 -1
  107. package/dist/svgTags/MapTag.stories.d.ts +1 -1
  108. package/dist/svgTags/MessageTag.d.ts +8 -0
  109. package/dist/svgTags/MessageTag.stories.d.ts +7 -0
  110. package/dist/svgTags/NearbyTag.stories.d.ts +1 -1
  111. package/dist/svgTags/NewsfeedTag.stories.d.ts +1 -1
  112. package/dist/svgTags/PrivateTag.stories.d.ts +1 -1
  113. package/dist/svgTags/ReportTag.d.ts +9 -0
  114. package/dist/svgTags/ReportTag.stories.d.ts +7 -0
  115. package/dist/svgTags/SvgTag.stories.d.ts +1 -1
  116. package/dist/svgTags/UpArrowTag.stories.d.ts +1 -1
  117. package/dist/svgTags/index.d.ts +3 -0
  118. package/dist/svgTags/locations/CityTag.stories.d.ts +1 -1
  119. package/dist/svgTags/locations/LocationPointTag.stories.d.ts +1 -1
  120. package/dist/svgTags/locations/LocationTag.stories.d.ts +1 -1
  121. package/dist/svgTags/locations/StreetTag.stories.d.ts +1 -1
  122. package/dist/svgTags/posts/CreatePostTag.stories.d.ts +1 -1
  123. package/dist/svgTags/posts/ImageTag.stories.d.ts +1 -1
  124. package/dist/svgTags/posts/PollTag.stories.d.ts +1 -1
  125. package/dist/svgTags/posts/PostTag.stories.d.ts +1 -1
  126. package/dist/svgTags/profiles/ArenaTag.stories.d.ts +1 -1
  127. package/dist/svgTags/profiles/CoachTag.stories.d.ts +1 -1
  128. package/dist/svgTags/profiles/CollectionTag.stories.d.ts +1 -1
  129. package/dist/svgTags/profiles/EventTag.stories.d.ts +1 -1
  130. package/dist/svgTags/profiles/GameTag.stories.d.ts +1 -1
  131. package/dist/svgTags/profiles/LeaderboardTag.stories.d.ts +1 -1
  132. package/dist/svgTags/profiles/MarketTag.stories.d.ts +1 -1
  133. package/dist/svgTags/profiles/ProfileTag.stories.d.ts +1 -1
  134. package/dist/svgTags/profiles/TeamTag.stories.d.ts +1 -1
  135. package/dist/svgTags/profiles/UserTag.stories.d.ts +1 -1
  136. package/dist/tags/Tag.stories.d.ts +1 -1
  137. package/dist/tags/Tags.stories.d.ts +1 -1
  138. package/dist/wacomm.cjs.js +689 -1
  139. package/dist/wacomm.css +2 -1
  140. package/dist/wacomm.es.js +41287 -153
  141. package/package.json +13 -13
  142. package/dist/index-9cyy21Gb.mjs +0 -62454
  143. package/dist/index-Chuw4Ews.js +0 -921
  144. package/dist/mapbox-gl-BPlgA_VG.mjs +0 -36217
  145. package/dist/mapbox-gl-z4AKn_Nw.js +0 -3073
  146. package/dist/maplibre-gl-B5W3svJJ.mjs +0 -18016
  147. package/dist/maplibre-gl-DdapCre3.js +0 -580
  148. /package/dist/{alertWrapper → alerts}/AlertWrapper.d.ts +0 -0
  149. /package/dist/{alertWrapper → alerts}/ChatAlert.d.ts +0 -0
  150. /package/dist/{alertWrapper → alerts}/NotificationAlert.d.ts +0 -0
@@ -1,580 +0,0 @@
1
- "use strict";const Ep=require("./index-Chuw4Ews.js");function Dp(Ta,Ol){for(var Fr=0;Fr<Ol.length;Fr++){const ki=Ol[Fr];if(typeof ki!="string"&&!Array.isArray(ki)){for(const Or in ki)if(Or!=="default"&&!(Or in Ta)){const Sa=Object.getOwnPropertyDescriptor(ki,Or);Sa&&Object.defineProperty(Ta,Or,Sa.get?Sa:{enumerable:!0,get:()=>ki[Or]})}}}return Object.freeze(Object.defineProperty(Ta,Symbol.toStringTag,{value:"Module"}))}var Ro={exports:{}};/**
2
- * MapLibre GL JS
3
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
4
- */var Lp=Ro.exports,Fu;function Rp(){return Fu||(Fu=1,(function(Ta,Ol){(function(Fr,ki){Ta.exports=ki()})(Lp,(function(){"use strict";var Fr={},ki={};function Or(L,p,zi){if(ki[L]=zi,L==="index"){var Xi="var sharedModule = {}; ("+ki.shared+")(sharedModule); ("+ki.worker+")(sharedModule);",Gt={};return ki.shared(Gt),ki.index(Fr,Gt),typeof window<"u"&&Fr.setWorkerUrl(window.URL.createObjectURL(new Blob([Xi],{type:"text/javascript"}))),Fr}}Or("shared",["exports"],(function(L){"use strict";function p(i,t,r,n){return new(r||(r=Promise))((function(l,u){function d(x){try{_(n.next(x))}catch(v){u(v)}}function f(x){try{_(n.throw(x))}catch(v){u(v)}}function _(x){var v;x.done?l(x.value):(v=x.value,v instanceof r?v:new r((function(w){w(v)}))).then(d,f)}_((n=n.apply(i,t||[])).next())}))}function zi(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Xi=Gt;function Gt(i,t){this.x=i,this.y=t}Gt.prototype={clone:function(){return new Gt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),n=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=n,this},_rotateAround:function(i,t){var r=Math.cos(i),n=Math.sin(i),l=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-n*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Gt.convert=function(i){return i instanceof Gt?i:Array.isArray(i)?new Gt(i[0],i[1]):i};var me=zi(Xi),ne=Vr;function Vr(i,t,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=n}Vr.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=l/u}var d=0,f=1;for(r=i,n=0;n<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));n++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var br=zi(ne);let Wi,wr;function hr(){return Wi==null&&(Wi=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Wi}function Gs(){if(wr==null&&(wr=!1,hr())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let n=0;n<25;n++){const l=4*n;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(n%5,Math.floor(n/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let n=0;n<100;n++)if(n%4!=3&&r[n]!==n){wr=!0;break}}}return wr||!1}function hi(i,t,r,n){const l=new br(i,t,r,n);return u=>l.solve(u)}const Ia=hi(.25,.1,.25,1);function Ei(i,t,r){return Math.min(r,Math.max(t,i))}function Ki(i,t,r){const n=r-t,l=((i-t)%n+n)%n+t;return l===t?r:l}function vi(i,...t){for(const r of t)for(const n in r)i[n]=r[n];return i}let Pn=1;function Ji(i,t,r){const n={};for(const l in i)n[l]=t.call(this,i[l],l,i);return n}function Hs(i,t,r){const n={};for(const l in i)t.call(this,i[l],l,i)&&(n[l]=i[l]);return n}function nt(i){return Array.isArray(i)?i.map(nt):typeof i=="object"&&i?Ji(i,nt):i}const An={};function Ft(i){An[i]||(typeof console<"u"&&console.warn(i),An[i]=!0)}function Ht(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function ur(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let os=null;function Yi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Mn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Nr(i,t,r,n,l){return p(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const d=u==null?void 0:u.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),_=new Uint8ClampedArray(n*l*4);if(yield u.copyTo(_,(function(x,v,w,I,M){const k=4*Math.max(-v,0),z=(Math.max(0,w)-w)*I*4+k,F=4*I,j=Math.max(0,v),Q=Math.max(0,w);return{rect:{x:j,y:Q,width:Math.min(x.width,v+I)-j,height:Math.min(x.height,w+M)-Q},layout:[{offset:z,stride:F}]}})(i,t,r,n,l)),f)for(let x=0;x<_.length;x+=4){const v=_[x];_[x]=_[x+2],_[x+2]=v}return _}finally{u.close()}}))}let dr,ei;const Di="AbortError";function ls(){return new Error(Di)}const Tr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Qi(i){return Tr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const cs="global-dispatcher";class ui extends Error{constructor(t,r,n,l){super(`AJAXError: ${r} (${t}): ${n}`),this.status=t,this.statusText=r,this.url=n,this.body=l}}const Li=()=>ur(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,jr=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const n=Qi(i.url);if(n)return n(i,t);if(ur(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:cs},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Li())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(n,l){return p(this,void 0,void 0,(function*(){const u=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:Li(),signal:l.signal});n.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");const d=yield fetch(u);if(!d.ok){const x=yield d.blob();throw new ui(d.status,d.statusText,n.url,x)}let f;f=n.type==="arrayBuffer"||n.type==="image"?d.arrayBuffer():n.type==="json"?d.json():d.text();const _=yield f;if(l.signal.aborted)throw ls();return{data:_,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}}))})(i,t);if(ur(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:cs},t)}var r;return(function(n,l){return new Promise(((u,d)=>{var f;const _=new XMLHttpRequest;_.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(_.responseType="arraybuffer");for(const x in n.headers)_.setRequestHeader(x,n.headers[x]);n.type==="json"&&(_.responseType="text",!((f=n.headers)===null||f===void 0)&&f.Accept||_.setRequestHeader("Accept","application/json")),_.withCredentials=n.credentials==="include",_.onerror=()=>{d(new Error(_.statusText))},_.onload=()=>{if(!l.signal.aborted)if((_.status>=200&&_.status<300||_.status===0)&&_.response!==null){let x=_.response;if(n.type==="json")try{x=JSON.parse(_.response)}catch(v){return void d(v)}u({data:x,cacheControl:_.getResponseHeader("Cache-Control"),expires:_.getResponseHeader("Expires")})}else{const x=new Blob([_.response],{type:_.getResponseHeader("Content-Type")});d(new ui(_.status,_.statusText,n.url,x))}},l.signal.addEventListener("abort",(()=>{_.abort(),d(ls())})),_.send(n.body)}))})(i,t)};function Ur(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Xs(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function pr(i,t,r){if(r&&r[i]){const n=r[i].indexOf(t);n!==-1&&r[i].splice(n,1)}}class Sr{constructor(t,r={}){vi(this,r),this.type=t}}class Ir extends Sr{constructor(t,r={}){super("error",vi({error:t},r))}}class hs{on(t,r){return this._listeners=this._listeners||{},Xs(t,r,this._listeners),this}off(t,r){return pr(t,r,this._listeners),pr(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Xs(t,r,this._oneTimeListeners),this):new Promise((n=>this.once(t,n)))}fire(t,r){typeof t=="string"&&(t=new Sr(t,r||{}));const n=t.type;if(this.listens(n)){t.target=this;const l=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const f of l)f.call(this,t);const u=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const f of u)pr(n,f,this._oneTimeListeners),f.call(this,t);const d=this._eventedParent;d&&(vi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof Ir&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},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},"*":{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:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},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:"*",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:.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:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},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)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"},"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:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"}}};const $r=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ws(i,t){const r={};for(const n in i)n!=="ref"&&(r[n]=i[n]);return $r.forEach((n=>{n in t&&(r[n]=t[n])})),r}function et(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r<i.length;r++)if(!et(i[r],t[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&t!==null){if(typeof t!="object"||Object.keys(i).length!==Object.keys(t).length)return!1;for(const r in i)if(!et(i[r],t[r]))return!1;return!0}return i===t}function yt(i,t){i.push(t)}function Ks(i,t,r){yt(r,{command:"addSource",args:[i,t[i]]})}function Pr(i,t,r){yt(t,{command:"removeSource",args:[i]}),r[i]=!0}function fr(i,t,r,n){Pr(i,r,n),Ks(i,t,r)}function us(i,t,r){let n;for(n in i[r])if(Object.prototype.hasOwnProperty.call(i[r],n)&&n!=="data"&&!et(i[r][n],t[r][n]))return!1;for(n in t[r])if(Object.prototype.hasOwnProperty.call(t[r],n)&&n!=="data"&&!et(i[r][n],t[r][n]))return!1;return!0}function bi(i,t,r,n,l,u){i=i||{},t=t||{};for(const d in i)Object.prototype.hasOwnProperty.call(i,d)&&(et(i[d],t[d])||r.push({command:u,args:[n,d,t[d],l]}));for(const d in t)Object.prototype.hasOwnProperty.call(t,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(et(i[d],t[d])||r.push({command:u,args:[n,d,t[d],l]}))}function Js(i){return i.id}function Ys(i,t){return i[t.id]=t,i}class ue{constructor(t,r,n,l){this.message=(t?`${t}: `:"")+n,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function er(i,...t){for(const r of t)for(const n in r)i[n]=r[n];return i}class Xt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class tr{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[n,l]of r)this.bindings[n]=l}concat(t){return new tr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Ar={kind:"null"},_e={kind:"number"},$e={kind:"string"},Be={kind:"boolean"},ti={kind:"color"},Ri={kind:"object"},Ne={kind:"value"},ir={kind:"collator"},mr={kind:"formatted"},Mr={kind:"padding"},rr={kind:"resolvedImage"},N={kind:"variableAnchorOffsetCollection"};function A(i,t){return{kind:"array",itemType:i,N:t}}function P(i){if(i.kind==="array"){const t=P(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}const D=[Ar,_e,$e,Be,ti,mr,Ri,A(Ne),Mr,rr,N];function O(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!O(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(const r of D)if(!O(r,t))return null}}return`Expected ${P(i)} but found ${P(t)} instead.`}function H(i,t){return t.some((r=>r.kind===i.kind))}function W(i,t){return t.some((r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i))}function Y(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}const q=.96422,se=.82521,le=4/29,te=6/29,de=3*te*te,Ee=te*te*te,De=Math.PI/180,Ke=180/Math.PI;function je(i){return(i%=360)<0&&(i+=360),i}function Je([i,t,r,n]){let l,u;const d=Pt((.2225045*(i=Ge(i))+.7168786*(t=Ge(t))+.0606169*(r=Ge(r)))/1);i===t&&t===r?l=u=d:(l=Pt((.4360747*i+.3850649*t+.1430804*r)/q),u=Pt((.0139322*i+.0971045*t+.7141733*r)/se));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),n]}function Ge(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Pt(i){return i>Ee?Math.pow(i,1/3):i/de+le}function xt([i,t,r,n]){let l=(i+16)/116,u=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*rt(l),u=q*rt(u),d=se*rt(d),[qe(3.1338561*u-1.6168667*l-.4906146*d),qe(-.9787684*u+1.9161415*l+.033454*d),qe(.0719453*u-.2289914*l+1.4052427*d),n]}function qe(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function rt(i){return i>te?i*i*i:de*(i-le)}function gt(i){return parseInt(i.padEnd(2,i),16)/255}function kt(i,t){return Lt(t?i/100:i,0,1)}function Lt(i,t,r){return Math.min(Math.max(t,i),r)}function Wt(i){return!i.some(Number.isNaN)}const ds={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]};class st{constructor(t,r,n,l=1,u=!0){this.r=t,this.g=r,this.b=n,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,n,l]))}static parse(t){if(t instanceof st)return t;if(typeof t!="string")return;const r=(function(n){if((n=n.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=ds[n];if(l){const[d,f,_]=l;return[d/255,f/255,_/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const d=n.length<6?1:2;let f=1;return[gt(n.slice(f,f+=d)),gt(n.slice(f,f+=d)),gt(n.slice(f,f+=d)),gt(n.slice(f,f+d)||"ff")]}if(n.startsWith("rgb")){const d=n.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,x,v,w,I,M,k,z,F,j,Q]=d,G=[v||" ",M||" ",F].join("");if(G===" "||G===" /"||G===",,"||G===",,,"){const J=[x,I,z].join(""),re=J==="%%%"?100:J===""?255:0;if(re){const ce=[Lt(+_/re,0,1),Lt(+w/re,0,1),Lt(+k/re,0,1),j?kt(+j,Q):1];if(Wt(ce))return ce}}return}}const u=n.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,_,x,v,w,I,M,k]=u,z=[_||" ",v||" ",I].join("");if(z===" "||z===" /"||z===",,"||z===",,,"){const F=[+f,Lt(+x,0,100),Lt(+w,0,100),M?kt(+M,k):1];if(Wt(F))return(function([j,Q,G,J]){function re(ce){const we=(ce+j/30)%12,Le=Q*Math.min(G,1-G);return G-Le*Math.max(-1,Math.min(we-3,9-we,1))}return j=je(j),Q/=100,G/=100,[re(0),re(8),re(4),J]})(F)}}})(t);return r?new st(...r,!1):void 0}get rgb(){const{r:t,g:r,b:n,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[t/u,r/u,n/u,l])}get hcl(){return this.overwriteGetter("hcl",(function(t){const[r,n,l,u]=Je(t),d=Math.sqrt(n*n+l*l);return[Math.round(1e4*d)?je(Math.atan2(l,n)*Ke):NaN,d,r,u]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Je(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,n,l]=this.rgb;return`rgba(${[t,r,n].map((u=>Math.round(255*u))).join(",")},${l})`}}st.black=new st(0,0,0,1),st.white=new st(1,1,1,1),st.transparent=new st(0,0,0,0),st.red=new st(1,0,0,1);class Pa{constructor(t,r,n){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Aa{constructor(t,r,n,l,u){this.text=t,this.image=r,this.scale=n,this.fontStack=l,this.textColor=u}}class di{constructor(t){this.sections=t}static fromString(t){return new di([new Aa(t,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 di?t:di.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t=>t.text)).join("")}}class pi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof pi)return t;if(typeof t=="number")return new pi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="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 pi(t)}}toString(){return JSON.stringify(this.values)}}const Vl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class wi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof wi)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const n=t[r],l=t[r+1];if(typeof n!="string"||!Vl.has(n)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new wi(t)}}toString(){return JSON.stringify(this.values)}}class fi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new fi({name:t,available:!1}):null}}function ps(i,t,r,n){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,t,r,n]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function qr(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof st||i instanceof Pa||i instanceof di||i instanceof pi||i instanceof wi||i instanceof fi)return!0;if(Array.isArray(i)){for(const t of i)if(!qr(t))return!1;return!0}if(typeof i=="object"){for(const t in i)if(!qr(i[t]))return!1;return!0}return!1}function At(i){if(i===null)return Ar;if(typeof i=="string")return $e;if(typeof i=="boolean")return Be;if(typeof i=="number")return _e;if(i instanceof st)return ti;if(i instanceof Pa)return ir;if(i instanceof di)return mr;if(i instanceof pi)return Mr;if(i instanceof wi)return N;if(i instanceof fi)return rr;if(Array.isArray(i)){const t=i.length;let r;for(const n of i){const l=At(n);if(r){if(r===l)continue;r=Ne;break}r=l}return A(r||Ne,t)}return Ri}function Qs(i){const t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof st||i instanceof di||i instanceof pi||i instanceof wi||i instanceof fi?i.toString():JSON.stringify(i)}class Bi{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!qr(t[1]))return r.error("invalid value");const n=t[1];let l=At(n);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Bi(l,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class St{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Cn={string:$e,number:_e,boolean:Be,object:Ri};class Fi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n,l=1;const u=t[0];if(u==="array"){let f,_;if(t.length>2){const x=t[1];if(typeof x!="string"||!(x in Cn)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Cn[x],l++}else f=Ne;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=t[2],l++}n=A(f,_)}else{if(!Cn[u])throw new Error(`Types doesn't contain name = ${u}`);n=Cn[u]}const d=[];for(;l<t.length;l++){const f=r.parse(t[l],l,Ne);if(!f)return null;d.push(f)}return new Fi(n,d)}evaluate(t){for(let r=0;r<this.args.length;r++){const n=this.args[r].evaluate(t);if(!O(this.type,At(n)))return n;if(r===this.args.length-1)throw new St(`Expected value to be of type ${P(this.type)}, but found ${P(At(n))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Ma={"to-boolean":Be,"to-color":ti,"to-number":_e,"to-string":$e};class Oi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const n=t[0];if(!Ma[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&t.length!==2)return r.error("Expected one argument.");const l=Ma[n],u=[];for(let d=1;d<t.length;d++){const f=r.parse(t[d],d,Ne);if(!f)return null;u.push(f)}return new Oi(l,u)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,n;for(const l of this.args){if(r=l.evaluate(t),n=null,r instanceof st)return r;if(typeof r=="string"){const u=t.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(n=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ps(r[0],r[1],r[2],r[3]),!n))return new st(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new St(n||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const n of this.args){r=n.evaluate(t);const l=pi.parse(r);if(l)return l}throw new St(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const n of this.args){r=n.evaluate(t);const l=wi.parse(r);if(l)return l}throw new St(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const n of this.args){if(r=n.evaluate(t),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new St(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return di.fromString(Qs(this.args[0].evaluate(t)));case"resolvedImage":return fi.fromString(Qs(this.args[0].evaluate(t)));default:return Qs(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Nl=["Unknown","Point","LineString","Polygon"];class kn{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Nl[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 r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=st.parse(t)),r}}class Zr{constructor(t,r,n=[],l,u=new tr,d=[]){this.registry=t,this.path=n,this.key=n.map((f=>`[${f}]`)).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,n,l,u={}){return r?this.concat(r,n,l)._parse(t,u):this._parse(t,u)}_parse(t,r){function n(l,u,d){return d==="assert"?new Fi(u,[l]):d==="coerce"?new Oi(u,[l]):l}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", []].');const l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(t,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Bi)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new kn;try{d=new Bi(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${l}". 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,r,n){const l=typeof t=="number"?this.path.concat(t):this.path,u=n?this.scope.concat(n):this.scope;return new Zr(this.registry,this._isConstant,l,r||null,u,this.errors)}error(t,...r){const n=`${this.key}${r.map((l=>`[${l}]`)).join("")}`;this.errors.push(new Xt(n,t))}checkSubtype(t,r){const n=O(t,r);return n&&this.error(n),n}}class Cr{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let u=1;u<t.length-1;u+=2){const d=t[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(t[u+1],u+1);if(!f)return null;n.push([d,f])}const l=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return l?new Cr(n,l):null}outputDefined(){return this.result.outputDefined()}}class tt{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const n=t[1];return r.scope.has(n)?new tt(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ca{constructor(t,r,n){this.type=t,this.index=r,this.input=n}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,_e),l=r.parse(t[2],2,A(r.expectedType||Ne));return n&&l?new Ca(l.type.itemType,n,l):null}evaluate(t){const r=this.index.evaluate(t),n=this.input.evaluate(t);if(r<0)throw new St(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new St(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new St(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ka{constructor(t,r){this.type=Be,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,Ne),l=r.parse(t[2],2,Ne);return n&&l?H(n.type,[Be,$e,_e,Ar,Ne])?new ka(n,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(n.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!W(r,["boolean","string","number","null"]))throw new St(`Expected first argument to be of type boolean, string, number or null, but found ${P(At(r))} instead.`);if(!W(n,["string","array"]))throw new St(`Expected second argument to be of type array or string, but found ${P(At(n))} instead.`);return n.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class fs{constructor(t,r,n){this.type=_e,this.needle=t,this.haystack=r,this.fromIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,Ne),l=r.parse(t[2],2,Ne);if(!n||!l)return null;if(!H(n.type,[Be,$e,_e,Ar,Ne]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(n.type)} instead`);if(t.length===4){const u=r.parse(t[3],3,_e);return u?new fs(n,l,u):null}return new fs(n,l)}evaluate(t){const r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!W(r,["boolean","string","number","null"]))throw new St(`Expected first argument to be of type boolean, string, number or null, but found ${P(At(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),W(n,["string"])){const u=n.indexOf(r,l);return u===-1?-1:[...n.slice(0,u)].length}if(W(n,["array"]))return n.indexOf(r,l);throw new St(`Expected second argument to be of type array or string, but found ${P(At(n))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class za{constructor(t,r,n,l,u,d){this.inputType=t,this.type=r,this.input=n,this.cases=l,this.outputs=u,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let n,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let x=2;x<t.length-1;x+=2){let v=t[x];const w=t[x+1];Array.isArray(v)||(v=[v]);const I=r.concat(x);if(v.length===0)return I.error("Expected at least one branch label.");for(const k of v){if(typeof k!="number"&&typeof k!="string")return I.error("Branch labels must be numbers or strings.");if(typeof k=="number"&&Math.abs(k)>Number.MAX_SAFE_INTEGER)return I.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof k=="number"&&Math.floor(k)!==k)return I.error("Numeric branch labels must be integer values.");if(n){if(I.checkSubtype(n,At(k)))return null}else n=At(k);if(u[String(k)]!==void 0)return I.error("Branch labels must be unique.");u[String(k)]=d.length}const M=r.parse(w,x,l);if(!M)return null;l=l||M.type,d.push(M)}const f=r.parse(t[1],1,Ne);if(!f)return null;const _=r.parse(t[t.length-1],t.length-1,l);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(n,f.type)?null:new za(n,l,f,u,d,_):null}evaluate(t){const r=this.input.evaluate(t);return(At(r)===this.inputType&&this.outputs[this.cases[r]]||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 zn{constructor(t,r,n){this.type=t,this.branches=r,this.otherwise=n}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);const l=[];for(let d=1;d<t.length-1;d+=2){const f=r.parse(t[d],d,Be);if(!f)return null;const _=r.parse(t[d+1],d+1,n);if(!_)return null;l.push([f,_]),n=n||_.type}const u=r.parse(t[t.length-1],t.length-1,n);if(!u)return null;if(!n)throw new Error("Can't infer output type");return new zn(n,l,u)}evaluate(t){for(const[r,n]of this.branches)if(r.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,n]of this.branches)t(r),t(n);t(this.otherwise)}outputDefined(){return this.branches.every((([t,r])=>r.outputDefined()))&&this.otherwise.outputDefined()}}class en{constructor(t,r,n,l){this.type=t,this.input=r,this.beginIndex=n,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,Ne),l=r.parse(t[2],2,_e);if(!n||!l)return null;if(!H(n.type,[A(Ne),$e,Ne]))return r.error(`Expected first argument to be of type array or string, but found ${P(n.type)} instead`);if(t.length===4){const u=r.parse(t[3],3,_e);return u?new en(n.type,n,l,u):null}return new en(n.type,n,l)}evaluate(t){const r=this.input.evaluate(t),n=this.beginIndex.evaluate(t);let l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),W(r,["string"]))return[...r].slice(n,l).join("");if(W(r,["array"]))return r.slice(n,l);throw new St(`Expected first argument to be of type array or string, but found ${P(At(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function En(i,t){const r=i.length-1;let n,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),n=i[f],l=i[f+1],n<=t){if(f===r||t<l)return f;u=f+1}else{if(!(n>t))throw new St("Input is not a number.");d=f-1}return 0}class ms{constructor(t,r,n){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of n)this.labels.push(l),this.outputs.push(u)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(t[1],1,_e);if(!n)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<t.length;d+=2){const f=d===1?-1/0:t[d],_=t[d+1],x=d,v=d+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const w=r.parse(_,v,u);if(!w)return null;u=u||w.type,l.push([f,w])}return new ms(u,n,l)}evaluate(t){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return n[0].evaluate(t);const u=r.length;return l>=r[u-1]?n[u-1].evaluate(t):n[En(r,l)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Bo(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var jl=Fo;function Fo(i,t,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=n}Fo.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=l/u}var d=0,f=1;for(r=i,n=0;n<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));n++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Ul=Bo(jl);function Gr(i,t,r){return i+r*(t-i)}function tn(i,t,r){return i.map(((n,l)=>Gr(n,t[l],r)))}const ii={number:Gr,color:function(i,t,r,n="rgb"){switch(n){case"rgb":{const[l,u,d,f]=tn(i.rgb,t.rgb,r);return new st(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[_,x,v,w]=t.hcl;let I,M;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?I=NaN:(I=_,d!==1&&d!==0||(M=x)):(I=l,v!==1&&v!==0||(M=u));else{let Q=_-l;_>l&&Q>180?Q-=360:_<l&&l-_>180&&(Q+=360),I=l+r*Q}const[k,z,F,j]=(function([Q,G,J,re]){return Q=isNaN(Q)?0:Q*De,xt([J,Math.cos(Q)*G,Math.sin(Q)*G,re])})([I,M??Gr(u,x,r),Gr(d,v,r),Gr(f,w,r)]);return new st(k,z,F,j,!1)}case"lab":{const[l,u,d,f]=xt(tn(i.lab,t.lab,r));return new st(l,u,d,f,!1)}}},array:tn,padding:function(i,t,r){return new pi(tn(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){const n=i.values,l=t.values;if(n.length!==l.length)throw new St(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);const u=[];for(let d=0;d<n.length;d+=2){if(n[d]!==l[d])throw new St(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${n[d]}, to[${d}]: ${l[d]}`);u.push(n[d]);const[f,_]=n[d+1],[x,v]=l[d+1];u.push([Gr(f,x,r),Gr(_,v,r)])}return new wi(u)}};class ri{constructor(t,r,n,l,u){this.type=t,this.operator=r,this.interpolation=n,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(t,r,n,l){let u=0;if(t.name==="exponential")u=Dn(r,t.base,n,l);else if(t.name==="linear")u=Dn(r,1,n,l);else if(t.name==="cubic-bezier"){const d=t.controlPoints;u=new Ul(d[0],d[1],d[2],d[3]).solve(Dn(r,1,n,l))}return u}static parse(t,r){let[n,l,u,...d]=t;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some((v=>typeof v!="number"||v<0||v>1)))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,_e),!u)return null;const f=[];let _=null;n==="interpolate-hcl"||n==="interpolate-lab"?_=ti:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x<d.length;x+=2){const v=d[x],w=d[x+1],I=x+3,M=x+4;if(typeof v!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',I);if(f.length&&f[f.length-1][0]>=v)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',I);const k=r.parse(w,M,_);if(!k)return null;_=_||k.type,f.push([v,k])}return Y(_,_e)||Y(_,ti)||Y(_,Mr)||Y(_,N)||Y(_,A(_e))?new ri(_,n,l,u,f):r.error(`Type ${P(_)} is not interpolatable.`)}evaluate(t){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return n[0].evaluate(t);const u=r.length;if(l>=r[u-1])return n[u-1].evaluate(t);const d=En(r,l),f=ri.interpolationFactor(this.interpolation,l,r[d],r[d+1]),_=n[d].evaluate(t),x=n[d+1].evaluate(t);switch(this.operator){case"interpolate":return ii[this.type.kind](_,x,f);case"interpolate-hcl":return ii.color(_,x,f,"hcl");case"interpolate-lab":return ii.color(_,x,f,"lab")}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Dn(i,t,r,n){const l=n-r,u=i-r;return l===0?0:t===1?u/l:(Math.pow(t,u)-1)/(Math.pow(t,l)-1)}class Ln{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let n=null;const l=r.expectedType;l&&l.kind!=="value"&&(n=l);const u=[];for(const f of t.slice(1)){const _=r.parse(f,1+u.length,n,void 0,{typeAnnotation:"omit"});if(!_)return null;n=n||_.type,u.push(_)}if(!n)throw new Error("No output type");const d=l&&u.some((f=>O(l,f.type)));return new Ln(d?Ne:n,u)}evaluate(t){let r,n=null,l=0;for(const u of this.args)if(l++,n=u.evaluate(t),n&&n instanceof fi&&!n.available&&(r||(r=n.name),n=null,l===this.args.length&&(n=r)),n!==null)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function Rn(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Oo(i,t,r,n){return n.compare(t,r)===0}function _s(i,t,r){const n=i!=="=="&&i!=="!=";return class Ou{constructor(u,d,f){this.type=Be,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let _=d.parse(u[1],1,Ne);if(!_)return null;if(!Rn(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${P(_.type)}'.`);let x=d.parse(u[2],2,Ne);if(!x)return null;if(!Rn(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${P(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${P(_.type)}' and '${P(x.type)}'.`);n&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Fi(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Fi(_.type,[x])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(v=d.parse(u[3],3,ir),!v)return null}return new Ou(_,x,v)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(n&&this.hasUntypedArgument){const _=At(d),x=At(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new St(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const _=At(d),x=At(f);if(_.kind!=="string"||x.kind!=="string")return t(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):t(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const $l=_s("==",(function(i,t,r){return t===r}),Oo),Vo=_s("!=",(function(i,t,r){return t!==r}),(function(i,t,r,n){return!Oo(0,t,r,n)})),No=_s("<",(function(i,t,r){return t<r}),(function(i,t,r,n){return n.compare(t,r)<0})),ql=_s(">",(function(i,t,r){return t>r}),(function(i,t,r,n){return n.compare(t,r)>0})),Zl=_s("<=",(function(i,t,r){return t<=r}),(function(i,t,r,n){return n.compare(t,r)<=0})),jo=_s(">=",(function(i,t,r){return t>=r}),(function(i,t,r,n){return n.compare(t,r)>=0}));class rn{constructor(t,r,n){this.type=ir,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const n=t[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");const l=r.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,Be);if(!l)return null;const u=r.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Be);if(!u)return null;let d=null;return n.locale&&(d=r.parse(n.locale,1,$e),!d)?null:new rn(l,u,d)}evaluate(t){return new Pa(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 Ea{constructor(t,r,n,l,u){this.type=$e,this.number=t,this.locale=r,this.currency=n,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const n=r.parse(t[1],1,_e);if(!n)return null;const l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,$e),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,$e),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,_e),!f))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,_e),!_)?null:new Ea(n,u,d,f,_)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Bn{constructor(t){this.type=mr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=t.length-1;++d){const f=t[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,_e),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,A($e)),!x))return null;let v=null;if(f["text-color"]&&(v=r.parse(f["text-color"],1,ti),!v))return null;const w=l[l.length-1];w.scale=_,w.font=x,w.textColor=v}else{const _=r.parse(t[d],1,Ne);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:_,scale:null,font:null,textColor:null})}}return new Bn(l)}evaluate(t){return new di(this.sections.map((r=>{const n=r.content.evaluate(t);return At(n)===rr?new Aa("",n,null,null,null):new Aa(Qs(n),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)})))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class Da{constructor(t){this.type=rr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const n=r.parse(t[1],1,$e);return n?new Da(n):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),n=fi.fromString(r);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(r)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}}class La{constructor(t){this.type=_e,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=r.parse(t[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${P(n.type)} instead.`):new La(n):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new St(`Expected value to be of type string or array, but found ${P(At(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const sr=8192;function Gl(i,t){const r=(180+i[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*sr),Math.round(n*l*sr)]}function Ra(i,t){const r=Math.pow(2,t.z);return[(l=(i[0]/sr+t.x)/r,360*l-180),(n=(i[1]/sr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,l}function Hr(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function kr(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function it(i,t,r){const n=i[0]-t[0],l=i[1]-t[1],u=i[0]-r[0],d=i[1]-r[1];return n*d-u*l==0&&n*u<=0&&l*d<=0}function Fn(i,t,r,n){return(l=[n[0]-r[0],n[1]-r[1]])[0]*(u=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*u[0]!=0&&!(!$o(i,t,r,n)||!$o(r,n,i,t));var l,u}function Hl(i,t,r){for(const n of r)for(let l=0;l<n.length-1;++l)if(Fn(i,t,n[l],n[l+1]))return!0;return!1}function gs(i,t,r=!1){let n=!1;for(const f of t)for(let _=0;_<f.length-1;_++){if(it(i,f[_],f[_+1]))return r;(u=f[_])[1]>(l=i)[1]!=(d=f[_+1])[1]>l[1]&&l[0]<(d[0]-u[0])*(l[1]-u[1])/(d[1]-u[1])+u[0]&&(n=!n)}var l,u,d;return n}function Xl(i,t){for(const r of t)if(gs(i,r))return!0;return!1}function Uo(i,t){for(const r of i)if(!gs(r,t))return!1;for(let r=0;r<i.length-1;++r)if(Hl(i[r],i[r+1],t))return!1;return!0}function Wl(i,t){for(const r of t)if(Uo(i,r))return!0;return!1}function $o(i,t,r,n){const l=n[0]-r[0],u=n[1]-r[1],d=(i[0]-r[0])*u-l*(i[1]-r[1]),f=(t[0]-r[0])*u-l*(t[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Ba(i,t,r){const n=[];for(let l=0;l<i.length;l++){const u=[];for(let d=0;d<i[l].length;d++){const f=Gl(i[l][d],r);Hr(t,f),u.push(f)}n.push(u)}return n}function qo(i,t,r){const n=[];for(let l=0;l<i.length;l++){const u=Ba(i[l],t,r);n.push(u)}return n}function Zo(i,t,r,n){if(i[0]<r[0]||i[0]>r[2]){const l=.5*n;let u=i[0]-r[0]>l?-n:r[0]-i[0]>l?n:0;u===0&&(u=i[0]-r[2]>l?-n:r[2]-i[0]>l?n:0),i[0]+=u}Hr(t,i)}function Go(i,t,r,n){const l=Math.pow(2,n.z)*sr,u=[n.x*sr,n.y*sr],d=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];Zo(x,t,r,l),d.push(x)}return d}function Ho(i,t,r,n){const l=Math.pow(2,n.z)*sr,u=[n.x*sr,n.y*sr],d=[];for(const _ of i){const x=[];for(const v of _){const w=[v.x+u[0],v.y+u[1]];Hr(t,w),x.push(w)}d.push(x)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of d)for(const x of _)Zo(x,t,r,l)}var f;return d}class Xr{constructor(t,r){this.type=Be,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(qr(t[1])){const n=t[1];if(n.type==="FeatureCollection"){const l=[];for(const u of n.features){const{type:d,coordinates:f}=u.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new Xr(n,{type:"MultiPolygon",coordinates:l})}else if(n.type==="Feature"){const l=n.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Xr(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Xr(n,n)}return r.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(r,n){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Ba(n.coordinates,u,d),_=Go(r.geometry(),l,u,d);if(!kr(l,u))return!1;for(const x of _)if(!gs(x,f))return!1}if(n.type==="MultiPolygon"){const f=qo(n.coordinates,u,d),_=Go(r.geometry(),l,u,d);if(!kr(l,u))return!1;for(const x of _)if(!Xl(x,f))return!1}return!0})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,n){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Ba(n.coordinates,u,d),_=Ho(r.geometry(),l,u,d);if(!kr(l,u))return!1;for(const x of _)if(!Uo(x,f))return!1}if(n.type==="MultiPolygon"){const f=qo(n.coordinates,u,d),_=Ho(r.geometry(),l,u,d);if(!kr(l,u))return!1;for(const x of _)if(!Wl(x,f))return!1}return!0})(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Xo=class{constructor(i=[],t=((r,n)=>r<n?-1:r>n?1:0)){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:t,compare:r}=this,n=t[i];for(;i>0;){const l=i-1>>1,u=t[l];if(r(n,u)>=0)break;t[i]=u,i=l}t[i]=n}_down(i){const{data:t,compare:r}=this,n=this.length>>1,l=t[i];for(;i<n;){let u=1+(i<<1);const d=u+1;if(d<this.length&&r(t[d],t[u])<0&&(u=d),r(t[u],l)>=0)break;t[i]=t[u],i=u}t[i]=l}};function Kl(i,t,r,n,l){Wo(i,t,r,n||i.length-1,l||Jl)}function Wo(i,t,r,n,l){for(;n>r;){if(n-r>600){var u=n-r+1,d=t-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);Wo(i,t,Math.max(r,Math.floor(t-d*_/u+x)),Math.min(n,Math.floor(t+(u-d)*_/u+x)),l)}var v=i[t],w=r,I=n;for(sn(i,r,t),l(i[n],v)>0&&sn(i,r,n);w<I;){for(sn(i,w,I),w++,I--;l(i[w],v)<0;)w++;for(;l(i[I],v)>0;)I--}l(i[r],v)===0?sn(i,r,I):sn(i,++I,n),I<=t&&(r=I+1),t<=I&&(n=I-1)}}function sn(i,t,r){var n=i[t];i[t]=i[r],i[r]=n}function Jl(i,t){return i<t?-1:i>t?1:0}function On(i,t){if(i.length<=1)return[i];const r=[];let n,l;for(const u of i){const d=Ql(u);d!==0&&(u.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(n&&r.push(n),n=[u]):n.push(u))}if(n&&r.push(n),t>1)for(let u=0;u<r.length;u++)r[u].length<=t||(Kl(r[u],t,1,r[u].length-1,Yl),r[u]=r[u].slice(0,t));return r}function Yl(i,t){return t.area-i.area}function Ql(i){let t=0;for(let r,n,l=0,u=i.length,d=u-1;l<u;d=l++)r=i[l],n=i[d],t+=(n.x-r.x)*(r.y+n.y);return t}const Ko=1/298.257223563,Jo=Ko*(2-Ko),Yo=Math.PI/180;class Fa{constructor(t){const r=6378.137*Yo*1e3,n=Math.cos(t*Yo),l=1/(1-Jo*(1-n*n)),u=Math.sqrt(l);this.kx=r*u*n,this.ky=r*u*l*(1-Jo)}distance(t,r){const n=this.wrap(t[0]-r[0])*this.kx,l=(t[1]-r[1])*this.ky;return Math.sqrt(n*n+l*l)}pointOnLine(t,r){let n,l,u,d,f=1/0;for(let _=0;_<t.length-1;_++){let x=t[_][0],v=t[_][1],w=this.wrap(t[_+1][0]-x)*this.kx,I=(t[_+1][1]-v)*this.ky,M=0;w===0&&I===0||(M=(this.wrap(r[0]-x)*this.kx*w+(r[1]-v)*this.ky*I)/(w*w+I*I),M>1?(x=t[_+1][0],v=t[_+1][1]):M>0&&(x+=w/this.kx*M,v+=I/this.ky*M)),w=this.wrap(r[0]-x)*this.kx,I=(r[1]-v)*this.ky;const k=w*w+I*I;k<f&&(f=k,n=x,l=v,u=_,d=M)}return{point:[n,l],index:u,t:Math.max(0,Math.min(1,d))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Qo(i,t){return t[0]-i[0]}function Vn(i){return i[1]-i[0]+1}function _r(i,t){return i[1]>=i[0]&&i[1]<t}function Oa(i,t){if(i[0]>i[1])return[null,null];const r=Vn(i);if(t){if(r===2)return[i,null];const l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];const n=Math.floor(r/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function Va(i,t){if(!_r(t,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)Hr(r,i[n]);return r}function Na(i){const t=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const n of r)Hr(t,n);return t}function Nn(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function ja(i,t,r){if(!Nn(i)||!Nn(t))return NaN;let n=0,l=0;return i[2]<t[0]&&(n=t[0]-i[2]),i[0]>t[2]&&(n=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]<t[1]&&(l=t[1]-i[3]),r.distance([0,0],[n,l])}function Wr(i,t,r){const n=r.pointOnLine(t,i);return r.distance(i,n.point)}function Ua(i,t,r,n,l){const u=Math.min(Wr(i,[r,n],l),Wr(t,[r,n],l)),d=Math.min(Wr(r,[i,t],l),Wr(n,[i,t],l));return Math.min(u,d)}function ec(i,t,r,n,l){if(!_r(t,i.length)||!_r(n,r.length))return 1/0;let u=1/0;for(let d=t[0];d<t[1];++d){const f=i[d],_=i[d+1];for(let x=n[0];x<n[1];++x){const v=r[x],w=r[x+1];if(Fn(f,_,v,w))return 0;u=Math.min(u,Ua(f,_,v,w,l))}}return u}function bt(i,t,r,n,l){if(!_r(t,i.length)||!_r(n,r.length))return NaN;let u=1/0;for(let d=t[0];d<=t[1];++d)for(let f=n[0];f<=n[1];++f)if(u=Math.min(u,l.distance(i[d],r[f])),u===0)return u;return u}function tc(i,t,r){if(gs(i,t,!0))return 0;let n=1/0;for(const l of t){const u=l[0],d=l[l.length-1];if(u!==d&&(n=Math.min(n,Wr(i,[d,u],r)),n===0))return n;const f=r.pointOnLine(l,i);if(n=Math.min(n,r.distance(i,f.point)),n===0)return n}return n}function Ze(i,t,r,n){if(!_r(t,i.length))return NaN;for(let u=t[0];u<=t[1];++u)if(gs(i[u],r,!0))return 0;let l=1/0;for(let u=t[0];u<t[1];++u){const d=i[u],f=i[u+1];for(const _ of r)for(let x=0,v=_.length,w=v-1;x<v;w=x++){const I=_[w],M=_[x];if(Fn(d,f,I,M))return 0;l=Math.min(l,Ua(d,f,I,M,n))}}return l}function jn(i,t){for(const r of i)for(const n of r)if(gs(n,t,!0))return!0;return!1}function ht(i,t,r,n=1/0){const l=Na(i),u=Na(t);if(n!==1/0&&ja(l,u,r)>=n)return n;if(kr(l,u)){if(jn(i,t))return 0}else if(jn(t,i))return 0;let d=1/0;for(const f of i)for(let _=0,x=f.length,v=x-1;_<x;v=_++){const w=f[v],I=f[_];for(const M of t)for(let k=0,z=M.length,F=z-1;k<z;F=k++){const j=M[F],Q=M[k];if(Fn(w,I,j,Q))return 0;d=Math.min(d,Ua(w,I,j,Q,r))}}return d}function at(i,t,r,n,l,u){if(!u)return;const d=ja(Va(n,u),l,r);d<t&&i.push([d,u,[0,0]])}function Kr(i,t,r,n,l,u,d){if(!u||!d)return;const f=ja(Va(n,u),Va(l,d),r);f<t&&i.push([f,u,d])}function nn(i,t,r,n,l=1/0){let u=Math.min(n.distance(i[0],r[0][0]),l);if(u===0)return u;const d=new Xo([[0,[0,i.length-1],[0,0]]],Qo),f=Na(r);for(;d.length>0;){const _=d.pop();if(_[0]>=u)continue;const x=_[1],v=t?50:100;if(Vn(x)<=v){if(!_r(x,i.length))return NaN;if(t){const w=Ze(i,x,r,n);if(isNaN(w)||w===0)return w;u=Math.min(u,w)}else for(let w=x[0];w<=x[1];++w){const I=tc(i[w],r,n);if(u=Math.min(u,I),u===0)return 0}}else{const w=Oa(x,t);at(d,u,n,i,f,w[0]),at(d,u,n,i,f,w[1])}}return u}function an(i,t,r,n,l,u=1/0){let d=Math.min(u,l.distance(i[0],r[0]));if(d===0)return d;const f=new Xo([[0,[0,i.length-1],[0,r.length-1]]],Qo);for(;f.length>0;){const _=f.pop();if(_[0]>=d)continue;const x=_[1],v=_[2],w=t?50:100,I=n?50:100;if(Vn(x)<=w&&Vn(v)<=I){if(!_r(x,i.length)&&_r(v,r.length))return NaN;let M;if(t&&n)M=ec(i,x,r,v,l),d=Math.min(d,M);else if(t&&!n){const k=i.slice(x[0],x[1]+1);for(let z=v[0];z<=v[1];++z)if(M=Wr(r[z],k,l),d=Math.min(d,M),d===0)return d}else if(!t&&n){const k=r.slice(v[0],v[1]+1);for(let z=x[0];z<=x[1];++z)if(M=Wr(i[z],k,l),d=Math.min(d,M),d===0)return d}else M=bt(i,x,r,v,l),d=Math.min(d,M)}else{const M=Oa(x,t),k=Oa(v,n);Kr(f,d,l,i,r,M[0],k[0]),Kr(f,d,l,i,r,M[0],k[1]),Kr(f,d,l,i,r,M[1],k[0]),Kr(f,d,l,i,r,M[1],k[1])}}return d}function $a(i){return i.type==="MultiPolygon"?i.coordinates.map((t=>({type:"Polygon",coordinates:t}))):i.type==="MultiLineString"?i.coordinates.map((t=>({type:"LineString",coordinates:t}))):i.type==="MultiPoint"?i.coordinates.map((t=>({type:"Point",coordinates:t}))):[i]}class Jr{constructor(t,r){this.type=_e,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(qr(t[1])){const n=t[1];if(n.type==="FeatureCollection")return new Jr(n,n.features.map((l=>$a(l.geometry))).flat());if(n.type==="Feature")return new Jr(n,$a(n.geometry));if("type"in n&&"coordinates"in n)return new Jr(n,$a(n))}return r.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(r,n){const l=r.geometry(),u=l.flat().map((_=>Ra([_.x,_.y],r.canonical)));if(l.length===0)return NaN;const d=new Fa(u[0][1]);let f=1/0;for(const _ of n){switch(_.type){case"Point":f=Math.min(f,an(u,!1,[_.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,an(u,!1,_.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,nn(u,!1,_.coordinates,d,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,n){const l=r.geometry(),u=l.flat().map((_=>Ra([_.x,_.y],r.canonical)));if(l.length===0)return NaN;const d=new Fa(u[0][1]);let f=1/0;for(const _ of n){switch(_.type){case"Point":f=Math.min(f,an(u,!0,[_.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,an(u,!0,_.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,nn(u,!0,_.coordinates,d,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="Polygon")return(function(r,n){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const u=On(l,0).map((_=>_.map((x=>x.map((v=>Ra([v.x,v.y],r.canonical))))))),d=new Fa(u[0][0][0][1]);let f=1/0;for(const _ of n)for(const x of u){switch(_.type){case"Point":f=Math.min(f,nn([_.coordinates],!1,x,d,f));break;case"LineString":f=Math.min(f,nn(_.coordinates,!0,x,d,f));break;case"Polygon":f=Math.min(f,ht(x,_.coordinates,d,f))}if(f===0)return f}return f})(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const ys={"==":$l,"!=":Vo,">":ql,"<":No,">=":jo,"<=":Zl,array:Fi,at:Ca,boolean:Fi,case:zn,coalesce:Ln,collator:rn,format:Bn,image:Da,in:ka,"index-of":fs,interpolate:ri,"interpolate-hcl":ri,"interpolate-lab":ri,length:La,let:Cr,literal:Bi,match:za,number:Fi,"number-format":Ea,object:Fi,slice:en,step:ms,string:Fi,"to-boolean":Oi,"to-color":Oi,"to-number":Oi,"to-string":Oi,var:tt,within:Xr,distance:Jr};class Ti{constructor(t,r,n,l){this.name=t,this.type=r,this._evaluate=n,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const n=t[0],l=Ti.definitions[n];if(!l)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter((([x])=>!Array.isArray(x)||x.length===t.length-1));let _=null;for(const[x,v]of f){_=new Zr(r.registry,on,r.path,null,r.scope);const w=[];let I=!1;for(let M=1;M<t.length;M++){const k=t[M],z=Array.isArray(x)?x[M-1]:x.type,F=_.parse(k,1+w.length,z);if(!F){I=!0;break}w.push(F)}if(!I)if(Array.isArray(x)&&x.length!==w.length)_.error(`Expected ${x.length} arguments, but found ${w.length} instead.`);else{for(let M=0;M<w.length;M++){const k=Array.isArray(x)?x[M]:x.type,z=w[M];_.concat(M+1).checkSubtype(k,z.type)}if(_.errors.length===0)return new Ti(n,u,v,w)}}if(f.length===1)r.errors.push(..._.errors);else{const x=(f.length?f:d).map((([w])=>{return I=w,Array.isArray(I)?`(${I.map(P).join(", ")})`:`(${P(I.type)}...)`;var I})).join(" | "),v=[];for(let w=1;w<t.length;w++){const I=r.parse(t[w],1+v.length);if(!I)return null;v.push(P(I.type))}r.error(`Expected arguments of type ${x}, but found (${v.join(", ")}) instead.`)}return null}static register(t,r){Ti.definitions=r;for(const n in r)t[n]=Ti}}function qa(i,[t,r,n,l]){t=t.evaluate(i),r=r.evaluate(i),n=n.evaluate(i);const u=l?l.evaluate(i):1,d=ps(t,r,n,u);if(d)throw new St(d);return new st(t/255,r/255,n/255,u,!1)}function Za(i,t){return i in t}function Ga(i,t){const r=t[i];return r===void 0?null:r}function Yr(i){return{type:i}}function on(i){if(i instanceof tt)return on(i.boundExpression);if(i instanceof Ti&&i.name==="error"||i instanceof rn||i instanceof Xr||i instanceof Jr)return!1;const t=i instanceof Oi||i instanceof Fi;let r=!0;return i.eachChild((n=>{r=t?r&&on(n):r&&n instanceof Bi})),!!r&&ln(i)&&cn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ln(i){if(i instanceof Ti&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Xr||i instanceof Jr)return!1;let t=!0;return i.eachChild((r=>{t&&!ln(r)&&(t=!1)})),t}function xs(i){if(i instanceof Ti&&i.name==="feature-state")return!1;let t=!0;return i.eachChild((r=>{t&&!xs(r)&&(t=!1)})),t}function cn(i,t){if(i instanceof Ti&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild((n=>{r&&!cn(n,t)&&(r=!1)})),r}function Un(i){return{result:"success",value:i}}function vs(i){return{result:"error",value:i}}function bs(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function el(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ha(i){return!!i.expression&&i.expression.interpolated}function Ye(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function $n(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ic(i){return i}function tl(i,t){const r=t.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",l=n||!(n||i.property!==void 0),u=i.type||(Ha(t)?"exponential":"interval");if(r||t.type==="padding"){const v=r?st.parse:pi.parse;(i=er({},i)).stops&&(i.stops=i.stops.map((w=>[w[0],v(w[1])]))),i.default=v(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,x;if(u==="exponential")f=rl;else if(u==="interval")f=qn;else if(u==="categorical"){f=il,_=Object.create(null);for(const v of i.stops)_[v[0]]=v[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=sl}if(n){const v={},w=[];for(let k=0;k<i.stops.length;k++){const z=i.stops[k],F=z[0].zoom;v[F]===void 0&&(v[F]={zoom:F,type:i.type,property:i.property,default:i.default,stops:[]},w.push(F)),v[F].stops.push([z[0].value,z[1]])}const I=[];for(const k of w)I.push([v[k].zoom,tl(v[k],t)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:ri.interpolationFactor.bind(void 0,M),zoomStops:I.map((k=>k[0])),evaluate:({zoom:k},z)=>rl({stops:I,base:i.base},t,k).evaluate(k,z)}}if(l){const v=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:ri.interpolationFactor.bind(void 0,v),zoomStops:i.stops.map((w=>w[0])),evaluate:({zoom:w})=>f(i,t,w,_,x)}}return{kind:"source",evaluate(v,w){const I=w&&w.properties?w.properties[i.property]:void 0;return I===void 0?ws(i.default,t.default):f(i,t,I,_,x)}}}function ws(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function il(i,t,r,n,l){return ws(typeof r===l?n[r]:void 0,i.default,t.default)}function qn(i,t,r){if(Ye(r)!=="number")return ws(i.default,t.default);const n=i.stops.length;if(n===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[n-1][0])return i.stops[n-1][1];const l=En(i.stops.map((u=>u[0])),r);return i.stops[l][1]}function rl(i,t,r){const n=i.base!==void 0?i.base:1;if(Ye(r)!=="number")return ws(i.default,t.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=En(i.stops.map((v=>v[0])),r),d=(function(v,w,I,M){const k=M-I,z=v-I;return k===0?0:w===1?z/k:(Math.pow(w,z)-1)/(Math.pow(w,k)-1)})(r,n,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=ii[t.type]||ic;return typeof f.evaluate=="function"?{evaluate(...v){const w=f.evaluate.apply(void 0,v),I=_.evaluate.apply(void 0,v);if(w!==void 0&&I!==void 0)return x(w,I,d,i.colorSpace)}}:x(f,_,d,i.colorSpace)}function sl(i,t,r){switch(t.type){case"color":r=st.parse(r);break;case"formatted":r=di.fromString(r.toString());break;case"resolvedImage":r=fi.fromString(r.toString());break;case"padding":r=pi.parse(r);break;default:Ye(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return ws(r,i.default,t.default)}Ti.register(ys,{error:[{kind:"error"},[$e],(i,[t])=>{throw new St(t.evaluate(i))}],typeof:[$e,[Ne],(i,[t])=>P(At(t.evaluate(i)))],"to-rgba":[A(_e,4),[ti],(i,[t])=>{const[r,n,l,u]=t.evaluate(i).rgb;return[255*r,255*n,255*l,u]}],rgb:[ti,[_e,_e,_e],qa],rgba:[ti,[_e,_e,_e,_e],qa],has:{type:Be,overloads:[[[$e],(i,[t])=>Za(t.evaluate(i),i.properties())],[[$e,Ri],(i,[t,r])=>Za(t.evaluate(i),r.evaluate(i))]]},get:{type:Ne,overloads:[[[$e],(i,[t])=>Ga(t.evaluate(i),i.properties())],[[$e,Ri],(i,[t,r])=>Ga(t.evaluate(i),r.evaluate(i))]]},"feature-state":[Ne,[$e],(i,[t])=>Ga(t.evaluate(i),i.featureState||{})],properties:[Ri,[],i=>i.properties()],"geometry-type":[$e,[],i=>i.geometryType()],id:[Ne,[],i=>i.id()],zoom:[_e,[],i=>i.globals.zoom],"heatmap-density":[_e,[],i=>i.globals.heatmapDensity||0],"line-progress":[_e,[],i=>i.globals.lineProgress||0],accumulated:[Ne,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[_e,Yr(_e),(i,t)=>{let r=0;for(const n of t)r+=n.evaluate(i);return r}],"*":[_e,Yr(_e),(i,t)=>{let r=1;for(const n of t)r*=n.evaluate(i);return r}],"-":{type:_e,overloads:[[[_e,_e],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[_e],(i,[t])=>-t.evaluate(i)]]},"/":[_e,[_e,_e],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[_e,[_e,_e],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[_e,[],()=>Math.LN2],pi:[_e,[],()=>Math.PI],e:[_e,[],()=>Math.E],"^":[_e,[_e,_e],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[_e,[_e],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[_e,[_e],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[_e,[_e],(i,[t])=>Math.log(t.evaluate(i))],log2:[_e,[_e],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[_e,[_e],(i,[t])=>Math.sin(t.evaluate(i))],cos:[_e,[_e],(i,[t])=>Math.cos(t.evaluate(i))],tan:[_e,[_e],(i,[t])=>Math.tan(t.evaluate(i))],asin:[_e,[_e],(i,[t])=>Math.asin(t.evaluate(i))],acos:[_e,[_e],(i,[t])=>Math.acos(t.evaluate(i))],atan:[_e,[_e],(i,[t])=>Math.atan(t.evaluate(i))],min:[_e,Yr(_e),(i,t)=>Math.min(...t.map((r=>r.evaluate(i))))],max:[_e,Yr(_e),(i,t)=>Math.max(...t.map((r=>r.evaluate(i))))],abs:[_e,[_e],(i,[t])=>Math.abs(t.evaluate(i))],round:[_e,[_e],(i,[t])=>{const r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[_e,[_e],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[_e,[_e],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[Be,[$e,Ne],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[Be,[Ne],(i,[t])=>i.id()===t.value],"filter-type-==":[Be,[$e],(i,[t])=>i.geometryType()===t.value],"filter-<":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n<l}],"filter-id-<":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n>l}],"filter-id->":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n<=l}],"filter-id-<=":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n>=l}],"filter-id->=":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[Be,[Ne],(i,[t])=>t.value in i.properties()],"filter-has-id":[Be,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Be,[A($e)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[Be,[A(Ne)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[Be,[$e,A(Ne)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[Be,[$e,A(Ne)],(i,[t,r])=>(function(n,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===n)return!0;l[f]>n?d=f-1:u=f+1}return!1})(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Be,overloads:[[[Be,Be],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Yr(Be),(i,t)=>{for(const r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Be,overloads:[[[Be,Be],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Yr(Be),(i,t)=>{for(const r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[Be,[Be],(i,[t])=>!t.evaluate(i)],"is-supported-script":[Be,[$e],(i,[t])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[$e,[$e],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[$e,[$e],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[$e,Yr(Ne),(i,t)=>t.map((r=>Qs(r.evaluate(i)))).join("")],"resolved-locale":[$e,[ir],(i,[t])=>t.evaluate(i).resolvedLocale()]});class Zn{constructor(t,r){var n;this.expression=t,this._warningHistory={},this._evaluator=new kn,this._defaultValue=r?(n=r).type==="color"&&$n(n.default)?new st(0,0,0,0):n.type==="color"?st.parse(n.default)||null:n.type==="padding"?pi.parse(n.default)||null:n.type==="variableAnchorOffsetCollection"?wi.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,n,l,u,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,n,l,u,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new St(`Expected value to be one of ${Object.keys(this._enumValues).map((_=>JSON.stringify(_))).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Gn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ys}function Ts(i,t){const r=new Zr(ys,on,[],t?(function(l){const u={color:ti,string:$e,number:_e,enum:$e,boolean:Be,formatted:mr,padding:Mr,resolvedImage:rr,variableAnchorOffsetCollection:N};return l.type==="array"?A(u[l.value]||Ne,l.length):u[l.type]})(t):void 0),n=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Un(new Zn(n,t)):vs(r.errors)}class Ss{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!xs(r.expression)}evaluateWithoutErrorHandling(t,r,n,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,l,u,d)}evaluate(t,r,n,l,u,d){return this._styleExpression.evaluate(t,r,n,l,u,d)}}class Is{constructor(t,r,n,l){this.kind=t,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!xs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,n,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,l,u,d)}evaluate(t,r,n,l,u,d){return this._styleExpression.evaluate(t,r,n,l,u,d)}interpolationFactor(t,r,n){return this.interpolationType?ri.interpolationFactor(this.interpolationType,t,r,n):0}}function Xa(i,t){const r=Ts(i,t);if(r.result==="error")return r;const n=r.value.expression,l=ln(n);if(!l&&!bs(t))return vs([new Xt("","data expressions not supported")]);const u=cn(n,["zoom"]);if(!u&&!el(t))return vs([new Xt("","zoom expressions not supported")]);const d=hn(n);return d||u?d instanceof Xt?vs([d]):d instanceof ri&&!Ha(t)?vs([new Xt("",'"interpolate" expressions cannot be used with this property')]):Un(d?new Is(l?"camera":"composite",r.value,d.labels,d instanceof ri?d.interpolation:void 0):new Ss(l?"constant":"source",r.value)):vs([new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ps{constructor(t,r){this._parameters=t,this._specification=r,er(this,tl(this._parameters,this._specification))}static deserialize(t){return new Ps(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function hn(i){let t=null;if(i instanceof Cr)t=hn(i.result);else if(i instanceof Ln){for(const r of i.args)if(t=hn(r),t)break}else(i instanceof ms||i instanceof ri)&&i.input instanceof Ti&&i.input.name==="zoom"&&(t=i);return t instanceof Xt||i.eachChild((r=>{const n=hn(r);n instanceof Xt?t=n:!t&&n?t=new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&n&&t!==n&&(t=new Xt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function Hn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const t of i.slice(1))if(!Hn(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Xn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Wa(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Hn(i)||(i=Wn(i));const t=Ts(i,Xn);if(t.result==="error")throw new Error(t.value.map((r=>`${r.key}: ${r.message}`)).join(", "));return{filter:(r,n,l)=>t.value.evaluate(r,n,{},l),needGeometry:nl(i)}}function rc(i,t){return i<t?-1:i>t?1:0}function nl(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t<i.length;t++)if(nl(i[t]))return!0;return!1}function Wn(i){if(!i)return!0;const t=i[0];return i.length<=1?t!=="any":t==="=="?Ka(i[1],i[2],"=="):t==="!="?Ot(Ka(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Ka(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(Wn))):t==="all"?["all"].concat(i.slice(1).map(Wn)):t==="none"?["all"].concat(i.slice(1).map(Wn).map(Ot)):t==="in"?un(i[1],i.slice(2)):t==="!in"?Ot(un(i[1],i.slice(2))):t==="has"?dn(i[1]):t!=="!has"||Ot(dn(i[1]));var r}function Ka(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function un(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((r=>typeof r!=typeof t[0]))?["filter-in-large",i,["literal",t.sort(rc)]]:["filter-in-small",i,["literal",t]]}}function dn(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ot(i){return["!",i]}function Qr(i){const t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${Qr(u)},`;return`${l}]`}const r=Object.keys(i).sort();let n="{";for(let l=0;l<r.length;l++)n+=`${JSON.stringify(r[l])}:${Qr(i[r[l]])},`;return`${n}}`}function al(i){let t="";for(const r of $r)t+=`/${Qr(i[r])}`;return t}function ol(i){const t=i.value;return t?[new ue(i.key,t,"constants have been deprecated as of v8")]:[]}function wt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Vi(i){if(Array.isArray(i))return i.map(Vi);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const t={};for(const r in i)t[r]=Vi(i[r]);return t}return wt(i)}function mi(i){const t=i.key,r=i.value,n=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let _=[];const x=Ye(r);if(x!=="object")return[new ue(t,r,`object expected, ${x} found`)];for(const v in r){const w=v.split(".")[0],I=n[w]||n["*"];let M;if(l[w])M=l[w];else if(n[w])M=f;else if(l["*"])M=l["*"];else{if(!n["*"]){_.push(new ue(t,r[v],`unknown property "${v}"`));continue}M=f}_=_.concat(M({key:(t&&`${t}.`)+v,value:r[v],valueSpec:I,style:u,styleSpec:d,object:r,objectKey:v,validateSpec:f},r))}for(const v in n)l[v]||n[v].required&&n[v].default===void 0&&r[v]===void 0&&_.push(new ue(t,r,`missing required property "${v}"`));return _}function pn(i){const t=i.value,r=i.valueSpec,n=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(Ye(t)!=="array")return[new ue(u,t,`array expected, ${Ye(t)} found`)];if(r.length&&t.length!==r.length)return[new ue(u,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new ue(u,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),Ye(r.value)==="object"&&(f=r.value);let _=[];for(let x=0;x<t.length;x++)_=_.concat(d({array:t,arrayIndex:x,value:t[x],valueSpec:f,validateSpec:i.validateSpec,style:n,styleSpec:l,key:`${u}[${x}]`}));return _}function Ja(i){const t=i.key,r=i.value,n=i.valueSpec;let l=Ye(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new ue(t,r,`number expected, ${l} found`)]:"minimum"in n&&r<n.minimum?[new ue(t,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new ue(t,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Kn(i){const t=i.valueSpec,r=wt(i.value.type);let n,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=Ye(i.value.stops)==="array"&&Ye(i.value.stops[0])==="array"&&Ye(i.value.stops[0][0])==="object",v=mi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new ue(M.key,M.value,'identity function may not have a "stops" property')];let k=[];const z=M.value;return k=k.concat(pn({key:M.key,value:z,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:w})),Ye(z)==="array"&&z.length===0&&k.push(new ue(M.key,z,"array must have at least one stop")),k},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&v.push(new ue(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||v.push(new ue(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ha(i.valueSpec)&&v.push(new ue(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!bs(i.valueSpec)?v.push(new ue(i.key,i.value,"property functions not supported")):f&&!el(i.valueSpec)&&v.push(new ue(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||v.push(new ue(i.key,i.value,'"property" property is required')),v;function w(M){let k=[];const z=M.value,F=M.key;if(Ye(z)!=="array")return[new ue(F,z,`array expected, ${Ye(z)} found`)];if(z.length!==2)return[new ue(F,z,`array length 2 expected, length ${z.length} found`)];if(x){if(Ye(z[0])!=="object")return[new ue(F,z,`object expected, ${Ye(z[0])} found`)];if(z[0].zoom===void 0)return[new ue(F,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new ue(F,z,"object stop key must have value")];if(u&&u>wt(z[0].zoom))return[new ue(F,z[0].zoom,"stop zoom values must appear in ascending order")];wt(z[0].zoom)!==u&&(u=wt(z[0].zoom),l=void 0,d={}),k=k.concat(mi({key:`${F}[0]`,value:z[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Ja,value:I}}))}else k=k.concat(I({key:`${F}[0]`,value:z[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},z));return Gn(Vi(z[1]))?k.concat([new ue(`${F}[1]`,z[1],"expressions are not allowed in function stops.")]):k.concat(M.validateSpec({key:`${F}[1]`,value:z[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function I(M,k){const z=Ye(M.value),F=wt(M.value),j=M.value!==null?M.value:k;if(n){if(z!==n)return[new ue(M.key,j,`${z} stop domain type must match previous stop domain type ${n}`)]}else n=z;if(z!=="number"&&z!=="string"&&z!=="boolean")return[new ue(M.key,j,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&r!=="categorical"){let Q=`number expected, ${z} found`;return bs(t)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ue(M.key,j,Q)]}return r!=="categorical"||z!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&z==="number"&&l!==void 0&&F<l?[new ue(M.key,j,"stop domain values must appear in ascending order")]:(l=F,r==="categorical"&&F in d?[new ue(M.key,j,"stop domain values must be unique")]:(d[F]=!0,[])):[new ue(M.key,j,`integer expected, found ${F}`)]}}function As(i){const t=(i.expressionContext==="property"?Xa:Ts)(Vi(i.value),i.valueSpec);if(t.result==="error")return t.value.map((n=>new ue(`${i.key}${n.key}`,i.value,n.message)));const r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new ue(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!xs(r))return[new ue(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!xs(r))return[new ue(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!cn(r,["zoom","feature-state"]))return[new ue(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ln(r))return[new ue(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gr(i){const t=i.key,r=i.value,n=i.valueSpec,l=[];return Array.isArray(n.values)?n.values.indexOf(wt(r))===-1&&l.push(new ue(t,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(wt(r))===-1&&l.push(new ue(t,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Ya(i){return Hn(Vi(i.value))?As(er({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Jn(i)}function Jn(i){const t=i.value,r=i.key;if(Ye(t)!=="array")return[new ue(r,t,`array expected, ${Ye(t)} found`)];const n=i.styleSpec;let l,u=[];if(t.length<1)return[new ue(r,t,"filter array must have at least 1 element")];switch(u=u.concat(gr({key:`${r}[0]`,value:t[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),wt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&wt(t[1])==="$type"&&u.push(new ue(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&u.push(new ue(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Ye(t[1]),l!=="string"&&u.push(new ue(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d<t.length;d++)l=Ye(t[d]),wt(t[1])==="$type"?u=u.concat(gr({key:`${r}[${d}]`,value:t[d],valueSpec:n.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&u.push(new ue(`${r}[${d}]`,t[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<t.length;d++)u=u.concat(Jn({key:`${r}[${d}]`,value:t[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=Ye(t[1]),t.length!==2?u.push(new ue(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&u.push(new ue(`${r}[1]`,t[1],`string expected, ${l} found`))}return u}function Qa(i,t){const r=i.key,n=i.validateSpec,l=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,_=u[`${t}_${i.layerType}`];if(!_)return[];const x=f.match(/^(.*)-transition$/);if(t==="paint"&&x&&_[x[1]]&&_[x[1]].transition)return n({key:r,value:d,valueSpec:u.transition,style:l,styleSpec:u});const v=i.valueSpec||_[f];if(!v)return[new ue(r,d,`unknown property "${f}"`)];let w;if(Ye(d)==="string"&&bs(v)&&!v.tokens&&(w=/^{([^}]+)}$/.exec(d)))return[new ue(r,d,`"${f}" does not support interpolation syntax
5
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const I=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&I.push(new ue(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&$n(Vi(d))&&wt(d.type)==="identity"&&I.push(new ue(r,d,'"text-font" does not support identity functions'))),I.concat(n({key:i.key,value:d,valueSpec:v,style:l,styleSpec:u,expressionContext:"property",propertyType:t,propertyKey:f}))}function Yn(i){return Qa(i,"paint")}function eo(i){return Qa(i,"layout")}function to(i){let t=[];const r=i.value,n=i.key,l=i.style,u=i.styleSpec;r.type||r.ref||t.push(new ue(n,r,'either "type" or "ref" is required'));let d=wt(r.type);const f=wt(r.ref);if(r.id){const _=wt(r.id);for(let x=0;x<i.arrayIndex;x++){const v=l.layers[x];wt(v.id)===_&&t.push(new ue(n,r.id,`duplicate layer id "${r.id}", previously used at line ${v.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach((x=>{x in r&&t.push(new ue(n,r[x],`"${x}" is prohibited for ref layers`))})),l.layers.forEach((x=>{wt(x.id)===f&&(_=x)})),_?_.ref?t.push(new ue(n,r.ref,"ref cannot reference another ref layer")):d=wt(_.type):t.push(new ue(n,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&wt(_.type);_?x==="vector"&&d==="raster"?t.push(new ue(n,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?t.push(new ue(n,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?t.push(new ue(n,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?t.push(new ue(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||t.push(new ue(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ue(n,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new ue(n,r.source,`source "${r.source}" not found`))}else t.push(new ue(n,r,'missing required property "source"'));return t=t.concat(mi({key:n,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${n}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Ya,layout:_=>mi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>eo(er({layerType:d},x))}}),paint:_=>mi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Yn(er({layerType:d},x))}})}})),t}function es(i){const t=i.value,r=i.key,n=Ye(t);return n!=="string"?[new ue(r,t,`string expected, ${n} found`)]:[]}const Qn={promoteId:function({key:i,value:t}){if(Ye(t)==="string")return es({key:i,value:t});{const r=[];for(const n in t)r.push(...es({key:`${i}.${n}`,value:t[n]}));return r}}};function fn(i){const t=i.value,r=i.key,n=i.styleSpec,l=i.style,u=i.validateSpec;if(!t.type)return[new ue(r,t,'"type" is required')];const d=wt(t.type);let f;switch(d){case"vector":case"raster":return f=mi({key:r,value:t,valueSpec:n[`source_${d.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:Qn,validateSpec:u}),f;case"raster-dem":return f=(function(_){var x;const v=(x=_.sourceName)!==null&&x!==void 0?x:"",w=_.value,I=_.styleSpec,M=I.source_raster_dem,k=_.style;let z=[];const F=Ye(w);if(w===void 0)return z;if(F!=="object")return z.push(new ue("source_raster_dem",w,`object expected, ${F} found`)),z;const j=wt(w.encoding)==="custom",Q=["redFactor","greenFactor","blueFactor","baseShift"],G=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const J in w)!j&&Q.includes(J)?z.push(new ue(J,w[J],`In "${v}": "${J}" is only valid when "encoding" is set to "custom". ${G} encoding found`)):M[J]?z=z.concat(_.validateSpec({key:J,value:w[J],valueSpec:M[J],validateSpec:_.validateSpec,style:k,styleSpec:I})):z.push(new ue(J,w[J],`unknown property "${J}"`));return z})({sourceName:r,value:t,style:i.style,styleSpec:n,validateSpec:u}),f;case"geojson":if(f=mi({key:r,value:t,valueSpec:n.source_geojson,style:l,styleSpec:n,validateSpec:u,objectElementValidators:Qn}),t.cluster)for(const _ in t.clusterProperties){const[x,v]=t.clusterProperties[_],w=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...As({key:`${r}.${_}.map`,value:v,validateSpec:u,expressionContext:"cluster-map"})),f.push(...As({key:`${r}.${_}.reduce`,value:w,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return mi({key:r,value:t,valueSpec:n.source_video,style:l,validateSpec:u,styleSpec:n});case"image":return mi({key:r,value:t,valueSpec:n.source_image,style:l,validateSpec:u,styleSpec:n});case"canvas":return[new ue(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return gr({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:n})}}function io(i){const t=i.value,r=i.styleSpec,n=r.light,l=i.style;let u=[];const d=Ye(t);if(t===void 0)return u;if(d!=="object")return u=u.concat([new ue("light",t,`object expected, ${d} found`)]),u;for(const f in t){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&n[_[1]]&&n[_[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)])}return u}function ro(i){const t=i.value,r=i.styleSpec,n=r.sky,l=i.style,u=Ye(t);if(t===void 0)return[];if(u!=="object")return[new ue("sky",t,`object expected, ${u} found`)];let d=[];for(const f in t)d=d.concat(n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)]);return d}function so(i){const t=i.value,r=i.styleSpec,n=r.terrain,l=i.style;let u=[];const d=Ye(t);if(t===void 0)return u;if(d!=="object")return u=u.concat([new ue("terrain",t,`object expected, ${d} found`)]),u;for(const f in t)u=u.concat(n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)]);return u}function no(i){let t=[];const r=i.value,n=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&t.push(new ue(n,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&t.push(new ue(n,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),t=t.concat(mi({key:`${n}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return es({key:n,value:r})}const ea={"*":()=>[],array:pn,boolean:function(i){const t=i.value,r=i.key,n=Ye(t);return n!=="boolean"?[new ue(r,t,`boolean expected, ${n} found`)]:[]},number:Ja,color:function(i){const t=i.key,r=i.value,n=Ye(r);return n!=="string"?[new ue(t,r,`color expected, ${n} found`)]:st.parse(String(r))?[]:[new ue(t,r,`color expected, "${r}" found`)]},constants:ol,enum:gr,filter:Ya,function:Kn,layer:to,object:mi,source:fn,light:io,sky:ro,terrain:so,projection:function(i){const t=i.value,r=i.styleSpec,n=r.projection,l=i.style,u=Ye(t);if(t===void 0)return[];if(u!=="object")return[new ue("projection",t,`object expected, ${u} found`)];let d=[];for(const f in t)d=d.concat(n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)]);return d},string:es,formatted:function(i){return es(i).length===0?[]:As(i)},resolvedImage:function(i){return es(i).length===0?[]:As(i)},padding:function(i){const t=i.key,r=i.value;if(Ye(r)==="array"){if(r.length<1||r.length>4)return[new ue(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let l=[];for(let u=0;u<r.length;u++)l=l.concat(i.validateSpec({key:`${t}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:n}));return l}return Ja({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const t=i.key,r=i.value,n=Ye(r),l=i.styleSpec;if(n!=="array"||r.length<1||r.length%2!=0)return[new ue(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let d=0;d<r.length;d+=2)u=u.concat(gr({key:`${t}[${d}]`,value:r[d],valueSpec:l.layout_symbol["text-anchor"]})),u=u.concat(pn({key:`${t}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return u},sprite:no};function Ms(i){const t=i.value,r=i.valueSpec,n=i.styleSpec;return i.validateSpec=Ms,r.expression&&$n(wt(t))?Kn(i):r.expression&&Gn(Vi(t))?As(i):r.type&&ea[r.type]?ea[r.type](i):mi(er({},i,{valueSpec:r.type?n[r.type]:r}))}function ll(i){const t=i.value,r=i.key,n=es(i);return n.length||(t.indexOf("{fontstack}")===-1&&n.push(new ue(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&n.push(new ue(r,t,'"glyphs" url must include a "{range}" token'))),n}function Si(i,t=ie){let r=[];return r=r.concat(Ms({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,validateSpec:Ms,objectElementValidators:{glyphs:ll,"*":()=>[]}})),i.constants&&(r=r.concat(ol({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:Ms}))),ao(r)}function nr(i){return function(t){return i({...t,validateSpec:Ms})}}function ao(i){return[].concat(i).sort(((t,r)=>t.line-r.line))}function Ni(i){return function(...t){return ao(i.apply(this,t))}}Si.source=Ni(nr(fn)),Si.sprite=Ni(nr(no)),Si.glyphs=Ni(nr(ll)),Si.light=Ni(nr(io)),Si.sky=Ni(nr(ro)),Si.terrain=Ni(nr(so)),Si.layer=Ni(nr(to)),Si.filter=Ni(nr(Ya)),Si.paintProperty=Ni(nr(Yn)),Si.layoutProperty=Ni(nr(eo));const ts=Si,sc=ts.light,nc=ts.sky,cl=ts.paintProperty,hl=ts.layoutProperty;function oo(i,t){let r=!1;if(t&&t.length)for(const n of t)i.fire(new Ir(new Error(n.message))),r=!0;return r}class Cs{constructor(t,r,n){const l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(n=d[2]);for(let _=0;_<this.d*this.d;_++){const x=d[3+_],v=d[3+_+1];l.push(x===v?null:d.subarray(x,v))}const f=d[3+l.length+1];this.keys=d.subarray(d[3+l.length],f),this.bboxes=d.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=n,this.scale=r/t,this.uid=0;const u=n/r*t;this.min=-u,this.max=t+u}insert(t,r,n,l,u){this._forEachCell(r,n,l,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(l),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,n,l,u,d){this.cells[u].push(d)}query(t,r,n,l,u){const d=this.min,f=this.max;if(t<=d&&r<=d&&f<=n&&f<=l&&!u)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(t,r,n,l,this._queryCell,_,{},u),_}}_queryCell(t,r,n,l,u,d,f,_){const x=this.cells[u];if(x!==null){const v=this.keys,w=this.bboxes;for(let I=0;I<x.length;I++){const M=x[I];if(f[M]===void 0){const k=4*M;(_?_(w[k+0],w[k+1],w[k+2],w[k+3]):t<=w[k+2]&&r<=w[k+3]&&n>=w[k+0]&&l>=w[k+1])?(f[M]=!0,d.push(v[M])):f[M]=!1}}}}_forEachCell(t,r,n,l,u,d,f,_){const x=this._convertToCellCoord(t),v=this._convertToCellCoord(r),w=this._convertToCellCoord(n),I=this._convertToCellCoord(l);for(let M=x;M<=w;M++)for(let k=v;k<=I;k++){const z=this.d*k+M;if((!_||_(this._convertFromCellCoord(M),this._convertFromCellCoord(k),this._convertFromCellCoord(M+1),this._convertFromCellCoord(k+1)))&&u.call(this,t,r,n,l,z,d,f,_))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;const t=this.cells,r=3+this.cells.length+1+1;let n=0;for(let d=0;d<this.cells.length;d++)n+=this.cells[d].length;const l=new Int32Array(r+n+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let u=r;for(let d=0;d<t.length;d++){const f=t[d];l[3+d]=u,l.set(f,u),u+=f.length}return l[3+t.length]=u,l.set(this.keys,u),u+=this.keys.length,l[3+t.length+1]=u,l.set(this.bboxes,u),u+=this.bboxes.length,l.buffer}static serialize(t,r){const n=t.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(t){return new Cs(t.buffer)}}const Ii={};function Ie(i,t,r={}){if(Ii[i])throw new Error(`${i} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),Ii[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Ie("Object",Object),Ie("TransferableGridIndex",Cs),Ie("Color",st),Ie("Error",Error),Ie("AJAXError",ui),Ie("ResolvedImage",fi),Ie("StylePropertyFunction",Ps),Ie("StyleExpression",Zn,{omit:["_evaluator"]}),Ie("ZoomDependentExpression",Is),Ie("ZoomConstantExpression",Ss),Ie("CompoundExpression",Ti,{omit:["_evaluate"]});for(const i in ys)ys[i]._classRegistryKey||Ie(`Expression_${i}`,ys[i]);function ta(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function lo(i){return i.$name||i.constructor._classRegistryKey}function ul(i){return!(function(t){if(t===null||typeof t!="object")return!1;const r=lo(t);return!(!r||r==="Object")})(i)&&(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||ta(i)||Yi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function ks(i,t){if(ul(i))return(ta(i)||Yi(i))&&t&&t.push(i),ArrayBuffer.isView(i)&&t&&t.push(i.buffer),i instanceof ImageData&&t&&t.push(i.data.buffer),i;if(Array.isArray(i)){const u=[];for(const d of i)u.push(ks(d,t));return u}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=lo(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!Ii[r])throw new Error(`${r} is not registered.`);const{klass:n}=Ii[r],l=n.serialize?n.serialize(i,t):{};if(n.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||Ii[r].omit.indexOf(u)>=0)continue;const d=i[u];l[u]=Ii[r].shallow.indexOf(u)>=0?d:ks(d,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function zs(i){if(ul(i))return i;if(Array.isArray(i))return i.map(zs);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const t=lo(i)||"Object";if(!Ii[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=Ii[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);const n=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];n[l]=Ii[t].shallow.indexOf(l)>=0?u:zs(u)}return n}class co{constructor(){this.first=!0}update(t,r){const n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=n,!0))}}const Xe={"Latin-1 Supplement":i=>i>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function ho(i){for(const t of i)if(po(t.charCodeAt(0)))return!0;return!1}function ac(i){for(const t of i)if(!Es(t.charCodeAt(0)))return!1;return!0}function uo(i){const t=i.map((r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}})).filter((r=>r));return new RegExp(t.join("|"),"u")}const oc=uo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Es(i){return!oc.test(String.fromCodePoint(i))}const dl=uo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function po(i){return!(i!==746&&i!==747&&(i<4352||!(Xe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Xe["CJK Compatibility"](i)||Xe["CJK Strokes"](i)||!(!Xe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Xe["Enclosed CJK Letters and Months"](i)||Xe["Ideographic Description Characters"](i)||Xe.Kanbun(i)||Xe.Katakana(i)&&i!==12540||!(!Xe["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Xe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Xe["Vertical Forms"](i)||Xe["Yijing Hexagram Symbols"](i)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(i))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(i))||dl.test(String.fromCodePoint(i)))))}function pl(i){return!(po(i)||(function(t){return!!(Xe["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Xe["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Xe["Letterlike Symbols"](t)||Xe["Number Forms"](t)||Xe["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Xe["Control Pictures"](t)&&t!==9251||Xe["Optical Character Recognition"](t)||Xe["Enclosed Alphanumerics"](t)||Xe["Geometric Shapes"](t)||Xe["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Xe["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Xe["CJK Symbols and Punctuation"](t)||Xe.Katakana(t)||Xe["Private Use Area"](t)||Xe["CJK Compatibility Forms"](t)||Xe["Small Form Variants"](t)||Xe["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)})(i))}const lc=uo(["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 fo(i){return lc.test(String.fromCodePoint(i))}function cc(i,t){return!(!t&&fo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Xe.Khmer(i))}function hc(i){for(const t of i)if(fo(t.charCodeAt(0)))return!0;return!1}const _i=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class dt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new co,this.transition={})}isSupportedScript(t){return(function(r,n){for(const l of r)if(!cc(l.charCodeAt(0),n))return!1;return!0})(t,_i.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class Ds{constructor(t,r){this.property=t,this.value=r,this.expression=(function(n,l){if($n(n))return new Ps(n,l);if(Gn(n)){const u=Xa(n,l);if(u.result==="error")throw new Error(u.value.map((d=>`${d.key}: ${d.message}`)).join(", "));return u.value}{let u=n;return l.type==="color"&&typeof n=="string"?u=st.parse(n):l.type!=="padding"||typeof n!="number"&&!Array.isArray(n)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(n)&&(u=wi.parse(n)):u=pi.parse(n),{kind:"constant",evaluate:()=>u}}})(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,n){return this.property.possiblyEvaluate(this,t,r,n)}}class ia{constructor(t){this.property=t,this.value=new Ds(t,void 0)}transitioned(t,r){return new fl(this.property,this.value,r,vi({},t.transition,this.transition),t.now)}untransitioned(){return new fl(this.property,this.value,null,{},0)}}class ra{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return nt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ia(this._values[t].property)),this._values[t].value=new Ds(this._values[t].property,r===null?void 0:nt(r))}getTransition(t){return nt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ia(this._values[t].property)),this._values[t].transition=nt(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(t[r]=n);const l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){const n=new mn(this._properties);for(const l of Object.keys(this._values))n._values[l]=this._values[l].transitioned(t,r._values[l]);return n}untransitioned(){const t=new mn(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class fl{constructor(t,r,n,l,u){this.property=t,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=n)}possiblyEvaluate(t,r,n){const l=t.now||0,u=this.value.possiblyEvaluate(t,r,n),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l<this.begin)return d.possiblyEvaluate(t,r,n);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(t,r,n),u,(function(_){if(_<=0)return 0;if(_>=1)return 1;const x=_*_,v=x*_;return 4*(_<.5?v:3*(_-x)+v-.75)})(f))}}return u}}class mn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,n){const l=new gn(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(t,r,n);return l}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class _n{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return nt(this._values[t].value)}setValue(t,r){this._values[t]=new Ds(this._values[t].property,r===null?void 0:nt(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(t[r]=n)}return t}possiblyEvaluate(t,r,n){const l=new gn(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(t,r,n);return l}}class ar{constructor(t,r,n){this.property=t,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,n,l){return this.property.evaluate(this.value,this.parameters,t,r,n,l)}}class gn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ae{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,n){const l=ii[this.specification.type];return l?l(t,r,n):t}}class Re{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,n,l){return new ar(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},n,l)}:t.expression,r)}interpolate(t,r,n){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new ar(this,{kind:"constant",value:void 0},t.parameters);const l=ii[this.specification.type];if(l){const u=l(t.value.value,r.value.value,n);return new ar(this,{kind:"constant",value:u},t.parameters)}return t}evaluate(t,r,n,l,u,d){return t.kind==="constant"?t.value:t.evaluate(r,n,l,u,d)}}class sa extends Re{possiblyEvaluate(t,r,n,l){if(t.value===void 0)return new ar(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const u=t.expression.evaluate(r,null,{},n,l),d=t.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new ar(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){const u=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new ar(this,{kind:"constant",value:u},r)}return new ar(this,t.expression,r)}evaluate(t,r,n,l,u,d){if(t.kind==="source"){const f=t.evaluate(r,n,l,u,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},n,l),t.evaluate({zoom:Math.floor(r.zoom)},n,l),t.evaluate({zoom:Math.floor(r.zoom)+1},n,l),r):t.value}_calculate(t,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}}class na{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,l){if(t.value!==void 0){if(t.expression.kind==="constant"){const u=t.expression.evaluate(r,null,{},n,l);return this._calculate(u,u,u,r)}return this._calculate(t.expression.evaluate(new dt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new dt(Math.floor(r.zoom),r)),t.expression.evaluate(new dt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}}class mo{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,l){return!!t.expression.evaluate(r,null,{},n,l)}interpolate(){return!1}}class h{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const n=t[r];n.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Ds(n,void 0),u=this.defaultTransitionablePropertyValues[r]=new ia(n);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ie("DataDrivenProperty",Re),Ie("DataConstantProperty",Ae),Ie("CrossFadedDataDrivenProperty",sa),Ie("CrossFadedProperty",na),Ie("ColorRampProperty",mo);const e="-transition";class s extends hs{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new _n(r.layout)),r.paint)){this._transitionablePaint=new ra(r.paint);for(const n in t.paint)this.setPaintProperty(n,t.paint[n],{validate:!1});for(const n in t.layout)this.setLayoutProperty(n,t.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new gn(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,n={}){r!=null&&this._validate(hl,`layers.${this.id}.layout.${t}`,t,r,n)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,n={}){if(r!=null&&this._validate(cl,`layers.${this.id}.paint.${t}`,t,r,n))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[t],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const _=this._transitionablePaint._values[t].value;return _.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(t,f,_)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,n){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Hs(t,((r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length)))}_validate(t,r,n,l,u={}){return(!u||u.validate!==!1)&&oo(this,t.call(ts,{key:r,layerType:this.type,objectKey:n,value:l,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof ar&&bs(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const a={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class c{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(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);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,n=0;return{members:i.map((l=>{const u=a[l.type].BYTES_PER_ELEMENT,d=r=g(r,Math.max(t,u)),f=l.components||1;return n=Math.max(n,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}})),size:g(r,Math.max(n,t)),alignment:t}}function g(i,t){return Math.ceil(i/t)*t}class y extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,r)}emplace(t,r,n){const l=2*t;return this.int16[l+0]=r,this.int16[l+1]=n,t}}y.prototype.bytesPerElement=4,Ie("StructArrayLayout2i4",y);class b extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const u=3*t;return this.int16[u+0]=r,this.int16[u+1]=n,this.int16[u+2]=l,t}}b.prototype.bytesPerElement=6,Ie("StructArrayLayout3i6",b);class T extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,r,n,l)}emplace(t,r,n,l,u){const d=4*t;return this.int16[d+0]=r,this.int16[d+1]=n,this.int16[d+2]=l,this.int16[d+3]=u,t}}T.prototype.bytesPerElement=8,Ie("StructArrayLayout4i8",T);class S extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,u,d)}emplace(t,r,n,l,u,d,f){const _=6*t;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,t}}S.prototype.bytesPerElement=12,Ie("StructArrayLayout2i4i12",S);class C extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,u,d)}emplace(t,r,n,l,u,d,f){const _=4*t,x=8*t;return this.int16[_+0]=r,this.int16[_+1]=n,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,t}}C.prototype.bytesPerElement=8,Ie("StructArrayLayout2i4ub8",C);class E extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,r)}emplace(t,r,n){const l=2*t;return this.float32[l+0]=r,this.float32[l+1]=n,t}}E.prototype.bytesPerElement=8,Ie("StructArrayLayout2f8",E);class R extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u,d,f,_,x,v){const w=this.length;return this.resize(w+1),this.emplace(w,t,r,n,l,u,d,f,_,x,v)}emplace(t,r,n,l,u,d,f,_,x,v,w){const I=10*t;return this.uint16[I+0]=r,this.uint16[I+1]=n,this.uint16[I+2]=l,this.uint16[I+3]=u,this.uint16[I+4]=d,this.uint16[I+5]=f,this.uint16[I+6]=_,this.uint16[I+7]=x,this.uint16[I+8]=v,this.uint16[I+9]=w,t}}R.prototype.bytesPerElement=20,Ie("StructArrayLayout10ui20",R);class V extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u,d,f,_,x,v,w,I){const M=this.length;return this.resize(M+1),this.emplace(M,t,r,n,l,u,d,f,_,x,v,w,I)}emplace(t,r,n,l,u,d,f,_,x,v,w,I,M){const k=12*t;return this.int16[k+0]=r,this.int16[k+1]=n,this.int16[k+2]=l,this.int16[k+3]=u,this.uint16[k+4]=d,this.uint16[k+5]=f,this.uint16[k+6]=_,this.uint16[k+7]=x,this.int16[k+8]=v,this.int16[k+9]=w,this.int16[k+10]=I,this.int16[k+11]=M,t}}V.prototype.bytesPerElement=24,Ie("StructArrayLayout4i4ui4i24",V);class U extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const u=3*t;return this.float32[u+0]=r,this.float32[u+1]=n,this.float32[u+2]=l,t}}U.prototype.bytesPerElement=12,Ie("StructArrayLayout3f12",U);class $ extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}$.prototype.bytesPerElement=4,Ie("StructArrayLayout1ul4",$);class Z extends c{_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,r,n,l,u,d,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,r,n,l,u,d,f,_,x)}emplace(t,r,n,l,u,d,f,_,x,v){const w=10*t,I=5*t;return this.int16[w+0]=r,this.int16[w+1]=n,this.int16[w+2]=l,this.int16[w+3]=u,this.int16[w+4]=d,this.int16[w+5]=f,this.uint32[I+3]=_,this.uint16[w+8]=x,this.uint16[w+9]=v,t}}Z.prototype.bytesPerElement=20,Ie("StructArrayLayout6i1ul2ui20",Z);class B extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,u,d)}emplace(t,r,n,l,u,d,f){const _=6*t;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,t}}B.prototype.bytesPerElement=12,Ie("StructArrayLayout2i2i2i12",B);class X extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,n,l,u)}emplace(t,r,n,l,u,d){const f=4*t,_=8*t;return this.float32[f+0]=r,this.float32[f+1]=n,this.float32[f+2]=l,this.int16[_+6]=u,this.int16[_+7]=d,t}}X.prototype.bytesPerElement=16,Ie("StructArrayLayout2f1f2i16",X);class K extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,u,d)}emplace(t,r,n,l,u,d,f){const _=16*t,x=4*t,v=8*t;return this.uint8[_+0]=r,this.uint8[_+1]=n,this.float32[x+1]=l,this.float32[x+2]=u,this.int16[v+6]=d,this.int16[v+7]=f,t}}K.prototype.bytesPerElement=16,Ie("StructArrayLayout2ub2f2i16",K);class ee extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const u=3*t;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=l,t}}ee.prototype.bytesPerElement=6,Ie("StructArrayLayout3ui6",ee);class oe extends c{_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,r,n,l,u,d,f,_,x,v,w,I,M,k,z,F,j){const Q=this.length;return this.resize(Q+1),this.emplace(Q,t,r,n,l,u,d,f,_,x,v,w,I,M,k,z,F,j)}emplace(t,r,n,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q){const G=24*t,J=12*t,re=48*t;return this.int16[G+0]=r,this.int16[G+1]=n,this.uint16[G+2]=l,this.uint16[G+3]=u,this.uint32[J+2]=d,this.uint32[J+3]=f,this.uint32[J+4]=_,this.uint16[G+10]=x,this.uint16[G+11]=v,this.uint16[G+12]=w,this.float32[J+7]=I,this.float32[J+8]=M,this.uint8[re+36]=k,this.uint8[re+37]=z,this.uint8[re+38]=F,this.uint32[J+10]=j,this.int16[G+22]=Q,t}}oe.prototype.bytesPerElement=48,Ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",oe);class he extends c{_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,r,n,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q,G,J,re,ce,we,Le,ve,ye,ke,Pe){const Se=this.length;return this.resize(Se+1),this.emplace(Se,t,r,n,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q,G,J,re,ce,we,Le,ve,ye,ke,Pe)}emplace(t,r,n,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q,G,J,re,ce,we,Le,ve,ye,ke,Pe,Se){const ae=32*t,ze=16*t;return this.int16[ae+0]=r,this.int16[ae+1]=n,this.int16[ae+2]=l,this.int16[ae+3]=u,this.int16[ae+4]=d,this.int16[ae+5]=f,this.int16[ae+6]=_,this.int16[ae+7]=x,this.uint16[ae+8]=v,this.uint16[ae+9]=w,this.uint16[ae+10]=I,this.uint16[ae+11]=M,this.uint16[ae+12]=k,this.uint16[ae+13]=z,this.uint16[ae+14]=F,this.uint16[ae+15]=j,this.uint16[ae+16]=Q,this.uint16[ae+17]=G,this.uint16[ae+18]=J,this.uint16[ae+19]=re,this.uint16[ae+20]=ce,this.uint16[ae+21]=we,this.uint16[ae+22]=Le,this.uint32[ze+12]=ve,this.float32[ze+13]=ye,this.float32[ze+14]=ke,this.uint16[ae+30]=Pe,this.uint16[ae+31]=Se,t}}he.prototype.bytesPerElement=64,Ie("StructArrayLayout8i15ui1ul2f2ui64",he);class xe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}xe.prototype.bytesPerElement=4,Ie("StructArrayLayout1f4",xe);class Te extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const u=3*t;return this.uint16[6*t+0]=r,this.float32[u+1]=n,this.float32[u+2]=l,t}}Te.prototype.bytesPerElement=12,Ie("StructArrayLayout1ui2f12",Te);class fe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const u=4*t;return this.uint32[2*t+0]=r,this.uint16[u+2]=n,this.uint16[u+3]=l,t}}fe.prototype.bytesPerElement=8,Ie("StructArrayLayout1ul2ui8",fe);class pe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,r)}emplace(t,r,n){const l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=n,t}}pe.prototype.bytesPerElement=4,Ie("StructArrayLayout2ui4",pe);class Me extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Me.prototype.bytesPerElement=2,Ie("StructArrayLayout1ui2",Me);class Ve extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,r,n,l)}emplace(t,r,n,l,u){const d=4*t;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=l,this.float32[d+3]=u,t}}Ve.prototype.bytesPerElement=16,Ie("StructArrayLayout4f16",Ve);class ge extends o{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 me(this.anchorPointX,this.anchorPointY)}}ge.prototype.size=20;class be extends Z{get(t){return new ge(this,t)}}Ie("CollisionBoxArray",be);class Fe extends o{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]}}Fe.prototype.size=48;class pt extends oe{get(t){return new Fe(this,t)}}Ie("PlacedSymbolArray",pt);class Ue extends o{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]}}Ue.prototype.size=64;class He extends he{get(t){return new Ue(this,t)}}Ie("SymbolInstanceArray",He);class ft extends xe{getoffsetX(t){return this.float32[1*t+0]}}Ie("GlyphOffsetArray",ft);class Vt extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ie("SymbolLineVertexArray",Vt);class ji extends o{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]}}ji.prototype.size=12;class mt extends Te{get(t){return new ji(this,t)}}Ie("TextAnchorOffsetArray",mt);class si extends o{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]}}si.prototype.size=8;class Kt extends fe{get(t){return new si(this,t)}}Ie("FeatureIndexArray",Kt);class Nt extends y{}class Jt extends y{}class or extends y{}class Ls extends S{}class aa extends C{}class Rs extends E{}class Pi extends R{}class oa extends V{}class _o extends U{}class Ai extends ${}class Mi extends B{}class zr extends K{}class Ui extends ee{}class Rt extends pe{}const jt=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:gi}=jt;class We{constructor(t=[]){this.segments=t}prepareSegment(t,r,n,l){let u=this.segments[this.segments.length-1];return t>We.MAX_VERTEX_ARRAY_LENGTH&&Ft(`Max vertices per segment is ${We.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!u||u.vertexLength+t>We.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,n,l){return new We([{vertexOffset:t,primitiveOffset:r,vertexLength:n,primitiveLength:l,vaos:{},sortKey:0}])}}function is(i,t){return 256*(i=Ei(Math.floor(i),0,255))+Ei(Math.floor(t),0,255)}We.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ie("SegmentVector",We);const Bs=m([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Fs={exports:{}},ml={exports:{}};ml.exports=function(i,t){var r,n,l,u,d,f,_,x;for(n=i.length-(r=3&i.length),l=t,d=3432918353,f=461845907,x=0;x<n;)_=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(u=5*(65535&(l=(l^=_=(65535&(_=(_=(65535&_)*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var uc=ml.exports,_l={exports:{}};_l.exports=function(i,t){for(var r,n=i.length,l=t^n,u=0;n>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++u;switch(n){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Er=uc,gl=_l.exports;Fs.exports=Er,Fs.exports.murmur3=Er,Fs.exports.murmur2=gl;var la=zi(Fs.exports);class yn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,n,l){this.ids.push(ca(t)),this.positions.push(r,n,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=ca(t);let n=0,l=this.ids.length-1;for(;n<l;){const d=n+l>>1;this.ids[d]>=r?l=d:n=d+1}const u=[];for(;this.ids[n]===r;)u.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return u}static serialize(t,r){const n=new Float64Array(t.ids),l=new Uint32Array(t.positions);return ha(n,l,0,n.length-1),r&&r.push(n.buffer,l.buffer),{ids:n,positions:l}}static deserialize(t){const r=new yn;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function ca(i){const t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:la(String(i))}function ha(i,t,r,n){for(;r<n;){const l=i[r+n>>1];let u=r-1,d=n+1;for(;;){do u++;while(i[u]<l);do d--;while(i[d]>l);if(u>=d)break;Os(i,u,d),Os(t,3*u,3*d),Os(t,3*u+1,3*d+1),Os(t,3*u+2,3*d+2)}d-r<n-d?(ha(i,t,r,d),r=d+1):(ha(i,t,d+1,n),n=d)}}function Os(i,t,r){const n=i[t];i[t]=i[r],i[r]=n}Ie("FeaturePositionMap",yn);class xn{constructor(t,r){this.gl=t.gl,this.location=r}}class yl extends xn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class eh extends xn{constructor(t,r){super(t,r),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 th extends xn{constructor(t,r){super(t,r),this.current=st.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))}}const Nu=new Float32Array(16);function dc(i){return[is(255*i.r,255*i.g),is(255*i.b,255*i.a)]}class go{constructor(t,r,n){this.value=t,this.uniformNames=r.map((l=>`u_${l}`)),this.type=n}setUniform(t,r,n){t.set(n.constantOr(this.value))}getBinding(t,r,n){return this.type==="color"?new th(t,r):new yl(t,r)}}class ua{constructor(t,r){this.uniformNames=r.map((n=>`u_${n}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,n,l){const u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&t.set(u)}getBinding(t,r,n){return n.substr(0,9)==="u_pattern"?new eh(t,r):new yl(t,r)}}class rs{constructor(t,r,n,l){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map((u=>({name:`a_${u}`,type:"Float32",components:n==="color"?2:1,offset:0}))),this.paintVertexArray=new l}populatePaintArray(t,r,n,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new dt(0),r,{},l,[],u);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,n,l){const u=this.expression.evaluate({zoom:0},n,l);this._setPaintValue(t,r,u)}_setPaintValue(t,r,n){if(this.type==="color"){const l=dc(n);for(let u=t;u<r;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=t;l<r;l++)this.paintVertexArray.emplace(l,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class yr{constructor(t,r,n,l,u,d){this.expression=t,this.uniformNames=r.map((f=>`u_${f}_t`)),this.type=n,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map((f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0}))),this.paintVertexArray=new d}populatePaintArray(t,r,n,l,u){const d=this.expression.evaluate(new dt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new dt(this.zoom+1),r,{},l,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(_,t,d,f)}updatePaintArray(t,r,n,l){const u=this.expression.evaluate({zoom:this.zoom},n,l),d=this.expression.evaluate({zoom:this.zoom+1},n,l);this._setPaintValue(t,r,u,d)}_setPaintValue(t,r,n,l){if(this.type==="color"){const u=dc(n),d=dc(l);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=t;u<r;u++)this.paintVertexArray.emplace(u,n,l);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.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,r){const n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Ei(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,r,n){return new yl(t,r)}}class Vs{constructor(t,r,n,l,u,d){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(t,r,n){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(t,r,n,l,u){this._setPaintValues(t,r,n.patterns&&n.patterns[this.layerId],u)}_setPaintValues(t,r,n,l){if(!l||!n)return;const{min:u,mid:d,max:f}=n,_=l[u],x=l[d],v=l[f];if(_&&x&&v)for(let w=t;w<r;w++)this.zoomInPaintVertexArray.emplace(w,x.tl[0],x.tl[1],x.br[0],x.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],x.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(w,x.tl[0],x.tl[1],x.br[0],x.br[1],v.tl[0],v.tl[1],v.br[0],v.br[1],x.pixelRatio,v.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Bs.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Bs.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ih{constructor(t,r,n){this.binders={},this._buffers=[];const l=[];for(const u in t.paint._values){if(!n(u))continue;const d=t.paint.get(u);if(!(d instanceof ar&&bs(d.property.specification)))continue;const f=ju(u,t.type),_=d.value,x=d.property.specification.type,v=d.property.useIntegerZoom,w=d.property.specification["property-type"],I=w==="cross-faded"||w==="cross-faded-data-driven";if(_.kind==="constant")this.binders[u]=I?new ua(_.value,f):new go(_.value,f,x),l.push(`/u_${u}`);else if(_.kind==="source"||I){const M=rh(u,x,"source");this.binders[u]=I?new Vs(_,x,v,r,M,t.id):new rs(_,f,x,M),l.push(`/a_${u}`)}else{const M=rh(u,x,"composite");this.binders[u]=new yr(_,f,x,v,r,M),l.push(`/z_${u}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof rs||r instanceof yr?r.maxValue:0}populatePaintArrays(t,r,n,l,u){for(const d in this.binders){const f=this.binders[d];(f instanceof rs||f instanceof yr||f instanceof Vs)&&f.populatePaintArray(t,r,n,l,u)}}setConstantPatternPositions(t,r){for(const n in this.binders){const l=this.binders[n];l instanceof ua&&l.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,n,l,u){let d=!1;for(const f in t){const _=r.getPositions(f);for(const x of _){const v=n.feature(x.index);for(const w in this.binders){const I=this.binders[w];if((I instanceof rs||I instanceof yr||I instanceof Vs)&&I.expression.isStateDependent===!0){const M=l.paint.get(w);I.expression=M.value,I.updatePaintArray(x.start,x.end,v,t[f],u),d=!0}}}}return d}defines(){const t=[];for(const r in this.binders){const n=this.binders[r];(n instanceof go||n instanceof ua)&&t.push(...n.uniformNames.map((l=>`#define HAS_UNIFORM_${l}`)))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof rs||n instanceof yr)for(let l=0;l<n.paintVertexAttributes.length;l++)t.push(n.paintVertexAttributes[l].name);else if(n instanceof Vs)for(let l=0;l<Bs.members.length;l++)t.push(Bs.members[l].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof go||n instanceof ua||n instanceof yr)for(const l of n.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const n=[];for(const l in this.binders){const u=this.binders[l];if(u instanceof go||u instanceof ua||u instanceof yr){for(const d of u.uniformNames)if(r[d]){const f=u.getBinding(t,r[d],d);n.push({name:d,property:l,binding:f})}}}return n}setUniforms(t,r,n,l){for(const{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,l,n.get(d),u)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const n=this.binders[r];if(t&&n instanceof Vs){const l=t.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(n instanceof rs||n instanceof yr)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(t){for(const r in this.binders){const n=this.binders[r];(n instanceof rs||n instanceof yr||n instanceof Vs)&&n.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof rs||r instanceof yr||r instanceof Vs)&&r.destroy()}}}class vn{constructor(t,r,n=(()=>!0)){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new ih(l,r,n);this.needsUpload=!1,this._featureMap=new yn,this._bufferOffset=0}populatePaintArrays(t,r,n,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,n,l){for(const u of n)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(t,this._featureMap,r,u,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function ju(i,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function rh(i,t,r){const n={color:{source:E,composite:Ve},number:{source:xe,composite:E}},l=(function(u){return{"line-pattern":{source:Pi,composite:Pi},"fill-pattern":{source:Pi,composite:Pi},"fill-extrusion-pattern":{source:Pi,composite:Pi}}[u]})(i);return l&&l[r]||n[t][r]}Ie("ConstantBinder",go),Ie("CrossFadedConstantBinder",ua),Ie("SourceExpressionBinder",rs),Ie("CrossFadedCompositeBinder",Vs),Ie("CompositeExpressionBinder",yr),Ie("ProgramConfiguration",ih,{omit:["_buffers"]}),Ie("ProgramConfigurationSet",vn);const Mt=8192,pc=Math.pow(2,14)-1,sh=-pc-1;function bn(i){const t=Mt/i.extent,r=i.loadGeometry();for(let n=0;n<r.length;n++){const l=r[n];for(let u=0;u<l.length;u++){const d=l[u],f=Math.round(d.x*t),_=Math.round(d.y*t);d.x=Ei(f,sh,pc),d.y=Ei(_,sh,pc),(f<d.x||f>d.x+1||_<d.y||_>d.y+1)&&Ft("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function wn(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?bn(i):[]}}function xl(i,t,r,n,l){i.emplaceBack(2*t+(n+1)/2,2*r+(l+1)/2)}class fc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Jt,this.indexArray=new Ui,this.segments=new We,this.programConfigurations=new vn(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,n){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:_,id:x,index:v,sourceLayerIndex:w}of t){const I=this.layers[0]._featureFilter.needGeometry,M=wn(_,I);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),M,n))continue;const k=f?d.evaluate(M,{},n):void 0,z={id:x,properties:_.properties,type:_.type,sourceLayerIndex:w,index:v,geometry:I?M.geometry:bn(_),patterns:{},sortKey:k};u.push(z)}f&&u.sort(((_,x)=>_.sortKey-x.sortKey));for(const _ of u){const{geometry:x,index:v,sourceLayerIndex:w}=_,I=t[v].feature;this.addFeature(_,x,v,n),r.featureIndex.insert(I,x,v,w,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gi),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,r,n,l){for(const u of r)for(const d of u){const f=d.x,_=d.y;if(f<0||f>=Mt||_<0||_>=Mt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),v=x.vertexLength;xl(this.layoutVertexArray,f,_,-1,-1),xl(this.layoutVertexArray,f,_,1,-1),xl(this.layoutVertexArray,f,_,1,1),xl(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(v,v+1,v+2),this.indexArray.emplaceBack(v,v+3,v+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},l)}}function nh(i,t){for(let r=0;r<i.length;r++)if(da(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(da(i,t[r]))return!0;return!!mc(i,t)}function Uu(i,t,r){return!!da(i,t)||!!_c(t,i,r)}function ah(i,t){if(i.length===1)return lh(t,i[0]);for(let r=0;r<t.length;r++){const n=t[r];for(let l=0;l<n.length;l++)if(da(i,n[l]))return!0}for(let r=0;r<i.length;r++)if(lh(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(mc(i,t[r]))return!0;return!1}function $u(i,t,r){if(i.length>1){if(mc(i,t))return!0;for(let n=0;n<t.length;n++)if(_c(t[n],i,r))return!0}for(let n=0;n<i.length;n++)if(_c(i[n],t,r))return!0;return!1}function mc(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){const n=i[r],l=i[r+1];for(let u=0;u<t.length-1;u++)if(qu(n,l,t[u],t[u+1]))return!0}return!1}function qu(i,t,r,n){return Ht(i,r,n)!==Ht(t,r,n)&&Ht(i,t,r)!==Ht(i,t,n)}function _c(i,t,r){const n=r*r;if(t.length===1)return i.distSqr(t[0])<n;for(let l=1;l<t.length;l++)if(oh(i,t[l-1],t[l])<n)return!0;return!1}function oh(i,t,r){const n=t.distSqr(r);if(n===0)return i.distSqr(t);const l=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/n;return i.distSqr(l<0?t:l>1?r:r.sub(t)._mult(l)._add(t))}function lh(i,t){let r,n,l,u=!1;for(let d=0;d<i.length;d++){r=i[d];for(let f=0,_=r.length-1;f<r.length;_=f++)n=r[f],l=r[_],n.y>t.y!=l.y>t.y&&t.x<(l.x-n.x)*(t.y-n.y)/(l.y-n.y)+n.x&&(u=!u)}return u}function da(i,t){let r=!1;for(let n=0,l=i.length-1;n<i.length;l=n++){const u=i[n],d=i[l];u.y>t.y!=d.y>t.y&&t.x<(d.x-u.x)*(t.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function Zu(i,t,r){const n=r[0],l=r[2];if(i.x<n.x&&t.x<n.x||i.x>l.x&&t.x>l.x||i.y<n.y&&t.y<n.y||i.y>l.y&&t.y>l.y)return!1;const u=Ht(i,t,r[0]);return u!==Ht(i,t,r[1])||u!==Ht(i,t,r[2])||u!==Ht(i,t,r[3])}function yo(i,t,r){const n=t.paint.get(i).value;return n.kind==="constant"?n.value:r.programConfigurations.get(t.id).getMaxValue(i)}function vl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function bl(i,t,r,n,l){if(!t[0]&&!t[1])return i;const u=me.convert(t)._mult(l);r==="viewport"&&u._rotate(-n);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}let ch,hh;Ie("CircleBucket",fc,{omit:["layers"]});var Gu={get paint(){return hh=hh||new h({"circle-radius":new Re(ie.paint_circle["circle-radius"]),"circle-color":new Re(ie.paint_circle["circle-color"]),"circle-blur":new Re(ie.paint_circle["circle-blur"]),"circle-opacity":new Re(ie.paint_circle["circle-opacity"]),"circle-translate":new Ae(ie.paint_circle["circle-translate"]),"circle-translate-anchor":new Ae(ie.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ae(ie.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ae(ie.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Re(ie.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Re(ie.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Re(ie.paint_circle["circle-stroke-opacity"])})},get layout(){return ch=ch||new h({"circle-sort-key":new Re(ie.layout_circle["circle-sort-key"])})}},ni=1e-6,pa=typeof Float32Array<"u"?Float32Array:Array;function gc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function uh(i,t,r){var n=t[0],l=t[1],u=t[2],d=t[3],f=t[4],_=t[5],x=t[6],v=t[7],w=t[8],I=t[9],M=t[10],k=t[11],z=t[12],F=t[13],j=t[14],Q=t[15],G=r[0],J=r[1],re=r[2],ce=r[3];return i[0]=G*n+J*f+re*w+ce*z,i[1]=G*l+J*_+re*I+ce*F,i[2]=G*u+J*x+re*M+ce*j,i[3]=G*d+J*v+re*k+ce*Q,i[4]=(G=r[4])*n+(J=r[5])*f+(re=r[6])*w+(ce=r[7])*z,i[5]=G*l+J*_+re*I+ce*F,i[6]=G*u+J*x+re*M+ce*j,i[7]=G*d+J*v+re*k+ce*Q,i[8]=(G=r[8])*n+(J=r[9])*f+(re=r[10])*w+(ce=r[11])*z,i[9]=G*l+J*_+re*I+ce*F,i[10]=G*u+J*x+re*M+ce*j,i[11]=G*d+J*v+re*k+ce*Q,i[12]=(G=r[12])*n+(J=r[13])*f+(re=r[14])*w+(ce=r[15])*z,i[13]=G*l+J*_+re*I+ce*F,i[14]=G*u+J*x+re*M+ce*j,i[15]=G*d+J*v+re*k+ce*Q,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var xo,Hu=uh;function wl(i,t,r){var n=t[0],l=t[1],u=t[2],d=t[3];return i[0]=r[0]*n+r[4]*l+r[8]*u+r[12]*d,i[1]=r[1]*n+r[5]*l+r[9]*u+r[13]*d,i[2]=r[2]*n+r[6]*l+r[10]*u+r[14]*d,i[3]=r[3]*n+r[7]*l+r[11]*u+r[15]*d,i}xo=new pa(4),pa!=Float32Array&&(xo[0]=0,xo[1]=0,xo[2]=0,xo[3]=0);class Xu extends s{constructor(t){super(t,Gu)}createBucket(t){return new fc(t)}queryRadius(t){const r=t;return yo("circle-radius",this,r)+yo("circle-stroke-width",this,r)+vl(this.paint.get("circle-translate"))}queryIntersectsFeature(t,r,n,l,u,d,f,_){const x=bl(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,f),v=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n),w=this.paint.get("circle-pitch-alignment")==="map",I=w?x:(function(k,z){return k.map((F=>dh(F,z)))})(x,_),M=w?v*f:v;for(const k of l)for(const z of k){const F=w?z:dh(z,_);let j=M;const Q=wl([],[z.x,z.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?j*=Q[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(j*=d.cameraToCenterDistance/Q[3]),Uu(I,F,j))return!0}return!1}}function dh(i,t){const r=wl([],[i.x,i.y,0,1],t);return new me(r[0]/r[3],r[1]/r[3])}class ph extends fc{}let fh;Ie("HeatmapBucket",ph,{omit:["layers"]});var Wu={get paint(){return fh=fh||new h({"heatmap-radius":new Re(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Re(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ae(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new mo(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ae(ie.paint_heatmap["heatmap-opacity"])})}};function yc(i,{width:t,height:r},n,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*n)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*n}`)}else l=new Uint8Array(t*r*n);return i.width=t,i.height=r,i.data=l,i}function mh(i,{width:t,height:r},n){if(t===i.width&&r===i.height)return;const l=yc({},{width:t,height:r},n);xc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},n),i.width=t,i.height=r,i.data=l.data}function xc(i,t,r,n,l,u){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||n.x>t.width-l.width||n.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_<l.height;_++){const x=((r.y+_)*i.width+r.x)*u,v=((n.y+_)*t.width+n.x)*u;for(let w=0;w<l.width*u;w++)f[v+w]=d[x+w]}return t}class vo{constructor(t,r){yc(this,t,1,r)}resize(t){mh(this,t,1)}clone(){return new vo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,l,u){xc(t,r,n,l,u,1)}}class $i{constructor(t,r){yc(this,t,4,r)}resize(t){mh(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new $i({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,l,u){xc(t,r,n,l,u,4)}}function _h(i){const t={},r=i.resolution||256,n=i.clips?i.clips.length:1,l=i.image||new $i({width:r,height:n});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(d,f,_)=>{t[i.evaluationKey]=_;const x=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d<n;++d,f+=4*r)for(let _=0,x=0;_<r;_++,x+=4){const v=_/(r-1),{start:w,end:I}=i.clips[d];u(f,x,w*(1-v)+I*v)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return l}Ie("AlphaImage",vo),Ie("RGBAImage",$i);const vc="big-fb";class Ku extends s{createBucket(t){return new ph(t)}constructor(t){super(t,Wu),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=_h({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(vc)&&this.heatmapFbos.delete(vc)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let gh;var Ju={get paint(){return gh=gh||new h({"hillshade-illumination-direction":new Ae(ie.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ae(ie.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ae(ie.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ae(ie.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ae(ie.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ae(ie.paint_hillshade["hillshade-accent-color"])})}};class Yu extends s{constructor(t){super(t,Ju)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Qu=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:ed}=Qu;function yh(i,t,r=2){const n=t&&t.length,l=n?t[0]*r:i.length;let u=xh(i,0,l,r,!0);const d=[];if(!u||u.next===u.prev)return d;let f,_,x;if(n&&(u=(function(v,w,I,M){const k=[];for(let z=0,F=w.length;z<F;z++){const j=xh(v,w[z]*M,z<F-1?w[z+1]*M:v.length,M,!1);j===j.next&&(j.steiner=!0),k.push(ld(j))}k.sort(nd);for(let z=0;z<k.length;z++)I=ad(k[z],I);return I})(i,t,u,r)),i.length>80*r){f=1/0,_=1/0;let v=-1/0,w=-1/0;for(let I=r;I<l;I+=r){const M=i[I],k=i[I+1];M<f&&(f=M),k<_&&(_=k),M>v&&(v=M),k>w&&(w=k)}x=Math.max(v-f,w-_),x=x!==0?32767/x:0}return bo(u,d,r,f,_,x,0),d}function xh(i,t,r,n,l){let u;if(l===(function(d,f,_,x){let v=0;for(let w=f,I=_-x;w<_;w+=x)v+=(d[I]-d[w])*(d[w+1]+d[I+1]),I=w;return v})(i,t,r,n)>0)for(let d=t;d<r;d+=n)u=wh(d/n|0,i[d],i[d+1],u);else for(let d=r-n;d>=t;d-=n)u=wh(d/n|0,i[d],i[d+1],u);return u&&Tl(u,u.next)&&(To(u),u=u.next),u}function Tn(i,t){if(!i)return i;t||(t=i);let r,n=i;do if(r=!1,n.steiner||!Tl(n,n.next)&&It(n.prev,n,n.next)!==0)n=n.next;else{if(To(n),n=t=n.prev,n===n.next)break;r=!0}while(r||n!==t);return t}function bo(i,t,r,n,l,u,d){if(!i)return;!d&&u&&(function(_,x,v,w){let I=_;do I.z===0&&(I.z=bc(I.x,I.y,x,v,w)),I.prevZ=I.prev,I.nextZ=I.next,I=I.next;while(I!==_);I.prevZ.nextZ=null,I.prevZ=null,(function(M){let k,z=1;do{let F,j=M;M=null;let Q=null;for(k=0;j;){k++;let G=j,J=0;for(let ce=0;ce<z&&(J++,G=G.nextZ,G);ce++);let re=z;for(;J>0||re>0&&G;)J!==0&&(re===0||!G||j.z<=G.z)?(F=j,j=j.nextZ,J--):(F=G,G=G.nextZ,re--),Q?Q.nextZ=F:M=F,F.prevZ=Q,Q=F;j=G}Q.nextZ=null,z*=2}while(k>1)})(I)})(i,n,l,u);let f=i;for(;i.prev!==i.next;){const _=i.prev,x=i.next;if(u?id(i,n,l,u):td(i))t.push(_.i,i.i,x.i),To(i),i=x.next,f=x.next;else if((i=x)===f){d?d===1?bo(i=rd(Tn(i),t),t,r,n,l,u,2):d===2&&sd(i,t,r,n,l,u):bo(Tn(i),t,r,n,l,u,1);break}}}function td(i){const t=i.prev,r=i,n=i.next;if(It(t,r,n)>=0)return!1;const l=t.x,u=r.x,d=n.x,f=t.y,_=r.y,x=n.y,v=l<u?l<d?l:d:u<d?u:d,w=f<_?f<x?f:x:_<x?_:x,I=l>u?l>d?l:d:u>d?u:d,M=f>_?f>x?f:x:_>x?_:x;let k=n.next;for(;k!==t;){if(k.x>=v&&k.x<=I&&k.y>=w&&k.y<=M&&fa(l,f,u,_,d,x,k.x,k.y)&&It(k.prev,k,k.next)>=0)return!1;k=k.next}return!0}function id(i,t,r,n){const l=i.prev,u=i,d=i.next;if(It(l,u,d)>=0)return!1;const f=l.x,_=u.x,x=d.x,v=l.y,w=u.y,I=d.y,M=f<_?f<x?f:x:_<x?_:x,k=v<w?v<I?v:I:w<I?w:I,z=f>_?f>x?f:x:_>x?_:x,F=v>w?v>I?v:I:w>I?w:I,j=bc(M,k,t,r,n),Q=bc(z,F,t,r,n);let G=i.prevZ,J=i.nextZ;for(;G&&G.z>=j&&J&&J.z<=Q;){if(G.x>=M&&G.x<=z&&G.y>=k&&G.y<=F&&G!==l&&G!==d&&fa(f,v,_,w,x,I,G.x,G.y)&&It(G.prev,G,G.next)>=0||(G=G.prevZ,J.x>=M&&J.x<=z&&J.y>=k&&J.y<=F&&J!==l&&J!==d&&fa(f,v,_,w,x,I,J.x,J.y)&&It(J.prev,J,J.next)>=0))return!1;J=J.nextZ}for(;G&&G.z>=j;){if(G.x>=M&&G.x<=z&&G.y>=k&&G.y<=F&&G!==l&&G!==d&&fa(f,v,_,w,x,I,G.x,G.y)&&It(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;J&&J.z<=Q;){if(J.x>=M&&J.x<=z&&J.y>=k&&J.y<=F&&J!==l&&J!==d&&fa(f,v,_,w,x,I,J.x,J.y)&&It(J.prev,J,J.next)>=0)return!1;J=J.nextZ}return!0}function rd(i,t){let r=i;do{const n=r.prev,l=r.next.next;!Tl(n,l)&&vh(n,r,r.next,l)&&wo(n,l)&&wo(l,n)&&(t.push(n.i,r.i,l.i),To(r),To(r.next),r=i=l),r=r.next}while(r!==i);return Tn(r)}function sd(i,t,r,n,l,u){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&cd(d,f)){let _=bh(d,f);return d=Tn(d,d.next),_=Tn(_,_.next),bo(d,t,r,n,l,u,0),void bo(_,t,r,n,l,u,0)}f=f.next}d=d.next}while(d!==i)}function nd(i,t){return i.x-t.x}function ad(i,t){const r=(function(l,u){let d=u;const f=l.x,_=l.y;let x,v=-1/0;do{if(_<=d.y&&_>=d.next.y&&d.next.y!==d.y){const z=d.x+(_-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(z<=f&&z>v&&(v=z,x=d.x<d.next.x?d:d.next,z===f))return x}d=d.next}while(d!==u);if(!x)return null;const w=x,I=x.x,M=x.y;let k=1/0;d=x;do{if(f>=d.x&&d.x>=I&&f!==d.x&&fa(_<M?f:v,_,I,M,_<M?v:f,_,d.x,d.y)){const z=Math.abs(_-d.y)/(f-d.x);wo(d,l)&&(z<k||z===k&&(d.x>x.x||d.x===x.x&&od(x,d)))&&(x=d,k=z)}d=d.next}while(d!==w);return x})(i,t);if(!r)return t;const n=bh(r,i);return Tn(n,n.next),Tn(r,r.next)}function od(i,t){return It(i.prev,i,t.prev)<0&&It(t.next,i,i.next)<0}function bc(i,t,r,n,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ld(i){let t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function fa(i,t,r,n,l,u,d,f){return(l-d)*(t-f)>=(i-d)*(u-f)&&(i-d)*(n-f)>=(r-d)*(t-f)&&(r-d)*(u-f)>=(l-d)*(n-f)}function cd(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!(function(r,n){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==n.i&&l.next.i!==n.i&&vh(l,l.next,r,n))return!0;l=l.next}while(l!==r);return!1})(i,t)&&(wo(i,t)&&wo(t,i)&&(function(r,n){let l=r,u=!1;const d=(r.x+n.x)/2,f=(r.y+n.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u})(i,t)&&(It(i.prev,i,t.prev)||It(i,t.prev,t))||Tl(i,t)&&It(i.prev,i,i.next)>0&&It(t.prev,t,t.next)>0)}function It(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Tl(i,t){return i.x===t.x&&i.y===t.y}function vh(i,t,r,n){const l=Il(It(i,t,r)),u=Il(It(i,t,n)),d=Il(It(r,n,i)),f=Il(It(r,n,t));return l!==u&&d!==f||!(l!==0||!Sl(i,r,t))||!(u!==0||!Sl(i,n,t))||!(d!==0||!Sl(r,i,n))||!(f!==0||!Sl(r,t,n))}function Sl(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Il(i){return i>0?1:i<0?-1:0}function wo(i,t){return It(i.prev,i,i.next)<0?It(i,t,i.next)>=0&&It(i,i.prev,t)>=0:It(i,t,i.prev)<0||It(i,i.next,t)<0}function bh(i,t){const r=wc(i.i,i.x,i.y),n=wc(t.i,t.x,t.y),l=i.next,u=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,n.next=r,r.prev=n,u.next=n,n.prev=u,n}function wh(i,t,r,n){const l=wc(i,t,r);return n?(l.next=n.next,l.prev=n,n.next.prev=l,n.next=l):(l.prev=l,l.next=l),l}function To(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function wc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Tc(i,t,r){const n=r.patternDependencies;let l=!1;for(const u of t){const d=u.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);const f=d.constantOr(null);f&&(l=!0,n[f.to]=!0,n[f.from]=!0)}return l}function Sc(i,t,r,n,l){const u=l.patternDependencies;for(const d of t){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let _=f.evaluate({zoom:n-1},r,{},l.availableImages),x=f.evaluate({zoom:n},r,{},l.availableImages),v=f.evaluate({zoom:n+1},r,{},l.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,v=v&&v.name?v.name:v,u[_]=!0,u[x]=!0,u[v]=!0,r.patterns[d.id]={min:_,mid:x,max:v}}}return r}class Ic{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new or,this.indexArray=new Ui,this.indexArray2=new Rt,this.programConfigurations=new vn(t.layers,t.zoom),this.segments=new We,this.segments2=new We,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,n){this.hasPattern=Tc("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,I=wn(f,w);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),I,n))continue;const M=u?l.evaluate(I,{},n,r.availableImages):void 0,k={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?I.geometry:bn(f),patterns:{},sortKey:M};d.push(k)}u&&d.sort(((f,_)=>f.sortKey-_.sortKey));for(const f of d){const{geometry:_,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){const w=Sc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(t[x].feature,_,x,v,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ed),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,r,n,l,u){for(const d of On(r,500)){let f=0;for(const M of d)f+=M.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,v=[],w=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&w.push(v.length/2);const k=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),z=k.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(z+M.length-1,z),v.push(M[0].x),v.push(M[0].y);for(let F=1;F<M.length;F++)this.layoutVertexArray.emplaceBack(M[F].x,M[F].y),this.indexArray2.emplaceBack(z+F-1,z+F),v.push(M[F].x),v.push(M[F].y);k.vertexLength+=M.length,k.primitiveLength+=M.length}const I=yh(v,w);for(let M=0;M<I.length;M+=3)this.indexArray.emplaceBack(x+I[M],x+I[M+1],x+I[M+2]);_.vertexLength+=f,_.primitiveLength+=I.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,u,l)}}let Th,Sh;Ie("FillBucket",Ic,{omit:["layers","patternFeatures"]});var hd={get paint(){return Sh=Sh||new h({"fill-antialias":new Ae(ie.paint_fill["fill-antialias"]),"fill-opacity":new Re(ie.paint_fill["fill-opacity"]),"fill-color":new Re(ie.paint_fill["fill-color"]),"fill-outline-color":new Re(ie.paint_fill["fill-outline-color"]),"fill-translate":new Ae(ie.paint_fill["fill-translate"]),"fill-translate-anchor":new Ae(ie.paint_fill["fill-translate-anchor"]),"fill-pattern":new sa(ie.paint_fill["fill-pattern"])})},get layout(){return Th=Th||new h({"fill-sort-key":new Re(ie.layout_fill["fill-sort-key"])})}};class ud extends s{constructor(t){super(t,hd)}recalculate(t,r){super.recalculate(t,r);const n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Ic(t)}queryRadius(){return vl(this.paint.get("fill-translate"))}queryIntersectsFeature(t,r,n,l,u,d,f){return ah(bl(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),d.angle,f),l)}isTileClipped(){return!0}}const dd=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),pd=m([{name:"a_centroid",components:2,type:"Int16"}],4),{members:fd}=dd;var Ns={},md=Xi,Ih=ma;function ma(i,t,r,n,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=l,i.readFields(_d,this,t)}function _d(i,t,r){i==1?t.id=r.readVarint():i==2?(function(n,l){for(var u=n.readVarint()+n.pos;n.pos<u;){var d=l._keys[n.readVarint()],f=l._values[n.readVarint()];l.properties[d]=f}})(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function gd(i){for(var t,r,n=0,l=0,u=i.length,d=u-1;l<u;d=l++)n+=((r=i[d]).x-(t=i[l]).x)*(t.y+r.y);return n}ma.types=["Unknown","Point","LineString","Polygon"],ma.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,n=1,l=0,u=0,d=0,f=[];i.pos<r;){if(l<=0){var _=i.readVarint();n=7&_,l=_>>3}if(l--,n===1||n===2)u+=i.readSVarint(),d+=i.readSVarint(),n===1&&(t&&f.push(t),t=[]),t.push(new md(u,d));else{if(n!==7)throw new Error("unknown command "+n);t&&t.push(t[0].clone())}}return t&&f.push(t),f},ma.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,n=0,l=0,u=0,d=1/0,f=-1/0,_=1/0,x=-1/0;i.pos<t;){if(n<=0){var v=i.readVarint();r=7&v,n=v>>3}if(n--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>f&&(f=l),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,f,x]},ma.prototype.toGeoJSON=function(i,t,r){var n,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,_=this.loadGeometry(),x=ma.types[this.type];function v(M){for(var k=0;k<M.length;k++){var z=M[k];M[k]=[360*(z.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(z.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var w=[];for(n=0;n<_.length;n++)w[n]=_[n][0];v(_=w);break;case 2:for(n=0;n<_.length;n++)v(_[n]);break;case 3:for(_=(function(M){var k=M.length;if(k<=1)return[M];for(var z,F,j=[],Q=0;Q<k;Q++){var G=gd(M[Q]);G!==0&&(F===void 0&&(F=G<0),F===G<0?(z&&j.push(z),z=[M[Q]]):z.push(M[Q]))}return z&&j.push(z),j})(_),n=0;n<_.length;n++)for(l=0;l<_[n].length;l++)v(_[n][l])}_.length===1?_=_[0]:x="Multi"+x;var I={type:"Feature",geometry:{type:x,coordinates:_},properties:this.properties};return"id"in this&&(I.id=this.id),I};var yd=Ih,Ph=Ah;function Ah(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(xd,this,t),this.length=this._features.length}function xd(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push((function(n){for(var l=null,u=n.readVarint()+n.pos;n.pos<u;){var d=n.readVarint()>>3;l=d===1?n.readString():d===2?n.readFloat():d===3?n.readDouble():d===4?n.readVarint64():d===5?n.readVarint():d===6?n.readSVarint():d===7?n.readBoolean():null}return l})(r))}Ah.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new yd(this._pbf,t,this.extent,this._keys,this._values)};var vd=Ph;function bd(i,t,r){if(i===3){var n=new vd(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}Ns.VectorTile=function(i,t){this.layers=i.readFields(bd,{},t)},Ns.VectorTileFeature=Ih,Ns.VectorTileLayer=Ph;const wd=Ns.VectorTileFeature.types,Pc=Math.pow(2,13);function So(i,t,r,n,l,u,d,f){i.emplaceBack(t,r,2*Math.floor(n*Pc)+d,l*Pc*2,u*Pc*2,Math.round(f))}class Ac{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ls,this.centroidVertexArray=new Nt,this.indexArray=new Ui,this.programConfigurations=new vn(t.layers,t.zoom),this.segments=new We,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,n){this.features=[],this.hasPattern=Tc("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of t){const _=this.layers[0]._featureFilter.needGeometry,x=wn(l,_);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),x,n))continue;const v={id:u,sourceLayerIndex:f,index:d,geometry:_?x.geometry:bn(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Sc("fill-extrusion",this.layers,v,this.zoom,r)):this.addFeature(v,v.geometry,d,n,{}),r.featureIndex.insert(l,v.geometry,d,f,this.index,!0)}}addFeatures(t,r,n){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,n)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}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,fd),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,pd.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,r,n,l,u){for(const d of On(r,500)){const f={x:0,y:0,vertexCount:0};let _=0;for(const k of d)_+=k.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const k of d){if(k.length===0||Sd(k))continue;let z=0;for(let F=0;F<k.length;F++){const j=k[F];if(F>=1){const Q=k[F-1];if(!Td(j,Q)){x.vertexLength+4>We.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const G=j.sub(Q)._perp()._unit(),J=Q.dist(j);z+J>32768&&(z=0),So(this.layoutVertexArray,j.x,j.y,G.x,G.y,0,0,z),So(this.layoutVertexArray,j.x,j.y,G.x,G.y,0,1,z),f.x+=2*j.x,f.y+=2*j.y,f.vertexCount+=2,z+=J,So(this.layoutVertexArray,Q.x,Q.y,G.x,G.y,0,0,z),So(this.layoutVertexArray,Q.x,Q.y,G.x,G.y,0,1,z),f.x+=2*Q.x,f.y+=2*Q.y,f.vertexCount+=2;const re=x.vertexLength;this.indexArray.emplaceBack(re,re+2,re+1),this.indexArray.emplaceBack(re+1,re+2,re+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>We.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),wd[t.type]!=="Polygon")continue;const v=[],w=[],I=x.vertexLength;for(const k of d)if(k.length!==0){k!==d[0]&&w.push(v.length/2);for(let z=0;z<k.length;z++){const F=k[z];So(this.layoutVertexArray,F.x,F.y,0,0,1,1,0),f.x+=F.x,f.y+=F.y,f.vertexCount+=1,v.push(F.x),v.push(F.y)}}const M=yh(v,w);for(let k=0;k<M.length;k+=3)this.indexArray.emplaceBack(I+M[k],I+M[k+2],I+M[k+1]);x.primitiveLength+=M.length/3,x.vertexLength+=_;for(let k=0;k<f.vertexCount;k++){const z=Math.floor(f.x/f.vertexCount),F=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(z,F)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,u,l)}}function Td(i,t){return i.x===t.x&&(i.x<0||i.x>Mt)||i.y===t.y&&(i.y<0||i.y>Mt)}function Sd(i){return i.every((t=>t.x<0))||i.every((t=>t.x>Mt))||i.every((t=>t.y<0))||i.every((t=>t.y>Mt))}let Mh;Ie("FillExtrusionBucket",Ac,{omit:["layers","features"]});var Id={get paint(){return Mh=Mh||new h({"fill-extrusion-opacity":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Re(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new sa(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Re(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Re(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Pd extends s{constructor(t){super(t,Id)}createBucket(t){return new Ac(t)}queryRadius(){return vl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,n,l,u,d,f,_){const x=bl(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),v=this.paint.get("fill-extrusion-height").evaluate(r,n),w=this.paint.get("fill-extrusion-base").evaluate(r,n),I=(function(k,z,F,j){const Q=[];for(const G of k){const J=[G.x,G.y,0,1];wl(J,J,z),Q.push(new me(J[0]/J[3],J[1]/J[3]))}return Q})(x,_),M=(function(k,z,F,j){const Q=[],G=[],J=j[8]*z,re=j[9]*z,ce=j[10]*z,we=j[11]*z,Le=j[8]*F,ve=j[9]*F,ye=j[10]*F,ke=j[11]*F;for(const Pe of k){const Se=[],ae=[];for(const ze of Pe){const Ce=ze.x,Oe=ze.y,ct=j[0]*Ce+j[4]*Oe+j[12],lt=j[1]*Ce+j[5]*Oe+j[13],zt=j[2]*Ce+j[6]*Oe+j[14],lr=j[3]*Ce+j[7]*Oe+j[15],$t=zt+ce,Et=lr+we,ai=ct+Le,oi=lt+ve,li=zt+ye,Tt=lr+ke,Dt=new me((ct+J)/Et,(lt+re)/Et);Dt.z=$t/Et,Se.push(Dt);const Yt=new me(ai/Tt,oi/Tt);Yt.z=li/Tt,ae.push(Yt)}Q.push(Se),G.push(ae)}return[Q,G]})(l,w,v,_);return(function(k,z,F){let j=1/0;ah(F,z)&&(j=Ch(F,z[0]));for(let Q=0;Q<z.length;Q++){const G=z[Q],J=k[Q];for(let re=0;re<G.length-1;re++){const ce=G[re],we=[ce,G[re+1],J[re+1],J[re],ce];nh(F,we)&&(j=Math.min(j,Ch(F,we)))}}return j!==1/0&&j})(M[0],M[1],I)}}function Io(i,t){return i.x*t.x+i.y*t.y}function Ch(i,t){if(i.length===1){let r=0;const n=t[r++];let l;for(;!l||n.equals(l);)if(l=t[r++],!l)return 1/0;for(;r<t.length;r++){const u=t[r],d=i[0],f=l.sub(n),_=u.sub(n),x=d.sub(n),v=Io(f,f),w=Io(f,_),I=Io(_,_),M=Io(x,f),k=Io(x,_),z=v*I-w*w,F=(I*M-w*k)/z,j=(v*k-w*M)/z,Q=n.z*(1-F-j)+l.z*F+u.z*j;if(isFinite(Q))return Q}return 1/0}{let r=1/0;for(const n of t)r=Math.min(r,n.z);return r}}const Ad=m([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Md}=Ad,Cd=m([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:kd}=Cd,zd=Ns.VectorTileFeature.types,Ed=Math.cos(Math.PI/180*37.5),kh=Math.pow(2,14)/.5;class Mc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((r=>{this.gradients[r.id]={}})),this.layoutVertexArray=new aa,this.layoutVertexArray2=new Rs,this.indexArray=new Ui,this.programConfigurations=new vn(t.layers,t.zoom),this.segments=new We,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,n){this.hasPattern=Tc("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,I=wn(f,w);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),I,n))continue;const M=u?l.evaluate(I,{},n):void 0,k={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?I.geometry:bn(f),patterns:{},sortKey:M};d.push(k)}u&&d.sort(((f,_)=>f.sortKey-_.sortKey));for(const f of d){const{geometry:_,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){const w=Sc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(t[x].feature,_,x,v,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}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,kd)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Md),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.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,n,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),_=d.get("line-cap"),x=d.get("line-miter-limit"),v=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const w of r)this.addLine(w,t,f,_,x,v);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,u,l)}addLine(t,r,n,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let j=0;j<t.length-1;j++)this.totalDistance+=t[j].dist(t[j+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=zd[r.type]==="Polygon";let _=t.length;for(;_>=2&&t[_-1].equals(t[_-2]);)_--;let x=0;for(;x<_-1&&t[x].equals(t[x+1]);)x++;if(_<(f?3:2))return;n==="bevel"&&(u=1.05);const v=this.overscaling<=16?15*Mt/(512*this.overscaling):0,w=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let I,M,k,z,F;this.e1=this.e2=-1,f&&(I=t[_-2],F=t[x].sub(I)._unit()._perp());for(let j=x;j<_;j++){if(k=j===_-1?f?t[x+1]:void 0:t[j+1],k&&t[j].equals(k))continue;F&&(z=F),I&&(M=I),I=t[j],F=k?k.sub(I)._unit()._perp():z,z=z||F;let Q=z.add(F);Q.x===0&&Q.y===0||Q._unit();const G=z.x*F.x+z.y*F.y,J=Q.x*F.x+Q.y*F.y,re=J!==0?1/J:1/0,ce=2*Math.sqrt(2-2*J),we=J<Ed&&M&&k,Le=z.x*F.y-z.y*F.x>0;if(we&&j>x){const ke=I.dist(M);if(ke>2*v){const Pe=I.sub(I.sub(M)._mult(v/ke)._round());this.updateDistance(M,Pe),this.addCurrentVertex(Pe,z,0,0,w),M=Pe}}const ve=M&&k;let ye=ve?n:f?"butt":l;if(ve&&ye==="round"&&(re<d?ye="miter":re<=2&&(ye="fakeround")),ye==="miter"&&re>u&&(ye="bevel"),ye==="bevel"&&(re>2&&(ye="flipbevel"),re<u&&(ye="miter")),M&&this.updateDistance(M,I),ye==="miter")Q._mult(re),this.addCurrentVertex(I,Q,0,0,w);else if(ye==="flipbevel"){if(re>100)Q=F.mult(-1);else{const ke=re*z.add(F).mag()/z.sub(F).mag();Q._perp()._mult(ke*(Le?-1:1))}this.addCurrentVertex(I,Q,0,0,w),this.addCurrentVertex(I,Q.mult(-1),0,0,w)}else if(ye==="bevel"||ye==="fakeround"){const ke=-Math.sqrt(re*re-1),Pe=Le?ke:0,Se=Le?0:ke;if(M&&this.addCurrentVertex(I,z,Pe,Se,w),ye==="fakeround"){const ae=Math.round(180*ce/Math.PI/20);for(let ze=1;ze<ae;ze++){let Ce=ze/ae;if(Ce!==.5){const ct=Ce-.5;Ce+=Ce*ct*(Ce-1)*((1.0904+G*(G*(3.55645-1.43519*G)-3.2452))*ct*ct+(.848013+G*(.215638*G-1.06021)))}const Oe=F.sub(z)._mult(Ce)._add(z)._unit()._mult(Le?-1:1);this.addHalfVertex(I,Oe.x,Oe.y,!1,Le,0,w)}}k&&this.addCurrentVertex(I,F,-Pe,-Se,w)}else if(ye==="butt")this.addCurrentVertex(I,Q,0,0,w);else if(ye==="square"){const ke=M?1:-1;this.addCurrentVertex(I,Q,ke,ke,w)}else ye==="round"&&(M&&(this.addCurrentVertex(I,z,0,0,w),this.addCurrentVertex(I,z,1,1,w,!0)),k&&(this.addCurrentVertex(I,F,-1,-1,w,!0),this.addCurrentVertex(I,F,0,0,w)));if(we&&j<_-1){const ke=I.dist(k);if(ke>2*v){const Pe=I.add(k.sub(I)._mult(v/ke)._round());this.updateDistance(I,Pe),this.addCurrentVertex(Pe,F,0,0,w),I=Pe}}}}addCurrentVertex(t,r,n,l,u,d=!1){const f=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*n,r.y-r.x*n,d,!1,n,u),this.addHalfVertex(t,f,_,d,!0,-l,u),this.distance>kh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,n,l,u,d))}addHalfVertex({x:t,y:r},n,l,u,d,f,_){const x=.5*(this.lineClips?this.scaledDistance*(kh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*n)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),d?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let zh,Eh;Ie("LineBucket",Mc,{omit:["layers","patternFeatures"]});var Dh={get paint(){return Eh=Eh||new h({"line-opacity":new Re(ie.paint_line["line-opacity"]),"line-color":new Re(ie.paint_line["line-color"]),"line-translate":new Ae(ie.paint_line["line-translate"]),"line-translate-anchor":new Ae(ie.paint_line["line-translate-anchor"]),"line-width":new Re(ie.paint_line["line-width"]),"line-gap-width":new Re(ie.paint_line["line-gap-width"]),"line-offset":new Re(ie.paint_line["line-offset"]),"line-blur":new Re(ie.paint_line["line-blur"]),"line-dasharray":new na(ie.paint_line["line-dasharray"]),"line-pattern":new sa(ie.paint_line["line-pattern"]),"line-gradient":new mo(ie.paint_line["line-gradient"])})},get layout(){return zh=zh||new h({"line-cap":new Ae(ie.layout_line["line-cap"]),"line-join":new Re(ie.layout_line["line-join"]),"line-miter-limit":new Ae(ie.layout_line["line-miter-limit"]),"line-round-limit":new Ae(ie.layout_line["line-round-limit"]),"line-sort-key":new Re(ie.layout_line["line-sort-key"])})}};class Dd extends Re{possiblyEvaluate(t,r){return r=new dt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,n,l){return r=vi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,n,l)}}let Pl;class Ld extends s{constructor(t){super(t,Dh),this.gradientVersion=0,Pl||(Pl=new Dd(Dh.paint.properties["line-width"].specification),Pl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!(function(n){return n._styleExpression!==void 0})(r)&&r._styleExpression.expression instanceof ms,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=Pl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Mc(t)}queryRadius(t){const r=t,n=Lh(yo("line-width",this,r),yo("line-gap-width",this,r)),l=yo("line-offset",this,r);return n/2+Math.abs(l)+vl(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,n,l,u,d,f){const _=bl(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*Lh(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),v=this.paint.get("line-offset").evaluate(r,n);return v&&(l=(function(w,I){const M=[];for(let k=0;k<w.length;k++){const z=w[k],F=[];for(let j=0;j<z.length;j++){const Q=z[j-1],G=z[j],J=z[j+1],re=j===0?new me(0,0):G.sub(Q)._unit()._perp(),ce=j===z.length-1?new me(0,0):J.sub(G)._unit()._perp(),we=re._add(ce)._unit(),Le=we.x*ce.x+we.y*ce.y;Le!==0&&we._mult(1/Le),F.push(we._mult(I)._add(G))}M.push(F)}return M})(l,v*f)),(function(w,I,M){for(let k=0;k<I.length;k++){const z=I[k];if(w.length>=3){for(let F=0;F<z.length;F++)if(da(w,z[F]))return!0}if($u(w,z,M))return!0}return!1})(_,l,x)}isTileClipped(){return!0}}function Lh(i,t){return t>0?t+2*i:i}const Rd=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Bd=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Fd=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{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"}]);const Rh=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Od=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Vd(i,t,r){return i.sections.forEach((n=>{n.text=(function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),_i.applyArabicShaping&&(l=_i.applyArabicShaping(l)),l})(n.text,t,r)})),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{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"}]),m([{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"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Po={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ct=24,Bh=ot,Fh=function(i,t,r,n,l){var u,d,f=8*l-n-1,_=(1<<f)-1,x=_>>1,v=-7,w=r?l-1:0,I=r?-1:1,M=i[t+w];for(w+=I,u=M&(1<<-v)-1,M>>=-v,v+=f;v>0;u=256*u+i[t+w],w+=I,v-=8);for(d=u&(1<<-v)-1,u>>=-v,v+=n;v>0;d=256*d+i[t+w],w+=I,v-=8);if(u===0)u=1-x;else{if(u===_)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,n),u-=x}return(M?-1:1)*d*Math.pow(2,u-n)},Oh=function(i,t,r,n,l,u){var d,f,_,x=8*u-l-1,v=(1<<x)-1,w=v>>1,I=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=n?0:u-1,k=n?1:-1,z=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=v):(d=Math.floor(Math.log(t)/Math.LN2),t*(_=Math.pow(2,-d))<1&&(d--,_*=2),(t+=d+w>=1?I/_:I*Math.pow(2,1-w))*_>=2&&(d++,_/=2),d+w>=v?(f=0,d=v):d+w>=1?(f=(t*_-1)*Math.pow(2,l),d+=w):(f=t*Math.pow(2,w-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=k,f/=256,l-=8);for(d=d<<l|f,x+=l;x>0;i[r+M]=255&d,M+=k,d/=256,x-=8);i[r+M-k]|=128*z};function ot(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ot.Varint=0,ot.Fixed64=1,ot.Bytes=2,ot.Fixed32=5;var Cc=4294967296,Vh=1/Cc,Nh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ss(i){return i.type===ot.Bytes?i.readVarint()+i.pos:i.pos+1}function _a(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function jh(i,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(n);for(var l=r.pos-1;l>=i;l--)r.buf[l+n]=r.buf[l]}function Nd(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function jd(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function Ud(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function $d(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function qd(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function Zd(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function Gd(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function Hd(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function Xd(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function Al(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function ga(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function Uh(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}ot.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),l=n>>3,u=this.pos;this.type=7&n,i(l,t,this),this.pos===u&&this.skip(n)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Al(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Uh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Al(this.buf,this.pos)+Al(this.buf,this.pos+4)*Cc;return this.pos+=8,i},readSFixed64:function(){var i=Al(this.buf,this.pos)+Uh(this.buf,this.pos+4)*Cc;return this.pos+=8,i},readFloat:function(){var i=Fh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Fh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,n=this.buf;return t=127&(r=n[this.pos++]),r<128?t:(t|=(127&(r=n[this.pos++]))<<7,r<128?t:(t|=(127&(r=n[this.pos++]))<<14,r<128?t:(t|=(127&(r=n[this.pos++]))<<21,r<128?t:(function(l,u,d){var f,_,x=d.buf;if(f=(112&(_=x[d.pos++]))>>4,_<128||(f|=(127&(_=x[d.pos++]))<<3,_<128)||(f|=(127&(_=x[d.pos++]))<<10,_<128)||(f|=(127&(_=x[d.pos++]))<<17,_<128)||(f|=(127&(_=x[d.pos++]))<<24,_<128)||(f|=(1&(_=x[d.pos++]))<<31,_<128))return _a(l,f,u);throw new Error("Expected varint not more than 10 bytes")})(t|=(15&(r=n[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Nh?(function(r,n,l){return Nh.decode(r.subarray(n,l))})(this.buf,t,i):(function(r,n,l){for(var u="",d=n;d<l;){var f,_,x,v=r[d],w=null,I=v>239?4:v>223?3:v>191?2:1;if(d+I>l)break;I===1?v<128&&(w=v):I===2?(192&(f=r[d+1]))==128&&(w=(31&v)<<6|63&f)<=127&&(w=null):I===3?(_=r[d+2],(192&(f=r[d+1]))==128&&(192&_)==128&&((w=(15&v)<<12|(63&f)<<6|63&_)<=2047||w>=55296&&w<=57343)&&(w=null)):I===4&&(_=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&_)==128&&(192&x)==128&&((w=(15&v)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||w>=1114112)&&(w=null)),w===null?(w=65533,I=1):w>65535&&(w-=65536,u+=String.fromCharCode(w>>>10&1023|55296),w=56320|1023&w),u+=String.fromCharCode(w),d+=I}return u})(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==ot.Bytes)return i.push(this.readVarint(t));var r=ss(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==ot.Bytes)return i.push(this.readSVarint());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==ot.Bytes)return i.push(this.readBoolean());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ot.Bytes)return i.push(this.readFloat());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ot.Bytes)return i.push(this.readDouble());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ot.Bytes)return i.push(this.readFixed32());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ot.Bytes)return i.push(this.readSFixed32());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ot.Bytes)return i.push(this.readFixed64());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ot.Bytes)return i.push(this.readSFixed64());var t=ss(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===ot.Varint)for(;this.buf[this.pos++]>127;);else if(t===ot.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ot.Fixed32)this.pos+=4;else{if(t!==ot.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ga(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ga(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ga(this.buf,-1&i,this.pos),ga(this.buf,Math.floor(i*Vh),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ga(this.buf,-1&i,this.pos),ga(this.buf,Math.floor(i*Vh),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?(function(t,r){var n,l;if(t>=0?(n=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),(function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)})(n,0,r),(function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))})(l,r)})(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=(function(n,l,u){for(var d,f,_=0;_<l.length;_++){if((d=l.charCodeAt(_))>55295&&d<57344){if(!f){d>56319||_+1===l.length?(n[u++]=239,n[u++]=191,n[u++]=189):f=d;continue}if(d<56320){n[u++]=239,n[u++]=191,n[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(n[u++]=239,n[u++]=191,n[u++]=189,f=null);d<128?n[u++]=d:(d<2048?n[u++]=d>>6|192:(d<65536?n[u++]=d>>12|224:(n[u++]=d>>18|240,n[u++]=d>>12&63|128),n[u++]=d>>6&63|128),n[u++]=63&d|128)}return u})(this.buf,i,this.pos);var r=this.pos-t;r>=128&&jh(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Oh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Oh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var n=this.pos-r;n>=128&&jh(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(i,t,r){this.writeTag(i,ot.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Nd,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,jd,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,qd,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Ud,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,$d,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,Zd,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,Gd,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,Hd,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,Xd,t)},writeBytesField:function(i,t){this.writeTag(i,ot.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ot.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ot.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ot.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ot.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ot.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ot.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ot.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ot.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ot.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var kc=zi(Bh);const zc=3;function Wd(i,t,r){i===1&&r.readMessage(Kd,t)}function Kd(i,t,r){if(i===3){const{id:n,bitmap:l,width:u,height:d,left:f,top:_,advance:x}=r.readMessage(Jd,{});t.push({id:n,bitmap:new vo({width:u+2*zc,height:d+2*zc},l),metrics:{width:u,height:d,left:f,top:_,advance:x}})}}function Jd(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}const $h=zc;function qh(i){let t=0,r=0;for(const d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort(((d,f)=>f.h-d.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=n.length-1;f>=0;f--){const _=n[f];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===_.w&&d.h===_.h){const x=n.pop();f<n.length&&(n[f]=x)}else d.h===_.h?(_.x+=d.w,_.w-=d.w):d.w===_.w?(_.y+=d.h,_.h-=d.h):(n.push({x:_.x+d.w,y:_.y,w:_.w-d.w,h:d.h}),_.y+=d.h,_.h-=d.h);break}}return{w:l,h:u,fill:t/(l*u)||0}}const yi=1;class Ec{constructor(t,{pixelRatio:r,version:n,stretchX:l,stretchY:u,content:d,textFitWidth:f,textFitHeight:_}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=d,this.version=n,this.textFitWidth=f,this.textFitHeight=_}get tl(){return[this.paddedRect.x+yi,this.paddedRect.y+yi]}get br(){return[this.paddedRect.x+this.paddedRect.w-yi,this.paddedRect.y+this.paddedRect.h-yi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*yi)/this.pixelRatio,(this.paddedRect.h-2*yi)/this.pixelRatio]}}class Zh{constructor(t,r){const n={},l={};this.haveRenderCallbacks=[];const u=[];this.addImages(t,n,u),this.addImages(r,l,u);const{w:d,h:f}=qh(u),_=new $i({width:d||1,height:f||1});for(const x in t){const v=t[x],w=n[x].paddedRect;$i.copy(v.data,_,{x:0,y:0},{x:w.x+yi,y:w.y+yi},v.data)}for(const x in r){const v=r[x],w=l[x].paddedRect,I=w.x+yi,M=w.y+yi,k=v.data.width,z=v.data.height;$i.copy(v.data,_,{x:0,y:0},{x:I,y:M},v.data),$i.copy(v.data,_,{x:0,y:z-1},{x:I,y:M-1},{width:k,height:1}),$i.copy(v.data,_,{x:0,y:0},{x:I,y:M+z},{width:k,height:1}),$i.copy(v.data,_,{x:k-1,y:0},{x:I-1,y:M},{width:1,height:z}),$i.copy(v.data,_,{x:0,y:0},{x:I+k,y:M},{width:1,height:z})}this.image=_,this.iconPositions=n,this.patternPositions=l}addImages(t,r,n){for(const l in t){const u=t[l],d={x:0,y:0,w:u.data.width+2*yi,h:u.data.height+2*yi};n.push(d),r[l]=new Ec(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),r)}patchUpdatedImage(t,r,n){if(!t||!r||t.version===r.version)return;t.version=r.version;const[l,u]=t.tl;n.update(r.data,void 0,{x:l,y:u})}}var js;Ie("ImagePosition",Ec),Ie("ImageAtlas",Zh),L.ah=void 0,(js=L.ah||(L.ah={}))[js.none=0]="none",js[js.horizontal=1]="horizontal",js[js.vertical=2]="vertical",js[js.horizontalOnly=3]="horizontalOnly";const Ao=-17;class Mo{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){const n=new Mo;return n.scale=t||1,n.fontStack=r,n}static forImage(t){const r=new Mo;return r.imageName=t,r}}class ya{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const n=new ya;for(let l=0;l<t.sections.length;l++){const u=t.sections[l];u.image?n.addImageSection(u):n.addTextSection(u,r)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=(function(t){let r="";for(let n=0;n<t.length;n++){const l=t.charCodeAt(n+1)||null,u=t.charCodeAt(n-1)||null;r+=l&&pl(l)&&!Po[t[n+1]]||u&&pl(u)&&!Po[t[n-1]]||!Po[t[n]]?t[n]:Po[t[n]]}return r})(this.text)}trim(){let t=0;for(let n=0;n<this.text.length&&Cl[this.text.charCodeAt(n)];n++)t++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=t&&Cl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const n=new ya;return n.text=this.text.substring(t,r),n.sectionIndex=this.sectionIndex.slice(t,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,r)=>Math.max(t,this.sections[r].scale)),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Mo.forText(t.scale,t.fontStack||r));const n=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(n)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void Ft("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(Mo.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Ft("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ml(i,t,r,n,l,u,d,f,_,x,v,w,I,M,k){const z=ya.fromFeature(i,l);let F;w===L.ah.vertical&&z.verticalizePunctuation();const{processBidirectionalText:j,processStyledBidirectionalText:Q}=_i;if(j&&z.sections.length===1){F=[];const re=j(z.toString(),Dc(z,x,u,t,n,M));for(const ce of re){const we=new ya;we.text=ce,we.sections=z.sections;for(let Le=0;Le<ce.length;Le++)we.sectionIndex.push(0);F.push(we)}}else if(Q){F=[];const re=Q(z.text,z.sectionIndex,Dc(z,x,u,t,n,M));for(const ce of re){const we=new ya;we.text=ce[0],we.sectionIndex=ce[1],we.sections=z.sections,F.push(we)}}else F=(function(re,ce){const we=[],Le=re.text;let ve=0;for(const ye of ce)we.push(re.substring(ve,ye)),ve=ye;return ve<Le.length&&we.push(re.substring(ve,Le.length)),we})(z,Dc(z,x,u,t,n,M));const G=[],J={positionedLines:G,text:z.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:w,iconsInText:!1,verticalizable:!1};return(function(re,ce,we,Le,ve,ye,ke,Pe,Se,ae,ze,Ce){let Oe=0,ct=Ao,lt=0,zt=0;const lr=Pe==="right"?1:Pe==="left"?0:.5;let $t=0;for(const Tt of ve){Tt.trim();const Dt=Tt.getMaxScale(),Yt=(Dt-1)*Ct,qt={positionedGlyphs:[],lineOffset:0};re.positionedLines[$t]=qt;const ci=qt.positionedGlyphs;let Zt=0;if(!Tt.length()){ct+=ye,++$t;continue}for(let xi=0;xi<Tt.length();xi++){const Qe=Tt.getSection(xi),ut=Tt.getSectionIndex(xi),_t=Tt.getCharCode(xi);let Ci=0,vt=null,wa=null,Lr=null,Rr=Ct;const cr=!(Se===L.ah.horizontal||!ze&&!po(_t)||ze&&(Cl[_t]||(Et=_t,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Et)))));if(Qe.imageName){const Gi=Le[Qe.imageName];if(!Gi)continue;Lr=Qe.imageName,re.iconsInText=re.iconsInText||!0,wa=Gi.paddedRect;const Bt=Gi.displaySize;Qe.scale=Qe.scale*Ct/Ce,vt={width:Bt[0],height:Bt[1],left:yi,top:-$h,advance:cr?Bt[1]:Bt[0]},Ci=Yt+(Ct-Bt[1]*Qe.scale),Rr=vt.advance;const ns=cr?Bt[0]*Qe.scale-Ct*Dt:Bt[1]*Qe.scale-Ct*Dt;ns>0&&ns>Zt&&(Zt=ns)}else{const Gi=we[Qe.fontStack],Bt=Gi&&Gi[_t];if(Bt&&Bt.rect)wa=Bt.rect,vt=Bt.metrics;else{const ns=ce[Qe.fontStack],Lo=ns&&ns[_t];if(!Lo)continue;vt=Lo.metrics}Ci=(Dt-Qe.scale)*Ct}cr?(re.verticalizable=!0,ci.push({glyph:_t,imageName:Lr,x:Oe,y:ct+Ci,vertical:cr,scale:Qe.scale,fontStack:Qe.fontStack,sectionIndex:ut,metrics:vt,rect:wa}),Oe+=Rr*Qe.scale+ae):(ci.push({glyph:_t,imageName:Lr,x:Oe,y:ct+Ci,vertical:cr,scale:Qe.scale,fontStack:Qe.fontStack,sectionIndex:ut,metrics:vt,rect:wa}),Oe+=vt.advance*Qe.scale+ae)}ci.length!==0&&(lt=Math.max(Oe-ae,lt),tp(ci,0,ci.length-1,lr,Zt)),Oe=0;const Zi=ye*Dt+Zt;qt.lineOffset=Math.max(Zt,Yt),ct+=Zi,zt=Math.max(Zi,zt),++$t}var Et;const ai=ct-Ao,{horizontalAlign:oi,verticalAlign:li}=Lc(ke);(function(Tt,Dt,Yt,qt,ci,Zt,Zi,xi,Qe){const ut=(Dt-Yt)*ci;let _t=0;_t=Zt!==Zi?-xi*qt-Ao:(-qt*Qe+.5)*Zi;for(const Ci of Tt)for(const vt of Ci.positionedGlyphs)vt.x+=ut,vt.y+=_t})(re.positionedLines,lr,oi,li,lt,zt,ye,ai,ve.length),re.top+=-li*ai,re.bottom=re.top+ai,re.left+=-oi*lt,re.right=re.left+lt})(J,t,r,n,F,d,f,_,w,x,I,k),!(function(re){for(const ce of re)if(ce.positionedGlyphs.length!==0)return!1;return!0})(G)&&J}const Cl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yd={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Qd={40:!0};function Gh(i,t,r,n,l,u){if(t.imageName){const d=n[t.imageName];return d?d.displaySize[0]*t.scale*Ct/u+l:0}{const d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function Hh(i,t,r,n){const l=Math.pow(i-t,2);return n?i<t?l/2:2*l:l+Math.abs(r)*r}function ep(i,t,r){let n=0;return i===10&&(n-=1e4),r&&(n+=150),i!==40&&i!==65288||(n+=50),t!==41&&t!==65289||(n+=50),n}function Xh(i,t,r,n,l,u){let d=null,f=Hh(t,r,l,u);for(const _ of n){const x=Hh(t-_.x,r,l,u)+_.badness;x<=f&&(d=_,f=x)}return{index:i,x:t,priorBreak:d,badness:f}}function Wh(i){return i?Wh(i.priorBreak).concat(i.index):[]}function Dc(i,t,r,n,l,u){if(!i)return[];const d=[],f=(function(w,I,M,k,z,F){let j=0;for(let Q=0;Q<w.length();Q++){const G=w.getSection(Q);j+=Gh(w.getCharCode(Q),G,k,z,I,F)}return j/Math.max(1,Math.ceil(j/M))})(i,t,r,n,l,u),_=i.text.indexOf("​")>=0;let x=0;for(let w=0;w<i.length();w++){const I=i.getSection(w),M=i.getCharCode(w);if(Cl[M]||(x+=Gh(M,I,n,l,t,u)),w<i.length()-1){const k=!((v=M)<11904)&&(!!Xe["CJK Compatibility Forms"](v)||!!Xe["CJK Compatibility"](v)||!!Xe["CJK Strokes"](v)||!!Xe["CJK Symbols and Punctuation"](v)||!!Xe["Enclosed CJK Letters and Months"](v)||!!Xe["Halfwidth and Fullwidth Forms"](v)||!!Xe["Ideographic Description Characters"](v)||!!Xe["Vertical Forms"](v)||dl.test(String.fromCodePoint(v)));(Yd[M]||k||I.imageName||w!==i.length()-2&&Qd[i.getCharCode(w+1)])&&d.push(Xh(w+1,x,f,d,ep(M,i.getCharCode(w+1),k&&_),!1))}}var v;return Wh(Xh(i.length(),x,f,d,0,!0))}function Lc(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function tp(i,t,r,n,l){if(!n&&!l)return;const u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*n;for(let f=t;f<=r;f++)i[f].x-=d,i[f].y+=l}function ip(i,t,r){const{horizontalAlign:n,verticalAlign:l}=Lc(r),u=t[0]-i.displaySize[0]*n,d=t[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function Kh(i){var t,r;let n=i.left,l=i.top,u=i.right-n,d=i.bottom-l;const f=(t=i.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",_=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(_==="proportional"){if(f==="stretchOnly"&&u/d<x||f==="proportional"){const v=Math.ceil(d*x);n*=v/u,u=v}}else if(f==="proportional"&&_==="stretchOnly"&&x!==0&&u/d>x){const v=Math.ceil(u/x);l*=v/d,d=v}return{x1:n,y1:l,x2:n+u,y2:l+d}}function Jh(i,t,r,n,l,u){const d=i.image;let f;if(d.content){const F=d.content,j=d.pixelRatio||1;f=[F[0]/j,F[1]/j,d.displaySize[0]-F[2]/j,d.displaySize[1]-F[3]/j]}const _=t.left*u,x=t.right*u;let v,w,I,M;r==="width"||r==="both"?(M=l[0]+_-n[3],w=l[0]+x+n[1]):(M=l[0]+(_+x-d.displaySize[0])/2,w=M+d.displaySize[0]);const k=t.top*u,z=t.bottom*u;return r==="height"||r==="both"?(v=l[1]+k-n[0],I=l[1]+z+n[2]):(v=l[1]+(k+z-d.displaySize[1])/2,I=v+d.displaySize[1]),{image:d,top:v,right:w,bottom:I,left:M,collisionPadding:f}}const Co=255,Dr=128,Us=Co*Dr;function Yh(i,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new dt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:l}=r;let u=0;for(;u<n.length&&n[u]<=i;)u++;u=Math.max(0,u-1);let d=u;for(;d<n.length&&n[d]<i+1;)d++;d=Math.min(n.length-1,d);const f=n[u],_=n[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:_,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:_,minSize:r.evaluate(new dt(f)),maxSize:r.evaluate(new dt(_)),interpolationType:l}}}function Rc(i,t,r){let n="never";const l=i.get(t);return l?n=l:i.get(r)&&(n="always"),n}const rp=Ns.VectorTileFeature.types,sp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function kl(i,t,r,n,l,u,d,f,_,x,v,w,I){const M=f?Math.min(Us,Math.round(f[0])):0,k=f?Math.min(Us,Math.round(f[1])):0;i.emplaceBack(t,r,Math.round(32*n),Math.round(32*l),u,d,(M<<1)+(_?1:0),k,16*x,16*v,256*w,256*I)}function Bc(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function np(i){for(const t of i.sections)if(hc(t.text))return!0;return!1}class Fc{constructor(t){this.layoutVertexArray=new oa,this.indexArray=new Ui,this.programConfigurations=t,this.segments=new We,this.dynamicLayoutVertexArray=new _o,this.opacityVertexArray=new Ai,this.hasVisibleVertices=!1,this.placedSymbolArray=new pt}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,n,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Rd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Bd.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,sp,!0),this.opacityVertexBuffer.itemSize=1),(n||l)&&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())}}Ie("SymbolBuffers",Fc);class Oc{constructor(t,r,n){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new n,this.segments=new We,this.collisionVertexArray=new zr}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Fd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ie("CollisionBuffers",Oc);class xa{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((d=>d.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=gc([]),this.placementViewportMatrix=gc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Yh(this.zoom,r["text-size"]),this.iconSizeData=Yh(this.zoom,r["icon-size"]);const n=this.layers[0].layout,l=n.get("symbol-sort-key"),u=n.get("symbol-z-order");this.canOverlap=Rc(n,"text-overlap","text-allow-overlap")!=="never"||Rc(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map((d=>L.ah[d]))),this.stateDependentLayerIds=this.layers.filter((d=>d.isStateDependent())).map((d=>d.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Fc(new vn(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Fc(new vn(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ft,this.lineVertexArray=new Vt,this.symbolInstances=new He,this.textAnchorOffsets=new mt}calculateGlyphDependencies(t,r,n,l,u){for(let d=0;d<t.length;d++)if(r[t.charCodeAt(d)]=!0,(n||l)&&u){const f=Po[t.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(t,r,n){const l=this.layers[0],u=l.layout,d=u.get("text-font"),f=u.get("text-field"),_=u.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof di&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),v=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,w=u.get("symbol-sort-key");if(this.features=[],!x&&!v)return;const I=r.iconDependencies,M=r.glyphDependencies,k=r.availableImages,z=new dt(this.zoom);for(const{feature:F,id:j,index:Q,sourceLayerIndex:G}of t){const J=l._featureFilter.needGeometry,re=wn(F,J);if(!l._featureFilter.filter(z,re,n))continue;let ce,we;if(J||(re.geometry=bn(F)),x){const ve=l.getValueAndResolveTokens("text-field",re,n,k),ye=di.factory(ve),ke=this.hasRTLText=this.hasRTLText||np(ye);(!ke||_i.getRTLTextPluginStatus()==="unavailable"||ke&&_i.isParsed())&&(ce=Vd(ye,l,re))}if(v){const ve=l.getValueAndResolveTokens("icon-image",re,n,k);we=ve instanceof fi?ve:fi.fromString(ve)}if(!ce&&!we)continue;const Le=this.sortFeaturesByKey?w.evaluate(re,{},n):void 0;if(this.features.push({id:j,text:ce,icon:we,index:Q,sourceLayerIndex:G,geometry:re.geometry,properties:F.properties,type:rp[F.type],sortKey:Le}),we&&(I[we.name]=!0),ce){const ve=d.evaluate(re,{},n).join(","),ye=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(L.ah.vertical)>=0;for(const ke of ce.sections)if(ke.image)I[ke.image.name]=!0;else{const Pe=ho(ce.toString()),Se=ke.fontStack||ve,ae=M[Se]=M[Se]||{};this.calculateGlyphDependencies(ke.text,ae,ye,this.allowVerticalPlacement,Pe)}}}u.get("symbol-placement")==="line"&&(this.features=(function(F){const j={},Q={},G=[];let J=0;function re(ve){G.push(F[ve]),J++}function ce(ve,ye,ke){const Pe=Q[ve];return delete Q[ve],Q[ye]=Pe,G[Pe].geometry[0].pop(),G[Pe].geometry[0]=G[Pe].geometry[0].concat(ke[0]),Pe}function we(ve,ye,ke){const Pe=j[ye];return delete j[ye],j[ve]=Pe,G[Pe].geometry[0].shift(),G[Pe].geometry[0]=ke[0].concat(G[Pe].geometry[0]),Pe}function Le(ve,ye,ke){const Pe=ke?ye[0][ye[0].length-1]:ye[0][0];return`${ve}:${Pe.x}:${Pe.y}`}for(let ve=0;ve<F.length;ve++){const ye=F[ve],ke=ye.geometry,Pe=ye.text?ye.text.toString():null;if(!Pe){re(ve);continue}const Se=Le(Pe,ke),ae=Le(Pe,ke,!0);if(Se in Q&&ae in j&&Q[Se]!==j[ae]){const ze=we(Se,ae,ke),Ce=ce(Se,ae,G[ze].geometry);delete j[Se],delete Q[ae],Q[Le(Pe,G[Ce].geometry,!0)]=Ce,G[ze].geometry=null}else Se in Q?ce(Se,ae,ke):ae in j?we(Se,ae,ke):(re(ve),j[Se]=J-1,Q[ae]=J-1)}return G.filter((ve=>ve.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((F,j)=>F.sortKey-j.sortKey))}update(t,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(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,r){const n=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),u=t.dist(r[t.segment]);const d={};for(let f=t.segment+1;f<r.length;f++)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=t.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const _=d[f];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,r,n,l,u,d,f,_,x,v,w,I){const M=t.indexArray,k=t.layoutVertexArray,z=t.segments.prepareSegment(4*r.length,k,M,this.canOverlap?d.sortKey:void 0),F=this.glyphOffsetArray.length,j=z.vertexLength,Q=this.allowVerticalPlacement&&f===L.ah.vertical?Math.PI/2:0,G=d.text&&d.text.sections;for(let J=0;J<r.length;J++){const{tl:re,tr:ce,bl:we,br:Le,tex:ve,pixelOffsetTL:ye,pixelOffsetBR:ke,minFontScaleX:Pe,minFontScaleY:Se,glyphOffset:ae,isSDF:ze,sectionIndex:Ce}=r[J],Oe=z.vertexLength,ct=ae[1];kl(k,_.x,_.y,re.x,ct+re.y,ve.x,ve.y,n,ze,ye.x,ye.y,Pe,Se),kl(k,_.x,_.y,ce.x,ct+ce.y,ve.x+ve.w,ve.y,n,ze,ke.x,ye.y,Pe,Se),kl(k,_.x,_.y,we.x,ct+we.y,ve.x,ve.y+ve.h,n,ze,ye.x,ke.y,Pe,Se),kl(k,_.x,_.y,Le.x,ct+Le.y,ve.x+ve.w,ve.y+ve.h,n,ze,ke.x,ke.y,Pe,Se),Bc(t.dynamicLayoutVertexArray,_,Q),M.emplaceBack(Oe,Oe+1,Oe+2),M.emplaceBack(Oe+1,Oe+2,Oe+3),z.vertexLength+=4,z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ae[0]),J!==r.length-1&&Ce===r[J+1].sectionIndex||t.programConfigurations.populatePaintArrays(k.length,d,d.index,{},I,G&&G[Ce])}t.placedSymbolArray.emplaceBack(_.x,_.y,F,this.glyphOffsetArray.length-F,j,x,v,_.segment,n?n[0]:0,n?n[1]:0,l[0],l[1],f,0,!1,0,w)}_addCollisionDebugVertex(t,r,n,l,u,d){return r.emplaceBack(0,0),t.emplaceBack(n.x,n.y,l,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(t,r,n,l,u,d,f){const _=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),x=_.vertexLength,v=u.layoutVertexArray,w=u.collisionVertexArray,I=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(v,w,d,I,M,new me(t,r)),this._addCollisionDebugVertex(v,w,d,I,M,new me(n,r)),this._addCollisionDebugVertex(v,w,d,I,M,new me(n,l)),this._addCollisionDebugVertex(v,w,d,I,M,new me(t,l)),_.vertexLength+=4;const k=u.indexArray;k.emplaceBack(x,x+1),k.emplaceBack(x+1,x+2),k.emplaceBack(x+2,x+3),k.emplaceBack(x+3,x),_.primitiveLength+=4}addDebugCollisionBoxes(t,r,n,l){for(let u=t;u<r;u++){const d=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Oc(Mi,Rh.members,Rt),this.iconCollisionBox=new Oc(Mi,Rh.members,Rt);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,n,l,u,d,f,_,x){const v={};for(let w=r;w<n;w++){const I=t.get(w);v.textBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.textFeatureIndex=I.featureIndex;break}for(let w=l;w<u;w++){const I=t.get(w);v.verticalTextBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.verticalTextFeatureIndex=I.featureIndex;break}for(let w=d;w<f;w++){const I=t.get(w);v.iconBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.iconFeatureIndex=I.featureIndex;break}for(let w=_;w<x;w++){const I=t.get(w);v.verticalIconBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.verticalIconFeatureIndex=I.featureIndex;break}return v}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){const n=t.placedSymbolArray.get(r),l=n.vertexStartIndex+4*n.numGlyphs;for(let u=n.vertexStartIndex;u<l;u+=4)t.indexArray.emplaceBack(u,u+1,u+2),t.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),n=Math.cos(t),l=[],u=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);const _=this.symbolInstances.get(f);l.push(0|Math.round(r*_.anchorX+n*_.anchorY)),u.push(_.featureIndex)}return d.sort(((f,_)=>l[f]-l[_]||u[_]-u[f])),d}addToSortKeyRanges(t,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,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(const r of this.symbolInstanceIndexes){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach(((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)})),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Qh,eu;Ie("SymbolBucket",xa,{omit:["layers","collisionBoxArray","features","compareText"]}),xa.MAX_GLYPHS=65535,xa.addDynamicAttributes=Bc;var Vc={get paint(){return eu=eu||new h({"icon-opacity":new Re(ie.paint_symbol["icon-opacity"]),"icon-color":new Re(ie.paint_symbol["icon-color"]),"icon-halo-color":new Re(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Re(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Re(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new Ae(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ae(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Re(ie.paint_symbol["text-opacity"]),"text-color":new Re(ie.paint_symbol["text-color"],{runtimeType:ti,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Re(ie.paint_symbol["text-halo-color"]),"text-halo-width":new Re(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Re(ie.paint_symbol["text-halo-blur"]),"text-translate":new Ae(ie.paint_symbol["text-translate"]),"text-translate-anchor":new Ae(ie.paint_symbol["text-translate-anchor"])})},get layout(){return Qh=Qh||new h({"symbol-placement":new Ae(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new Ae(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ae(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Re(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ae(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ae(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ae(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ae(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ae(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ae(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Re(ie.layout_symbol["icon-size"]),"icon-text-fit":new Ae(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ae(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Re(ie.layout_symbol["icon-image"]),"icon-rotate":new Re(ie.layout_symbol["icon-rotate"]),"icon-padding":new Re(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new Ae(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Re(ie.layout_symbol["icon-offset"]),"icon-anchor":new Re(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ae(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ae(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ae(ie.layout_symbol["text-rotation-alignment"]),"text-field":new Re(ie.layout_symbol["text-field"]),"text-font":new Re(ie.layout_symbol["text-font"]),"text-size":new Re(ie.layout_symbol["text-size"]),"text-max-width":new Re(ie.layout_symbol["text-max-width"]),"text-line-height":new Ae(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Re(ie.layout_symbol["text-letter-spacing"]),"text-justify":new Re(ie.layout_symbol["text-justify"]),"text-radial-offset":new Re(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ae(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Re(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Re(ie.layout_symbol["text-anchor"]),"text-max-angle":new Ae(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new Ae(ie.layout_symbol["text-writing-mode"]),"text-rotate":new Re(ie.layout_symbol["text-rotate"]),"text-padding":new Ae(ie.layout_symbol["text-padding"]),"text-keep-upright":new Ae(ie.layout_symbol["text-keep-upright"]),"text-transform":new Re(ie.layout_symbol["text-transform"]),"text-offset":new Re(ie.layout_symbol["text-offset"]),"text-allow-overlap":new Ae(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new Ae(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new Ae(ie.layout_symbol["text-ignore-placement"]),"text-optional":new Ae(ie.layout_symbol["text-optional"])})}};class tu{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Ar,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.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}}Ie("FormatSectionOverride",tu,{omit:["defaultValue"]});class zl extends s{constructor(t){super(t,Vc)}recalculate(t,r){if(super.recalculate(t,r),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"){const n=this.layout.get("text-writing-mode");if(n){const l=[];for(const u of n)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,n,l){const u=this.layout.get(t).evaluate(r,{},n,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||Gn(d.value)||!u?u:(function(f,_){return _.replace(/{([^{}]+)}/g,((x,v)=>f&&v in f?String(f[v]):""))})(r.properties,u)}createBucket(t){return new xa(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Vc.paint.overridableProperties){if(!zl.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),n=new tu(r),l=new Zn(n,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Ss("source",l):new Is("composite",l,r.value.zoomStops),this.paint._values[t]=new ar(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&zl.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const n=t.get("text-field"),l=Vc.paint.properties[r];let u=!1;const d=f=>{for(const _ of f)if(l.overrides&&l.overrides.hasOverride(_))return void(u=!0)};if(n.value.kind==="constant"&&n.value.value instanceof di)d(n.value.value.sections);else if(n.value.kind==="source"){const f=x=>{u||(x instanceof Bi&&At(x.value)===mr?d(x.value.sections):x instanceof Bn?d(x.sections):x.eachChild(f))},_=n.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let iu;var ap={get paint(){return iu=iu||new h({"background-color":new Ae(ie.paint_background["background-color"]),"background-pattern":new na(ie.paint_background["background-pattern"]),"background-opacity":new Ae(ie.paint_background["background-opacity"])})}};class op extends s{constructor(t){super(t,ap)}}let ru;var lp={get paint(){return ru=ru||new h({"raster-opacity":new Ae(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ae(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ae(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ae(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new Ae(ie.paint_raster["raster-saturation"]),"raster-contrast":new Ae(ie.paint_raster["raster-contrast"]),"raster-resampling":new Ae(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new Ae(ie.paint_raster["raster-fade-duration"])})}};class cp extends s{constructor(t){super(t,lp)}}class hp extends s{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class up{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Nc=63710088e-1;class $s{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $s(Ki(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,n=this.lat*r,l=t.lat*r,u=Math.sin(n)*Math.sin(l)+Math.cos(n)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return Nc*Math.acos(Math.min(u,1))}static convert(t){if(t instanceof $s)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new $s(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new $s(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const su=2*Math.PI*Nc;function nu(i){return su*Math.cos(i*Math.PI/180)}function au(i){return(180+i)/360}function ou(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function lu(i,t){return i/nu(t)}function jc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ko{constructor(t,r,n=0){this.x=+t,this.y=+r,this.z=+n}static fromLngLat(t,r=0){const n=$s.convert(t);return new ko(au(n.lng),ou(n.lat),lu(r,n.lat))}toLngLat(){return new $s(360*this.x-180,jc(this.y))}toAltitude(){return this.z*nu(jc(this.y))}meterInMercatorCoordinateUnits(){return 1/su*(t=jc(this.y),1/Math.cos(t*Math.PI/180));var t}}function cu(i,t,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[i*n-2*Math.PI*6378137/2,t*n-2*Math.PI*6378137/2]}class Uc{constructor(t,r,n){if(!(function(l,u,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||u<0||u>=Math.pow(2,l))})(t,r,n))throw new Error(`x=${r}, y=${n}, 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=r,this.y=n,this.key=zo(0,t,t,r,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,n){const l=(d=this.y,f=this.z,_=cu(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=cu(256*(u+1),256*(d+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,d,f,_,x;const v=(function(w,I,M){let k,z="";for(let F=w;F>0;F--)k=1<<F-1,z+=(I&k?1:0)+(M&k?2:0);return z})(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(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new me((t.x*r-this.x)*Mt,(t.y*r-this.y)*Mt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class hu{constructor(t,r){this.wrap=t,this.canonical=r,this.key=zo(t,r.z,r.z,r.x,r.y)}}class qi{constructor(t,r,n,l,u){if(t<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${n}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Uc(n,+l,+u),this.key=zo(r,t,n,l,u)}clone(){return new qi(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 new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new qi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qi(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?zo(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):zo(this.wrap*+r,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new qi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,l=2*this.canonical.y;return[new qi(r,this.wrap,r,n,l),new qi(r,this.wrap,r,n+1,l),new qi(r,this.wrap,r,n,l+1),new qi(r,this.wrap,r,n+1,l+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 qi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new qi(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 hu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ko(t.x-this.wrap,t.y))}}function zo(i,t,r,n,l){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*l+n).toString(36)+r.toString(36)+t.toString(36)}Ie("CanonicalTileID",Uc),Ie("OverscaledTileID",qi,{omit:["posMatrix"]});class uu{constructor(t,r,n,l=1,u=1,d=1,f=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n))return void Ft(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=u,this.blueFactor=d,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<_;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(_,x)]=this.data[this._idx(_-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,_)]=this.data[this._idx(x,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<_;x++)for(let v=0;v<_;v++){const w=this.get(x,v);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(t,r){const n=new Uint8Array(this.data.buffer),l=4*this._idx(t,r);return this.unpack(n[l],n[l+1],n[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,n){return t*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new $i({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=n*this.dim,f=n*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(n){case-1:d=f-1;break;case 1:f=d+1}const _=-r*this.dim,x=-n*this.dim;for(let v=d;v<f;v++)for(let w=l;w<u;w++)this.data[this._idx(w,v)]=t.data[this._idx(w+_,v+x)]}}Ie("DEMData",uu);class du{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const n=t[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class pu{constructor(t,r,n,l,u){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=n,t._y=l,this.properties=t.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class fu{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Cs(Mt,16,0),this.grid3D=new Cs(Mt,16,0),this.featureIndexArray=new Kt,this.promoteId=r}insert(t,r,n,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,l,u);const _=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const v=r[x],w=[1/0,1/0,-1/0,-1/0];for(let I=0;I<v.length;I++){const M=v[I];w[0]=Math.min(w[0],M.x),w[1]=Math.min(w[1],M.y),w[2]=Math.max(w[2],M.x),w[3]=Math.max(w[3],M.y)}w[0]<Mt&&w[1]<Mt&&w[2]>=0&&w[3]>=0&&_.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ns.VectorTile(new kc(this.rawTileData)).layers,this.sourceLayerCoder=new du(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,n,l){this.loadVTLayers();const u=t.params||{},d=Mt/t.tileSize/t.scale,f=Wa(u.filter),_=t.queryGeometry,x=t.queryPadding*d,v=_u(_),w=this.grid.query(v.minX-x,v.minY-x,v.maxX+x,v.maxY+x),I=_u(t.cameraQueryGeometry),M=this.grid3D.query(I.minX-x,I.minY-x,I.maxX+x,I.maxY+x,((F,j,Q,G)=>(function(J,re,ce,we,Le){for(const ye of J)if(re<=ye.x&&ce<=ye.y&&we>=ye.x&&Le>=ye.y)return!0;const ve=[new me(re,ce),new me(re,Le),new me(we,Le),new me(we,ce)];if(J.length>2){for(const ye of ve)if(da(J,ye))return!0}for(let ye=0;ye<J.length-1;ye++)if(Zu(J[ye],J[ye+1],ve))return!0;return!1})(t.cameraQueryGeometry,F-x,j-x,Q+x,G+x)));for(const F of M)w.push(F);w.sort(dp);const k={};let z;for(let F=0;F<w.length;F++){const j=w[F];if(j===z)continue;z=j;const Q=this.featureIndexArray.get(j);let G=null;this.loadMatchingFeature(k,Q.bucketIndex,Q.sourceLayerIndex,Q.featureIndex,f,u.layers,u.availableImages,r,n,l,((J,re,ce)=>(G||(G=bn(J)),re.queryIntersectsFeature(_,J,ce,G,this.z,t.transform,d,t.pixelPosMatrix))))}return k}loadMatchingFeature(t,r,n,l,u,d,f,_,x,v,w){const I=this.bucketLayerIDs[r];if(d&&!(function(F,j){for(let Q=0;Q<F.length;Q++)if(j.indexOf(F[Q])>=0)return!0;return!1})(d,I))return;const M=this.sourceLayerCoder.decode(n),k=this.vtLayers[M].feature(l);if(u.needGeometry){const F=wn(k,!0);if(!u.filter(new dt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new dt(this.tileID.overscaledZ),k))return;const z=this.getId(k,M);for(let F=0;F<I.length;F++){const j=I[F];if(d&&d.indexOf(j)<0)continue;const Q=_[j];if(!Q)continue;let G={};z&&v&&(G=v.getState(Q.sourceLayer||"_geojsonTileLayer",z));const J=vi({},x[j]);J.paint=mu(J.paint,Q.paint,k,G,f),J.layout=mu(J.layout,Q.layout,k,G,f);const re=!w||w(k,Q,G);if(!re)continue;const ce=new pu(k,this.z,this.x,this.y,z);ce.layer=J;let we=t[j];we===void 0&&(we=t[j]=[]),we.push({featureIndex:l,feature:ce,intersectionZ:re})}}lookupSymbolFeatures(t,r,n,l,u,d,f,_){const x={};this.loadVTLayers();const v=Wa(u);for(const w of t)this.loadMatchingFeature(x,n,l,w,v,d,f,_,r);return x}hasLayer(t){for(const r of this.bucketLayerIDs)for(const n of r)if(t===n)return!0;return!1}getId(t,r){let n=t.id;return this.promoteId&&(n=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof n=="boolean"&&(n=Number(n))),n}}function mu(i,t,r,n,l){return Ji(i,((u,d)=>{const f=t instanceof gn?t.get(d):null;return f&&f.evaluate?f.evaluate(r,n,l):f}))}function _u(i){let t=1/0,r=1/0,n=-1/0,l=-1/0;for(const u of i)t=Math.min(t,u.x),r=Math.min(r,u.y),n=Math.max(n,u.x),l=Math.max(l,u.y);return{minX:t,minY:r,maxX:n,maxY:l}}function dp(i,t){return t-i}function gu(i,t,r,n,l){const u=[];for(let d=0;d<i.length;d++){const f=i[d];let _;for(let x=0;x<f.length-1;x++){let v=f[x],w=f[x+1];v.x<t&&w.x<t||(v.x<t?v=new me(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x<t&&(w=new me(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y<r&&w.y<r||(v.y<r?v=new me(v.x+(r-v.y)/(w.y-v.y)*(w.x-v.x),r)._round():w.y<r&&(w=new me(v.x+(r-v.y)/(w.y-v.y)*(w.x-v.x),r)._round()),v.x>=n&&w.x>=n||(v.x>=n?v=new me(n,v.y+(n-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x>=n&&(w=new me(n,v.y+(n-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y>=l&&w.y>=l||(v.y>=l?v=new me(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round():w.y>=l&&(w=new me(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round()),_&&v.equals(_[_.length-1])||(_=[v],u.push(_)),_.push(w)))))}}return u}Ie("FeatureIndex",fu,{omit:["rawTileData","sourceLayerCoder"]});class qs extends me{constructor(t,r,n,l){super(t,r),this.angle=n,l!==void 0&&(this.segment=l)}clone(){return new qs(this.x,this.y,this.angle,this.segment)}}function yu(i,t,r,n,l){if(t.segment===void 0||r===0)return!0;let u=t,d=t.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const _=[];let x=0;for(;f<r/2;){const v=i[d],w=i[d+1];if(!w)return!1;let I=i[d-1].angleTo(v)-v.angleTo(w);for(I=Math.abs((I+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:I}),x+=I;f-_[0].distance>n;)x-=_.shift().angleDelta;if(x>l)return!1;d++,f+=v.dist(w)}return!0}function xu(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function vu(i,t,r){return i?.6*t*r:0}function bu(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function pp(i,t,r,n,l,u){const d=vu(r,l,u),f=bu(r,n)*u;let _=0;const x=xu(i)/2;for(let v=0;v<i.length-1;v++){const w=i[v],I=i[v+1],M=w.dist(I);if(_+M>x){const k=(x-_)/M,z=ii.number(w.x,I.x,k),F=ii.number(w.y,I.y,k),j=new qs(z,F,I.angleTo(w),v);return j._round(),!d||yu(i,j,f,d,t)?j:void 0}_+=M}}function fp(i,t,r,n,l,u,d,f,_){const x=vu(n,u,d),v=bu(n,l),w=v*d,I=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return t-w<t/4&&(t=w+t/4),wu(i,I?t/2*f%t:(v/2+2*u)*d*f%t,t,x,r,w,I,!1,_)}function wu(i,t,r,n,l,u,d,f,_){const x=u/2,v=xu(i);let w=0,I=t-r,M=[];for(let k=0;k<i.length-1;k++){const z=i[k],F=i[k+1],j=z.dist(F),Q=F.angleTo(z);for(;I+r<w+j;){I+=r;const G=(I-w)/j,J=ii.number(z.x,F.x,G),re=ii.number(z.y,F.y,G);if(J>=0&&J<_&&re>=0&&re<_&&I-x>=0&&I+x<=v){const ce=new qs(J,re,Q,k);ce._round(),n&&!yu(i,ce,u,n,l)||M.push(ce)}}w+=j}return f||M.length||d||(M=wu(i,w/2,r,n,l,u,d,!0,_)),M}Ie("Anchor",qs);const va=yi;function Tu(i,t,r,n){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*va,_=u.paddedRect.h-2*va;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const v=u.stretchX||[[0,f]],w=u.stretchY||[[0,_]],I=(ae,ze)=>ae+ze[1]-ze[0],M=v.reduce(I,0),k=w.reduce(I,0),z=f-M,F=_-k;let j=0,Q=M,G=0,J=k,re=0,ce=z,we=0,Le=F;if(u.content&&n){const ae=u.content,ze=ae[2]-ae[0],Ce=ae[3]-ae[1];(u.textFitWidth||u.textFitHeight)&&(x=Kh(i)),j=El(v,0,ae[0]),G=El(w,0,ae[1]),Q=El(v,ae[0],ae[2]),J=El(w,ae[1],ae[3]),re=ae[0]-j,we=ae[1]-G,ce=ze-Q,Le=Ce-J}const ve=x.x1,ye=x.y1,ke=x.x2-ve,Pe=x.y2-ye,Se=(ae,ze,Ce,Oe)=>{const ct=Dl(ae.stretch-j,Q,ke,ve),lt=Ll(ae.fixed-re,ce,ae.stretch,M),zt=Dl(ze.stretch-G,J,Pe,ye),lr=Ll(ze.fixed-we,Le,ze.stretch,k),$t=Dl(Ce.stretch-j,Q,ke,ve),Et=Ll(Ce.fixed-re,ce,Ce.stretch,M),ai=Dl(Oe.stretch-G,J,Pe,ye),oi=Ll(Oe.fixed-we,Le,Oe.stretch,k),li=new me(ct,zt),Tt=new me($t,zt),Dt=new me($t,ai),Yt=new me(ct,ai),qt=new me(lt/d,lr/d),ci=new me(Et/d,oi/d),Zt=t*Math.PI/180;if(Zt){const Qe=Math.sin(Zt),ut=Math.cos(Zt),_t=[ut,-Qe,Qe,ut];li._matMult(_t),Tt._matMult(_t),Yt._matMult(_t),Dt._matMult(_t)}const Zi=ae.stretch+ae.fixed,xi=ze.stretch+ze.fixed;return{tl:li,tr:Tt,bl:Yt,br:Dt,tex:{x:u.paddedRect.x+va+Zi,y:u.paddedRect.y+va+xi,w:Ce.stretch+Ce.fixed-Zi,h:Oe.stretch+Oe.fixed-xi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qt,pixelOffsetBR:ci,minFontScaleX:ce/d/ke,minFontScaleY:Le/d/Pe,isSDF:r}};if(n&&(u.stretchX||u.stretchY)){const ae=Su(v,z,M),ze=Su(w,F,k);for(let Ce=0;Ce<ae.length-1;Ce++){const Oe=ae[Ce],ct=ae[Ce+1];for(let lt=0;lt<ze.length-1;lt++)l.push(Se(Oe,ze[lt],ct,ze[lt+1]))}}else l.push(Se({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:_+1}));return l}function El(i,t,r){let n=0;for(const l of i)n+=Math.max(t,Math.min(r,l[1]))-Math.max(t,Math.min(r,l[0]));return n}function Su(i,t,r){const n=[{fixed:-va,stretch:0}];for(const[l,u]of i){const d=n[n.length-1];n.push({fixed:l-d.stretch,stretch:d.stretch}),n.push({fixed:l-d.stretch,stretch:d.stretch+(u-l)})}return n.push({fixed:t+va,stretch:r}),n}function Dl(i,t,r,n){return i/t*r+n}function Ll(i,t,r,n){return i-t*r/n}class Rl{constructor(t,r,n,l,u,d,f,_,x,v){var w;if(this.boxStartIndex=t.length,x){let I=d.top,M=d.bottom;const k=d.collisionPadding;k&&(I-=k[1],M+=k[3]);let z=M-I;z>0&&(z=Math.max(10,z),this.circleDiameter=z)}else{const I=!((w=d.image)===null||w===void 0)&&w.content&&(d.image.textFitWidth||d.image.textFitHeight)?Kh(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};I.y1=I.y1*f-_[0],I.y2=I.y2*f+_[2],I.x1=I.x1*f-_[3],I.x2=I.x2*f+_[1];const M=d.collisionPadding;if(M&&(I.x1-=M[0]*f,I.y1-=M[1]*f,I.x2+=M[2]*f,I.y2+=M[3]*f),v){const k=new me(I.x1,I.y1),z=new me(I.x2,I.y1),F=new me(I.x1,I.y2),j=new me(I.x2,I.y2),Q=v*Math.PI/180;k._rotate(Q),z._rotate(Q),F._rotate(Q),j._rotate(Q),I.x1=Math.min(k.x,z.x,F.x,j.x),I.x2=Math.max(k.x,z.x,F.x,j.x),I.y1=Math.min(k.y,z.y,F.y,j.y),I.y2=Math.max(k.y,z.y,F.y,j.y)}t.emplaceBack(r.x,r.y,I.x1,I.y1,I.x2,I.y2,n,l,u)}this.boxEndIndex=t.length}}class mp{constructor(t=[],r=((n,l)=>n<l?-1:n>l?1:0)){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:n}=this,l=r[t];for(;t>0;){const u=t-1>>1,d=r[u];if(n(l,d)>=0)break;r[t]=d,t=u}r[t]=l}_down(t){const{data:r,compare:n}=this,l=this.length>>1,u=r[t];for(;t<l;){let d=1+(t<<1);const f=d+1;if(f<this.length&&n(r[f],r[d])<0&&(d=f),n(r[d],u)>=0)break;r[t]=r[d],t=d}r[t]=u}}function _p(i,t=1,r=!1){let n=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let M=0;M<f.length;M++){const k=f[M];(!M||k.x<n)&&(n=k.x),(!M||k.y<l)&&(l=k.y),(!M||k.x>u)&&(u=k.x),(!M||k.y>d)&&(d=k.y)}const _=Math.min(u-n,d-l);let x=_/2;const v=new mp([],gp);if(_===0)return new me(n,l);for(let M=n;M<u;M+=_)for(let k=l;k<d;k+=_)v.push(new ba(M+x,k+x,x,i));let w=(function(M){let k=0,z=0,F=0;const j=M[0];for(let Q=0,G=j.length,J=G-1;Q<G;J=Q++){const re=j[Q],ce=j[J],we=re.x*ce.y-ce.x*re.y;z+=(re.x+ce.x)*we,F+=(re.y+ce.y)*we,k+=3*we}return new ba(z/k,F/k,0,M)})(i),I=v.length;for(;v.length;){const M=v.pop();(M.d>w.d||!w.d)&&(w=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,I)),M.max-w.d<=t||(x=M.h/2,v.push(new ba(M.p.x-x,M.p.y-x,x,i)),v.push(new ba(M.p.x+x,M.p.y-x,x,i)),v.push(new ba(M.p.x-x,M.p.y+x,x,i)),v.push(new ba(M.p.x+x,M.p.y+x,x,i)),I+=4)}return r&&(console.log(`num probes: ${I}`),console.log(`best distance: ${w.d}`)),w.p}function gp(i,t){return t.max-i.max}function ba(i,t,r,n){this.p=new me(i,t),this.h=r,this.d=(function(l,u){let d=!1,f=1/0;for(let _=0;_<u.length;_++){const x=u[_];for(let v=0,w=x.length,I=w-1;v<w;I=v++){const M=x[v],k=x[I];M.y>l.y!=k.y>l.y&&l.x<(k.x-M.x)*(l.y-M.y)/(k.y-M.y)+M.x&&(d=!d),f=Math.min(f,oh(l,M,k))}}return(d?1:-1)*Math.sqrt(f)})(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Ut;L.aq=void 0,(Ut=L.aq||(L.aq={}))[Ut.center=1]="center",Ut[Ut.left=2]="left",Ut[Ut.right=3]="right",Ut[Ut.top=4]="top",Ut[Ut.bottom=5]="bottom",Ut[Ut["top-left"]=6]="top-left",Ut[Ut["top-right"]=7]="top-right",Ut[Ut["bottom-left"]=8]="bottom-left",Ut[Ut["bottom-right"]=9]="bottom-right";const Zs=7,$c=Number.POSITIVE_INFINITY;function Iu(i,t){return t[1]!==$c?(function(r,n,l){let u=0,d=0;switch(n=Math.abs(n),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-Zs;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+Zs}switch(r){case"top-right":case"bottom-right":case"right":u=-n;break;case"top-left":case"bottom-left":case"left":u=n}return[u,d]})(i,t[0],t[1]):(function(r,n){let l=0,u=0;n<0&&(n=0);const d=n/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-Zs;break;case"bottom-right":case"bottom-left":u=-d+Zs;break;case"bottom":u=-n+Zs;break;case"top":u=n-Zs}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=n;break;case"right":l=-n}return[l,u]})(i,t[0])}function Pu(i,t,r){var n;const l=i.layout,u=(n=l.get("text-variable-anchor-offset"))===null||n===void 0?void 0:n.evaluate(t,{},r);if(u){const f=u.values,_=[];for(let x=0;x<f.length;x+=2){const v=_[x]=f[x],w=f[x+1].map((I=>I*Ct));v.startsWith("top")?w[1]-=Zs:v.startsWith("bottom")&&(w[1]+=Zs),_[x+1]=w}return new wi(_)}const d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*Ct,$c]:l.get("text-offset").evaluate(t,{},r).map((x=>x*Ct));const _=[];for(const x of d)_.push(x,Iu(x,f));return new wi(_)}return null}function qc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function yp(i,t,r,n,l,u,d,f,_,x,v){let w=u.textMaxSize.evaluate(t,{});w===void 0&&(w=d);const I=i.layers[0].layout,M=I.get("icon-offset").evaluate(t,{},v),k=Mu(r.horizontal),z=d/24,F=i.tilePixelRatio*z,j=i.tilePixelRatio*w/24,Q=i.tilePixelRatio*f,G=i.tilePixelRatio*I.get("symbol-spacing"),J=I.get("text-padding")*i.tilePixelRatio,re=(function(ae,ze,Ce,Oe=1){const ct=ae.get("icon-padding").evaluate(ze,{},Ce),lt=ct&&ct.values;return[lt[0]*Oe,lt[1]*Oe,lt[2]*Oe,lt[3]*Oe]})(I,t,v,i.tilePixelRatio),ce=I.get("text-max-angle")/180*Math.PI,we=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point",Le=I.get("icon-rotation-alignment")==="map"&&I.get("symbol-placement")!=="point",ve=I.get("symbol-placement"),ye=G/2,ke=I.get("icon-text-fit");let Pe;n&&ke!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Pe=Jh(n,r.vertical,ke,I.get("icon-text-fit-padding"),M,z)),k&&(n=Jh(n,k,ke,I.get("icon-text-fit-padding"),M,z)));const Se=(ae,ze)=>{ze.x<0||ze.x>=Mt||ze.y<0||ze.y>=Mt||(function(Ce,Oe,ct,lt,zt,lr,$t,Et,ai,oi,li,Tt,Dt,Yt,qt,ci,Zt,Zi,xi,Qe,ut,_t,Ci,vt,wa){const Lr=Ce.addToLineVertexArray(Oe,ct);let Rr,cr,Gi,Bt,ns=0,Lo=0,Eu=0,Du=0,Yc=-1,Qc=-1;const as={};let Lu=la("");if(Ce.allowVerticalPlacement&&lt.vertical){const Qt=Et.layout.get("text-rotate").evaluate(ut,{},vt)+90;Gi=new Rl(ai,Oe,oi,li,Tt,lt.vertical,Dt,Yt,qt,Qt),$t&&(Bt=new Rl(ai,Oe,oi,li,Tt,$t,Zt,Zi,qt,Qt))}if(zt){const Qt=Et.layout.get("icon-rotate").evaluate(ut,{}),Hi=Et.layout.get("icon-text-fit")!=="none",Sn=Tu(zt,Qt,Ci,Hi),vr=$t?Tu($t,Qt,Ci,Hi):void 0;cr=new Rl(ai,Oe,oi,li,Tt,zt,Zt,Zi,!1,Qt),ns=4*Sn.length;const In=Ce.iconSizeData;let Br=null;In.kind==="source"?(Br=[Dr*Et.layout.get("icon-size").evaluate(ut,{})],Br[0]>Us&&Ft(`${Ce.layerIds[0]}: Value for "icon-size" is >= ${Co}. Reduce your "icon-size".`)):In.kind==="composite"&&(Br=[Dr*_t.compositeIconSizes[0].evaluate(ut,{},vt),Dr*_t.compositeIconSizes[1].evaluate(ut,{},vt)],(Br[0]>Us||Br[1]>Us)&&Ft(`${Ce.layerIds[0]}: Value for "icon-size" is >= ${Co}. Reduce your "icon-size".`)),Ce.addSymbols(Ce.icon,Sn,Br,Qe,xi,ut,L.ah.none,Oe,Lr.lineStartIndex,Lr.lineLength,-1,vt),Yc=Ce.icon.placedSymbolArray.length-1,vr&&(Lo=4*vr.length,Ce.addSymbols(Ce.icon,vr,Br,Qe,xi,ut,L.ah.vertical,Oe,Lr.lineStartIndex,Lr.lineLength,-1,vt),Qc=Ce.icon.placedSymbolArray.length-1)}const Ru=Object.keys(lt.horizontal);for(const Qt of Ru){const Hi=lt.horizontal[Qt];if(!Rr){Lu=la(Hi.text);const vr=Et.layout.get("text-rotate").evaluate(ut,{},vt);Rr=new Rl(ai,Oe,oi,li,Tt,Hi,Dt,Yt,qt,vr)}const Sn=Hi.positionedLines.length===1;if(Eu+=Au(Ce,Oe,Hi,lr,Et,qt,ut,ci,Lr,lt.vertical?L.ah.horizontal:L.ah.horizontalOnly,Sn?Ru:[Qt],as,Yc,_t,vt),Sn)break}lt.vertical&&(Du+=Au(Ce,Oe,lt.vertical,lr,Et,qt,ut,ci,Lr,L.ah.vertical,["vertical"],as,Qc,_t,vt));const bp=Rr?Rr.boxStartIndex:Ce.collisionBoxArray.length,wp=Rr?Rr.boxEndIndex:Ce.collisionBoxArray.length,Tp=Gi?Gi.boxStartIndex:Ce.collisionBoxArray.length,Sp=Gi?Gi.boxEndIndex:Ce.collisionBoxArray.length,Ip=cr?cr.boxStartIndex:Ce.collisionBoxArray.length,Pp=cr?cr.boxEndIndex:Ce.collisionBoxArray.length,Ap=Bt?Bt.boxStartIndex:Ce.collisionBoxArray.length,Mp=Bt?Bt.boxEndIndex:Ce.collisionBoxArray.length;let xr=-1;const Fl=(Qt,Hi)=>Qt&&Qt.circleDiameter?Math.max(Qt.circleDiameter,Hi):Hi;xr=Fl(Rr,xr),xr=Fl(Gi,xr),xr=Fl(cr,xr),xr=Fl(Bt,xr);const Bu=xr>-1?1:0;Bu&&(xr*=wa/Ct),Ce.glyphOffsetArray.length>=xa.MAX_GLYPHS&&Ft("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ut.sortKey!==void 0&&Ce.addToSortKeyRanges(Ce.symbolInstances.length,ut.sortKey);const Cp=Pu(Et,ut,vt),[kp,zp]=(function(Qt,Hi){const Sn=Qt.length,vr=Hi==null?void 0:Hi.values;if((vr==null?void 0:vr.length)>0)for(let In=0;In<vr.length;In+=2){const Br=vr[In+1];Qt.emplaceBack(L.aq[vr[In]],Br[0],Br[1])}return[Sn,Qt.length]})(Ce.textAnchorOffsets,Cp);Ce.symbolInstances.emplaceBack(Oe.x,Oe.y,as.right>=0?as.right:-1,as.center>=0?as.center:-1,as.left>=0?as.left:-1,as.vertical||-1,Yc,Qc,Lu,bp,wp,Tp,Sp,Ip,Pp,Ap,Mp,oi,Eu,Du,ns,Lo,Bu,0,Dt,xr,kp,zp)})(i,ze,ae,r,n,l,Pe,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,F,[J,J,J,J],we,_,Q,re,Le,M,t,u,x,v,d)};if(ve==="line")for(const ae of gu(t.geometry,0,0,Mt,Mt)){const ze=fp(ae,G,ce,r.vertical||k,n,24,j,i.overscaling,Mt);for(const Ce of ze)k&&xp(i,k.text,ye,Ce)||Se(ae,Ce)}else if(ve==="line-center"){for(const ae of t.geometry)if(ae.length>1){const ze=pp(ae,ce,r.vertical||k,n,24,j);ze&&Se(ae,ze)}}else if(t.type==="Polygon")for(const ae of On(t.geometry,0)){const ze=_p(ae,16);Se(ae[0],new qs(ze.x,ze.y,0))}else if(t.type==="LineString")for(const ae of t.geometry)Se(ae,new qs(ae[0].x,ae[0].y,0));else if(t.type==="Point")for(const ae of t.geometry)for(const ze of ae)Se([ze],new qs(ze.x,ze.y,0))}function Au(i,t,r,n,l,u,d,f,_,x,v,w,I,M,k){const z=(function(Q,G,J,re,ce,we,Le,ve){const ye=re.layout.get("text-rotate").evaluate(we,{})*Math.PI/180,ke=[];for(const Pe of G.positionedLines)for(const Se of Pe.positionedGlyphs){if(!Se.rect)continue;const ae=Se.rect||{};let ze=$h+1,Ce=!0,Oe=1,ct=0;const lt=(ce||ve)&&Se.vertical,zt=Se.metrics.advance*Se.scale/2;if(ve&&G.verticalizable&&(ct=Pe.lineOffset/2-(Se.imageName?-(Ct-Se.metrics.width*Se.scale)/2:(Se.scale-1)*Ct)),Se.imageName){const Qe=Le[Se.imageName];Ce=Qe.sdf,Oe=Qe.pixelRatio,ze=yi/Oe}const lr=ce?[Se.x+zt,Se.y]:[0,0];let $t=ce?[0,0]:[Se.x+zt+J[0],Se.y+J[1]-ct],Et=[0,0];lt&&(Et=$t,$t=[0,0]);const ai=Se.metrics.isDoubleResolution?2:1,oi=(Se.metrics.left-ze)*Se.scale-zt+$t[0],li=(-Se.metrics.top-ze)*Se.scale+$t[1],Tt=oi+ae.w/ai*Se.scale/Oe,Dt=li+ae.h/ai*Se.scale/Oe,Yt=new me(oi,li),qt=new me(Tt,li),ci=new me(oi,Dt),Zt=new me(Tt,Dt);if(lt){const Qe=new me(-zt,zt-Ao),ut=-Math.PI/2,_t=Ct/2-zt,Ci=new me(5-Ao-_t,-(Se.imageName?_t:0)),vt=new me(...Et);Yt._rotateAround(ut,Qe)._add(Ci)._add(vt),qt._rotateAround(ut,Qe)._add(Ci)._add(vt),ci._rotateAround(ut,Qe)._add(Ci)._add(vt),Zt._rotateAround(ut,Qe)._add(Ci)._add(vt)}if(ye){const Qe=Math.sin(ye),ut=Math.cos(ye),_t=[ut,-Qe,Qe,ut];Yt._matMult(_t),qt._matMult(_t),ci._matMult(_t),Zt._matMult(_t)}const Zi=new me(0,0),xi=new me(0,0);ke.push({tl:Yt,tr:qt,bl:ci,br:Zt,tex:ae,writingMode:G.writingMode,glyphOffset:lr,sectionIndex:Se.sectionIndex,isSDF:Ce,pixelOffsetTL:Zi,pixelOffsetBR:xi,minFontScaleX:0,minFontScaleY:0})}return ke})(0,r,f,l,u,d,n,i.allowVerticalPlacement),F=i.textSizeData;let j=null;F.kind==="source"?(j=[Dr*l.layout.get("text-size").evaluate(d,{})],j[0]>Us&&Ft(`${i.layerIds[0]}: Value for "text-size" is >= ${Co}. Reduce your "text-size".`)):F.kind==="composite"&&(j=[Dr*M.compositeTextSizes[0].evaluate(d,{},k),Dr*M.compositeTextSizes[1].evaluate(d,{},k)],(j[0]>Us||j[1]>Us)&&Ft(`${i.layerIds[0]}: Value for "text-size" is >= ${Co}. Reduce your "text-size".`)),i.addSymbols(i.text,z,j,f,u,d,x,t,_.lineStartIndex,_.lineLength,I,k);for(const Q of v)w[Q]=i.text.placedSymbolArray.length-1;return 4*z.length}function Mu(i){for(const t in i)return i[t];return null}function xp(i,t,r,n){const l=i.compareText;if(t in l){const u=l[t];for(let d=u.length-1;d>=0;d--)if(n.dist(u[d])<r)return!0}else l[t]=[];return l[t].push(n),!1}const Cu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Zc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=n>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=Cu[15&n];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new Zc(f,d,u,t)}constructor(t,r=64,n=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const u=Cu.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+_,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+_),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+_,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=r,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Gc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,n,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){const v=_.pop()||0,w=_.pop()||0,I=_.pop()||0;if(w-I<=f){for(let F=I;F<=w;F++){const j=d[2*F],Q=d[2*F+1];j>=t&&j<=n&&Q>=r&&Q<=l&&x.push(u[F])}continue}const M=I+w>>1,k=d[2*M],z=d[2*M+1];k>=t&&k<=n&&z>=r&&z<=l&&x.push(u[M]),(v===0?t<=k:r<=z)&&(_.push(I),_.push(M-1),_.push(1-v)),(v===0?n>=k:l>=z)&&(_.push(M+1),_.push(w),_.push(1-v))}return x}within(t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],_=[],x=n*n;for(;f.length;){const v=f.pop()||0,w=f.pop()||0,I=f.pop()||0;if(w-I<=d){for(let F=I;F<=w;F++)zu(u[2*F],u[2*F+1],t,r)<=x&&_.push(l[F]);continue}const M=I+w>>1,k=u[2*M],z=u[2*M+1];zu(k,z,t,r)<=x&&_.push(l[M]),(v===0?t-n<=k:r-n<=z)&&(f.push(I),f.push(M-1),f.push(1-v)),(v===0?t+n>=k:r+n>=z)&&(f.push(M+1),f.push(w),f.push(1-v))}return _}}function Gc(i,t,r,n,l,u){if(l-n<=r)return;const d=n+l>>1;ku(i,t,d,n,l,u),Gc(i,t,r,n,d-1,1-u),Gc(i,t,r,d+1,l,1-u)}function ku(i,t,r,n,l,u){for(;l>n;){if(l-n>600){const x=l-n+1,v=r-n+1,w=Math.log(x),I=.5*Math.exp(2*w/3),M=.5*Math.sqrt(w*I*(x-I)/x)*(v-x/2<0?-1:1);ku(i,t,r,Math.max(n,Math.floor(r-v*I/x+M)),Math.min(l,Math.floor(r+(x-v)*I/x+M)),u)}const d=t[2*r+u];let f=n,_=l;for(Eo(i,t,n,r),t[2*l+u]>d&&Eo(i,t,n,l);f<_;){for(Eo(i,t,f,_),f++,_--;t[2*f+u]<d;)f++;for(;t[2*_+u]>d;)_--}t[2*n+u]===d?Eo(i,t,n,_):(_++,Eo(i,t,_,l)),_<=r&&(n=_+1),r<=_&&(l=_-1)}}function Eo(i,t,r,n){Hc(i,r,n),Hc(t,2*r,2*n),Hc(t,2*r+1,2*n+1)}function Hc(i,t,r){const n=i[t];i[t]=i[r],i[r]=n}function zu(i,t,r,n){const l=i-r,u=t-n;return l*l+u*u}var Xc;L.bg=void 0,(Xc=L.bg||(L.bg={})).create="create",Xc.load="load",Xc.fullLoad="fullLoad";let Bl=null,Do=[];const Wc=1e3/60,Kc="loadTime",Jc="fullLoadTime",vp={mark(i){performance.mark(i)},frame(i){const t=i;Bl!=null&&Do.push(t-Bl),Bl=t},clearMetrics(){Bl=null,Do=[],performance.clearMeasures(Kc),performance.clearMeasures(Jc);for(const i in L.bg)performance.clearMarks(L.bg[i])},getPerformanceMetrics(){performance.measure(Kc,L.bg.create,L.bg.load),performance.measure(Jc,L.bg.create,L.bg.fullLoad);const i=performance.getEntriesByName(Kc)[0].duration,t=performance.getEntriesByName(Jc)[0].duration,r=Do.length,n=1/(Do.reduce(((u,d)=>u+d),0)/r/1e3),l=Do.filter((u=>u>Wc)).reduce(((u,d)=>u+(d-Wc)/Wc),0);return{loadTime:i,fullLoadTime:t,fps:n,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};L.$=class extends T{},L.A=pa,L.B=nc,L.C=function(i){if(os==null){const t=i.navigator?i.navigator.userAgent:null;os=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return os},L.D=Ae,L.E=hs,L.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new up((()=>this.process())),this.subscription=(function(r,n,l,u){return r.addEventListener(n,l,!1),{unsubscribe:()=>{r.removeEventListener(n,l,!1)}}})(this.target,"message",(r=>this.receive(r))),this.globalScope=ur(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise(((r,n)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:n},t&&t.signal.addEventListener("abort",(()=>{delete this.resolveRejects[l];const f={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)}),{once:!0});const u=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:ks(i.data,u)});this.target.postMessage(d,{transfer:u})}))}receive(i){const t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const n=this.abortControllers[r];return delete this.abortControllers[r],void(n&&n.abort())}if(ur(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,(function*(){if(t.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(zs(t.error)):l.resolve(zs(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=zs(t.data),n=new AbortController;this.abortControllers[i]=n;try{const l=yield this.messageHandlers[t.type](t.sourceMapId,r,n);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}}))}completeTask(i,t,r){const n=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?ks(t):null,data:ks(r,n)};this.target.postMessage(l,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},L.G=cs,L.H=function(){var i=new pa(16);return pa!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},L.I=Ec,L.J=function(i,t,r){var n,l,u,d,f,_,x,v,w,I,M,k,z=r[0],F=r[1],j=r[2];return t===i?(i[12]=t[0]*z+t[4]*F+t[8]*j+t[12],i[13]=t[1]*z+t[5]*F+t[9]*j+t[13],i[14]=t[2]*z+t[6]*F+t[10]*j+t[14],i[15]=t[3]*z+t[7]*F+t[11]*j+t[15]):(l=t[1],u=t[2],d=t[3],f=t[4],_=t[5],x=t[6],v=t[7],w=t[8],I=t[9],M=t[10],k=t[11],i[0]=n=t[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=_,i[6]=x,i[7]=v,i[8]=w,i[9]=I,i[10]=M,i[11]=k,i[12]=n*z+f*F+w*j+t[12],i[13]=l*z+_*F+I*j+t[13],i[14]=u*z+x*F+M*j+t[14],i[15]=d*z+v*F+k*j+t[15]),i},L.K=function(i,t,r){var n=r[0],l=r[1],u=r[2];return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*n,i[3]=t[3]*n,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*u,i[9]=t[9]*u,i[10]=t[10]*u,i[11]=t[11]*u,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},L.L=uh,L.M=function(i,t){const r={};for(let n=0;n<t.length;n++){const l=t[n];l in i&&(r[l]=i[l])}return r},L.N=$s,L.O=au,L.P=me,L.Q=ou,L.R=$i,L.S=qi,L.T=ra,L.U=hr,L.V=Gs,L.W=Nr,L.X=Mt,L.Y=m,L.Z=ko,L._=p,L.a=Tr,L.a$=function(i,t){var r=i[0],n=i[1],l=i[2],u=i[3],d=i[4],f=i[5],_=i[6],x=i[7],v=i[8],w=i[9],I=i[10],M=i[11],k=i[12],z=i[13],F=i[14],j=i[15],Q=t[0],G=t[1],J=t[2],re=t[3],ce=t[4],we=t[5],Le=t[6],ve=t[7],ye=t[8],ke=t[9],Pe=t[10],Se=t[11],ae=t[12],ze=t[13],Ce=t[14],Oe=t[15];return Math.abs(r-Q)<=ni*Math.max(1,Math.abs(r),Math.abs(Q))&&Math.abs(n-G)<=ni*Math.max(1,Math.abs(n),Math.abs(G))&&Math.abs(l-J)<=ni*Math.max(1,Math.abs(l),Math.abs(J))&&Math.abs(u-re)<=ni*Math.max(1,Math.abs(u),Math.abs(re))&&Math.abs(d-ce)<=ni*Math.max(1,Math.abs(d),Math.abs(ce))&&Math.abs(f-we)<=ni*Math.max(1,Math.abs(f),Math.abs(we))&&Math.abs(_-Le)<=ni*Math.max(1,Math.abs(_),Math.abs(Le))&&Math.abs(x-ve)<=ni*Math.max(1,Math.abs(x),Math.abs(ve))&&Math.abs(v-ye)<=ni*Math.max(1,Math.abs(v),Math.abs(ye))&&Math.abs(w-ke)<=ni*Math.max(1,Math.abs(w),Math.abs(ke))&&Math.abs(I-Pe)<=ni*Math.max(1,Math.abs(I),Math.abs(Pe))&&Math.abs(M-Se)<=ni*Math.max(1,Math.abs(M),Math.abs(Se))&&Math.abs(k-ae)<=ni*Math.max(1,Math.abs(k),Math.abs(ae))&&Math.abs(z-ze)<=ni*Math.max(1,Math.abs(z),Math.abs(ze))&&Math.abs(F-Ce)<=ni*Math.max(1,Math.abs(F),Math.abs(Ce))&&Math.abs(j-Oe)<=ni*Math.max(1,Math.abs(j),Math.abs(Oe))},L.a0=We,L.a1=Uc,L.a2=ue,L.a3=i=>{const t=window.document.createElement("video");return t.muted=!0,new Promise((r=>{t.onloadstart=()=>{r(t)};for(const n of i){const l=window.document.createElement("source");Ur(n)||(t.crossOrigin="Anonymous"),l.src=n,t.appendChild(l)}}))},L.a4=function(){return Pn++},L.a5=be,L.a6=xa,L.a7=Wa,L.a8=wn,L.a9=pu,L.aA=function(i){if(i.type==="custom")return new hp(i);switch(i.type){case"background":return new op(i);case"circle":return new Xu(i);case"fill":return new ud(i);case"fill-extrusion":return new Pd(i);case"heatmap":return new Ku(i);case"hillshade":return new Yu(i);case"line":return new Ld(i);case"raster":return new cp(i);case"symbol":return new zl(i)}},L.aB=nt,L.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!et(i.version,t.version))return[{command:"setStyle",args:[t]}];et(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),et(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),et(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),et(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),et(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),et(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),et(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),et(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),et(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),et(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),et(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const n={},l=[];(function(d,f,_,x){let v;for(v in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(f,v)||Pr(v,_,x));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(d,v)?et(d[v],f[v])||(d[v].type==="geojson"&&f[v].type==="geojson"&&us(d,f,v)?yt(_,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):fr(v,f,_,x)):Ks(v,f,_))})(i.sources,t.sources,l,n);const u=[];i.layers&&i.layers.forEach((d=>{"source"in d&&n[d.source]?r.push({command:"removeLayer",args:[d.id]}):u.push(d)})),r=r.concat(l),(function(d,f,_){f=f||[];const x=(d=d||[]).map(Js),v=f.map(Js),w=d.reduce(Ys,{}),I=f.reduce(Ys,{}),M=x.slice(),k=Object.create(null);let z,F,j,Q,G;for(let J=0,re=0;J<x.length;J++)z=x[J],Object.prototype.hasOwnProperty.call(I,z)?re++:(yt(_,{command:"removeLayer",args:[z]}),M.splice(M.indexOf(z,re),1));for(let J=0,re=0;J<v.length;J++)z=v[v.length-1-J],M[M.length-1-J]!==z&&(Object.prototype.hasOwnProperty.call(w,z)?(yt(_,{command:"removeLayer",args:[z]}),M.splice(M.lastIndexOf(z,M.length-re),1)):re++,Q=M[M.length-J],yt(_,{command:"addLayer",args:[I[z],Q]}),M.splice(M.length-J,0,z),k[z]=!0);for(let J=0;J<v.length;J++)if(z=v[J],F=w[z],j=I[z],!k[z]&&!et(F,j))if(et(F.source,j.source)&&et(F["source-layer"],j["source-layer"])&&et(F.type,j.type)){for(G in bi(F.layout,j.layout,_,z,null,"setLayoutProperty"),bi(F.paint,j.paint,_,z,null,"setPaintProperty"),et(F.filter,j.filter)||yt(_,{command:"setFilter",args:[z,j.filter]}),et(F.minzoom,j.minzoom)&&et(F.maxzoom,j.maxzoom)||yt(_,{command:"setLayerZoomRange",args:[z,j.minzoom,j.maxzoom]}),F)Object.prototype.hasOwnProperty.call(F,G)&&G!=="layout"&&G!=="paint"&&G!=="filter"&&G!=="metadata"&&G!=="minzoom"&&G!=="maxzoom"&&(G.indexOf("paint.")===0?bi(F[G],j[G],_,z,G.slice(6),"setPaintProperty"):et(F[G],j[G])||yt(_,{command:"setLayerProperty",args:[z,G,j[G]]}));for(G in j)Object.prototype.hasOwnProperty.call(j,G)&&!Object.prototype.hasOwnProperty.call(F,G)&&G!=="layout"&&G!=="paint"&&G!=="filter"&&G!=="metadata"&&G!=="minzoom"&&G!=="maxzoom"&&(G.indexOf("paint.")===0?bi(F[G],j[G],_,z,G.slice(6),"setPaintProperty"):et(F[G],j[G])||yt(_,{command:"setLayerProperty",args:[z,G,j[G]]}))}else yt(_,{command:"removeLayer",args:[z]}),Q=M[M.lastIndexOf(z)+1],yt(_,{command:"addLayer",args:[j,Q]})})(u,t.layers,r)}catch(n){console.warn("Unable to compute style diff:",n),r=[{command:"setStyle",args:[t]}]}return r},L.aD=function(i){const t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},L.aE=function i(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],r[n]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const n in t)if(!i(t[n],r[n]))return!1;return!0}return t===r},L.aF=Ji,L.aG=Hs,L.aH=class extends xn{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},L.aI=yl,L.aJ=class extends xn{constructor(i,t){super(i,t),this.current=Nu}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},L.aK=eh,L.aL=th,L.aM=st,L.aN=class extends xn{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},L.aO=class extends xn{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},L.aP=function(i,t,r,n,l,u,d){var f=1/(t-r),_=1/(n-l),x=1/(u-d);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(t+r)*f,i[13]=(l+n)*_,i[14]=(d+u)*x,i[15]=1,i},L.aQ=Hu,L.aR=class extends X{},L.aS=Od,L.aT=class extends ee{},L.aU=vc,L.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},L.aW=_h,L.aX=Nt,L.aY=Ui,L.aZ=class extends Me{},L.a_=function(i,t){return i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]&&i[9]===t[9]&&i[10]===t[10]&&i[11]===t[11]&&i[12]===t[12]&&i[13]===t[13]&&i[14]===t[14]&&i[15]===t[15]},L.aa=function(i){const t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((r,n,l,u)=>{const d=l||u;return t[n]=!d||d.toLowerCase(),""})),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},L.ab=function(i,t){const r=[];for(const n in i)n in t||r.push(n);return r},L.ac=Ei,L.ad=function(i,t,r){var n=Math.sin(r),l=Math.cos(r),u=t[0],d=t[1],f=t[2],_=t[3],x=t[4],v=t[5],w=t[6],I=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=u*l+x*n,i[1]=d*l+v*n,i[2]=f*l+w*n,i[3]=_*l+I*n,i[4]=x*l-u*n,i[5]=v*l-d*n,i[6]=w*l-f*n,i[7]=I*l-_*n,i},L.ae=function(i){var t=new pa(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},L.af=wl,L.ag=function(i,t){let r=0,n=0;if(i.kind==="constant")n=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?Ei(ri.interpolationFactor(l,t,u,d),0,1):0;i.kind==="camera"?n=ii.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:n}},L.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:n,upperSize:l}){return i.kind==="source"?n/Dr:i.kind==="composite"?ii.number(n/Dr,l/Dr,r):t},L.aj=Bc,L.ak=function(i,t,r,n){const l=t.y-i.y,u=t.x-i.x,d=n.y-r.y,f=n.x-r.x,_=d*u-f*l;if(_===0)return null;const x=(f*(i.y-r.y)-d*(i.x-r.x))/_;return new me(i.x+x*u,i.y+x*l)},L.al=gu,L.am=nh,L.an=gc,L.ao=function(i){let t=1/0,r=1/0,n=-1/0,l=-1/0;for(const u of i)t=Math.min(t,u.x),r=Math.min(r,u.y),n=Math.max(n,u.x),l=Math.max(l,u.y);return[t,r,n,l]},L.ap=Ct,L.ar=Rc,L.as=function(i,t){var r=t[0],n=t[1],l=t[2],u=t[3],d=t[4],f=t[5],_=t[6],x=t[7],v=t[8],w=t[9],I=t[10],M=t[11],k=t[12],z=t[13],F=t[14],j=t[15],Q=r*f-n*d,G=r*_-l*d,J=r*x-u*d,re=n*_-l*f,ce=n*x-u*f,we=l*x-u*_,Le=v*z-w*k,ve=v*F-I*k,ye=v*j-M*k,ke=w*F-I*z,Pe=w*j-M*z,Se=I*j-M*F,ae=Q*Se-G*Pe+J*ke+re*ye-ce*ve+we*Le;return ae?(i[0]=(f*Se-_*Pe+x*ke)*(ae=1/ae),i[1]=(l*Pe-n*Se-u*ke)*ae,i[2]=(z*we-F*ce+j*re)*ae,i[3]=(I*ce-w*we-M*re)*ae,i[4]=(_*ye-d*Se-x*ve)*ae,i[5]=(r*Se-l*ye+u*ve)*ae,i[6]=(F*J-k*we-j*G)*ae,i[7]=(v*we-I*J+M*G)*ae,i[8]=(d*Pe-f*ye+x*Le)*ae,i[9]=(n*ye-r*Pe-u*Le)*ae,i[10]=(k*ce-z*J+j*Q)*ae,i[11]=(w*J-v*ce-M*Q)*ae,i[12]=(f*ve-d*ke-_*Le)*ae,i[13]=(r*ke-n*ve+l*Le)*ae,i[14]=(z*G-k*re-F*Q)*ae,i[15]=(v*re-w*G+I*Q)*ae,i):null},L.at=qc,L.au=Lc,L.av=Zc,L.aw=function(){const i={},t=ie.$version;for(const r in ie.$root){const n=ie.$root[r];if(n.required){let l=null;l=r==="version"?t:n.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},L.ax=co,L.ay=Li,L.az=function(i){i=i.slice();const t=Object.create(null);for(let r=0;r<i.length;r++)t[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=Ws(i[r],t[i[r].ref]));return i},L.b=Yi,L.b0=function(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},L.b1=function(i,t,r){return i[0]=t[0]*r[0],i[1]=t[1]*r[1],i[2]=t[2]*r[2],i[3]=t[3]*r[3],i},L.b2=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},L.b3=Ki,L.b4=hu,L.b5=lu,L.b6=function(i,t,r,n,l){var u,d=1/Math.tan(t/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+n)*(u=1/(n-l)),i[14]=2*l*n*u):(i[10]=-1,i[14]=-2*n),i},L.b7=function(i,t,r){var n=Math.sin(r),l=Math.cos(r),u=t[4],d=t[5],f=t[6],_=t[7],x=t[8],v=t[9],w=t[10],I=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=u*l+x*n,i[5]=d*l+v*n,i[6]=f*l+w*n,i[7]=_*l+I*n,i[8]=x*l-u*n,i[9]=v*l-d*n,i[10]=w*l-f*n,i[11]=I*l-_*n,i},L.b8=hi,L.b9=Ia,L.bA=Bh,L.bB=function(i){return i.message===Di},L.bC=Ts,L.bD=_i,L.ba=function(i){return i*Math.PI/180},L.bb=function(i,t){const{x:r,y:n}=ko.fromLngLat(t);return!(i<0||i>25||n<0||n>=1||r<0||r>=1)},L.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},L.bd=class extends b{},L.be=Nc,L.bf=vp,L.bh=ui,L.bi=function(i,t){Tr.REGISTERED_PROTOCOLS[i]=t},L.bj=function(i){delete Tr.REGISTERED_PROTOCOLS[i]},L.bk=function(i,t){const r={};for(let l=0;l<i.length;l++){const u=t&&t[i[l].id]||al(i[l]);t&&(t[i[l].id]=u);let d=r[u];d||(d=r[u]=[]),d.push(i[l])}const n=[];for(const l in r)n.push(r[l]);return n},L.bl=Ie,L.bm=du,L.bn=fu,L.bo=Zh,L.bp=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Mt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const t=i.bucket.layers[0],r=t.layout,n=t._unevaluatedLayout._values,l={layoutIconSize:n["icon-size"].possiblyEvaluate(new dt(i.bucket.zoom+1),i.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new dt(i.bucket.zoom+1),i.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new dt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:v}=i.bucket.textSizeData;l.compositeTextSizes=[n["text-size"].possiblyEvaluate(new dt(x),i.canonical),n["text-size"].possiblyEvaluate(new dt(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:v}=i.bucket.iconSizeData;l.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new dt(x),i.canonical),n["icon-size"].possiblyEvaluate(new dt(v),i.canonical)]}const u=r.get("text-line-height")*Ct,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const v=r.get("text-font").evaluate(x,{},i.canonical).join(","),w=_.evaluate(x,{},i.canonical),I=l.layoutTextSize.evaluate(x,{},i.canonical),M=l.layoutIconSize.evaluate(x,{},i.canonical),k={horizontal:{},vertical:void 0},z=x.text;let F,j=[0,0];if(z){const J=z.toString(),re=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*Ct,ce=ac(J)?re:0,we=r.get("text-anchor").evaluate(x,{},i.canonical),Le=Pu(t,x,i.canonical);if(!Le){const Pe=r.get("text-radial-offset").evaluate(x,{},i.canonical);j=Pe?Iu(we,[Pe*Ct,$c]):r.get("text-offset").evaluate(x,{},i.canonical).map((Se=>Se*Ct))}let ve=d?"center":r.get("text-justify").evaluate(x,{},i.canonical);const ye=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*Ct:1/0,ke=()=>{i.bucket.allowVerticalPlacement&&ho(J)&&(k.vertical=Ml(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,u,we,"left",ce,j,L.ah.vertical,!0,I,w))};if(!d&&Le){const Pe=new Set;if(ve==="auto")for(let ae=0;ae<Le.values.length;ae+=2)Pe.add(qc(Le.values[ae]));else Pe.add(ve);let Se=!1;for(const ae of Pe)if(!k.horizontal[ae])if(Se)k.horizontal[ae]=k.horizontal[0];else{const ze=Ml(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,u,"center",ae,ce,j,L.ah.horizontal,!1,I,w);ze&&(k.horizontal[ae]=ze,Se=ze.positionedLines.length===1)}ke()}else{ve==="auto"&&(ve=qc(we));const Pe=Ml(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,u,we,ve,ce,j,L.ah.horizontal,!1,I,w);Pe&&(k.horizontal[ve]=Pe),ke(),ho(J)&&d&&f&&(k.vertical=Ml(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,u,we,ve,ce,j,L.ah.vertical,!1,I,w))}}let Q=!1;if(x.icon&&x.icon.name){const J=i.imageMap[x.icon.name];J&&(F=ip(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),Q=!!J.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=Q:i.bucket.sdfIcons!==Q&&Ft("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(J.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const G=Mu(k.horizontal)||k.vertical;i.bucket.iconsInText=!!G&&G.iconsInText,(G||F)&&yp(i.bucket,x,k,F,i.imageMap,l,I,M,j,Q,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},L.bq=Mc,L.br=Ic,L.bs=Ac,L.bt=Ns,L.bu=kc,L.bv=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},L.bw=function(i,t,r,n,l){return p(this,void 0,void 0,(function*(){if(Gs())try{return yield Nr(i,t,r,n,l)}catch{}return(function(u,d,f,_,x){const v=u.width,w=u.height;dr&&ei||(dr=new OffscreenCanvas(v,w),ei=dr.getContext("2d",{willReadFrequently:!0})),dr.width=v,dr.height=w,ei.drawImage(u,0,0,v,w);const I=ei.getImageData(d,f,_,x);return ei.clearRect(0,0,v,w),I.data})(i,t,r,n,l)}))},L.bx=uu,L.by=zi,L.bz=Xi,L.c=ls,L.d=i=>p(void 0,void 0,void 0,(function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),L.e=vi,L.f=i=>new Promise(((t,r)=>{const n=new Image;n.onload=()=>{t(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame((()=>{n.src=Mn}))},n.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?URL.createObjectURL(l):Mn})),L.g=Qi,L.h=(i,t)=>jr(vi(i,{type:"json"}),t),L.i=ur,L.j=Ir,L.k=Sr,L.l=(i,t)=>jr(vi(i,{type:"arrayBuffer"}),t),L.m=jr,L.n=function(i){return new kc(i).readFields(Wd,[])},L.o=vo,L.p=qh,L.q=h,L.r=sc,L.s=Ur,L.t=oo,L.u=ts,L.v=ie,L.w=Ft,L.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},L.y=ii,L.z=dt})),Or("worker",["./shared"],(function(L){"use strict";class p{constructor(A){this.keyCache={},A&&this.replace(A)}replace(A){this._layerConfigs={},this._layers={},this.update(A,[])}update(A,P){for(const O of A){this._layerConfigs[O.id]=O;const H=this._layers[O.id]=L.aA(O);H._featureFilter=L.a7(H.filter),this.keyCache[O.id]&&delete this.keyCache[O.id]}for(const O of P)delete this.keyCache[O],delete this._layerConfigs[O],delete this._layers[O];this.familiesBySource={};const D=L.bk(Object.values(this._layerConfigs),this.keyCache);for(const O of D){const H=O.map((te=>this._layers[te.id])),W=H[0];if(W.visibility==="none")continue;const Y=W.source||"";let q=this.familiesBySource[Y];q||(q=this.familiesBySource[Y]={});const se=W.sourceLayer||"_geojsonTileLayer";let le=q[se];le||(le=q[se]=[]),le.push(H)}}}class zi{constructor(A){const P={},D=[];for(const Y in A){const q=A[Y],se=P[Y]={};for(const le in q){const te=q[+le];if(!te||te.bitmap.width===0||te.bitmap.height===0)continue;const de={x:0,y:0,w:te.bitmap.width+2,h:te.bitmap.height+2};D.push(de),se[le]={rect:de,metrics:te.metrics}}}const{w:O,h:H}=L.p(D),W=new L.o({width:O||1,height:H||1});for(const Y in A){const q=A[Y];for(const se in q){const le=q[+se];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const te=P[Y][se].rect;L.o.copy(le.bitmap,W,{x:0,y:0},{x:te.x+1,y:te.y+1},le.bitmap)}}this.image=W,this.positions=P}}L.bl("GlyphAtlas",zi);class Xi{constructor(A){this.tileID=new L.S(A.tileID.overscaledZ,A.tileID.wrap,A.tileID.canonical.z,A.tileID.canonical.x,A.tileID.canonical.y),this.uid=A.uid,this.zoom=A.zoom,this.pixelRatio=A.pixelRatio,this.tileSize=A.tileSize,this.source=A.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=A.showCollisionBoxes,this.collectResourceTiming=!!A.collectResourceTiming,this.returnDependencies=!!A.returnDependencies,this.promoteId=A.promoteId,this.inFlightDependencies=[]}parse(A,P,D,O){return L._(this,void 0,void 0,(function*(){this.status="parsing",this.data=A,this.collisionBoxArray=new L.a5;const H=new L.bm(Object.keys(A.layers).sort()),W=new L.bn(this.tileID,this.promoteId);W.bucketLayerIDs=[];const Y={},q={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},se=P.familiesBySource[this.source];for(const qe in se){const rt=A.layers[qe];if(!rt)continue;rt.version===1&&L.w(`Vector tile source "${this.source}" layer "${qe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const gt=H.encode(qe),kt=[];for(let Lt=0;Lt<rt.length;Lt++){const Wt=rt.feature(Lt),ds=W.getId(Wt,qe);kt.push({feature:Wt,id:ds,index:Lt,sourceLayerIndex:gt})}for(const Lt of se[qe]){const Wt=Lt[0];Wt.source!==this.source&&L.w(`layer.source = ${Wt.source} does not equal this.source = ${this.source}`),Wt.minzoom&&this.zoom<Math.floor(Wt.minzoom)||Wt.maxzoom&&this.zoom>=Wt.maxzoom||Wt.visibility!=="none"&&(Gt(Lt,this.zoom,D),(Y[Wt.id]=Wt.createBucket({index:W.bucketLayerIDs.length,layers:Lt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:gt,sourceID:this.source})).populate(kt,q,this.tileID.canonical),W.bucketLayerIDs.push(Lt.map((ds=>ds.id))))}}const le=L.aF(q.glyphDependencies,(qe=>Object.keys(qe).map(Number)));this.inFlightDependencies.forEach((qe=>qe==null?void 0:qe.abort())),this.inFlightDependencies=[];let te=Promise.resolve({});if(Object.keys(le).length){const qe=new AbortController;this.inFlightDependencies.push(qe),te=O.sendAsync({type:"GG",data:{stacks:le,source:this.source,tileID:this.tileID,type:"glyphs"}},qe)}const de=Object.keys(q.iconDependencies);let Ee=Promise.resolve({});if(de.length){const qe=new AbortController;this.inFlightDependencies.push(qe),Ee=O.sendAsync({type:"GI",data:{icons:de,source:this.source,tileID:this.tileID,type:"icons"}},qe)}const De=Object.keys(q.patternDependencies);let Ke=Promise.resolve({});if(De.length){const qe=new AbortController;this.inFlightDependencies.push(qe),Ke=O.sendAsync({type:"GI",data:{icons:De,source:this.source,tileID:this.tileID,type:"patterns"}},qe)}const[je,Je,Ge]=yield Promise.all([te,Ee,Ke]),Pt=new zi(je),xt=new L.bo(Je,Ge);for(const qe in Y){const rt=Y[qe];rt instanceof L.a6?(Gt(rt.layers,this.zoom,D),L.bp({bucket:rt,glyphMap:je,glyphPositions:Pt.positions,imageMap:Je,imagePositions:xt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):rt.hasPattern&&(rt instanceof L.bq||rt instanceof L.br||rt instanceof L.bs)&&(Gt(rt.layers,this.zoom,D),rt.addFeatures(q,this.tileID.canonical,xt.patternPositions))}return this.status="done",{buckets:Object.values(Y).filter((qe=>!qe.isEmpty())),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Pt.image,imageAtlas:xt,glyphMap:this.returnDependencies?je:null,iconMap:this.returnDependencies?Je:null,glyphPositions:this.returnDependencies?Pt.positions:null}}))}}function Gt(N,A,P){const D=new L.z(A);for(const O of N)O.recalculate(D,P)}class me{constructor(A,P,D){this.actor=A,this.layerIndex=P,this.availableImages=D,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(A,P){return L._(this,void 0,void 0,(function*(){const D=yield L.l(A.request,P);try{return{vectorTile:new L.bt.VectorTile(new L.bu(D.data)),rawData:D.data,cacheControl:D.cacheControl,expires:D.expires}}catch(O){const H=new Uint8Array(D.data);let W=`Unable to parse the tile at ${A.request.url}, `;throw W+=H[0]===31&&H[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${O.message}`,new Error(W)}}))}loadTile(A){return L._(this,void 0,void 0,(function*(){const P=A.uid,D=!!(A&&A.request&&A.request.collectResourceTiming)&&new L.bv(A.request),O=new Xi(A);this.loading[P]=O;const H=new AbortController;O.abort=H;try{const W=yield this.loadVectorTile(A,H);if(delete this.loading[P],!W)return null;const Y=W.rawData,q={};W.expires&&(q.expires=W.expires),W.cacheControl&&(q.cacheControl=W.cacheControl);const se={};if(D){const te=D.finish();te&&(se.resourceTiming=JSON.parse(JSON.stringify(te)))}O.vectorTile=W.vectorTile;const le=O.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[P]=O,this.fetching[P]={rawTileData:Y,cacheControl:q,resourceTiming:se};try{const te=yield le;return L.e({rawTileData:Y.slice(0)},te,q,se)}finally{delete this.fetching[P]}}catch(W){throw delete this.loading[P],O.status="done",this.loaded[P]=O,W}}))}reloadTile(A){return L._(this,void 0,void 0,(function*(){const P=A.uid;if(!this.loaded||!this.loaded[P])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const D=this.loaded[P];if(D.showCollisionBoxes=A.showCollisionBoxes,D.status==="parsing"){const O=yield D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor);let H;if(this.fetching[P]){const{rawTileData:W,cacheControl:Y,resourceTiming:q}=this.fetching[P];delete this.fetching[P],H=L.e({rawTileData:W.slice(0)},O,Y,q)}else H=O;return H}if(D.status==="done"&&D.vectorTile)return D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(A){return L._(this,void 0,void 0,(function*(){const P=this.loading,D=A.uid;P&&P[D]&&P[D].abort&&(P[D].abort.abort(),delete P[D])}))}removeTile(A){return L._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[A.uid]&&delete this.loaded[A.uid]}))}}class ne{constructor(){this.loaded={}}loadTile(A){return L._(this,void 0,void 0,(function*(){const{uid:P,encoding:D,rawImageData:O,redFactor:H,greenFactor:W,blueFactor:Y,baseShift:q}=A,se=O.width+2,le=O.height+2,te=L.b(O)?new L.R({width:se,height:le},yield L.bw(O,-1,-1,se,le)):O,de=new L.bx(P,te,D,H,W,Y,q);return this.loaded=this.loaded||{},this.loaded[P]=de,de}))}removeTile(A){const P=this.loaded,D=A.uid;P&&P[D]&&delete P[D]}}function Vr(N,A){if(N.length!==0){br(N[0],A);for(var P=1;P<N.length;P++)br(N[P],!A)}}function br(N,A){for(var P=0,D=0,O=0,H=N.length,W=H-1;O<H;W=O++){var Y=(N[O][0]-N[W][0])*(N[W][1]+N[O][1]),q=P+Y;D+=Math.abs(P)>=Math.abs(Y)?P-q+Y:Y-q+P,P=q}P+D>=0!=!!A&&N.reverse()}var Wi=L.by((function N(A,P){var D,O=A&&A.type;if(O==="FeatureCollection")for(D=0;D<A.features.length;D++)N(A.features[D],P);else if(O==="GeometryCollection")for(D=0;D<A.geometries.length;D++)N(A.geometries[D],P);else if(O==="Feature")N(A.geometry,P);else if(O==="Polygon")Vr(A.coordinates,P);else if(O==="MultiPolygon")for(D=0;D<A.coordinates.length;D++)Vr(A.coordinates[D],P);return A}));const wr=L.bt.VectorTileFeature.prototype.toGeoJSON;var hr={exports:{}},Gs=L.bz,hi=L.bt.VectorTileFeature,Ia=Ei;function Ei(N,A){this.options=A||{},this.features=N,this.length=N.length}function Ki(N,A){this.id=typeof N.id=="number"?N.id:void 0,this.type=N.type,this.rawGeometry=N.type===1?[N.geometry]:N.geometry,this.properties=N.tags,this.extent=A||4096}Ei.prototype.feature=function(N){return new Ki(this.features[N],this.options.extent)},Ki.prototype.loadGeometry=function(){var N=this.rawGeometry;this.geometry=[];for(var A=0;A<N.length;A++){for(var P=N[A],D=[],O=0;O<P.length;O++)D.push(new Gs(P[O][0],P[O][1]));this.geometry.push(D)}return this.geometry},Ki.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var N=this.geometry,A=1/0,P=-1/0,D=1/0,O=-1/0,H=0;H<N.length;H++)for(var W=N[H],Y=0;Y<W.length;Y++){var q=W[Y];A=Math.min(A,q.x),P=Math.max(P,q.x),D=Math.min(D,q.y),O=Math.max(O,q.y)}return[A,D,P,O]},Ki.prototype.toGeoJSON=hi.prototype.toGeoJSON;var vi=L.bA,Pn=Ia;function Ji(N){var A=new vi;return(function(P,D){for(var O in P.layers)D.writeMessage(3,Hs,P.layers[O])})(N,A),A.finish()}function Hs(N,A){var P;A.writeVarintField(15,N.version||1),A.writeStringField(1,N.name||""),A.writeVarintField(5,N.extent||4096);var D={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<N.length;P++)D.feature=N.feature(P),A.writeMessage(2,nt,D);var O=D.keys;for(P=0;P<O.length;P++)A.writeStringField(3,O[P]);var H=D.values;for(P=0;P<H.length;P++)A.writeMessage(4,os,H[P])}function nt(N,A){var P=N.feature;P.id!==void 0&&A.writeVarintField(1,P.id),A.writeMessage(2,An,N),A.writeVarintField(3,P.type),A.writeMessage(4,ur,P)}function An(N,A){var P=N.feature,D=N.keys,O=N.values,H=N.keycache,W=N.valuecache;for(var Y in P.properties){var q=P.properties[Y],se=H[Y];if(q!==null){se===void 0&&(D.push(Y),H[Y]=se=D.length-1),A.writeVarint(se);var le=typeof q;le!=="string"&&le!=="boolean"&&le!=="number"&&(q=JSON.stringify(q));var te=le+":"+q,de=W[te];de===void 0&&(O.push(q),W[te]=de=O.length-1),A.writeVarint(de)}}}function Ft(N,A){return(A<<3)+(7&N)}function Ht(N){return N<<1^N>>31}function ur(N,A){for(var P=N.loadGeometry(),D=N.type,O=0,H=0,W=P.length,Y=0;Y<W;Y++){var q=P[Y],se=1;D===1&&(se=q.length),A.writeVarint(Ft(1,se));for(var le=D===3?q.length-1:q.length,te=0;te<le;te++){te===1&&D!==1&&A.writeVarint(Ft(2,le-1));var de=q[te].x-O,Ee=q[te].y-H;A.writeVarint(Ht(de)),A.writeVarint(Ht(Ee)),O+=de,H+=Ee}D===3&&A.writeVarint(Ft(7,1))}}function os(N,A){var P=typeof N;P==="string"?A.writeStringField(1,N):P==="boolean"?A.writeBooleanField(7,N):P==="number"&&(N%1!=0?A.writeDoubleField(3,N):N<0?A.writeSVarintField(6,N):A.writeVarintField(5,N))}hr.exports=Ji,hr.exports.fromVectorTileJs=Ji,hr.exports.fromGeojsonVt=function(N,A){A=A||{};var P={};for(var D in N)P[D]=new Pn(N[D].features,A),P[D].name=D,P[D].version=A.version,P[D].extent=A.extent;return Ji({layers:P})},hr.exports.GeoJSONWrapper=Pn;var Yi=L.by(hr.exports);const Mn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:N=>N},Nr=Math.fround||(dr=new Float32Array(1),N=>(dr[0]=+N,dr[0]));var dr;const ei=3,Di=5,ls=6;class Tr{constructor(A){this.options=Object.assign(Object.create(Mn),A),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(A){const{log:P,minZoom:D,maxZoom:O}=this.options;P&&console.time("total time");const H=`prepare ${A.length} points`;P&&console.time(H),this.points=A;const W=[];for(let q=0;q<A.length;q++){const se=A[q];if(!se.geometry)continue;const[le,te]=se.geometry.coordinates,de=Nr(ui(le)),Ee=Nr(Li(te));W.push(de,Ee,1/0,q,-1,1),this.options.reduce&&W.push(0)}let Y=this.trees[O+1]=this._createTree(W);P&&console.timeEnd(H);for(let q=O;q>=D;q--){const se=+Date.now();Y=this.trees[q]=this._createTree(this._cluster(Y,q)),P&&console.log("z%d: %d clusters in %dms",q,Y.numItems,+Date.now()-se)}return P&&console.timeEnd("total time"),this}getClusters(A,P){let D=((A[0]+180)%360+360)%360-180;const O=Math.max(-90,Math.min(90,A[1]));let H=A[2]===180?180:((A[2]+180)%360+360)%360-180;const W=Math.max(-90,Math.min(90,A[3]));if(A[2]-A[0]>=360)D=-180,H=180;else if(D>H){const te=this.getClusters([D,O,180,W],P),de=this.getClusters([-180,O,H,W],P);return te.concat(de)}const Y=this.trees[this._limitZoom(P)],q=Y.range(ui(D),Li(W),ui(H),Li(O)),se=Y.data,le=[];for(const te of q){const de=this.stride*te;le.push(se[de+Di]>1?Qi(se,de,this.clusterProps):this.points[se[de+ei]])}return le}getChildren(A){const P=this._getOriginId(A),D=this._getOriginZoom(A),O="No cluster with the specified id.",H=this.trees[D];if(!H)throw new Error(O);const W=H.data;if(P*this.stride>=W.length)throw new Error(O);const Y=this.options.radius/(this.options.extent*Math.pow(2,D-1)),q=H.within(W[P*this.stride],W[P*this.stride+1],Y),se=[];for(const le of q){const te=le*this.stride;W[te+4]===A&&se.push(W[te+Di]>1?Qi(W,te,this.clusterProps):this.points[W[te+ei]])}if(se.length===0)throw new Error(O);return se}getLeaves(A,P,D){const O=[];return this._appendLeaves(O,A,P=P||10,D=D||0,0),O}getTile(A,P,D){const O=this.trees[this._limitZoom(A)],H=Math.pow(2,A),{extent:W,radius:Y}=this.options,q=Y/W,se=(D-q)/H,le=(D+1+q)/H,te={features:[]};return this._addTileFeatures(O.range((P-q)/H,se,(P+1+q)/H,le),O.data,P,D,H,te),P===0&&this._addTileFeatures(O.range(1-q/H,se,1,le),O.data,H,D,H,te),P===H-1&&this._addTileFeatures(O.range(0,se,q/H,le),O.data,-1,D,H,te),te.features.length?te:null}getClusterExpansionZoom(A){let P=this._getOriginZoom(A)-1;for(;P<=this.options.maxZoom;){const D=this.getChildren(A);if(P++,D.length!==1)break;A=D[0].properties.cluster_id}return P}_appendLeaves(A,P,D,O,H){const W=this.getChildren(P);for(const Y of W){const q=Y.properties;if(q&&q.cluster?H+q.point_count<=O?H+=q.point_count:H=this._appendLeaves(A,q.cluster_id,D,O,H):H<O?H++:A.push(Y),A.length===D)break}return H}_createTree(A){const P=new L.av(A.length/this.stride|0,this.options.nodeSize,Float32Array);for(let D=0;D<A.length;D+=this.stride)P.add(A[D],A[D+1]);return P.finish(),P.data=A,P}_addTileFeatures(A,P,D,O,H,W){for(const Y of A){const q=Y*this.stride,se=P[q+Di]>1;let le,te,de;if(se)le=cs(P,q,this.clusterProps),te=P[q],de=P[q+1];else{const Ke=this.points[P[q+ei]];le=Ke.properties;const[je,Je]=Ke.geometry.coordinates;te=ui(je),de=Li(Je)}const Ee={type:1,geometry:[[Math.round(this.options.extent*(te*H-D)),Math.round(this.options.extent*(de*H-O))]],tags:le};let De;De=se||this.options.generateId?P[q+ei]:this.points[P[q+ei]].id,De!==void 0&&(Ee.id=De),W.features.push(Ee)}}_limitZoom(A){return Math.max(this.options.minZoom,Math.min(Math.floor(+A),this.options.maxZoom+1))}_cluster(A,P){const{radius:D,extent:O,reduce:H,minPoints:W}=this.options,Y=D/(O*Math.pow(2,P)),q=A.data,se=[],le=this.stride;for(let te=0;te<q.length;te+=le){if(q[te+2]<=P)continue;q[te+2]=P;const de=q[te],Ee=q[te+1],De=A.within(q[te],q[te+1],Y),Ke=q[te+Di];let je=Ke;for(const Je of De){const Ge=Je*le;q[Ge+2]>P&&(je+=q[Ge+Di])}if(je>Ke&&je>=W){let Je,Ge=de*Ke,Pt=Ee*Ke,xt=-1;const qe=((te/le|0)<<5)+(P+1)+this.points.length;for(const rt of De){const gt=rt*le;if(q[gt+2]<=P)continue;q[gt+2]=P;const kt=q[gt+Di];Ge+=q[gt]*kt,Pt+=q[gt+1]*kt,q[gt+4]=qe,H&&(Je||(Je=this._map(q,te,!0),xt=this.clusterProps.length,this.clusterProps.push(Je)),H(Je,this._map(q,gt)))}q[te+4]=qe,se.push(Ge/je,Pt/je,1/0,qe,-1,je),H&&se.push(xt)}else{for(let Je=0;Je<le;Je++)se.push(q[te+Je]);if(je>1)for(const Je of De){const Ge=Je*le;if(!(q[Ge+2]<=P)){q[Ge+2]=P;for(let Pt=0;Pt<le;Pt++)se.push(q[Ge+Pt])}}}}return se}_getOriginId(A){return A-this.points.length>>5}_getOriginZoom(A){return(A-this.points.length)%32}_map(A,P,D){if(A[P+Di]>1){const W=this.clusterProps[A[P+ls]];return D?Object.assign({},W):W}const O=this.points[A[P+ei]].properties,H=this.options.map(O);return D&&H===O?Object.assign({},H):H}}function Qi(N,A,P){return{type:"Feature",id:N[A+ei],properties:cs(N,A,P),geometry:{type:"Point",coordinates:[(D=N[A],360*(D-.5)),jr(N[A+1])]}};var D}function cs(N,A,P){const D=N[A+Di],O=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,H=N[A+ls],W=H===-1?{}:Object.assign({},P[H]);return Object.assign(W,{cluster:!0,cluster_id:N[A+ei],point_count:D,point_count_abbreviated:O})}function ui(N){return N/360+.5}function Li(N){const A=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return P<0?0:P>1?1:P}function jr(N){const A=(180-360*N)*Math.PI/180;return 360*Math.atan(Math.exp(A))/Math.PI-90}function Ur(N,A,P,D){let O=D;const H=A+(P-A>>1);let W,Y=P-A;const q=N[A],se=N[A+1],le=N[P],te=N[P+1];for(let de=A+3;de<P;de+=3){const Ee=Xs(N[de],N[de+1],q,se,le,te);if(Ee>O)W=de,O=Ee;else if(Ee===O){const De=Math.abs(de-H);De<Y&&(W=de,Y=De)}}O>D&&(W-A>3&&Ur(N,A,W,D),N[W+2]=O,P-W>3&&Ur(N,W,P,D))}function Xs(N,A,P,D,O,H){let W=O-P,Y=H-D;if(W!==0||Y!==0){const q=((N-P)*W+(A-D)*Y)/(W*W+Y*Y);q>1?(P=O,D=H):q>0&&(P+=W*q,D+=Y*q)}return W=N-P,Y=A-D,W*W+Y*Y}function pr(N,A,P,D){const O={id:N??null,type:A,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(A==="Point"||A==="MultiPoint"||A==="LineString")Sr(O,P);else if(A==="Polygon")Sr(O,P[0]);else if(A==="MultiLineString")for(const H of P)Sr(O,H);else if(A==="MultiPolygon")for(const H of P)Sr(O,H[0]);return O}function Sr(N,A){for(let P=0;P<A.length;P+=3)N.minX=Math.min(N.minX,A[P]),N.minY=Math.min(N.minY,A[P+1]),N.maxX=Math.max(N.maxX,A[P]),N.maxY=Math.max(N.maxY,A[P+1])}function Ir(N,A,P,D){if(!A.geometry)return;const O=A.geometry.coordinates;if(O&&O.length===0)return;const H=A.geometry.type,W=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2);let Y=[],q=A.id;if(P.promoteId?q=A.properties[P.promoteId]:P.generateId&&(q=D||0),H==="Point")hs(O,Y);else if(H==="MultiPoint")for(const se of O)hs(se,Y);else if(H==="LineString")ie(O,Y,W,!1);else if(H==="MultiLineString"){if(P.lineMetrics){for(const se of O)Y=[],ie(se,Y,W,!1),N.push(pr(q,"LineString",Y,A.properties));return}$r(O,Y,W,!1)}else if(H==="Polygon")$r(O,Y,W,!0);else{if(H!=="MultiPolygon"){if(H==="GeometryCollection"){for(const se of A.geometry.geometries)Ir(N,{id:q,geometry:se,properties:A.properties},P,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const se of O){const le=[];$r(se,le,W,!0),Y.push(le)}}N.push(pr(q,H,Y,A.properties))}function hs(N,A){A.push(Ws(N[0]),et(N[1]),0)}function ie(N,A,P,D){let O,H,W=0;for(let q=0;q<N.length;q++){const se=Ws(N[q][0]),le=et(N[q][1]);A.push(se,le,0),q>0&&(W+=D?(O*le-se*H)/2:Math.sqrt(Math.pow(se-O,2)+Math.pow(le-H,2))),O=se,H=le}const Y=A.length-3;A[2]=1,Ur(A,0,Y,P),A[Y+2]=1,A.size=Math.abs(W),A.start=0,A.end=A.size}function $r(N,A,P,D){for(let O=0;O<N.length;O++){const H=[];ie(N[O],H,P,D),A.push(H)}}function Ws(N){return N/360+.5}function et(N){const A=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return P<0?0:P>1?1:P}function yt(N,A,P,D,O,H,W,Y){if(D/=A,H>=(P/=A)&&W<D)return N;if(W<P||H>=D)return null;const q=[];for(const se of N){const le=se.geometry;let te=se.type;const de=O===0?se.minX:se.minY,Ee=O===0?se.maxX:se.maxY;if(de>=P&&Ee<D){q.push(se);continue}if(Ee<P||de>=D)continue;let De=[];if(te==="Point"||te==="MultiPoint")Ks(le,De,P,D,O);else if(te==="LineString")Pr(le,De,P,D,O,!1,Y.lineMetrics);else if(te==="MultiLineString")us(le,De,P,D,O,!1);else if(te==="Polygon")us(le,De,P,D,O,!0);else if(te==="MultiPolygon")for(const Ke of le){const je=[];us(Ke,je,P,D,O,!0),je.length&&De.push(je)}if(De.length){if(Y.lineMetrics&&te==="LineString"){for(const Ke of De)q.push(pr(se.id,te,Ke,se.tags));continue}te!=="LineString"&&te!=="MultiLineString"||(De.length===1?(te="LineString",De=De[0]):te="MultiLineString"),te!=="Point"&&te!=="MultiPoint"||(te=De.length===3?"Point":"MultiPoint"),q.push(pr(se.id,te,De,se.tags))}}return q.length?q:null}function Ks(N,A,P,D,O){for(let H=0;H<N.length;H+=3){const W=N[H+O];W>=P&&W<=D&&bi(A,N[H],N[H+1],N[H+2])}}function Pr(N,A,P,D,O,H,W){let Y=fr(N);const q=O===0?Js:Ys;let se,le,te=N.start;for(let je=0;je<N.length-3;je+=3){const Je=N[je],Ge=N[je+1],Pt=N[je+2],xt=N[je+3],qe=N[je+4],rt=O===0?Je:Ge,gt=O===0?xt:qe;let kt=!1;W&&(se=Math.sqrt(Math.pow(Je-xt,2)+Math.pow(Ge-qe,2))),rt<P?gt>P&&(le=q(Y,Je,Ge,xt,qe,P),W&&(Y.start=te+se*le)):rt>D?gt<D&&(le=q(Y,Je,Ge,xt,qe,D),W&&(Y.start=te+se*le)):bi(Y,Je,Ge,Pt),gt<P&&rt>=P&&(le=q(Y,Je,Ge,xt,qe,P),kt=!0),gt>D&&rt<=D&&(le=q(Y,Je,Ge,xt,qe,D),kt=!0),!H&&kt&&(W&&(Y.end=te+se*le),A.push(Y),Y=fr(N)),W&&(te+=se)}let de=N.length-3;const Ee=N[de],De=N[de+1],Ke=O===0?Ee:De;Ke>=P&&Ke<=D&&bi(Y,Ee,De,N[de+2]),de=Y.length-3,H&&de>=3&&(Y[de]!==Y[0]||Y[de+1]!==Y[1])&&bi(Y,Y[0],Y[1],Y[2]),Y.length&&A.push(Y)}function fr(N){const A=[];return A.size=N.size,A.start=N.start,A.end=N.end,A}function us(N,A,P,D,O,H){for(const W of N)Pr(W,A,P,D,O,H,!1)}function bi(N,A,P,D){N.push(A,P,D)}function Js(N,A,P,D,O,H){const W=(H-A)/(D-A);return bi(N,H,P+(O-P)*W,1),W}function Ys(N,A,P,D,O,H){const W=(H-P)/(O-P);return bi(N,A+(D-A)*W,H,1),W}function ue(N,A){const P=[];for(let D=0;D<N.length;D++){const O=N[D],H=O.type;let W;if(H==="Point"||H==="MultiPoint"||H==="LineString")W=er(O.geometry,A);else if(H==="MultiLineString"||H==="Polygon"){W=[];for(const Y of O.geometry)W.push(er(Y,A))}else if(H==="MultiPolygon"){W=[];for(const Y of O.geometry){const q=[];for(const se of Y)q.push(er(se,A));W.push(q)}}P.push(pr(O.id,H,W,O.tags))}return P}function er(N,A){const P=[];P.size=N.size,N.start!==void 0&&(P.start=N.start,P.end=N.end);for(let D=0;D<N.length;D+=3)P.push(N[D]+A,N[D+1],N[D+2]);return P}function Xt(N,A){if(N.transformed)return N;const P=1<<N.z,D=N.x,O=N.y;for(const H of N.features){const W=H.geometry,Y=H.type;if(H.geometry=[],Y===1)for(let q=0;q<W.length;q+=2)H.geometry.push(tr(W[q],W[q+1],A,P,D,O));else for(let q=0;q<W.length;q++){const se=[];for(let le=0;le<W[q].length;le+=2)se.push(tr(W[q][le],W[q][le+1],A,P,D,O));H.geometry.push(se)}}return N.transformed=!0,N}function tr(N,A,P,D,O,H){return[Math.round(P*(N*D-O)),Math.round(P*(A*D-H))]}function Ar(N,A,P,D,O){const H=A===O.maxZoom?0:O.tolerance/((1<<A)*O.extent),W={features:[],numPoints:0,numSimplified:0,numFeatures:N.length,source:null,x:P,y:D,z:A,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Y of N)_e(W,Y,H,O);return W}function _e(N,A,P,D){const O=A.geometry,H=A.type,W=[];if(N.minX=Math.min(N.minX,A.minX),N.minY=Math.min(N.minY,A.minY),N.maxX=Math.max(N.maxX,A.maxX),N.maxY=Math.max(N.maxY,A.maxY),H==="Point"||H==="MultiPoint")for(let Y=0;Y<O.length;Y+=3)W.push(O[Y],O[Y+1]),N.numPoints++,N.numSimplified++;else if(H==="LineString")$e(W,O,N,P,!1,!1);else if(H==="MultiLineString"||H==="Polygon")for(let Y=0;Y<O.length;Y++)$e(W,O[Y],N,P,H==="Polygon",Y===0);else if(H==="MultiPolygon")for(let Y=0;Y<O.length;Y++){const q=O[Y];for(let se=0;se<q.length;se++)$e(W,q[se],N,P,!0,se===0)}if(W.length){let Y=A.tags||null;if(H==="LineString"&&D.lineMetrics){Y={};for(const se in A.tags)Y[se]=A.tags[se];Y.mapbox_clip_start=O.start/O.size,Y.mapbox_clip_end=O.end/O.size}const q={geometry:W,type:H==="Polygon"||H==="MultiPolygon"?3:H==="LineString"||H==="MultiLineString"?2:1,tags:Y};A.id!==null&&(q.id=A.id),N.features.push(q)}}function $e(N,A,P,D,O,H){const W=D*D;if(D>0&&A.size<(O?W:D))return void(P.numPoints+=A.length/3);const Y=[];for(let q=0;q<A.length;q+=3)(D===0||A[q+2]>W)&&(P.numSimplified++,Y.push(A[q],A[q+1])),P.numPoints++;O&&(function(q,se){let le=0;for(let te=0,de=q.length,Ee=de-2;te<de;Ee=te,te+=2)le+=(q[te]-q[Ee])*(q[te+1]+q[Ee+1]);if(le>0===se)for(let te=0,de=q.length;te<de/2;te+=2){const Ee=q[te],De=q[te+1];q[te]=q[de-2-te],q[te+1]=q[de-1-te],q[de-2-te]=Ee,q[de-1-te]=De}})(Y,H),N.push(Y)}const Be={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ti{constructor(A,P){const D=(P=this.options=(function(H,W){for(const Y in W)H[Y]=W[Y];return H})(Object.create(Be),P)).debug;if(D&&console.time("preprocess data"),P.maxZoom<0||P.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");let O=(function(H,W){const Y=[];if(H.type==="FeatureCollection")for(let q=0;q<H.features.length;q++)Ir(Y,H.features[q],W,q);else Ir(Y,H.type==="Feature"?H:{geometry:H},W);return Y})(A,P);this.tiles={},this.tileCoords=[],D&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",P.indexMaxZoom,P.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),O=(function(H,W){const Y=W.buffer/W.extent;let q=H;const se=yt(H,1,-1-Y,Y,0,-1,2,W),le=yt(H,1,1-Y,2+Y,0,-1,2,W);return(se||le)&&(q=yt(H,1,-Y,1+Y,0,-1,2,W)||[],se&&(q=ue(se,1).concat(q)),le&&(q=q.concat(ue(le,-1)))),q})(O,P),O.length&&this.splitTile(O,0,0,0),D&&(O.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(A,P,D,O,H,W,Y){const q=[A,P,D,O],se=this.options,le=se.debug;for(;q.length;){O=q.pop(),D=q.pop(),P=q.pop(),A=q.pop();const te=1<<P,de=Ri(P,D,O);let Ee=this.tiles[de];if(!Ee&&(le>1&&console.time("creation"),Ee=this.tiles[de]=Ar(A,P,D,O,se),this.tileCoords.push({z:P,x:D,y:O}),le)){le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,D,O,Ee.numFeatures,Ee.numPoints,Ee.numSimplified),console.timeEnd("creation"));const kt=`z${P}`;this.stats[kt]=(this.stats[kt]||0)+1,this.total++}if(Ee.source=A,H==null){if(P===se.indexMaxZoom||Ee.numPoints<=se.indexMaxPoints)continue}else{if(P===se.maxZoom||P===H)continue;if(H!=null){const kt=H-P;if(D!==W>>kt||O!==Y>>kt)continue}}if(Ee.source=null,A.length===0)continue;le>1&&console.time("clipping");const De=.5*se.buffer/se.extent,Ke=.5-De,je=.5+De,Je=1+De;let Ge=null,Pt=null,xt=null,qe=null,rt=yt(A,te,D-De,D+je,0,Ee.minX,Ee.maxX,se),gt=yt(A,te,D+Ke,D+Je,0,Ee.minX,Ee.maxX,se);A=null,rt&&(Ge=yt(rt,te,O-De,O+je,1,Ee.minY,Ee.maxY,se),Pt=yt(rt,te,O+Ke,O+Je,1,Ee.minY,Ee.maxY,se),rt=null),gt&&(xt=yt(gt,te,O-De,O+je,1,Ee.minY,Ee.maxY,se),qe=yt(gt,te,O+Ke,O+Je,1,Ee.minY,Ee.maxY,se),gt=null),le>1&&console.timeEnd("clipping"),q.push(Ge||[],P+1,2*D,2*O),q.push(Pt||[],P+1,2*D,2*O+1),q.push(xt||[],P+1,2*D+1,2*O),q.push(qe||[],P+1,2*D+1,2*O+1)}}getTile(A,P,D){A=+A,P=+P,D=+D;const O=this.options,{extent:H,debug:W}=O;if(A<0||A>24)return null;const Y=1<<A,q=Ri(A,P=P+Y&Y-1,D);if(this.tiles[q])return Xt(this.tiles[q],H);W>1&&console.log("drilling down to z%d-%d-%d",A,P,D);let se,le=A,te=P,de=D;for(;!se&&le>0;)le--,te>>=1,de>>=1,se=this.tiles[Ri(le,te,de)];return se&&se.source?(W>1&&(console.log("found parent tile z%d-%d-%d",le,te,de),console.time("drilling down")),this.splitTile(se.source,le,te,de,A,P,D),W>1&&console.timeEnd("drilling down"),this.tiles[q]?Xt(this.tiles[q],H):null):null}}function Ri(N,A,P){return 32*((1<<N)*P+A)+N}function Ne(N,A){return A?N.properties[A]:N.id}function ir(N,A){if(N==null)return!0;if(N.type==="Feature")return Ne(N,A)!=null;if(N.type==="FeatureCollection"){const P=new Set;for(const D of N.features){const O=Ne(D,A);if(O==null||P.has(O))return!1;P.add(O)}return!0}return!1}function mr(N,A){const P=new Map;if(N!=null)if(N.type==="Feature")P.set(Ne(N,A),N);else for(const D of N.features)P.set(Ne(D,A),D);return P}class Mr extends me{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(A,P){return L._(this,void 0,void 0,(function*(){const D=A.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const O=this._geoJSONIndex.getTile(D.z,D.x,D.y);if(!O)return null;const H=new class{constructor(Y){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=L.X,this.length=Y.length,this._features=Y}feature(Y){return new class{constructor(q){this._feature=q,this.extent=L.X,this.type=q.type,this.properties=q.tags,"id"in q&&!isNaN(q.id)&&(this.id=parseInt(q.id,10))}loadGeometry(){if(this._feature.type===1){const q=[];for(const se of this._feature.geometry)q.push([new L.P(se[0],se[1])]);return q}{const q=[];for(const se of this._feature.geometry){const le=[];for(const te of se)le.push(new L.P(te[0],te[1]));q.push(le)}return q}}toGeoJSON(q,se,le){return wr.call(this,q,se,le)}}(this._features[Y])}}(O.features);let W=Yi(H);return W.byteOffset===0&&W.byteLength===W.buffer.byteLength||(W=new Uint8Array(W)),{vectorTile:H,rawData:W.buffer}}))}loadData(A){return L._(this,void 0,void 0,(function*(){var P;(P=this._pendingRequest)===null||P===void 0||P.abort();const D=!!(A&&A.request&&A.request.collectResourceTiming)&&new L.bv(A.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(A,this._pendingRequest),this._geoJSONIndex=A.cluster?new Tr((function({superclusterOptions:W,clusterProperties:Y}){if(!Y||!W)return W;const q={},se={},le={accumulated:null,zoom:0},te={properties:null},de=Object.keys(Y);for(const Ee of de){const[De,Ke]=Y[Ee],je=L.bC(Ke),Je=L.bC(typeof De=="string"?[De,["accumulated"],["get",Ee]]:De);q[Ee]=je.value,se[Ee]=Je.value}return W.map=Ee=>{te.properties=Ee;const De={};for(const Ke of de)De[Ke]=q[Ke].evaluate(le,te);return De},W.reduce=(Ee,De)=>{te.properties=De;for(const Ke of de)le.accumulated=Ee[Ke],Ee[Ke]=se[Ke].evaluate(le,te)},W})(A)).load((yield this._pendingData).features):(O=yield this._pendingData,new ti(O,A.geojsonVtOptions)),this.loaded={};const H={};if(D){const W=D.finish();W&&(H.resourceTiming={},H.resourceTiming[A.source]=JSON.parse(JSON.stringify(W)))}return H}catch(H){if(delete this._pendingRequest,L.bB(H))return{abandoned:!0};throw H}var O}))}getData(){return L._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(A){const P=this.loaded;return P&&P[A.uid]?super.reloadTile(A):this.loadTile(A)}loadAndProcessGeoJSON(A,P){return L._(this,void 0,void 0,(function*(){let D=yield this.loadGeoJSON(A,P);if(delete this._pendingRequest,typeof D!="object")throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);if(Wi(D,!0),A.filter){const O=L.bC(A.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(O.result==="error")throw new Error(O.value.map((W=>`${W.key}: ${W.message}`)).join(", "));D={type:"FeatureCollection",features:D.features.filter((W=>O.value.evaluate({zoom:0},W)))}}return D}))}loadGeoJSON(A,P){return L._(this,void 0,void 0,(function*(){const{promoteId:D}=A;if(A.request){const O=yield L.h(A.request,P);return this._dataUpdateable=ir(O.data,D)?mr(O.data,D):void 0,O.data}if(typeof A.data=="string")try{const O=JSON.parse(A.data);return this._dataUpdateable=ir(O,D)?mr(O,D):void 0,O}catch{throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`)}if(!A.dataDiff)throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${A.source}`);return(function(O,H,W){var Y,q,se,le;if(H.removeAll&&O.clear(),H.remove)for(const te of H.remove)O.delete(te);if(H.add)for(const te of H.add){const de=Ne(te,W);de!=null&&O.set(de,te)}if(H.update)for(const te of H.update){let de=O.get(te.id);if(de==null)continue;const Ee=!te.removeAllProperties&&(((Y=te.removeProperties)===null||Y===void 0?void 0:Y.length)>0||((q=te.addOrUpdateProperties)===null||q===void 0?void 0:q.length)>0);if((te.newGeometry||te.removeAllProperties||Ee)&&(de=Object.assign({},de),O.set(te.id,de),Ee&&(de.properties=Object.assign({},de.properties))),te.newGeometry&&(de.geometry=te.newGeometry),te.removeAllProperties)de.properties={};else if(((se=te.removeProperties)===null||se===void 0?void 0:se.length)>0)for(const De of te.removeProperties)Object.prototype.hasOwnProperty.call(de.properties,De)&&delete de.properties[De];if(((le=te.addOrUpdateProperties)===null||le===void 0?void 0:le.length)>0)for(const{key:De,value:Ke}of te.addOrUpdateProperties)de.properties[De]=Ke}})(this._dataUpdateable,A.dataDiff,D),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(A){return L._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(A){return this._geoJSONIndex.getClusterExpansionZoom(A.clusterId)}getClusterChildren(A){return this._geoJSONIndex.getChildren(A.clusterId)}getClusterLeaves(A){return this._geoJSONIndex.getLeaves(A.clusterId,A.limit,A.offset)}}class rr{constructor(A){this.self=A,this.actor=new L.F(A),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(P,D)=>{if(this.externalWorkerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.externalWorkerSourceTypes[P]=D},this.self.addProtocol=L.bi,this.self.removeProtocol=L.bj,this.self.registerRTLTextPlugin=P=>{if(L.bD.isParsed())throw new Error("RTL text plugin already registered.");L.bD.setMethods(P)},this.actor.registerMessageHandler("LDT",((P,D)=>this._getDEMWorkerSource(P,D.source).loadTile(D))),this.actor.registerMessageHandler("RDT",((P,D)=>L._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(P,D.source).removeTile(D)})))),this.actor.registerMessageHandler("GCEZ",((P,D)=>L._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,D.type,D.source).getClusterExpansionZoom(D)})))),this.actor.registerMessageHandler("GCC",((P,D)=>L._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,D.type,D.source).getClusterChildren(D)})))),this.actor.registerMessageHandler("GCL",((P,D)=>L._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,D.type,D.source).getClusterLeaves(D)})))),this.actor.registerMessageHandler("LD",((P,D)=>this._getWorkerSource(P,D.type,D.source).loadData(D))),this.actor.registerMessageHandler("GD",((P,D)=>this._getWorkerSource(P,D.type,D.source).getData())),this.actor.registerMessageHandler("LT",((P,D)=>this._getWorkerSource(P,D.type,D.source).loadTile(D))),this.actor.registerMessageHandler("RT",((P,D)=>this._getWorkerSource(P,D.type,D.source).reloadTile(D))),this.actor.registerMessageHandler("AT",((P,D)=>this._getWorkerSource(P,D.type,D.source).abortTile(D))),this.actor.registerMessageHandler("RMT",((P,D)=>this._getWorkerSource(P,D.type,D.source).removeTile(D))),this.actor.registerMessageHandler("RS",((P,D)=>L._(this,void 0,void 0,(function*(){if(!this.workerSources[P]||!this.workerSources[P][D.type]||!this.workerSources[P][D.type][D.source])return;const O=this.workerSources[P][D.type][D.source];delete this.workerSources[P][D.type][D.source],O.removeSource!==void 0&&O.removeSource(D)})))),this.actor.registerMessageHandler("RM",(P=>L._(this,void 0,void 0,(function*(){delete this.layerIndexes[P],delete this.availableImages[P],delete this.workerSources[P],delete this.demWorkerSources[P]})))),this.actor.registerMessageHandler("SR",((P,D)=>L._(this,void 0,void 0,(function*(){this.referrer=D})))),this.actor.registerMessageHandler("SRPS",((P,D)=>this._syncRTLPluginState(P,D))),this.actor.registerMessageHandler("IS",((P,D)=>L._(this,void 0,void 0,(function*(){this.self.importScripts(D)})))),this.actor.registerMessageHandler("SI",((P,D)=>this._setImages(P,D))),this.actor.registerMessageHandler("UL",((P,D)=>L._(this,void 0,void 0,(function*(){this._getLayerIndex(P).update(D.layers,D.removedIds)})))),this.actor.registerMessageHandler("SL",((P,D)=>L._(this,void 0,void 0,(function*(){this._getLayerIndex(P).replace(D)}))))}_setImages(A,P){return L._(this,void 0,void 0,(function*(){this.availableImages[A]=P;for(const D in this.workerSources[A]){const O=this.workerSources[A][D];for(const H in O)O[H].availableImages=P}}))}_syncRTLPluginState(A,P){return L._(this,void 0,void 0,(function*(){if(L.bD.isParsed())return L.bD.getState();if(P.pluginStatus!=="loading")return L.bD.setState(P),P;const D=P.pluginURL;if(this.self.importScripts(D),L.bD.isParsed()){const O={pluginStatus:"loaded",pluginURL:D};return L.bD.setState(O),O}throw L.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${D}`)}))}_getAvailableImages(A){let P=this.availableImages[A];return P||(P=[]),P}_getLayerIndex(A){let P=this.layerIndexes[A];return P||(P=this.layerIndexes[A]=new p),P}_getWorkerSource(A,P,D){if(this.workerSources[A]||(this.workerSources[A]={}),this.workerSources[A][P]||(this.workerSources[A][P]={}),!this.workerSources[A][P][D]){const O={sendAsync:(H,W)=>(H.targetMapId=A,this.actor.sendAsync(H,W))};switch(P){case"vector":this.workerSources[A][P][D]=new me(O,this._getLayerIndex(A),this._getAvailableImages(A));break;case"geojson":this.workerSources[A][P][D]=new Mr(O,this._getLayerIndex(A),this._getAvailableImages(A));break;default:this.workerSources[A][P][D]=new this.externalWorkerSourceTypes[P](O,this._getLayerIndex(A),this._getAvailableImages(A))}}return this.workerSources[A][P][D]}_getDEMWorkerSource(A,P){return this.demWorkerSources[A]||(this.demWorkerSources[A]={}),this.demWorkerSources[A][P]||(this.demWorkerSources[A][P]=new ne),this.demWorkerSources[A][P]}}return L.i(self)&&(self.worker=new rr(self)),rr})),Or("index",["exports","./shared"],(function(L,p){"use strict";var zi="4.7.1";let Xi,Gt;const me={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:h=>new Promise(((e,s)=>{const a=requestAnimationFrame(e);h.signal.addEventListener("abort",(()=>{cancelAnimationFrame(a),s(p.c())}))})),getImageData(h,e=0){return this.getImageCanvasContext(h).getImageData(-e,-e,h.width+2*e,h.height+2*e)},getImageCanvasContext(h){const e=window.document.createElement("canvas"),s=e.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return e.width=h.width,e.height=h.height,s.drawImage(h,0,0,h.width,h.height),s},resolveURL:h=>(Xi||(Xi=document.createElement("a")),Xi.href=h,Xi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Gt==null&&(Gt=matchMedia("(prefers-reduced-motion: reduce)")),Gt.matches)}};class ne{static testProp(e){if(!ne.docStyle)return e[0];for(let s=0;s<e.length;s++)if(e[s]in ne.docStyle)return e[s];return e[0]}static create(e,s,a){const o=window.document.createElement(e);return s!==void 0&&(o.className=s),a&&a.appendChild(o),o}static createNS(e,s){return window.document.createElementNS(e,s)}static disableDrag(){ne.docStyle&&ne.selectProp&&(ne.userSelect=ne.docStyle[ne.selectProp],ne.docStyle[ne.selectProp]="none")}static enableDrag(){ne.docStyle&&ne.selectProp&&(ne.docStyle[ne.selectProp]=ne.userSelect)}static setTransform(e,s){e.style[ne.transformProp]=s}static addEventListener(e,s,a,o={}){e.addEventListener(s,a,"passive"in o?o:o.capture)}static removeEventListener(e,s,a,o={}){e.removeEventListener(s,a,"passive"in o?o:o.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",ne.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ne.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",ne.suppressClickInternal,!0)}),0)}static getScale(e){const s=e.getBoundingClientRect();return{x:s.width/e.offsetWidth||1,y:s.height/e.offsetHeight||1,boundingClientRect:s}}static getPoint(e,s,a){const o=s.boundingClientRect;return new p.P((a.clientX-o.left)/s.x-e.clientLeft,(a.clientY-o.top)/s.y-e.clientTop)}static mousePos(e,s){const a=ne.getScale(e);return ne.getPoint(e,a,s)}static touchPos(e,s){const a=[],o=ne.getScale(e);for(let c=0;c<s.length;c++)a.push(ne.getPoint(e,o,s[c]));return a}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}ne.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ne.selectProp=ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ne.transformProp=ne.testProp(["transform","WebkitTransform"]);const Vr={supported:!1,testSupport:function(h){!wr&&Wi&&(hr?Gs(h):br=h)}};let br,Wi,wr=!1,hr=!1;function Gs(h){const e=h.createTexture();h.bindTexture(h.TEXTURE_2D,e);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,Wi),h.isContextLost())return;Vr.supported=!0}catch{}h.deleteTexture(e),wr=!0}var hi;typeof document<"u"&&(Wi=document.createElement("img"),Wi.onload=()=>{br&&Gs(br),br=null,hr=!0},Wi.onerror=()=>{wr=!0,br=null},Wi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(h){let e,s,a,o;h.resetRequestQueue=()=>{e=[],s=0,a=0,o={}},h.addThrottleControl=y=>{const b=a++;return o[b]=y,b},h.removeThrottleControl=y=>{delete o[y],m()},h.getImage=(y,b,T=!0)=>new Promise(((S,C)=>{Vr.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:T,state:"queued",onError:E=>{C(E)},onSuccess:E=>{S(E)}}),m()}));const c=y=>p._(this,void 0,void 0,(function*(){y.state="running";const{requestParameters:b,supportImageRefresh:T,onError:S,onSuccess:C,abortController:E}=y,R=T===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((($,Z)=>$&&Z==="accept"),!0));s++;const V=R?g(b,E):p.m(b,E);try{const $=yield V;delete y.abortController,y.state="completed",$.data instanceof HTMLImageElement||p.b($.data)?C($):$.data&&C({data:yield(U=$.data,typeof createImageBitmap=="function"?p.d(U):p.f(U)),cacheControl:$.cacheControl,expires:$.expires})}catch($){delete y.abortController,S($)}finally{s--,m()}var U})),m=()=>{const y=(()=>{for(const b of Object.keys(o))if(o[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=s;b<y&&e.length>0;b++){const T=e.shift();T.abortController.signal.aborted?b--:c(T)}},g=(y,b)=>new Promise(((T,S)=>{const C=new Image,E=y.url,R=y.credentials;R&&R==="include"?C.crossOrigin="use-credentials":(R&&R==="same-origin"||!p.s(E))&&(C.crossOrigin="anonymous"),b.signal.addEventListener("abort",(()=>{C.src="",S(p.c())})),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,T({data:C})},C.onerror=()=>{C.onerror=C.onload=null,b.signal.aborted||S(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},C.src=E}))})(hi||(hi={})),hi.resetRequestQueue();class Ia{constructor(e){this._transformRequestFn=e}transformRequest(e,s){return this._transformRequestFn&&this._transformRequestFn(e,s)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Ei(h){var e=new p.A(3);return e[0]=h[0],e[1]=h[1],e[2]=h[2],e}var Ki,vi=function(h,e,s){return h[0]=e[0]-s[0],h[1]=e[1]-s[1],h[2]=e[2]-s[2],h};Ki=new p.A(3),p.A!=Float32Array&&(Ki[0]=0,Ki[1]=0,Ki[2]=0);var Pn=function(h){var e=h[0],s=h[1];return e*e+s*s};function Ji(h){const e=[];if(typeof h=="string")e.push({id:"default",url:h});else if(h&&h.length>0){const s=[];for(const{id:a,url:o}of h){const c=`${a}${o}`;s.indexOf(c)===-1&&(s.push(c),e.push({id:a,url:o}))}}return e}function Hs(h,e,s){const a=h.split("?");return a[0]+=`${e}${s}`,a.join("?")}(function(){var h=new p.A(2);p.A!=Float32Array&&(h[0]=0,h[1]=0)})();class nt{constructor(e,s,a,o){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this.update(s,o)}update(e,s,a){const{width:o,height:c}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===c||a),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(s&&s.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!s||s.premultiply!==!1)),m)this.size=[o,c],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,c,0,this.format,y.UNSIGNED_BYTE,e.data);else{const{x:b,y:T}=a||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,T,o,c,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,s,a){const{context:o}=this,{gl:c}=o;c.bindTexture(c.TEXTURE_2D,this.texture),a!==c.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=c.LINEAR),e!==this.filter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a||e),this.filter=e),s!==this.wrap&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,s),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,s),this.wrap=s)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function An(h){const{userImage:e}=h;return!!(e&&e.render&&e.render())&&(h.data.replace(new Uint8Array(e.data.buffer)),!0)}class Ft extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:s,promiseResolve:a}of this.requestors)a(this._getImagesForIds(s));this.requestors=[]}}getImage(e){const s=this.images[e];if(s&&!s.data&&s.spriteData){const a=s.spriteData;s.data=new p.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),s.spriteData=null}return s}addImage(e,s){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,s)&&(this.images[e]=s)}_validate(e,s){let a=!0;const o=s.data||s.spriteData;return this._validateStretch(s.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),a=!1),this._validateStretch(s.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),a=!1),this._validateContent(s.content,s)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),a=!1),a}_validateStretch(e,s){if(!e)return!0;let a=0;for(const o of e){if(o[0]<a||o[1]<o[0]||s<o[1])return!1;a=o[1]}return!0}_validateContent(e,s){if(!e)return!0;if(e.length!==4)return!1;const a=s.spriteData,o=a&&a.width||s.data.width,c=a&&a.height||s.data.height;return!(e[0]<0||o<e[0]||e[1]<0||c<e[1]||e[2]<0||o<e[2]||e[3]<0||c<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,s,a=!0){const o=this.getImage(e);if(a&&(o.data.width!==s.data.width||o.data.height!==s.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${s.data.width}x${s.data.height}).`);s.version=o.version+1,this.images[e]=s,this.updatedImages[e]=!0}removeImage(e){const s=this.images[e];delete this.images[e],delete this.patterns[e],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((s,a)=>{let o=!0;if(!this.isLoaded())for(const c of e)this.images[c]||(o=!1);this.isLoaded()||o?s(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:s})}))}_getImagesForIds(e){const s={};for(const a of e){let o=this.getImage(a);o||(this.fire(new p.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?s[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${a}" 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 s}getPixelSize(){const{width:e,height:s}=this.atlasImage;return{width:e,height:s}}getPattern(e){const s=this.patterns[e],a=this.getImage(e);if(!a)return null;if(s&&s.position.version===a.version)return s.position;if(s)s.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},c=new p.I(o,a);this.patterns[e]={bin:o,position:c}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const s=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new nt(e,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const c in this.patterns)e.push(this.patterns[c].bin);const{w:s,h:a}=p.p(e),o=this.atlasImage;o.resize({width:s||1,height:a||1});for(const c in this.patterns){const{bin:m}=this.patterns[c],g=m.x+1,y=m.y+1,b=this.getImage(c).data,T=b.width,S=b.height;p.R.copy(b,o,{x:0,y:0},{x:g,y},{width:T,height:S}),p.R.copy(b,o,{x:0,y:S-1},{x:g,y:y-1},{width:T,height:1}),p.R.copy(b,o,{x:0,y:0},{x:g,y:y+S},{width:T,height:1}),p.R.copy(b,o,{x:T-1,y:0},{x:g-1,y},{width:1,height:S}),p.R.copy(b,o,{x:0,y:0},{x:g+T,y},{width:1,height:S})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const s of e){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const a=this.getImage(s);a||p.w(`Image with ID: "${s}" was not found`),An(a)&&this.updateImage(s,a)}}}const Ht=1e20;function ur(h,e,s,a,o,c,m,g,y){for(let b=e;b<e+a;b++)os(h,s*c+b,c,o,m,g,y);for(let b=s;b<s+o;b++)os(h,b*c+e,1,a,m,g,y)}function os(h,e,s,a,o,c,m){c[0]=0,m[0]=-Ht,m[1]=Ht,o[0]=h[e];for(let g=1,y=0,b=0;g<a;g++){o[g]=h[e+g*s];const T=g*g;do{const S=c[y];b=(o[g]-o[S]+T-S*S)/(g-S)/2}while(b<=m[y]&&--y>-1);y++,c[y]=g,m[y]=b,m[y+1]=Ht}for(let g=0,y=0;g<a;g++){for(;m[y+1]<g;)y++;const b=c[y],T=g-b;h[e+g*s]=o[b]+T*T}}class Yi{constructor(e,s){this.requestManager=e,this.localIdeographFontFamily=s,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return p._(this,void 0,void 0,(function*(){const s=[];for(const c in e)for(const m of e[c])s.push(this._getAndCacheGlyphsPromise(c,m));const a=yield Promise.all(s),o={};for(const{stack:c,id:m,glyph:g}of a)o[c]||(o[c]={}),o[c][m]=g&&{id:g.id,bitmap:g.bitmap.clone(),metrics:g.metrics};return o}))}_getAndCacheGlyphsPromise(e,s){return p._(this,void 0,void 0,(function*(){let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}});let o=a.glyphs[s];if(o!==void 0)return{stack:e,id:s,glyph:o};if(o=this._tinySDF(a,e,s),o)return a.glyphs[s]=o,{stack:e,id:s,glyph:o};const c=Math.floor(s/256);if(256*c>65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[c])return{stack:e,id:s,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[c]){const g=Yi.loadGlyphRange(e,c,this.url,this.requestManager);a.requests[c]=g}const m=yield a.requests[c];for(const g in m)this._doesCharSupportLocalGlyph(+g)||(a.glyphs[+g]=m[+g]);return a.ranges[c]=!0,{stack:e,id:s,glyph:m[s]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,s,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let c=e.tinySDF;if(!c){let g="400";/bold/i.test(s)?g="900":/medium/i.test(s)?g="500":/light/i.test(s)&&(g="200"),c=e.tinySDF=new Yi.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:g})}const m=c.draw(String.fromCharCode(a));return{id:a,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}Yi.loadGlyphRange=function(h,e,s,a){return p._(this,void 0,void 0,(function*(){const o=256*e,c=o+255,m=a.transformRequest(s.replace("{fontstack}",h).replace("{range}",`${o}-${c}`),"Glyphs"),g=yield p.l(m,new AbortController);if(!g||!g.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${c}`);const y={};for(const b of p.n(g.data))y[b.id]=b;return y}))},Yi.TinySDF=class{constructor({fontSize:h=24,buffer:e=3,radius:s=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:c="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=a,this.radius=s;const g=this.size=h+4*e,y=this._createCanvas(g),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${c} ${h}px ${o}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(h){const e=document.createElement("canvas");return e.width=e.height=h,e}draw(h){const{width:e,actualBoundingBoxAscent:s,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:c}=this.ctx.measureText(h),m=Math.ceil(s),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),b=g+2*this.buffer,T=y+2*this.buffer,S=Math.max(b*T,0),C=new Uint8ClampedArray(S),E={data:C,width:b,height:T,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(g===0||y===0)return E;const{ctx:R,buffer:V,gridInner:U,gridOuter:$}=this;R.clearRect(V,V,g,y),R.fillText(h,V,V+m);const Z=R.getImageData(V,V,g,y);$.fill(Ht,0,S),U.fill(0,0,S);for(let B=0;B<y;B++)for(let X=0;X<g;X++){const K=Z.data[4*(B*g+X)+3]/255;if(K===0)continue;const ee=(B+V)*b+X+V;if(K===1)$[ee]=0,U[ee]=Ht;else{const oe=.5-K;$[ee]=oe>0?oe*oe:0,U[ee]=oe<0?oe*oe:0}}ur($,0,0,b,T,b,this.f,this.v,this.z),ur(U,V,V,g,y,b,this.f,this.v,this.z);for(let B=0;B<S;B++){const X=Math.sqrt($[B])-Math.sqrt(U[B]);C[B]=Math.round(255-255*(X/this.radius+this.cutoff))}return E}};class Mn{constructor(){this.specification=p.v.light.position}possiblyEvaluate(e,s){return p.x(e.expression.evaluate(s))}interpolate(e,s,a){return{x:p.y.number(e.x,s.x,a),y:p.y.number(e.y,s.y,a),z:p.y.number(e.z,s.z,a)}}}let Nr;class dr extends p.E{constructor(e){super(),Nr=Nr||new p.q({anchor:new p.D(p.v.light.anchor),position:new Mn,color:new p.D(p.v.light.color),intensity:new p.D(p.v.light.intensity)}),this._transitionable=new p.T(Nr),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,s={}){if(!this._validate(p.r,e,s))for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,s,a){return(!a||a.validate!==!1)&&p.t(this,e.call(p.u,{value:s,style:{glyphs:!0,sprite:!0},styleSpec:p.v}))}}const ei=new p.q({"sky-color":new p.D(p.v.sky["sky-color"]),"horizon-color":new p.D(p.v.sky["horizon-color"]),"fog-color":new p.D(p.v.sky["fog-color"]),"fog-ground-blend":new p.D(p.v.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.v.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.v.sky["atmosphere-blend"])});class Di extends p.E{constructor(e){super(),this._transitionable=new p.T(ei),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.z(0))}setSky(e,s={}){if(!this._validate(p.B,e,s)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,s,a={}){return(a==null?void 0:a.validate)!==!1&&p.t(this,e.call(p.u,p.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:p.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class ls{constructor(e,s){this.width=e,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,s){const a=e.join(",")+String(s);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(e,s)),this.dashEntry[a]}getDashRanges(e,s,a){const o=[];let c=e.length%2==1?-e[e.length-1]*a:0,m=e[0]*a,g=!0;o.push({left:c,right:m,isDash:g,zeroLength:e[0]===0});let y=e[0];for(let b=1;b<e.length;b++){g=!g;const T=e[b];c=y*a,y+=T,m=y*a,o.push({left:c,right:m,isDash:g,zeroLength:T===0})}return o}addRoundDash(e,s,a){const o=s/2;for(let c=-a;c<=a;c++){const m=this.width*(this.nextRow+a+c);let g=0,y=e[g];for(let b=0;b<this.width;b++){b/y.right>1&&(y=e[++g]);const T=Math.abs(b-y.left),S=Math.abs(b-y.right),C=Math.min(T,S);let E;const R=c/a*(o+1);if(y.isDash){const V=o-Math.abs(R);E=Math.sqrt(C*C+V*V)}else E=o-Math.sqrt(C*C+R*R);this.data[m+b]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e){for(let g=e.length-1;g>=0;--g){const y=e[g],b=e[g+1];y.zeroLength?e.splice(g,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(g,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const o=this.width*this.nextRow;let c=0,m=e[c];for(let g=0;g<this.width;g++){g/m.right>1&&(m=e[++c]);const y=Math.abs(g-m.left),b=Math.abs(g-m.right),T=Math.min(y,b);this.data[o+g]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,s){const a=s?7:0,o=2*a+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let c=0;for(let g=0;g<e.length;g++)c+=e[g];if(c!==0){const g=this.width/c,y=this.getDashRanges(e,this.width,g);s?this.addRoundDash(y,g,a):this.addRegularDash(y)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:c};return this.nextRow+=o,this.dirty=!0,m}bind(e){const s=e.gl;this.texture?(s.bindTexture(s.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,s.texSubImage2D(s.TEXTURE_2D,0,0,0,this.width,this.height,s.ALPHA,s.UNSIGNED_BYTE,this.data))):(this.texture=s.createTexture(),s.bindTexture(s.TEXTURE_2D,this.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,this.width,this.height,0,s.ALPHA,s.UNSIGNED_BYTE,this.data))}}const Tr="maplibre_preloaded_worker_pool";class Qi{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Qi.workerCount;)this.workers.push(new Worker(p.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((s=>{s.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Tr]}numActive(){return Object.keys(this.active).length}}const cs=Math.floor(me.hardwareConcurrency/2);let ui,Li;function jr(){return ui||(ui=new Qi),ui}Qi.workerCount=p.C(globalThis)?Math.max(Math.min(cs,3),1):1;class Ur{constructor(e,s){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=s;const a=this.workerPool.acquire(s);for(let o=0;o<a.length;o++){const c=new p.F(a[o],s);c.name=`Worker ${o}`,this.actors.push(c)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,s){const a=[];for(const o of this.actors)a.push(o.sendAsync({type:e,data:s}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((s=>{s.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,s){for(const a of this.actors)a.registerMessageHandler(e,s)}}function Xs(){return Li||(Li=new Ur(jr(),p.G),Li.registerMessageHandler("GR",((h,e,s)=>p.m(e,s)))),Li}function pr(h,e){const s=p.H();return p.J(s,s,[1,1,0]),p.K(s,s,[.5*h.width,.5*h.height,1]),p.L(s,s,h.calculatePosMatrix(e.toUnwrapped()))}function Sr(h,e,s,a,o,c){const m=(function(S,C,E){if(S)for(const R of S){const V=C[R];if(V&&V.source===E&&V.type==="fill-extrusion")return!0}else for(const R in C){const V=C[R];if(V.source===E&&V.type==="fill-extrusion")return!0}return!1})(o&&o.layers,e,h.id),g=c.maxPitchScaleFactor(),y=h.tilesIn(a,g,m);y.sort(Ir);const b=[];for(const S of y)b.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(e,s,h._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,o,c,g,pr(h.transform,S.tileID))});const T=(function(S){const C={},E={};for(const R of S){const V=R.queryResults,U=R.wrappedTileID,$=E[U]=E[U]||{};for(const Z in V){const B=V[Z],X=$[Z]=$[Z]||{},K=C[Z]=C[Z]||[];for(const ee of B)X[ee.featureIndex]||(X[ee.featureIndex]=!0,K.push(ee))}}return C})(b);for(const S in T)T[S].forEach((C=>{const E=C.feature,R=h.getFeatureState(E.layer["source-layer"],E.id);E.source=E.layer.source,E.layer["source-layer"]&&(E.sourceLayer=E.layer["source-layer"]),E.state=R}));return T}function Ir(h,e){const s=h.tileID,a=e.tileID;return s.overscaledZ-a.overscaledZ||s.canonical.y-a.canonical.y||s.wrap-a.wrap||s.canonical.x-a.canonical.x}function hs(h,e,s){return p._(this,void 0,void 0,(function*(){let a=h;if(h.url?a=(yield p.h(e.transformRequest(h.url,"Source"),s)).data:yield me.frameAsync(s),!a)return null;const o=p.M(p.e(a,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map((c=>c.id))),o}))}class ie{constructor(e,s){e&&(s?this.setSouthWest(e).setNorthEast(s):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){const s=this._sw,a=this._ne;let o,c;if(e instanceof p.N)o=e,c=e;else{if(!(e instanceof ie))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ie.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(o=e._sw,c=e._ne,!o||!c)return this}return s||a?(s.lng=Math.min(o.lng,s.lng),s.lat=Math.min(o.lat,s.lat),a.lng=Math.max(c.lng,a.lng),a.lat=Math.max(c.lat,a.lat)):(this._sw=new p.N(o.lng,o.lat),this._ne=new p.N(c.lng,c.lat)),this}getCenter(){return new p.N((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 p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(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(e){const{lng:s,lat:a}=p.N.convert(e);let o=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(e){return e instanceof ie?e:e&&new ie(e)}static fromLngLat(e,s=0){const a=360*s/40075017,o=a/Math.cos(Math.PI/180*e.lat);return new ie(new p.N(e.lng-o,e.lat-a),new p.N(e.lng+o,e.lat+a))}adjustAntiMeridian(){const e=new p.N(this._sw.lng,this._sw.lat),s=new p.N(this._ne.lng,this._ne.lat);return new ie(e,e.lng>s.lng?new p.N(s.lng+360,s.lat):s)}}class $r{constructor(e,s,a){this.bounds=ie.convert(this.validateBounds(e)),this.minzoom=s||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const s=Math.pow(2,e.z),a=Math.floor(p.O(this.bounds.getWest())*s),o=Math.floor(p.Q(this.bounds.getNorth())*s),c=Math.ceil(p.O(this.bounds.getEast())*s),m=Math.ceil(p.Q(this.bounds.getSouth())*s);return e.x>=a&&e.x<c&&e.y>=o&&e.y<m}}class Ws extends p.E{constructor(e,s,a,o){if(super(),this.id=e,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.M(s,["url","scheme","tileSize","promoteId"])),this._options=p.e({type:"vector"},s),this._collectResourceTiming=s.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield hs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(p.e(this,e),e.bounds&&(this.tileBounds=new $r(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,(function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(s,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise(((c,m)=>{e.reloadPromise={resolve:c,reject:m}}))}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{const c=yield e.actor.sendAsync({type:o,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,c)}catch(c){if(delete e.abortController,e.aborted)return;if(c&&c.status!==404)throw c;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,s){if(s&&s.resourceTiming&&(e.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&e.setExpiryData(s),e.loadVectorData(s,this.map.painter),e.reloadPromise){const a=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(a.resolve).catch(a.reject)}}abortTile(e){return p._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class et extends p.E{constructor(e,s,a,o){super(),this.id=e,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},s),p.e(this,p.M(s,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield hs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new $r(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,(function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const a=yield hi.getImage(this.map._requestManager.transformRequest(s,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,c=o.gl,m=a.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new nt(o,m,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}))}abortTile(e){return p._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class yt extends et{constructor(e,s,a,o){super(e,s,a,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(e){return p._(this,void 0,void 0,(function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(s,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const o=yield hi.getImage(a,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){const c=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const m=p.b(c)&&p.U()?c:yield this.readImageNow(c),g={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const y=yield e.actor.sendAsync({type:"LDT",data:g});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}}))}readImageNow(e){return p._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&p.V()){const s=e.width+2,a=e.height+2;try{return new p.R({width:s,height:a},yield p.W(e,-1,-1,s,a))}catch{}}return me.getImageData(e,1)}))}_getNeighboringTiles(e){const s=e.canonical,a=Math.pow(2,s.z),o=(s.x-1+a)%a,c=s.x===0?e.wrap-1:e.wrap,m=(s.x+1+a)%a,g=s.x+1===a?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,c,s.z,o,s.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,g,s.z,m,s.y).key]={backfilled:!1},s.y>0&&(y[new p.S(e.overscaledZ,c,s.z,o,s.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,g,s.z,m,s.y-1).key]={backfilled:!1}),s.y+1<a&&(y[new p.S(e.overscaledZ,c,s.z,o,s.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,g,s.z,m,s.y+1).key]={backfilled:!1}),y}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))}))}}class Ks extends p.E{constructor(e,s,a,o){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(o),this._data=s.data,this._options=p.e({},s),this._collectResourceTiming=s.collectResourceTiming,s.maxzoom!==void 0&&(this.maxzoom=s.maxzoom),s.type&&(this.type=s.type),s.attribution&&(this.attribution=s.attribution),this.promoteId=s.promoteId;const c=p.X/this.tileSize;s.clusterMaxZoom!==void 0&&this.maxzoom<=s.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${s.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:(s.buffer!==void 0?s.buffer:128)*c,tolerance:(s.tolerance!==void 0?s.tolerance:.375)*c,extent:p.X,maxZoom:this.maxzoom,lineMetrics:s.lineMetrics||!1,generateId:s.generateId||!1},superclusterOptions:{maxZoom:s.clusterMaxZoom!==void 0?s.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,s.clusterMinPoints||2),extent:p.X,radius:(s.clusterRadius||50)*c,log:!1,generateId:s.generateId||!1},clusterProperties:s.clusterProperties,filter:s.filter},s.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return p._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return p._(this,void 0,void 0,(function*(){const e=p.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,s,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:s,offset:a}})}_updateWorkerData(e){return p._(this,void 0,void 0,(function*(){const s=p.e({type:this.type},this.workerOptions);e?s.dataDiff=e:typeof this._data=="string"?(s.request=this.map._requestManager.transformRequest(me.resolveURL(this._data),"Source"),s.request.collectResourceTiming=this._collectResourceTiming):s.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new p.k("dataloading",{dataType:"source"}));try{const a=yield this.actor.sendAsync({type:"LD",data:s});if(this._pendingLoads--,this._removed||a.abandoned)return void this.fire(new p.k("dataabort",{dataType:"source"}));let o=null;a.resourceTiming&&a.resourceTiming[this.id]&&(o=a.resourceTiming[this.id].slice(0));const c={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&p.e(c,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(a))}}))}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,(function*(){const s=e.actor?"RT":"LT";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;const o=yield this.actor.sendAsync({type:s,data:a},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,s==="RT")}))}abortTile(e){return p._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Pr=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fr extends p.E{constructor(e,s,a,o){super(),this.id=e,this.dispatcher=a,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=s}load(e){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const s=yield hi.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,s&&s.data&&(this.image=s.data,e&&(this.coordinates=e),this._finishLoading())}catch(s){this._request=null,this._loaded=!0,this.fire(new p.j(s))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const s=e.map(p.Z.fromLngLat);this.tileID=(function(o){let c=1/0,m=1/0,g=-1/0,y=-1/0;for(const C of o)c=Math.min(c,C.x),m=Math.min(m,C.y),g=Math.max(g,C.x),y=Math.max(y,C.y);const b=Math.max(g-c,y-m),T=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),S=Math.pow(2,T);return new p.a1(T,Math.floor((c+g)/2*S),Math.floor((m+y)/2*S))})(s),this.minzoom=this.maxzoom=this.tileID.z;const a=s.map((o=>this.tileID.getTilePoint(o)._round()));return this._boundsArray=new p.$,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,p.X,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,p.X),this._boundsArray.emplaceBack(a[2].x,a[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Pr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new nt(e,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class us extends fr{constructor(e,s,a,o){super(e,s,a,o),this.roundZoom=!0,this.type="video",this.options=s}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const s of e.urls)this.urls.push(this.map._requestManager.transformRequest(s,"Source").url);try{const s=yield p.a3(this.urls);if(this._loaded=!0,!s)return;this.video=s,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(s){this.fire(new p.j(s))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const s=this.video.seekable;e<s.start(0)||e>s.end(0)?this.fire(new p.j(new p.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Pr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new nt(e,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new p.k("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 bi extends fr{constructor(e,s,a,o){super(e,s,a,o),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some((c=>!Array.isArray(c)||c.length!==2||c.some((m=>typeof m!="number"))))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){return p._(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 p.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const s=this.map.painter.context,a=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,Pr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new nt(s,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const c in this.tiles){const m=this.tiles[c];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Js={},Ys=h=>{switch(h){case"geojson":return Ks;case"image":return fr;case"raster":return et;case"raster-dem":return yt;case"vector":return Ws;case"video":return us;case"canvas":return bi}return Js[h]},ue="RTLPluginLoaded";class er extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Xs()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((s=>{throw this.status="error",s}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,(function*(s,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=me.resolveURL(s),!this.url)throw new Error(`requested url ${s} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return p._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(ue))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Xt=null;function tr(){return Xt||(Xt=new er),Xt}class Ar{constructor(e,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.a4(),this.uses=0,this.tileSize=s,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const s=e+this.timeAdded;s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,s,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=(function(o,c){const m={};if(!c)return m;for(const g of o){const y=g.layerIds.map((b=>c.getLayer(b))).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map((b=>y.filter((T=>T.id===b))[0])));for(const b of y)m[b.id]=g}}return m})(e.buckets,s.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const c=this.buckets[o];if(c instanceof p.a6){if(this.hasSymbolBuckets=!0,!a)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const c=this.buckets[o];if(c instanceof p.a6&&c.hasRTLText){this.hasRTLText=!0,tr().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const c=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(o).queryRadius(c))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(e)}const s=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new nt(e,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new nt(e,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,s,a,o,c,m,g,y,b,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:c,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:g,queryPadding:this.queryPadding*b},e,s,a):{}}querySourceFeatures(e,s){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),c=s&&s.sourceLayer?s.sourceLayer:"",m=o._geojsonTileLayer||o[c];if(!m)return;const g=p.a7(s&&s.filter),{z:y,x:b,y:T}=this.tileID.canonical,S={z:y,x:b,y:T};for(let C=0;C<m.length;C++){const E=m.feature(C);if(g.needGeometry){const U=p.a8(E,!0);if(!g.filter(new p.z(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!g.filter(new p.z(this.tileID.overscaledZ),E))continue;const R=a.getId(E,c),V=new p.a9(E,y,b,T,R);V.tile=S,e.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const s=this.expirationTime;if(e.cacheControl){const a=p.aa(e.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const a=Date.now();let o=!1;if(this.expirationTime>a)o=!1;else if(s)if(this.expirationTime<s)o=!0;else{const c=this.expirationTime-s;c?this.expirationTime=a+Math.max(c,3e4):o=!0}else o=!0;o?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const o in this.buckets){if(!s.style.hasLayer(o))continue;const c=this.buckets[o],m=c.layers[0].sourceLayer||"_geojsonTileLayer",g=a[m],y=e[m];if(!g||!y||Object.keys(y).length===0)continue;c.update(y,g,this.imageAtlas&&this.imageAtlas.patternPositions||{});const b=s&&s.style&&s.style.getLayer(o);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(c)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<me.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=me.now()+e}setDependencies(e,s){const a={};for(const o of s)a[o]=!0;this.dependencies[e]=a}hasDependency(e,s){for(const a of e){const o=this.dependencies[a];if(o){for(const c of s)if(o[c])return!0}}return!1}}class _e{constructor(e,s){this.max=e,this.onRemove=s,this.reset()}reset(){for(const e in this.data)for(const s of this.data[e])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(e,s,a){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const c={value:s,timeout:void 0};if(a!==void 0&&(c.timeout=setTimeout((()=>{this.remove(e,c)}),a)),this.data[o].push(c),this.order.push(o),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const s=this.data[e].shift();return s.timeout&&clearTimeout(s.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),s.value}getByKey(e){const s=this.data[e];return s?s[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,s){if(!this.has(e))return this;const a=e.wrapped().key,o=s===void 0?0:this.data[a].indexOf(s),c=this.data[a][o];return this.data[a].splice(o,1),c.timeout&&clearTimeout(c.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(c.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(e){const s=[];for(const a in this.data)for(const o of this.data[a])e(o.value)||s.push(o);for(const a of s)this.remove(a.value.tileID,a)}}class $e{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,s,a){const o=String(s);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},p.e(this.stateChanges[e][o],a),this.deletedStates[e]===null){this.deletedStates[e]={};for(const c in this.state[e])c!==o&&(this.deletedStates[e][c]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const c in this.state[e][o])a[c]||(this.deletedStates[e][o][c]=null)}else for(const c in a)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][c]===null&&delete this.deletedStates[e][o][c]}removeFeatureState(e,s,a){if(this.deletedStates[e]===null)return;const o=String(s);if(this.deletedStates[e]=this.deletedStates[e]||{},a&&s!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][a]=null);else if(s!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(a in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][a]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,s){const a=String(s),o=p.e({},(this.state[e]||{})[a],(this.stateChanges[e]||{})[a]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const c=this.deletedStates[e][s];if(c===null)return{};for(const m in c)delete o[m]}return o}initializeTileState(e,s){e.setFeatureState(this.state,s)}coalesceChanges(e,s){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const c={};for(const m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),c[m]=this.state[o][m];a[o]=c}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const c={};if(this.deletedStates[o]===null)for(const m in this.state[o])c[m]={},this.state[o][m]={};else for(const m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(const g of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][g];c[m]=this.state[o][m]}a[o]=a[o]||{},p.e(a[o],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in e)e[o].setFeatureState(a,s)}}class Be extends p.E{constructor(e,s,a){super(),this.id=e,this.dispatcher=a,this.on("data",(o=>this._dataHandler(o))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((o,c,m,g)=>{const y=new(Ys(c.type))(o,c,m,g);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,s,a,this),this._tiles={},this._cache=new _e(0,(o=>this._unloadTile(o))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new $e,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const s=this._tiles[e];if(s.state!=="loaded"&&s.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,s,a){return p._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,s,a)}catch(o){e.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const a=this._tiles[s];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(ti).map((e=>e.key))}getRenderableIds(e){const s=[];for(const a in this._tiles)this._isIdRenderable(a,e)&&s.push(this._tiles[a]);return e?s.sort(((a,o)=>{const c=a.tileID,m=o.tileID,g=new p.P(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x})).map((a=>a.tileID.key)):s.map((a=>a.tileID)).sort(ti).map((a=>a.key))}hasRenderableParent(e){const s=this.findLoadedParent(e,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(e,s){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(s||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,s){return p._(this,void 0,void 0,(function*(){const a=this._tiles[e];a&&(a.state!=="loading"&&(a.state=s),yield this._loadTile(a,e,s))}))}_tileLoaded(e,s,a){e.timeAdded=me.now(),a==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(s,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const s=this.getRenderableIds();for(let o=0;o<s.length;o++){const c=s[o];if(e.neighboringTiles&&e.neighboringTiles[c]){const m=this.getTileByID(c);a(e,m),a(m,e)}}function a(o,c){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let m=c.tileID.canonical.x-o.tileID.canonical.x;const g=c.tileID.canonical.y-o.tileID.canonical.y,y=Math.pow(2,o.tileID.canonical.z),b=c.tileID.key;m===0&&g===0||Math.abs(g)>1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),c.dem&&o.dem&&(o.dem.backfillBorder(c.dem,m,g),o.neighboringTiles&&o.neighboringTiles[b]&&(o.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,s,a,o){for(const c in this._tiles){let m=this._tiles[c];if(o[c]||!m.hasData()||m.tileID.overscaledZ<=s||m.tileID.overscaledZ>a)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>s+1;){const b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(g=b)}let y=g;for(;y.overscaledZ>s;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[g.key]=g;break}}}findLoadedParent(e,s){if(e.key in this._loadedParentTiles){const a=this._loadedParentTiles[e.key];return a&&a.tileID.overscaledZ>=s?a:null}for(let a=e.overscaledZ-1;a>=s;a--){const o=e.scaledTo(a),c=this._getLoadedTile(o);if(c)return c}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const s=this._tiles[e.key];return s&&s.hasData()?s:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const s=Math.ceil(e.width/this._source.tileSize)+1,a=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(s*a*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),c=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(c)}handleWrapJump(e){const s=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,s){const a={};for(const o in this._tiles){const c=this._tiles[o];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+s),a[c.tileID.key]=c}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,s,a,o,c,m){const g={},y={},b=Object.keys(e),T=me.now();for(const S of b){const C=e[S],E=this._tiles[S];if(!E||E.fadeEndTime!==0&&E.fadeEndTime<=T)continue;const R=this.findLoadedParent(C,s),V=this.findLoadedSibling(C),U=R||V||null;U&&(this._addTile(U.tileID),g[U.tileID.key]=U.tileID),y[S]=C}this._retainLoadedChildren(y,o,a,e);for(const S in g)e[S]||(this._coveredTiles[S]=!0,e[S]=g[S]);if(m){const S={},C={};for(const E of c)this._tiles[E.key].hasData()?S[E.key]=E:C[E.key]=E;for(const E in C){const R=C[E].children(this._source.maxzoom);this._tiles[R[0].key]&&this._tiles[R[1].key]&&this._tiles[R[2].key]&&this._tiles[R[3].key]&&(S[R[0].key]=e[R[0].key]=R[0],S[R[1].key]=e[R[1].key]=R[1],S[R[2].key]=e[R[2].key]=R[2],S[R[3].key]=e[R[3].key]=R[3],delete C[E])}for(const E in C){const R=C[E],V=this.findLoadedParent(R,this._source.minzoom),U=this.findLoadedSibling(R),$=V||U||null;if($){S[$.tileID.key]=e[$.tileID.key]=$.tileID;for(const Z in S)S[Z].isChildOf($.tileID)&&delete S[Z]}}for(const E in this._tiles)S[E]||(this._coveredTiles[E]=!0)}}update(e,s){if(!this._sourceLoaded||this._paused)return;let a;this.transform=e,this.terrain=s,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((T=>new p.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y))):(a=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:s}),this._source.hasTile&&(a=a.filter((T=>this._source.hasTile(T))))):a=[];const o=e.coveringZoomLevel(this._source),c=Math.max(o-Be.maxOverzooming,this._source.minzoom),m=Math.max(o+Be.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const S of a)if(S.canonical.z>this._source.minzoom){const C=S.scaledTo(S.canonical.z-1);T[C.key]=C;const E=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));T[E.key]=E}a=a.concat(Object.values(T))}const g=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);Ri(this._source.type)&&this._updateCoveredAndRetainedTiles(y,c,m,o,a,s);for(const T in y)this._tiles[T].clearFadeHold();const b=p.ab(this._tiles,y);for(const T of b){const S=this._tiles[T];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,s){var a;const o={},c={},m=Math.max(s-Be.maxOverzooming,this._source.minzoom),g=Math.max(s+Be.maxUnderzooming,this._source.minzoom),y={};for(const b of e){const T=this._addTile(b);o[b.key]=b,T.hasData()||s<this._source.maxzoom&&(y[b.key]=b)}this._retainLoadedChildren(y,s,g,o);for(const b of e){let T=this._tiles[b.key];if(T.hasData())continue;if(s+1>this._source.maxzoom){const C=b.children(this._source.maxzoom)[0],E=this.getTile(C);if(E&&E.hasData()){o[C.key]=C;continue}}else{const C=b.children(this._source.maxzoom);if(o[C[0].key]&&o[C[1].key]&&o[C[2].key]&&o[C[3].key])continue}let S=T.wasRequested();for(let C=b.overscaledZ-1;C>=m;--C){const E=b.scaledTo(C);if(c[E.key])break;if(c[E.key]=!0,T=this.getTile(E),!T&&S&&(T=this._addTile(E)),T){const R=T.hasData();if((R||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||S)&&(o[E.key]=E),S=T.wasRequested(),R)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const s=[];let a,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}s.push(o.key);const c=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(c),a)break;o=c}for(const c of s)this._loadedParentTiles[c]=a}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const s=this._tiles[e].tileID,a=this._getLoadedTile(s);this._loadedSiblingTiles[s.key]=a}}_addTile(e){let s=this._tiles[e.key];if(s)return s;s=this._cache.getAndRemove(e),s&&(this._setTileReloadTimer(e.key,s),s.tileID=e,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,s)));const a=s;return s||(s=new Ar(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(s,e.key,s.state)),s.uses++,this._tiles[e.key]=s,a||this._source.fire(new p.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(e,s){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const a=s.getExpiryTimeout();a&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),a))}_removeTile(e){const s=this._tiles[e];s&&(s.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}_dataHandler(e){const s=e.sourceDataType;e.dataType==="source"&&s==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&s==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,s,a){const o=[],c=this.transform;if(!c)return o;const m=a?c.getCameraQueryGeometry(e):e,g=e.map((R=>c.pointCoordinate(R,this.terrain))),y=m.map((R=>c.pointCoordinate(R,this.terrain))),b=this.getIds();let T=1/0,S=1/0,C=-1/0,E=-1/0;for(const R of y)T=Math.min(T,R.x),S=Math.min(S,R.y),C=Math.max(C,R.x),E=Math.max(E,R.y);for(let R=0;R<b.length;R++){const V=this._tiles[b[R]];if(V.holdingForFade())continue;const U=V.tileID,$=Math.pow(2,c.zoom-V.tileID.overscaledZ),Z=s*V.queryPadding*p.X/V.tileSize/$,B=[U.getTilePoint(new p.Z(T,S)),U.getTilePoint(new p.Z(C,E))];if(B[0].x-Z<p.X&&B[0].y-Z<p.X&&B[1].x+Z>=0&&B[1].y+Z>=0){const X=g.map((ee=>U.getTilePoint(ee))),K=y.map((ee=>U.getTilePoint(ee)));o.push({tile:V,tileID:U,queryGeometry:X,cameraQueryGeometry:K,scale:$})}}return o}getVisibleCoordinates(e){const s=this.getRenderableIds(e).map((a=>this._tiles[a].tileID));for(const a of s)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(Ri(this._source.type)){const e=me.now();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=e)return!0}return!1}setFeatureState(e,s,a){this._state.updateState(e=e||"_geojsonTileLayer",s,a)}removeFeatureState(e,s,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",s,a)}getFeatureState(e,s){return this._state.getState(e=e||"_geojsonTileLayer",s)}setDependencies(e,s,a){const o=this._tiles[e];o&&o.setDependencies(s,a)}reloadTilesForDependencies(e,s){for(const a in this._tiles)this._tiles[a].hasDependency(e,s)&&this._reloadTile(a,"reloading");this._cache.filter((a=>!a.hasDependency(e,s)))}}function ti(h,e){const s=Math.abs(2*h.wrap)-+(h.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return h.overscaledZ-e.overscaledZ||a-s||e.canonical.y-h.canonical.y||e.canonical.x-h.canonical.x}function Ri(h){return h==="raster"||h==="image"||h==="video"}Be.maxOverzooming=10,Be.maxUnderzooming=3;class Ne{constructor(e,s){this.reset(e,s)}reset(e,s){this.points=e||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(s||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=p.ac(e,0,1);let s=1,a=this._distances[s];const o=e*this.paddedLength+this.padding;for(;a<o&&s<this._distances.length;)a=this._distances[++s];const c=s-1,m=this._distances[c],g=a-m,y=g>0?(o-m)/g:0;return this.points[c].mult(1-y).add(this.points[s].mult(y))}}function ir(h,e){let s=!0;return h==="always"||h!=="never"&&e!=="never"||(s=!1),s}class mr{constructor(e,s,a){const o=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(s/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)o.push([]),c.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=s,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,s,a,o,c){this._forEachCell(s,a,o,c,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(c)}insertCircle(e,s,a,o){this._forEachCell(s-o,a-o,s+o,a+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(s),this.circles.push(a),this.circles.push(o)}_insertBoxCell(e,s,a,o,c,m){this.boxCells[c].push(m)}_insertCircleCell(e,s,a,o,c,m){this.circleCells[c].push(m)}_query(e,s,a,o,c,m,g){if(a<0||e>this.width||o<0||s>this.height)return[];const y=[];if(e<=0&&s<=0&&this.width<=a&&this.height<=o){if(c)return[{key:null,x1:e,y1:s,x2:a,y2:o}];for(let b=0;b<this.boxKeys.length;b++)y.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const T=this.circles[3*b],S=this.circles[3*b+1],C=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:T-C,y1:S-C,x2:T+C,y2:S+C})}}else this._forEachCell(e,s,a,o,this._queryCell,y,{hitTest:c,overlapMode:m,seenUids:{box:{},circle:{}}},g);return y}query(e,s,a,o){return this._query(e,s,a,o,!1,null)}hitTest(e,s,a,o,c,m){return this._query(e,s,a,o,!0,c,m).length>0}hitTestCircle(e,s,a,o,c){const m=e-a,g=e+a,y=s-a,b=s+a;if(g<0||m>this.width||b<0||y>this.height)return!1;const T=[];return this._forEachCell(m,y,g,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:s,radius:a},seenUids:{box:{},circle:{}}},c),T.length>0}_queryCell(e,s,a,o,c,m,g,y){const{seenUids:b,hitTest:T,overlapMode:S}=g,C=this.boxCells[c];if(C!==null){const R=this.bboxes;for(const V of C)if(!b.box[V]){b.box[V]=!0;const U=4*V,$=this.boxKeys[V];if(e<=R[U+2]&&s<=R[U+3]&&a>=R[U+0]&&o>=R[U+1]&&(!y||y($))&&(!T||!ir(S,$.overlapMode))&&(m.push({key:$,x1:R[U],y1:R[U+1],x2:R[U+2],y2:R[U+3]}),T))return!0}}const E=this.circleCells[c];if(E!==null){const R=this.circles;for(const V of E)if(!b.circle[V]){b.circle[V]=!0;const U=3*V,$=this.circleKeys[V];if(this._circleAndRectCollide(R[U],R[U+1],R[U+2],e,s,a,o)&&(!y||y($))&&(!T||!ir(S,$.overlapMode))){const Z=R[U],B=R[U+1],X=R[U+2];if(m.push({key:$,x1:Z-X,y1:B-X,x2:Z+X,y2:B+X}),T)return!0}}}return!1}_queryCellCircle(e,s,a,o,c,m,g,y){const{circle:b,seenUids:T,overlapMode:S}=g,C=this.boxCells[c];if(C!==null){const R=this.bboxes;for(const V of C)if(!T.box[V]){T.box[V]=!0;const U=4*V,$=this.boxKeys[V];if(this._circleAndRectCollide(b.x,b.y,b.radius,R[U+0],R[U+1],R[U+2],R[U+3])&&(!y||y($))&&!ir(S,$.overlapMode))return m.push(!0),!0}}const E=this.circleCells[c];if(E!==null){const R=this.circles;for(const V of E)if(!T.circle[V]){T.circle[V]=!0;const U=3*V,$=this.circleKeys[V];if(this._circlesCollide(R[U],R[U+1],R[U+2],b.x,b.y,b.radius)&&(!y||y($))&&!ir(S,$.overlapMode))return m.push(!0),!0}}}_forEachCell(e,s,a,o,c,m,g,y){const b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(s),S=this._convertToXCellCoord(a),C=this._convertToYCellCoord(o);for(let E=b;E<=S;E++)for(let R=T;R<=C;R++)if(c.call(this,e,s,a,o,this.xCellCount*R+E,m,g,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,s,a,o,c,m){const g=o-e,y=c-s,b=a+m;return b*b>g*g+y*y}_circleAndRectCollide(e,s,a,o,c,m,g){const y=(m-o)/2,b=Math.abs(e-(o+y));if(b>y+a)return!1;const T=(g-c)/2,S=Math.abs(s-(c+T));if(S>T+a)return!1;if(b<=y||S<=T)return!0;const C=b-y,E=S-T;return C*C+E*E<=a*a}}function Mr(h,e,s,a,o){const c=p.H();return e?(p.K(c,c,[1/o,1/o,1]),s||p.ad(c,c,a.angle)):p.L(c,a.labelPlaneMatrix,h),c}function rr(h,e,s,a,o){if(e){const c=p.ae(h);return p.K(c,c,[o,o,1]),s||p.ad(c,c,-a.angle),c}return a.glCoordMatrix}function N(h,e,s,a){let o;a?(o=[h,e,a(h,e),1],p.af(o,o,s)):(o=[h,e,0,1],Ke(o,o,s));const c=o[3];return{point:new p.P(o[0]/c,o[1]/c),signedDistanceFromCamera:c,isOccluded:!1}}function A(h,e){return .5+h/e*.5}function P(h,e){return h.x>=-e[0]&&h.x<=e[0]&&h.y>=-e[1]&&h.y<=e[1]}function D(h,e,s,a,o,c,m,g,y,b,T,S,C,E,R){const V=a?h.textSizeData:h.iconSizeData,U=p.ag(V,s.transform.zoom),$=[256/s.width*2+1,256/s.height*2+1],Z=a?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;Z.clear();const B=h.lineVertexArray,X=a?h.text.placedSymbolArray:h.icon.placedSymbolArray,K=s.transform.width/s.transform.height;let ee=!1;for(let oe=0;oe<X.length;oe++){const he=X.get(oe);if(he.hidden||he.writingMode===p.ah.vertical&&!ee){De(he.numGlyphs,Z);continue}ee=!1;const xe=N(he.anchorX,he.anchorY,e,R);if(!P(xe.point,$)){De(he.numGlyphs,Z);continue}const Te=A(s.transform.cameraToCenterDistance,xe.signedDistanceFromCamera),fe=p.ai(V,U,he),pe=m?fe/Te:fe*Te,Me={getElevation:R,labelPlaneMatrix:o,lineVertexArray:B,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:b,tileAnchorPoint:new p.P(he.anchorX,he.anchorY),unwrappedTileID:T,width:S,height:C,translation:E},Ve=W(Me,he,pe,!1,g,e,c,h.glyphOffsetArray,Z,K,y);ee=Ve.useVertical,(Ve.notEnoughRoom||ee||Ve.needsFlipping&&W(Me,he,pe,!0,g,e,c,h.glyphOffsetArray,Z,K,y).notEnoughRoom)&&De(he.numGlyphs,Z)}a?h.text.dynamicLayoutVertexBuffer.updateData(Z):h.icon.dynamicLayoutVertexBuffer.updateData(Z)}function O(h,e,s,a,o,c,m,g){const y=c.glyphStartIndex+c.numGlyphs,b=c.lineStartIndex,T=c.lineStartIndex+c.lineLength,S=e.getoffsetX(c.glyphStartIndex),C=e.getoffsetX(y-1),E=de(h*S,s,a,o,c.segment,b,T,g,m);if(!E)return null;const R=de(h*C,s,a,o,c.segment,b,T,g,m);return R?g.projectionCache.anyProjectionOccluded?null:{first:E,last:R}:null}function H(h,e,s,a){return h===p.ah.horizontal&&Math.abs(s.y-e.y)>Math.abs(s.x-e.x)*a?{useVertical:!0}:(h===p.ah.vertical?e.y<s.y:e.x>s.x)?{needsFlipping:!0}:null}function W(h,e,s,a,o,c,m,g,y,b,T){const S=s/24,C=e.lineOffsetX*S,E=e.lineOffsetY*S;let R;if(e.numGlyphs>1){const V=e.glyphStartIndex+e.numGlyphs,U=e.lineStartIndex,$=e.lineStartIndex+e.lineLength,Z=O(S,g,C,E,a,e,T,h);if(!Z)return{notEnoughRoom:!0};const B=N(Z.first.point.x,Z.first.point.y,m,h.getElevation).point,X=N(Z.last.point.x,Z.last.point.y,m,h.getElevation).point;if(o&&!a){const K=H(e.writingMode,B,X,b);if(K)return K}R=[Z.first];for(let K=e.glyphStartIndex+1;K<V-1;K++)R.push(de(S*g.getoffsetX(K),C,E,a,e.segment,U,$,h,T));R.push(Z.last)}else{if(o&&!a){const U=N(h.tileAnchorPoint.x,h.tileAnchorPoint.y,c,h.getElevation).point,$=e.lineStartIndex+e.segment+1,Z=new p.P(h.lineVertexArray.getx($),h.lineVertexArray.gety($)),B=N(Z.x,Z.y,c,h.getElevation),X=B.signedDistanceFromCamera>0?B.point:(function(ee,oe,he,xe,Te,fe){return Y(ee,oe,he,1,Te,fe)})(h.tileAnchorPoint,Z,U,0,c,h),K=H(e.writingMode,U,X,b);if(K)return K}const V=de(S*g.getoffsetX(e.glyphStartIndex),C,E,a,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,h,T);if(!V||h.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};R=[V]}for(const V of R)p.aj(y,V.point,V.angle);return{}}function Y(h,e,s,a,o,c){const m=h.add(h.sub(e)._unit()),g=o!==void 0?N(m.x,m.y,o,c.getElevation).point:se(m.x,m.y,c).point,y=s.sub(g);return s.add(y._mult(a/y.mag()))}function q(h,e,s){const a=e.projectionCache;if(a.projections[h])return a.projections[h];const o=new p.P(e.lineVertexArray.getx(h),e.lineVertexArray.gety(h)),c=se(o.x,o.y,e);if(c.signedDistanceFromCamera>0)return a.projections[h]=c.point,a.anyProjectionOccluded=a.anyProjectionOccluded||c.isOccluded,c.point;const m=h-s.direction;return(function(g,y,b,T,S){return Y(g,y,b,T,void 0,S)})(s.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,s.previousVertex,s.absOffsetX-s.distanceFromAnchor+1,e)}function se(h,e,s){const a=h+s.translation[0],o=e+s.translation[1];let c;return!s.pitchWithMap&&s.projection.useSpecialProjectionForSymbols?(c=s.projection.projectTileCoordinates(a,o,s.unwrappedTileID,s.getElevation),c.point.x=(.5*c.point.x+.5)*s.width,c.point.y=(.5*-c.point.y+.5)*s.height):(c=N(a,o,s.labelPlaneMatrix,s.getElevation),c.isOccluded=!1),c}function le(h,e,s){return h._unit()._perp()._mult(e*s)}function te(h,e,s,a,o,c,m,g,y){if(g.projectionCache.offsets[h])return g.projectionCache.offsets[h];const b=s.add(e);if(h+y.direction<a||h+y.direction>=o)return g.projectionCache.offsets[h]=b,b;const T=q(h+y.direction,g,y),S=le(T.sub(s),m,y.direction),C=s.add(S),E=T.add(S);return g.projectionCache.offsets[h]=p.ak(c,b,C,E)||b,g.projectionCache.offsets[h]}function de(h,e,s,a,o,c,m,g,y){const b=a?h-e:h+e;let T=b>0?1:-1,S=0;a&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let C,E=T>0?c+o:c+o+1;g.projectionCache.cachedAnchorPoint?C=g.projectionCache.cachedAnchorPoint:(C=se(g.tileAnchorPoint.x,g.tileAnchorPoint.y,g).point,g.projectionCache.cachedAnchorPoint=C);let R,V,U=C,$=C,Z=0,B=0;const X=Math.abs(b),K=[];let ee;for(;Z+B<=X;){if(E+=T,E<c||E>=m)return null;Z+=B,$=U,V=R;const xe={absOffsetX:X,direction:T,distanceFromAnchor:Z,previousVertex:$};if(U=q(E,g,xe),s===0)K.push($),ee=U.sub($);else{let Te;const fe=U.sub($);Te=fe.mag()===0?le(q(E+T,g,xe).sub(U),s,T):le(fe,s,T),V||(V=$.add(Te)),R=te(E,Te,U,c,m,V,s,g,xe),K.push(V),ee=R.sub(V)}B=ee.mag()}const oe=ee._mult((X-Z)/B)._add(V||$),he=S+Math.atan2(U.y-$.y,U.x-$.x);return K.push(oe),{point:oe,angle:y?he:0,path:K}}const Ee=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function De(h,e){for(let s=0;s<h;s++){const a=e.length;e.resize(a+4),e.float32.set(Ee,3*a)}}function Ke(h,e,s){const a=e[0],o=e[1];return h[0]=s[0]*a+s[4]*o+s[12],h[1]=s[1]*a+s[5]*o+s[13],h[3]=s[3]*a+s[7]*o+s[15],h}const je=100;class Je{constructor(e,s,a=new mr(e.width+200,e.height+200,25),o=new mr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=s,this.grid=a,this.ignoredGrid=o,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+je,this.screenBottomBoundary=e.height+je,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,s,a,o,c,m,g,y,b,T,S){const C=e.anchorPointX+y[0],E=e.anchorPointY+y[1],R=this.projectAndGetPerspectiveRatio(o,C,E,c,T),V=a*R.perspectiveRatio;let U;if(m||g)U=this._projectCollisionBox(e,V,o,c,m,g,y,R,T,S);else{const K=R.point.x+(S?S.x*V:0),ee=R.point.y+(S?S.y*V:0);U={allPointsOccluded:!1,box:[K+e.x1*V,ee+e.y1*V,K+e.x2*V,ee+e.y2*V]}}const[$,Z,B,X]=U.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?U.allPointsOccluded:this.mapProjection.isOccluded(C,E,c))||R.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid($,Z,B,X)||s!=="always"&&this.grid.hitTest($,Z,B,X,s,b)?{box:[$,Z,B,X],placeable:!1,offscreen:!1}:{box:[$,Z,B,X],placeable:!0,offscreen:this.isOffscreen($,Z,B,X)}}placeCollisionCircles(e,s,a,o,c,m,g,y,b,T,S,C,E,R,V,U){const $=[],Z=new p.P(s.anchorX,s.anchorY),B=this.getPerspectiveRatio(m,Z.x,Z.y,g,U),X=(S?c/B:c*B)/p.ap,K={getElevation:U,labelPlaneMatrix:y,lineVertexArray:a,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Z,unwrappedTileID:g,width:this.transform.width,height:this.transform.height,translation:V},ee=O(X,o,s.lineOffsetX*X,s.lineOffsetY*X,!1,s,!1,K);let oe=!1,he=!1,xe=!0;if(ee){const Te=.5*E*B+R,fe=new p.P(-100,-100),pe=new p.P(this.screenRightBoundary,this.screenBottomBoundary),Me=new Ne,Ve=ee.first,ge=ee.last;let be=[];for(let Ue=Ve.path.length-1;Ue>=1;Ue--)be.push(Ve.path[Ue]);for(let Ue=1;Ue<ge.path.length;Ue++)be.push(ge.path[Ue]);const Fe=2.5*Te;if(b){const Ue=this.projectPathToScreenSpace(be,K,b);be=Ue.some((He=>He.signedDistanceFromCamera<=0))?[]:Ue.map((He=>He.point))}let pt=[];if(be.length>0){const Ue=be[0].clone(),He=be[0].clone();for(let ft=1;ft<be.length;ft++)Ue.x=Math.min(Ue.x,be[ft].x),Ue.y=Math.min(Ue.y,be[ft].y),He.x=Math.max(He.x,be[ft].x),He.y=Math.max(He.y,be[ft].y);pt=Ue.x>=fe.x&&He.x<=pe.x&&Ue.y>=fe.y&&He.y<=pe.y?[be]:He.x<fe.x||Ue.x>pe.x||He.y<fe.y||Ue.y>pe.y?[]:p.al([be],fe.x,fe.y,pe.x,pe.y)}for(const Ue of pt){Me.reset(Ue,.25*Te);let He=0;He=Me.length<=.5*Te?1:Math.ceil(Me.paddedLength/Fe)+1;for(let ft=0;ft<He;ft++){const Vt=ft/Math.max(He-1,1),ji=Me.lerp(Vt),mt=ji.x+je,si=ji.y+je;$.push(mt,si,Te,0);const Kt=mt-Te,Nt=si-Te,Jt=mt+Te,or=si+Te;if(xe=xe&&this.isOffscreen(Kt,Nt,Jt,or),he=he||this.isInsideGrid(Kt,Nt,Jt,or),e!=="always"&&this.grid.hitTestCircle(mt,si,Te,e,C)&&(oe=!0,!T))return{circles:[],offscreen:!1,collisionDetected:oe}}}}return{circles:!T&&oe||!he||B<this.perspectiveRatioCutoff?[]:$,offscreen:xe,collisionDetected:oe}}projectPathToScreenSpace(e,s,a){return e.map((o=>N(o.x,o.y,a,s.getElevation)))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const s=[];let a=1/0,o=1/0,c=-1/0,m=-1/0;for(const T of e){const S=new p.P(T.x+je,T.y+je);a=Math.min(a,S.x),o=Math.min(o,S.y),c=Math.max(c,S.x),m=Math.max(m,S.y),s.push(S)}const g=this.grid.query(a,o,c,m).concat(this.ignoredGrid.query(a,o,c,m)),y={},b={};for(const T of g){const S=T.key;if(y[S.bucketInstanceId]===void 0&&(y[S.bucketInstanceId]={}),y[S.bucketInstanceId][S.featureIndex])continue;const C=[new p.P(T.x1,T.y1),new p.P(T.x2,T.y1),new p.P(T.x2,T.y2),new p.P(T.x1,T.y2)];p.am(s,C)&&(y[S.bucketInstanceId][S.featureIndex]=!0,b[S.bucketInstanceId]===void 0&&(b[S.bucketInstanceId]=[]),b[S.bucketInstanceId].push(S.featureIndex))}return b}insertCollisionBox(e,s,a,o,c,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:s},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,s,a,o,c,m){const g=a?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:s};for(let b=0;b<e.length;b+=4)g.insertCircle(y,e[b],e[b+1],e[b+2])}projectAndGetPerspectiveRatio(e,s,a,o,c){let m;c?(m=[s,a,c(s,a),1],p.af(m,m,e)):(m=[s,a,0,1],Ke(m,m,e));const g=m[3];return{point:new p.P((m[0]/g+1)/2*this.transform.width+je,(-m[1]/g+1)/2*this.transform.height+je),perspectiveRatio:.5+this.transform.cameraToCenterDistance/g*.5,isOccluded:!1,signedDistanceFromCamera:g}}getPerspectiveRatio(e,s,a,o,c){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(s,a,o,c):N(s,a,e,c);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(e,s,a,o){return a<je||e>=this.screenRightBoundary||o<je||s>this.screenBottomBoundary}isInsideGrid(e,s,a,o){return a>=0&&e<this.gridRightBoundary&&o>=0&&s<this.gridBottomBoundary}getViewportMatrix(){const e=p.an([]);return p.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,s,a,o,c,m,g,y,b,T){let S=new p.P(1,0),C=new p.P(0,1);const E=new p.P(e.anchorPointX+g[0],e.anchorPointY+g[1]);if(m&&!c){const xe=this.projectAndGetPerspectiveRatio(a,E.x+1,E.y,o,b).point.sub(y.point).unit(),Te=Math.atan(xe.y/xe.x)+(xe.x<0?Math.PI:0),fe=Math.sin(Te),pe=Math.cos(Te);S=new p.P(pe,fe),C=new p.P(-fe,pe)}else if(!m&&c){const xe=-this.transform.angle,Te=Math.sin(xe),fe=Math.cos(xe);S=new p.P(fe,Te),C=new p.P(-Te,fe)}let R=y.point,V=s;if(c){R=E;const xe=this.transform.zoom-Math.floor(this.transform.zoom);V=Math.pow(2,-xe),V*=this.mapProjection.getPitchedTextCorrection(this.transform,E,o),T||(V*=p.ac(.5+y.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}T&&(R=R.add(S.mult(T.x*V)).add(C.mult(T.y*V)));const U=e.x1*V,$=e.x2*V,Z=(U+$)/2,B=e.y1*V,X=e.y2*V,K=(B+X)/2,ee=[{offsetX:U,offsetY:B},{offsetX:Z,offsetY:B},{offsetX:$,offsetY:B},{offsetX:$,offsetY:K},{offsetX:$,offsetY:X},{offsetX:Z,offsetY:X},{offsetX:U,offsetY:X},{offsetX:U,offsetY:K}];let oe=[];for(const{offsetX:xe,offsetY:Te}of ee)oe.push(new p.P(R.x+S.x*xe+C.x*Te,R.y+S.y*xe+C.y*Te));let he=!1;if(c){const xe=oe.map((Te=>this.projectAndGetPerspectiveRatio(a,Te.x,Te.y,o,b)));he=xe.some((Te=>!Te.isOccluded)),oe=xe.map((Te=>Te.point))}else he=!0;return{box:p.ao(oe),allPointsOccluded:!he}}}function Ge(h,e,s){return e*(p.X/(h.tileSize*Math.pow(2,s-h.tileID.overscaledZ)))}class Pt{constructor(e,s,a,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?s:-s))):o&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class xt{constructor(e,s,a,o,c){this.text=new Pt(e?e.text:null,s,a,c),this.icon=new Pt(e?e.icon:null,s,o,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class qe{constructor(e,s,a){this.text=e,this.icon=s,this.skipFade=a}}class rt{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class gt{constructor(e,s,a,o,c){this.bucketInstanceId=e,this.featureIndex=s,this.sourceLayerIndex=a,this.bucketIndex=o,this.tileID=c}}class kt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const s=++this.maxGroupID;this.collisionGroups[e]={ID:s,predicate:a=>a.collisionGroupID===s}}return this.collisionGroups[e]}}function Lt(h,e,s,a,o){const{horizontalAlign:c,verticalAlign:m}=p.au(h);return new p.P(-(c-.5)*e+a[0]*o,-(m-.5)*s+a[1]*o)}class Wt{constructor(e,s,a,o,c,m){this.transform=e.clone(),this.terrain=a,this.collisionIndex=new Je(this.transform,s),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new kt(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const s=this.terrain;return s?(a,o)=>s.getElevation(e,a,o):null}getBucketParts(e,s,a,o){const c=a.getBucket(s),m=a.latestFeatureIndex;if(!c||!m||s.id!==c.layerIds[0])return;const g=a.collisionBoxArray,y=c.layers[0].layout,b=c.layers[0].paint,T=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/p.X,C=a.tileID.toUnwrapped(),E=this.transform.calculatePosMatrix(C),R=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",U=Ge(a,1,this.transform.zoom),$=this.collisionIndex.mapProjection.translatePosition(this.transform,a,b.get("text-translate"),b.get("text-translate-anchor")),Z=this.collisionIndex.mapProjection.translatePosition(this.transform,a,b.get("icon-translate"),b.get("icon-translate-anchor")),B=Mr(E,R,V,this.transform,U);let X=null;if(R){const ee=rr(E,R,V,this.transform,U);X=p.L([],this.transform.labelPlaneMatrix,ee)}this.retainedQueryData[c.bucketInstanceId]=new gt(c.bucketInstanceId,m,c.sourceLayerIndex,c.index,a.tileID);const K={bucket:c,layout:y,translationText:$,translationIcon:Z,posMatrix:E,unwrappedTileID:C,textLabelPlaneMatrix:B,labelToScreenMatrix:X,scale:T,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:p.ag(c.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(o)for(const ee of c.sortKeyRanges){const{sortKey:oe,symbolInstanceStart:he,symbolInstanceEnd:xe}=ee;e.push({sortKey:oe,symbolInstanceStart:he,symbolInstanceEnd:xe,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,s,a,o,c,m,g,y,b,T,S,C,E,R,V,U,$,Z,B){const X=p.aq[e.textAnchor],K=[e.textOffset0,e.textOffset1],ee=Lt(X,a,o,K,c),oe=this.collisionIndex.placeCollisionBox(s,C,y,b,T,g,m,U,S.predicate,B,ee);if((!Z||this.collisionIndex.placeCollisionBox(Z,C,y,b,T,g,m,$,S.predicate,B,ee).placeable)&&oe.placeable){let he;if(this.prevPlacement&&this.prevPlacement.variableOffsets[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID].text&&(he=this.prevPlacement.variableOffsets[E.crossTileID].anchor),E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[E.crossTileID]={textOffset:K,width:a,height:o,anchor:X,textBoxScale:c,prevAnchor:he},this.markUsedJustification(R,X,E,V),R.allowVerticalPlacement&&(this.markUsedOrientation(R,V,E),this.placedOrientations[E.crossTileID]=V),{shift:ee,placedGlyphBoxes:oe}}}placeLayerBucketPart(e,s,a){const{bucket:o,layout:c,translationText:m,translationIcon:g,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:T,labelToScreenMatrix:S,textPixelRatio:C,holdingForFade:E,collisionBoxArray:R,partiallyEvaluatedTextSize:V,collisionGroup:U}=e.parameters,$=c.get("text-optional"),Z=c.get("icon-optional"),B=p.ar(c,"text-overlap","text-allow-overlap"),X=B==="always",K=p.ar(c,"icon-overlap","icon-allow-overlap"),ee=K==="always",oe=c.get("text-rotation-alignment")==="map",he=c.get("text-pitch-alignment")==="map",xe=c.get("icon-text-fit")!=="none",Te=c.get("symbol-z-order")==="viewport-y",fe=X&&(ee||!o.hasIconData()||Z),pe=ee&&(X||!o.hasTextData()||$);!o.collisionArrays&&R&&o.deserializeCollisionBoxes(R);const Me=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),Ve=(ge,be,Fe)=>{var pt,Ue;if(s[ge.crossTileID])return;if(E)return void(this.placements[ge.crossTileID]=new qe(!1,!1,!1));let He=!1,ft=!1,Vt=!0,ji=null,mt={box:null,placeable:!1,offscreen:null},si={box:null,placeable:!1,offscreen:null},Kt=null,Nt=null,Jt=null,or=0,Ls=0,aa=0;be.textFeatureIndex?or=be.textFeatureIndex:ge.useRuntimeCollisionCircles&&(or=ge.featureIndex),be.verticalTextFeatureIndex&&(Ls=be.verticalTextFeatureIndex);const Rs=be.textBox;if(Rs){const Ai=Rt=>{let jt=p.ah.horizontal;if(o.allowVerticalPlacement&&!Rt&&this.prevPlacement){const gi=this.prevPlacement.placedOrientations[ge.crossTileID];gi&&(this.placedOrientations[ge.crossTileID]=gi,jt=gi,this.markUsedOrientation(o,jt,ge))}return jt},Mi=(Rt,jt)=>{if(o.allowVerticalPlacement&&ge.numVerticalGlyphVertices>0&&be.verticalTextBox){for(const gi of o.writingModes)if(gi===p.ah.vertical?(mt=jt(),si=mt):mt=Rt(),mt&&mt.placeable)break}else mt=Rt()},zr=ge.textAnchorOffsetStartIndex,Ui=ge.textAnchorOffsetEndIndex;if(Ui===zr){const Rt=(jt,gi)=>{const We=this.collisionIndex.placeCollisionBox(jt,B,C,y,b,he,oe,m,U.predicate,Me);return We&&We.placeable&&(this.markUsedOrientation(o,gi,ge),this.placedOrientations[ge.crossTileID]=gi),We};Mi((()=>Rt(Rs,p.ah.horizontal)),(()=>{const jt=be.verticalTextBox;return o.allowVerticalPlacement&&ge.numVerticalGlyphVertices>0&&jt?Rt(jt,p.ah.vertical):{box:null,offscreen:null}})),Ai(mt&&mt.placeable)}else{let Rt=p.aq[(Ue=(pt=this.prevPlacement)===null||pt===void 0?void 0:pt.variableOffsets[ge.crossTileID])===null||Ue===void 0?void 0:Ue.anchor];const jt=(We,is,Bs)=>{const Fs=We.x2-We.x1,ml=We.y2-We.y1,uc=ge.textBoxScale,_l=xe&&K==="never"?is:null;let Er=null,gl=B==="never"?1:2,la="never";Rt&&gl++;for(let yn=0;yn<gl;yn++){for(let ca=zr;ca<Ui;ca++){const ha=o.textAnchorOffsets.get(ca);if(Rt&&ha.textAnchor!==Rt)continue;const Os=this.attemptAnchorPlacement(ha,We,Fs,ml,uc,oe,he,C,y,b,U,la,ge,o,Bs,m,g,_l,Me);if(Os&&(Er=Os.placedGlyphBoxes,Er&&Er.placeable))return He=!0,ji=Os.shift,Er}Rt?Rt=null:la=B}return a&&!Er&&(Er={box:this.collisionIndex.placeCollisionBox(Rs,"always",C,y,b,he,oe,m,U.predicate,Me,new p.P(0,0)).box,offscreen:!1,placeable:!1}),Er};Mi((()=>jt(Rs,be.iconBox,p.ah.horizontal)),(()=>{const We=be.verticalTextBox;return o.allowVerticalPlacement&&(!mt||!mt.placeable)&&ge.numVerticalGlyphVertices>0&&We?jt(We,be.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}})),mt&&(He=mt.placeable,Vt=mt.offscreen);const gi=Ai(mt&&mt.placeable);if(!He&&this.prevPlacement){const We=this.prevPlacement.variableOffsets[ge.crossTileID];We&&(this.variableOffsets[ge.crossTileID]=We,this.markUsedJustification(o,We.anchor,ge,gi))}}}if(Kt=mt,He=Kt&&Kt.placeable,Vt=Kt&&Kt.offscreen,ge.useRuntimeCollisionCircles){const Ai=o.text.placedSymbolArray.get(ge.centerJustifiedTextSymbolIndex),Mi=p.ai(o.textSizeData,V,Ai),zr=c.get("text-padding");Nt=this.collisionIndex.placeCollisionCircles(B,Ai,o.lineVertexArray,o.glyphOffsetArray,Mi,y,b,T,S,a,he,U.predicate,ge.collisionCircleDiameter,zr,m,Me),Nt.circles.length&&Nt.collisionDetected&&!a&&p.w("Collisions detected, but collision boxes are not shown"),He=X||Nt.circles.length>0&&!Nt.collisionDetected,Vt=Vt&&Nt.offscreen}if(be.iconFeatureIndex&&(aa=be.iconFeatureIndex),be.iconBox){const Ai=Mi=>this.collisionIndex.placeCollisionBox(Mi,K,C,y,b,he,oe,g,U.predicate,Me,xe&&ji?ji:void 0);si&&si.placeable&&be.verticalIconBox?(Jt=Ai(be.verticalIconBox),ft=Jt.placeable):(Jt=Ai(be.iconBox),ft=Jt.placeable),Vt=Vt&&Jt.offscreen}const Pi=$||ge.numHorizontalGlyphVertices===0&&ge.numVerticalGlyphVertices===0,oa=Z||ge.numIconVertices===0;Pi||oa?oa?Pi||(ft=ft&&He):He=ft&&He:ft=He=ft&&He;const _o=ft&&Jt.placeable;if(He&&Kt.placeable&&this.collisionIndex.insertCollisionBox(Kt.box,B,c.get("text-ignore-placement"),o.bucketInstanceId,si&&si.placeable&&Ls?Ls:or,U.ID),_o&&this.collisionIndex.insertCollisionBox(Jt.box,K,c.get("icon-ignore-placement"),o.bucketInstanceId,aa,U.ID),Nt&&He&&this.collisionIndex.insertCollisionCircles(Nt.circles,B,c.get("text-ignore-placement"),o.bucketInstanceId,or,U.ID),a&&this.storeCollisionData(o.bucketInstanceId,Fe,be,Kt,Jt,Nt),ge.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ge.crossTileID]=new qe(He||fe,ft||pe,Vt||o.justReloaded),s[ge.crossTileID]=!0};if(Te){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ge=o.getSortedSymbolIndexes(this.transform.angle);for(let be=ge.length-1;be>=0;--be){const Fe=ge[be];Ve(o.symbolInstances.get(Fe),o.collisionArrays[Fe],Fe)}}else for(let ge=e.symbolInstanceStart;ge<e.symbolInstanceEnd;ge++)Ve(o.symbolInstances.get(ge),o.collisionArrays[ge],ge);if(a&&o.bucketInstanceId in this.collisionCircleArrays){const ge=this.collisionCircleArrays[o.bucketInstanceId];p.as(ge.invProjMatrix,y),ge.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}storeCollisionData(e,s,a,o,c,m){if(a.textBox||a.iconBox){let g,y;this.collisionBoxArrays.has(e)?g=this.collisionBoxArrays.get(e):(g=new Map,this.collisionBoxArrays.set(e,g)),g.has(s)?y=g.get(s):(y={text:null,icon:null},g.set(s,y)),a.textBox&&(y.text=o.box),a.iconBox&&(y.icon=c.box)}if(m){let g=this.collisionCircleArrays[e];g===void 0&&(g=this.collisionCircleArrays[e]=new rt);for(let y=0;y<m.circles.length;y+=4)g.circles.push(m.circles[y+0]),g.circles.push(m.circles[y+1]),g.circles.push(m.circles[y+2]),g.circles.push(m.collisionDetected?1:0)}}markUsedJustification(e,s,a,o){let c;c=o===p.ah.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[p.at(s)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const g of m)g>=0&&(e.text.placedSymbolArray.get(g).crossTileID=c>=0&&g!==c?0:a.crossTileID)}markUsedOrientation(e,s,a){const o=s===p.ah.horizontal||s===p.ah.horizontalOnly?s:0,c=s===p.ah.vertical?s:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const g of m)e.text.placedSymbolArray.get(g).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=c)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let a=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const o=s?s.symbolFadeChange(e):1,c=s?s.opacities:{},m=s?s.variableOffsets:{},g=s?s.placedOrientations:{};for(const y in this.placements){const b=this.placements[y],T=c[y];T?(this.opacities[y]=new xt(T,o,b.text,b.icon),a=a||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[y]=new xt(null,o,b.text,b.icon,b.skipFade),a=a||b.text||b.icon)}for(const y in c){const b=c[y];if(!this.opacities[y]){const T=new xt(b,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||b.text.placed||b.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(s&&s.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:e)}updateLayerOpacities(e,s){const a={};for(const o of s){const c=o.getBucket(e);c&&o.latestFeatureIndex&&e.id===c.layerIds[0]&&this.updateBucketOpacities(c,o.tileID,a,o.collisionBoxArray)}}updateBucketOpacities(e,s,a,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const c=e.layers[0],m=c.layout,g=new xt(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S=m.get("text-rotation-alignment")==="map",C=m.get("text-pitch-alignment")==="map",E=m.get("icon-text-fit")!=="none",R=new xt(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const V=($,Z,B)=>{for(let X=0;X<Z/4;X++)$.opacityVertexArray.emplaceBack(B);$.hasVisibleVertices=$.hasVisibleVertices||B!==ps},U=this.collisionBoxArrays.get(e.bucketInstanceId);for(let $=0;$<e.symbolInstances.length;$++){const Z=e.symbolInstances.get($),{numHorizontalGlyphVertices:B,numVerticalGlyphVertices:X,crossTileID:K}=Z;let ee=this.opacities[K];a[K]?ee=g:ee||(ee=R,this.opacities[K]=ee),a[K]=!0;const oe=Z.numIconVertices>0,he=this.placedOrientations[Z.crossTileID],xe=he===p.ah.vertical,Te=he===p.ah.horizontal||he===p.ah.horizontalOnly;if(B>0||X>0){const pe=fi(ee.text);V(e.text,B,xe?ps:pe),V(e.text,X,Te?ps:pe);const Me=ee.text.isHidden();[Z.rightJustifiedTextSymbolIndex,Z.centerJustifiedTextSymbolIndex,Z.leftJustifiedTextSymbolIndex].forEach((be=>{be>=0&&(e.text.placedSymbolArray.get(be).hidden=Me||xe?1:0)})),Z.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(Z.verticalPlacedTextSymbolIndex).hidden=Me||Te?1:0);const Ve=this.variableOffsets[Z.crossTileID];Ve&&this.markUsedJustification(e,Ve.anchor,Z,he);const ge=this.placedOrientations[Z.crossTileID];ge&&(this.markUsedJustification(e,"left",Z,ge),this.markUsedOrientation(e,ge,Z))}if(oe){const pe=fi(ee.icon),Me=!(E&&Z.verticalPlacedIconSymbolIndex&&xe);Z.placedIconSymbolIndex>=0&&(V(e.icon,Z.numIconVertices,Me?pe:ps),e.icon.placedSymbolArray.get(Z.placedIconSymbolIndex).hidden=ee.icon.isHidden()),Z.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,Z.numVerticalIconVertices,Me?ps:pe),e.icon.placedSymbolArray.get(Z.verticalPlacedIconSymbolIndex).hidden=ee.icon.isHidden())}const fe=U&&U.has($)?U.get($):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const pe=e.collisionArrays[$];if(pe){let Me=new p.P(0,0);if(pe.textBox||pe.verticalTextBox){let Ve=!0;if(T){const ge=this.variableOffsets[K];ge?(Me=Lt(ge.anchor,ge.width,ge.height,ge.textOffset,ge.textBoxScale),S&&Me._rotate(C?this.transform.angle:-this.transform.angle)):Ve=!1}if(pe.textBox||pe.verticalTextBox){let ge;pe.textBox&&(ge=xe),pe.verticalTextBox&&(ge=Te),ds(e.textCollisionBox.collisionVertexArray,ee.text.placed,!Ve||ge,fe.text,Me.x,Me.y)}}if(pe.iconBox||pe.verticalIconBox){const Ve=!!(!Te&&pe.verticalIconBox);let ge;pe.iconBox&&(ge=Ve),pe.verticalIconBox&&(ge=!Ve),ds(e.iconCollisionBox.collisionVertexArray,ee.icon.placed,ge,fe.icon,E?Me.x:0,E?Me.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const $=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=$.invProjMatrix,e.placementViewportMatrix=$.viewportMatrix,e.collisionCircleArray=$.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,s){const a=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*a>e}setStale(){this.stale=!0}}function ds(h,e,s,a,o,c){a&&a.length!==0||(a=[0,0,0,0]);const m=a[0]-je,g=a[1]-je,y=a[2]-je,b=a[3]-je;h.emplaceBack(e?1:0,s?1:0,o||0,c||0,m,g),h.emplaceBack(e?1:0,s?1:0,o||0,c||0,y,g),h.emplaceBack(e?1:0,s?1:0,o||0,c||0,y,b),h.emplaceBack(e?1:0,s?1:0,o||0,c||0,m,b)}const st=Math.pow(2,25),Pa=Math.pow(2,24),Aa=Math.pow(2,17),di=Math.pow(2,16),pi=Math.pow(2,9),Vl=Math.pow(2,8),wi=Math.pow(2,1);function fi(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const e=h.placed?1:0,s=Math.floor(127*h.opacity);return s*st+e*Pa+s*Aa+e*di+s*pi+e*Vl+s*wi+e}const ps=0;function qr(){return{isOccluded:(h,e,s)=>!1,getPitchedTextCorrection:(h,e,s)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(h,e,s,a){throw new Error("Not implemented.")},translatePosition:(h,e,s,a)=>(function(o,c,m,g,y=!1){if(!m[0]&&!m[1])return[0,0];const b=y?g==="map"?o.angle:0:g==="viewport"?-o.angle:0;if(b){const T=Math.sin(b),S=Math.cos(b);m=[m[0]*S-m[1]*T,m[0]*T+m[1]*S]}return[y?m[0]:Ge(c,m[0],o.zoom),y?m[1]:Ge(c,m[1],o.zoom)]})(h,e,s,a),getCircleRadiusCorrection:h=>1}}class At{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,s,a,o,c){const m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(s.getBucketParts(m,o,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,c())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort(((g,y)=>g.sortKey-y.sortKey)));this._currentPartIndex<m.length;)if(s.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,c())return!0;return!1}}class Qs{constructor(e,s,a,o,c,m,g,y){this.placement=new Wt(e,qr(),s,m,g,y),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=c,this._done=!1}isDone(){return this._done}continuePlacement(e,s,a){const o=me.now(),c=()=>!this._forceFullPlacement&&me.now()-o>2;for(;this._currentPlacementIndex>=0;){const m=s[e[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new At(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Bi=512/p.X/2;class St{constructor(e,s,a){this.tileID=e,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let c=0;c<s.length;c++){const m=s.get(c),g=m.key,y=o.get(g);y?y.push(m):o.set(g,[m])}for(const[c,m]of o){const g={positions:m.map((y=>({x:Math.floor(y.anchorX*Bi),y:Math.floor(y.anchorY*Bi)}))),crossTileIDs:m.map((y=>y.crossTileID))};if(g.positions.length>128){const y=new p.av(g.positions.length,16,Uint16Array);for(const{x:b,y:T}of g.positions)y.add(b,T);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[c]=g}}getScaledCoordinates(e,s){const{x:a,y:o,z:c}=this.tileID.canonical,{x:m,y:g,z:y}=s.canonical,b=Bi/Math.pow(2,y-c),T=(g*p.X+e.anchorY)*b,S=o*p.X*Bi;return{x:Math.floor((m*p.X+e.anchorX)*b-a*p.X*Bi),y:Math.floor(T-S)}}findMatches(e,s,a){const o=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let c=0;c<e.length;c++){const m=e.get(c);if(m.crossTileID)continue;const g=this._symbolsByKey[m.key];if(!g)continue;const y=this.getScaledCoordinates(m,s);if(g.index){const b=g.index.range(y.x-o,y.y-o,y.x+o,y.y+o).sort();for(const T of b){const S=g.crossTileIDs[T];if(!a[S]){a[S]=!0,m.crossTileID=S;break}}}else if(g.positions)for(let b=0;b<g.positions.length;b++){const T=g.positions[b],S=g.crossTileIDs[b];if(Math.abs(T.x-y.x)<=o&&Math.abs(T.y-y.y)<=o&&!a[S]){a[S]=!0,m.crossTileID=S;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class Cn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Fi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const s=Math.round((e-this.lng)/360);if(s!==0)for(const a in this.indexes){const o=this.indexes[a],c={};for(const m in o){const g=o[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+s),c[g.tileID.key]=g}this.indexes[a]=c}this.lng=e}addBucket(e,s,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let c=0;c<s.symbolInstances.length;c++)s.symbolInstances.get(c).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const o=this.usedCrossTileIDs[e.overscaledZ];for(const c in this.indexes){const m=this.indexes[c];if(Number(c)>e.overscaledZ)for(const g in m){const y=m[g];y.tileID.isChildOf(e)&&y.findMatches(s.symbolInstances,e,o)}else{const g=m[e.scaledTo(Number(c)).key];g&&g.findMatches(s.symbolInstances,e,o)}}for(let c=0;c<s.symbolInstances.length;c++){const m=s.symbolInstances.get(c);m.crossTileID||(m.crossTileID=a.generate(),o[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new St(e,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(e,s){for(const a of s.getCrossTileIDsLists())for(const o of a)delete this.usedCrossTileIDs[e][o]}removeStaleBuckets(e){let s=!1;for(const a in this.indexes){const o=this.indexes[a];for(const c in o)e[o[c].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,o[c]),delete o[c],s=!0)}return s}}class Ma{constructor(){this.layerIndexes={},this.crossTileIDs=new Cn,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,s,a){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new Fi);let c=!1;const m={};o.handleWrapJump(a);for(const g of s){const y=g.getBucket(e);y&&e.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(g.tileID,y,this.crossTileIDs)&&(c=!0),m[y.bucketInstanceId]=!0)}return o.removeStaleBuckets(m)&&(c=!0),c}pruneUnusedLayers(e){const s={};e.forEach((a=>{s[a]=!0}));for(const a in this.layerIndexes)s[a]||delete this.layerIndexes[a]}}const Oi=(h,e)=>p.t(h,e&&e.filter((s=>s.identifier!=="source.canvas"))),Nl=p.aw();class kn extends p.E{constructor(e,s={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=e,this.dispatcher=new Ur(jr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((a,o)=>this.getGlyphs(a,o))),this.dispatcher.registerMessageHandler("GI",((a,o)=>this.getImages(a,o))),this.imageManager=new Ft,this.imageManager.setEventedParent(this),this.glyphManager=new Yi(e._requestManager,s.localIdeographFontFamily),this.lineAtlas=new ls(256,512),this.crossTileSymbolIndex=new Ma,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),tr().on(ue,this._rtlPluginLoaded),this.on("data",(a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const c=o.getSource();if(c&&c.vectorLayerIds)for(const m in this._layers){const g=this._layers[m];g.source===c.id&&this._validateLayer(g)}}))}loadURL(e,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),s.validate=typeof s.validate!="boolean"||s.validate;const o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const c=this._loadStyleRequest;p.h(o,this._loadStyleRequest).then((m=>{this._loadStyleRequest=null,this._load(m.data,s,a)})).catch((m=>{this._loadStyleRequest=null,m&&!c.signal.aborted&&this.fire(new p.j(m))}))}loadJSON(e,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,s.validate=s.validate!==!1,this._load(e,s,a)})).catch((()=>{}))}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Nl,{validate:!1})}_load(e,s,a){var o;const c=s.transformStyle?s.transformStyle(a,e):e;if(!s.validate||!Oi(this,p.u(c))){this._loaded=!0,this.stylesheet=c;for(const m in c.sources)this.addSource(m,c.sources[m],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new dr(this.stylesheet.light),this.sky=new Di(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){const e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((s=>s.id)),this._layers={},this._serializedLayers=null;for(const s of e){const a=p.aA(s);a.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=a}}_loadSprite(e,s=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(c,m,g,y){return p._(this,void 0,void 0,(function*(){const b=Ji(c),T=g>1?"@2x":"",S={},C={};for(const{id:E,url:R}of b){const V=m.transformRequest(Hs(R,T,".json"),"SpriteJSON");S[E]=p.h(V,y);const U=m.transformRequest(Hs(R,T,".png"),"SpriteImage");C[E]=hi.getImage(U,y)}return yield Promise.all([...Object.values(S),...Object.values(C)]),(function(E,R){return p._(this,void 0,void 0,(function*(){const V={};for(const U in E){V[U]={};const $=me.getImageCanvasContext((yield R[U]).data),Z=(yield E[U]).data;for(const B in Z){const{width:X,height:K,x:ee,y:oe,sdf:he,pixelRatio:xe,stretchX:Te,stretchY:fe,content:pe,textFitWidth:Me,textFitHeight:Ve}=Z[B];V[U][B]={data:null,pixelRatio:xe,sdf:he,stretchX:Te,stretchY:fe,content:pe,textFitWidth:Me,textFitHeight:Ve,spriteData:{width:X,height:K,x:ee,y:oe,context:$}}}}return V}))})(S,C)}))})(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((c=>{if(this._spriteRequest=null,c)for(const m in c){this._spritesImagesIds[m]=[];const g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter((y=>!(y in c))):[];for(const y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in c[m]){const b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,c[m][y],!1):this.imageManager.addImage(b,c[m][y]),s&&(this._changedImages[b]=!0)}}})).catch((c=>{this._spriteRequest=null,o=c,this.fire(new p.j(o))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),a&&a(o)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){const s=this.sourceCaches[e.source];if(!s)return;const a=e.sourceLayer;if(!a)return;const o=s.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new p.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,s=!1){const a=this._serializedAllLayers();if(!e||e.length===0)return Object.values(s?p.aB(a):a);const o=[];for(const c of e)if(a[c]){const m=s?p.aB(a[c]):a[c];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const s=Object.keys(this._layers);for(const a of s){const o=this._layers[a];o.type!=="custom"&&(e[a]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const s=this._changed;if(s){const o=Object.keys(this._updatedLayers),c=Object.keys(this._removedLayers);(o.length||c.length)&&this._updateWorkerLayers(o,c);for(const m in this._updatedSources){const g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const c=this.sourceCaches[o];a[o]=c.used,c.used=!1}for(const o of this._order){const c=this._layers[o];c.recalculate(e,this._availableImages),!c.isHidden(e.zoom)&&c.source&&(this.sourceCaches[c.source].used=!0)}for(const o in a){const c=this.sourceCaches[o];!!a[o]!=!!c.used&&c.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,s&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,s){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,s={}){var a;this._checkLoaded();const o=this.serialize();if(e=s.transformStyle?s.transformStyle(o,e):e,((a=s.validate)===null||a===void 0||a)&&Oi(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);const c=p.aC(o,e),m=this._getOperationsToPerform(c);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const g of m.operations)g();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const s=[],a=[];for(const o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":s.push((()=>this.addLayer.apply(this,o.args)));break;case"removeLayer":s.push((()=>this.removeLayer.apply(this,o.args)));break;case"setPaintProperty":s.push((()=>this.setPaintProperty.apply(this,o.args)));break;case"setLayoutProperty":s.push((()=>this.setLayoutProperty.apply(this,o.args)));break;case"setFilter":s.push((()=>this.setFilter.apply(this,o.args)));break;case"addSource":s.push((()=>this.addSource.apply(this,o.args)));break;case"removeSource":s.push((()=>this.removeSource.apply(this,o.args)));break;case"setLayerZoomRange":s.push((()=>this.setLayerZoomRange.apply(this,o.args)));break;case"setLight":s.push((()=>this.setLight.apply(this,o.args)));break;case"setGeoJSONSourceData":s.push((()=>this.setGeoJSONSourceData.apply(this,o.args)));break;case"setGlyphs":s.push((()=>this.setGlyphs.apply(this,o.args)));break;case"setSprite":s.push((()=>this.setSprite.apply(this,o.args)));break;case"setSky":s.push((()=>this.setSky.apply(this,o.args)));break;case"setTerrain":s.push((()=>this.map.setTerrain.apply(this,o.args)));break;case"setTransition":s.push((()=>{}));break;default:a.push(o.command)}return{operations:s,unimplemented:a}}addImage(e,s){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,s),this._afterImageUpdated(e)}updateImage(e,s){this.imageManager.updateImage(e,s)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,s,a={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(p.u.source,`sources.${e}`,s,null,a))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const o=this.sourceCaches[e]=new Be(e,s,this.dispatcher);o.style=this,o.setEventedParent(this,(()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e}))),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${a}" is using it.`)));const s=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],s.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,s){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const a=this.sourceCaches[e].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(s),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,s,a={}){this._checkLoaded();const o=e.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let c;if(e.type==="custom"){if(Oi(this,p.aD(e)))return;c=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=p.aB(e),e=p.e(e,{source:o})),this._validate(p.u.layer,`layers.${o}`,e,{arrayIndex:-1},a))return;c=p.aA(e),this._validateLayer(c),c.setEventedParent(this,{layer:{id:o}})}const m=s?this._order.indexOf(s):this._order.length;if(s&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${s}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=c,this._removedLayers[o]&&c.source&&c.type!=="custom"){const g=this._removedLayers[o];delete this._removedLayers[o],g.type!==c.type?this._updatedSources[c.source]="clear":(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause())}this._updateLayer(c),c.onAdd&&c.onAdd(this.map)}}moveLayer(e,s){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===s)return;const a=this._order.indexOf(e);this._order.splice(a,1);const o=s?this._order.indexOf(s):this._order.length;s&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${s}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const s=this._layers[e];if(!s)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));s.setEventedParent(null);const a=this._order.indexOf(e);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=s,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],s.onRemove&&s.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,s,a){this._checkLoaded();const o=this.getLayer(e);o?o.minzoom===s&&o.maxzoom===a||(s!=null&&(o.minzoom=s),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,s,a={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!p.aE(o.filter,s))return s==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.u.filter,`layers.${o.id}.filter`,s,null,a)||(o.filter=p.aB(s),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,s,a,o={}){this._checkLoaded();const c=this.getLayer(e);c?p.aE(c.getLayoutProperty(s),a)||(c.setLayoutProperty(s,a,o),this._updateLayer(c)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,s){const a=this.getLayer(e);if(a)return a.getLayoutProperty(s);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,s,a,o={}){this._checkLoaded();const c=this.getLayer(e);c?p.aE(c.getPaintProperty(s),a)||(c.setPaintProperty(s,a,o)&&this._updateLayer(c),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,s){return this.getLayer(e).getPaintProperty(s)}setFeatureState(e,s){this._checkLoaded();const a=e.source,o=e.sourceLayer,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const m=c.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),c.setFeatureState(o,e.id,s)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,s){this._checkLoaded();const a=e.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const c=o.getSource().type,m=c==="vector"?e.sourceLayer:void 0;c!=="vector"||m?s&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,s):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const s=e.source,a=e.sourceLayer,o=this.sourceCaches[s];if(o!==void 0)return o.getSource().type!=="vector"||a?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=p.aF(this.sourceCaches,(c=>c.serialize())),s=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:s,terrain:a},(c=>c!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const s=m=>this._layers[m].type==="fill-extrusion",a={},o=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g)){a[g]=m;for(const y of e){const b=y[g];if(b)for(const T of b)o.push(T)}}}o.sort(((m,g)=>g.intersectionZ-m.intersectionZ));const c=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g))for(let y=o.length-1;y>=0;y--){const b=o[y].feature;if(a[b.layer.id]<m)break;c.push(b),o.pop()}else for(const y of e){const b=y[g];if(b)for(const T of b)c.push(T.feature)}}return c}queryRenderedFeatures(e,s,a){s&&s.filter&&this._validate(p.u.filter,"queryRenderedFeatures.filter",s.filter,null,s);const o={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new p.j(new Error("parameters.layers must be an Array."))),[];for(const g of s.layers){const y=this._layers[g];if(!y)return this.fire(new p.j(new Error(`The layer '${g}' does not exist in the map's style and cannot be queried for features.`))),[];o[y.source]=!0}}const c=[];s.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const g in this.sourceCaches)s.layers&&!o[g]||c.push(Sr(this.sourceCaches[g],this._layers,m,e,s,a));return this.placement&&c.push((function(g,y,b,T,S,C,E){const R={},V=C.queryRenderedSymbols(T),U=[];for(const $ of Object.keys(V).map(Number))U.push(E[$]);U.sort(Ir);for(const $ of U){const Z=$.featureIndex.lookupSymbolFeatures(V[$.bucketInstanceId],y,$.bucketIndex,$.sourceLayerIndex,S.filter,S.layers,S.availableImages,g);for(const B in Z){const X=R[B]=R[B]||[],K=Z[B];K.sort(((ee,oe)=>{const he=$.featureSortOrder;if(he){const xe=he.indexOf(ee.featureIndex);return he.indexOf(oe.featureIndex)-xe}return oe.featureIndex-ee.featureIndex}));for(const ee of K)X.push(ee)}}for(const $ in R)R[$].forEach((Z=>{const B=Z.feature,X=b[g[$].source].getFeatureState(B.layer["source-layer"],B.id);B.source=B.layer.source,B.layer["source-layer"]&&(B.sourceLayer=B.layer["source-layer"]),B.state=X}));return R})(this._layers,m,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(e,s){s&&s.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",s.filter,null,s);const a=this.sourceCaches[e];return a?(function(o,c){const m=o.getRenderableIds().map((b=>o.getTileByID(b))),g=[],y={};for(let b=0;b<m.length;b++){const T=m[b],S=T.tileID.canonical.key;y[S]||(y[S]=!0,T.querySourceFeatures(g,c))}return g})(a,s):[]}getLight(){return this.light.getLight()}setLight(e,s={}){this._checkLoaded();const a=this.light.getLight();let o=!1;for(const m in e)if(!p.aE(e[m],a[m])){o=!0;break}if(!o)return;const c={now:me.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,s),this.light.updateTransitions(c)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,s={}){const a=this.getSky();let o=!1;if(!e&&!a)return;if(e&&!a)o=!0;else if(!e&&a)o=!0;else for(const m in e)if(!p.aE(e[m],a[m])){o=!0;break}if(!o)return;const c={now:me.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,s),this.sky.updateTransitions(c)}_validate(e,s,a,o,c={}){return(!c||c.validate!==!1)&&Oi(this,e.call(p.u,p.e({key:s,style:this.serialize(),value:a,styleSpec:p.v},o)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),tr().off(ue,this._rtlPluginLoaded);for(const s in this._layers)this._layers[s].setEventedParent(null);for(const s in this.sourceCaches){const a=this.sourceCaches[s];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const s in this.sourceCaches)this.sourceCaches[s].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,s,a,o,c=!1){let m=!1,g=!1;const y={};for(const b of this._order){const T=this._layers[b];if(T.type!=="symbol")continue;if(!y[T.source]){const C=this.sourceCaches[T.source];y[T.source]=C.getRenderableIds(!0).map((E=>C.getTileByID(E))).sort(((E,R)=>R.tileID.overscaledZ-E.tileID.overscaledZ||(E.tileID.isLessThan(R.tileID)?-1:1)))}const S=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(me.now(),e.zoom))&&(this.pauseablePlacement=new Qs(e,this.map.terrain,this._order,c,s,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(me.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)for(const b of this._order){const T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(me.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,s){return p._(this,void 0,void 0,(function*(){const a=yield this.imageManager.getImages(s.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,s.icons),a}))}getGlyphs(e,s){return p._(this,void 0,void 0,(function*(){const a=yield this.glyphManager.getGlyphs(s.stacks),o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,[""]),a}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,s={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,s,a={},o){this._checkLoaded();const c=[{id:e,url:s}],m=[...Ji(this.stylesheet.sprite),...c];this._validate(p.u.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(c,!0,o))}removeSprite(e){this._checkLoaded();const s=Ji(this.stylesheet.sprite);if(s.find((a=>a.id===e))){if(this._spritesImagesIds[e])for(const a of this._spritesImagesIds[e])this.imageManager.removeImage(a),this._changedImages[a]=!0;s.splice(s.findIndex((a=>a.id===e)),1),this.stylesheet.sprite=s.length>0?s:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Ji(this.stylesheet.sprite)}setSprite(e,s={},a){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,s)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,a):(this._unloadSprite(),a&&a(null)))}}var Zr=p.Y([{name:"a_pos",type:"Int16",components:2}]);const Cr={prelude:tt(`#ifdef GL_ES
6
- precision mediump float;
7
- #else
8
- #if !defined(lowp)
9
- #define lowp
10
- #endif
11
- #if !defined(mediump)
12
- #define mediump
13
- #endif
14
- #if !defined(highp)
15
- #define highp
16
- #endif
17
- #endif
18
- `,`#ifdef GL_ES
19
- precision highp float;
20
- #else
21
- #if !defined(lowp)
22
- #define lowp
23
- #endif
24
- #if !defined(mediump)
25
- #define mediump
26
- #endif
27
- #if !defined(highp)
28
- #define highp
29
- #endif
30
- #endif
31
- vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
32
- );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
33
- #ifdef TERRAIN3D
34
- uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
35
- #endif
36
- const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
37
- #ifdef TERRAIN3D
38
- highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
39
- #else
40
- return 1.0;
41
- #endif
42
- }float calculate_visibility(vec4 pos) {
43
- #ifdef TERRAIN3D
44
- vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
45
- #else
46
- return 1.0;
47
- #endif
48
- }float ele(vec2 pos) {
49
- #ifdef TERRAIN3D
50
- vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
51
- #else
52
- return 0.0;
53
- #endif
54
- }float get_elevation(vec2 pos) {
55
- #ifdef TERRAIN3D
56
- vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
57
- #else
58
- return 0.0;
59
- #endif
60
- }`),background:tt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
61
- #ifdef OVERDRAW_INSPECTOR
62
- gl_FragColor=vec4(1.0);
63
- #endif
64
- }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:tt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
65
- #ifdef OVERDRAW_INSPECTOR
66
- gl_FragColor=vec4(1.0);
67
- #endif
68
- }`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:tt(`varying vec3 v_data;varying float v_visibility;
69
- #pragma mapbox: define highp vec4 color
70
- #pragma mapbox: define mediump float radius
71
- #pragma mapbox: define lowp float blur
72
- #pragma mapbox: define lowp float opacity
73
- #pragma mapbox: define highp vec4 stroke_color
74
- #pragma mapbox: define mediump float stroke_width
75
- #pragma mapbox: define lowp float stroke_opacity
76
- void main() {
77
- #pragma mapbox: initialize highp vec4 color
78
- #pragma mapbox: initialize mediump float radius
79
- #pragma mapbox: initialize lowp float blur
80
- #pragma mapbox: initialize lowp float opacity
81
- #pragma mapbox: initialize highp vec4 stroke_color
82
- #pragma mapbox: initialize mediump float stroke_width
83
- #pragma mapbox: initialize lowp float stroke_opacity
84
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
85
- #ifdef OVERDRAW_INSPECTOR
86
- gl_FragColor=vec4(1.0);
87
- #endif
88
- }`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
89
- #pragma mapbox: define highp vec4 color
90
- #pragma mapbox: define mediump float radius
91
- #pragma mapbox: define lowp float blur
92
- #pragma mapbox: define lowp float opacity
93
- #pragma mapbox: define highp vec4 stroke_color
94
- #pragma mapbox: define mediump float stroke_width
95
- #pragma mapbox: define lowp float stroke_opacity
96
- void main(void) {
97
- #pragma mapbox: initialize highp vec4 color
98
- #pragma mapbox: initialize mediump float radius
99
- #pragma mapbox: initialize lowp float blur
100
- #pragma mapbox: initialize lowp float opacity
101
- #pragma mapbox: initialize highp vec4 stroke_color
102
- #pragma mapbox: initialize mediump float stroke_width
103
- #pragma mapbox: initialize lowp float stroke_opacity
104
- vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:tt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tt(`uniform highp float u_intensity;varying vec2 v_extrude;
105
- #pragma mapbox: define highp float weight
106
- #define GAUSS_COEF 0.3989422804014327
107
- void main() {
108
- #pragma mapbox: initialize highp float weight
109
- float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
110
- #ifdef OVERDRAW_INSPECTOR
111
- gl_FragColor=vec4(1.0);
112
- #endif
113
- }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
114
- #pragma mapbox: define highp float weight
115
- #pragma mapbox: define mediump float radius
116
- const highp float ZERO=1.0/255.0/16.0;
117
- #define GAUSS_COEF 0.3989422804014327
118
- void main(void) {
119
- #pragma mapbox: initialize highp float weight
120
- #pragma mapbox: initialize mediump float radius
121
- vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:tt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
122
- #ifdef OVERDRAW_INSPECTOR
123
- gl_FragColor=vec4(0.0);
124
- #endif
125
- }`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:tt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:tt(`#pragma mapbox: define highp vec4 color
126
- #pragma mapbox: define lowp float opacity
127
- void main() {
128
- #pragma mapbox: initialize highp vec4 color
129
- #pragma mapbox: initialize lowp float opacity
130
- gl_FragColor=color*opacity;
131
- #ifdef OVERDRAW_INSPECTOR
132
- gl_FragColor=vec4(1.0);
133
- #endif
134
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
135
- #pragma mapbox: define highp vec4 color
136
- #pragma mapbox: define lowp float opacity
137
- void main() {
138
- #pragma mapbox: initialize highp vec4 color
139
- #pragma mapbox: initialize lowp float opacity
140
- gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:tt(`varying vec2 v_pos;
141
- #pragma mapbox: define highp vec4 outline_color
142
- #pragma mapbox: define lowp float opacity
143
- void main() {
144
- #pragma mapbox: initialize highp vec4 outline_color
145
- #pragma mapbox: initialize lowp float opacity
146
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
147
- #ifdef OVERDRAW_INSPECTOR
148
- gl_FragColor=vec4(1.0);
149
- #endif
150
- }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
151
- #pragma mapbox: define highp vec4 outline_color
152
- #pragma mapbox: define lowp float opacity
153
- void main() {
154
- #pragma mapbox: initialize highp vec4 outline_color
155
- #pragma mapbox: initialize lowp float opacity
156
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:tt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
157
- #pragma mapbox: define lowp float opacity
158
- #pragma mapbox: define lowp vec4 pattern_from
159
- #pragma mapbox: define lowp vec4 pattern_to
160
- void main() {
161
- #pragma mapbox: initialize lowp float opacity
162
- #pragma mapbox: initialize mediump vec4 pattern_from
163
- #pragma mapbox: initialize mediump vec4 pattern_to
164
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
165
- #ifdef OVERDRAW_INSPECTOR
166
- gl_FragColor=vec4(1.0);
167
- #endif
168
- }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
169
- #pragma mapbox: define lowp float opacity
170
- #pragma mapbox: define lowp vec4 pattern_from
171
- #pragma mapbox: define lowp vec4 pattern_to
172
- #pragma mapbox: define lowp float pixel_ratio_from
173
- #pragma mapbox: define lowp float pixel_ratio_to
174
- void main() {
175
- #pragma mapbox: initialize lowp float opacity
176
- #pragma mapbox: initialize mediump vec4 pattern_from
177
- #pragma mapbox: initialize mediump vec4 pattern_to
178
- #pragma mapbox: initialize lowp float pixel_ratio_from
179
- #pragma mapbox: initialize lowp float pixel_ratio_to
180
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:tt(`#ifdef GL_ES
181
- precision highp float;
182
- #endif
183
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
184
- #pragma mapbox: define lowp float opacity
185
- #pragma mapbox: define lowp vec4 pattern_from
186
- #pragma mapbox: define lowp vec4 pattern_to
187
- void main() {
188
- #pragma mapbox: initialize lowp float opacity
189
- #pragma mapbox: initialize mediump vec4 pattern_from
190
- #pragma mapbox: initialize mediump vec4 pattern_to
191
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
192
- #ifdef OVERDRAW_INSPECTOR
193
- gl_FragColor=vec4(1.0);
194
- #endif
195
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
196
- #pragma mapbox: define lowp float opacity
197
- #pragma mapbox: define lowp vec4 pattern_from
198
- #pragma mapbox: define lowp vec4 pattern_to
199
- #pragma mapbox: define lowp float pixel_ratio_from
200
- #pragma mapbox: define lowp float pixel_ratio_to
201
- void main() {
202
- #pragma mapbox: initialize lowp float opacity
203
- #pragma mapbox: initialize mediump vec4 pattern_from
204
- #pragma mapbox: initialize mediump vec4 pattern_to
205
- #pragma mapbox: initialize lowp float pixel_ratio_from
206
- #pragma mapbox: initialize lowp float pixel_ratio_to
207
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:tt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
208
- #ifdef OVERDRAW_INSPECTOR
209
- gl_FragColor=vec4(1.0);
210
- #endif
211
- }`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
212
- #ifdef TERRAIN3D
213
- attribute vec2 a_centroid;
214
- #endif
215
- varying vec4 v_color;
216
- #pragma mapbox: define highp float base
217
- #pragma mapbox: define highp float height
218
- #pragma mapbox: define highp vec4 color
219
- void main() {
220
- #pragma mapbox: initialize highp float base
221
- #pragma mapbox: initialize highp float height
222
- #pragma mapbox: initialize highp vec4 color
223
- vec3 normal=a_normal_ed.xyz;
224
- #ifdef TERRAIN3D
225
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
226
- #else
227
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
228
- #endif
229
- base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:tt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
230
- #pragma mapbox: define lowp float base
231
- #pragma mapbox: define lowp float height
232
- #pragma mapbox: define lowp vec4 pattern_from
233
- #pragma mapbox: define lowp vec4 pattern_to
234
- #pragma mapbox: define lowp float pixel_ratio_from
235
- #pragma mapbox: define lowp float pixel_ratio_to
236
- void main() {
237
- #pragma mapbox: initialize lowp float base
238
- #pragma mapbox: initialize lowp float height
239
- #pragma mapbox: initialize mediump vec4 pattern_from
240
- #pragma mapbox: initialize mediump vec4 pattern_to
241
- #pragma mapbox: initialize lowp float pixel_ratio_from
242
- #pragma mapbox: initialize lowp float pixel_ratio_to
243
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
244
- #ifdef OVERDRAW_INSPECTOR
245
- gl_FragColor=vec4(1.0);
246
- #endif
247
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
248
- #ifdef TERRAIN3D
249
- attribute vec2 a_centroid;
250
- #endif
251
- varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
252
- #pragma mapbox: define lowp float base
253
- #pragma mapbox: define lowp float height
254
- #pragma mapbox: define lowp vec4 pattern_from
255
- #pragma mapbox: define lowp vec4 pattern_to
256
- #pragma mapbox: define lowp float pixel_ratio_from
257
- #pragma mapbox: define lowp float pixel_ratio_to
258
- void main() {
259
- #pragma mapbox: initialize lowp float base
260
- #pragma mapbox: initialize lowp float height
261
- #pragma mapbox: initialize mediump vec4 pattern_from
262
- #pragma mapbox: initialize mediump vec4 pattern_to
263
- #pragma mapbox: initialize lowp float pixel_ratio_from
264
- #pragma mapbox: initialize lowp float pixel_ratio_to
265
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
266
- #ifdef TERRAIN3D
267
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
268
- #else
269
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
270
- #endif
271
- base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
272
- ? a_pos
273
- : vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:tt(`#ifdef GL_ES
274
- precision highp float;
275
- #endif
276
- uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
277
- #ifdef OVERDRAW_INSPECTOR
278
- gl_FragColor=vec4(1.0);
279
- #endif
280
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:tt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
281
- #define PI 3.141592653589793
282
- void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
283
- #ifdef OVERDRAW_INSPECTOR
284
- gl_FragColor=vec4(1.0);
285
- #endif
286
- }`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:tt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
287
- #pragma mapbox: define highp vec4 color
288
- #pragma mapbox: define lowp float blur
289
- #pragma mapbox: define lowp float opacity
290
- void main() {
291
- #pragma mapbox: initialize highp vec4 color
292
- #pragma mapbox: initialize lowp float blur
293
- #pragma mapbox: initialize lowp float opacity
294
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
295
- #ifdef OVERDRAW_INSPECTOR
296
- gl_FragColor=vec4(1.0);
297
- #endif
298
- }`,`
299
- #define scale 0.015873016
300
- attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
301
- #pragma mapbox: define highp vec4 color
302
- #pragma mapbox: define lowp float blur
303
- #pragma mapbox: define lowp float opacity
304
- #pragma mapbox: define mediump float gapwidth
305
- #pragma mapbox: define lowp float offset
306
- #pragma mapbox: define mediump float width
307
- void main() {
308
- #pragma mapbox: initialize highp vec4 color
309
- #pragma mapbox: initialize lowp float blur
310
- #pragma mapbox: initialize lowp float opacity
311
- #pragma mapbox: initialize mediump float gapwidth
312
- #pragma mapbox: initialize lowp float offset
313
- #pragma mapbox: initialize mediump float width
314
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
315
- #ifdef TERRAIN3D
316
- v_gamma_scale=1.0;
317
- #else
318
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
319
- #endif
320
- v_width2=vec2(outset,inset);}`),lineGradient:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
321
- #pragma mapbox: define lowp float blur
322
- #pragma mapbox: define lowp float opacity
323
- void main() {
324
- #pragma mapbox: initialize lowp float blur
325
- #pragma mapbox: initialize lowp float opacity
326
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
327
- #ifdef OVERDRAW_INSPECTOR
328
- gl_FragColor=vec4(1.0);
329
- #endif
330
- }`,`
331
- #define scale 0.015873016
332
- attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
333
- #pragma mapbox: define lowp float blur
334
- #pragma mapbox: define lowp float opacity
335
- #pragma mapbox: define mediump float gapwidth
336
- #pragma mapbox: define lowp float offset
337
- #pragma mapbox: define mediump float width
338
- void main() {
339
- #pragma mapbox: initialize lowp float blur
340
- #pragma mapbox: initialize lowp float opacity
341
- #pragma mapbox: initialize mediump float gapwidth
342
- #pragma mapbox: initialize lowp float offset
343
- #pragma mapbox: initialize mediump float width
344
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
345
- #ifdef TERRAIN3D
346
- v_gamma_scale=1.0;
347
- #else
348
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
349
- #endif
350
- v_width2=vec2(outset,inset);}`),linePattern:tt(`#ifdef GL_ES
351
- precision highp float;
352
- #endif
353
- uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
354
- #pragma mapbox: define lowp vec4 pattern_from
355
- #pragma mapbox: define lowp vec4 pattern_to
356
- #pragma mapbox: define lowp float pixel_ratio_from
357
- #pragma mapbox: define lowp float pixel_ratio_to
358
- #pragma mapbox: define lowp float blur
359
- #pragma mapbox: define lowp float opacity
360
- void main() {
361
- #pragma mapbox: initialize mediump vec4 pattern_from
362
- #pragma mapbox: initialize mediump vec4 pattern_to
363
- #pragma mapbox: initialize lowp float pixel_ratio_from
364
- #pragma mapbox: initialize lowp float pixel_ratio_to
365
- #pragma mapbox: initialize lowp float blur
366
- #pragma mapbox: initialize lowp float opacity
367
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
368
- #ifdef OVERDRAW_INSPECTOR
369
- gl_FragColor=vec4(1.0);
370
- #endif
371
- }`,`
372
- #define scale 0.015873016
373
- #define LINE_DISTANCE_SCALE 2.0
374
- attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
375
- #pragma mapbox: define lowp float blur
376
- #pragma mapbox: define lowp float opacity
377
- #pragma mapbox: define lowp float offset
378
- #pragma mapbox: define mediump float gapwidth
379
- #pragma mapbox: define mediump float width
380
- #pragma mapbox: define lowp float floorwidth
381
- #pragma mapbox: define lowp vec4 pattern_from
382
- #pragma mapbox: define lowp vec4 pattern_to
383
- #pragma mapbox: define lowp float pixel_ratio_from
384
- #pragma mapbox: define lowp float pixel_ratio_to
385
- void main() {
386
- #pragma mapbox: initialize lowp float blur
387
- #pragma mapbox: initialize lowp float opacity
388
- #pragma mapbox: initialize lowp float offset
389
- #pragma mapbox: initialize mediump float gapwidth
390
- #pragma mapbox: initialize mediump float width
391
- #pragma mapbox: initialize lowp float floorwidth
392
- #pragma mapbox: initialize mediump vec4 pattern_from
393
- #pragma mapbox: initialize mediump vec4 pattern_to
394
- #pragma mapbox: initialize lowp float pixel_ratio_from
395
- #pragma mapbox: initialize lowp float pixel_ratio_to
396
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
397
- #ifdef TERRAIN3D
398
- v_gamma_scale=1.0;
399
- #else
400
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
401
- #endif
402
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
403
- #pragma mapbox: define highp vec4 color
404
- #pragma mapbox: define lowp float blur
405
- #pragma mapbox: define lowp float opacity
406
- #pragma mapbox: define mediump float width
407
- #pragma mapbox: define lowp float floorwidth
408
- void main() {
409
- #pragma mapbox: initialize highp vec4 color
410
- #pragma mapbox: initialize lowp float blur
411
- #pragma mapbox: initialize lowp float opacity
412
- #pragma mapbox: initialize mediump float width
413
- #pragma mapbox: initialize lowp float floorwidth
414
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
415
- #ifdef OVERDRAW_INSPECTOR
416
- gl_FragColor=vec4(1.0);
417
- #endif
418
- }`,`
419
- #define scale 0.015873016
420
- #define LINE_DISTANCE_SCALE 2.0
421
- attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
422
- #pragma mapbox: define highp vec4 color
423
- #pragma mapbox: define lowp float blur
424
- #pragma mapbox: define lowp float opacity
425
- #pragma mapbox: define mediump float gapwidth
426
- #pragma mapbox: define lowp float offset
427
- #pragma mapbox: define mediump float width
428
- #pragma mapbox: define lowp float floorwidth
429
- void main() {
430
- #pragma mapbox: initialize highp vec4 color
431
- #pragma mapbox: initialize lowp float blur
432
- #pragma mapbox: initialize lowp float opacity
433
- #pragma mapbox: initialize mediump float gapwidth
434
- #pragma mapbox: initialize lowp float offset
435
- #pragma mapbox: initialize mediump float width
436
- #pragma mapbox: initialize lowp float floorwidth
437
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
438
- #ifdef TERRAIN3D
439
- v_gamma_scale=1.0;
440
- #else
441
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
442
- #endif
443
- v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:tt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
444
- #ifdef OVERDRAW_INSPECTOR
445
- gl_FragColor=vec4(1.0);
446
- #endif
447
- }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:tt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
448
- #pragma mapbox: define lowp float opacity
449
- void main() {
450
- #pragma mapbox: initialize lowp float opacity
451
- lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
452
- #ifdef OVERDRAW_INSPECTOR
453
- gl_FragColor=vec4(1.0);
454
- #endif
455
- }`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
456
- #pragma mapbox: define lowp float opacity
457
- void main() {
458
- #pragma mapbox: initialize lowp float opacity
459
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
460
- camera_to_anchor_distance/u_camera_to_center_distance :
461
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:tt(`#define SDF_PX 8.0
462
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
463
- #pragma mapbox: define highp vec4 fill_color
464
- #pragma mapbox: define highp vec4 halo_color
465
- #pragma mapbox: define lowp float opacity
466
- #pragma mapbox: define lowp float halo_width
467
- #pragma mapbox: define lowp float halo_blur
468
- void main() {
469
- #pragma mapbox: initialize highp vec4 fill_color
470
- #pragma mapbox: initialize highp vec4 halo_color
471
- #pragma mapbox: initialize lowp float opacity
472
- #pragma mapbox: initialize lowp float halo_width
473
- #pragma mapbox: initialize lowp float halo_blur
474
- float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
475
- #ifdef OVERDRAW_INSPECTOR
476
- gl_FragColor=vec4(1.0);
477
- #endif
478
- }`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
479
- #pragma mapbox: define highp vec4 fill_color
480
- #pragma mapbox: define highp vec4 halo_color
481
- #pragma mapbox: define lowp float opacity
482
- #pragma mapbox: define lowp float halo_width
483
- #pragma mapbox: define lowp float halo_blur
484
- void main() {
485
- #pragma mapbox: initialize highp vec4 fill_color
486
- #pragma mapbox: initialize highp vec4 halo_color
487
- #pragma mapbox: initialize lowp float opacity
488
- #pragma mapbox: initialize lowp float halo_width
489
- #pragma mapbox: initialize lowp float halo_blur
490
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
491
- camera_to_anchor_distance/u_camera_to_center_distance :
492
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:tt(`#define SDF_PX 8.0
493
- #define SDF 1.0
494
- #define ICON 0.0
495
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
496
- #pragma mapbox: define highp vec4 fill_color
497
- #pragma mapbox: define highp vec4 halo_color
498
- #pragma mapbox: define lowp float opacity
499
- #pragma mapbox: define lowp float halo_width
500
- #pragma mapbox: define lowp float halo_blur
501
- void main() {
502
- #pragma mapbox: initialize highp vec4 fill_color
503
- #pragma mapbox: initialize highp vec4 halo_color
504
- #pragma mapbox: initialize lowp float opacity
505
- #pragma mapbox: initialize lowp float halo_width
506
- #pragma mapbox: initialize lowp float halo_blur
507
- float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
508
- #ifdef OVERDRAW_INSPECTOR
509
- gl_FragColor=vec4(1.0);
510
- #endif
511
- return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
512
- #ifdef OVERDRAW_INSPECTOR
513
- gl_FragColor=vec4(1.0);
514
- #endif
515
- }`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
516
- #pragma mapbox: define highp vec4 fill_color
517
- #pragma mapbox: define highp vec4 halo_color
518
- #pragma mapbox: define lowp float opacity
519
- #pragma mapbox: define lowp float halo_width
520
- #pragma mapbox: define lowp float halo_blur
521
- void main() {
522
- #pragma mapbox: initialize highp vec4 fill_color
523
- #pragma mapbox: initialize highp vec4 halo_color
524
- #pragma mapbox: initialize lowp float opacity
525
- #pragma mapbox: initialize lowp float halo_width
526
- #pragma mapbox: initialize lowp float halo_blur
527
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
528
- camera_to_anchor_distance/u_camera_to_center_distance :
529
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:tt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:tt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:tt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:tt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function tt(h,e){const s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=e.match(/attribute ([\w]+) ([\w]+)/g),o=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),c=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=c?c.concat(o):o,g={};return{fragmentSource:h=h.replace(s,((y,b,T,S,C)=>(g[C]=!0,b==="define"?`
530
- #ifndef HAS_UNIFORM_u_${C}
531
- varying ${T} ${S} ${C};
532
- #else
533
- uniform ${T} ${S} u_${C};
534
- #endif
535
- `:`
536
- #ifdef HAS_UNIFORM_u_${C}
537
- ${T} ${S} ${C} = u_${C};
538
- #endif
539
- `))),vertexSource:e=e.replace(s,((y,b,T,S,C)=>{const E=S==="float"?"vec2":"vec4",R=C.match(/color/)?"color":E;return g[C]?b==="define"?`
540
- #ifndef HAS_UNIFORM_u_${C}
541
- uniform lowp float u_${C}_t;
542
- attribute ${T} ${E} a_${C};
543
- varying ${T} ${S} ${C};
544
- #else
545
- uniform ${T} ${S} u_${C};
546
- #endif
547
- `:R==="vec4"?`
548
- #ifndef HAS_UNIFORM_u_${C}
549
- ${C} = a_${C};
550
- #else
551
- ${T} ${S} ${C} = u_${C};
552
- #endif
553
- `:`
554
- #ifndef HAS_UNIFORM_u_${C}
555
- ${C} = unpack_mix_${R}(a_${C}, u_${C}_t);
556
- #else
557
- ${T} ${S} ${C} = u_${C};
558
- #endif
559
- `:b==="define"?`
560
- #ifndef HAS_UNIFORM_u_${C}
561
- uniform lowp float u_${C}_t;
562
- attribute ${T} ${E} a_${C};
563
- #else
564
- uniform ${T} ${S} u_${C};
565
- #endif
566
- `:R==="vec4"?`
567
- #ifndef HAS_UNIFORM_u_${C}
568
- ${T} ${S} ${C} = a_${C};
569
- #else
570
- ${T} ${S} ${C} = u_${C};
571
- #endif
572
- `:`
573
- #ifndef HAS_UNIFORM_u_${C}
574
- ${T} ${S} ${C} = unpack_mix_${R}(a_${C}, u_${C}_t);
575
- #else
576
- ${T} ${S} ${C} = u_${C};
577
- #endif
578
- `})),staticAttributes:a,staticUniforms:m}}class Ca{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,s,a,o,c,m,g,y,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let S=0;!T&&S<o.length;S++)this.boundPaintVertexBuffers[S]!==o[S]&&(T=!0);!this.vao||this.boundProgram!==s||this.boundLayoutVertexBuffer!==a||T||this.boundIndexBuffer!==c||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==g||this.boundDynamicVertexBuffer2!==y||this.boundDynamicVertexBuffer3!==b?this.freshBind(s,a,o,c,m,g,y,b):(e.bindVertexArray.set(this.vao),g&&g.bind(),c&&c.dynamicDraw&&c.bind(),y&&y.bind(),b&&b.bind())}freshBind(e,s,a,o,c,m,g,y){const b=e.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=s,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=o,this.boundVertexOffset=c,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=g,this.boundDynamicVertexBuffer3=y,s.enableAttributes(S,e);for(const C of a)C.enableAttributes(S,e);m&&m.enableAttributes(S,e),g&&g.enableAttributes(S,e),y&&y.enableAttributes(S,e),s.bind(),s.setVertexAttribPointers(S,e,c);for(const C of a)C.bind(),C.setVertexAttribPointers(S,e,c);m&&(m.bind(),m.setVertexAttribPointers(S,e,c)),o&&o.bind(),g&&(g.bind(),g.setVertexAttribPointers(S,e,c)),y&&(y.bind(),y.setVertexAttribPointers(S,e,c)),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ka=(h,e,s,a,o)=>({u_matrix:h,u_texture:0,u_ele_delta:e,u_fog_matrix:s,u_fog_color:a?a.properties.get("fog-color"):p.aM.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?a.calculateFogBlendOpacity(o):0,u_horizon_color:a?a.properties.get("horizon-color"):p.aM.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1});function fs(h){const e=[];for(let s=0;s<h.length;s++){if(h[s]===null)continue;const a=h[s].split(" ");e.push(a.pop())}return e}class za{constructor(e,s,a,o,c,m){const g=e.gl;this.program=g.createProgram();const y=fs(s.staticAttributes),b=a?a.getBinderAttributes():[],T=y.concat(b),S=Cr.prelude.staticUniforms?fs(Cr.prelude.staticUniforms):[],C=s.staticUniforms?fs(s.staticUniforms):[],E=a?a.getBinderUniforms():[],R=S.concat(C).concat(E),V=[];for(const ee of R)V.indexOf(ee)<0&&V.push(ee);const U=a?a.defines():[];c&&U.push("#define OVERDRAW_INSPECTOR;"),m&&U.push("#define TERRAIN3D;");const $=U.concat(Cr.prelude.fragmentSource,s.fragmentSource).join(`
579
- `),Z=U.concat(Cr.prelude.vertexSource,s.vertexSource).join(`
580
- `),B=g.createShader(g.FRAGMENT_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);if(g.shaderSource(B,$),g.compileShader(B),!g.getShaderParameter(B,g.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${g.getShaderInfoLog(B)}`);g.attachShader(this.program,B);const X=g.createShader(g.VERTEX_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);if(g.shaderSource(X,Z),g.compileShader(X),!g.getShaderParameter(X,g.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${g.getShaderInfoLog(X)}`);g.attachShader(this.program,X),this.attributes={};const K={};this.numAttributes=T.length;for(let ee=0;ee<this.numAttributes;ee++)T[ee]&&(g.bindAttribLocation(this.program,ee,T[ee]),this.attributes[T[ee]]=ee);if(g.linkProgram(this.program),!g.getProgramParameter(this.program,g.LINK_STATUS))throw new Error(`Program failed to link: ${g.getProgramInfoLog(this.program)}`);g.deleteShader(X),g.deleteShader(B);for(let ee=0;ee<V.length;ee++){const oe=V[ee];if(oe&&!K[oe]){const he=g.getUniformLocation(this.program,oe);he&&(K[oe]=he)}}this.fixedUniforms=o(e,K),this.terrainUniforms=((ee,oe)=>({u_depth:new p.aH(ee,oe.u_depth),u_terrain:new p.aH(ee,oe.u_terrain),u_terrain_dim:new p.aI(ee,oe.u_terrain_dim),u_terrain_matrix:new p.aJ(ee,oe.u_terrain_matrix),u_terrain_unpack:new p.aK(ee,oe.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ee,oe.u_terrain_exaggeration)}))(e,K),this.binderUniforms=a?a.getUniforms(e,K):[]}draw(e,s,a,o,c,m,g,y,b,T,S,C,E,R,V,U,$,Z){const B=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(o),e.setColorMode(c),e.setCullFace(m),y){e.activeTexture.set(B.TEXTURE2),B.bindTexture(B.TEXTURE_2D,y.depthTexture),e.activeTexture.set(B.TEXTURE3),B.bindTexture(B.TEXTURE_2D,y.texture);for(const K in this.terrainUniforms)this.terrainUniforms[K].set(y[K])}for(const K in this.fixedUniforms)this.fixedUniforms[K].set(g[K]);V&&V.setUniforms(e,this.binderUniforms,E,{zoom:R});let X=0;switch(s){case B.LINES:X=2;break;case B.TRIANGLES:X=3;break;case B.LINE_STRIP:X=1}for(const K of C.get()){const ee=K.vaos||(K.vaos={});(ee[b]||(ee[b]=new Ca)).bind(e,this,T,V?V.getPaintVertexBuffers():[],S,K.vertexOffset,U,$,Z),B.drawElements(s,K.primitiveLength*X,B.UNSIGNED_SHORT,K.primitiveOffset*X*2)}}}function zn(h,e,s){const a=1/Ge(s,1,e.transform.tileZoom),o=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=c*(s.tileID.canonical.x+s.tileID.wrap*o),g=c*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[a,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}const en=(h,e,s,a)=>{const o=e.style.light,c=o.properties.get("position"),m=[c.x,c.y,c.z],g=(function(){var b=new p.A(9);return p.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b})();o.properties.get("anchor")==="viewport"&&(function(b,T){var S=Math.sin(T),C=Math.cos(T);b[0]=C,b[1]=S,b[2]=0,b[3]=-S,b[4]=C,b[5]=0,b[6]=0,b[7]=0,b[8]=1})(g,-e.transform.angle),(function(b,T,S){var C=T[0],E=T[1],R=T[2];b[0]=C*S[0]+E*S[3]+R*S[6],b[1]=C*S[1]+E*S[4]+R*S[7],b[2]=C*S[2]+E*S[5]+R*S[8]})(m,m,g);const y=o.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+s,u_opacity:a}},En=(h,e,s,a,o,c,m)=>p.e(en(h,e,s,a),zn(c,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),ms=h=>({u_matrix:h}),Bo=(h,e,s,a)=>p.e(ms(h),zn(s,e,a)),jl=(h,e)=>({u_matrix:h,u_world:e}),Fo=(h,e,s,a,o)=>p.e(Bo(h,e,s,a),{u_world:o}),Ul=(h,e,s,a)=>{const o=h.transform;let c,m;if(a.paint.get("circle-pitch-alignment")==="map"){const g=Ge(s,1,o.zoom);c=!0,m=[g,g]}else c=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(e.posMatrix,s,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+c,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},Gr=(h,e,s)=>({u_matrix:h,u_inv_matrix:e,u_camera_to_center_distance:s.cameraToCenterDistance,u_viewport_size:[s.width,s.height]}),tn=(h,e,s=1)=>({u_matrix:h,u_color:e,u_overlay:0,u_overlay_scale:s}),ii=h=>({u_matrix:h}),ri=(h,e,s,a)=>({u_matrix:h,u_extrude_scale:Ge(e,1,s),u_intensity:a}),Dn=(h,e,s,a)=>{const o=p.H();p.aP(o,0,h.width,h.height,0,0,1);const c=h.context.gl;return{u_matrix:o,u_world:[c.drawingBufferWidth,c.drawingBufferHeight],u_image:s,u_color_ramp:a,u_opacity:e.paint.get("heatmap-opacity")}};function Ln(h,e){const s=Math.pow(2,e.canonical.z),a=e.canonical.y;return[new p.Z(0,a/s).toLngLat().lat,new p.Z(0,(a+1)/s).toLngLat().lat]}const Rn=(h,e,s,a)=>{const o=h.transform;return{u_matrix:No(h,e,s,a),u_ratio:1/Ge(e,1,o.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Oo=(h,e,s,a,o)=>p.e(Rn(h,e,s,o),{u_image:0,u_image_height:a}),_s=(h,e,s,a,o)=>{const c=h.transform,m=Vo(e,c);return{u_matrix:No(h,e,s,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ge(e,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},$l=(h,e,s,a,o,c)=>{const m=h.lineAtlas,g=Vo(e,h.transform),y=s.layout.get("line-cap")==="round",b=m.getDash(a.from,y),T=m.getDash(a.to,y),S=b.width*o.fromScale,C=T.width*o.toScale;return p.e(Rn(h,e,s,c),{u_patternscale_a:[g/S,-b.height/2],u_patternscale_b:[g/C,-T.height/2],u_sdfgamma:m.width/(256*Math.min(S,C)*h.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:T.y,u_mix:o.t})};function Vo(h,e){return 1/Ge(h,1,e.tileZoom)}function No(h,e,s,a){return h.translatePosMatrix(a?a.posMatrix:e.tileID.posMatrix,e,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}const ql=(h,e,s,a,o)=>{return{u_matrix:h,u_tl_parent:e,u_scale_parent:s,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(c=o.paint.get("raster-contrast"),c>0?1/(1-c):1+c),u_spin_weights:Zl(o.paint.get("raster-hue-rotate"))};var c,m};function Zl(h){h*=Math.PI/180;const e=Math.sin(h),s=Math.cos(h);return[(2*s+1)/3,(-Math.sqrt(3)*e-s+1)/3,(Math.sqrt(3)*e-s+1)/3]}const jo=(h,e,s,a,o,c,m,g,y,b,T,S,C,E)=>{const R=m.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:R.width/R.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+S,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:c,u_texsize:C,u_texture:0,u_translation:T,u_pitched_scale:E}},rn=(h,e,s,a,o,c,m,g,y,b,T,S,C,E,R)=>{const V=m.transform;return p.e(jo(h,e,s,a,o,c,m,g,y,b,T,S,C,R),{u_gamma_scale:a?Math.cos(V._pitch)*V.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+E})},Ea=(h,e,s,a,o,c,m,g,y,b,T,S,C,E)=>p.e(rn(h,e,s,a,o,c,m,g,y,b,T,!0,S,!0,E),{u_texsize_icon:C,u_texture_icon:1}),Bn=(h,e,s)=>({u_matrix:h,u_opacity:e,u_color:s}),Da=(h,e,s,a,o,c)=>p.e((function(m,g,y,b){const T=y.imageManager.getPattern(m.from.toString()),S=y.imageManager.getPattern(m.to.toString()),{width:C,height:E}=y.imageManager.getPixelSize(),R=Math.pow(2,b.tileID.overscaledZ),V=b.tileSize*Math.pow(2,y.transform.tileZoom)/R,U=V*(b.tileID.canonical.x+b.tileID.wrap*R),$=V*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:S.tl,u_pattern_br_b:S.br,u_texsize:[C,E],u_mix:g.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:S.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/Ge(b,1,y.transform.tileZoom),u_pixel_coord_upper:[U>>16,$>>16],u_pixel_coord_lower:[65535&U,65535&$]}})(a,c,s,o),{u_matrix:h,u_opacity:e}),La={fillExtrusion:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_lightpos:new p.aN(h,e.u_lightpos),u_lightintensity:new p.aI(h,e.u_lightintensity),u_lightcolor:new p.aN(h,e.u_lightcolor),u_vertical_gradient:new p.aI(h,e.u_vertical_gradient),u_opacity:new p.aI(h,e.u_opacity)}),fillExtrusionPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_lightpos:new p.aN(h,e.u_lightpos),u_lightintensity:new p.aI(h,e.u_lightintensity),u_lightcolor:new p.aN(h,e.u_lightcolor),u_vertical_gradient:new p.aI(h,e.u_vertical_gradient),u_height_factor:new p.aI(h,e.u_height_factor),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade),u_opacity:new p.aI(h,e.u_opacity)}),fill:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix)}),fillPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),fillOutline:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world)}),fillOutlinePattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),circle:(h,e)=>({u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(h,e.u_scale_with_map),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_extrude_scale:new p.aO(h,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_matrix:new p.aJ(h,e.u_matrix)}),collisionBox:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_pixel_extrude_scale:new p.aO(h,e.u_pixel_extrude_scale)}),collisionCircle:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_inv_matrix:new p.aJ(h,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_viewport_size:new p.aO(h,e.u_viewport_size)}),debug:(h,e)=>({u_color:new p.aL(h,e.u_color),u_matrix:new p.aJ(h,e.u_matrix),u_overlay:new p.aH(h,e.u_overlay),u_overlay_scale:new p.aI(h,e.u_overlay_scale)}),clippingMask:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix)}),heatmap:(h,e)=>({u_extrude_scale:new p.aI(h,e.u_extrude_scale),u_intensity:new p.aI(h,e.u_intensity),u_matrix:new p.aJ(h,e.u_matrix)}),heatmapTexture:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world),u_image:new p.aH(h,e.u_image),u_color_ramp:new p.aH(h,e.u_color_ramp),u_opacity:new p.aI(h,e.u_opacity)}),hillshade:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_latrange:new p.aO(h,e.u_latrange),u_light:new p.aO(h,e.u_light),u_shadow:new p.aL(h,e.u_shadow),u_highlight:new p.aL(h,e.u_highlight),u_accent:new p.aL(h,e.u_accent)}),hillshadePrepare:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_dimension:new p.aO(h,e.u_dimension),u_zoom:new p.aI(h,e.u_zoom),u_unpack:new p.aK(h,e.u_unpack)}),line:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels)}),lineGradient:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_image:new p.aH(h,e.u_image),u_image_height:new p.aI(h,e.u_image_height)}),linePattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texsize:new p.aO(h,e.u_texsize),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_image:new p.aH(h,e.u_image),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),lineSDF:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_patternscale_a:new p.aO(h,e.u_patternscale_a),u_patternscale_b:new p.aO(h,e.u_patternscale_b),u_sdfgamma:new p.aI(h,e.u_sdfgamma),u_image:new p.aH(h,e.u_image),u_tex_y_a:new p.aI(h,e.u_tex_y_a),u_tex_y_b:new p.aI(h,e.u_tex_y_b),u_mix:new p.aI(h,e.u_mix)}),raster:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_tl_parent:new p.aO(h,e.u_tl_parent),u_scale_parent:new p.aI(h,e.u_scale_parent),u_buffer_scale:new p.aI(h,e.u_buffer_scale),u_fade_t:new p.aI(h,e.u_fade_t),u_opacity:new p.aI(h,e.u_opacity),u_image0:new p.aH(h,e.u_image0),u_image1:new p.aH(h,e.u_image1),u_brightness_low:new p.aI(h,e.u_brightness_low),u_brightness_high:new p.aI(h,e.u_brightness_high),u_saturation_factor:new p.aI(h,e.u_saturation_factor),u_contrast_factor:new p.aI(h,e.u_contrast_factor),u_spin_weights:new p.aN(h,e.u_spin_weights)}),symbolIcon:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texture:new p.aH(h,e.u_texture),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),symbolSDF:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texture:new p.aH(h,e.u_texture),u_gamma_scale:new p.aI(h,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_is_halo:new p.aH(h,e.u_is_halo),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),symbolTextAndIcon:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texsize_icon:new p.aO(h,e.u_texsize_icon),u_texture:new p.aH(h,e.u_texture),u_texture_icon:new p.aH(h,e.u_texture_icon),u_gamma_scale:new p.aI(h,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_is_halo:new p.aH(h,e.u_is_halo),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),background:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_opacity:new p.aI(h,e.u_opacity),u_color:new p.aL(h,e.u_color)}),backgroundPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_opacity:new p.aI(h,e.u_opacity),u_image:new p.aH(h,e.u_image),u_pattern_tl_a:new p.aO(h,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(h,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(h,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(h,e.u_pattern_br_b),u_texsize:new p.aO(h,e.u_texsize),u_mix:new p.aI(h,e.u_mix),u_pattern_size_a:new p.aO(h,e.u_pattern_size_a),u_pattern_size_b:new p.aO(h,e.u_pattern_size_b),u_scale_a:new p.aI(h,e.u_scale_a),u_scale_b:new p.aI(h,e.u_scale_b),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(h,e.u_tile_units_to_pixels)}),terrain:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texture:new p.aH(h,e.u_texture),u_ele_delta:new p.aI(h,e.u_ele_delta),u_fog_matrix:new p.aJ(h,e.u_fog_matrix),u_fog_color:new p.aL(h,e.u_fog_color),u_fog_ground_blend:new p.aI(h,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(h,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(h,e.u_horizon_color),u_horizon_fog_blend:new p.aI(h,e.u_horizon_fog_blend)}),terrainDepth:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ele_delta:new p.aI(h,e.u_ele_delta)}),terrainCoords:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texture:new p.aH(h,e.u_texture),u_terrain_coords_id:new p.aI(h,e.u_terrain_coords_id),u_ele_delta:new p.aI(h,e.u_ele_delta)}),sky:(h,e)=>({u_sky_color:new p.aL(h,e.u_sky_color),u_horizon_color:new p.aL(h,e.u_horizon_color),u_horizon:new p.aI(h,e.u_horizon),u_sky_horizon_blend:new p.aI(h,e.u_sky_horizon_blend)})};class sr{constructor(e,s,a){this.context=e;const o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Gl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ra{constructor(e,s,a,o){this.length=s.length,this.attributes=a,this.itemSize=s.bytesPerElement,this.dynamicDraw=o,this.context=e;const c=e.gl;this.buffer=c.createBuffer(),e.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,s){for(let a=0;a<this.attributes.length;a++){const o=s.attributes[this.attributes[a].name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,s,a){for(let o=0;o<this.attributes.length;o++){const c=this.attributes[o],m=s.attributes[c.name];m!==void 0&&e.vertexAttribPointer(m,c.components,e[Gl[c.type]],!1,this.itemSize,c.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Hr=new WeakMap;function kr(h){var e;if(Hr.has(h))return Hr.get(h);{const s=(e=h.getParameter(h.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Hr.set(h,s),s}}class it{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Fn extends it{getDefault(){return p.aM.transparent}set(e){const s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Hl extends it{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class gs extends it{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Xl extends it{getDefault(){return[!0,!0,!0,!0]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Uo extends it{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Wl extends it{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class $o extends it{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const s=this.current;(e.func!==s.func||e.ref!==s.ref||e.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Ba extends it{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class qo extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=e,this.dirty=!1}}class Zo extends it{getDefault(){return[0,1]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Go extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ho extends it{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Xr extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.BLEND):s.disable(s.BLEND),this.current=e,this.dirty=!1}}class Xo extends it{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Kl extends it{getDefault(){return p.aM.transparent}set(e){const s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Wo extends it{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class sn extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=e,this.dirty=!1}}class Jl extends it{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class On extends it{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Yl extends it{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Ql extends it{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ko extends it{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Jo extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Yo extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Fa extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindTexture(s.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Qo extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Vn extends it{getDefault(){return null}set(e){const s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class _r extends it{getDefault(){return null}set(e){var s;if(e===this.current&&!this.dirty)return;const a=this.gl;kr(a)?a.bindVertexArray(e):(s=a.getExtension("OES_vertex_array_object"))===null||s===void 0||s.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Oa extends it{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Va extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Na extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Nn extends it{constructor(e,s){super(e),this.context=e,this.parent=s}getDefault(){return null}}class ja extends Nn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Wr extends Nn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ua extends Nn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ec{constructor(e,s,a,o,c){this.context=e,this.width=s,this.height=a;const m=e.gl,g=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new ja(e,g),o)this.depthAttachment=c?new Ua(e,g):new Wr(e,g);else if(c)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,s=this.colorAttachment.get();if(s&&e.deleteTexture(s),this.depthAttachment){const a=this.depthAttachment.get();a&&e.deleteRenderbuffer(a)}e.deleteFramebuffer(this.framebuffer)}}class bt{constructor(e,s,a){this.blendFunction=e,this.blendColor=s,this.mask=a}}bt.Replace=[1,0],bt.disabled=new bt(bt.Replace,p.aM.transparent,[!1,!1,!1,!1]),bt.unblended=new bt(bt.Replace,p.aM.transparent,[!0,!0,!0,!0]),bt.alphaBlended=new bt([1,771],p.aM.transparent,[!0,!0,!0,!0]);class tc{constructor(e){var s,a;if(this.gl=e,this.clearColor=new Fn(this),this.clearDepth=new Hl(this),this.clearStencil=new gs(this),this.colorMask=new Xl(this),this.depthMask=new Uo(this),this.stencilMask=new Wl(this),this.stencilFunc=new $o(this),this.stencilOp=new Ba(this),this.stencilTest=new qo(this),this.depthRange=new Zo(this),this.depthTest=new Go(this),this.depthFunc=new Ho(this),this.blend=new Xr(this),this.blendFunc=new Xo(this),this.blendColor=new Kl(this),this.blendEquation=new Wo(this),this.cullFace=new sn(this),this.cullFaceSide=new Jl(this),this.frontFace=new On(this),this.program=new Yl(this),this.activeTexture=new Ql(this),this.viewport=new Ko(this),this.bindFramebuffer=new Jo(this),this.bindRenderbuffer=new Yo(this),this.bindTexture=new Fa(this),this.bindVertexBuffer=new Qo(this),this.bindElementBuffer=new Vn(this),this.bindVertexArray=new _r(this),this.pixelStoreUnpack=new Oa(this),this.pixelStoreUnpackPremultiplyAlpha=new Va(this),this.pixelStoreUnpackFlipY=new Na(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),kr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const o=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(s=e.RGBA16F)!==null&&s!==void 0?s:o==null?void 0:o.RGBA16F_EXT,this.RGB16F=(a=e.RGB16F)!==null&&a!==void 0?a:o==null?void 0:o.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const o=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=o==null?void 0:o.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,s){return new sr(this,e,s)}createVertexBuffer(e,s,a){return new Ra(this,e,s,a)}createRenderbuffer(e,s,a){const o=this.gl,c=o.createRenderbuffer();return this.bindRenderbuffer.set(c),o.renderbufferStorage(o.RENDERBUFFER,e,s,a),this.bindRenderbuffer.set(null),c}createFramebuffer(e,s,a,o){return new ec(this,e,s,a,o)}clear({color:e,depth:s,stencil:a}){const o=this.gl;let c=0;e&&(c|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),s!==void 0&&(c|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),this.depthMask.set(!0)),a!==void 0&&(c|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(c)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){p.aE(e.blendFunction,bt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return kr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var s;return kr(this.gl)?this.gl.deleteVertexArray(e):(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class Ze{constructor(e,s,a){this.func=e,this.mask=s,this.range=a}}Ze.ReadOnly=!1,Ze.ReadWrite=!0,Ze.disabled=new Ze(519,Ze.ReadOnly,[0,1]);const jn=7680;class ht{constructor(e,s,a,o,c,m){this.test=e,this.ref=s,this.mask=a,this.fail=o,this.depthFail=c,this.pass=m}}ht.disabled=new ht({func:519,mask:0},0,0,jn,jn,jn);class at{constructor(e,s,a){this.enable=e,this.mode=s,this.frontFace=a}}let Kr;function nn(h,e,s,a,o){const c=h.context,m=c.gl,g=h.useProgram("collisionBox"),y=[];let b=0,T=0;for(let $=0;$<a.length;$++){const Z=a[$],B=e.getTile(Z).getBucket(s);if(!B)continue;const X=o?B.textCollisionBox:B.iconCollisionBox,K=B.collisionCircleArray;if(K.length>0){const ee=p.H();p.aQ(ee,B.placementInvProjMatrix,h.transform.glCoordMatrix),p.aQ(ee,ee,B.placementViewportMatrix),y.push({circleArray:K,circleOffset:T,transform:Z.posMatrix,invTransform:ee,coord:Z}),b+=K.length/4,T=b}X&&g.draw(c,m.LINES,Ze.disabled,ht.disabled,h.colorModeForRenderPass(),at.disabled,{u_matrix:Z.posMatrix,u_pixel_extrude_scale:[1/(S=h.transform).width,1/S.height]},h.style.map.terrain&&h.style.map.terrain.getTerrainData(Z),s.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,null,h.transform.zoom,null,null,X.collisionVertexBuffer)}var S;if(!o||!y.length)return;const C=h.useProgram("collisionCircle"),E=new p.aR;E.resize(4*b),E._trim();let R=0;for(const $ of y)for(let Z=0;Z<$.circleArray.length/4;Z++){const B=4*Z,X=$.circleArray[B+0],K=$.circleArray[B+1],ee=$.circleArray[B+2],oe=$.circleArray[B+3];E.emplace(R++,X,K,ee,oe,0),E.emplace(R++,X,K,ee,oe,1),E.emplace(R++,X,K,ee,oe,2),E.emplace(R++,X,K,ee,oe,3)}(!Kr||Kr.length<2*b)&&(Kr=(function($){const Z=2*$,B=new p.aT;B.resize(Z),B._trim();for(let X=0;X<Z;X++){const K=6*X;B.uint16[K+0]=4*X+0,B.uint16[K+1]=4*X+1,B.uint16[K+2]=4*X+2,B.uint16[K+3]=4*X+2,B.uint16[K+4]=4*X+3,B.uint16[K+5]=4*X+0}return B})(b));const V=c.createIndexBuffer(Kr,!0),U=c.createVertexBuffer(E,p.aS.members,!0);for(const $ of y){const Z=Gr($.transform,$.invTransform,h.transform);C.draw(c,m.TRIANGLES,Ze.disabled,ht.disabled,h.colorModeForRenderPass(),at.disabled,Z,h.style.map.terrain&&h.style.map.terrain.getTerrainData($.coord),s.id,U,V,p.a0.simpleSegment(0,2*$.circleOffset,$.circleArray.length,$.circleArray.length/2),null,h.transform.zoom,null,null,null)}U.destroy(),V.destroy()}at.disabled=new at(!1,1029,2305),at.backCCW=new at(!0,1029,2305);const an=p.an(new Float32Array(16));function $a(h,e,s,a,o,c){const{horizontalAlign:m,verticalAlign:g}=p.au(h);return new p.P((-(m-.5)*e/o+a[0])*c,(-(g-.5)*s/o+a[1])*c)}function Jr(h,e,s,a,o,c){const m=e.tileAnchorPoint.add(new p.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let g=a.mult(c);s||(g=g.rotate(-o));const y=m.add(g);return N(y.x,y.y,e.labelPlaneMatrix,e.getElevation).point}if(s){const g=se(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(h),y=Math.atan(g.y/g.x)+(g.x<0?Math.PI:0);return h.add(a.rotate(y))}return h.add(a)}function ys(h,e,s,a,o,c,m,g,y,b,T,S,C,E){const R=h.text.placedSymbolArray,V=h.text.dynamicLayoutVertexArray,U=h.icon.dynamicLayoutVertexArray,$={};V.clear();for(let Z=0;Z<R.length;Z++){const B=R.get(Z),X=B.hidden||!B.crossTileID||h.allowVerticalPlacement&&!B.placedOrientation?null:a[B.crossTileID];if(X){const K=new p.P(B.anchorX,B.anchorY),ee={getElevation:E,width:o.width,height:o.height,labelPlaneMatrix:c,lineVertexArray:null,pitchWithMap:s,projection:T,projectionCache:null,tileAnchorPoint:K,translation:S,unwrappedTileID:C},oe=s?N(K.x,K.y,m,E):se(K.x,K.y,ee),he=A(o.cameraToCenterDistance,oe.signedDistanceFromCamera);let xe=p.ai(h.textSizeData,y,B)*he/p.ap;s&&(xe*=h.tilePixelRatio/g);const{width:Te,height:fe,anchor:pe,textOffset:Me,textBoxScale:Ve}=X,ge=$a(pe,Te,fe,Me,Ve,xe),be=T.getPitchedTextCorrection(o,K.add(new p.P(S[0],S[1])),C),Fe=Jr(oe.point,ee,e,ge,o.angle,be),pt=h.allowVerticalPlacement&&B.placedOrientation===p.ah.vertical?Math.PI/2:0;for(let Ue=0;Ue<B.numGlyphs;Ue++)p.aj(V,Fe,pt);b&&B.associatedIconIndex>=0&&($[B.associatedIconIndex]={shiftedAnchor:Fe,angle:pt})}else De(B.numGlyphs,V)}if(b){U.clear();const Z=h.icon.placedSymbolArray;for(let B=0;B<Z.length;B++){const X=Z.get(B);if(X.hidden)De(X.numGlyphs,U);else{const K=$[B];if(K)for(let ee=0;ee<X.numGlyphs;ee++)p.aj(U,K.shiftedAnchor,K.angle);else De(X.numGlyphs,U)}}h.icon.dynamicLayoutVertexBuffer.updateData(U)}h.text.dynamicLayoutVertexBuffer.updateData(V)}function Ti(h,e,s){return s.iconsInText&&e?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function qa(h,e,s,a,o,c,m,g,y,b,T,S){const C=h.context,E=C.gl,R=h.transform,V=qr(),U=g==="map",$=y==="map",Z=g!=="viewport"&&s.layout.get("symbol-placement")!=="point",B=U&&!$&&!Z,X=!$&&Z,K=!s.layout.get("symbol-sort-key").isConstant();let ee=!1;const oe=h.depthModeForSublayer(0,Ze.ReadOnly),he=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),xe=[],Te=V.getCircleRadiusCorrection(R);for(const fe of a){const pe=e.getTile(fe),Me=pe.getBucket(s);if(!Me)continue;const Ve=o?Me.text:Me.icon;if(!Ve||!Ve.segments.get().length||!Ve.hasVisibleVertices)continue;const ge=Ve.programConfigurations.get(s.id),be=o||Me.sdfIcons,Fe=o?Me.textSizeData:Me.iconSizeData,pt=$||R.pitch!==0,Ue=h.useProgram(Ti(be,o,Me),ge),He=p.ag(Fe,R.zoom),ft=h.style.map.terrain&&h.style.map.terrain.getTerrainData(fe);let Vt,ji,mt,si,Kt=[0,0],Nt=null;if(o)ji=pe.glyphAtlasTexture,mt=E.LINEAR,Vt=pe.glyphAtlasTexture.size,Me.iconsInText&&(Kt=pe.imageAtlasTexture.size,Nt=pe.imageAtlasTexture,si=pt||h.options.rotating||h.options.zooming||Fe.kind==="composite"||Fe.kind==="camera"?E.LINEAR:E.NEAREST);else{const We=s.layout.get("icon-size").constantOr(0)!==1||Me.iconsNeedLinear;ji=pe.imageAtlasTexture,mt=be||h.options.rotating||h.options.zooming||We||pt?E.LINEAR:E.NEAREST,Vt=pe.imageAtlasTexture.size}const Jt=Ge(pe,1,h.transform.zoom),or=X?fe.posMatrix:an,Ls=Mr(or,$,U,h.transform,Jt),aa=rr(or,$,U,h.transform,Jt),Rs=rr(fe.posMatrix,$,U,h.transform,Jt),Pi=V.translatePosition(h.transform,pe,c,m),oa=he&&Me.hasTextData(),_o=s.layout.get("icon-text-fit")!=="none"&&oa&&Me.hasIconData();if(Z){const We=h.style.map.terrain?(Bs,Fs)=>h.style.map.terrain.getElevation(fe,Bs,Fs):null,is=s.layout.get("text-rotation-alignment")==="map";D(Me,fe.posMatrix,h,o,Ls,Rs,$,b,is,V,fe.toUnwrapped(),R.width,R.height,Pi,We)}const Ai=fe.posMatrix,Mi=o&&he||_o,zr=Z||Mi?an:Ls,Ui=aa,Rt=be&&s.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let jt;jt=be?Me.iconsInText?Ea(Fe.kind,He,B,$,Z,Mi,h,Ai,zr,Ui,Pi,Vt,Kt,Te):rn(Fe.kind,He,B,$,Z,Mi,h,Ai,zr,Ui,Pi,o,Vt,!0,Te):jo(Fe.kind,He,B,$,Z,Mi,h,Ai,zr,Ui,Pi,o,Vt,Te);const gi={program:Ue,buffers:Ve,uniformValues:jt,atlasTexture:ji,atlasTextureIcon:Nt,atlasInterpolation:mt,atlasInterpolationIcon:si,isSDF:be,hasHalo:Rt};if(K&&Me.canOverlap){ee=!0;const We=Ve.segments.get();for(const is of We)xe.push({segments:new p.a0([is]),sortKey:is.sortKey,state:gi,terrainData:ft})}else xe.push({segments:Ve.segments,sortKey:0,state:gi,terrainData:ft})}ee&&xe.sort(((fe,pe)=>fe.sortKey-pe.sortKey));for(const fe of xe){const pe=fe.state;if(C.activeTexture.set(E.TEXTURE0),pe.atlasTexture.bind(pe.atlasInterpolation,E.CLAMP_TO_EDGE),pe.atlasTextureIcon&&(C.activeTexture.set(E.TEXTURE1),pe.atlasTextureIcon&&pe.atlasTextureIcon.bind(pe.atlasInterpolationIcon,E.CLAMP_TO_EDGE)),pe.isSDF){const Me=pe.uniformValues;pe.hasHalo&&(Me.u_is_halo=1,Za(pe.buffers,fe.segments,s,h,pe.program,oe,T,S,Me,fe.terrainData)),Me.u_is_halo=0}Za(pe.buffers,fe.segments,s,h,pe.program,oe,T,S,pe.uniformValues,fe.terrainData)}}function Za(h,e,s,a,o,c,m,g,y,b){const T=a.context;o.draw(T,T.gl.TRIANGLES,c,m,g,at.disabled,y,b,s.id,h.layoutVertexBuffer,h.indexBuffer,e,s.paint,a.transform.zoom,h.programConfigurations.get(s.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function Ga(h,e,s,a){const o=h.context,c=o.gl,m=ht.disabled,g=new bt([c.ONE,c.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(s);if(!y)return;const b=a.key;let T=s.heatmapFbos.get(b);T||(T=on(o,e.tileSize,e.tileSize),s.heatmapFbos.set(b,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:p.aM.transparent});const S=y.programConfigurations.get(s.id),C=h.useProgram("heatmap",S),E=h.style.map.terrain.getTerrainData(a);C.draw(o,c.TRIANGLES,Ze.disabled,m,g,at.disabled,ri(a.posMatrix,e,h.transform.zoom,s.paint.get("heatmap-intensity")),E,s.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,s.paint,h.transform.zoom,S)}function Yr(h,e,s){const a=h.context,o=a.gl;a.setColorMode(h.colorModeForRenderPass());const c=ln(a,e),m=s.key,g=e.heatmapFbos.get(m);g&&(a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,g.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(a,o.TRIANGLES,Ze.disabled,ht.disabled,h.colorModeForRenderPass(),at.disabled,Dn(h,e,0,1),null,e.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments,e.paint,h.transform.zoom),g.destroy(),e.heatmapFbos.delete(m))}function on(h,e,s){var a,o;const c=h.gl,m=c.createTexture();c.bindTexture(c.TEXTURE_2D,m),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);const g=(a=h.HALF_FLOAT)!==null&&a!==void 0?a:c.UNSIGNED_BYTE,y=(o=h.RGBA16F)!==null&&o!==void 0?o:c.RGBA;c.texImage2D(c.TEXTURE_2D,0,y,e,s,0,c.RGBA,g,null);const b=h.createFramebuffer(e,s,!1,!1);return b.colorAttachment.set(m),b}function ln(h,e){return e.colorRampTexture||(e.colorRampTexture=new nt(h,e.colorRamp,h.gl.RGBA)),e.colorRampTexture}function xs(h,e,s,a,o){if(!s||!a||!a.imageAtlas)return;const c=a.imageAtlas.patternPositions;let m=c[s.to.toString()],g=c[s.from.toString()];if(!m&&g&&(m=g),!g&&m&&(g=m),!m||!g){const y=o.getPaintProperty(e);m=c[y],g=c[y]}m&&g&&h.setConstantPatternPositions(m,g)}function cn(h,e,s,a,o,c,m){const g=h.context.gl,y="fill-pattern",b=s.paint.get(y),T=b&&b.constantOr(1),S=s.getCrossfadeParameters();let C,E,R,V,U;m?(E=T&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",C=g.LINES):(E=T?"fillPattern":"fill",C=g.TRIANGLES);const $=b.constantOr(null);for(const Z of a){const B=e.getTile(Z);if(T&&!B.patternsLoaded())continue;const X=B.getBucket(s);if(!X)continue;const K=X.programConfigurations.get(s.id),ee=h.useProgram(E,K),oe=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Z);T&&(h.context.activeTexture.set(g.TEXTURE0),B.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),K.updatePaintBuffers(S)),xs(K,y,$,B,s);const he=oe?Z:null,xe=h.translatePosMatrix(he?he.posMatrix:Z.posMatrix,B,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(m){V=X.indexBuffer2,U=X.segments2;const Te=[g.drawingBufferWidth,g.drawingBufferHeight];R=E==="fillOutlinePattern"&&T?Fo(xe,h,S,B,Te):jl(xe,Te)}else V=X.indexBuffer,U=X.segments,R=T?Bo(xe,h,S,B):ms(xe);ee.draw(h.context,C,o,h.stencilModeForClipping(Z),c,at.disabled,R,oe,s.id,X.layoutVertexBuffer,V,U,s.paint,h.transform.zoom,K)}}function Un(h,e,s,a,o,c,m){const g=h.context,y=g.gl,b="fill-extrusion-pattern",T=s.paint.get(b),S=T.constantOr(1),C=s.getCrossfadeParameters(),E=s.paint.get("fill-extrusion-opacity"),R=T.constantOr(null);for(const V of a){const U=e.getTile(V),$=U.getBucket(s);if(!$)continue;const Z=h.style.map.terrain&&h.style.map.terrain.getTerrainData(V),B=$.programConfigurations.get(s.id),X=h.useProgram(S?"fillExtrusionPattern":"fillExtrusion",B);S&&(h.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),B.updatePaintBuffers(C)),xs(B,b,R,U,s);const K=h.translatePosMatrix(V.posMatrix,U,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),ee=s.paint.get("fill-extrusion-vertical-gradient"),oe=S?En(K,h,ee,E,V,C,U):en(K,h,ee,E);X.draw(g,g.gl.TRIANGLES,o,c,m,at.backCCW,oe,Z,s.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,s.paint,h.transform.zoom,B,h.style.map.terrain&&$.centroidVertexBuffer)}}function vs(h,e,s,a,o,c,m){const g=h.context,y=g.gl,b=s.fbo;if(!b)return;const T=h.useProgram("hillshade"),S=h.style.map.terrain&&h.style.map.terrain.getTerrainData(e);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),T.draw(g,y.TRIANGLES,o,c,m,at.disabled,((C,E,R,V)=>{const U=R.paint.get("hillshade-shadow-color"),$=R.paint.get("hillshade-highlight-color"),Z=R.paint.get("hillshade-accent-color");let B=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(B-=C.transform.angle);const X=!C.options.moving;return{u_matrix:V?V.posMatrix:C.transform.calculatePosMatrix(E.tileID.toUnwrapped(),X),u_image:0,u_latrange:Ln(0,E.tileID),u_light:[R.paint.get("hillshade-exaggeration"),B],u_shadow:U,u_highlight:$,u_accent:Z}})(h,s,a,S?e:null),S,a.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function bs(h,e,s,a,o,c){const m=h.context,g=m.gl,y=e.dem;if(y&&y.data){const b=y.dim,T=y.stride,S=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||h.getTileTexture(T),e.demTexture){const E=e.demTexture;E.update(S,{premultiply:!1}),E.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else e.demTexture=new nt(m,S,g.RGBA,{premultiply:!1}),e.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let C=e.fbo;if(!C){const E=new nt(m,{width:b,height:b,data:null},g.RGBA);E.bind(g.LINEAR,g.CLAMP_TO_EDGE),C=e.fbo=m.createFramebuffer(b,b,!0,!1),C.colorAttachment.set(E.texture)}m.bindFramebuffer.set(C.framebuffer),m.viewport.set([0,0,b,b]),h.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,a,o,c,at.disabled,((E,R)=>{const V=R.stride,U=p.H();return p.aP(U,0,p.X,-p.X,0,0,1),p.J(U,U,[0,-p.X,0]),{u_matrix:U,u_image:1,u_dimension:[V,V],u_zoom:E.overscaledZ,u_unpack:R.getUnpackVector()}})(e.tileID,y),null,s.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function el(h,e,s,a,o,c){const m=a.paint.get("raster-fade-duration");if(!c&&m>0){const g=me.now(),y=(g-h.timeAdded)/m,b=e?(g-e.timeAdded)/m:-1,T=s.getSource(),S=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),C=!e||Math.abs(e.tileID.overscaledZ-S)>Math.abs(h.tileID.overscaledZ-S),E=C&&h.refreshedUponExpiration?1:p.ac(C?y:1-b,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),e?{opacity:1,mix:1-E}:{opacity:E,mix:0}}return{opacity:1,mix:0}}const Ha=new p.aM(1,0,0,1),Ye=new p.aM(0,1,0,1),$n=new p.aM(0,0,1,1),ic=new p.aM(1,0,1,1),tl=new p.aM(0,1,1,1);function ws(h,e,s,a){qn(h,0,e+s/2,h.transform.width,s,a)}function il(h,e,s,a){qn(h,e-s/2,0,s,h.transform.height,a)}function qn(h,e,s,a,o,c){const m=h.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(e*h.pixelRatio,s*h.pixelRatio,a*h.pixelRatio,o*h.pixelRatio),m.clear({color:c}),g.disable(g.SCISSOR_TEST)}function rl(h,e,s){const a=h.context,o=a.gl,c=s.posMatrix,m=h.useProgram("debug"),g=Ze.disabled,y=ht.disabled,b=h.colorModeForRenderPass(),T="$debug",S=h.style.map.terrain&&h.style.map.terrain.getTerrainData(s);a.activeTexture.set(o.TEXTURE0);const C=e.getTileByID(s.key).latestRawTileData,E=Math.floor((C&&C.byteLength||0)/1024),R=e.getTile(s).tileSize,V=512/Math.min(R,512)*(s.overscaledZ/h.transform.zoom)*.5;let U=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(U+=` => ${s.overscaledZ}`),(function($,Z){$.initDebugOverlayCanvas();const B=$.debugOverlayCanvas,X=$.context.gl,K=$.debugOverlayCanvas.getContext("2d");K.clearRect(0,0,B.width,B.height),K.shadowColor="white",K.shadowBlur=2,K.lineWidth=1.5,K.strokeStyle="white",K.textBaseline="top",K.font="bold 36px Open Sans, sans-serif",K.fillText(Z,5,5),K.strokeText(Z,5,5),$.debugOverlayTexture.update(B),$.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)})(h,`${U} ${E}kB`),m.draw(a,o.TRIANGLES,g,y,bt.alphaBlended,at.disabled,tn(c,p.aM.transparent,V),null,T,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(a,o.LINE_STRIP,g,y,b,at.disabled,tn(c,p.aM.red),S,T,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function sl(h,e,s){const a=h.context,o=a.gl,c=h.colorModeForRenderPass(),m=new Ze(o.LEQUAL,Ze.ReadWrite,h.depthRangeFor3D),g=h.useProgram("terrain"),y=e.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,h.width,h.height]);for(const b of s){const T=h.renderToTexture.getTexture(b),S=e.getTerrainData(b.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);const C=h.transform.calculatePosMatrix(b.tileID.toUnwrapped()),E=e.getMeshFrameDelta(h.transform.zoom),R=h.transform.calculateFogMatrix(b.tileID.toUnwrapped()),V=ka(C,E,R,h.style.sky,h.transform.pitch);g.draw(a,o.TRIANGLES,m,ht.disabled,c,at.backCCW,V,S,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Zn{constructor(e,s,a){this.vertexBuffer=e,this.indexBuffer=s,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Gn{constructor(e,s){this.context=new tc(e),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Be.maxUnderzooming+Be.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ma}resize(e,s,a){if(this.width=Math.floor(e*a),this.height=Math.floor(s*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const e=this.context,s=new p.aX;s.emplaceBack(0,0),s.emplaceBack(p.X,0),s.emplaceBack(0,p.X),s.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(s,Zr.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);const a=new p.aX;a.emplaceBack(0,0),a.emplaceBack(p.X,0),a.emplaceBack(0,p.X),a.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(a,Zr.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);const o=new p.$;o.emplaceBack(0,0,0,0),o.emplaceBack(p.X,0,p.X,0),o.emplaceBack(0,p.X,0,p.X),o.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,Pr.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);const c=new p.aX;c.emplaceBack(0,0),c.emplaceBack(1,0),c.emplaceBack(0,1),c.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(c,Zr.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);const m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);const g=new p.aY;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(g);const y=this.context.gl;this.stencilClearMode=new ht({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const e=this.context,s=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=p.H();p.aP(a,0,this.width,this.height,0,0,1),p.K(a,a,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,s.TRIANGLES,Ze.disabled,this.stencilClearMode,bt.disabled,at.disabled,ii(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!s||!s.length)return;this.currentStencilSource=e.source;const a=this.context,o=a.gl;this.nextStencilID+s.length>256&&this.clearStencil(),a.setColorMode(bt.disabled),a.setDepthMode(Ze.disabled);const c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of s){const g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);c.draw(a,o.TRIANGLES,Ze.disabled,new ht({func:o.ALWAYS,mask:0},g,255,o.KEEP,o.KEEP,o.REPLACE),bt.disabled,at.disabled,ii(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,s=this.context.gl;return new ht({func:s.NOTEQUAL,mask:255},e,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(e){const s=this.context.gl;return new ht({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(e){const s=this.context.gl,a=e.sort(((m,g)=>g.overscaledZ-m.overscaledZ)),o=a[a.length-1].overscaledZ,c=a[0].overscaledZ-o+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();const m={};for(let g=0;g<c;g++)m[g+o]=new ht({func:s.GEQUAL,mask:255},g+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=c,[m,a]}return[{[o]:ht.disabled},a]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new bt([e.CONSTANT_COLOR,e.ONE],new p.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?bt.unblended:bt.alphaBlended}depthModeForSublayer(e,s,a){if(!this.opaquePassEnabledForLayer())return Ze.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Ze(a||this.context.gl.LEQUAL,s,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,s){this.style=e,this.options=s,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(me.now()),this.imageManager.beginFrame();const a=this.style._order,o=this.style.sourceCaches,c={},m={},g={};for(const y in o){const b=o[y];b.used&&b.prepare(this.context),c[y]=b.getVisibleCoordinates(),m[y]=c[y].slice().reverse(),g[y]=b.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<a.length;y++)if(this.style._layers[a[y]].is3D()){this.opaquePassCutoff=y;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const y of a){const b=this.style._layers[y];if(!b.hasOffscreenPass()||b.isHidden(this.transform.zoom))continue;const T=m[b.source];(b.type==="custom"||T.length)&&this.renderLayer(this,o[b.source],b,T)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?p.aM.black:p.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(y,b){const T=y.context,S=T.gl,C=(($,Z,B)=>({u_sky_color:$.properties.get("sky-color"),u_horizon_color:$.properties.get("horizon-color"),u_horizon:(Z.height/2+Z.getHorizon())*B,u_sky_horizon_blend:$.properties.get("sky-horizon-blend")*Z.height/2*B}))(b,y.style.map.transform,y.pixelRatio),E=new Ze(S.LEQUAL,Ze.ReadWrite,[0,1]),R=ht.disabled,V=y.colorModeForRenderPass(),U=y.useProgram("sky");if(!b.mesh){const $=new p.aX;$.emplaceBack(-1,-1),$.emplaceBack(1,-1),$.emplaceBack(1,1),$.emplaceBack(-1,1);const Z=new p.aY;Z.emplaceBack(0,1,2),Z.emplaceBack(0,2,3),b.mesh=new Zn(T.createVertexBuffer($,Zr.members),T.createIndexBuffer(Z),p.a0.simpleSegment(0,0,$.length,Z.length))}U.draw(T,S.TRIANGLES,E,R,V,at.disabled,C,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)})(this,this.style.sky),this._showOverdrawInspector=s.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],b=o[y.source],T=c[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,b,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const y=this.style._layers[a[this.currentLayer]],b=o[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const T=(y.type==="symbol"?g:m)[y.source];this._renderTileClippingMasks(y,c[y.source]),this.renderLayer(this,b,y,T)}if(this.options.showTileBoundaries){const y=(function(b,T){let S=null;const C=Object.values(b._layers).flatMap((U=>U.source&&!U.isHidden(T)?[b.sourceCaches[U.source]]:[])),E=C.filter((U=>U.getSource().type==="vector")),R=C.filter((U=>U.getSource().type!=="vector")),V=U=>{(!S||S.getSource().maxzoom<U.getSource().maxzoom)&&(S=U)};return E.forEach((U=>V(U))),S||R.forEach((U=>V(U))),S})(this.style,this.transform.zoom);y&&(function(b,T,S){for(let C=0;C<S.length;C++)rl(b,T,S[C])})(this,y,y.getVisibleCoordinates())}this.options.showPadding&&(function(y){const b=y.transform.padding;ws(y,y.transform.height-(b.top||0),3,Ha),ws(y,b.bottom||0,3,Ye),il(y,b.left||0,3,$n),il(y,y.transform.width-(b.right||0),3,ic);const T=y.transform.centerPoint;(function(S,C,E,R){qn(S,C-1,E-10,2,20,R),qn(S,C-10,E-1,20,2,R)})(y,T.x,y.transform.height-T.y,tl)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const s=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix;let o=this.terrainFacilitator.dirty;o||(o=e?!p.a_(s,a):!p.a$(s,a)),o||(o=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),o&&(p.b0(s,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(c,m){const g=c.context,y=g.gl,b=bt.unblended,T=new Ze(y.LEQUAL,Ze.ReadWrite,[0,1]),S=m.getTerrainMesh(),C=m.sourceCache.getRenderableTiles(),E=c.useProgram("terrainDepth");g.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),g.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),g.clear({color:p.aM.transparent,depth:1});for(const R of C){const V=m.getTerrainData(R.tileID),U={u_matrix:c.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};E.draw(g,y.TRIANGLES,T,ht.disabled,b,at.backCCW,U,V,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}g.bindFramebuffer.set(null),g.viewport.set([0,0,c.width,c.height])})(this,this.style.map.terrain),(function(c,m){const g=c.context,y=g.gl,b=bt.unblended,T=new Ze(y.LEQUAL,Ze.ReadWrite,[0,1]),S=m.getTerrainMesh(),C=m.getCoordsTexture(),E=m.sourceCache.getRenderableTiles(),R=c.useProgram("terrainCoords");g.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),g.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),g.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(const V of E){const U=m.getTerrainData(V.tileID);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,C.texture);const $={u_matrix:c.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};R.draw(g,y.TRIANGLES,T,ht.disabled,b,at.backCCW,$,U,"terrain",S.vertexBuffer,S.indexBuffer,S.segments),m.coordsIndex.push(V.tileID.key)}g.bindFramebuffer.set(null),g.viewport.set([0,0,c.width,c.height])})(this,this.style.map.terrain))}renderLayer(e,s,a,o){if(!a.isHidden(this.transform.zoom)&&(a.type==="background"||a.type==="custom"||(o||[]).length))switch(this.id=a.id,a.type){case"symbol":(function(c,m,g,y,b){if(c.renderPass!=="translucent")return;const T=ht.disabled,S=c.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(C,E,R,V,U,$,Z,B,X){const K=E.transform,ee=qr(),oe=U==="map",he=$==="map";for(const xe of C){const Te=V.getTile(xe),fe=Te.getBucket(R);if(!fe||!fe.text||!fe.text.segments.get().length)continue;const pe=p.ag(fe.textSizeData,K.zoom),Me=Ge(Te,1,E.transform.zoom),Ve=Mr(xe.posMatrix,he,oe,E.transform,Me),ge=R.layout.get("icon-text-fit")!=="none"&&fe.hasIconData();if(pe){const be=Math.pow(2,K.zoom-Te.tileID.overscaledZ),Fe=E.style.map.terrain?(Ue,He)=>E.style.map.terrain.getElevation(xe,Ue,He):null,pt=ee.translatePosition(K,Te,Z,B);ys(fe,oe,he,X,K,Ve,xe.posMatrix,be,pe,ge,ee,pt,xe.toUnwrapped(),Fe)}}})(y,c,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),b),g.paint.get("icon-opacity").constantOr(1)!==0&&qa(c,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),T,S),g.paint.get("text-opacity").constantOr(1)!==0&&qa(c,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),T,S),m.map.showCollisionBoxes&&(nn(c,m,g,y,!0),nn(c,m,g,y,!1))})(e,s,a,o,this.style.placement.variableOffsets);break;case"circle":(function(c,m,g,y){if(c.renderPass!=="translucent")return;const b=g.paint.get("circle-opacity"),T=g.paint.get("circle-stroke-width"),S=g.paint.get("circle-stroke-opacity"),C=!g.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(T.constantOr(1)===0||S.constantOr(1)===0))return;const E=c.context,R=E.gl,V=c.depthModeForSublayer(0,Ze.ReadOnly),U=ht.disabled,$=c.colorModeForRenderPass(),Z=[];for(let B=0;B<y.length;B++){const X=y[B],K=m.getTile(X),ee=K.getBucket(g);if(!ee)continue;const oe=ee.programConfigurations.get(g.id),he=c.useProgram("circle",oe),xe=ee.layoutVertexBuffer,Te=ee.indexBuffer,fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(X),pe={programConfiguration:oe,program:he,layoutVertexBuffer:xe,indexBuffer:Te,uniformValues:Ul(c,X,K,g),terrainData:fe};if(C){const Me=ee.segments.get();for(const Ve of Me)Z.push({segments:new p.a0([Ve]),sortKey:Ve.sortKey,state:pe})}else Z.push({segments:ee.segments,sortKey:0,state:pe})}C&&Z.sort(((B,X)=>B.sortKey-X.sortKey));for(const B of Z){const{programConfiguration:X,program:K,layoutVertexBuffer:ee,indexBuffer:oe,uniformValues:he,terrainData:xe}=B.state;K.draw(E,R.TRIANGLES,V,U,$,at.disabled,he,xe,g.id,ee,oe,B.segments,g.paint,c.transform.zoom,X)}})(e,s,a,o);break;case"heatmap":(function(c,m,g,y){if(g.paint.get("heatmap-opacity")===0)return;const b=c.context;if(c.style.map.terrain){for(const T of y){const S=m.getTile(T);m.hasRenderableParent(T)||(c.renderPass==="offscreen"?Ga(c,S,g,T):c.renderPass==="translucent"&&Yr(c,g,T))}b.viewport.set([0,0,c.width,c.height])}else c.renderPass==="offscreen"?(function(T,S,C,E){const R=T.context,V=R.gl,U=ht.disabled,$=new bt([V.ONE,V.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(Z,B,X){const K=Z.gl;Z.activeTexture.set(K.TEXTURE1),Z.viewport.set([0,0,B.width/4,B.height/4]);let ee=X.heatmapFbos.get(p.aU);ee?(K.bindTexture(K.TEXTURE_2D,ee.colorAttachment.get()),Z.bindFramebuffer.set(ee.framebuffer)):(ee=on(Z,B.width/4,B.height/4),X.heatmapFbos.set(p.aU,ee))})(R,T,C),R.clear({color:p.aM.transparent});for(let Z=0;Z<E.length;Z++){const B=E[Z];if(S.hasRenderableParent(B))continue;const X=S.getTile(B),K=X.getBucket(C);if(!K)continue;const ee=K.programConfigurations.get(C.id),oe=T.useProgram("heatmap",ee),{zoom:he}=T.transform;oe.draw(R,V.TRIANGLES,Ze.disabled,U,$,at.disabled,ri(B.posMatrix,X,he,C.paint.get("heatmap-intensity")),null,C.id,K.layoutVertexBuffer,K.indexBuffer,K.segments,C.paint,T.transform.zoom,ee)}R.viewport.set([0,0,T.width,T.height])})(c,m,g,y):c.renderPass==="translucent"&&(function(T,S){const C=T.context,E=C.gl;C.setColorMode(T.colorModeForRenderPass());const R=S.heatmapFbos.get(p.aU);R&&(C.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,R.colorAttachment.get()),C.activeTexture.set(E.TEXTURE1),ln(C,S).bind(E.LINEAR,E.CLAMP_TO_EDGE),T.useProgram("heatmapTexture").draw(C,E.TRIANGLES,Ze.disabled,ht.disabled,T.colorModeForRenderPass(),at.disabled,Dn(T,S,0,1),null,S.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,S.paint,T.transform.zoom))})(c,g)})(e,s,a,o);break;case"line":(function(c,m,g,y){if(c.renderPass!=="translucent")return;const b=g.paint.get("line-opacity"),T=g.paint.get("line-width");if(b.constantOr(1)===0||T.constantOr(1)===0)return;const S=c.depthModeForSublayer(0,Ze.ReadOnly),C=c.colorModeForRenderPass(),E=g.paint.get("line-dasharray"),R=g.paint.get("line-pattern"),V=R.constantOr(1),U=g.paint.get("line-gradient"),$=g.getCrossfadeParameters(),Z=V?"linePattern":E?"lineSDF":U?"lineGradient":"line",B=c.context,X=B.gl;let K=!0;for(const ee of y){const oe=m.getTile(ee);if(V&&!oe.patternsLoaded())continue;const he=oe.getBucket(g);if(!he)continue;const xe=he.programConfigurations.get(g.id),Te=c.context.program.get(),fe=c.useProgram(Z,xe),pe=K||fe.program!==Te,Me=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ee),Ve=R.constantOr(null);if(Ve&&oe.imageAtlas){const Fe=oe.imageAtlas,pt=Fe.patternPositions[Ve.to.toString()],Ue=Fe.patternPositions[Ve.from.toString()];pt&&Ue&&xe.setConstantPatternPositions(pt,Ue)}const ge=Me?ee:null,be=V?_s(c,oe,g,$,ge):E?$l(c,oe,g,E,$,ge):U?Oo(c,oe,g,he.lineClipsArray.length,ge):Rn(c,oe,g,ge);if(V)B.activeTexture.set(X.TEXTURE0),oe.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),xe.updatePaintBuffers($);else if(E&&(pe||c.lineAtlas.dirty))B.activeTexture.set(X.TEXTURE0),c.lineAtlas.bind(B);else if(U){const Fe=he.gradients[g.id];let pt=Fe.texture;if(g.gradientVersion!==Fe.version){let Ue=256;if(g.stepInterpolant){const He=m.getSource().maxzoom,ft=ee.canonical.z===He?Math.ceil(1<<c.transform.maxZoom-ee.canonical.z):1;Ue=p.ac(p.aV(he.maxLineLength/p.X*1024*ft),256,B.maxTextureSize)}Fe.gradient=p.aW({expression:g.gradientExpression(),evaluationKey:"lineProgress",resolution:Ue,image:Fe.gradient||void 0,clips:he.lineClipsArray}),Fe.texture?Fe.texture.update(Fe.gradient):Fe.texture=new nt(B,Fe.gradient,X.RGBA),Fe.version=g.gradientVersion,pt=Fe.texture}B.activeTexture.set(X.TEXTURE0),pt.bind(g.stepInterpolant?X.NEAREST:X.LINEAR,X.CLAMP_TO_EDGE)}fe.draw(B,X.TRIANGLES,S,c.stencilModeForClipping(ee),C,at.disabled,be,Me,g.id,he.layoutVertexBuffer,he.indexBuffer,he.segments,g.paint,c.transform.zoom,xe,he.layoutVertexBuffer2),K=!1}})(e,s,a,o);break;case"fill":(function(c,m,g,y){const b=g.paint.get("fill-color"),T=g.paint.get("fill-opacity");if(T.constantOr(1)===0)return;const S=c.colorModeForRenderPass(),C=g.paint.get("fill-pattern"),E=c.opaquePassEnabledForLayer()&&!C.constantOr(1)&&b.constantOr(p.aM.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===E){const R=c.depthModeForSublayer(1,c.renderPass==="opaque"?Ze.ReadWrite:Ze.ReadOnly);cn(c,m,g,y,R,S,!1)}if(c.renderPass==="translucent"&&g.paint.get("fill-antialias")){const R=c.depthModeForSublayer(g.getPaintProperty("fill-outline-color")?2:0,Ze.ReadOnly);cn(c,m,g,y,R,S,!0)}})(e,s,a,o);break;case"fill-extrusion":(function(c,m,g,y){const b=g.paint.get("fill-extrusion-opacity");if(b!==0&&c.renderPass==="translucent"){const T=new Ze(c.context.gl.LEQUAL,Ze.ReadWrite,c.depthRangeFor3D);if(b!==1||g.paint.get("fill-extrusion-pattern").constantOr(1))Un(c,m,g,y,T,ht.disabled,bt.disabled),Un(c,m,g,y,T,c.stencilModeFor3D(),c.colorModeForRenderPass());else{const S=c.colorModeForRenderPass();Un(c,m,g,y,T,ht.disabled,S)}}})(e,s,a,o);break;case"hillshade":(function(c,m,g,y){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent")return;const b=c.context,T=c.depthModeForSublayer(0,Ze.ReadOnly),S=c.colorModeForRenderPass(),[C,E]=c.renderPass==="translucent"?c.stencilConfigForOverlap(y):[{},y];for(const R of E){const V=m.getTile(R);V.needsHillshadePrepare!==void 0&&V.needsHillshadePrepare&&c.renderPass==="offscreen"?bs(c,V,g,T,ht.disabled,S):c.renderPass==="translucent"&&vs(c,R,V,g,T,C[R.overscaledZ],S)}b.viewport.set([0,0,c.width,c.height])})(e,s,a,o);break;case"raster":(function(c,m,g,y){if(c.renderPass!=="translucent"||g.paint.get("raster-opacity")===0||!y.length)return;const b=c.context,T=b.gl,S=m.getSource(),C=c.useProgram("raster"),E=c.colorModeForRenderPass(),[R,V]=S instanceof fr?[{},y]:c.stencilConfigForOverlap(y),U=V[V.length-1].overscaledZ,$=!c.options.moving;for(const Z of V){const B=c.depthModeForSublayer(Z.overscaledZ-U,g.paint.get("raster-opacity")===1?Ze.ReadWrite:Ze.ReadOnly,T.LESS),X=m.getTile(Z);X.registerFadeDuration(g.paint.get("raster-fade-duration"));const K=m.findLoadedParent(Z,0),ee=m.findLoadedSibling(Z),oe=el(X,K||ee||null,m,g,c.transform,c.style.map.terrain);let he,xe;const Te=g.paint.get("raster-resampling")==="nearest"?T.NEAREST:T.LINEAR;b.activeTexture.set(T.TEXTURE0),X.texture.bind(Te,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(T.TEXTURE1),K?(K.texture.bind(Te,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),he=Math.pow(2,K.tileID.overscaledZ-X.tileID.overscaledZ),xe=[X.tileID.canonical.x*he%1,X.tileID.canonical.y*he%1]):X.texture.bind(Te,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),X.texture.useMipmap&&b.extTextureFilterAnisotropic&&c.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);const fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(Z),pe=fe?Z:null,Me=pe?pe.posMatrix:c.transform.calculatePosMatrix(Z.toUnwrapped(),$),Ve=ql(Me,xe||[0,0],he||1,oe,g);S instanceof fr?C.draw(b,T.TRIANGLES,B,ht.disabled,E,at.disabled,Ve,fe,g.id,S.boundsBuffer,c.quadTriangleIndexBuffer,S.boundsSegments):C.draw(b,T.TRIANGLES,B,R[Z.overscaledZ],E,at.disabled,Ve,fe,g.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}})(e,s,a,o);break;case"background":(function(c,m,g,y){const b=g.paint.get("background-color"),T=g.paint.get("background-opacity");if(T===0)return;const S=c.context,C=S.gl,E=c.transform,R=E.tileSize,V=g.paint.get("background-pattern");if(c.isPatternMissing(V))return;const U=!V&&b.a===1&&T===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==U)return;const $=ht.disabled,Z=c.depthModeForSublayer(0,U==="opaque"?Ze.ReadWrite:Ze.ReadOnly),B=c.colorModeForRenderPass(),X=c.useProgram(V?"backgroundPattern":"background"),K=y||E.coveringTiles({tileSize:R,terrain:c.style.map.terrain});V&&(S.activeTexture.set(C.TEXTURE0),c.imageManager.bind(c.context));const ee=g.getCrossfadeParameters();for(const oe of K){const he=y?oe.posMatrix:c.transform.calculatePosMatrix(oe.toUnwrapped()),xe=V?Da(he,T,c,V,{tileID:oe,tileSize:R},ee):Bn(he,T,b),Te=c.style.map.terrain&&c.style.map.terrain.getTerrainData(oe);X.draw(S,C.TRIANGLES,Z,$,B,at.disabled,xe,Te,g.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}})(e,0,a,o);break;case"custom":(function(c,m,g){const y=c.context,b=g.implementation;if(c.renderPass==="offscreen"){const T=b.prerender;T&&(c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),T.call(b,y.gl,c.transform.customLayerMatrix()),y.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),y.setStencilMode(ht.disabled);const T=b.renderingMode==="3d"?new Ze(c.context.gl.LEQUAL,Ze.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,Ze.ReadOnly);y.setDepthMode(T),b.render(y.gl,c.transform.customLayerMatrix(),{farZ:c.transform.farZ,nearZ:c.transform.nearZ,fov:c.transform._fov,modelViewProjectionMatrix:c.transform.modelViewProjectionMatrix,projectionMatrix:c.transform.projectionMatrix}),y.setDirty(),c.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,a)}}translatePosMatrix(e,s,a,o,c){if(!a[0]&&!a[1])return e;const m=c?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),T=Math.cos(m);a=[a[0]*T-a[1]*b,a[0]*b+a[1]*T]}const g=[c?a[0]:Ge(s,a[0],this.transform.zoom),c?a[1]:Ge(s,a[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,g),y}saveTileTexture(e){const s=this._tileTextures[e.size[0]];s?s.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const s=this._tileTextures[e];return s&&s.length>0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const s=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!s||!a}useProgram(e,s){this.cache=this.cache||{};const a=e+(s?s.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new za(this.context,Cr[e],s,La[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new nt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:s}=this.context.gl;return this.width!==e||this.height!==s}}class Ts{constructor(e,s){this.points=e,this.planes=s}static fromInvProjectionMatrix(e,s,a){const o=Math.pow(2,a),c=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((g=>{const y=1/(g=p.af([],g,e))[3]/s*o;return p.b1(g,g,[y,y,1/g[3],y])})),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((g=>{const y=(function(C,E){var R=E[0],V=E[1],U=E[2],$=R*R+V*V+U*U;return $>0&&($=1/Math.sqrt($)),C[0]=E[0]*$,C[1]=E[1]*$,C[2]=E[2]*$,C})([],(function(C,E,R){var V=E[0],U=E[1],$=E[2],Z=R[0],B=R[1],X=R[2];return C[0]=U*X-$*B,C[1]=$*Z-V*X,C[2]=V*B-U*Z,C})([],vi([],c[g[0]],c[g[1]]),vi([],c[g[2]],c[g[1]]))),b=-((T=y)[0]*(S=c[g[1]])[0]+T[1]*S[1]+T[2]*S[2]);var T,S;return y.concat(b)}));return new Ts(c,m)}}class Ss{constructor(e,s){this.min=e,this.max=s,this.center=(function(a,o,c){return a[0]=.5*o[0],a[1]=.5*o[1],a[2]=.5*o[2],a})([],(function(a,o,c){return a[0]=o[0]+c[0],a[1]=o[1]+c[1],a[2]=o[2]+c[2],a})([],this.min,this.max))}quadrant(e){const s=[e%2==0,e<2],a=Ei(this.min),o=Ei(this.max);for(let c=0;c<s.length;c++)a[c]=s[c]?this.min[c]:this.center[c],o[c]=s[c]?this.center[c]:this.max[c];return o[2]=this.max[2],new Ss(a,o)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){const s=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let a=!0;for(let o=0;o<e.planes.length;o++){const c=e.planes[o];let m=0;for(let g=0;g<s.length;g++)p.b2(c,s[g])>=0&&m++;if(m===0)return 0;m!==s.length&&(a=!1)}if(a)return 2;for(let o=0;o<3;o++){let c=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;g<e.points.length;g++){const y=e.points[g][o]-this.min[o];c=Math.min(c,y),m=Math.max(m,y)}if(m<0||c>this.max[o]-this.min[o])return 0}return 1}}class Is{constructor(e=0,s=0,a=0,o=0){if(isNaN(e)||e<0||isNaN(s)||s<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=s,this.left=a,this.right=o}interpolate(e,s,a){return s.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,s.top,a)),s.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,s.bottom,a)),s.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,s.left,a)),s.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,s.right,a)),this}getCenter(e,s){const a=p.ac((this.left+e-this.right)/2,0,e),o=p.ac((this.top+s-this.bottom)/2,0,s);return new p.P(a,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Is(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Xa=85.051129;class Ps{constructor(e,s,a,o,c){this.tileSize=512,this._renderWorldCopies=c===void 0||!!c,this._minZoom=e||0,this._maxZoom=s||22,this._minPitch=a??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Is,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const e=new Ps(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const s=-p.b3(e,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=(function(){var a=new p.A(4);return p.A!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a})(),(function(a,o,c){var m=o[0],g=o[1],y=o[2],b=o[3],T=Math.sin(c),S=Math.cos(c);a[0]=m*S+y*T,a[1]=g*S+b*T,a[2]=m*-T+y*S,a[3]=g*-T+b*S})(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const s=p.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const s=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.tileZoom=Math.max(0,Math.floor(s)),this.scale=this.zoomScale(s),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,s,a){this._unmodified=!1,this._edgeInsets.interpolate(e,s,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const s=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(e){const s=[new p.b4(0,e)];if(this._renderWorldCopies){const a=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),c=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),g=Math.floor(Math.min(a.x,o.x,c.x,m.x)),y=Math.floor(Math.max(a.x,o.x,c.x,m.x)),b=1;for(let T=g-b;T<=y+b;T++)T!==0&&s.push(new p.b4(T,e))}return s}coveringTiles(e){var s,a;let o=this.coveringZoomLevel(e);const c=o;if(e.minzoom!==void 0&&o<e.minzoom)return[];e.maxzoom!==void 0&&o>e.maxzoom&&(o=e.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),g=p.Z.fromLngLat(this.center),y=Math.pow(2,o),b=[y*m.x,y*m.y,0],T=[y*g.x,y*g.y,0],S=Ts.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o);let C=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(C=o);const E=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,R=B=>({aabb:new Ss([B*y,0,0],[(B+1)*y,y,0]),zoom:0,x:0,y:0,wrap:B,fullyVisible:!1}),V=[],U=[],$=o,Z=e.reparseOverscaled?c:o;if(this._renderWorldCopies)for(let B=1;B<=3;B++)V.push(R(-B)),V.push(R(B));for(V.push(R(0));V.length>0;){const B=V.pop(),X=B.x,K=B.y;let ee=B.fullyVisible;if(!ee){const fe=B.aabb.intersects(S);if(fe===0)continue;ee=fe===2}const oe=e.terrain?b:T,he=B.aabb.distanceX(oe),xe=B.aabb.distanceY(oe),Te=Math.max(Math.abs(he),Math.abs(xe));if(B.zoom===$||Te>E+(1<<$-B.zoom)-2&&B.zoom>=C){const fe=$-B.zoom,pe=b[0]-.5-(X<<fe),Me=b[1]-.5-(K<<fe);U.push({tileID:new p.S(B.zoom===$?Z:B.zoom,B.wrap,B.zoom,X,K),distanceSq:Pn([T[0]-.5-X,T[1]-.5-K]),tileDistanceToCamera:Math.sqrt(pe*pe+Me*Me)})}else for(let fe=0;fe<4;fe++){const pe=(X<<1)+fe%2,Me=(K<<1)+(fe>>1),Ve=B.zoom+1;let ge=B.aabb.quadrant(fe);if(e.terrain){const be=new p.S(Ve,B.wrap,Ve,pe,Me),Fe=e.terrain.getMinMaxElevation(be),pt=(s=Fe.minElevation)!==null&&s!==void 0?s:this.elevation,Ue=(a=Fe.maxElevation)!==null&&a!==void 0?a:this.elevation;ge=new Ss([ge.min[0],ge.min[1],pt],[ge.max[0],ge.max[1],Ue])}V.push({aabb:ge,zoom:Ve,x:pe,y:Me,wrap:B.wrap,fullyVisible:ee})}}return U.sort(((B,X)=>B.distanceSq-X.distanceSq)).map((B=>B.tileID))}resize(e,s){this.width=e,this.height=s,this.pixelsToGLUnits=[2/e,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){const s=p.ac(e.lat,-85.051129,Xa);return new p.P(p.O(e.lng)*this.worldSize,p.Q(s)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const s=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),c=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-c))return;const m=a+s-c,g=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,o.lat),y=this.scaleZoom(g/this.tileSize);this._elevation=c,this._center=o,this.zoom=y}setLocationAtPoint(e,s){const a=this.pointCoordinate(s),o=this.pointCoordinate(this.centerPoint),c=this.locationCoordinate(e),m=new p.Z(c.x-(a.x-o.x),c.y-(a.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,s){return s?this.coordinatePoint(this.locationCoordinate(e),s.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,s){return this.coordinateLocation(this.pointCoordinate(e,s))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,s){if(s){const C=s.pointCoordinate(e);if(C!=null)return C}const a=[e.x,e.y,0,1],o=[e.x,e.y,1,1];p.af(a,a,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);const c=a[3],m=o[3],g=a[1]/c,y=o[1]/m,b=a[2]/c,T=o[2]/m,S=b===T?0:(0-b)/(T-b);return new p.Z(p.y.number(a[0]/c,o[0]/m,S)/this.worldSize,p.y.number(g,y,S)/this.worldSize)}coordinatePoint(e,s=0,a=this.pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,s,1];return p.af(o,o,a),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return new ie().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ie([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Xa])}calculateTileMatrix(e){const s=e.canonical,a=this.worldSize/this.zoomScale(s.z),o=s.x+Math.pow(2,s.z)*e.wrap,c=p.an(new Float64Array(16));return p.J(c,c,[o*a,s.y*a,0]),p.K(c,c,[a/p.X,a/p.X,1]),c}calculatePosMatrix(e,s=!1){const a=e.key,o=s?this._alignedPosMatrixCache:this._posMatrixCache;if(o[a])return o[a];const c=this.calculateTileMatrix(e);return p.L(c,s?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),o[a]=new Float32Array(c),o[a]}calculateFogMatrix(e){const s=e.key,a=this._fogMatrixCache;if(a[s])return a[s];const o=this.calculateTileMatrix(e);return p.L(o,this.fogMatrix,o),a[s]=new Float32Array(o),a[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,s){s=p.ac(+s,this.minZoom,this.maxZoom);const a={center:new p.N(e.lng,e.lat),zoom:s};let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const B=179.9999999999;o=[-B,B]}const c=this.tileSize*this.zoomScale(a.zoom);let m=0,g=c,y=0,b=c,T=0,S=0;const{x:C,y:E}=this.size;if(this.latRange){const B=this.latRange;m=p.Q(B[1])*c,g=p.Q(B[0])*c,g-m<E&&(T=E/(g-m))}o&&(y=p.b3(p.O(o[0])*c,0,c),b=p.b3(p.O(o[1])*c,0,c),b<y&&(b+=c),b-y<C&&(S=C/(b-y)));const{x:R,y:V}=this.project.call({worldSize:c},e);let U,$;const Z=Math.max(S||0,T||0);if(Z){const B=new p.P(S?(b+y)/2:R,T?(g+m)/2:V);return a.center=this.unproject.call({worldSize:c},B).wrap(),a.zoom+=this.scaleZoom(Z),a}if(this.latRange){const B=E/2;V-B<m&&($=m+B),V+B>g&&($=g-B)}if(o){const B=(y+b)/2;let X=R;this._renderWorldCopies&&(X=p.b3(R,B-c/2,B+c/2));const K=C/2;X-K<y&&(U=y+K),X+K>b&&(U=b-K)}if(U!==void 0||$!==void 0){const B=new p.P(U??R,$??V);a.center=this.unproject.call({worldSize:c},B).wrap()}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:s,zoom:a}=this.getConstrained(this.center,this.zoom);this.center=s,this.zoom=a,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,s=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.K(o,o,[this.width/2,-this.height/2,1]),p.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.K(o,o,[1,-1,1]),p.J(o,o,[-1,-1,0]),p.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;const c=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),g=c-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:c,b=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),S=Math.sin(T)*y/Math.sin(p.ac(Math.PI-b-T,.01,Math.PI-.01)),C=this.getHorizon(),E=2*Math.atan(C/this.cameraToCenterDistance)*(.5+e.y/(2*C)),R=Math.sin(E)*y/Math.sin(p.ac(Math.PI-b-E,.01,Math.PI-.01)),V=Math.min(S,R);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*V+y),this.nearZ=this.height/50,o=new Float64Array(16),p.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=p.ae(o),p.K(o,o,[1,-1,1]),p.J(o,o,[0,0,-this.cameraToCenterDistance]),p.b7(o,o,this._pitch),p.ad(o,o,this.angle),p.J(o,o,[-s,-a,0]),this.mercatorMatrix=p.K([],o,[this.worldSize,this.worldSize,this.worldSize]),p.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,o),p.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=p.as([],o),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,c,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-s,-a,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,o);const U=this.width%2/2,$=this.height%2/2,Z=Math.cos(this.angle),B=Math.sin(this.angle),X=s-Math.round(s)+Z*U+B*$,K=a-Math.round(a)+Z*$+B*U,ee=new Float64Array(o);if(p.J(ee,ee,[X>.5?X-1:X,K>.5?K-1:K,0]),this.alignedModelViewProjectionMatrix=ee,o=p.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new p.P(0,0)),s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(s,s,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){const s=this.getCameraPoint();if(e.length===1)return[e[0],s];{let a=s.x,o=s.y,c=s.x,m=s.y;for(const g of e)a=Math.min(a,g.x),o=Math.min(o,g.y),c=Math.max(c,g.x),m=Math.max(m,g.y);return[new p.P(a,o),new p.P(c,o),new p.P(c,m),new p.P(a,m),new p.P(a,o)]}}lngLatToCameraDepth(e,s){const a=this.locationCoordinate(e),o=[a.x*this.worldSize,a.y*this.worldSize,s,1];return p.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function hn(h,e){let s,a=!1,o=null,c=null;const m=()=>{o=null,a&&(h.apply(c,s),o=setTimeout(m,e),a=!1)};return(...g)=>(a=!0,c=this,s=g,o||m(),o)}class Hn{constructor(e){this._getCurrentHash=()=>{const s=window.location.hash.replace("#","");if(this._hashName){let a;return s.split("&").map((o=>o.split("="))).forEach((o=>{o[0]===this._hashName&&(a=o)})),(a&&a[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{const s=this._getCurrentHash();if(s.length>=3&&!s.some((a=>isNaN(a)))){const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:a,pitch:+(s[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const s=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,s)},this._removeHash=()=>{const s=this._getCurrentHash();if(s.length===0)return;const a=s.join("/");let o=a;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${a}`);let c=window.location.hash.replace(o,"");c.startsWith("#&")?c=c.slice(0,1)+c.slice(2):c==="#"&&(c="");let m=window.location.href.replace(/(#.+)?$/,c);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=hn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const s=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,o),m=Math.round(s.lng*c)/c,g=Math.round(s.lat*c)/c,y=this._map.getBearing(),b=this._map.getPitch();let T="";if(T+=e?`/${m}/${g}/${a}`:`${a}/${g}/${m}`,(y||b)&&(T+="/"+Math.round(10*y)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){const S=this._hashName;let C=!1;const E=window.location.hash.slice(1).split("&").map((R=>{const V=R.split("=")[0];return V===S?(C=!0,`${V}=${T}`):R})).filter((R=>R));return C||E.push(`${S}=${T}`),`#${E.join("&")}`}return`#${T}`}}const Xn={linearity:.3,easing:p.b8(0,0,.3,1)},Wa=p.e({deceleration:2500,maxSpeed:1400},Xn),rc=p.e({deceleration:20,maxSpeed:1400},Xn),nl=p.e({deceleration:1e3,maxSpeed:360},Xn),Wn=p.e({deceleration:1e3,maxSpeed:90},Xn);class Ka{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:me.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,s=me.now();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:c}of this._inertiaBuffer)s.zoom+=c.zoomDelta||0,s.bearing+=c.bearingDelta||0,s.pitch+=c.pitchDelta||0,c.panDelta&&s.pan._add(c.panDelta),c.around&&(s.around=c.around),c.pinchAround&&(s.pinchAround=c.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(s.pan.mag()){const c=dn(s.pan.mag(),a,p.e({},Wa,e||{}));o.offset=s.pan.mult(c.amount/s.pan.mag()),o.center=this._map.transform.center,un(o,c)}if(s.zoom){const c=dn(s.zoom,a,rc);o.zoom=this._map.transform.zoom+c.amount,un(o,c)}if(s.bearing){const c=dn(s.bearing,a,nl);o.bearing=this._map.transform.bearing+p.ac(c.amount,-179,179),un(o,c)}if(s.pitch){const c=dn(s.pitch,a,Wn);o.pitch=this._map.transform.pitch+c.amount,un(o,c)}if(o.zoom||o.bearing){const c=s.pinchAround===void 0?s.around:s.pinchAround;o.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function un(h,e){(!h.duration||h.duration<e.duration)&&(h.duration=e.duration,h.easing=e.easing)}function dn(h,e,s){const{maxSpeed:a,linearity:o,deceleration:c}=s,m=p.ac(h*o/(e/1e3),-a,a),g=Math.abs(m)/(c*o);return{easing:s.easing,duration:1e3*g,amount:m*(g/2)}}class Ot extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a,o={}){const c=ne.mousePos(s.getCanvas(),a),m=s.unproject(c);super(e,p.e({point:c,lngLat:m,originalEvent:a},o)),this._defaultPrevented=!1,this.target=s}}class Qr extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a){const o=e==="touchend"?a.changedTouches:a.touches,c=ne.touchPos(s.getCanvasContainer(),o),m=c.map((y=>s.unproject(y))),g=c.reduce(((y,b,T,S)=>y.add(b.div(S.length))),new p.P(0,0));super(e,{points:c,point:g,lngLats:m,lngLat:s.unproject(g),originalEvent:a}),this._defaultPrevented=!1}}class al extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class ol{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new al(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new Ot(e.type,this._map,e))}mouseup(e){this._map.fire(new Ot(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Ot(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ot(e.type,this._map,e))}mouseover(e){this._map.fire(new Ot(e.type,this._map,e))}mouseout(e){this._map.fire(new Ot(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Qr(e.type,this._map,e))}touchmove(e){this._map.fire(new Qr(e.type,this._map,e))}touchend(e){this._map.fire(new Qr(e.type,this._map,e))}touchcancel(e){this._map.fire(new Qr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wt{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ot(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ot("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ot(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vi{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class mi{constructor(e,s){this._map=e,this._tr=new Vi(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,s){this.isEnabled()&&e.shiftKey&&e.button===0&&(ne.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;const a=s;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const o=this._startPos;this._lastPos=a,this._box||(this._box=ne.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const c=Math.min(o.x,a.x),m=Math.max(o.x,a.x),g=Math.min(o.y,a.y),y=Math.max(o.y,a.y);ne.setTransform(this._box,`translate(${c}px,${g}px)`),this._box.style.width=m-c+"px",this._box.style.height=y-g+"px"}mouseupWindow(e,s){if(!this._active||e.button!==0)return;const a=this._startPos,o=s;if(this.reset(),ne.suppressClick(),a.x!==o.x||a.y!==o.y)return this._map.fire(new p.k("boxzoomend",{originalEvent:e})),{cameraAnimation:c=>c.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ne.remove(this._box),this._box=null),ne.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,s){return this._map.fire(new p.k(e,{originalEvent:s}))}}function pn(h,e){if(h.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${e.length}`);const s={};for(let a=0;a<h.length;a++)s[h[a].identifier]=e[a];return s}class Ja{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,s,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),a.length===this.numTouches&&(this.centroid=(function(o){const c=new p.P(0,0);for(const m of o)c._add(m);return c.div(o.length)})(s),this.touches=pn(a,s)))}touchmove(e,s,a){if(this.aborted||!this.centroid)return;const o=pn(a,s);for(const c in this.touches){const m=o[c];(!m||m.dist(this.touches[c])>30)&&(this.aborted=!0)}}touchend(e,s,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class Kn{constructor(e){this.singleTap=new Ja(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,a){this.singleTap.touchstart(e,s,a)}touchmove(e,s,a){this.singleTap.touchmove(e,s,a)}touchend(e,s,a){const o=this.singleTap.touchend(e,s,a);if(o){const c=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(c&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class As{constructor(e){this._tr=new Vi(e),this._zoomIn=new Kn({numTouches:1,numTaps:2}),this._zoomOut=new Kn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,a){this._zoomIn.touchstart(e,s,a),this._zoomOut.touchstart(e,s,a)}touchmove(e,s,a){this._zoomIn.touchmove(e,s,a),this._zoomOut.touchmove(e,s,a)}touchend(e,s,a){const o=this._zoomIn.touchend(e,s,a),c=this._zoomOut.touchend(e,s,a),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):c?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(c)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const s=this._moveFunction(...e);if(s.bearingDelta||s.pitchDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(e,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=s.length?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,s){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const o=s.length?s[0]:s;return!this._moved&&o.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(a,o))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ne.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ya={0:1,2:2};class Jn{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const s=ne.mouseButton(e);this._eventButton=s}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!(function(s,a){const o=Ya[a];return s.buttons===void 0||(s.buttons&o)!==o})(e,this._eventButton)}isValidEndEvent(e){return ne.mouseButton(e)===this._eventButton}}class Qa{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}const Yn=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=e=>{e.preventDefault()}},eo=({enable:h,clickTolerance:e,bearingDegreesPerPixelMoved:s=.8})=>{const a=new Jn({checkCorrectEvent:o=>ne.mouseButton(o)===0&&o.ctrlKey||ne.mouseButton(o)===2});return new gr({clickTolerance:e,move:(o,c)=>({bearingDelta:(c.x-o.x)*s}),moveStateManager:a,enable:h,assignEvents:Yn})},to=({enable:h,clickTolerance:e,pitchDegreesPerPixelMoved:s=-.5})=>{const a=new Jn({checkCorrectEvent:o=>ne.mouseButton(o)===0&&o.ctrlKey||ne.mouseButton(o)===2});return new gr({clickTolerance:e,move:(o,c)=>({pitchDelta:(c.y-o.y)*s}),moveStateManager:a,enable:h,assignEvents:Yn})};class es{constructor(e,s){this._clickTolerance=e.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,s,a){return this._calculateTransform(e,s,a)}touchmove(e,s,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,s,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,s,a){this._calculateTransform(e,s,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,a){a.length>0&&(this._active=!0);const o=pn(a,s),c=new p.P(0,0),m=new p.P(0,0);let g=0;for(const b in o){const T=o[b],S=this._touches[b];S&&(c._add(T),m._add(T.sub(S)),g++,o[b]=T)}if(this._touches=o,this._shouldBePrevented(g)||!m.mag())return;const y=m.div(g);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:c.div(g),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,s,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([s[0],s[1]]))}touchmove(e,s,a){if(!this._firstTwoTouches)return;e.preventDefault();const[o,c]=this._firstTwoTouches,m=fn(a,s,o),g=fn(a,s,c);if(!m||!g)return;const y=this._aroundCenter?null:m.add(g).div(2);return this._move([m,g],y,e)}touchend(e,s,a){if(!this._firstTwoTouches)return;const[o,c]=this._firstTwoTouches,m=fn(a,s,o),g=fn(a,s,c);m&&g||(this._active&&ne.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function fn(h,e,s){for(let a=0;a<h.length;a++)if(h[a].identifier===s)return e[a]}function io(h,e){return Math.log(h/e)/Math.LN2}class ro extends Qn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,s){const a=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(io(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:io(this._distance,a),pinchAround:s}}}function so(h,e){return 180*h.angleWith(e)/Math.PI}class no extends Qn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,s,a){const o=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:so(this._vector,o),pinchAround:s}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const s=25/(Math.PI*this._minDiameter)*360,a=so(e,this._startVector);return Math.abs(a)<s}}function ea(h){return Math.abs(h.y)>Math.abs(h.x)}class Ms extends Qn{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,s,a){super.touchstart(e,s,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,ea(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=e[0].sub(this._lastPoints[0]),c=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,c,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(e,s,a){if(this._valid!==void 0)return this._valid;const o=e.mag()>=2,c=s.mag()>=2;if(!o&&!c)return;if(!o||!c)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=e.y>0==s.y>0;return ea(e)&&ea(s)&&m}}const ll={panStep:100,bearingStep:15,pitchStep:10};class Si{constructor(e){this._tr=new Vi(e);const s=ll;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let s=0,a=0,o=0,c=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),c=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),c=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:g=>{const y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:nr,zoom:s?Math.round(y.zoom)+s*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-c*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function nr(h){return h*(2-h)}const ao=4.000244140625;class Ni{constructor(e,s){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=e,this._tr=new Vi(e),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const a=me.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,s!==0&&s%ao==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=ne.mousePos(this._map.getCanvas(),e),a=this._tr;this._around=s.y>a.transform.height/2-a.transform.getHorizon()?p.N.convert(this._aroundCenter?a.center:a.unproject(s)):p.N.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>ao?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);const T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,a=this._startZoom,o=this._easing;let c,m=!1;const g=me.now()-this._lastWheelEventTime;if(this._type==="wheel"&&a&&o&&g){const y=Math.min(g/200,1),b=o(y);c=p.y.number(a,s,b),y<1?this._frameId||(this._frameId=!0):m=!0}else c=s,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:c-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=p.b9;if(this._prevEase){const a=this._prevEase,o=(me.now()-a.start)/a.duration,c=a.easing(o+.01)-a.easing(o),m=.27/Math.sqrt(c*c+1e-4)*.01,g=Math.sqrt(.0729-m*m);s=p.b8(m,g,.25,1)}return this._prevEase={start:me.now(),duration:e,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ts{constructor(e,s){this._clickZoom=e,this._tapZoom=s}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class sc{constructor(e){this._tr=new Vi(e),this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nc{constructor(){this._tap=new Kn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,s,a){if(!this._swipePoint)if(this._tapTime){const o=s[0],c=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;c&&m?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,s,a)}touchmove(e,s,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=s[0],c=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(e,s,a)}touchend(e,s,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(e,s,a);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cl{constructor(e,s,a){this._el=e,this._mousePan=s,this._touchPan=a}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class hl{constructor(e,s,a){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=s,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class oo{constructor(e,s,a,o){this._el=e,this._touchZoom=s,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Cs{constructor(e,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ne.create("div","maplibregl-cooperative-gesture-screen",e);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=s,this._container.appendChild(o);const c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=a,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ne.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,s){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:s})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Ii=h=>h.zoom||h.drag||h.pitch||h.rotate;class Ie extends p.k{}function ta(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class lo{constructor(e,s){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,c)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=o.type==="renderFrame"?void 0:o,g={needsRenderFrame:!1},y={},b={},T=o.touches,S=T?this._getMapTouches(T):void 0,C=S?ne.touchPos(this._map.getCanvas(),S):ne.mousePos(this._map.getCanvas(),o);for(const{handlerName:V,handler:U,allowed:$}of this._handlers){if(!U.isEnabled())continue;let Z;this._blockedByActive(b,$,V)?U.reset():U[c||o.type]&&(Z=U[c||o.type](o,C,S),this.mergeHandlerResult(g,y,Z,V,m),Z&&Z.needsRenderFrame&&this._triggerRenderFrame()),(Z||U.isActive())&&(b[V]=U)}const E={};for(const V in this._previousActiveHandlers)b[V]||(E[V]=m);this._previousActiveHandlers=b,(Object.keys(E).length||ta(g))&&(this._changes.push([g,y,E]),this._triggerRenderFrame()),(Object.keys(b).length||ta(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:R}=g;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ka(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,c,m]of this._listeners)ne.addEventListener(o,c,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[e,s,a]of this._listeners)ne.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){const s=this._map,a=s.getCanvasContainer();this._add("mapEvent",new ol(s,e));const o=s.boxZoom=new mi(s,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const c=s.cooperativeGestures=new Cs(s,e.cooperativeGestures);this._add("cooperativeGestures",c),e.cooperativeGestures&&c.enable();const m=new As(s),g=new sc(s);s.doubleClickZoom=new ts(g,m),this._add("tapZoom",m),this._add("clickZoom",g),e.interactive&&e.doubleClickZoom&&s.doubleClickZoom.enable();const y=new nc;this._add("tapDragZoom",y);const b=s.touchPitch=new Ms(s);this._add("touchPitch",b),e.interactive&&e.touchPitch&&s.touchPitch.enable(e.touchPitch);const T=eo(e),S=to(e);s.dragRotate=new hl(e,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]),e.interactive&&e.dragRotate&&s.dragRotate.enable();const C=(({enable:Z,clickTolerance:B})=>{const X=new Jn({checkCorrectEvent:K=>ne.mouseButton(K)===0&&!K.ctrlKey});return new gr({clickTolerance:B,move:(K,ee)=>({around:ee,panDelta:ee.sub(K)}),activateOnStart:!0,moveStateManager:X,enable:Z,assignEvents:Yn})})(e),E=new es(e,s);s.dragPan=new cl(a,C,E),this._add("mousePan",C),this._add("touchPan",E,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&s.dragPan.enable(e.dragPan);const R=new no,V=new ro;s.touchZoomRotate=new oo(a,V,R,y),this._add("touchRotate",R,["touchPan","touchZoom"]),this._add("touchZoom",V,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&s.touchZoomRotate.enable(e.touchZoomRotate);const U=s.scrollZoom=new Ni(s,(()=>this._triggerRenderFrame()));this._add("scrollZoom",U,["mousePan"]),e.interactive&&e.scrollZoom&&s.scrollZoom.enable(e.scrollZoom);const $=s.keyboard=new Si(s);this._add("keyboard",$),e.interactive&&e.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new wt(s))}_add(e,s,a){this._handlers.push({handlerName:e,handler:s,allowed:a}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ii(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,s,a){for(const o in e)if(o!==a&&(!s||s.indexOf(o)<0))return!0;return!1}_getMapTouches(e){const s=[];for(const a of e)this._el.contains(a.target)&&s.push(a);return s}mergeHandlerResult(e,s,a,o,c){if(!a)return;p.e(e,a);const m={handlerName:o,originalEvent:a.originalEvent||c};a.zoomDelta!==void 0&&(s.zoom=m),a.panDelta!==void 0&&(s.drag=m),a.pitchDelta!==void 0&&(s.pitch=m),a.bearingDelta!==void 0&&(s.rotate=m)}_applyChanges(){const e={},s={},a={};for(const[o,c,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),p.e(s,c),p.e(a,m);this._updateMapTransform(e,s,a),this._changes=[]}_updateMapTransform(e,s,a){const o=this._map,c=o._getTransformForUpdate(),m=o.terrain;if(!(ta(e)||m&&this._terrainMovement))return this._fireEvents(s,a,!0);let{panDelta:g,zoomDelta:y,bearingDelta:b,pitchDelta:T,around:S,pinchAround:C}=e;C!==void 0&&(S=C),o._stop(!0),S=S||o.transform.centerPoint;const E=c.pointLocation(g?S.sub(g):S);b&&(c.bearing+=b),T&&(c.pitch+=T),y&&(c.zoom+=y),m?this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?c.center=c.pointLocation(c.centerPoint.sub(g)):c.setLocationAtPoint(E,S):(this._terrainMovement=!0,this._map._elevationFreeze=!0,c.setLocationAtPoint(E,S)):c.setLocationAtPoint(E,S),o._applyUpdatedTransform(c),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,a,!0)}_fireEvents(e,s,a){const o=Ii(this._eventsInProgress),c=Ii(e),m={};for(const S in e){const{originalEvent:C}=e[S];this._eventsInProgress[S]||(m[`${S}start`]=C),this._eventsInProgress[S]=e[S]}!o&&c&&this._fireEvent("movestart",c.originalEvent);for(const S in m)this._fireEvent(S,m[S]);c&&this._fireEvent("move",c.originalEvent);for(const S in e){const{originalEvent:C}=e[S];this._fireEvent(S,C)}const g={};let y;for(const S in this._eventsInProgress){const{handlerName:C,originalEvent:E}=this._eventsInProgress[S];this._handlersById[C].isActive()||(delete this._eventsInProgress[S],y=s[C]||E,g[`${S}end`]=y)}for(const S in g)this._fireEvent(S,g[S]);const b=Ii(this._eventsInProgress),T=(o||c)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const S=this._map._getTransformForUpdate();S.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(S)}if(a&&T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=E=>E!==0&&-this._bearingSnap<E&&E<this._bearingSnap;!S||!S.essential&&me.prefersReducedMotion?(this._map.fire(new p.k("moveend",{originalEvent:y})),C(this._map.getBearing())&&this._map.resetNorth()):(C(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(e,s){this._map.fire(new p.k(e,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new Ie("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ul extends p.E{constructor(e,s){super(),this._renderFrameCallback=()=>{const a=Math.min((me.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}panBy(e,s,a){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},s),a)}panTo(e,s,a){return this.easeTo(p.e({center:e},s),a)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,a){return this.easeTo(p.e({zoom:e},s),a)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,a){return this.easeTo(p.e({bearing:e},s),a)}resetNorth(e,s){return this.rotateTo(0,p.e({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,s):this}getPitch(){return this.transform.pitch}setPitch(e,s){return this.jumpTo({pitch:e},s),this}cameraForBounds(e,s){e=ie.convert(e).adjustAntiMeridian();const a=s&&s.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),a,s)}_cameraForBoxAndBearing(e,s,a,o){const c={top:0,bottom:0,right:0,left:0};if(typeof(o=p.e({padding:c,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding=="number"){const fe=o.padding;o.padding={top:fe,bottom:fe,right:fe,left:fe}}o.padding=p.e(c,o.padding);const m=this.transform,g=m.padding,y=new ie(e,s),b=m.project(y.getNorthWest()),T=m.project(y.getNorthEast()),S=m.project(y.getSouthEast()),C=m.project(y.getSouthWest()),E=p.ba(-a),R=b.rotate(E),V=T.rotate(E),U=S.rotate(E),$=C.rotate(E),Z=new p.P(Math.max(R.x,V.x,$.x,U.x),Math.max(R.y,V.y,$.y,U.y)),B=new p.P(Math.min(R.x,V.x,$.x,U.x),Math.min(R.y,V.y,$.y,U.y)),X=Z.sub(B),K=(m.width-(g.left+g.right+o.padding.left+o.padding.right))/X.x,ee=(m.height-(g.top+g.bottom+o.padding.top+o.padding.bottom))/X.y;if(ee<0||K<0)return void p.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const oe=Math.min(m.scaleZoom(m.scale*Math.min(K,ee)),o.maxZoom),he=p.P.convert(o.offset),xe=new p.P((o.padding.left-o.padding.right)/2,(o.padding.top-o.padding.bottom)/2).rotate(p.ba(a)),Te=he.add(xe).mult(m.scale/m.zoomScale(oe));return{center:m.unproject(b.add(S).div(2).sub(Te)),zoom:oe,bearing:a}}fitBounds(e,s,a){return this._fitInternal(this.cameraForBounds(e,s),s,a)}fitScreenCoordinates(e,s,a,o,c){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(p.P.convert(e)),this.transform.pointLocation(p.P.convert(s)),a,o),o,c)}_fitInternal(e,s,a){return e?(delete(s=p.e(e,s)).padding,s.linear?this.easeTo(s,a):this.flyTo(s,a)):this}jumpTo(e,s){this.stop();const a=this._getTransformForUpdate();let o=!1,c=!1,m=!1;return"zoom"in e&&a.zoom!==+e.zoom&&(o=!0,a.zoom=+e.zoom),e.center!==void 0&&(a.center=p.N.convert(e.center)),"bearing"in e&&a.bearing!==+e.bearing&&(c=!0,a.bearing=+e.bearing),"pitch"in e&&a.pitch!==+e.pitch&&(m=!0,a.pitch=+e.pitch),e.padding==null||a.isPaddingEqual(e.padding)||(a.padding=e.padding),this._applyUpdatedTransform(a),this.fire(new p.k("movestart",s)).fire(new p.k("move",s)),o&&this.fire(new p.k("zoomstart",s)).fire(new p.k("zoom",s)).fire(new p.k("zoomend",s)),c&&this.fire(new p.k("rotatestart",s)).fire(new p.k("rotate",s)).fire(new p.k("rotateend",s)),m&&this.fire(new p.k("pitchstart",s)).fire(new p.k("pitch",s)).fire(new p.k("pitchend",s)),this.fire(new p.k("moveend",s))}calculateCameraOptionsFromTo(e,s,a,o=0){const c=p.Z.fromLngLat(e,s),m=p.Z.fromLngLat(a,o),g=m.x-c.x,y=m.y-c.y,b=m.z-c.z,T=Math.hypot(g,y,b);if(T===0)throw new Error("Can't calculate camera options with same From and To");const S=Math.hypot(g,y),C=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),E=180*Math.atan2(g,-y)/Math.PI;let R=180*Math.acos(S/T)/Math.PI;return R=b<0?90-R:90+R,{center:m.toLngLat(),zoom:C,pitch:R,bearing:E}}easeTo(e,s){var a;this._stop(!1,e.easeId),((e=p.e({offset:[0,0],duration:500,easing:p.b9},e)).animate===!1||!e.essential&&me.prefersReducedMotion)&&(e.duration=0);const o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,g=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:g,S="padding"in e?e.padding:o.padding,C=p.P.convert(e.offset);let E=o.centerPoint.add(C);const R=o.pointLocation(E),{center:V,zoom:U}=o.getConstrained(p.N.convert(e.center||R),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(V,o);const $=o.project(R),Z=o.project(V).sub($),B=o.zoomScale(U-c);let X,K;e.around&&(X=p.N.convert(e.around),K=o.locationPoint(X));const ee={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==c,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||T!==g,this._padding=!o.isPaddingEqual(S),this._easeId=e.easeId,this._prepareEase(s,e.noMoveStart,ee),this.terrain&&this._prepareElevation(V),this._ease((oe=>{if(this._zooming&&(o.zoom=p.y.number(c,U,oe)),this._rotating&&(o.bearing=p.y.number(m,b,oe)),this._pitching&&(o.pitch=p.y.number(g,T,oe)),this._padding&&(o.interpolatePadding(y,S,oe),E=o.centerPoint.add(C)),this.terrain&&!e.freezeElevation&&this._updateElevation(oe),X)o.setLocationAtPoint(X,K);else{const he=o.zoomScale(o.zoom-c),xe=U>c?Math.min(2,B):Math.max(.5,B),Te=Math.pow(xe,1-oe),fe=o.unproject($.add(Z.mult(oe*Te)).mult(he));o.setLocationAtPoint(o.renderWorldCopies?fe.wrap():fe,E)}this._applyUpdatedTransform(o),this._fireMoveEvents(s)}),(oe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s,oe)}),e),this}_prepareEase(e,s,a={}){this._moving=!0,s||a.moving||this.fire(new p.k("movestart",e)),this._zooming&&!a.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!a.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!a.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&s!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(s-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=s}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){const s=e.getCameraPosition(),a=this.terrain.getElevationForLngLatZoom(s.lngLat,e.zoom);if(s.altitude<a){const o=this.calculateCameraOptionsFromTo(s.lngLat,a,e.center,e.elevation);return{pitch:o.pitch,zoom:o.zoom}}return{}}_applyUpdatedTransform(e){const s=[];if(this.terrain&&s.push((o=>this._elevateCameraIfInsideTerrain(o))),this.transformCameraUpdate&&s.push((o=>this.transformCameraUpdate(o))),!s.length)return;const a=e.clone();for(const o of s){const c=a.clone(),{center:m,zoom:g,pitch:y,bearing:b,elevation:T}=o(c);m&&(c.center=m),g!==void 0&&(c.zoom=g),y!==void 0&&(c.pitch=y),b!==void 0&&(c.bearing=b),T!==void 0&&(c.elevation=T),a.apply(c)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;const a=this._zooming,o=this._rotating,c=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new p.k("zoomend",e)),o&&this.fire(new p.k("rotateend",e)),c&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,s){var a;if(!e.essential&&me.prefersReducedMotion){const be=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(be,s)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);const o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,g=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:g,S="padding"in e?e.padding:o.padding,C=p.P.convert(e.offset);let E=o.centerPoint.add(C);const R=o.pointLocation(E),{center:V,zoom:U}=o.getConstrained(p.N.convert(e.center||R),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(V,o);const $=o.zoomScale(U-c),Z=o.project(R),B=o.project(V).sub(Z);let X=e.curve;const K=Math.max(o.width,o.height),ee=K/$,oe=B.mag();if("minZoom"in e){const be=p.ac(Math.min(e.minZoom,c,U),o.minZoom,o.maxZoom),Fe=K/o.zoomScale(be-c);X=Math.sqrt(Fe/oe*2)}const he=X*X;function xe(be){const Fe=(ee*ee-K*K+(be?-1:1)*he*he*oe*oe)/(2*(be?ee:K)*he*oe);return Math.log(Math.sqrt(Fe*Fe+1)-Fe)}function Te(be){return(Math.exp(be)-Math.exp(-be))/2}function fe(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=xe(!1);let Me=function(be){return fe(pe)/fe(pe+X*be)},Ve=function(be){return K*((fe(pe)*(Te(Fe=pe+X*be)/fe(Fe))-Te(pe))/he)/oe;var Fe},ge=(xe(!0)-pe)/X;if(Math.abs(oe)<1e-6||!isFinite(ge)){if(Math.abs(K-ee)<1e-6)return this.easeTo(e,s);const be=ee<K?-1:1;ge=Math.abs(Math.log(ee/K))/X,Ve=()=>0,Me=Fe=>Math.exp(be*X*Fe)}return e.duration="duration"in e?+e.duration:1e3*ge/("screenSpeed"in e?+e.screenSpeed/X:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=T!==g,this._padding=!o.isPaddingEqual(S),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(V),this._ease((be=>{const Fe=be*ge,pt=1/Me(Fe);o.zoom=be===1?U:c+o.scaleZoom(pt),this._rotating&&(o.bearing=p.y.number(m,b,be)),this._pitching&&(o.pitch=p.y.number(g,T,be)),this._padding&&(o.interpolatePadding(y,S,be),E=o.centerPoint.add(C)),this.terrain&&!e.freezeElevation&&this._updateElevation(be);const Ue=be===1?V:o.unproject(Z.add(B.mult(Ve(Fe))).mult(pt));o.setLocationAtPoint(o.renderWorldCopies?Ue.wrap():Ue,E),this._applyUpdatedTransform(o),this._fireMoveEvents(s)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,s)}return e||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(e,s,a){a.animate===!1||a.duration===0?(e(1),s()):(this._easeStart=me.now(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,s){e=p.b3(e,-180,180);const a=Math.abs(e-s);return Math.abs(e-360-s)<a&&(e-=360),Math.abs(e+360-s)<a&&(e+=360),e}_normalizeCenter(e,s){if(!s.renderWorldCopies||s.lngRange)return;const a=e.lng-s.center.lng;e.lng+=a>180?-360:a<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}const ks={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class zs{constructor(e=ks){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ne.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ne.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ne.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ne.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,s){const a=this._map._getUIString(`AttributionControl.${s}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((o=>typeof o!="string"?"":o))):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const s=this._map.style.sourceCaches;for(const o in s){const c=s[o];if(c.used||c.usedForTerrain){const m=c.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter((o=>String(o).trim())),e.sort(((o,c)=>o.length-c.length)),e=e.filter(((o,c)=>{for(let m=c+1;m<e.length;m++)if(e[m].indexOf(o)>=0)return!1;return!0}));const a=e.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,e.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class co{constructor(e={}){this._updateCompact=()=>{const s=this._container.children;if(s.length){const a=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ne.create("div","maplibregl-ctrl");const s=ne.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ne.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Xe{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){const s=this._currentlyRunning,a=s?this._queue.concat(s):this._queue;for(const o of a)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const s=this._currentlyRunning=this._queue;this._queue=[];for(const a of s)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ho=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class ac extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,s){this.sourceCache.update(e,s),this._renderableTilesKeys=[];const a={};for(const o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aP(o.posMatrix,0,p.X,0,p.X,0,1),this._tiles[o.key]=new Ar(o,this.tileSize));for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(e){for(const s in this._tiles){const a=this._tiles[s];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const s={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID;if(o.canonical.equals(e.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16),p.aP(c.posMatrix,0,p.X,0,p.X,0,1),s[a]=c}else if(o.canonical.isChildOf(e.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16);const m=o.canonical.z-e.canonical.z,g=o.canonical.x-(o.canonical.x>>m<<m),y=o.canonical.y-(o.canonical.y>>m<<m),b=p.X>>m;p.aP(c.posMatrix,0,b,0,b,0,1),p.J(c.posMatrix,c.posMatrix,[-g*b,-y*b,0]),s[a]=c}else if(e.canonical.isChildOf(o.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16);const m=e.canonical.z-o.canonical.z,g=e.canonical.x-(e.canonical.x>>m<<m),y=e.canonical.y-(e.canonical.y>>m<<m),b=p.X>>m;p.aP(c.posMatrix,0,p.X,0,p.X,0,1),p.J(c.posMatrix,c.posMatrix,[g*b,y*b,0]),p.K(c.posMatrix,c.posMatrix,[1/2**m,1/2**m,0]),s[a]=c}}return s}getSourceTile(e,s){const a=this.sourceCache._source;let o=e.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o<a.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let c=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!c||!c.dem)&&s)for(;o>=a.minzoom&&(!c||!c.dem);)c=this.sourceCache.getTileByID(e.scaledTo(o--).key);return c}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter((s=>s.timeAdded>=e))}}class uo{constructor(e,s,a){this.painter=e,this.sourceCache=new ac(s),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,s,a,o=p.X){var c;if(!(s>=0&&s<o&&a>=0&&a<o))return 0;const m=this.getTerrainData(e),g=(c=m.tile)===null||c===void 0?void 0:c.dem;if(!g)return 0;const y=(function(R,V,U){var $=V[0],Z=V[1];return R[0]=U[0]*$+U[4]*Z+U[12],R[1]=U[1]*$+U[5]*Z+U[13],R})([],[s/o*p.X,a/o*p.X],m.u_terrain_matrix),b=[y[0]*g.dim,y[1]*g.dim],T=Math.floor(b[0]),S=Math.floor(b[1]),C=b[0]-T,E=b[1]-S;return g.get(T,S)*(1-C)*(1-E)+g.get(T+1,S)*C*(1-E)+g.get(T,S+1)*(1-C)*E+g.get(T+1,S+1)*C*E}getElevationForLngLatZoom(e,s){if(!p.bb(s,e.wrap()))return 0;const{tileID:a,mercatorX:o,mercatorY:c}=this._getOverscaledTileIDFromLngLatZoom(e,s);return this.getElevation(a,o%p.X,c%p.X,p.X)}getElevation(e,s,a,o=p.X){return this.getDEMElevation(e,s,a,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const o=this.painter.context,c=new p.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new nt(o,c,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new nt(o,new p.R({width:1,height:1}),o.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=p.an([])}const s=this.sourceCache.getSourceTile(e,!0);if(s&&s.dem&&(!s.demTexture||s.needsTerrainPrepare)){const o=this.painter.context;s.demTexture=this.painter.getTileTexture(s.dem.stride),s.demTexture?s.demTexture.update(s.dem.getPixels(),{premultiply:!1}):s.demTexture=new nt(o,s.dem.getPixels(),o.gl.RGBA,{premultiply:!1}),s.demTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),s.needsTerrainPrepare=!1}const a=s&&s+s.tileID.key+e.key;if(a&&!this._demMatrixCache[a]){const o=this.sourceCache.sourceCache._source.maxzoom;let c=e.canonical.z-s.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=o?c=e.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=e.canonical.x-(e.canonical.x>>c<<c),g=e.canonical.y-(e.canonical.y>>c<<c),y=p.bc(new Float64Array(16),[1/(p.X<<c),1/(p.X<<c),0]);p.J(y,y,[m*p.X,g*p.X,0]),this._demMatrixCache[e.key]={matrix:y,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:s&&s.dem&&s.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:s&&s.dem&&s.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(s&&s.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:s}}getFramebuffer(e){const s=this.painter,a=s.width/devicePixelRatio,o=s.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===o||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new nt(s.context,{width:a,height:o,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new nt(s.context,{width:a,height:o,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=s.context.createFramebuffer(a,o,!0,!1),this._fbo.depthAttachment.set(s.context.createRenderbuffer(s.context.gl.DEPTH_COMPONENT16,a,o))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const s=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let c=0,m=0;c<this._coordsTextureSize;c++)for(let g=0;g<this._coordsTextureSize;g++,m+=4)s[m+0]=255&g,s[m+1]=255&c,s[m+2]=g>>8<<4|c>>8,s[m+3]=0;const a=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),o=new nt(e,a,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const s=new Uint8Array(4),a=this.painter.context,o=a.gl,c=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),g=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(c,g-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,s),a.bindFramebuffer.set(null);const y=s[0]+(s[2]>>4<<8),b=s[1]+((15&s[2])<<8),T=this.coordsIndex[255-s[3]],S=T&&this.sourceCache.getTileByID(T);if(!S)return null;const C=this._coordsTextureSize,E=(1<<S.tileID.canonical.z)*C;return new p.Z((S.tileID.canonical.x*C+y)/E+S.tileID.wrap,(S.tileID.canonical.y*C+b)/E,this.getElevation(S.tileID,y,b,C))}depthAtPoint(e){const s=new Uint8Array(4),a=this.painter.context,o=a.gl;return a.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,s),a.bindFramebuffer.set(null),(s[0]/16777216+s[1]/65536+s[2]/256+s[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,s=new p.bd,a=new p.aY,o=this.meshSize,c=p.X/o,m=o*o;for(let S=0;S<=o;S++)for(let C=0;C<=o;C++)s.emplaceBack(C*c,S*c,0);for(let S=0;S<m;S+=o+1)for(let C=0;C<o;C++)a.emplaceBack(C+S,o+C+S+1,o+C+S+2),a.emplaceBack(C+S,o+C+S+2,C+S+1);const g=s.length,y=g+2*(o+1);for(const S of[0,1])for(let C=0;C<=o;C++)for(const E of[0,1])s.emplaceBack(C*c,S*p.X,E);for(let S=0;S<2*o;S+=2)a.emplaceBack(y+S,y+S+1,y+S+3),a.emplaceBack(y+S,y+S+3,y+S+2),a.emplaceBack(g+S,g+S+3,g+S+1),a.emplaceBack(g+S,g+S+2,g+S+3);const b=s.length,T=b+2*(o+1);for(const S of[0,1])for(let C=0;C<=o;C++)for(const E of[0,1])s.emplaceBack(S*p.X,C*c,E);for(let S=0;S<2*o;S+=2)a.emplaceBack(b+S,b+S+1,b+S+3),a.emplaceBack(b+S,b+S+3,b+S+2),a.emplaceBack(T+S,T+S+3,T+S+1),a.emplaceBack(T+S,T+S+2,T+S+3);return this._mesh=new Zn(e.createVertexBuffer(s,ho.members),e.createIndexBuffer(a),p.a0.simpleSegment(0,0,s.length,a.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*p.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,s){var a;const{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,s);return(a=this.getMinMaxElevation(o).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(e){const s=this.getTerrainData(e).tile,a={minElevation:null,maxElevation:null};return s&&s.dem&&(a.minElevation=s.dem.min*this.exaggeration,a.maxElevation=s.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(e,s){const a=p.Z.fromLngLat(e.wrap()),o=(1<<s)*p.X,c=a.x*o,m=a.y*o,g=Math.floor(c/p.X),y=Math.floor(m/p.X);return{tileID:new p.S(s,0,s,g,y),mercatorX:c,mercatorY:m}}}class oc{constructor(e,s,a){this._context=e,this._size=s,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const s=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new nt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),s.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),s.colorAttachment.set(a.texture),{id:e,fbo:s,texture:a,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((s=>e.id!==s)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((e=>!e.inUse))===!1}}const Es={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class dl{constructor(e,s){this.painter=e,this.terrain=s,this.pool=new oc(e.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((a=>!e._layers[a].isHidden(s))),this._coordsDescendingInv={};for(const a in e.sourceCaches){this._coordsDescendingInv[a]={};const o=e.sourceCaches[a].getVisibleCoordinates();for(const c of o){const m=this.terrain.sourceCache.getTerrainCoords(c);for(const g in m)this._coordsDescendingInv[a][g]||(this._coordsDescendingInv[a][g]=[]),this._coordsDescendingInv[a][g].push(m[g])}}this._coordsDescendingInvStr={};for(const a of e._order){const o=e._layers[a],c=o.source;if(Es[o.type]&&!this._coordsDescendingInvStr[c]){this._coordsDescendingInvStr[c]={};for(const m in this._coordsDescendingInv[c])this._coordsDescendingInvStr[c][m]=this._coordsDescendingInv[c][m].map((g=>g.key)).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsDescendingInvStr){const c=this._coordsDescendingInvStr[o][a.tileID.key];c&&c!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const s=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Es[s]&&(this._prevType&&Es[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(Es[this._prevType]||Es[s]&&o){this._prevType=s;const c=this._stacks.length-1,m=this._stacks[c]||[];for(const g of this._renderableTiles){if(this.pool.isFull()&&(sl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[c]){const b=this.pool.getObjectForId(g.rtt[c].id);if(b.stamp===g.rtt[c].stamp){this.pool.useObject(b);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[c]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:p.aM.transparent,stencil:0}),a.currentStencilSource=void 0;for(let b=0;b<m.length;b++){const T=a.style._layers[m[b]],S=T.source?this._coordsDescendingInv[T.source][g.tileID.key]:[g.tileID];a.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),a._renderTileClippingMasks(T,S),a.renderLayer(a,a.style.sourceCaches[T.source],T,S),T.source&&(g.rttCoords[T.source]=this._coordsDescendingInvStr[T.source][g.tileID.key])}}return sl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Es[s]}return!1}}const po={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},pl=zi,lc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:ks,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:p.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},fo=h=>{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},cc={showCompass:!0,showZoom:!0,visualizePitch:!1};class hc{constructor(e,s,a=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ne.mousePos(this.element,m)),ne.addEventListener(window,"mousemove",this.mousemove),ne.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ne.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ne.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ne.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ne.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const o=e.dragRotate._mouseRotate.getClickTolerance(),c=e.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=eo({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{const b=new Qa;return new gr({clickTolerance:g,move:(T,S)=>({bearingDelta:(S.x-T.x)*y}),moveStateManager:b,enable:m,assignEvents:fo})})({clickTolerance:o,enable:!0}),this.map=e,a&&(this.mousePitch=to({clickTolerance:c,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{const b=new Qa;return new gr({clickTolerance:g,move:(T,S)=>({pitchDelta:(S.y-T.y)*y}),moveStateManager:b,enable:m,assignEvents:fo})})({clickTolerance:c,enable:!0})),ne.addEventListener(s,"mousedown",this.mousedown),ne.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),ne.addEventListener(s,"touchcancel",this.reset)}startMouse(e,s){this.mouseRotate.dragStart(e,s),this.mousePitch&&this.mousePitch.dragStart(e,s),ne.disableDrag()}startTouch(e,s){this.touchRotate.dragStart(e,s),this.touchPitch&&this.touchPitch.dragStart(e,s),ne.disableDrag()}moveMouse(e,s){const a=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){const{pitchDelta:c}=this.mousePitch.dragMove(e,s)||{};c&&a.setPitch(a.getPitch()+c)}}moveTouch(e,s){const a=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.touchPitch){const{pitchDelta:c}=this.touchPitch.dragMove(e,s)||{};c&&a.setPitch(a.getPitch()+c)}}off(){const e=this.element;ne.removeEventListener(e,"mousedown",this.mousedown),ne.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend),ne.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ne.enableDrag(),ne.removeEventListener(window,"mousemove",this.mousemove),ne.removeEventListener(window,"mouseup",this.mouseup),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend)}}let _i;function dt(h,e,s){const a=new p.N(h.lng,h.lat);if(h=new p.N(h.lng,h.lat),e){const o=new p.N(h.lng-360,h.lat),c=new p.N(h.lng+360,h.lat),m=s.locationPoint(h).distSqr(e);s.locationPoint(o).distSqr(e)<m?h=o:s.locationPoint(c).distSqr(e)<m&&(h=c)}for(;Math.abs(h.lng-s.center.lng)>180;){const o=s.locationPoint(h);if(o.x>=0&&o.y>=0&&o.x<=s.width&&o.y<=s.height)break;h.lng>s.center.lng?h.lng-=360:h.lng+=360}return h.lng!==a.lng&&s.locationPoint(h).y>s.height/2-s.getHorizon()?h:a}const Ds={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ia(h,e,s){const a=h.classList;for(const o in Ds)a.remove(`maplibregl-${s}-anchor-${o}`);a.add(`maplibregl-${s}-anchor-${e}`)}class ra extends p.E{constructor(e){if(super(),this._onKeyPress=s=>{const a=s.code,o=s.charCode||s.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=s=>{const a=s.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=s=>{var a;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();((s==null?void 0:s.type)==="terrain"||(s==null?void 0:s.type)==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?dt(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||s&&s.type!=="moveend"||(this._pos=this._pos.round()),ne.setTransform(this._element,`${Ds[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${c}`),me.frameAsync(new AbortController).then((()=>{this._updateOpacity(s&&s.type==="moveend")})).catch((()=>{}))},this._onMove=s=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=s.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new p.k("dragstart"))),this.fire(new p.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new p.k("dragend")),this._state="inactive"},this._addDragHandler=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ne.create("div");const s=ne.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${a}px`),s.setAttributeNS(null,"width",`${o}px`),s.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const c=ne.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"stroke","none"),c.setAttributeNS(null,"stroke-width","1"),c.setAttributeNS(null,"fill","none"),c.setAttributeNS(null,"fill-rule","evenodd");const m=ne.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const g=ne.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const $ of y){const Z=ne.createNS("http://www.w3.org/2000/svg","ellipse");Z.setAttributeNS(null,"opacity","0.04"),Z.setAttributeNS(null,"cx","10.5"),Z.setAttributeNS(null,"cy","5.80029008"),Z.setAttributeNS(null,"rx",$.rx),Z.setAttributeNS(null,"ry",$.ry),g.appendChild(Z)}const b=ne.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const T=ne.createNS("http://www.w3.org/2000/svg","path");T.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(T);const S=ne.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");const C=ne.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),S.appendChild(C);const E=ne.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(6.0, 7.0)"),E.setAttributeNS(null,"fill","#FFFFFF");const R=ne.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=ne.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const U=ne.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),R.appendChild(V),R.appendChild(U),m.appendChild(g),m.appendChild(b),m.appendChild(S),m.appendChild(E),m.appendChild(R),s.appendChild(m),s.setAttributeNS(null,"height",a*this._scale+"px"),s.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(s),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(s=>{s.preventDefault()})),this._element.addEventListener("mousedown",(s=>{s.preventDefault()})),ia(this._element,this._anchor,"marker"),e&&e.className)for(const s of e.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ne.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var s,a;if(!(!((s=this._map)===null||s===void 0)&&s.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const o=this._map,c=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-c<.006)return void(this._element.style.opacity=this._opacity);const g=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*g,b=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,s){return e===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}const fl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let mn=0,_n=!1;const ar={maxWidth:100,unit:"metric"};function gn(h,e,s){const a=s&&s.maxWidth||100,o=h._container.clientHeight/2,c=h.unproject([0,o]),m=h.unproject([a,o]),g=c.distanceTo(m);if(s&&s.unit==="imperial"){const y=3.2808*g;y>5280?Ae(e,a,y/5280,h._getUIString("ScaleControl.Miles")):Ae(e,a,y,h._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?Ae(e,a,g/1852,h._getUIString("ScaleControl.NauticalMiles")):g>=1e3?Ae(e,a,g/1e3,h._getUIString("ScaleControl.Kilometers")):Ae(e,a,g,h._getUIString("ScaleControl.Meters"))}function Ae(h,e,s,a){const o=(function(c){const m=Math.pow(10,`${Math.floor(c)}`.length-1);let g=c/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:(function(y){const b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b})(g),m*g})(s);h.style.width=e*(o/s)+"px",h.innerHTML=`${o}&nbsp;${a}`}const Re={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},sa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function na(h){if(h){if(typeof h=="number"){const e=Math.round(Math.abs(h)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,h),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-h),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(h,0),right:new p.P(-h,0)}}if(h instanceof p.P||Array.isArray(h)){const e=p.P.convert(h);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(h.center||[0,0]),top:p.P.convert(h.top||[0,0]),"top-left":p.P.convert(h["top-left"]||[0,0]),"top-right":p.P.convert(h["top-right"]||[0,0]),bottom:p.P.convert(h.bottom||[0,0]),"bottom-left":p.P.convert(h["bottom-left"]||[0,0]),"bottom-right":p.P.convert(h["bottom-right"]||[0,0]),left:p.P.convert(h.left||[0,0]),right:p.P.convert(h.right||[0,0])}}return na(new p.P(0,0))}const mo=zi;L.AJAXError=p.bh,L.Evented=p.E,L.LngLat=p.N,L.MercatorCoordinate=p.Z,L.Point=p.P,L.addProtocol=p.bi,L.config=p.a,L.removeProtocol=p.bj,L.AttributionControl=zs,L.BoxZoomHandler=mi,L.CanvasSource=bi,L.CooperativeGesturesHandler=Cs,L.DoubleClickZoomHandler=ts,L.DragPanHandler=cl,L.DragRotateHandler=hl,L.EdgeInsets=Is,L.FullscreenControl=class extends p.E{constructor(h={}){super(),this._onFullscreenChange=()=>{var e;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=s==null?void 0:s.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:p.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ne.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=ne.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ne.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},L.GeoJSONSource=Ks,L.GeolocateControl=class extends p.E{constructor(h){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const s=new p.N(e.coords.longitude,e.coords.latitude),a=e.coords.accuracy,o=this._map.getBearing(),c=p.e({bearing:o},this.options.fitBoundsOptions),m=ie.fromLngLat(s,a);this._map.fitBounds(m,c,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const s=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&_n)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=ne.create("button","maplibregl-ctrl-geolocate",this._container),ne.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ne.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ra({element:this._dotElement}),this._circleElement=ne.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ra({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))}))}},this.options=p.e({},fl,h)}onAdd(h){return this._map=h,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return p._(this,arguments,void 0,(function*(e=!1){if(_i!==void 0&&!e)return _i;if(window.navigator.permissions===void 0)return _i=!!window.navigator.geolocation,_i;try{_i=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_i=!!window.navigator.geolocation}return _i}))})().then((e=>this._finishSetupUI(e))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ne.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,mn=0,_n=!1}_isOutOfMapMaxBounds(h){const e=this._map.getMaxBounds(),s=h.coords;return e&&(s.longitude<e.getWest()||s.longitude>e.getEast()||s.latitude<e.getSouth()||s.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),e=h.getSouthEast(),s=h.getNorthEast(),a=e.distanceTo(s),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mn--,_n=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new p.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new p.k("trackuserlocationstart")),this.fire(new p.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mn++,mn>1?(h={maximumAge:6e5,timeout:0},_n=!0):(h=this.options.positionOptions,_n=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},L.Hash=Hn,L.ImageSource=fr,L.KeyboardHandler=Si,L.LngLatBounds=ie,L.LogoControl=co,L.Map=class extends ul{constructor(h){p.bf.mark(p.bg.create);const e=Object.assign(Object.assign({},lc),h);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ps(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Xe,this._controls=[],this._mapId=p.a4(),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},po),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=hi.addThrottleControl((()=>this.isMoving())),this._requestManager=new Ia(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))).on("moveend",(()=>this._update(!1))).on("zoom",(()=>this._update(!0))).on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})).once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const a=hn((o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())}),50);this._resizeObserver=new ResizeObserver((o=>{s?a(o):s=!0})),this._resizeObserver.observe(this._container)}this.handlers=new lo(this,e),this._hash=e.hash&&new Hn(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new zs(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new co,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(s=>{this._update(s.dataType==="style"),this.fire(new p.k(`${s.dataType}data`,s))})),this.on("dataloading",(s=>{this.fire(new p.k(`${s.dataType}dataloading`,s))})),this.on("dataabort",(s=>{this.fire(new p.k("sourcedataabort",s))}))}_getMapId(){return this._mapId}addControl(h,e){if(e===void 0&&(e=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const s=h.onAdd(this);this._controls.push(h);const a=this._controlPositions[e];return e.indexOf("bottom")!==-1?a.insertBefore(s,a.firstChild):a.appendChild(s),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(h);return e>-1&&this._controls.splice(e,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,e,s,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,e,s,a)}resize(h){var e;const s=this._containerDimensions(),a=s[0],o=s[1],c=this._getClampedPixelRatio(a,o);if(this._resizeCanvas(a,o,c),this.painter.resize(a,o,c),this.painter.overLimit()){const g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];const y=this._getClampedPixelRatio(a,o);this._resizeCanvas(a,o,y),this.painter.resize(a,o,y)}this.transform.resize(a,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(a,o);const m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",h)).fire(new p.k("move",h))),this.fire(new p.k("resize",h)),m&&this.fire(new p.k("moveend",h)),this}_getClampedPixelRatio(h,e){const{0:s,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),c=h*o,m=e*o;return Math.min(c>s?s/c:1,m>a?a/m:1)*o}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(ie.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()<h&&this.setZoom(h),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()<h&&this.setPitch(h),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}project(h){return this.transform.locationPoint(p.N.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(p.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,e,s){if(h==="mouseenter"||h==="mouseover"){let a=!1;return{layers:e,listener:s,delegates:{mousemove:c=>{const m=e.filter((y=>this.getLayer(y))),g=m.length!==0?this.queryRenderedFeatures(c.point,{layers:m}):[];g.length?a||(a=!0,s.call(this,new Ot(h,this,c.originalEvent,{features:g}))):a=!1},mouseout:()=>{a=!1}}}}if(h==="mouseleave"||h==="mouseout"){let a=!1;return{layers:e,listener:s,delegates:{mousemove:m=>{const g=e.filter((y=>this.getLayer(y)));(g.length!==0?this.queryRenderedFeatures(m.point,{layers:g}):[]).length?a=!0:a&&(a=!1,s.call(this,new Ot(h,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,s.call(this,new Ot(h,this,m.originalEvent)))}}}}{const a=o=>{const c=e.filter((g=>this.getLayer(g))),m=c.length!==0?this.queryRenderedFeatures(o.point,{layers:c}):[];m.length&&(o.features=m,s.call(this,o),delete o.features)};return{layers:e,listener:s,delegates:{[h]:a}}}}_saveDelegatedListener(h,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(e)}_removeDelegatedListener(h,e,s){if(!this._delegatedListeners||!this._delegatedListeners[h])return;const a=this._delegatedListeners[h];for(let o=0;o<a.length;o++){const c=a[o];if(c.listener===s&&c.layers.length===e.length&&c.layers.every((m=>e.includes(m)))){for(const m in c.delegates)this.off(m,c.delegates[m]);return void a.splice(o,1)}}}on(h,e,s){if(s===void 0)return super.on(h,e);const a=this._createDelegatedListener(h,typeof e=="string"?[e]:e,s);this._saveDelegatedListener(h,a);for(const o in a.delegates)this.on(o,a.delegates[o]);return this}once(h,e,s){if(s===void 0)return super.once(h,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(h,a,s);for(const c in o.delegates){const m=o.delegates[c];o.delegates[c]=(...g)=>{this._removeDelegatedListener(h,a,s),m(...g)}}this._saveDelegatedListener(h,o);for(const c in o.delegates)this.once(c,o.delegates[c]);return this}off(h,e,s){return s===void 0?super.off(h,e):(this._removeDelegatedListener(h,typeof e=="string"?[e]:e,s),this)}queryRenderedFeatures(h,e){if(!this.style)return[];let s;const a=h instanceof p.P||Array.isArray(h),o=a?h:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(a?{}:h)||{},o instanceof p.P||typeof o[0]=="number")s=[p.P.convert(o)];else{const c=p.P.convert(o[0]),m=p.P.convert(o[1]);s=[c,new p.P(m.x,c.y),m,new p.P(c.x,m.y),c]}return this.style.queryRenderedFeatures(s,e,this.transform)}querySourceFeatures(h,e){return this.style.querySourceFeatures(h,e)}setStyle(h,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(h,e))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const e=this._locale[h];if(e==null)throw new Error(`Missing UI string '${h}'`);return e}_updateStyle(h,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(h,e)));const s=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new kn(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,e,s):this.style.loadJSON(h,e,s),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new kn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,e){if(typeof h=="string"){const s=this._requestManager.transformRequest(h,"Style");p.h(s,new AbortController).then((a=>{this._updateDiff(a.data,e)})).catch((a=>{a&&this.fire(new p.j(a))}))}else typeof h=="object"&&this._updateDiff(h,e)}_updateDiff(h,e){try{this.style.setState(h,e)&&this._update(!0)}catch(s){p.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(h,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(h,e){return this._lazyInitEmptyStyle(),this.style.addSource(h,e),this._update(!0)}isSourceLoaded(h){const e=this.style&&this.style.sourceCaches[h];if(e!==void 0)return e.loaded();this.fire(new p.j(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const e=this.style.sourceCaches[h.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain===null&&e.reload();for(const s in this.style._layers){const a=this.style._layers[s];a.type==="hillshade"&&a.source===h.source&&p.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new uo(this.painter,e,h),this.painter.renderToTexture=new dl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.sourceId!==h.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(s.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:h})),this}getTerrain(){var h,e;return(e=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const e in h){const s=h[e]._tiles;for(const a in s){const o=s[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,e,s={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:c,stretchY:m,content:g,textFitWidth:y,textFitHeight:b}=s;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:T,height:S,data:C}=e,E=e;return this.style.addImage(h,{data:new p.R({width:T,height:S},new Uint8Array(C)),pixelRatio:a,stretchX:c,stretchY:m,content:g,textFitWidth:y,textFitHeight:b,sdf:o,version:0,userImage:E}),E.onAdd&&E.onAdd(this,h),this}}{const{width:T,height:S,data:C}=me.getImageData(e);this.style.addImage(h,{data:new p.R({width:T,height:S},C),pixelRatio:a,stretchX:c,stretchY:m,content:g,textFitWidth:y,textFitHeight:b,sdf:o,version:0})}}updateImage(h,e){const s=this.style.getImage(h);if(!s)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=e instanceof HTMLImageElement||p.b(e)?me.getImageData(e):e,{width:o,height:c,data:m}=a;if(o===void 0||c===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==s.data.width||c!==s.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const g=!(e instanceof HTMLImageElement||p.b(e));return s.data.replace(m,g),this.style.updateImage(h,s),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return hi.getImage(this._requestManager.transformRequest(h,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(h,e){return this._lazyInitEmptyStyle(),this.style.addLayer(h,e),this._update(!0)}moveLayer(h,e){return this.style.moveLayer(h,e),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,e,s){return this.style.setLayerZoomRange(h,e,s),this._update(!0)}setFilter(h,e,s={}){return this.style.setFilter(h,e,s),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,e,s,a={}){return this.style.setPaintProperty(h,e,s,a),this._update(!0)}getPaintProperty(h,e){return this.style.getPaintProperty(h,e)}setLayoutProperty(h,e,s,a={}){return this.style.setLayoutProperty(h,e,s,a),this._update(!0)}getLayoutProperty(h,e){return this.style.getLayoutProperty(h,e)}setGlyphs(h,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,e,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,e,s,(a=>{a||this._update(!0)})),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,e,(s=>{s||this._update(!0)})),this}setLight(h,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(h){return this._lazyInitEmptyStyle(),this.style.setSky(h),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(h,e){return this.style.setFeatureState(h,e),this._update()}removeFeatureState(h,e){return this.style.removeFeatureState(h,e),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,e=0;return this._container&&(h=this._container.clientWidth||400,e=this._container.clientHeight||300),[h,e]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const e=this._canvasContainer=ne.create("div","maplibregl-canvas-container",h);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ne.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const s=this._containerDimensions(),a=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],a);const o=this._controlContainer=ne.create("div","maplibregl-control-container",h),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((m=>{c[m]=ne.create("div",`maplibregl-ctrl-${m} `,o)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,e,s){this._canvas.width=Math.floor(s*h),this._canvas.height=Math.floor(s*e),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(a=>{e={requestedAttributes:h},a&&(e.statusMessage=a.statusMessage,e.type=a.type)}),{once:!0});const s=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!s){const a="Failed to initialize WebGL";throw e?(e.message=a,new Error(JSON.stringify(e))):new Error(a)}this.painter=new Gn(s,this.transform),Vr.testSupport(s)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){const e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const o=this.transform.zoom,c=me.now();this.style.zoomHistory.update(o,c);const m=new p.z(o,{now:c,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(s=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,p.bf.mark(p.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const s of this._controls)s.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),hi.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ne.remove(this._canvasContainer),ne.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then((h=>{p.bf.frame(h),this._frameRequest=null,this._render(h)})).catch((()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return pl}getCameraTargetElevation(){return this.transform.elevation}},L.MapMouseEvent=Ot,L.MapTouchEvent=Qr,L.MapWheelEvent=al,L.Marker=ra,L.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const e=this._map.getZoom(),s=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,s)=>{const a=this._map._getUIString(`NavigationControl.${s}`);e.title=a,e.setAttribute("aria-label",a)},this.options=p.e({},cc,h),this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),ne.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),ne.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=ne.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new hc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ne.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,e){const s=ne.create("button",h,this._container);return s.type="button",s.addEventListener("click",e),s}},L.Popup=class extends p.E{constructor(h){super(),this.remove=()=>(this._content&&ne.remove(this._content),this._container&&(ne.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ne.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ne.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const g of this.options.className.split(" "))this._container.classList.add(g);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?dt(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._trackPointer&&!e)return;const a=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor;const c=na(this.options.offset);if(!o){const g=this._container.offsetWidth,y=this._container.offsetHeight;let b;b=a.y+c.bottom.y<y?["top"]:a.y>this._map.transform.height-y?["bottom"]:[],a.x<g/2?b.push("left"):a.x>this._map.transform.width-g/2&&b.push("right"),o=b.length===0?"bottom":b.join("-")}let m=a.add(c[o]);this.options.subpixelPositioning||(m=m.round()),ne.setTransform(this._container,`${Ds[o]} translate(${m.x}px,${m.y}px)`),ia(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(Re),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=p.N.convert(h),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const e=document.createDocumentFragment(),s=document.createElement("body");let a;for(s.innerHTML=h;a=s.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ne.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}_createCloseButton(){this.options.closeButton&&(this._closeButton=ne.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(sa);h&&h.focus()}},L.RasterDEMTileSource=yt,L.RasterTileSource=et,L.ScaleControl=class{constructor(h){this._onMove=()=>{gn(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,gn(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ar),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ne.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},L.ScrollZoomHandler=Ni,L.Style=kn,L.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=h}onAdd(h){return this._map=h,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ne.create("button","maplibregl-ctrl-terrain",this._container),ne.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){ne.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},L.TwoFingersTouchPitchHandler=Ms,L.TwoFingersTouchRotateHandler=no,L.TwoFingersTouchZoomHandler=ro,L.TwoFingersTouchZoomRotateHandler=oo,L.VectorTileSource=Ws,L.VideoSource=us,L.addSourceType=(h,e)=>p._(void 0,void 0,void 0,(function*(){if(Ys(h))throw new Error(`A source type called "${h}" already exists.`);((s,a)=>{Js[s]=a})(h,e)})),L.clearPrewarmedResources=function(){const h=ui;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Tr),ui=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},L.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},L.getRTLTextPluginStatus=function(){return tr().getRTLTextPluginStatus()},L.getVersion=function(){return mo},L.getWorkerCount=function(){return Qi.workerCount},L.getWorkerUrl=function(){return p.a.WORKER_URL},L.importScriptInWorkers=function(h){return Xs().broadcast("IS",h)},L.prewarm=function(){jr().acquire(Tr)},L.setMaxParallelImageRequests=function(h){p.a.MAX_PARALLEL_IMAGE_REQUESTS=h},L.setRTLTextPlugin=function(h,e){return tr().setRTLTextPlugin(h,e)},L.setWorkerCount=function(h){Qi.workerCount=h},L.setWorkerUrl=function(h){p.a.WORKER_URL=h}}));var Sa=Fr;return Sa}))})(Ro,Ro.exports)),Ro.exports}var Vu=Rp();const Bp=Ep.getDefaultExportFromCjs(Vu),Fp=Dp({__proto__:null,default:Bp},[Vu]);exports.maplibreGl=Fp;