@geolonia/embed 5.0.3 → 5.2.1

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 (66) hide show
  1. package/.github/workflows/build.yml +9 -4
  2. package/.vscode/settings.json +27 -0
  3. package/CHANGELOG.md +9 -0
  4. package/README.md +71 -2
  5. package/dist/embed +1 -1
  6. package/dist/embed-chunks/12cbd0d1cb4cf744c32f.js +2 -0
  7. package/dist/embed-chunks/1492645e3d07fd3de940.js +1 -0
  8. package/dist/embed-chunks/8a521e8312a5b4da123d.js +2 -0
  9. package/dist/embed-chunks/8a521e8312a5b4da123d.js.LICENSE.txt +6 -0
  10. package/dist/embed-core.d.ts +14 -0
  11. package/dist/embed-core.js +2 -0
  12. package/dist/embed-core.js.LICENSE.txt +4 -0
  13. package/dist/{src/embed.d.ts → embed.d.ts} +2 -37
  14. package/dist/embed.js +1 -1
  15. package/dist/embed.js.LICENSE.txt +1 -1
  16. package/dist/lib/keyring.d.ts +45 -0
  17. package/dist/{src/lib → lib}/parse-atts.d.ts +1 -1
  18. package/dist/{src/lib → lib}/simplestyle.d.ts +2 -0
  19. package/dist/{src/lib → lib}/util.d.ts +3 -3
  20. package/dist/types.d.ts +38 -0
  21. package/dist/version.d.ts +1 -0
  22. package/e2e/basic.spec.ts +6 -1
  23. package/e2e/external-style.spec.ts +25 -0
  24. package/e2e/map.spec.ts +12 -12
  25. package/package.json +15 -8
  26. package/src/embed-core.ts +22 -0
  27. package/src/embed.ts +2 -42
  28. package/src/lib/geolonia-map.ts +4 -3
  29. package/src/lib/geolonia-marker.ts +1 -1
  30. package/src/lib/keyring.test.ts +58 -15
  31. package/src/lib/keyring.ts +53 -1
  32. package/src/lib/parse-atts.test.ts +2 -2
  33. package/src/lib/parse-atts.ts +5 -1
  34. package/src/lib/render.ts +1 -1
  35. package/src/lib/simplestyle.test.ts +94 -56
  36. package/src/lib/simplestyle.ts +75 -17
  37. package/src/lib/util.test.ts +136 -96
  38. package/src/lib/util.ts +55 -10
  39. package/src/testability.test.ts +13 -10
  40. package/src/types.ts +44 -0
  41. package/tsconfig.build.json +9 -0
  42. package/tsconfig.json +1 -0
  43. package/vitest.config.ts +8 -0
  44. package/webpack.config.js +45 -14
  45. package/.mocharc.js +0 -9
  46. package/dist/e2e/basic.spec.d.ts +0 -8
  47. package/dist/e2e/helper.d.ts +0 -4
  48. package/dist/e2e/map.spec.d.ts +0 -1
  49. package/dist/embed-chunks/2489af4328c51b71e92d.js +0 -2
  50. package/dist/playwright.config.d.ts +0 -9
  51. package/dist/src/lib/keyring.d.ts +0 -29
  52. package/dist/src/lib/keyring.test.d.ts +0 -1
  53. package/dist/src/lib/parse-atts.test.d.ts +0 -1
  54. package/dist/src/lib/simplestyle.test.d.ts +0 -1
  55. package/dist/src/lib/util.test.d.ts +0 -1
  56. package/dist/src/testability.test.d.ts +0 -1
  57. package/dist/src/version.d.ts +0 -1
  58. /package/dist/embed-chunks/{2489af4328c51b71e92d.js.LICENSE.txt → 12cbd0d1cb4cf744c32f.js.LICENSE.txt} +0 -0
  59. /package/dist/{src/lib → lib}/CustomAttributionControl.d.ts +0 -0
  60. /package/dist/{src/lib → lib}/controls/geolonia-control.d.ts +0 -0
  61. /package/dist/{src/lib → lib}/geolonia-map.d.ts +0 -0
  62. /package/dist/{src/lib → lib}/geolonia-marker.d.ts +0 -0
  63. /package/dist/{src/lib → lib}/maplibre-util.d.ts +0 -0
  64. /package/dist/{src/lib → lib}/render.d.ts +0 -0
  65. /package/dist/{src/lib → lib}/simplestyle-vector.d.ts +0 -0
  66. /package/dist/{src/types-internal.d.ts → types-internal.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see embed-core.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.geoloniaEmbedCore=e():t.geoloniaEmbedCore=e()}(self,()=>(()=>{var t,e,r,i,n={34:(t,e,r)=>{"use strict";var i=r(9600),n=r(9957),o=r(4462)(),a=r(6556),s=a("Function.prototype.toString"),l=a("String.prototype.match"),c=a("Object.prototype.toString"),u=/^class /,h=/\s*function\s+([^(\s]*)\s*/,p=!(0 in[,]),d=Function.prototype,f=function(){return!1};if("object"==typeof document){var m=document.all;c(m)===c(document.all)&&(f=function(t){if((p||!t)&&(void 0===t||"object"==typeof t))try{var e=c(t);return("[object HTMLAllCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=function(){if(f(this)||!function(t){if(i(t))return!1;if("function"!=typeof t)return!1;try{return!!l(s(t),u)}catch(t){}return!1}(this)&&!i(this))throw new TypeError("Function.prototype.name sham getter called on non-function");if(o&&n(this,"name"))return this.name;if(this===d)return"";var t=s(this),e=l(t,h);return e&&e[1]}},41:(t,e,r)=>{"use strict";var i=r(655),n=r(8068),o=r(9675),a=r(5795);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new o("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],h=!!a&&a(t,e);if(i)i(t,e,{configurable:null===c&&h?h.configurable:!c,enumerable:null===s&&h?h.enumerable:!s,value:r,writable:null===l&&h?h.writable:!l});else{if(!u&&(s||l||c))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},76:t=>{"use strict";t.exports=Function.prototype.call},113:(t,e,r)=>{"use strict";t.exports=r(1350)},122:t=>{"use strict";t.exports=function(t,e,r){var i=t(e,r);return i>=0?i:i+r}},162:t=>{"use strict";t.exports=function(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},172:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,65536);return 0===s?0:s}},214:(t,e,r)=>{"use strict";var i=r(487),n=r(8452),o=r(5388),a=r(8206),s=r(4895),l=r(9377),c=i(s()),u=function(t){return o(t),c(t)};n(u,{getPolyfill:s,implementation:a,shim:l}),t.exports=u},216:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},256:t=>{"use strict";var e,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;i||(e=function(t){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;e||o||(e=function(t){return!1}),t.exports=e||function(t){if(!t||"object"!=typeof t)return!1;try{if(o.call(t),n)try{n.call(t)}catch(t){return!0}return t instanceof i}catch(t){}return!1}},259:(t,e,r)=>{"use strict";var i=r(9957),n=r(9675),o=r(6537),a=r(6966),s=r(4323);t.exports=function(t){if(!o(t))throw new n("ToPropertyDescriptor requires an object");var e={};if(i(t,"enumerable")&&(e["[[Enumerable]]"]=s(t.enumerable)),i(t,"configurable")&&(e["[[Configurable]]"]=s(t.configurable)),i(t,"value")&&(e["[[Value]]"]=t.value),i(t,"writable")&&(e["[[Writable]]"]=s(t.writable)),i(t,"get")){var r=t.get;if(void 0!==r&&!a(r))throw new n("getter must be a function");e["[[Get]]"]=r}if(i(t,"set")){var l=t.set;if(void 0!==l&&!a(l))throw new n("setter must be a function");e["[[Set]]"]=l}if((i(e,"[[Get]]")||i(e,"[[Set]]"))&&(i(e,"[[Value]]")||i(e,"[[Writable]]")))throw new n("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e}},280:(t,e,r)=>{"use strict";var i=r(9675),n=r(8859),o=r(3541),a=r(6537);t.exports=function(t,e){if(!a(t))throw new i("Assertion failed: Type(O) is not Object");if(!o(e))throw new i("Assertion failed: P is not a Property Key, got "+n(e));return t[e]}},414:t=>{"use strict";t.exports=Math.round},453:(t,e,r)=>{"use strict";var i,n=r(9612),o=r(9383),a=r(1237),s=r(9290),l=r(9538),c=r(8068),u=r(9675),h=r(5345),p=r(1514),d=r(8968),f=r(6188),m=r(8002),g=r(5880),_=r(414),y=r(3093),v=Function,b=function(t){try{return v('"use strict"; return ('+t+").constructor;")()}catch(t){}},x=r(5795),w=r(655),T=function(){throw new u},S=x?function(){try{return T}catch(t){try{return x(arguments,"callee").get}catch(t){return T}}}():T,P=r(4039)(),M=r(3628),A=r(1064),E=r(8648),I=r(1002),C=r(76),D={},z="undefined"!=typeof Uint8Array&&M?M(Uint8Array):i,k={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":P&&M?M([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":D,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P&&M?M(M([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P&&M?M((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":n,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":s,"%ReferenceError%":l,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P&&M?M((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P&&M?M(""[Symbol.iterator]()):i,"%Symbol%":P?Symbol:i,"%SyntaxError%":c,"%ThrowTypeError%":S,"%TypedArray%":z,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":h,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":C,"%Function.prototype.apply%":I,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":A,"%Math.abs%":p,"%Math.floor%":d,"%Math.max%":f,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":_,"%Math.sign%":y,"%Reflect.getPrototypeOf%":E};if(M)try{null.error}catch(t){var R=M(M(t));k["%Error.prototype%"]=R}var L=function t(e){var r;if("%AsyncFunction%"===e)r=b("async function () {}");else if("%GeneratorFunction%"===e)r=b("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=b("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&M&&(r=M(n.prototype))}return k[e]=r,r},F={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},B=r(6743),O=r(9957),j=B.call(C,Array.prototype.concat),N=B.call(I,Array.prototype.splice),V=B.call(C,String.prototype.replace),U=B.call(C,String.prototype.slice),$=B.call(C,RegExp.prototype.exec),G=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,q=/\\(\\)?/g,Z=function(t,e){var r,i=t;if(O(F,i)&&(i="%"+(r=F[i])[0]+"%"),O(k,i)){var n=k[i];if(n===D&&(n=L(i)),void 0===n&&!e)throw new u("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new c("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new u('"allowMissing" argument must be a boolean');if(null===$(/^%?[^%]*%?$/,t))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=U(t,0,1),r=U(t,-1);if("%"===e&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new c("invalid intrinsic syntax, expected opening `%`");var i=[];return V(t,G,function(t,e,r,n){i[i.length]=r?V(n,q,"$1"):e||t}),i}(t),i=r.length>0?r[0]:"",n=Z("%"+i+"%",e),o=n.name,a=n.value,s=!1,l=n.alias;l&&(i=l[0],N(r,j([0,1],l)));for(var h=1,p=!0;h<r.length;h+=1){var d=r[h],f=U(d,0,1),m=U(d,-1);if(('"'===f||"'"===f||"`"===f||'"'===m||"'"===m||"`"===m)&&f!==m)throw new c("property names with quotes must have matching quotes");if("constructor"!==d&&p||(s=!0),O(k,o="%"+(i+="."+d)+"%"))a=k[o];else if(null!=a){if(!(d in a)){if(!e)throw new u("base intrinsic for "+t+" exists, but the property is not available.");return}if(x&&h+1>=r.length){var g=x(a,d);a=(p=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[d]}else p=O(a,d),a=a[d];p&&!s&&(k[o]=a)}}return a}},487:(t,e,r)=>{"use strict";var i=r(6897),n=r(655),o=r(3126),a=r(2205);t.exports=function(t){var e=o(arguments),r=t.length-(arguments.length-1);return i(e,1+(r>0?r:0),!0)},n?n(t.exports,"apply",{value:a}):t.exports.apply=a},533:(t,e,r)=>{"use strict";t.exports=r(1412)},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},557:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},592:(t,e,r)=>{"use strict";var i=r(655),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(t){return!0}},t.exports=n},593:(t,e,r)=>{"use strict";var i=r(3802),n=r(256),o=r(7842),a=r(2648);t.exports=function(t){if(t&&"object"==typeof t){if(i(t))return"Map";if(n(t))return"Set";if(o(t))return"WeakMap";if(a(t))return"WeakSet"}return!1}},655:t=>{"use strict";var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},866:(t,e,r)=>{"use strict";var i=r(5437);t.exports=function(t){return arguments.length>1?i(t,arguments[1]):i(t)}},893:(t,e,r)=>{"use strict";var i=r(9675),n=r(6537),o=r(5701),a=r(4769),s=r(7030),l=r(8131),c=r(3541),u=r(2875),h=r(259);t.exports=function(t,e,r){if(!n(t))throw new i("Assertion failed: Type(O) is not Object");if(!c(e))throw new i("Assertion failed: P is not a Property Key");var p=o(r)?r:h(r);if(!o(p))throw new i("Assertion failed: Desc is not a valid Property Descriptor");return a(l,u,s,t,e,p)}},1002:t=>{"use strict";t.exports=Function.prototype.apply},1064:(t,e,r)=>{"use strict";var i=r(9612);t.exports=i.getPrototypeOf||null},1087:(t,e,r)=>{"use strict";t.exports=r(7440)},1093:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),i}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},1189:(t,e,r)=>{"use strict";var i=Array.prototype.slice,n=r(1093),o=Object.keys,a=o?function(t){return o(t)}:r(8875),s=Object.keys;a.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return n(t)?s(i.call(t)):s(t)})}else Object.keys=a;return Object.keys||a},t.exports=a},1208:(t,e,r)=>{"use strict";r.d(e,{A:()=>s});var i=r(1601),n=r.n(i),o=r(6314),a=r.n(o)()(n());a.push([t.id,'.geolonia-clickable-marker {\n cursor: pointer;\n}\n\n/* Make fullscreen mode works with ie11 */\n.geolonia:-ms-fullscreen {\n width: 100%;\n height: 100%;\n}\n\n/**\n * Styles for loading effect.\n */\n.loading-geolonia-map {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.5);\n z-index: 9999;\n justify-content: center;\n align-items: center;\n display: flex;\n}\n\n.loading-geolonia-map .lds-grid {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n}\n\n.loading-geolonia-map .lds-grid div {\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: #999999;\n animation: lds-grid 1.2s linear infinite;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(1) {\n top: 8px;\n left: 8px;\n animation-delay: 0s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(2) {\n top: 8px;\n left: 32px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(3) {\n top: 8px;\n left: 56px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(4) {\n top: 32px;\n left: 8px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(5) {\n top: 32px;\n left: 32px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(6) {\n top: 32px;\n left: 56px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(7) {\n top: 56px;\n left: 8px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(8) {\n top: 56px;\n left: 32px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(9) {\n top: 56px;\n left: 56px;\n animation-delay: -1.6s;\n}\n\n@keyframes lds-grid {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Style for restricted mode */\n.geolonia__restricted-mode-image-container {\n background-image: url("https://geolonia.github.io/embed/restricted.jpg");\n background-position: center center;\n background-size: cover;\n}\n\n/* Style for error message */\n.geolonia__error-container {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n background-color: #dedede;\n z-index: 9999;\n position: absolute;\n}\n\n.geolonia__error-message {\n max-width: 300px;\n background-color: #ffffff;\n margin: 10px;\n padding: 0.75rem 1.25rem;\n border-radius: 6px;\n position: absolute;\n z-index: 99999;\n word-wrap: break-word;\n box-shadow: 0 4px 10px #0000001a\n}\n\n.geolonia__error-message-description {\n margin: 15px 0;\n}\n\n/* CSS for Attribution */\n/* Fix: https://github.com/geolonia/embed/issues/291 */\n.maplibregl-map {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib-inner {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner,\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button {\n display: block!important;\n}\n/* End: CSS for Attribution */\n\n@media print {\n .maplibregl-control-container button {\n display: none;\n }\n}\n',""]);const s=a},1237:t=>{"use strict";t.exports=EvalError},1333:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var i in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},1350:(t,e,r)=>{"use strict";var i=r(8968);t.exports=function(t,e){var r=t%e;return i(r>=0?r:r+e)}},1376:(t,e,r)=>{"use strict";t.exports=r(453)},1412:(t,e,r)=>{"use strict";var i=r(453)("%Array%"),n=!i.isArray&&r(6556)("Object.prototype.toString");t.exports=i.isArray||function(t){return"[object Array]"===n(t)}},1413:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z%27/%3E%3C/svg%3E"},1482:(t,e,r)=>{"use strict";var i=r(8452),n=r(487),o=r(34),a=r(2747),s=r(8013),l=n(o);i(l,{getPolyfill:a,implementation:o,shim:s}),t.exports=l},1509:(t,e,r)=>{"use strict";var i=r(9675),n=r(6537),o=r(5291),a=r(6681),s=r(5680);t.exports=function(t,e){if("SEQ-CST"!==e&&"UNORDERED"!==e)throw new i("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if(!n(t))throw new i("Assertion failed: `O` must be an Object");if(!s(t))throw new i("Assertion failed: `O` must be a Typed Array");var r=a(t,e);if(o(r))throw new i("`O` must be in-bounds and backed by a non-detached buffer");return r}},1514:t=>{"use strict";t.exports=Math.abs},1539:(t,e,r)=>{"use strict";var i=r(4761),n=r(1703),o=r(5128),a=r(3612),s=r(9803);t.exports=function(t){return null==t||"object"!=typeof t&&"function"!=typeof t?null:i(t)?"String":n(t)?"Number":o(t)?"Boolean":a(t)?"Symbol":s(t)?"BigInt":void 0}},1601:t=>{"use strict";t.exports=function(t){return t[1]}},1703:(t,e,r)=>{"use strict";var i=r(6556),n=i("Number.prototype.toString"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"number"==typeof t||!(!t||"object"!=typeof t)&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object Number]"===o(t))}},1907:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},2076:(t,e,r)=>{"use strict";var i=r(9675),n=r(6537),o=r(3541),a=r(2875),s=function(){try{return delete[].length,!0}catch(t){return!1}}();t.exports=function(t,e,r,l){if(!n(t))throw new i("Assertion failed: `O` must be an Object");if(!o(e))throw new i("Assertion failed: `P` must be a Property Key");if("boolean"!=typeof l)throw new i("Assertion failed: `Throw` must be a Boolean");if(l){if(t[e]=r,s&&!a(t[e],r))throw new i("Attempted to assign to readonly property.");return!0}try{return t[e]=r,!s||a(t[e],r)}catch(t){return!1}}},2120:(t,e,r)=>{"use strict";var i=r(6556),n=i("Date.prototype.getDay"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"object"==typeof t&&null!==t&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object Date]"===o(t))}},2138:(t,e,r)=>{"use strict";var i=r(453),n=r(8068),o=r(9675),a=r(7440),s=i("%Uint8Array%",!0),l=r(7881),c=r(5910),u=r(5015),h=r(4670),p=r(7070),d=r(9957),f=r(4097),m=r(5100),g=r(3795);t.exports=function(t,e,r,i,_,y){var v=p(t);if(!h(t)&&!v)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!a(e)||e<0)throw new o("Assertion failed: `byteIndex` must be a non-negative integer");if("string"!=typeof r||!d(f.size,"$"+r))throw new o("Assertion failed: `type` must be one of "+f.choices);if("number"!=typeof i&&"bigint"!=typeof i)throw new o("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof _)throw new o("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==y&&"UNORDERED"!==y&&"INIT"!==y)throw new o('Assertion failed: `order` must be `"SEQ-CST"`, `"UNORDERED"`, or `"INIT"`');if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("Assertion failed: `isLittleEndian` must be a boolean, if present");if(c(t))throw new o("Assertion failed: ArrayBuffer is detached");if(l(r)?"bigint"!=typeof i:"number"!=typeof i)throw new o("Assertion failed: `value` must be a BigInt if type is ~BIGINT64~ or ~BIGUINT64~, otherwise a Number");var b=f.size["$"+r],x=u(r,i,arguments.length>6?arguments[6]:"little"===m);if(v)throw new n("SharedArrayBuffer is not supported by this implementation");var w=new s(t,e,b);g(x,function(t,e){w[e]=t})}},2158:t=>{"use strict";t.exports=function(t){return"number"==typeof t&&t>=0&&t<=255&&(0|t)===t}},2205:(t,e,r)=>{"use strict";var i=r(6743),n=r(1002),o=r(3144);t.exports=function(){return o(i,n,arguments)}},2228:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},2308:(t,e,r)=>{"use strict";var i=r(2682),n=r(487),o=r(9897)(),a=r(9209)(),s={__proto__:null},l=r(5795),c=Object.defineProperty;if(l){var u=function(t){return t.byteOffset};i(a,function(t){if("function"==typeof r.g[t]||"object"==typeof r.g[t]){var e=r.g[t].prototype,i=l(e,"byteOffset");if(!i){var a=o(e);i=l(a,"byteOffset")}if(i&&i.get)s[t]=n(i.get);else if(c){var h=new r.g[t](2);(i=l(h,"byteOffset"))&&i.configurable&&c(h,"length",{value:3}),2===h.length&&(s[t]=u)}}})}var h=r(5680);t.exports=function(t){return!!h(t)&&function(t){var e;return i(s,function(r){if("number"!=typeof e)try{var i=r(t);"number"==typeof i&&(e=i)}catch(t){}}),e}(t)}},2353:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27none%27 stroke=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Ccircle cx=%2711%27 cy=%2711%27 r=%278.5%27/%3E%3Cpath d=%27M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z%27/%3E%3Cpath d=%27M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z%27/%3E%3Cpath d=%27M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z%27/%3E%3C/svg%3E"},2475:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331),s=4294967296;t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),l=i(r,s),c=l>=2147483648?l-s:l;return 0===c?0:c}},2491:(t,e,r)=>{"use strict";var i=r(9675),n=r(9957),o=r(6537),a=r(3541);t.exports=function(t,e){if(!o(t))throw new i("Assertion failed: `O` must be an Object");if(!a(e))throw new i("Assertion failed: `P` must be a Property Key");return n(t,e)}},2521:(t,e,r)=>{"use strict";var i=r(8268);t.exports=function(){return"function"==typeof Uint8Array&&Uint8Array.prototype.slice||i}},2634:()=>{},2648:(t,e,r)=>{"use strict";var i=r(453),n=r(6556),o=i("%WeakSet%",!0),a=n("WeakSet.prototype.has",!0);if(a){var s=n("WeakMap.prototype.has",!0);t.exports=function(t){if(!t||"object"!=typeof t)return!1;try{if(a(t,a),s)try{s(t,s)}catch(t){return!0}return t instanceof o}catch(t){}return!1}}else t.exports=function(t){return!1}},2682:(t,e,r)=>{"use strict";var i=r(9600),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!i(e))throw new TypeError("iterator must be a function");var a,s;arguments.length>=3&&(a=r),s=t,"[object Array]"===n.call(s)?function(t,e,r){for(var i=0,n=t.length;i<n;i++)o.call(t,i)&&(null==r?e(t[i],i,t):e.call(r,t[i],i,t))}(t,e,a):"string"==typeof t?function(t,e,r){for(var i=0,n=t.length;i<n;i++)null==r?e(t.charAt(i),i,t):e.call(r,t.charAt(i),i,t)}(t,e,a):function(t,e,r){for(var i in t)o.call(t,i)&&(null==r?e(t[i],i,t):e.call(r,t[i],i,t))}(t,e,a)}},2697:(t,e,r)=>{"use strict";var i=r(453),n={__proto__:null,$Int8Array:i("%Int8Array%",!0),$Uint8Array:i("%Uint8Array%",!0),$Uint8ClampedArray:i("%Uint8ClampedArray%",!0),$Int16Array:i("%Int16Array%",!0),$Uint16Array:i("%Uint16Array%",!0),$Int32Array:i("%Int32Array%",!0),$Uint32Array:i("%Uint32Array%",!0),$BigInt64Array:i("%BigInt64Array%",!0),$BigUint64Array:i("%BigUint64Array%",!0),$Float16Array:i("%Float16Array%",!0),$Float32Array:i("%Float32Array%",!0),$Float64Array:i("%Float64Array%",!0)};t.exports=function(t){return n["$"+t]}},2702:(t,e,r)=>{"use strict";t.exports=r(6537)},2747:(t,e,r)=>{"use strict";var i=r(34);t.exports=function(){return i}},2779:(t,e,r)=>{"use strict";var i=r(1514),n=r(8968),o=r(5880),a=r(3331),s=r(4459),l=r(8017);t.exports=function(t,e){if(s(t))return e?[0,0,192,127]:[127,192,0,0];var r;if(0===t)return r=l(t)?128:0,e?[0,0,0,r]:[r,0,0,0];if(i(t)>34028234663852886e22||!a(t))return r=t<0?255:127,e?[0,0,128,r]:[r,128,0,0];var c=t<0?1:0;t=i(t);for(var u=0;t>=2;)u+=1,t/=2;for(;t<1;)u-=1,t*=2;var h=t-1;h*=o(2,23)+.5,u+=127;var p=c<<31|(u<<=23)|(h=n(h)),d=255&p,f=255&(p>>=8),m=255&(p>>=8),g=255&(p>>=8);return e?[d,f,m,g]:[g,m,f,d]}},2792:(t,e,r)=>{"use strict";function i(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce(function(t,e){return t.concat(i(e))},[]),t;case"Feature":return t.geometry?i(t.geometry).map(function(e){var r={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(r.id=t.id),r}):[t];case"MultiPoint":return t.coordinates.map(function(t){return{type:"Point",coordinates:t}});case"MultiPolygon":return t.coordinates.map(function(t){return{type:"Polygon",coordinates:t}});case"MultiLineString":return t.coordinates.map(function(t){return{type:"LineString",coordinates:t}});case"GeometryCollection":return t.geometries.map(i).reduce(function(t,e){return t.concat(e)},[]);case"Point":case"Polygon":case"LineString":return[t]}}r.r(e),r.d(e,{default:()=>i})},2875:(t,e,r)=>{"use strict";var i=r(4459);t.exports=function(t,e){return t===e?0!==t||1/t==1/e:i(t)&&i(e)}},2905:(t,e,r)=>{var i=r(8186),n=r(2792),o=r(9883);n instanceof Function||(n=n.default),t.exports=function(t){if(!t)return[];var e=n(i(t)),r=[];return e.features.forEach(function(t){t.geometry&&(r=r.concat(o(t.geometry.coordinates)))}),r}},2964:(t,e,r)=>{"use strict";var i=r(453),n=i("%BigInt%",!0),o=i("%Number%"),a=r(9675),s=r(8068),l=r(9693),c=r(866);t.exports=function(t){if(!n)throw new s("BigInts are not supported in this environment");var e=c(t,o);if(null==e)throw new a("Cannot convert null or undefined to a BigInt");if("boolean"==typeof e)return n(e?1:0);if("number"==typeof e)throw new a("Cannot convert a Number value to a BigInt");if("string"==typeof e){var r=l(e);if(void 0===r)throw new a("Failed to parse String to BigInt");return r}if("symbol"==typeof e)throw new a("Cannot convert a Symbol value to a BigInt");if("bigint"!=typeof e)throw new s("Assertion failed: unknown primitive type");return e}},2997:t=>{"use strict";t.exports=function(t){if(void 0===t)return t;var e={};return"[[Value]]"in t&&(e.value=t["[[Value]]"]),"[[Writable]]"in t&&(e.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(e.get=t["[[Get]]"]),"[[Set]]"in t&&(e.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(e.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(e.configurable=!!t["[[Configurable]]"]),e}},3093:(t,e,r)=>{"use strict";var i=r(4459);t.exports=function(t){return i(t)||0===t?t:t<0?-1:1}},3126:(t,e,r)=>{"use strict";var i=r(6743),n=r(9675),o=r(76),a=r(3144);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new n("a function is required");return a(i,o,t)}},3144:(t,e,r)=>{"use strict";var i=r(6743),n=r(1002),o=r(76),a=r(7119);t.exports=a||i.call(o,n)},3331:(t,e,r)=>{"use strict";var i=r(4459);t.exports=function(t){return("number"==typeof t||"bigint"==typeof t)&&!i(t)&&t!==1/0&&t!==-1/0}},3363:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},3384:(t,e,r)=>{"use strict";var i=r(5986),n=r(9675);t.exports=function(t){if("number"!=typeof t&&"bigint"!=typeof t)throw new n("argument must be a Number or a BigInt");var e=t<0?-i(-t):i(t);return 0===e?0:e}},3432:(t,e,r)=>{"use strict";var i=r(8452),n=r(487),o=r(8268),a=r(2521),s=r(8599),l=n(a());i(l,{getPolyfill:a,implementation:o,shim:s}),t.exports=l},3446:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(5880),o=r(2964),a=r(9969),s=r(122),l=i&&BigInt(n(2,32))*BigInt(n(2,31)),c=i&&BigInt(n(2,32))*BigInt(n(2,32));t.exports=function(t){var e=o(t),r=s(a,e,c);return r>=l?r-c:r}},3470:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},3490:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},3541:t=>{"use strict";t.exports=function(t){return"string"==typeof t||"symbol"==typeof t}},3557:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,65536);return s>=32768?s-65536:s}},3612:(t,e,r)=>{"use strict";var i=r(6556),n=i("Object.prototype.toString"),o=r(4039)(),a=r(9721);if(o){var s=i("Symbol.prototype.toString"),l=a(/^Symbol\(.*\)$/);t.exports=function(t){if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||"[object Symbol]"!==n(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&l(s(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},3628:(t,e,r)=>{"use strict";var i=r(8648),n=r(1064),o=r(7176);t.exports=i?function(t){return i(t)}:n?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return n(t)}:o?function(t){return o(t)}:null},3737:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23666%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},3795:t=>{"use strict";t.exports=function(t,e){for(var r=0;r<t.length;r+=1)e(t[r],r,t)}},3802:t=>{"use strict";var e,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;r||(e=function(t){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;e||n||(e=function(t){return!1}),t.exports=e||function(t){if(!t||"object"!=typeof t)return!1;try{if(n.call(t),o)try{o.call(t)}catch(t){return!0}return t instanceof r}catch(t){}return!1}},3811:(t,e,r)=>{"use strict";var i=r(6556)("FinalizationRegistry.prototype.register",!0);t.exports=i?function(t){if(!t||"object"!=typeof t)return!1;try{return i(t,{},null),!0}catch(t){return!1}}:function(t){return!1}},3870:t=>{"use strict";const e=async function(){}.constructor;t.exports=()=>e},3913:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},4035:(t,e,r)=>{"use strict";var i,n=r(6556),o=r(9092)(),a=r(9957),s=r(5795);if(o){var l=n("RegExp.prototype.exec"),c={},u=function(){throw c},h={toString:u,valueOf:u};"symbol"==typeof Symbol.toPrimitive&&(h[Symbol.toPrimitive]=u),i=function(t){if(!t||"object"!=typeof t)return!1;var e=s(t,"lastIndex");if(!e||!a(e,"value"))return!1;try{l(t,h)}catch(t){return t===c}}}else{var p=n("Object.prototype.toString");i=function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===p(t)}}t.exports=i},4039:(t,e,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(1333);t.exports=function(){return"function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&n()}},4097:t=>{"use strict";t.exports={__proto__:null,name:{__proto__:null,$Int8Array:"INT8",$Uint8Array:"UINT8",$Uint8ClampedArray:"UINT8C",$Int16Array:"INT16",$Uint16Array:"UINT16",$Int32Array:"INT32",$Uint32Array:"UINT32",$BigInt64Array:"BIGINT64",$BigUint64Array:"BIGUINT64",$Float32Array:"FLOAT32",$Float64Array:"FLOAT64"},size:{__proto__:null,$INT8:1,$UINT8:1,$UINT8C:1,$INT16:2,$UINT16:2,$INT32:4,$UINT32:4,$BIGINT64:8,$BIGUINT64:8,$FLOAT32:4,$FLOAT64:8},choices:'"INT8", "UINT8", "UINT8C", "INT16", "UINT16", "INT32", "UINT32", "BIGINT64", "BIGUINT64", "FLOAT32", or "FLOAT64"'}},4138:t=>{"use strict";t.exports=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0}},4224:(t,e,r)=>{"use strict";var i=r(113);t.exports=function(t,e){return i(t,e)}},4233:t=>{"use strict";const e=function*(){}.constructor;t.exports=()=>e},4323:t=>{"use strict";t.exports=function(t){return!!t}},4372:(t,e,r)=>{"use strict";var i=r(9675),n=r(6556)("TypedArray.prototype.buffer",!0),o=r(5680);t.exports=n||function(t){if(!o(t))throw new i("Not a Typed Array");return t.buffer}},4399:(t,e,r)=>{"use strict";var i=r(453)("%Array.prototype.concat%"),n=r(487),o=r(6556)("Array.prototype.slice"),a=r(1333)()&&Symbol.isConcatSpreadable,s=[],l=a?n.apply(i,s):null,c=a?r(4634):null;t.exports=a?function(t){for(var e=0;e<arguments.length;e+=1){var r=arguments[e];if(r&&"object"==typeof r&&"boolean"==typeof r[a]){s[a]||(s[a]=!0);var i=c(r)?o(r):[r];i[a]=!0,arguments[e]=i}}return l(arguments)}:n(i,s)},4417:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},4420:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},4459:t=>{"use strict";t.exports=Number.isNaN||function(t){return t!=t}},4462:t=>{"use strict";var e=function(){return"string"==typeof function(){}.name},r=Object.getOwnPropertyDescriptor;if(r)try{r([],"length")}catch(t){r=null}e.functionsHaveConfigurableNames=function(){if(!e()||!r)return!1;var t=r(function(){},"name");return!!t&&!!t.configurable};var i=Function.prototype.bind;e.boundFunctionsHaveNames=function(){return e()&&"function"==typeof i&&""!==function(){}.bind().name},t.exports=e},4528:(t,e,r)=>{"use strict";var i=r(1376)("%Reflect.construct%",!0),n=r(893);try{n({},"",{"[[Get]]":function(){}})}catch(t){n=null}if(n&&i){var o={},a={};n(a,"length",{"[[Get]]":function(){throw o},"[[Enumerable]]":!0}),t.exports=function(t){try{i(t,a)}catch(t){return t===o}}}else t.exports=function(t){return"function"==typeof t&&!!t.prototype}},4634:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},4643:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},4665:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},4670:(t,e,r)=>{"use strict";var i=r(487),n=r(6556),o=r(453)("%ArrayBuffer%",!0),a=n("ArrayBuffer.prototype.byteLength",!0),s=n("Object.prototype.toString"),l=!!o&&!a&&new o(0).slice,c=!!l&&i(l);t.exports=a||c?function(t){if(!t||"object"!=typeof t)return!1;try{return a?a(t):c(t,0),!0}catch(t){return!1}}:o?function(t){return"[object ArrayBuffer]"===s(t)}:function(t){return!1}},4742:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(7440),a=r(5767),s=r(4097);t.exports=function(t){var e=a(t);if(!e)throw new n("Assertion failed: `O` must be a TypedArray");var r=s.size["$"+s.name["$"+e]];if(!o(r)||r<0)throw new i("Assertion failed: Unknown TypedArray type `"+e+"`");return r}},4748:t=>{"use strict";function e(t,e){this.x=t,this.y=e}t.exports=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t}},4751:(t,e,r)=>{"use strict";var i=r(453),n=i("%Number%"),o=i("%BigInt%",!0);t.exports=function(t,e,r){var i="bigint"==typeof t?o:n;t<0&&(t>>>=0);for(var a=[],s=0;s<e;s++)a[r?s:e-1-s]=n(t&i(255)),t>>=i(8);return a}},4761:(t,e,r)=>{"use strict";var i=r(6556),n=i("String.prototype.valueOf"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"string"==typeof t||!(!t||"object"!=typeof t)&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object String]"===o(t))}},4769:(t,e,r)=>{"use strict";var i=r(592),n=r(655),o=i.hasArrayLengthDefineBug(),a=o&&r(1412),s=r(6556)("Object.prototype.propertyIsEnumerable");t.exports=function(t,e,r,i,l,c){if(!n){if(!t(c))return!1;if(!c["[[Configurable]]"]||!c["[[Writable]]"])return!1;if(l in i&&s(i,l)!==!!c["[[Enumerable]]"])return!1;var u=c["[[Value]]"];return i[l]=u,e(i[l],u)}return o&&"length"===l&&"[[Value]]"in c&&a(i)&&i.length!==c["[[Value]]"]?(i.length=c["[[Value]]"],i.length===c["[[Value]]"]):(n(i,l,r(c)),!0)}},4770:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,4294967296);return 0===s?0:s}},4810:(t,e,r)=>{"use strict";var i=r(453)("%String%"),n=r(9675);t.exports=function(t){if("symbol"==typeof t)throw new n("Cannot convert a Symbol value to a string");return i(t)}},4890:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},4895:(t,e,r)=>{"use strict";var i=r(8206);t.exports=function(){return String.prototype.trim&&"​"==="​".trim()&&"᠎"==="᠎".trim()&&"_᠎"==="_᠎".trim()&&"᠎_"==="᠎_".trim()?String.prototype.trim:i}},4915:(t,e,r)=>{"use strict";var i=r(5880);t.exports=function(t){var e=128&t[3]?-1:1,r=(127&t[3])<<1|t[2]>>7,n=(127&t[2])<<16|t[1]<<8|t[0];return 0===r&&0===n?1===e?0:-0:255===r&&0===n?1===e?1/0:-1/0:255===r&&0!==n?NaN:-127==(r-=127)?e*n*i(2,-149):e*(1+n*i(2,-23))*i(2,r)}},5015:(t,e,r)=>{"use strict";var i=r(9675),n=r(2491),o=r(3446),a=r(9887),s=r(3557),l=r(2475),c=r(7088),u=r(172),h=r(4770),p=r(6039),d=r(9308),f=r(2779),m=r(8894),g=r(4751),_=r(4097),y={__proto__:null,$INT8:c,$UINT8:p,$UINT8C:d,$INT16:s,$UINT16:u,$INT32:l,$UINT32:h,$BIGINT64:o,$BIGUINT64:a};t.exports=function(t,e,r){if("string"!=typeof t||!n(_.size,"$"+t))throw new i("Assertion failed: `type` must be a TypedArray element type");if("number"!=typeof e&&"bigint"!=typeof e)throw new i("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof r)throw new i("Assertion failed: `isLittleEndian` must be a Boolean");if("FLOAT32"===t)return f(e,r);if("FLOAT64"===t)return m(e,r);var o=_.size["$"+t],a=(0,y["$"+t])(e);return g(a,o,r)}},5056:(t,e,r)=>{"use strict";t.exports=function(t){var e=r.nc;e&&t.setAttribute("nonce",e)}},5072:t=>{"use strict";var e=[];function r(t){for(var r=-1,i=0;i<e.length;i++)if(e[i].identifier===t){r=i;break}return r}function i(t,i){for(var o={},a=[],s=0;s<t.length;s++){var l=t[s],c=i.base?l[0]+i.base:l[0],u=o[c]||0,h="".concat(c," ").concat(u);o[c]=u+1;var p=r(h),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var f=n(d,i);i.byIndex=s,e.splice(s,0,{identifier:h,updater:f,references:1})}a.push(h)}return a}function n(t,e){var r=e.domAPI(e);return r.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;r.update(t=e)}else r.remove()}}t.exports=function(t,n){var o=i(t=t||[],n=n||{});return function(t){t=t||[];for(var a=0;a<o.length;a++){var s=r(o[a]);e[s].references--}for(var l=i(t,n),c=0;c<o.length;c++){var u=r(o[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}o=l}}},5100:(t,e,r)=>{"use strict";var i=r(453),n=i("%Uint8Array%",!0),o=i("%Uint32Array%",!0),a=r(4372),s=o&&new o([305419896]),l=s&&new n(a(s));t.exports=l?120===l[0]?"little":18===l[0]?"big":52===l[0]?"mixed":"unknown":"indeterminate"},5128:(t,e,r)=>{"use strict";var i=r(6556),n=i("Boolean.prototype.toString"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"boolean"==typeof t||null!==t&&"object"==typeof t&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object Boolean]"===o(t))}},5233:t=>{function e(t){if(!(this instanceof e))return new e(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}t.exports=e,e.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},e.prototype.equals=function(t){var r;return r=t instanceof e?t.bbox():t,this._bbox[0]==r[0]&&this._bbox[1]==r[1]&&this._bbox[2]==r[2]&&this._bbox[3]==r[3]},e.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},e.prototype.union=function(t){var r;return this._valid=!0,r=t instanceof e?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],r[0]),this._bbox[1]=Math.min(this._bbox[1],r[1]),this._bbox[2]=Math.max(this._bbox[2],r[2]),this._bbox[3]=Math.max(this._bbox[3],r[3]),this},e.prototype.bbox=function(){return this._valid?this._bbox:null},e.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],r=t[1];return this._bbox[0]<=e&&this._bbox[1]<=r&&this._bbox[2]>=e&&this._bbox[3]>=r},e.prototype.intersect=function(t){return this._valid?(r=t instanceof e?t.bbox():t,!(this._bbox[0]>r[2]||this._bbox[2]<r[0]||this._bbox[3]<r[1]||this._bbox[1]>r[3])):null;var r},e.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},e.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},5291:(t,e,r)=>{"use strict";var i=r(9675),n=r(5910),o=r(6575),a=r(4742),s=r(9346),l=r(4372),c=r(2308),u=r(6058);t.exports=function(t){if(!s(t))throw new i("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");var e=t["[[Object]]"],r=t["[[CachedBufferByteLength]]"];if(n(l(e))&&"DETACHED"!==r)throw new i("Assertion failed: typed array is detached only if the byte length is ~DETACHED~");if("DETACHED"===r)return!0;var h,p=c(e),d=o(l(e))?u(e):"AUTO";return h="AUTO"===d?r:p+d*a(e),p>r||h>r}},5345:t=>{"use strict";t.exports=URIError},5351:(t,e,r)=>{"use strict";var i=r(6556),n=r(9721),o=i("Object.prototype.toString"),a=i("Function.prototype.toString"),s=n(/^\s*async(?:\s+function(?:\s+|\()|\s*\()/),l=r(9092)(),c=r(3628),u=r(3870);t.exports=function(t){if("function"!=typeof t)return!1;if(s(a(t)))return!0;if(!l)return"[object AsyncFunction]"===o(t);if(!c)return!1;var e=u();return e&&e.prototype===c(t)}},5388:(t,e,r)=>{"use strict";var i=r(9675);t.exports=function(t){if(null==t)throw new i(arguments.length>0&&arguments[1]||"Cannot call method on "+t);return t}},5437:(t,e,r)=>{"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,n=r(162),o=r(9600),a=r(2120),s=r(3612);t.exports=function(t){if(n(t))return t;var e,r="default";if(arguments.length>1&&(arguments[1]===String?r="string":arguments[1]===Number&&(r="number")),i&&(Symbol.toPrimitive?e=function(t,e){var r=t[e];if(null!=r){if(!o(r))throw new TypeError(r+" returned for property "+String(e)+" of object "+t+" is not a function");return r}}(t,Symbol.toPrimitive):s(t)&&(e=Symbol.prototype.valueOf)),void 0!==e){var l=e.call(t,r);if(n(l))return l;throw new TypeError("unable to convert exotic object to primitive")}return"default"===r&&(a(t)||s(t))&&(r="string"),function(t,e){if(null==t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof e||"number"!==e&&"string"!==e)throw new TypeError('hint must be "string" or "number"');var r,i,a,s="string"===e?["toString","valueOf"]:["valueOf","toString"];for(a=0;a<s.length;++a)if(r=t[s[a]],o(r)&&(i=r.call(t),n(i)))return i;throw new TypeError("No default value")}(t,"default"===r?"number":r)}},5446:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},5680:(t,e,r)=>{"use strict";var i=r(5767);t.exports=function(t){return!!i(t)}},5701:(t,e,r)=>{"use strict";var i=r(9675),n=r(9957),o={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};t.exports=function(t){if(!t||"object"!=typeof t)return!1;for(var e in t)if(n(t,e)&&!o[e])return!1;var r=n(t,"[[Value]]")||n(t,"[[Writable]]"),a=n(t,"[[Get]]")||n(t,"[[Set]]");if(r&&a)throw new i("Property Descriptors may not be both accessor and data descriptors");return!0}},5767:(t,e,r)=>{"use strict";var i=r(2682),n=r(9209),o=r(487),a=r(6556),s=r(5795),l=r(3628),c=a("Object.prototype.toString"),u=r(9092)(),h="undefined"==typeof globalThis?r.g:globalThis,p=n(),d=a("String.prototype.slice"),f=a("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r<t.length;r+=1)if(t[r]===e)return r;return-1},m={__proto__:null};i(p,u&&s&&l?function(t){var e=new h[t];if(Symbol.toStringTag in e&&l){var r=l(e),i=s(r,Symbol.toStringTag);if(!i&&r){var n=l(r);i=s(n,Symbol.toStringTag)}m["$"+t]=o(i.get)}}:function(t){var e=new h[t],r=e.slice||e.set;r&&(m["$"+t]=o(r))}),t.exports=function(t){if(!t||"object"!=typeof t)return!1;if(!u){var e=d(c(t),8,-1);return f(p,e)>-1?e:"Object"===e&&function(t){var e=!1;return i(m,function(r,i){if(!e)try{r(t),e=d(i,1)}catch(t){}}),e}(t)}return s?function(t){var e=!1;return i(m,function(r,i){if(!e)try{"$"+r(t)===i&&(e=d(i,1))}catch(t){}}),e}(t):null}},5795:(t,e,r)=>{"use strict";var i=r(6549);if(i)try{i([],"length")}catch(t){i=null}t.exports=i},5796:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23aaa%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},5879:(t,e,r)=>{var i=r(2905),n=r(6623),o=r(5233),a={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},s=Object.keys(a);function l(t){for(var e=o(),r=i(t),n=0;n<r.length;n++)e.include(r[n]);return e}t.exports=function(t){return l(t).bbox()},t.exports.polygon=function(t){return l(t).polygon()},t.exports.bboxify=function(t){return n(t).map(function(t){t&&s.some(function(e){return!!t[e]&&-1!==a[e].indexOf(t.type)})&&(t.bbox=l(t).bbox(),this.update(t))})}},5880:t=>{"use strict";t.exports=Math.pow},5910:(t,e,r)=>{"use strict";var i=r(9675),n=r(9511),o=r(9209)(),a=r(6556),s=r(4670),l=r(7070),c=a("SharedArrayBuffer.prototype.byteLength",!0);t.exports=function(t){var e=l(t);if(!s(t)&&!e)throw new i("Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot");if(0===(e?c:n)(t))try{new r.g[o[0]](t)}catch(t){return!!t&&"TypeError"===t.name}return!1}},5955:(t,e,r)=>{"use strict";r.d(e,{A:()=>yt});var i=r(1601),n=r.n(i),o=r(6314),a=r.n(o),s=r(4417),l=r.n(s),c=new URL(r(7035),r.b),u=new URL(r(3470),r.b),h=new URL(r(8164),r.b),p=new URL(r(4665),r.b),d=new URL(r(4890),r.b),f=new URL(r(3363),r.b),m=new URL(r(3490),r.b),g=new URL(r(7603),r.b),_=new URL(r(3913),r.b),y=new URL(r(1413),r.b),v=new URL(r(4643),r.b),b=new URL(r(216),r.b),x=new URL(r(1907),r.b),w=new URL(r(8605),r.b),T=new URL(r(9387),r.b),S=new URL(r(2353),r.b),P=new URL(r(5446),r.b),M=new URL(r(6694),r.b),A=new URL(r(4420),r.b),E=new URL(r(5796),r.b),I=new URL(r(2228),r.b),C=new URL(r(9819),r.b),D=new URL(r(7695),r.b),z=new URL(r(8869),r.b),k=new URL(r(557),r.b),R=new URL(r(8460),r.b),L=new URL(r(6539),r.b),F=new URL(r(3737),r.b),B=new URL(r(7914),r.b),O=new URL(r(6117),r.b),j=new URL(r(6311),r.b),N=a()(n()),V=l()(c),U=l()(u),$=l()(h),G=l()(p),q=l()(d),Z=l()(f),W=l()(m),H=l()(g),X=l()(_),Y=l()(y),K=l()(v),J=l()(b),Q=l()(x),tt=l()(w),et=l()(T),rt=l()(S),it=l()(P),nt=l()(M),ot=l()(A),at=l()(E),st=l()(I),lt=l()(C),ct=l()(D),ut=l()(z),ht=l()(k),pt=l()(R),dt=l()(L),ft=l()(F),mt=l()(B),gt=l()(O),_t=l()(j);N.push([t.id,`.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0,0,0,0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${V})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${U})}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${$})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${G})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${q})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${Z})}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${W})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${H})}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${X})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${Y})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${K})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${H})}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${J})}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${Q})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${tt})}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url(${et})}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url(${rt})}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(${it})}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(${nt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${ot})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${at})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${st})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${lt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${ct})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${ut})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${ht})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${pt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${st})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${lt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${ct})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${ut})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${dt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${ft})}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(${mt});background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(${mt})}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url(${mt})}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(${gt});border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${_t})}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${gt})}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}[dir=rtl] .maplibregl-popup-anchor-left{flex-direction:row-reverse}[dir=rtl] .maplibregl-popup-anchor-right{flex-direction:row}[dir=rtl] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-start}[dir=rtl] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-start}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@media (prefers-reduced-motion:reduce){.maplibregl-user-location-dot:before{animation:none}}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}`,""]);const yt=N},5986:(t,e,r)=>{"use strict";var i=r(8968);t.exports=function(t){return"bigint"==typeof t?t:i(t)}},6039:(t,e,r)=>{"use strict";var i=r(3331),n=r(4224),o=r(8410),a=r(3384);t.exports=function(t){var e=o(t);if(!i(e)||0===e)return 0;var r=a(e);return n(r,256)}},6058:(t,e,r)=>{"use strict";var i=r(487),n=r(2682),o=r(5795),a=r(5680),s=r(6578),l=r(9897)(),c={__proto__:null},u=Object.defineProperty;if(o){var h=function(t){return t.length};n(s,function(t){var e=r.g[t];if("function"==typeof e||"object"==typeof e){var n=e.prototype,a=o(n,"length");if(!a){var s=l(n);a=o(s,"length")}if(a&&a.get)c["$"+t]=i(a.get);else if(u){var p=new r.g[t](2);(a=o(p,"length"))&&a.configurable&&u(p,"length",{value:3}),2===p.length&&(c["$"+t]=h)}}})}t.exports=function(t){return!!a(t)&&function(t){var e;return n(c,function(r){if("number"!=typeof e)try{var i=r(t);"number"==typeof i&&(e=i)}catch(t){}}),e}(t)}},6117:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},6167:(t,e,r)=>{"use strict";var i=r(453),n=r(6556),o=r(9290),a=r(8068),s=r(9675),l=i("%BigInt%",!0),c=r(2491),u=r(533),h=r(7881),p=r(9373),d=r(4915),f=r(6587),m=r(6570),g=r(4138),_=r(2158),y=n("Array.prototype.reverse"),v=n("Array.prototype.slice"),b=r(4097);t.exports=function(t,e,r){if(!c(b.size,"$"+t))throw new s("Assertion failed: `type` must be a TypedArray element type");if(!u(e)||!g(e,_))throw new s("Assertion failed: `rawBytes` must be an Array of bytes");if("boolean"!=typeof r)throw new s("Assertion failed: `isLittleEndian` must be a Boolean");var i=b.size["$"+t];if(e.length!==i)throw new o("Assertion failed: `rawBytes` must have a length of "+i+" for type "+t);var n=h(t);if(n&&!l)throw new a("this environment does not support BigInts");return e=v(e,0,i),r||y(e),"FLOAT32"===t?d(e):"FLOAT64"===t?f(e):m(e,i,p(t),n)}},6188:t=>{"use strict";t.exports=Math.max},6268:(t,e,r)=>{"use strict";var i=r(453),n=r(6966),o=r(2702),a=r(9723),s=r(9675),l=r(3628),c=r(9612);t.exports=function(t){if(!o(t))throw new s("Reflect.getPrototypeOf called on non-object");if(l)return l(t);var e=a(t);if(e){var r=i("%"+e+".prototype%",!0);if(r)return r}return n(t.constructor)?t.constructor.prototype:t instanceof Object?c.prototype:null}},6311:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill=%27%23fff%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},6314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r="",i=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),i&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),i&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r}).join("")},e.i=function(t,r,i,n,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(i)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);i&&a[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),r&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=r):u[2]=r),n&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=n):u[4]="".concat(n)),e.push(u))}},e}},6419:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(5767),a=r(4097);t.exports=function(t){var e=o(t);if(!e)throw new n("Assertion failed: `O` must be a TypedArray");var r=a.name["$"+e];if("string"!=typeof r)throw new i("Assertion failed: Unknown TypedArray type `"+e+"`");return r}},6443:function(t){t.exports=function(){"use strict";var t={},e={};function r(r,i,n){if(e[r]=n,"index"===r){var o="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",a={};return e.shared(a),e.index(t,a),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),t}}return r("shared",0,function(t){function e(t,e,r,i){return new(r||(r=Promise))(function(n,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,s)}l((i=i.apply(t,e||[])).next())})}function r(t,e){this.x=t,this.y=e}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n,o;"function"==typeof SuppressedError&&SuppressedError,r.prototype={clone(){return new r(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const e=Math.cos(t),r=Math.sin(t),i=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=i,this},_rotateAround(t,e){const r=Math.cos(t),i=Math.sin(t),n=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-i*(this.y-e.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:r},r.convert=function(t){if(t instanceof r)return t;if(Array.isArray(t))return new r(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new r(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};var a=function(){if(o)return n;function t(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=i}return o=1,n=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,i=0;i<8;i++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=t,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-t)<e));i++)t>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},n}(),s=i(a);let l,c;function u(){return null==l&&(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function h(){if(null==c&&(c=!1,u())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<t*t;r++){const i=4*r;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%t,Math.floor(r/t),1,1)}const r=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&r[e]!==e){c=!0;break}}}return c||!1}var p=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function f(){var t=new d(9);return d!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function m(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function g(){var t=new d(3);return d!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function _(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function y(t,e,r){var i=new d(3);return i[0]=t,i[1]=e,i[2]=r,i}function v(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function b(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function x(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=n*l-o*s,t[1]=o*a-i*l,t[2]=i*s-n*a,t}var w,T=_;function S(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,t}function P(){var t=new d(4);return d!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function M(t,e,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,i*=o,r*=o;var a=Math.sin(e),s=Math.cos(e),l=Math.sin(r),c=Math.cos(r),u=Math.sin(i),h=Math.cos(i);switch(n){case"xyz":t[0]=a*c*h+s*l*u,t[1]=s*l*h-a*c*u,t[2]=s*c*u+a*l*h,t[3]=s*c*h-a*l*u;break;case"xzy":t[0]=a*c*h-s*l*u,t[1]=s*l*h-a*c*u,t[2]=s*c*u+a*l*h,t[3]=s*c*h+a*l*u;break;case"yxz":t[0]=a*c*h+s*l*u,t[1]=s*l*h-a*c*u,t[2]=s*c*u-a*l*h,t[3]=s*c*h+a*l*u;break;case"yzx":t[0]=a*c*h+s*l*u,t[1]=s*l*h+a*c*u,t[2]=s*c*u-a*l*h,t[3]=s*c*h-a*l*u;break;case"zxy":t[0]=a*c*h-s*l*u,t[1]=s*l*h+a*c*u,t[2]=s*c*u+a*l*h,t[3]=s*c*h-a*l*u;break;case"zyx":t[0]=a*c*h-s*l*u,t[1]=s*l*h+a*c*u,t[2]=s*c*u-a*l*h,t[3]=s*c*h+a*l*u;break;default:throw new Error("Unknown angle order "+n)}return t}function A(){var t=new d(2);return d!=Float32Array&&(t[0]=0,t[1]=0),t}function E(t,e){var r=new d(2);return r[0]=t,r[1]=e,r}g(),w=new d(4),d!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[3]=0),g(),y(1,0,0),y(0,1,0),P(),P(),f(),A();const I=8192;function C(t,e,r){return e*(I/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function D(t,e){return(t%e+e)%e}function z(t,e,r){return t*(1-r)+e*r}function k(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function R(t,e,r,i){const n=new s(t,e,r,i);return t=>n.solve(t)}const L=R(.25,.1,.25,1);function F(t,e,r){return Math.min(r,Math.max(e,t))}function B(t,e,r){const i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function O(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let j=1;function N(t,e,r){const i={};for(const r in t)i[r]=e.call(this,t[r],r,t);return i}function V(t,e,r){const i={};for(const r in t)e.call(this,t[r],r,t)&&(i[r]=t[r]);return i}function U(t){return Array.isArray(t)?t.map(U):"object"==typeof t&&t?N(t,U):t}const $={};function G(t){$[t]||("undefined"!=typeof console&&console.warn(t),$[t]=!0)}function q(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Z(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let W=null;function H(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const X="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Y(t,r,i,n,o){return e(this,void 0,void 0,function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const a=null==e?void 0:e.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield e.copyTo(l,function(t,e,r,i,n){const o=4*Math.max(-e,0),a=(Math.max(0,r)-r)*i*4+o,s=4*i,l=Math.max(0,e),c=Math.max(0,r);return{rect:{x:l,y:c,width:Math.min(t.width,e+i)-l,height:Math.min(t.height,r+n)-c},layout:[{offset:a,stride:s}]}}(t,r,i,n,o)),s)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}})}let K,J;function Q(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function tt(t){return t*Math.PI/180}function et(t){return t/Math.PI*180}const rt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},it={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},nt="AbortError";class ot extends Error{constructor(t=nt){super(t instanceof Error?t.message:t),this.name=nt,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function at(t){return t.name===nt}const st={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function lt(t){return st.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const ct="global-dispatcher";class ut extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}}const ht=()=>Z(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,pt=function(t,r){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=lt(t.url);if(e)return e(t,r);if(Z(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:ct},r)}if(!(/^file:/.test(i=t.url)||/^file:/.test(ht())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,r){return e(this,void 0,void 0,function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:ht(),signal:r.signal});let i,n;"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{i=yield fetch(e)}catch(e){if(at(e))throw e;throw new ut(0,e.message,t.url,new Blob)}if(!i.ok){const e=yield i.blob();throw new ut(i.status,i.statusText,t.url,e)}n="arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text();const o=yield n;return r.signal.throwIfAborted(),{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}})}(t,r);if(Z(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:ct},r)}var i;return function(t,e){return new Promise((r,i)=>{var n;const o=new XMLHttpRequest;o.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(o.responseType="arraybuffer");for(const e in t.headers)o.setRequestHeader(e,t.headers[e]);"json"===t.type&&(o.responseType="text",(null===(n=t.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===t.credentials,o.onerror=()=>{i(new Error(o.statusText))},o.onload=()=>{if(!e.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let e=o.response;if("json"===t.type)try{e=JSON.parse(o.response)}catch(t){return void i(t)}r({data:e,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const e=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});i(new ut(o.status,o.statusText,t.url,e))}},e.signal.addEventListener("abort",()=>{o.abort(),i(new ot(e.signal.reason))}),o.send(t.body)})}(t,r)};function dt(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function ft(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function mt(t,e,r){if(r&&r[t]){const i=r[t].indexOf(e);-1!==i&&r[t].splice(i,1)}}class gt{constructor(t,e={}){O(this,e),this.type=t}}class _t extends gt{constructor(t,e={}){super("error",O({error:t},e))}}class yt{on(t,e){return this._listeners=this._listeners||{},ft(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return mt(t,e,this._listeners),mt(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},ft(t,e,this._oneTimeListeners),this):new Promise(e=>this.once(t,e))}fire(t,e){"string"==typeof t&&(t=new gt(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of i)mt(r,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(O(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof _t&&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,e){return this._eventedParent=t,this._eventedParentData=e,this}}var vt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const bt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function xt(t,e){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);return bt.forEach(t=>{t in e&&(r[t]=e[t])}),r}function wt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!wt(t[r],e[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(!wt(t[r],e[r]))return!1;return!0}return t===e}function Tt(t,e){t.push(e)}function St(t,e,r){Tt(r,{command:"addSource",args:[t,e[t]]})}function Pt(t,e,r){Tt(e,{command:"removeSource",args:[t]}),r[t]=!0}function Mt(t,e,r,i){Pt(t,r,i),St(t,e,r)}function At(t,e,r){let i;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!wt(t[r][i],e[r][i]))return!1;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!wt(t[r][i],e[r][i]))return!1;return!0}function Et(t,e,r,i,n,o){t=t||{},e=e||{};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(wt(t[a],e[a])||r.push({command:o,args:[i,a,e[a],n]}));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&!Object.prototype.hasOwnProperty.call(t,a)&&(wt(t[a],e[a])||r.push({command:o,args:[i,a,e[a],n]}))}function It(t){return t.id}function Ct(t,e){return t[e.id]=e,t}class Dt{constructor(t,e,r,i){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)}}function zt(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class kt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Rt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new Rt(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 Lt={kind:"null"},Ft={kind:"number"},Bt={kind:"string"},Ot={kind:"boolean"},jt={kind:"color"},Nt={kind:"projectionDefinition"},Vt={kind:"object"},Ut={kind:"value"},$t={kind:"collator"},Gt={kind:"formatted"},qt={kind:"padding"},Zt={kind:"colorArray"},Wt={kind:"numberArray"},Ht={kind:"resolvedImage"},Xt={kind:"variableAnchorOffsetCollection"};function Yt(t,e){return{kind:"array",itemType:t,N:e}}function Kt(t){if("array"===t.kind){const e=Kt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Jt=[Lt,Ft,Bt,Ot,jt,Nt,Gt,Vt,Yt(Ut),qt,Wt,Zt,Ht,Xt];function Qt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Qt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of Jt)if(!Qt(t,e))return null}return`Expected ${Kt(t)} but found ${Kt(e)} instead.`}function te(t,e){return e.some(e=>e.kind===t.kind)}function ee(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function re(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const ie=.96422,ne=.82521,oe=4/29,ae=6/29,se=3*ae*ae,le=ae*ae*ae,ce=Math.PI/180,ue=180/Math.PI;function he(t){return(t%=360)<0&&(t+=360),t}function pe([t,e,r,i]){let n,o;const a=fe((.2225045*(t=de(t))+.7168786*(e=de(e))+.0606169*(r=de(r)))/1);t===e&&e===r?n=o=a:(n=fe((.4360747*t+.3850649*e+.1430804*r)/ie),o=fe((.0139322*t+.0971045*e+.7141733*r)/ne));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function de(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fe(t){return t>le?Math.pow(t,1/3):t/se+oe}function me([t,e,r,i]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(r)?n:n-r/200;return n=1*_e(n),o=ie*_e(o),a=ne*_e(a),[ge(3.1338561*o-1.6168667*n-.4906146*a),ge(-.9787684*o+1.9161415*n+.033454*a),ge(.0719453*o-.2289914*n+1.4052427*a),i]}function ge(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function _e(t){return t>ae?t*t*t:se*(t-oe)}const ye=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ve(t,e){return ye(t,e)?t[e]:void 0}function be(t){return parseInt(t.padEnd(2,t),16)/255}function xe(t,e){return we(e?t/100:t,0,1)}function we(t,e,r){return Math.min(Math.max(e,t),r)}function Te(t){return!t.some(Number.isNaN)}const Se={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Pe(t,e,r){return t+r*(e-t)}function Me(t,e,r){return t.map((t,i)=>Pe(t,e[i],r))}class Ae{constructor(t,e,r,i=1,n=!0){this.r=t,this.g=e,this.b=r,this.a=i,n||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,e,r,i]))}static parse(t){if(t instanceof Ae)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=ve(Se,t);if(e){const[t,r,i]=e;return[t/255,r/255,i/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return[be(t.slice(r,r+=e)),be(t.slice(r,r+=e)),be(t.slice(r,r+=e)),be(t.slice(r,r+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,r,i,n,o,a,s,l,c,u,h,p]=e,d=[n||" ",s||" ",u].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[i,a,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[we(+r/e,0,1),we(+o/e,0,1),we(+l/e,0,1),h?xe(+h,p):1];if(Te(t))return t}}return}}const r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[t,e,i,n,o,a,s,l,c]=r,u=[i||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,we(+n,0,100),we(+a,0,100),l?xe(+l,c):1];if(Te(t))return function([t,e,r,i]){function n(i){const n=(i+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(n-3,9-n,1))}return t=he(t),e/=100,r/=100,[n(0),n(8),n(4),i]}(t)}}}(t);return e?new Ae(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:i}=this,n=i||1/0;return this.overwriteGetter("rgb",[t/n,e/n,r/n,i])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,r,i,n]=pe(t),o=Math.sqrt(r*r+i*i);return[Math.round(1e4*o)?he(Math.atan2(i,r)*ue):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pe(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,i]=this.rgb;return`rgba(${[t,e,r].map(t=>Math.round(255*t)).join(",")},${i})`}static interpolate(t,e,r,i="rgb"){switch(i){case"rgb":{const[i,n,o,a]=Me(t.rgb,e.rgb,r);return new Ae(i,n,o,a,!1)}case"hcl":{const[i,n,o,a]=t.hcl,[s,l,c,u]=e.hcl;let h,p;if(isNaN(i)||isNaN(s))isNaN(i)?isNaN(s)?h=NaN:(h=s,1!==o&&0!==o||(p=l)):(h=i,1!==c&&0!==c||(p=n));else{let t=s-i;s>i&&t>180?t-=360:s<i&&i-s>180&&(t+=360),h=i+r*t}const[d,f,m,g]=function([t,e,r,i]){return t=isNaN(t)?0:t*ce,me([r,Math.cos(t)*e,Math.sin(t)*e,i])}([h,null!=p?p:Pe(n,l,r),Pe(o,c,r),Pe(a,u,r)]);return new Ae(d,f,m,g,!1)}case"lab":{const[i,n,o,a]=me(Me(t.lab,e.lab,r));return new Ae(i,n,o,a,!1)}}}}Ae.black=new Ae(0,0,0,1),Ae.white=new Ae(1,1,1,1),Ae.transparent=new Ae(0,0,0,0),Ae.red=new Ae(1,0,0,1);class Ee{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ie=["bottom","center","top"];class Ce{constructor(t,e,r,i,n,o){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=o}}class De{constructor(t){this.sections=t}static fromString(t){return new De([new Ce(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof De?t:De.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class ze{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ze)return t;if("number"==typeof t)return new ze([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)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 ze(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new ze(Me(t.values,e.values,r))}}class ke{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ke)return t;if("number"==typeof t)return new ke([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ke(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new ke(Me(t.values,e.values,r))}}class Re{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Re)return t;if("string"==typeof t){const e=Ae.parse(t);if(!e)return;return new Re([e])}if(!Array.isArray(t))return;const e=[];for(const r of t){if("string"!=typeof r)return;const t=Ae.parse(r);if(!t)return;e.push(t)}return new Re(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r,i="rgb"){const n=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)n.push(Ae.interpolate(t.values[o],e.values[o],r,i));return new Re(n)}}class Le extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Fe=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Be{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Be)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const r=t[e],i=t[e+1];if("string"!=typeof r||!Fe.has(r))return;if(!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new Be(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){const i=t.values,n=e.values;if(i.length!==n.length)throw new Le(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let t=0;t<i.length;t+=2){if(i[t]!==n[t])throw new Le(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${i[t]}, to[${t}]: ${n[t]}`);o.push(i[t]);const[e,a]=i[t+1],[s,l]=n[t+1];o.push([Pe(e,s,r),Pe(a,l,r)])}return new Be(o)}}class Oe{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Oe({name:t,available:!1}):null}}class je{constructor(t,e,r){this.from=t,this.to=e,this.transition=r}static interpolate(t,e,r){return new je(t,e,r)}static parse(t){return t instanceof je?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new je(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new je(t.from,t.to,t.transition):"string"==typeof t?new je(t,t,1):void 0}}function Ne(t,e,r,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,r,i]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ve(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof je||t instanceof Ae||t instanceof Ee||t instanceof De||t instanceof ze||t instanceof ke||t instanceof Re||t instanceof Be||t instanceof Oe)return!0;if(Array.isArray(t)){for(const e of t)if(!Ve(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ve(t[e]))return!1;return!0}return!1}function Ue(t){if(null===t)return Lt;if("string"==typeof t)return Bt;if("boolean"==typeof t)return Ot;if("number"==typeof t)return Ft;if(t instanceof Ae)return jt;if(t instanceof je)return Nt;if(t instanceof Ee)return $t;if(t instanceof De)return Gt;if(t instanceof ze)return qt;if(t instanceof ke)return Wt;if(t instanceof Re)return Zt;if(t instanceof Be)return Xt;if(t instanceof Oe)return Ht;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=Ue(e);if(r){if(r===t)continue;r=Ut;break}r=t}return Yt(r||Ut,e)}return Vt}function $e(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ae||t instanceof je||t instanceof De||t instanceof ze||t instanceof ke||t instanceof Re||t instanceof Be||t instanceof Oe?t.toString():JSON.stringify(t)}class Ge{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ve(t[1]))return e.error("invalid value");const r=t[1];let i=Ue(r);const n=e.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new Ge(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const qe={string:Bt,number:Ft,boolean:Ot,object:Vt};class Ze{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,i=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in qe)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=qe[r],i++}else n=Ut;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],i++}r=Yt(n,o)}else{if(!qe[n])throw new Error(`Types doesn't contain name = ${n}`);r=qe[n]}const o=[];for(;i<t.length;i++){const r=e.parse(t[i],i,Ut);if(!r)return null;o.push(r)}return new Ze(r,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!Qt(this.type,Ue(r)))return r;if(e===this.args.length-1)throw new Le(`Expected value to be of type ${Kt(this.type)}, but found ${Kt(Ue(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const We={"to-boolean":Ot,"to-color":jt,"to-number":Ft,"to-string":Bt};class He{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(!We[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const i=We[r],n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],r,Ut);if(!i)return null;n.push(i)}return new He(i,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,r;for(const i of this.args){if(e=i.evaluate(t),r=null,e instanceof Ae)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Ne(e[0],e[1],e[2],e[3]),!r))return new Ae(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Le(r||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const r of this.args){e=r.evaluate(t);const i=ze.parse(e);if(i)return i}throw new Le(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const r of this.args){e=r.evaluate(t);const i=ke.parse(e);if(i)return i}throw new Le(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const r of this.args){e=r.evaluate(t);const i=Re.parse(e);if(i)return i}throw new Le(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const r of this.args){e=r.evaluate(t);const i=Be.parse(e);if(i)return i}throw new Le(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new Le(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return De.fromString($e(this.args[0].evaluate(t)));case"resolvedImage":return Oe.fromString($e(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return $e(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Xe=["Unknown","Point","LineString","Polygon"];class Ye{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Xe[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=Ae.parse(t),this._parseColorCache.set(t,e)),e}}class Ke{constructor(t,e,r=[],i,n=new Rt,o=[]){this.registry=t,this.path=r,this.key=r.map(t=>`[${t}]`).join(""),this.scope=n,this.errors=o,this.expectedType=i,this._isConstant=e}parse(t,e,r,i,n={}){return e?this.concat(e,r,i)._parse(t,n):this._parse(t,n)}_parse(t,e){function r(t,e,r){return"assert"===r?new Ze(e,[t]):"coerce"===r?new He(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[i];if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,n=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===t.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(n.kind))i=r(i,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||"assert")}if(!(i instanceof Ge)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const e=new Ye;try{i=new Ge(i.type,i.evaluate(e))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const i="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new Ke(this.registry,this._isConstant,i,e||null,n,this.errors)}error(t,...e){const r=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new kt(r,t))}checkSubtype(t,e){const r=Qt(t,e);return r&&this.error(r),r}}class Je{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let i=1;i<t.length-1;i+=2){const n=t[i];if("string"!=typeof n)return e.error(`Expected string, but found ${typeof n} instead.`,i);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",i);const o=e.parse(t[i+1],i+1);if(!o)return null;r.push([n,o])}const i=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return i?new Je(r,i):null}outputDefined(){return this.result.outputDefined()}}class Qe{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Qe(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class tr{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Ft),i=e.parse(t[2],2,Yt(e.expectedType||Ut));return r&&i?new tr(i.type.itemType,r,i):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new Le(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new Le(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new Le(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class er{constructor(t,e){this.type=Ot,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ut);return r&&i?te(r.type,[Ot,Bt,Ft,Lt,Ut])?new er(r,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!ee(e,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(Ue(e))} instead.`);if(!ee(r,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Kt(Ue(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class rr{constructor(t,e,r){this.type=Ft,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ut);if(!r||!i)return null;if(!te(r.type,[Ot,Bt,Ft,Lt,Ut]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(r.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Ft);return n?new rr(r,i,n):null}return new rr(r,i)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!ee(e,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(Ue(e))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),ee(r,["string"])){const t=r.indexOf(e,i);return-1===t?-1:[...r.slice(0,t)].length}if(ee(r,["array"]))return r.indexOf(e,i);throw new Le(`Expected second argument to be of type array or string, but found ${Kt(Ue(r))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ir{constructor(t,e,r,i,n,o){this.inputType=t,this.type=e,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n={},o=[];for(let a=2;a<t.length-1;a+=2){let s=t[a];const l=t[a+1];Array.isArray(s)||(s=[s]);const c=e.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,Ue(t)))return null}else r=Ue(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=o.length}const u=e.parse(l,a,i);if(!u)return null;i=i||u.type,o.push(u)}const a=e.parse(t[1],1,Ut);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,i);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new ir(r,i,a,n,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(Ue(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class nr{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const i=[];for(let n=1;n<t.length-1;n+=2){const o=e.parse(t[n],n,Ot);if(!o)return null;const a=e.parse(t[n+1],n+1,r);if(!a)return null;i.push([o,a]),r=r||a.type}const n=e.parse(t[t.length-1],t.length-1,r);if(!n)return null;if(!r)throw new Error("Can't infer output type");return new nr(r,i,n)}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class or{constructor(t,e,r,i){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ft);if(!r||!i)return null;if(!te(r.type,[Yt(Ut),Bt,Ut]))return e.error(`Expected first argument to be of type array or string, but found ${Kt(r.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Ft);return n?new or(r.type,r,i,n):null}return new or(r.type,r,i)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);let i;if(this.endIndex&&(i=this.endIndex.evaluate(t)),ee(e,["string"]))return[...e].slice(r,i).join("");if(ee(e,["array"]))return e.slice(r,i);throw new Le(`Expected first argument to be of type array or string, but found ${Kt(Ue(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ar(t,e){const r=t.length-1;let i,n,o=0,a=r,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=t[s],n=t[s+1],i<=e){if(s===r||e<n)return s;o=s+1}else{if(!(i>e))throw new Le("Input is not a number.");a=s-1}return 0}class sr{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,Ft);if(!r)return null;const i=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let r=1;r<t.length;r+=2){const o=1===r?-1/0:t[r],a=t[r+1],s=r,l=r+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(i.length&&i[i.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,n);if(!c)return null;n=n||c.type,i.push([o,c])}return new sr(n,r,i)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);const n=e.length;return i>=e[n-1]?r[n-1].evaluate(t):r[ar(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}var lr,cr,ur=function(){if(cr)return lr;function t(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=i}return cr=1,lr=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,i=0;i<8;i++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=t,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-t)<e));i++)t>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},lr}(),hr=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(ur);class pr{constructor(t,e,r,i,n){this.type=t,this.operator=e,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,r,i){let n=0;if("exponential"===t.name)n=dr(e,t.base,r,i);else if("linear"===t.name)n=dr(e,1,r,i);else if("cubic-bezier"===t.name){const o=t.controlPoints;n=new hr(o[0],o[1],o[2],o[3]).solve(dr(e,1,r,i))}return n}static parse(t,e){let[r,i,n,...o]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,Ft),!n)return null;const a=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||e.expectedType==Zt?e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType):s=jt;for(let t=0;t<o.length;t+=2){const r=o[t],i=o[t+1],n=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=e.parse(i,l,s);if(!c)return null;s=s||c.type,a.push([r,c])}return re(s,Ft)||re(s,Nt)||re(s,jt)||re(s,qt)||re(s,Wt)||re(s,Zt)||re(s,Xt)||re(s,Yt(Ft))?new pr(s,r,i,n,a):e.error(`Type ${Kt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);const n=e.length;if(i>=e[n-1])return r[n-1].evaluate(t);const o=ar(e,i),a=pr.interpolationFactor(this.interpolation,i,e[o],e[o+1]),s=r[o].evaluate(t),l=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Pe(s,l,a);case"color":return Ae.interpolate(s,l,a);case"padding":return ze.interpolate(s,l,a);case"colorArray":return Re.interpolate(s,l,a);case"numberArray":return ke.interpolate(s,l,a);case"variableAnchorOffsetCollection":return Be.interpolate(s,l,a);case"array":return Me(s,l,a);case"projectionDefinition":return je.interpolate(s,l,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ae.interpolate(s,l,a,"hcl");case"colorArray":return Re.interpolate(s,l,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ae.interpolate(s,l,a,"lab");case"colorArray":return Re.interpolate(s,l,a,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function dr(t,e,r,i){const n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}const fr={color:Ae.interpolate,number:Pe,padding:ze.interpolate,numberArray:ke.interpolate,colorArray:Re.interpolate,variableAnchorOffsetCollection:Be.interpolate,array:Me};class mr{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r=null;const i=e.expectedType;i&&"value"!==i.kind&&(r=i);const n=[];for(const i of t.slice(1)){const t=e.parse(i,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,n.push(t)}if(!r)throw new Error("No output type");const o=i&&n.some(t=>Qt(i,t.type));return new mr(o?Ut:r,n)}evaluate(t){let e,r=null,i=0;for(const n of this.args)if(i++,r=n.evaluate(t),r&&r instanceof Oe&&!r.available&&(e||(e=r.name),r=null,i===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function gr(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function _r(t,e,r,i){return 0===i.compare(e,r)}function yr(t,e,r){const i="=="!==t&&"!="!==t;return class n{constructor(t,e,r){this.type=Ot,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let o=e.parse(t[1],1,Ut);if(!o)return null;if(!gr(r,o.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${Kt(o.type)}'.`);let a=e.parse(t[2],2,Ut);if(!a)return null;if(!gr(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${Kt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${Kt(o.type)}' and '${Kt(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Ze(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Ze(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,$t),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){const e=Ue(o),r=Ue(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new Le(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=Ue(o),r=Ue(a);if("string"!==t.kind||"string"!==r.kind)return e(n,o,a)}return this.collator?r(n,o,a,this.collator.evaluate(n)):e(n,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const vr=yr("==",function(t,e,r){return e===r},_r),br=yr("!=",function(t,e,r){return e!==r},function(t,e,r,i){return!_r(0,e,r,i)}),xr=yr("<",function(t,e,r){return e<r},function(t,e,r,i){return i.compare(e,r)<0}),wr=yr(">",function(t,e,r){return e>r},function(t,e,r,i){return i.compare(e,r)>0}),Tr=yr("<=",function(t,e,r){return e<=r},function(t,e,r,i){return i.compare(e,r)<=0}),Sr=yr(">=",function(t,e,r){return e>=r},function(t,e,r,i){return i.compare(e,r)>=0});class Pr{constructor(t,e,r){this.type=$t,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const i=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Ot);if(!i)return null;const n=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Ot);if(!n)return null;let o=null;return r.locale&&(o=e.parse(r.locale,1,Bt),!o)?null:new Pr(i,n,o)}evaluate(t){return new Ee(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 Mr{constructor(t,e,r,i,n){this.type=Bt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Ft);if(!r)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let n=null;if(i.locale&&(n=e.parse(i.locale,1,Bt),!n))return null;let o=null;if(i.currency&&(o=e.parse(i.currency,1,Bt),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=e.parse(i["min-fraction-digits"],1,Ft),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=e.parse(i["max-fraction-digits"],1,Ft),!s)?null:new Mr(r,n,o,a,s)}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 Ar{constructor(t){this.type=Gt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const i=[];let n=!1;for(let r=1;r<=t.length-1;++r){const o=t[r];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,Ft),!t))return null;let r=null;if(o["text-font"]&&(r=e.parse(o["text-font"],1,Yt(Bt)),!r))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,jt),!a))return null;let s=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!Ie.includes(o["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(s=e.parse(o["vertical-align"],1,Bt),!s)return null}const l=i[i.length-1];l.scale=t,l.font=r,l.textColor=a,l.verticalAlign=s}else{const o=e.parse(t[r],1,Ut);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,i.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ar(i)}evaluate(t){return new De(this.sections.map(e=>{const r=e.content.evaluate(t);return Ue(r)===Ht?new Ce("",r,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Ce($e(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Er{constructor(t){this.type=Ht,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Bt);return r?new Er(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=Oe.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ir{constructor(t){this.type=Ft,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${Kt(r.type)} instead.`):new Ir(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new Le(`Expected value to be of type string or array, but found ${Kt(Ue(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Cr=8192;function Dr(t,e){const r=(180+t[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(r*n*Cr),Math.round(i*n*Cr)]}function zr(t,e){const r=Math.pow(2,e.z);return[(n=(t[0]/Cr+e.x)/r,360*n-180),(i=(t[1]/Cr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,n}function kr(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Rr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Lr(t,e,r){const i=t[0]-e[0],n=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return i*a-o*n==0&&i*o<=0&&n*a<=0}function Fr(t,e,r,i){return 0!=(n=[i[0]-r[0],i[1]-r[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]&&!(!Ur(t,e,r,i)||!Ur(r,i,t,e));var n,o}function Br(t,e,r){for(const i of r)for(let r=0;r<i.length-1;++r)if(Fr(t,e,i[r],i[r+1]))return!0;return!1}function Or(t,e,r=!1){let i=!1;for(const s of e)for(let e=0;e<s.length-1;e++){if(Lr(t,s[e],s[e+1]))return r;(o=s[e])[1]>(n=t)[1]!=(a=s[e+1])[1]>n[1]&&n[0]<(a[0]-o[0])*(n[1]-o[1])/(a[1]-o[1])+o[0]&&(i=!i)}var n,o,a;return i}function jr(t,e){for(const r of e)if(Or(t,r))return!0;return!1}function Nr(t,e){for(const r of t)if(!Or(r,e))return!1;for(let r=0;r<t.length-1;++r)if(Br(t[r],t[r+1],e))return!1;return!0}function Vr(t,e){for(const r of e)if(Nr(t,r))return!0;return!1}function Ur(t,e,r,i){const n=i[0]-r[0],o=i[1]-r[1],a=(t[0]-r[0])*o-n*(t[1]-r[1]),s=(e[0]-r[0])*o-n*(e[1]-r[1]);return a>0&&s<0||a<0&&s>0}function $r(t,e,r){const i=[];for(let n=0;n<t.length;n++){const o=[];for(let i=0;i<t[n].length;i++){const a=Dr(t[n][i],r);kr(e,a),o.push(a)}i.push(o)}return i}function Gr(t,e,r){const i=[];for(let n=0;n<t.length;n++){const o=$r(t[n],e,r);i.push(o)}return i}function qr(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){const e=.5*i;let n=t[0]-r[0]>e?-i:r[0]-t[0]>e?i:0;0===n&&(n=t[0]-r[2]>e?-i:r[2]-t[0]>e?i:0),t[0]+=n}kr(e,t)}function Zr(t,e,r,i){const n=Math.pow(2,i.z)*Cr,o=[i.x*Cr,i.y*Cr],a=[];for(const i of t)for(const t of i){const i=[t.x+o[0],t.y+o[1]];qr(i,e,r,n),a.push(i)}return a}function Wr(t,e,r,i){const n=Math.pow(2,i.z)*Cr,o=[i.x*Cr,i.y*Cr],a=[];for(const r of t){const t=[];for(const i of r){const r=[i.x+o[0],i.y+o[1]];kr(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=n/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const i of t)qr(i,e,r,n)}var s;return a}class Hr{constructor(t,e){this.type=Ot,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ve(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const r of e.features){const{type:e,coordinates:i}=r.geometry;"Polygon"===e&&t.push(i),"MultiPolygon"===e&&t.push(...i)}if(t.length)return new Hr(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Hr(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Hr(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=$r(e.coordinates,i,n),a=Zr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!Or(t,o))return!1}if("MultiPolygon"===e.type){const o=Gr(e.coordinates,i,n),a=Zr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!jr(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=$r(e.coordinates,i,n),a=Wr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!Nr(t,o))return!1}if("MultiPolygon"===e.type){const o=Gr(e.coordinates,i,n),a=Wr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!Vr(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Xr=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let i=1+(t<<1);const o=i+1;if(o<this.length&&r(e[o],e[i])<0&&(i=o),r(e[i],n)>=0)break;e[t]=e[i],t=i}e[t]=n}};function Yr(t,e,r=0,i=t.length-1,n=Jr){for(;i>r;){if(i-r>600){const o=i-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Yr(t,e,Math.max(r,Math.floor(e-a*l/o+c)),Math.min(i,Math.floor(e+(o-a)*l/o+c)),n)}const o=t[e];let a=r,s=i;for(Kr(t,r,e),n(t[i],o)>0&&Kr(t,r,i);a<s;){for(Kr(t,a,s),a++,s--;n(t[a],o)<0;)a++;for(;n(t[s],o)>0;)s--}0===n(t[r],o)?Kr(t,r,s):(s++,Kr(t,s,i)),s<=e&&(r=s+1),e<=s&&(i=s-1)}}function Kr(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function Jr(t,e){return t<e?-1:t>e?1:0}function Qr(t,e){if(t.length<=1)return[t];const r=[];let i,n;for(const e of t){const t=ei(e);0!==t&&(e.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&r.push(i),i=[e]):i.push(e))}if(i&&r.push(i),e>1)for(let t=0;t<r.length;t++)r[t].length<=e||(Yr(r[t],e,1,r[t].length-1,ti),r[t]=r[t].slice(0,e));return r}function ti(t,e){return e.area-t.area}function ei(t){let e=0;for(let r,i,n=0,o=t.length,a=o-1;n<o;a=n++)r=t[n],i=t[a],e+=(i.x-r.x)*(r.y+i.y);return e}const ri=1/298.257223563,ii=ri*(2-ri),ni=Math.PI/180;class oi{constructor(t){const e=6378.137*ni*1e3,r=Math.cos(t*ni),i=1/(1-ii*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*(1-ii)}distance(t,e){const r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r,i,n,o,a=1/0;for(let s=0;s<t.length-1;s++){let l=t[s][0],c=t[s][1],u=this.wrap(t[s+1][0]-l)*this.kx,h=(t[s+1][1]-c)*this.ky,p=0;0===u&&0===h||(p=(this.wrap(e[0]-l)*this.kx*u+(e[1]-c)*this.ky*h)/(u*u+h*h),p>1?(l=t[s+1][0],c=t[s+1][1]):p>0&&(l+=u/this.kx*p,c+=h/this.ky*p)),u=this.wrap(e[0]-l)*this.kx,h=(e[1]-c)*this.ky;const d=u*u+h*h;d<a&&(a=d,r=l,i=c,n=s,o=p)}return{point:[r,i],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function ai(t,e){return e[0]-t[0]}function si(t){return t[1]-t[0]+1}function li(t,e){return t[1]>=t[0]&&t[1]<e}function ci(t,e){if(t[0]>t[1])return[null,null];const r=si(t);if(e){if(2===r)return[t,null];const e=Math.floor(r/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===r)return[t,null];const i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function ui(t,e){if(!li(e,t.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)kr(r,t[i]);return r}function hi(t){const e=[1/0,1/0,-1/0,-1/0];for(const r of t)for(const t of r)kr(e,t);return e}function pi(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function di(t,e,r){if(!pi(t)||!pi(e))return NaN;let i=0,n=0;return t[2]<e[0]&&(i=e[0]-t[2]),t[0]>e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),r.distance([0,0],[i,n])}function fi(t,e,r){const i=r.pointOnLine(e,t);return r.distance(t,i.point)}function mi(t,e,r,i,n){const o=Math.min(fi(t,[r,i],n),fi(e,[r,i],n)),a=Math.min(fi(r,[t,e],n),fi(i,[t,e],n));return Math.min(o,a)}function gi(t,e,r,i,n){if(!li(e,t.length)||!li(i,r.length))return 1/0;let o=1/0;for(let a=e[0];a<e[1];++a){const e=t[a],s=t[a+1];for(let t=i[0];t<i[1];++t){const i=r[t],a=r[t+1];if(Fr(e,s,i,a))return 0;o=Math.min(o,mi(e,s,i,a,n))}}return o}function _i(t,e,r,i,n){if(!li(e,t.length)||!li(i,r.length))return NaN;let o=1/0;for(let a=e[0];a<=e[1];++a)for(let e=i[0];e<=i[1];++e)if(o=Math.min(o,n.distance(t[a],r[e])),0===o)return o;return o}function yi(t,e,r){if(Or(t,e,!0))return 0;let i=1/0;for(const n of e){const e=n[0],o=n[n.length-1];if(e!==o&&(i=Math.min(i,fi(t,[o,e],r)),0===i))return i;const a=r.pointOnLine(n,t);if(i=Math.min(i,r.distance(t,a.point)),0===i)return i}return i}function vi(t,e,r,i){if(!li(e,t.length))return NaN;for(let i=e[0];i<=e[1];++i)if(Or(t[i],r,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(const t of r)for(let r=0,o=t.length,s=o-1;r<o;s=r++){const o=t[s],l=t[r];if(Fr(e,a,o,l))return 0;n=Math.min(n,mi(e,a,o,l,i))}}return n}function bi(t,e){for(const r of t)for(const t of r)if(Or(t,e,!0))return!0;return!1}function xi(t,e,r,i=1/0){const n=hi(t),o=hi(e);if(i!==1/0&&di(n,o,r)>=i)return i;if(Rr(n,o)){if(bi(t,e))return 0}else if(bi(e,t))return 0;let a=1/0;for(const i of t)for(let t=0,n=i.length,o=n-1;t<n;o=t++){const n=i[o],s=i[t];for(const t of e)for(let e=0,i=t.length,o=i-1;e<i;o=e++){const i=t[o],l=t[e];if(Fr(n,s,i,l))return 0;a=Math.min(a,mi(n,s,i,l,r))}}return a}function wi(t,e,r,i,n,o){if(!o)return;const a=di(ui(i,o),n,r);a<e&&t.push([a,o,[0,0]])}function Ti(t,e,r,i,n,o,a){if(!o||!a)return;const s=di(ui(i,o),ui(n,a),r);s<e&&t.push([s,o,a])}function Si(t,e,r,i,n=1/0){let o=Math.min(i.distance(t[0],r[0][0]),n);if(0===o)return o;const a=new Xr([[0,[0,t.length-1],[0,0]]],ai),s=hi(r);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=e?50:100;if(si(l)<=c){if(!li(l,t.length))return NaN;if(e){const e=vi(t,l,r,i);if(isNaN(e)||0===e)return e;o=Math.min(o,e)}else for(let e=l[0];e<=l[1];++e){const n=yi(t[e],r,i);if(o=Math.min(o,n),0===o)return 0}}else{const r=ci(l,e);wi(a,o,i,t,s,r[0]),wi(a,o,i,t,s,r[1])}}return o}function Pi(t,e,r,i,n,o=1/0){let a=Math.min(o,n.distance(t[0],r[0]));if(0===a)return a;const s=new Xr([[0,[0,t.length-1],[0,r.length-1]]],ai);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],u=e?50:100,h=i?50:100;if(si(l)<=u&&si(c)<=h){if(!li(l,t.length)&&li(c,r.length))return NaN;let o;if(e&&i)o=gi(t,l,r,c,n),a=Math.min(a,o);else if(e&&!i){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(o=fi(r[t],e,n),a=Math.min(a,o),0===a)return a}else if(!e&&i){const e=r.slice(c[0],c[1]+1);for(let r=l[0];r<=l[1];++r)if(o=fi(t[r],e,n),a=Math.min(a,o),0===a)return a}else o=_i(t,l,r,c,n),a=Math.min(a,o)}else{const o=ci(l,e),u=ci(c,i);Ti(s,a,n,t,r,o[0],u[0]),Ti(s,a,n,t,r,o[0],u[1]),Ti(s,a,n,t,r,o[1],u[0]),Ti(s,a,n,t,r,o[1],u[1])}}return a}function Mi(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class Ai{constructor(t,e){this.type=Ft,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ve(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Ai(e,e.features.map(t=>Mi(t.geometry)).flat());if("Feature"===e.type)return new Ai(e,Mi(e.geometry));if("type"in e&&"coordinates"in e)return new Ai(e,Mi(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=t.geometry(),i=r.flat().map(e=>zr([e.x,e.y],t.canonical));if(0===r.length)return NaN;const n=new oi(i[0][1]);let o=1/0;for(const t of e){switch(t.type){case"Point":o=Math.min(o,Pi(i,!1,[t.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Pi(i,!1,t.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Si(i,!1,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=t.geometry(),i=r.flat().map(e=>zr([e.x,e.y],t.canonical));if(0===r.length)return NaN;const n=new oi(i[0][1]);let o=1/0;for(const t of e){switch(t.type){case"Point":o=Math.min(o,Pi(i,!0,[t.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Pi(i,!0,t.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Si(i,!0,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const r=t.geometry();if(0===r.length||0===r[0].length)return NaN;const i=Qr(r,0).map(e=>e.map(e=>e.map(e=>zr([e.x,e.y],t.canonical)))),n=new oi(i[0][0][0][1]);let o=1/0;for(const t of e)for(const e of i){switch(t.type){case"Point":o=Math.min(o,Si([t.coordinates],!1,e,n,o));break;case"LineString":o=Math.min(o,Si(t.coordinates,!0,e,n,o));break;case"Polygon":o=Math.min(o,xi(e,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ei{constructor(t){this.type=Ut,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=t[1];return null==r?e.error("Global state property must be defined."):"string"!=typeof r?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Ei(r)}evaluate(t){var e;const r=null===(e=t.globals)||void 0===e?void 0:e.globalState;return r&&0!==Object.keys(r).length?ve(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Ii={"==":vr,"!=":br,">":wr,"<":xr,">=":Sr,"<=":Tr,array:Ze,at:tr,boolean:Ze,case:nr,coalesce:mr,collator:Pr,format:Ar,image:Er,in:er,"index-of":rr,interpolate:pr,"interpolate-hcl":pr,"interpolate-lab":pr,length:Ir,let:Je,literal:Ge,match:ir,number:Ze,"number-format":Mr,object:Ze,slice:or,step:sr,string:Ze,"to-boolean":He,"to-color":He,"to-number":He,"to-string":He,var:Qe,within:Hr,distance:Ai,"global-state":Ei};class Ci{constructor(t,e,r,i){this.name=t,this.type=e,this._evaluate=r,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const r=t[0],i=Ci.definitions[r];if(!i)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let s=null;for(const[i,o]of a){s=new Ke(e.registry,Li,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],n=Array.isArray(i)?i[e-1]:i.type,o=s.parse(r,1+a.length,n);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(i)&&i.length!==a.length)s.error(`Expected ${i.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(i)?i[t]:i.type,r=a[t];s.concat(t+1).checkSubtype(e,r.type)}if(0===s.errors.length)return new Ci(r,n,o,a)}}if(1===a.length)e.errors.push(...s.errors);else{const r=(a.length?a:o).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(Kt).join(", ")})`:`(${Kt(e.type)}...)`;var e}).join(" | "),i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],1+i.length);if(!n)return null;i.push(Kt(n.type))}e.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(t,e){Ci.definitions=e;for(const r in e)t[r]=Ci}}function Di(t,[e,r,i,n]){e=e.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);const o=n?n.evaluate(t):1,a=Ne(e,r,i,o);if(a)throw new Le(a);return new Ae(e/255,r/255,i/255,o,!1)}function zi(t,e){return t in e}function ki(t,e){const r=e[t];return void 0===r?null:r}function Ri(t){return{type:t}}function Li(t){if(t instanceof Qe)return Li(t.boundExpression);if(t instanceof Ci&&"error"===t.name)return!1;if(t instanceof Pr)return!1;if(t instanceof Hr)return!1;if(t instanceof Ai)return!1;if(t instanceof Ei)return!1;const e=t instanceof He||t instanceof Ze;let r=!0;return t.eachChild(t=>{r=e?r&&Li(t):r&&t instanceof Ge}),!!r&&Fi(t)&&Oi(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Fi(t){if(t instanceof Ci){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Hr)return!1;if(t instanceof Ai)return!1;let e=!0;return t.eachChild(t=>{e&&!Fi(t)&&(e=!1)}),e}function Bi(t){if(t instanceof Ci&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!Bi(t)&&(e=!1)}),e}function Oi(t,e){if(t instanceof Ci&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(t=>{r&&!Oi(t,e)&&(r=!1)}),r}function ji(t){return{result:"success",value:t}}function Ni(t){return{result:"error",value:t}}function Vi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ui(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function $i(t){return!!t.expression&&t.expression.interpolated}function Gi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function qi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Ue(t)===Vt}function Zi(t){return t}function Wi(t,e){const r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),n=t.type||($i(e)?"exponential":"interval"),o=function(t){switch(t.type){case"color":return Ae.parse;case"padding":return ze.parse;case"numberArray":return ke.parse;case"colorArray":return Re.parse;default:return null}}(e);if(o&&((t=zt({},t)).stops&&(t.stops=t.stops.map(t=>[t[0],o(t[1])])),t.default=o(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;const s=function(t){switch(t){case"exponential":return Ki;case"interval":return Yi;case"categorical":return Xi;case"identity":return Ji;default:throw new Error(`Unknown function type "${t}"`)}}(n);let l,c;if("categorical"===n){l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}if(r){const r={},i=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],o=n[0].zoom;void 0===r[o]&&(r[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},i.push(o)),r[o].stops.push([n[0].value,n[1]])}const n=[];for(const t of i)n.push([r[t].zoom,Wi(r[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:pr.interpolationFactor.bind(void 0,o),zoomStops:n.map(t=>t[0]),evaluate:({zoom:r},i)=>Ki({stops:n,base:t.base},e,r).evaluate(r,i)}}if(i){const r="exponential"===n?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:pr.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map(t=>t[0]),evaluate:({zoom:r})=>s(t,e,r,l,c)}}return{kind:"source",evaluate(r,i){const n=i&&i.properties?i.properties[t.property]:void 0;return void 0===n?Hi(t.default,e.default):s(t,e,n,l,c)}}}function Hi(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Xi(t,e,r,i,n){return Hi(typeof r===n?i[r]:void 0,t.default,e.default)}function Yi(t,e,r){if("number"!==Gi(r))return Hi(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const n=ar(t.stops.map(t=>t[0]),r);return t.stops[n][1]}function Ki(t,e,r){const i=void 0!==t.base?t.base:1;if("number"!==Gi(r))return Hi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const o=ar(t.stops.map(t=>t[0]),r),a=function(t,e,r,i){const n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(r,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],c=fr[e.type]||Zi;return"function"==typeof s.evaluate?{evaluate(...e){const r=s.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==i)return c(r,i,a,t.colorSpace)}}:c(s,l,a,t.colorSpace)}function Ji(t,e,r){switch(e.type){case"color":r=Ae.parse(r);break;case"formatted":r=De.fromString(r.toString());break;case"resolvedImage":r=Oe.fromString(r.toString());break;case"padding":r=ze.parse(r);break;case"colorArray":r=Re.parse(r);break;case"numberArray":r=ke.parse(r);break;default:Gi(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0)}return Hi(r,t.default,e.default)}Ci.register(Ii,{error:[{kind:"error"},[Bt],(t,[e])=>{throw new Le(e.evaluate(t))}],typeof:[Bt,[Ut],(t,[e])=>Kt(Ue(e.evaluate(t)))],"to-rgba":[Yt(Ft,4),[jt],(t,[e])=>{const[r,i,n,o]=e.evaluate(t).rgb;return[255*r,255*i,255*n,o]}],rgb:[jt,[Ft,Ft,Ft],Di],rgba:[jt,[Ft,Ft,Ft,Ft],Di],has:{type:Ot,overloads:[[[Bt],(t,[e])=>zi(e.evaluate(t),t.properties())],[[Bt,Vt],(t,[e,r])=>zi(e.evaluate(t),r.evaluate(t))]]},get:{type:Ut,overloads:[[[Bt],(t,[e])=>ki(e.evaluate(t),t.properties())],[[Bt,Vt],(t,[e,r])=>ki(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Ut,[Bt],(t,[e])=>ki(e.evaluate(t),t.featureState||{})],properties:[Vt,[],t=>t.properties()],"geometry-type":[Bt,[],t=>t.geometryType()],id:[Ut,[],t=>t.id()],zoom:[Ft,[],t=>t.globals.zoom],"heatmap-density":[Ft,[],t=>t.globals.heatmapDensity||0],elevation:[Ft,[],t=>t.globals.elevation||0],"line-progress":[Ft,[],t=>t.globals.lineProgress||0],accumulated:[Ut,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Ft,Ri(Ft),(t,e)=>{let r=0;for(const i of e)r+=i.evaluate(t);return r}],"*":[Ft,Ri(Ft),(t,e)=>{let r=1;for(const i of e)r*=i.evaluate(t);return r}],"-":{type:Ft,overloads:[[[Ft,Ft],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Ft],(t,[e])=>-e.evaluate(t)]]},"/":[Ft,[Ft,Ft],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[Ft,[Ft,Ft],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Ft,[],()=>Math.LN2],pi:[Ft,[],()=>Math.PI],e:[Ft,[],()=>Math.E],"^":[Ft,[Ft,Ft],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Ft,[Ft],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Ft,[Ft],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Ft,[Ft],(t,[e])=>Math.log(e.evaluate(t))],log2:[Ft,[Ft],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Ft,[Ft],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Ft,[Ft],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Ft,[Ft],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Ft,[Ft],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Ft,[Ft],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Ft,[Ft],(t,[e])=>Math.atan(e.evaluate(t))],min:[Ft,Ri(Ft),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[Ft,Ri(Ft),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[Ft,[Ft],(t,[e])=>Math.abs(e.evaluate(t))],round:[Ft,[Ft],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ft,[Ft],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Ft,[Ft],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Ot,[Bt,Ut],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[Ot,[Ut],(t,[e])=>t.id()===e.value],"filter-type-==":[Ot,[Bt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Ot,[Bt,Ut],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Ot,[Ut],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],"filter->":[Ot,[Bt,Ut],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Ot,[Ut],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[Ot,[Bt,Ut],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Ot,[Ut],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[Ot,[Bt,Ut],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Ot,[Ut],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[Ot,[Ut],(t,[e])=>e.value in t.properties()],"filter-has-id":[Ot,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Ot,[Yt(Bt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Ot,[Yt(Ut)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Ot,[Bt,Yt(Ut)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Ot,[Bt,Yt(Ut)],(t,[e,r])=>function(t,e,r,i){for(;r<=i;){const n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ot,overloads:[[[Ot,Ot],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Ri(Ot),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:Ot,overloads:[[[Ot,Ot],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Ri(Ot),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[Ot,[Ot],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Ot,[Bt],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Bt,[Bt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Bt,[Bt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Bt,Ri(Ut),(t,e)=>e.map(e=>$e(e.evaluate(t))).join("")],"resolved-locale":[Bt,[$t],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Qi{constructor(t,e,r){this.expression=t,this._warningHistory={},this._evaluator=new Ye,this._defaultValue=e?function(t){if("color"===t.type&&qi(t.default))return new Ae(0,0,0,0);switch(t.type){case"color":return Ae.parse(t.default)||null;case"padding":return ze.parse(t.default)||null;case"numberArray":return ke.parse(t.default)||null;case"colorArray":return Re.parse(t.default)||null;case"variableAnchorOffsetCollection":return Be.parse(t.default)||null;case"projectionDefinition":return je.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._globalState&&(t=cn(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,o){this._globalState&&(t=cn(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function tn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ii}function en(t,e,r){const i=new Ke(Ii,Li,[],e?function(t){const e={color:jt,string:Bt,number:Ft,enum:Bt,boolean:Ot,formatted:Gt,padding:qt,numberArray:Wt,colorArray:Zt,projectionDefinition:Nt,resolvedImage:Ht,variableAnchorOffsetCollection:Xt};return"array"===t.type?Yt(e[t.value]||Ut,t.length):e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?ji(new Qi(n,e,r)):Ni(i.errors)}class rn{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Bi(e.expression),this.globalStateRefs=ln(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._globalState&&(t=cn(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)}evaluate(t,e,r,i,n,o){return this._globalState&&(t=cn(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,o)}}class nn{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Bi(e.expression),this.globalStateRefs=ln(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._globalState&&(t=cn(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)}evaluate(t,e,r,i,n,o){return this._globalState&&(t=cn(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,o)}interpolationFactor(t,e,r){return this.interpolationType?pr.interpolationFactor(this.interpolationType,t,e,r):0}}function on(t,e,r){const i=en(t,e,r);if("error"===i.result)return i;const n=i.value.expression,o=Fi(n);if(!o&&!Vi(e))return Ni([new kt("","data expressions not supported")]);const a=Oi(n,["zoom"]);if(!a&&!Ui(e))return Ni([new kt("","zoom expressions not supported")]);const s=sn(n);return s||a?s instanceof kt?Ni([s]):s instanceof pr&&!$i(e)?Ni([new kt("",'"interpolate" expressions cannot be used with this property')]):ji(s?new nn(o?"camera":"composite",i.value,s.labels,s instanceof pr?s.interpolation:void 0,r):new rn(o?"constant":"source",i.value,r)):Ni([new kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class an{constructor(t,e){this._parameters=t,this._specification=e,zt(this,Wi(this._parameters,this._specification))}static deserialize(t){return new an(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function sn(t){let e=null;if(t instanceof Je)e=sn(t.result);else if(t instanceof mr){for(const r of t.args)if(e=sn(r),e)break}else(t instanceof sr||t instanceof pr)&&t.input instanceof Ci&&"zoom"===t.input.name&&(e=t);return e instanceof kt||t.eachChild(t=>{const r=sn(t);r instanceof kt?e=r:!e&&r?e=new kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new kt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function ln(t,e=new Set){return t instanceof Ei&&e.add(t.key),t.eachChild(t=>{ln(t,e)}),e}function cn(t,e){const{zoom:r,heatmapDensity:i,elevation:n,lineProgress:o,isSupportedScript:a,accumulated:s}=null!=t?t:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:o,isSupportedScript:a,accumulated:s,globalState:e}}function un(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!un(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const hn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pn(t,e){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};un(t)||(t=mn(t));const r=en(t,hn,e);if("error"===r.result)throw new Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,e,i)=>r.value.evaluate(t,e,{},i),needGeometry:fn(t),getGlobalStateRefs:()=>ln(r.value.expression)}}function dn(t,e){return t<e?-1:t>e?1:0}function fn(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(fn(t[e]))return!0;return!1}function mn(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?gn(t[1],t[2],"=="):"!="===e?vn(gn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?gn(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(mn))):"all"===e?["all"].concat(t.slice(1).map(mn)):"none"===e?["all"].concat(t.slice(1).map(mn).map(vn)):"in"===e?_n(t[1],t.slice(2)):"!in"===e?vn(_n(t[1],t.slice(2))):"has"===e?yn(t[1]):"!has"!==e||vn(yn(t[1]));var r}function gn(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function _n(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(dn)]]:["filter-in-small",t,["literal",e]]}}function yn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function vn(t){return["!",t]}function bn(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${bn(r)},`;return`${e}]`}const r=Object.keys(t).sort();let i="{";for(let e=0;e<r.length;e++)i+=`${JSON.stringify(r[e])}:${bn(t[r[e]])},`;return`${i}}`}function xn(t){let e="";for(const r of bt)e+=`/${bn(t[r])}`;return e}function wn(t){const e=t.value;return e?[new Dt(t.key,e,"constants have been deprecated as of v8")]:[]}function Tn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Sn(t){if(Array.isArray(t))return t.map(Sn);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Sn(t[r]);return e}return Tn(t)}function Pn(t){const e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec;let l=[];const c=Gi(r);if("object"!==c)return[new Dt(e,r,`object expected, ${c} found`)];for(const t in r){const c=t.split(".")[0],u=ve(i,c)||i["*"];let h;if(ve(n,c))h=n[c];else if(ve(i,c)){if(void 0===r[t])continue;h=s}else if(n["*"])h=n["*"];else{if(!i["*"]){l.push(new Dt(e,r[t],`unknown property "${t}"`));continue}h=s}l=l.concat(h({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:o,styleSpec:a,object:r,objectKey:t,validateSpec:s},r))}for(const t in i)n[t]||i[t].required&&void 0===i[t].default&&void 0===r[t]&&l.push(new Dt(e,r,`missing required property "${t}"`));return l}function Mn(t){const e=t.value,r=t.valueSpec,i=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==Gi(e))return[new Dt(o,e,`array expected, ${Gi(e)} found`)];if(r.length&&e.length!==r.length)return[new Dt(o,e,`array length ${r.length} expected, length ${e.length} found`)];let s={type:r.value,values:r.values};n.$version<7&&(s.function=r.function),"object"===Gi(r.value)&&(s=r.value);let l=[];for(let r=0;r<e.length;r++)l=l.concat(a({array:e,arrayIndex:r,value:e[r],valueSpec:s,validateSpec:t.validateSpec,style:i,styleSpec:n,key:`${o}[${r}]`}));return l}function An(t){const e=t.key,r=t.value,i=t.valueSpec;let n=Gi(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new Dt(e,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new Dt(e,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new Dt(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function En(t){const e=t.valueSpec,r=Tn(t.value.type);let i,n,o,a={};const s="categorical"!==r&&void 0===t.value.property,l=!s,c="array"===Gi(t.value.stops)&&"array"===Gi(t.value.stops[0])&&"object"===Gi(t.value.stops[0][0]),u=Pn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new Dt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const i=t.value;return e=e.concat(Mn({key:t.key,value:i,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Gi(i)&&0===i.length&&e.push(new Dt(t.key,i,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&s&&u.push(new Dt(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||u.push(new Dt(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!$i(t.valueSpec)&&u.push(new Dt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Vi(t.valueSpec)?u.push(new Dt(t.key,t.value,"property functions not supported")):s&&!Ui(t.valueSpec)&&u.push(new Dt(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!c||void 0!==t.value.property||u.push(new Dt(t.key,t.value,'"property" property is required')),u;function h(t){let r=[];const i=t.value,s=t.key;if("array"!==Gi(i))return[new Dt(s,i,`array expected, ${Gi(i)} found`)];if(2!==i.length)return[new Dt(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==Gi(i[0]))return[new Dt(s,i,`object expected, ${Gi(i[0])} found`)];if(void 0===i[0].zoom)return[new Dt(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Dt(s,i,"object stop key must have value")];if(o&&o>Tn(i[0].zoom))return[new Dt(s,i[0].zoom,"stop zoom values must appear in ascending order")];Tn(i[0].zoom)!==o&&(o=Tn(i[0].zoom),n=void 0,a={}),r=r.concat(Pn({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:An,value:p}}))}else r=r.concat(p({key:`${s}[0]`,value:i[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},i));return tn(Sn(i[1]))?r.concat([new Dt(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${s}[1]`,value:i[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const s=Gi(t.value),l=Tn(t.value),c=null!==t.value?t.value:o;if(i){if(s!==i)return[new Dt(t.key,c,`${s} stop domain type must match previous stop domain type ${i}`)]}else i=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Dt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==r){let i=`number expected, ${s} found`;return Vi(e)&&void 0===r&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Dt(t.key,c,i)]}return"categorical"!==r||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===s&&void 0!==n&&l<n?[new Dt(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===r&&l in a?[new Dt(t.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Dt(t.key,c,`integer expected, found ${l}`)]}}function In(t){const e=("property"===t.expressionContext?on:en)(Sn(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new Dt(`${t.key}${e.key}`,t.value,e.message));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new Dt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Bi(r))return[new Dt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Bi(r))return[new Dt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Oi(r,["zoom","feature-state"]))return[new Dt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Fi(r))return[new Dt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cn(t){const e=t.key,r=t.value,i=Gi(r);return"string"!==i?[new Dt(e,r,`color expected, ${i} found`)]:Ae.parse(String(r))?[]:[new Dt(e,r,`color expected, "${r}" found`)]}function Dn(t){const e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(Tn(r))&&n.push(new Dt(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(Tn(r))&&n.push(new Dt(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function zn(t){return un(Sn(t.value))?In(zt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):kn(t)}function kn(t){const e=t.value,r=t.key;if("array"!==Gi(e))return[new Dt(r,e,`array expected, ${Gi(e)} found`)];const i=t.styleSpec;let n,o=[];if(e.length<1)return[new Dt(r,e,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Tn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Tn(e[1])&&o.push(new Dt(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new Dt(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Gi(e[1]),"string"!==n&&o.push(new Dt(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a<e.length;a++)n=Gi(e[a]),"$type"===Tn(e[1])?o=o.concat(Dn({key:`${r}[${a}]`,value:e[a],valueSpec:i.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Dt(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let i=1;i<e.length;i++)o=o.concat(kn({key:`${r}[${i}]`,value:e[i],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=Gi(e[1]),2!==e.length?o.push(new Dt(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Dt(`${r}[1]`,e[1],`string expected, ${n} found`))}return o}function Rn(t,e){const r=t.key,i=t.validateSpec,n=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return i({key:r,value:a,valueSpec:o.transition,style:n,styleSpec:o});const u=t.valueSpec||l[s];if(!u)return[new Dt(r,a,`unknown property "${s}"`)];let h;if("string"===Gi(a)&&Vi(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new Dt(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&"text-font"===s&&qi(Sn(a))&&"identity"===Tn(a.type)&&p.push(new Dt(r,a,'"text-font" does not support identity functions')),p.concat(i({key:t.key,value:a,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Ln(t){return Rn(t,"paint")}function Fn(t){return Rn(t,"layout")}function Bn(t){let e=[];const r=t.value,i=t.key,n=t.style,o=t.styleSpec;if("object"!==Gi(r))return[new Dt(i,r,`object expected, ${Gi(r)} found`)];r.type||r.ref||e.push(new Dt(i,r,'either "type" or "ref" is required'));let a=Tn(r.type);const s=Tn(r.ref);if(r.id){const o=Tn(r.id);for(let a=0;a<t.arrayIndex;a++){const t=n.layers[a];Tn(t.id)===o&&e.push(new Dt(i,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&e.push(new Dt(i,r[t],`"${t}" is prohibited for ref layers`))}),n.layers.forEach(e=>{Tn(e.id)===s&&(t=e)}),t?t.ref?e.push(new Dt(i,r.ref,"ref cannot reference another ref layer")):a=Tn(t.type):e.push(new Dt(i,r.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(r.source){const t=n.sources&&n.sources[r.source],o=t&&Tn(t.type);t?"vector"===o&&"raster"===a?e.push(new Dt(i,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a||"raster-dem"!==o&&"color-relief"===a?e.push(new Dt(i,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?e.push(new Dt(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==o||r["source-layer"]?"raster-dem"===o&&"hillshade"!==a&&"color-relief"!==a?e.push(new Dt(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new Dt(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Dt(i,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Dt(i,r.source,`source "${r.source}" not found`))}else e.push(new Dt(i,r,'missing required property "source"'));return e=e.concat(Pn({key:i,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:zn,layout:t=>Pn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Fn(zt({layerType:a},t))}}),paint:t=>Pn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Ln(zt({layerType:a},t))}})}})),e}function On(t){const e=t.value,r=t.key,i=Gi(e);return"string"!==i?[new Dt(r,e,`string expected, ${i} found`)]:[]}const jn={promoteId:function({key:t,value:e}){if("string"===Gi(e))return On({key:t,value:e});{const r=[];for(const i in e)r.push(...On({key:`${t}.${i}`,value:e[i]}));return r}}};function Nn(t){const e=t.value,r=t.key,i=t.styleSpec,n=t.style,o=t.validateSpec;if(!e.type)return[new Dt(r,e,'"type" is required')];const a=Tn(e.type);let s;switch(a){case"vector":case"raster":return s=Pn({key:r,value:e,valueSpec:i[`source_${a.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:jn,validateSpec:o}),s;case"raster-dem":return s=function(t){var e;const r=null!==(e=t.sourceName)&&void 0!==e?e:"",i=t.value,n=t.styleSpec,o=n.source_raster_dem,a=t.style;let s=[];const l=Gi(i);if(void 0===i)return s;if("object"!==l)return s.push(new Dt("source_raster_dem",i,`object expected, ${l} found`)),s;const c="custom"===Tn(i.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in i)!c&&u.includes(e)?s.push(new Dt(e,i[e],`In "${r}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[e]?s=s.concat(t.validateSpec({key:e,value:i[e],valueSpec:o[e],validateSpec:t.validateSpec,style:a,styleSpec:n})):s.push(new Dt(e,i[e],`unknown property "${e}"`));return s}({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=Pn({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:jn}),e.cluster)for(const t in e.clusterProperties){const[i,n]=e.clusterProperties[t],o="string"==typeof i?[i,["accumulated"],["get",t]]:i;s.push(...In({key:`${r}.${t}.map`,value:n,expressionContext:"cluster-map"})),s.push(...In({key:`${r}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Pn({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return Pn({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new Dt(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Vn(t){const e=t.value,r=t.styleSpec,i=r.light,n=t.style;let o=[];const a=Gi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Dt("light",e,`object expected, ${a} found`)]),o;for(const a in e){const s=a.match(/^(.*)-transition$/);o=o.concat(s&&i[s[1]]&&i[s[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r}):i[a]?t.validateSpec({key:a,value:e[a],valueSpec:i[a],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new Dt(a,e[a],`unknown property "${a}"`)])}return o}function Un(t){const e=t.value,r=t.styleSpec,i=r.sky,n=t.style,o=Gi(e);if(void 0===e)return[];if("object"!==o)return[new Dt("sky",e,`object expected, ${o} found`)];let a=[];for(const o in e)a=a.concat(i[o]?t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r}):[new Dt(o,e[o],`unknown property "${o}"`)]);return a}function $n(t){const e=t.value,r=t.styleSpec,i=r.terrain,n=t.style;let o=[];const a=Gi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Dt("terrain",e,`object expected, ${a} found`)]),o;for(const a in e)o=o.concat(i[a]?t.validateSpec({key:a,value:e[a],valueSpec:i[a],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new Dt(a,e[a],`unknown property "${a}"`)]);return o}function Gn(t){let e=[];const r=t.value,i=t.key;if(Array.isArray(r)){const n=[],o=[];for(const a in r)r[a].id&&n.includes(r[a].id)&&e.push(new Dt(i,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),n.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new Dt(i,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url),e=e.concat(Pn({key:`${i}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return On({key:i,value:r})}function qn(t){return Boolean(t)&&t.constructor===Object}function Zn(t){return qn(t.value)?[]:[new Dt(t.key,t.value,`object expected, ${Gi(t.value)} found`)]}const Wn={"*":()=>[],array:Mn,boolean:function(t){const e=t.value,r=t.key,i=Gi(e);return"boolean"!==i?[new Dt(r,e,`boolean expected, ${i} found`)]:[]},number:An,color:Cn,constants:wn,enum:Dn,filter:zn,function:En,layer:Bn,object:Pn,source:Nn,light:Vn,sky:Un,terrain:$n,projection:function(t){const e=t.value,r=t.styleSpec,i=r.projection,n=t.style,o=Gi(e);if(void 0===e)return[];if("object"!==o)return[new Dt("projection",e,`object expected, ${o} found`)];let a=[];for(const o in e)a=a.concat(i[o]?t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r}):[new Dt(o,e[o],`unknown property "${o}"`)]);return a},projectionDefinition:function(t){const e=t.key;let r=t.value;r=r instanceof String?r.valueOf():r;const i=Gi(r);return"array"!==i||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(r)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(r)?["array","string"].includes(i)?[]:[new Dt(e,r,`projection expected, invalid type "${i}" found`)]:[new Dt(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:On,formatted:function(t){return 0===On(t).length?[]:In(t)},resolvedImage:function(t){return 0===On(t).length?[]:In(t)},padding:function(t){const e=t.key,r=t.value;if("array"===Gi(r)){if(r.length<1||r.length>4)return[new Dt(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const i={type:"number"};let n=[];for(let o=0;o<r.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return n}return An({key:e,value:r,valueSpec:{}})},numberArray:function(t){const e=t.key,r=t.value;if("array"===Gi(r)){const i={type:"number"};if(r.length<1)return[new Dt(e,r,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<r.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return n}return An({key:e,value:r,valueSpec:{}})},colorArray:function(t){const e=t.key,r=t.value;if("array"===Gi(r)){if(r.length<1)return[new Dt(e,r,"array length at least 1 expected, length 0 found")];let t=[];for(let i=0;i<r.length;i++)t=t.concat(Cn({key:`${e}[${i}]`,value:r[i]}));return t}return Cn({key:e,value:r})},variableAnchorOffsetCollection:function(t){const e=t.key,r=t.value,i=Gi(r),n=t.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new Dt(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let i=0;i<r.length;i+=2)o=o.concat(Dn({key:`${e}[${i}]`,value:r[i],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(Mn({key:`${e}[${i+1}]`,value:r[i+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return o},sprite:Gn,state:Zn,fontFaces:function(t){const e=t.key,r=t.value,i=t.validateSpec,n=t.styleSpec,o=t.style;if(!qn(r))return[new Dt(e,r,`object expected, ${Gi(r)} found`)];const a=[];for(const t in r){const s=r[t],l=Gi(s);if("string"===l)a.push(...On({key:`${e}.${t}`,value:s}));else if("array"===l){const r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of s.entries())a.push(...Pn({key:`${e}.${t}[${l}]`,value:c,valueSpec:r,styleSpec:n,style:o,validateSpec:i}))}else a.push(new Dt(`${e}.${t}`,s,`string or array expected, ${l} found`))}return a}};function Hn(t){const e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Hn,r.expression&&qi(Tn(e))?En(t):r.expression&&tn(Sn(e))?In(t):r.type&&Wn[r.type]?Wn[r.type](t):Pn(zt({},t,{valueSpec:r.type?i[r.type]:r}))}function Xn(t){const e=t.value,r=t.key,i=On(t);return i.length||(-1===e.indexOf("{fontstack}")&&i.push(new Dt(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new Dt(r,e,'"glyphs" url must include a "{range}" token'))),i}function Yn(t,e=vt){let r=[];return r=r.concat(Hn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Hn,objectElementValidators:{glyphs:Xn,"*":()=>[]}})),t.constants&&(r=r.concat(wn({key:"constants",value:t.constants}))),Jn(r)}function Kn(t){return function(e){return t(Object.assign({},e,{validateSpec:Hn}))}}function Jn(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function Qn(t){return function(...e){return Jn(t.apply(this,e))}}Yn.source=Qn(Kn(Nn)),Yn.sprite=Qn(Kn(Gn)),Yn.glyphs=Qn(Kn(Xn)),Yn.light=Qn(Kn(Vn)),Yn.sky=Qn(Kn(Un)),Yn.terrain=Qn(Kn($n)),Yn.state=Qn(Kn(Zn)),Yn.layer=Qn(Kn(Bn)),Yn.filter=Qn(Kn(zn)),Yn.paintProperty=Qn(Kn(Ln)),Yn.layoutProperty=Qn(Kn(Fn));const to={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class eo{constructor(t,e){this._globalState=e,this.setValue(t)}evaluate(){var t;return null!==(t=this._literalValue)&&void 0!==t?t:this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t)return this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const e=en(t,to,this._globalState);if("error"===e.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=ln(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const ro=vt,io=Yn,no=io.light,oo=io.sky,ao=io.paintProperty,so=io.layoutProperty;function lo(t,e){let r=!1;if(e&&e.length)for(const i of e)t.fire(new _t(new Error(i.message))),r=!0;return r}class co{constructor(t,e,r){const i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(r=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],r=n[3+t+1];i.push(e===r?null:n.subarray(e,r))}const o=n[3+i.length+1];this.keys=n.subarray(n[3+i.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const n=r/e*t;this.min=-n,this.max=t+n}insert(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,i,n,o){this.cells[n].push(o)}query(t,e,r,i,n){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=i&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,r,i,this._queryCell,o,{},n),o}}_queryCell(t,e,r,i,n,o,a,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const h=l[u];if(void 0===a[h]){const l=4*h;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&r>=c[l+0]&&i>=c[l+1])?(a[h]=!0,o.push(n[h])):a[h]=!1}}}}_forEachCell(t,e,r,i,n,o,a,s){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let p=l;p<=u;p++)for(let l=c;l<=h;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,r,i,c,o,a,s))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,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let n=e;for(let e=0;e<t.length;e++){const r=t[e];i[3+e]=n,i.set(r,n),n+=r.length}return i[3+t.length]=n,i.set(this.keys,n),n+=this.keys.length,i[3+t.length+1]=n,i.set(this.bboxes,n),n+=this.bboxes.length,i.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new co(t.buffer)}}const uo={};function ho(t,e,r={}){if(uo[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),uo[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}ho("Object",Object),ho("Set",Set),ho("TransferableGridIndex",co),ho("Color",Ae),ho("Error",Error),ho("AJAXError",ut),ho("ResolvedImage",Oe),ho("StylePropertyFunction",an),ho("StyleExpression",Qi,{omit:["_evaluator"]}),ho("ZoomDependentExpression",nn),ho("ZoomConstantExpression",rn),ho("CompoundExpression",Ci,{omit:["_evaluate"]});for(const t in Ii)Ii[t]._classRegistryKey||ho(`Expression_${t}`,Ii[t]);function po(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function fo(t){return t.$name||t.constructor._classRegistryKey}function mo(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=fo(t);return!(!e||"Object"===e)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||po(t)||H(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function go(t,e){if(mo(t))return(po(t)||H(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const i of t)r.push(go(i,e));return r}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const r=fo(t);if(!r)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!uo[r])throw new Error(`${r} is not registered.`);const{klass:i}=uo[r],n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(uo[r].omit.indexOf(i)>=0)continue;const o=t[i];n[i]=uo[r].shallow.indexOf(i)>=0?o:go(o,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function _o(t){if(mo(t))return t;if(Array.isArray(t))return t.map(_o);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=fo(t)||"Object";if(!uo[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=uo[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const i=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const n=t[r];i[r]=uo[e].shallow.indexOf(r)>=0?n:_o(n)}return i}class yo{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}function vo(t){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function bo(t){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function xo(t){return/\s/u.test(String.fromCodePoint(t))}function wo(t){for(const e of t)if(bo(e.codePointAt(0)))return!0;return!1}function To(t){for(const e of t)if(!Mo(e.codePointAt(0)))return!1;return!0}function So(t){const e=t.map(t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}}).filter(t=>t);return new RegExp(e.join("|"),"u")}const Po=So(["Arab","Dupl","Mong","Ougr","Syrc"]);function Mo(t){return!Po.test(String.fromCodePoint(t))}function Ao(t){return!(bo(t)||(e=t,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const Eo=So(["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 Io(t){return Eo.test(String.fromCodePoint(t))}function Co(t,e){return!(!e&&Io(t)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t)))}function Do(t){for(const e of t)if(Io(e.codePointAt(0)))return!0;return!1}const zo=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(zo.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,r){return e(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;const e=t.pluginURL,i=new Promise(t=>{this.loadScriptResolve=t});r(e);const n=new Promise(t=>setTimeout(()=>t(),this.TIMEOUT));if(yield Promise.race([i,n]),this.isParsed()){const t={pluginStatus:"loaded",pluginURL:e};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)})}};class ko{constructor(t,e){this.isSupportedScript=Ro,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new yo,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new yo,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}function Ro(t){return function(t,e){for(const r of t)if(!Co(r.codePointAt(0),e))return!1;return!0}(t,"loaded"===zo.getRTLTextPluginStatus())}const Lo="-transition";class Fo{constructor(t,e,r){this.property=t,this.value=e,this.expression=function(t,e,r){if(qi(t))return new an(t,e);if(tn(t)){const i=on(t,e,r);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return i.value}{let r=t;return"color"===e.type&&"string"==typeof t?r=Ae.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"numberArray"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"colorArray"!==e.type||"string"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?r=Be.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(r=je.parse(t)):r=Re.parse(t):r=ke.parse(t):r=ze.parse(t),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Bo{constructor(t,e){this.property=t,this.value=new Fo(t,void 0,e)}transitioned(t,e){return new jo(this.property,this.value,e,O({},t.transition,this.transition),t.now)}untransitioned(){return new jo(this.property,this.value,null,{},0)}}class Oo{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=e}getValue(t){return U(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Bo(this._values[t].property,this._globalState)),this._values[t].value=new Fo(this._values[t].property,null===e?void 0:U(e),this._globalState)}getTransition(t){return U(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Bo(this._values[t].property,this._globalState)),this._values[t].transition=U(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const i=this.getTransition(e);void 0!==i&&(t[`${e}${Lo}`]=i)}return t}transitioned(t,e){const r=new No(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){const t=new No(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class jo{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),o=this.prior;if(o){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return o.possiblyEvaluate(t,e,r);{const a=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,r),n,k(a))}}return n}}class No{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const i=new $o(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Vo{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=e}hasValue(t){return void 0!==this._values[t].value}getValue(t){return U(this._values[t].value)}setValue(t,e){this._values[t]=new Fo(this._values[t].property,null===e?void 0:U(e),this._globalState)}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const i=new $o(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}}class Uo{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}}class $o{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Go{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){const i=fr[this.specification.type];return i?i(t,e,r):t}}class qo{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,i){return new Uo(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Uo(this,{kind:"constant",value:void 0},t.parameters);const i=fr[this.specification.type];if(i){const n=i(t.value.value,e.value.value,r);return new Uo(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,r,i,n,o){return"constant"===t.kind?t.value:t.evaluate(e,r,i,n,o)}}class Zo extends qo{possiblyEvaluate(t,e,r,i){if(void 0===t.value)return new Uo(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},r,i),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new Uo(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Uo(this,{kind:"constant",value:r},e)}return new Uo(this,t.expression,e)}evaluate(t,e,r,i,n,o){if("source"===t.kind){const a=t.evaluate(e,r,i,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Wo{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new ko(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ko(Math.floor(e.zoom),e)),t.expression.evaluate(new ko(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Ho{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}}class Xo{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const i=this.defaultPropertyValues[e]=new Fo(r,void 0,void 0),n=this.defaultTransitionablePropertyValues[e]=new Bo(r,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}}ho("DataDrivenProperty",qo),ho("DataConstantProperty",Go),ho("CrossFadedDataDrivenProperty",Zo),ho("CrossFadedProperty",Wo),ho("ColorRampProperty",Ho);class Yo extends yt{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,e){return new eo(t,e)}(this.visibility,r),"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=pn(t.filter,r)),e.layout&&(this._unevaluatedLayout=new Vo(e.layout,r)),e.paint)){this._transitionablePaint=new Oo(e.paint,r);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new $o(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=pn(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;for(const e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(const e in this._unevaluatedLayout._values){const r=this._unevaluatedLayout._values[e];for(const e of r.getGlobalStateRefs())t.add(e)}for(const e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var t;const e=new globalThis.Map;if(this._transitionablePaint)for(const r in this._transitionablePaint._values){const i=this._transitionablePaint._values[r].value;for(const n of i.getGlobalStateRefs()){const o=null!==(t=e.get(n))&&void 0!==t?t:[];o.push({name:r,value:i.value}),e.set(n,o)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){if(null==e||!this._validate(so,`layers.${this.id}.layout.${t}`,t,e,r))return"visibility"===t?(this.visibility=e,this._visibilityExpression.setValue(e),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){return t.endsWith(Lo)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(ao,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(Lo))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],i="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||n||i||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return!!(this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){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),V(t,(t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length))}_validate(t,e,r,i,n={}){return(!n||!1!==n.validate)&&lo(this,t.call(io,{key:e,layerType:this.type,objectKey:r,value:i,styleSpec:vt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Uo&&Vi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}let Ko;var Jo={get paint(){return Ko=Ko||new Xo({"raster-opacity":new Go(vt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Go(vt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Go(vt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Go(vt.paint_raster["raster-brightness-max"]),"raster-saturation":new Go(vt.paint_raster["raster-saturation"]),"raster-contrast":new Go(vt.paint_raster["raster-contrast"]),"raster-resampling":new Go(vt.paint_raster["raster-resampling"]),"raster-fade-duration":new Go(vt.paint_raster["raster-fade-duration"])})}};class Qo extends Yo{constructor(t,e){super(t,Jo,e)}}const ta={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ea{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ra{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ia(t,e=1){let r=0,i=0;return{members:t.map(t=>{const n=ta[t.type].BYTES_PER_ELEMENT,o=r=na(r,Math.max(e,n)),a=t.components||1;return i=Math.max(i,n),r+=n*a,{name:t.name,type:t.type,components:a,offset:o}}),size:na(r,Math.max(i,e)),alignment:e}}function na(t,e){return Math.ceil(t/e)*e}class oa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,t}}oa.prototype.bytesPerElement=4,ho("StructArrayLayout2i4",oa);class aa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}}aa.prototype.bytesPerElement=6,ho("StructArrayLayout3i6",aa);class sa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,t}}sa.prototype.bytesPerElement=8,ho("StructArrayLayout4i8",sa);class la extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}la.prototype.bytesPerElement=12,ho("StructArrayLayout2i4i12",la);class ca extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}ca.prototype.bytesPerElement=8,ho("StructArrayLayout2i4ub8",ca);class ua extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.float32[i+0]=e,this.float32[i+1]=r,t}}ua.prototype.bytesPerElement=8,ho("StructArrayLayout2f8",ua);class ha extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,o,a,s,l,c)}emplace(t,e,r,i,n,o,a,s,l,c,u){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=i,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,t}}ha.prototype.bytesPerElement=20,ho("StructArrayLayout10ui20",ha);class pa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,o,a,s)}emplace(t,e,r,i,n,o,a,s,l){const c=8*t;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=o,this.uint16[c+5]=a,this.uint16[c+6]=s,this.uint16[c+7]=l,t}}pa.prototype.bytesPerElement=16,ho("StructArrayLayout8ui16",pa);class da extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c,u,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,i,n,o,a,s,l,c,u,h)}emplace(t,e,r,i,n,o,a,s,l,c,u,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=u,this.int16[d+10]=h,this.int16[d+11]=p,t}}da.prototype.bytesPerElement=24,ho("StructArrayLayout4i4ui4i24",da);class fa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}}fa.prototype.bytesPerElement=12,ho("StructArrayLayout3f12",fa);class ma extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}ma.prototype.bytesPerElement=4,ho("StructArrayLayout1ul4",ma);class ga extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,i,n,o,a,s,l)}emplace(t,e,r,i,n,o,a,s,l,c){const u=10*t,h=5*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=i,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=a,this.uint32[h+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,t}}ga.prototype.bytesPerElement=20,ho("StructArrayLayout6i1ul2ui20",ga);class _a extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}_a.prototype.bytesPerElement=12,ho("StructArrayLayout2i2i2i12",_a);class ya extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,i,n)}emplace(t,e,r,i,n,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.int16[s+6]=n,this.int16[s+7]=o,t}}ya.prototype.bytesPerElement=16,ho("StructArrayLayout2f1f2i16",ya);class va extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=16*t,l=4*t,c=8*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=a,t}}va.prototype.bytesPerElement=16,ho("StructArrayLayout2ub2f2i16",va);class ba extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}}ba.prototype.bytesPerElement=6,ho("StructArrayLayout3ui6",ba);class xa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g)}emplace(t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_){const y=24*t,v=12*t,b=48*t;return this.int16[y+0]=e,this.int16[y+1]=r,this.uint16[y+2]=i,this.uint16[y+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=u,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=d,this.uint8[b+37]=f,this.uint8[b+38]=m,this.uint32[v+10]=g,this.int16[y+22]=_,t}}xa.prototype.bytesPerElement=48,ho("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xa);class wa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y,v,b,x,w,T,S,P,M,A){const E=this.length;return this.resize(E+1),this.emplace(E,t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y,v,b,x,w,T,S,P,M,A)}emplace(t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y,v,b,x,w,T,S,P,M,A,E){const I=32*t,C=16*t;return this.int16[I+0]=e,this.int16[I+1]=r,this.int16[I+2]=i,this.int16[I+3]=n,this.int16[I+4]=o,this.int16[I+5]=a,this.int16[I+6]=s,this.int16[I+7]=l,this.uint16[I+8]=c,this.uint16[I+9]=u,this.uint16[I+10]=h,this.uint16[I+11]=p,this.uint16[I+12]=d,this.uint16[I+13]=f,this.uint16[I+14]=m,this.uint16[I+15]=g,this.uint16[I+16]=_,this.uint16[I+17]=y,this.uint16[I+18]=v,this.uint16[I+19]=b,this.uint16[I+20]=x,this.uint16[I+21]=w,this.uint16[I+22]=T,this.uint32[C+12]=S,this.float32[C+13]=P,this.float32[C+14]=M,this.uint16[I+30]=A,this.uint16[I+31]=E,t}}wa.prototype.bytesPerElement=64,ho("StructArrayLayout8i15ui1ul2f2ui64",wa);class Ta extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ta.prototype.bytesPerElement=4,ho("StructArrayLayout1f4",Ta);class Sa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}}Sa.prototype.bytesPerElement=12,ho("StructArrayLayout1ui2f12",Sa);class Pa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=r,this.uint16[n+3]=i,t}}Pa.prototype.bytesPerElement=8,ho("StructArrayLayout1ul2ui8",Pa);class Ma extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}}Ma.prototype.bytesPerElement=4,ho("StructArrayLayout2ui4",Ma);class Aa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Aa.prototype.bytesPerElement=2,ho("StructArrayLayout1ui2",Aa);class Ea extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,t}}Ea.prototype.bytesPerElement=16,ho("StructArrayLayout4f16",Ea);class Ia extends ea{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 r(this.anchorPointX,this.anchorPointY)}}Ia.prototype.size=20;class Ca extends ga{get(t){return new Ia(this,t)}}ho("CollisionBoxArray",Ca);class Da extends ea{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]}}Da.prototype.size=48;class za extends xa{get(t){return new Da(this,t)}}ho("PlacedSymbolArray",za);class ka extends ea{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]}}ka.prototype.size=64;class Ra extends wa{get(t){return new ka(this,t)}}ho("SymbolInstanceArray",Ra);class La extends Ta{getoffsetX(t){return this.float32[1*t+0]}}ho("GlyphOffsetArray",La);class Fa extends aa{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ho("SymbolLineVertexArray",Fa);class Ba extends ea{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]}}Ba.prototype.size=12;class Oa extends Sa{get(t){return new Ba(this,t)}}ho("TextAnchorOffsetArray",Oa);class ja extends ea{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]}}ja.prototype.size=8;class Na extends Pa{get(t){return new ja(this,t)}}ho("FeatureIndexArray",Na);class Va extends oa{}class Ua extends oa{}class $a extends oa{}class Ga extends la{}class qa extends ca{}class Za extends ua{}class Wa extends ha{}class Ha extends pa{}class Xa extends da{}class Ya extends fa{}class Ka extends ma{}class Ja extends _a{}class Qa extends va{}class ts extends ba{}class es extends Ma{}const rs=ia([{name:"a_pos",components:2,type:"Int16"}],4),{members:is}=rs;class ns{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,r,i){const n=this.segments[this.segments.length-1];return t>ns.MAX_VERTEX_ARRAY_LENGTH&&G(`Max vertices per segment is ${ns.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ns.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>ns.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i?this.createNewSegment(e,r,i):n}createNewSegment(t,e,r){const i={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(i.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(t,e,r){return this.prepareSegment(0,t,e,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,i){return new ns([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}}function os(t,e){return 256*(t=F(Math.floor(t),0,255))+F(Math.floor(e),0,255)}ns.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ho("SegmentVector",ns);const as=ia([{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"}]),ss=ia([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var ls,cs,us,hs={exports:{}},ps={exports:{}},ds={exports:{}},fs=function(){if(us)return hs.exports;us=1;var t=(ls||(ls=1,ps.exports=function(t,e){var r,i,n,o,a,s,l,c;for(i=t.length-(r=3&t.length),n=e,a=3432918353,s=461845907,c=0;c<i;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),ps.exports),e=(cs||(cs=1,ds.exports=function(t,e){for(var r,i=t.length,n=e^i,o=0;i>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),ds.exports);return hs.exports=t,hs.exports.murmur3=t,hs.exports.murmur2=e,hs.exports}(),ms=i(fs);class gs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,i){this.ids.push(_s(t)),this.positions.push(e,r,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=_s(t);let r=0,i=this.ids.length-1;for(;r<i;){const t=r+i>>1;this.ids[t]>=e?i=t:r=t+1}const n=[];for(;this.ids[r]===e;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(t,e){const r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return ys(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){const e=new gs;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function _s(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ms(String(t))}function ys(t,e,r,i){for(;r<i;){const n=t[r+i>>1];let o=r-1,a=i+1;for(;;){do{o++}while(t[o]<n);do{a--}while(t[a]>n);if(o>=a)break;vs(t,o,a),vs(e,3*o,3*a),vs(e,3*o+1,3*a+1),vs(e,3*o+2,3*a+2)}a-r<i-a?(ys(t,e,r,a),r=a+1):(ys(t,e,a+1,i),i=a)}}function vs(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}ho("FeaturePositionMap",gs);class bs{constructor(t,e){this.gl=t.gl,this.location=e}}class xs extends bs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class ws extends bs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Ts extends bs{constructor(t,e){super(t,e),this.current=Ae.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 Ss=new Float32Array(16);function Ps(t){return[os(255*t.r,255*t.g),os(255*t.b,255*t.a)]}class Ms{constructor(t,e,r){this.value=t,this.uniformNames=e.map(t=>`u_${t}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new Ts(t,e):new xs(t,e)}}class As{constructor(t,e){this.uniformNames=e.map(t=>`u_${t}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;"u_pattern_to"===i?n=this.patternTo:"u_pattern_from"===i?n=this.patternFrom:"u_dasharray_to"===i?n=this.dashTo:"u_dasharray_from"===i?n=this.dashFrom:"u_pixel_ratio_to"===i?n=this.pixelRatioTo:"u_pixel_ratio_from"===i&&(n=this.pixelRatioFrom),null!==n&&t.set(n)}getBinding(t,e,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new ws(t,e):new xs(t,e)}}class Es{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){const i=this.paintVertexArray.length,n=this.expression.evaluate(new ko(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){const o=this.expression.evaluate(new ko(0,n),r,i);this._setPaintValue(t,e,o)}_setPaintValue(t,e,r){if("color"===this.type){const i=Ps(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}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 Is{constructor(t,e,r,i,n,o){this.expression=t,this.uniformNames=e.map(t=>`u_${t}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,r){const i=this.expression.evaluate(new ko(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new ko(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,i,n)}updatePaintArray(t,e,r,i,n){const o=this.expression.evaluate(new ko(this.zoom,n),r,i),a=this.expression.evaluate(new ko(this.zoom+1,n),r,i);this._setPaintValue(t,e,o,a)}_setPaintValue(t,e,r,i){if("color"===this.type){const n=Ps(r),o=Ps(i);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}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,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=F(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new xs(t,e)}}class Cs{constructor(t,e,r,i,n,o){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){const i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,this.getPositionIds(e),r)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,this.getPositionIds(r),n)}_setPaintValues(t,e,r,i){const n=this.getPositions(i);if(!n||!r)return;const o=n[r.min],a=n[r.mid],s=n[r.max];if(o&&a&&s)for(let r=t;r<e;r++)this.emplace(this.zoomInPaintVertexArray,r,a,o),this.emplace(this.zoomOutPaintVertexArray,r,a,s)}upload(t){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ds extends Cs{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns&&t.patterns[this.layerId]}getVertexAttributes(){return as.members}emplace(t,e,r,i){t.emplace(e,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}}class zs extends Cs{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes&&t.dashes[this.layerId]}getVertexAttributes(){return ss.members}emplace(t,e,r,i){t.emplace(e,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}}class ks{constructor(t,e,r){this.binders={},this._buffers=[];const i=[];for(const n in t.paint._values){if(!r(n))continue;const o=t.paint.get(n);if(!(o instanceof Uo&&Vi(o.property.specification)))continue;const a=Ls(n,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[n]=h?new As(s.value,a):new Ms(s.value,a,l),i.push(`/u_${n}`);else if("source"===s.kind||h){const r=Fs(n,l,"source");this.binders[n]=h?"line-dasharray"===n?new zs(s,l,c,e,r,t.id):new Ds(s,l,c,e,r,t.id):new Es(s,a,l,r),i.push(`/a_${n}`)}else{const t=Fs(n,l,"composite");this.binders[n]=new Is(s,a,l,c,e,t),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Es||e instanceof Is?e.maxValue:0}populatePaintArrays(t,e,r){for(const i in this.binders){const n=this.binders[i];(n instanceof Es||n instanceof Is||n instanceof Cs)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(const r in this.binders){const i=this.binders[r];i instanceof As&&i.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(const r in this.binders){const i=this.binders[r];i instanceof As&&i.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof Es||l instanceof Is||l instanceof Cs)&&!0===l.expression.isStateDependent){const c=i.paint.get(r);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],n),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Ms||r instanceof As)&&t.push(...r.uniformNames.map(t=>`#define HAS_UNIFORM_${t}`))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Es||r instanceof Is)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof Cs){const e=r.getVertexAttributes();for(const r of e)t.push(r.name)}}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ms||r instanceof As||r instanceof Is)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Ms||n instanceof As||n instanceof Is)for(const o of n.uniformNames)if(e[o]){const a=n.getBinding(t,e[o],o);r.push({name:o,property:i,binding:a})}}return r}setUniforms(t,e,r,i){for(const{name:t,property:n,binding:o}of e)this.binders[n].setUniform(o,i,r.get(n),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof Cs){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof Es||r instanceof Is)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof Es||r instanceof Is||r instanceof Cs)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Es||e instanceof Is||e instanceof Cs)&&e.destroy()}}}class Rs{constructor(t,e,r=()=>!0){this.programConfigurations={};for(const i of t)this.programConfigurations[i.id]=new ks(i,e,r);this.needsUpload=!1,this._featureMap=new gs,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,i);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(const n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ls(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Fs(t,e,r){const i={color:{source:ua,composite:Ea},number:{source:Ta,composite:ua}},n=function(t){return{"line-pattern":{source:Wa,composite:Wa},"fill-pattern":{source:Wa,composite:Wa},"fill-extrusion-pattern":{source:Wa,composite:Wa},"line-dasharray":{source:Ha,composite:Ha}}[t]}(t);return n&&n[r]||i[e][r]}ho("ConstantBinder",Ms),ho("CrossFadedConstantBinder",As),ho("SourceExpressionBinder",Es),ho("CrossFadedPatternBinder",Ds),ho("CrossFadedDasharrayBinder",zs),ho("CompositeExpressionBinder",Is),ho("ProgramConfiguration",ks,{omit:["_buffers"]}),ho("ProgramConfigurationSet",Rs);const Bs=Math.pow(2,14)-1,Os=-Bs-1;function js(t){const e=I/t.extent,r=t.loadGeometry();for(let t=0;t<r.length;t++){const i=r[t];for(let t=0;t<i.length;t++){const r=i[t],n=Math.round(r.x*e),o=Math.round(r.y*e);r.x=F(n,Os,Bs),r.y=F(o,Os,Bs),(n<r.x||n>r.x+1||o<r.y||o>r.y+1)&&G("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ns(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?js(t):[]}}const Vs=-32768;function Us(t,e,r,i,n){t.emplaceBack(Vs+8*e+i,Vs+8*r+n)}class $s{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Ua,this.indexArray=new ts,this.segments=new ns,this.programConfigurations=new Rs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){const i=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===i.type;if("circle"===i.type){const t=i;o=t.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===t.paint.get("circle-pitch-alignment")}const l=s?e.subdivisionGranularity.circle:1;for(const{feature:e,id:i,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ns(e,t);if(!this.layers[0]._featureFilter.filter(new ko(this.zoom),c,r))continue;const u=a?o.evaluate(c,{},r):void 0,h={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:js(e),patterns:{},sortKey:u};n.push(h)}a&&n.sort((t,e)=>t.sortKey-e.sortKey);for(const i of n){const{geometry:n,index:o,sourceLayerIndex:a}=i,s=t[o].feature;this.addFeature(i,n,o,r,l),e.featureIndex.insert(s,n,o,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,is),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const a=o.length;for(const r of e)for(const e of r){const r=e.x,i=e.y;if(r<0||r>=I||i<0||i>=I)continue;const n=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,t.sortKey),s=n.vertexLength;for(let t=0;t<a;t++)for(let e=0;e<a;e++)Us(this.layoutVertexArray,r,i,o[e],o[t]);for(let t=0;t<a-1;t++)for(let e=0;e<a-1;e++){const r=s+t*a+e,i=s+(t+1)*a+e;this.indexArray.emplaceBack(r,i+1,r+1),this.indexArray.emplaceBack(r,i,i+1)}n.vertexLength+=a*a,n.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:i})}}function Gs(t,e){for(let r=0;r<t.length;r++)if(Qs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Qs(t,e[r]))return!0;return!!Hs(t,e)}function qs(t,e,r){return!!Qs(t,e)||!!Ys(e,t,r)}function Zs(t,e){if(1===t.length)return Js(e,t[0]);for(let r=0;r<e.length;r++){const i=e[r];for(let e=0;e<i.length;e++)if(Qs(t,i[e]))return!0}for(let r=0;r<t.length;r++)if(Js(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Hs(t,e[r]))return!0;return!1}function Ws(t,e,r){if(t.length>1){if(Hs(t,e))return!0;for(let i=0;i<e.length;i++)if(Ys(e[i],t,r))return!0}for(let i=0;i<t.length;i++)if(Ys(t[i],e,r))return!0;return!1}function Hs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1];for(let t=0;t<e.length-1;t++)if(Xs(i,n,e[t],e[t+1]))return!0}return!1}function Xs(t,e,r,i){return q(t,r,i)!==q(e,r,i)&&q(t,e,r)!==q(t,e,i)}function Ys(t,e,r){const i=r*r;if(1===e.length)return t.distSqr(e[0])<i;for(let r=1;r<e.length;r++)if(Ks(t,e[r-1],e[r])<i)return!0;return!1}function Ks(t,e,r){const i=e.distSqr(r);if(0===i)return t.distSqr(e);const n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return t.distSqr(n<0?e:n>1?r:r.sub(e)._mult(n)._add(e))}function Js(t,e){let r,i,n,o=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)i=r[t],n=r[a],i.y>e.y!=n.y>e.y&&e.x<(n.x-i.x)*(e.y-i.y)/(n.y-i.y)+i.x&&(o=!o)}return o}function Qs(t,e){let r=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){const o=t[i],a=t[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function tl(t,e,r){const i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;const o=q(t,e,r[0]);return o!==q(t,e,r[1])||o!==q(t,e,r[2])||o!==q(t,e,r[3])}function el(t,e,r){const i=e.paint.get(t).value;return"constant"===i.kind?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function rl(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function il(t,e,i,n,o){if(!e[0]&&!e[1])return t;const a=r.convert(e)._mult(o);"viewport"===i&&a._rotate(-n);const s=[];for(let e=0;e<t.length;e++)s.push(t[e].sub(a));return s}function nl(t){const e=[];for(let r=0;r<t.length;r++){const i=t[r],n=e.at(-1);(0===r||n&&!i.equals(n))&&e.push(i)}return e}function ol({queryGeometry:t,size:e},r){return qs(t,r,e)}function al({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},o){return qs(t,o,e*(r.projectTileCoordinates(o.x,o.y,i,n).signedDistanceFromCamera/r.cameraToCenterDistance))}function sl({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},o){const a=r.projectTileCoordinates(o.x,o.y,i,n).signedDistanceFromCamera,s=e*(r.cameraToCenterDistance/a);return qs(t,ul(o,r,i,n),s)}function ll({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},o){return qs(t,ul(o,r,i,n),e)}function cl({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:o="map",pitchScale:a="map"},s){const l="map"===o?"map"===a?ol:al:"map"===a?sl:ll,c={queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n};for(const t of s)for(const e of t)if(l(c,e))return!0;return!1}function ul(t,e,i,n){const o=e.projectTileCoordinates(t.x,t.y,i,n).point;return new r((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}let hl,pl;ho("CircleBucket",$s,{omit:["layers"]});var dl={get paint(){return pl=pl||new Xo({"circle-radius":new qo(vt.paint_circle["circle-radius"]),"circle-color":new qo(vt.paint_circle["circle-color"]),"circle-blur":new qo(vt.paint_circle["circle-blur"]),"circle-opacity":new qo(vt.paint_circle["circle-opacity"]),"circle-translate":new Go(vt.paint_circle["circle-translate"]),"circle-translate-anchor":new Go(vt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Go(vt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Go(vt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new qo(vt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new qo(vt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new qo(vt.paint_circle["circle-stroke-opacity"])})},get layout(){return hl=hl||new Xo({"circle-sort-key":new qo(vt.layout_circle["circle-sort-key"])})}};class fl extends Yo{constructor(t,e){super(t,dl,e)}createBucket(t){return new $s(t)}queryRadius(t){const e=t;return el("circle-radius",this,e)+el("circle-stroke-width",this,e)+rl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=il(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let p,d;return"map"===h?(p=l,d=c*o):(p=function(t,e,r,i){return t.map(t=>ul(t,e,r,i))}(l,n,a,s),d=c),cl({queryGeometry:p,size:d,transform:n,unwrappedTileID:a,getElevation:s,pitchAlignment:h,pitchScale:u},i)}}class ml extends $s{}let gl;ho("HeatmapBucket",ml,{omit:["layers"]});var _l={get paint(){return gl=gl||new Xo({"heatmap-radius":new qo(vt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new qo(vt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Go(vt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ho(vt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Go(vt.paint_heatmap["heatmap-opacity"])})}};function yl(t,{width:e,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`)}else n=new Uint8Array(e*r*i);return t.width=e,t.height=r,t.data=n,t}function vl(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;const n=yl({},{width:e,height:r},i);bl(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function bl(t,e,r,i,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((r.y+l)*t.width+r.x)*o,u=((i.y+l)*e.width+i.x)*o;for(let t=0;t<n.width*o;t++)s[u+t]=a[c+t]}return e}class xl{constructor(t,e){yl(this,t,1,e)}resize(t){vl(this,t,1)}clone(){return new xl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){bl(t,e,r,i,n,1)}}class wl{constructor(t,e){yl(this,t,4,e)}resize(t){vl(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new wl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){bl(t,e,r,i,n,4)}setPixel(t,e,r){const i=4*(t*this.width+e);this.data[i+0]=Math.round(255*r.r/r.a),this.data[i+1]=Math.round(255*r.g/r.a),this.data[i+2]=Math.round(255*r.b/r.a),this.data[i+3]=Math.round(255*r.a)}}function Tl(t){const e=new Uint8Array(t.length);for(let r=0;r<t.length;r+=4){const i=t[r+3];e[r+0]=Math.round(t[r+0]*i/255),e[r+1]=Math.round(t[r+1]*i/255),e[r+2]=Math.round(t[r+2]*i/255),e[r+3]=i}return e}function Sl(t){const e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new wl({width:r,height:i});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const o=(i,o,a)=>{e[t.evaluationKey]=a;const s=t.expression.evaluate(e);n.setPixel(i/4/r,o/4,s)};if(t.clips)for(let e=0,n=0;e<i;++e,n+=4*r)for(let i=0,a=0;i<r;i++,a+=4){const s=i/(r-1),{start:l,end:c}=t.clips[e];o(n,a,l*(1-s)+c*s)}else for(let t=0,e=0;t<r;t++,e+=4)o(0,e,t/(r-1));return n}ho("AlphaImage",xl),ho("RGBAImage",wl);const Pl="big-fb";class Ml extends Yo{createBucket(t){return new ml(t)}constructor(t,e){super(t,_l,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Sl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Pl)&&this.heatmapFbos.delete(Pl)}queryRadius(t){return el("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){return cl({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(e,r)*o,transform:n,unwrappedTileID:a,getElevation:s},i)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}let Al;var El={get paint(){return Al=Al||new Xo({"hillshade-illumination-direction":new Go(vt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Go(vt.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Go(vt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Go(vt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Go(vt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Go(vt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Go(vt.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Go(vt.paint_hillshade["hillshade-method"])})}};class Il extends Yo{constructor(t,e){super(t,El,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values;const n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));const o=e.map(tt);return{directionRadians:t.map(tt),altitudeRadians:o,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let Cl;var Dl={get paint(){return Cl=Cl||new Xo({"color-relief-opacity":new Go(vt["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Ho(vt["paint_color-relief"]["color-relief-color"])})}};function zl(t){return"data"in t}class kl{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){const{width:i,height:n}=t,o=!(this.size&&this.size[0]===i&&this.size[1]===n||r),{context:a}=this,{gl:s}=a;this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1);const l=this.format===s.RGBA&&(!e||!1!==e.premultiply);if(o)this.size=[i,n],zl(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,s)):(a.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,s));else{const{x:e,y:o}=r||{x:0,y:0};zl(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,e,o,i,n,s)):(a.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,e,o,s))}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:o}=t;e&&o&&(o=Tl(o)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,o)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,o,a){let{data:s}=t;e&&s&&(s=Tl(s)),a.texSubImage2D(a.TEXTURE_2D,0,r,i,n,o,a.RGBA,a.UNSIGNED_BYTE,s)}bind(t,e,r){const{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Rl{constructor(t,e,r,i=1,n=1,o=1,a=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void G(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const s=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=n,this.blueFactor=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<s;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(s,t)]=this.data[this._idx(s-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,s)]=this.data[this._idx(t,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<s;t++)for(let e=0;e<s;e++){const r=this.get(t,e);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,e){const r=new Uint8Array(this.data.buffer),i=4*this._idx(t,e);return this.unpack(r[i],r[i+1],r[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${e}, dim: ${this.dim}`);return(e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return Ll(t,this.getUnpackVector())}getPixels(){return new wl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,n=e*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:i=n-1;break;case 1:n=i+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-r*this.dim;for(let e=o;e<a;e++)for(let r=i;r<n;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+s,e+l)]}}function Ll(t,e){const r=e[0],i=e[1],n=e[2],o=e[3],a=Math.min(r,i,n),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/i)%256,b:Math.floor(s*a/n)%256}}ho("DEMData",Rl);class Fl extends Yo{constructor(t,e){super(t,Dl,e)}_createColorRamp(t){const e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof rn&&r._styleExpression.expression instanceof pr){this.colorRampExpression=r;const t=r._styleExpression.expression;e.elevationStops=t.labels,e.colorStops=[];for(const r of e.elevationStops)e.colorStops.push(t.evaluate({globals:{elevation:r}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[Ae.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;const i={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let t=0;t<e.elevationStops.length-.5;t+=n)i.elevationStops.push(e.elevationStops[Math.round(t)]),i.colorStops.push(e.colorStops[Math.round(t)]);return G(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const i=this._createColorRamp(e),n=new wl({width:i.colorStops.length,height:1}),o=new wl({width:i.colorStops.length,height:1});for(let t=0;t<i.elevationStops.length;t++){const e=Ll(i.elevationStops[t],r);o.setPixel(0,t,new Ae(e.r/255,e.g/255,e.b/255,1)),n.setPixel(0,t,i.colorStops[t])}return this.colorRampTextures={elevationTexture:new kl(t,o,t.gl.RGBA),colorTexture:new kl(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Bl=ia([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ol}=Bl;function jl(t,e,r){const i=r.patternDependencies;let n=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const o=e.constantOr(null);o&&(n=!0,i[o.to]=!0,i[o.from]=!0)}return n}function Nl(t,e,r,i,n){const{zoom:o}=i,a=n.patternDependencies;for(const i of e){const e=i.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:o-1},r,{},n.availableImages),s=e.evaluate({zoom:o},r,{},n.availableImages),l=e.evaluate({zoom:o+1},r,{},n.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,a[t]=!0,a[s]=!0,a[l]=!0,r.patterns[i.id]={min:t,mid:s,max:l}}}return r}function Vl(t,e,r,i,n){let o;if(n===function(t,e,r,i){let n=0;for(let o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(let n=e;n<r;n+=i)o=cc(n/i|0,t[n],t[n+1],o);else for(let n=r-i;n>=e;n-=i)o=cc(n/i|0,t[n],t[n+1],o);return o&&ic(o,o.next)&&(uc(o),o=o.next),o}function Ul(t,e){if(!t)return t;e||(e=t);let r,i=t;do{if(r=!1,i.steiner||!ic(i,i.next)&&0!==rc(i.prev,i,i.next))i=i.next;else{if(uc(i),i=e=i.prev,i===i.next)break;r=!0}}while(r||i!==e);return e}function $l(t,e,r,i,n,o,a){if(!t)return;!a&&o&&function(t,e,r,i){let n=t;do{0===n.z&&(n.z=Kl(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let e,r=1;do{let i,n=t;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let t=0;t<r&&(s++,a=a.nextZ,a);t++);let l=r;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1)}(n)}(t,i,n,o);let s=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(o?ql(t,i,n,o):Gl(t))e.push(l.i,t.i,c.i),uc(t),t=c.next,s=c.next;else if((t=c)===s){a?1===a?$l(t=Zl(Ul(t),e),e,r,i,n,o,2):2===a&&Wl(t,e,r,i,n,o):$l(Ul(t),e,r,i,n,o,1);break}}}function Gl(t){const e=t.prev,r=t,i=t.next;if(rc(e,r,i)>=0)return!1;const n=e.x,o=r.x,a=i.x,s=e.y,l=r.y,c=i.y,u=Math.min(n,o,a),h=Math.min(s,l,c),p=Math.max(n,o,a),d=Math.max(s,l,c);let f=i.next;for(;f!==e;){if(f.x>=u&&f.x<=p&&f.y>=h&&f.y<=d&&tc(n,s,o,l,a,c,f.x,f.y)&&rc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ql(t,e,r,i){const n=t.prev,o=t,a=t.next;if(rc(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,u=n.y,h=o.y,p=a.y,d=Math.min(s,l,c),f=Math.min(u,h,p),m=Math.max(s,l,c),g=Math.max(u,h,p),_=Kl(d,f,e,r,i),y=Kl(m,g,e,r,i);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=_&&b&&b.z<=y;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&tc(s,u,l,h,c,p,v.x,v.y)&&rc(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=d&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&tc(s,u,l,h,c,p,b.x,b.y)&&rc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&tc(s,u,l,h,c,p,v.x,v.y)&&rc(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=y;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&tc(s,u,l,h,c,p,b.x,b.y)&&rc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Zl(t,e){let r=t;do{const i=r.prev,n=r.next.next;!ic(i,n)&&nc(i,r,r.next,n)&&sc(i,n)&&sc(n,i)&&(e.push(i.i,r.i,n.i),uc(r),uc(r.next),r=t=n),r=r.next}while(r!==t);return Ul(r)}function Wl(t,e,r,i,n,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&ec(a,t)){let s=lc(a,t);return a=Ul(a,a.next),s=Ul(s,s.next),$l(a,e,r,i,n,o,0),void $l(s,e,r,i,n,o,0)}t=t.next}a=a.next}while(a!==t)}function Hl(t,e){let r=t.x-e.x;return 0===r&&(r=t.y-e.y,0===r)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function Xl(t,e){const r=function(t,e){let r=e;const i=t.x,n=t.y;let o,a=-1/0;if(ic(t,r))return r;do{if(ic(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){const t=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=i&&t>a&&(a=t,o=r.x<r.next.x?r:r.next,t===i))return o}r=r.next}while(r!==e);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;r=o;do{if(i>=r.x&&r.x>=l&&i!==r.x&&Ql(n<c?i:a,n,l,c,n<c?a:i,n,r.x,r.y)){const e=Math.abs(n-r.y)/(i-r.x);sc(r,t)&&(e<u||e===u&&(r.x>o.x||r.x===o.x&&Yl(o,r)))&&(o=r,u=e)}r=r.next}while(r!==s);return o}(t,e);if(!r)return e;const i=lc(r,t);return Ul(i,i.next),Ul(r,r.next)}function Yl(t,e){return rc(t.prev,t,e.prev)<0&&rc(e.next,t,t.next)<0}function Kl(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Jl(t){let e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Ql(t,e,r,i,n,o,a,s){return(n-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(i-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(n-a)*(i-s)}function tc(t,e,r,i,n,o,a,s){return!(t===a&&e===s)&&Ql(t,e,r,i,n,o,a,s)}function ec(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&nc(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(sc(t,e)&&sc(e,t)&&function(t,e){let r=t,i=!1;const n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(rc(t.prev,t,e.prev)||rc(t,e.prev,e))||ic(t,e)&&rc(t.prev,t,t.next)>0&&rc(e.prev,e,e.next)>0)}function rc(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ic(t,e){return t.x===e.x&&t.y===e.y}function nc(t,e,r,i){const n=ac(rc(t,e,r)),o=ac(rc(t,e,i)),a=ac(rc(r,i,t)),s=ac(rc(r,i,e));return n!==o&&a!==s||!(0!==n||!oc(t,r,e))||!(0!==o||!oc(t,i,e))||!(0!==a||!oc(r,t,i))||!(0!==s||!oc(r,e,i))}function oc(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ac(t){return t>0?1:t<0?-1:0}function sc(t,e){return rc(t.prev,t,t.next)<0?rc(t,e,t.next)>=0&&rc(t,t.prev,e)>=0:rc(t,e,t.prev)<0||rc(t,t.next,e)<0}function lc(t,e){const r=hc(t.i,t.x,t.y),i=hc(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function cc(t,e,r,i){const n=hc(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function uc(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function hc(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class pc{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class dc{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}dc.noSubdivision=new dc({fill:new pc(0,0),line:new pc(0,0),tile:new pc(0,0),stencil:new pc(0,0),circle:1}),ho("SubdivisionGranularityExpression",pc),ho("SubdivisionGranularitySetting",dc);const fc=-32768,mc=32767;class gc{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=I/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=0|Math.round(t),i=0|Math.round(e),n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(r,i),o}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const r=[];for(let i=0;i<e.length;i+=3){const n=e[i],o=e[i+1],a=e[i+2],s=t[2*n],l=t[2*n+1];(t[2*o]-s)*(t[2*a+1]-l)-(t[2*o+1]-l)*(t[2*a]-s)>0?(r.push(n),r.push(a),r.push(o)):(r.push(n),r.push(o),r.push(a))}return r}(this._vertexBuffer,t);const e=[],r=t.length;for(let i=0;i<r;i+=3){const r=[t[i+0],t[i+1],t[i+2]],n=[this._vertexBuffer[2*t[i+0]+0],this._vertexBuffer[2*t[i+0]+1],this._vertexBuffer[2*t[i+1]+0],this._vertexBuffer[2*t[i+1]+1],this._vertexBuffer[2*t[i+2]+0],this._vertexBuffer[2*t[i+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=n[2*t],r=n[2*t+1];o=Math.min(o,e),s=Math.max(s,e),a=Math.min(a,r),l=Math.max(l,r)}if(o===s||a===l)continue;const c=Math.floor(o/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),h=Math.floor(a/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(c!==u||h!==p)for(let t=h;t<p;t++){const i=this._scanlineGenerateVertexRingForCellRow(t,n,r);vc(this._vertexBuffer,i,e)}else e.push(...r)}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){const i=t*this._granularityCellSize,n=i+this._granularityCellSize,o=[];for(let t=0;t<3;t++){const a=e[2*t],s=e[2*t+1],l=e[2*(t+1)%6],c=e[(2*(t+1)+1)%6],u=e[2*(t+2)%6],h=e[(2*(t+2)+1)%6],p=l-a,d=c-s,f=0===p,m=0===d,g=(i-s)/d,_=(n-s)/d,y=Math.min(g,_),v=Math.max(g,_);if(!m&&(y>=1||v<=0)||m&&(s<i||s>n)){c>=i&&c<=n&&o.push(r[(t+1)%3]);continue}!m&&y>0&&o.push(this._vertexToIndex(a+p*y,s+d*y));const b=a+p*Math.max(y,0),x=a+p*Math.min(v,1);f||this._generateIntraEdgeVertices(o,a,s,l,c,b,x),!m&&v<1&&o.push(this._vertexToIndex(a+p*v,s+d*v)),(m||c>=i&&c<=n)&&o.push(r[(t+1)%3]),!m&&(c<=i||c>=n)&&this._generateInterEdgeVertices(o,a,s,l,c,u,h,x,i,n)}return o}_generateIntraEdgeVertices(t,e,r,i,n,o,a){const s=i-e,l=n-r,c=0===l,u=c?Math.min(e,i):Math.min(o,a),h=c?Math.max(e,i):Math.max(o,a),p=Math.floor(u/this._granularityCellSize)+1,d=Math.ceil(h/this._granularityCellSize)-1;if(c?e<i:o<a)for(let i=p;i<=d;i++){const n=i*this._granularityCellSize;t.push(this._vertexToIndex(n,r+l*(n-e)/s))}else for(let i=d;i>=p;i--){const n=i*this._granularityCellSize;t.push(this._vertexToIndex(n,r+l*(n-e)/s))}}_generateInterEdgeVertices(t,e,r,i,n,o,a,s,l,c){const u=n-r,h=o-i,p=a-n,d=(l-n)/p,f=(c-n)/p,m=Math.min(d,f),g=Math.max(d,f),_=i+h*m;let y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,b=s<_;const x=0===p;if(x&&(a===l||a===c))return;if(x||m>=1||g<=0){const t=r-a,i=o+(e-o)*Math.min((l-a)/t,(c-a)/t);y=Math.floor(Math.min(i,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(i,s)/this._granularityCellSize)-1,b=s<i}const w=u>0?c:l;if(b)for(let e=y;e<=v;e++)t.push(this._vertexToIndex(e*this._granularityCellSize,w));else for(let e=v;e>=y;e--)t.push(this._vertexToIndex(e*this._granularityCellSize,w))}_generateOutline(t){const e=[];for(const r of t){const t=yc(r,this._granularity,!0),i=this._pointArrayToIndices(t),n=[];for(let t=1;t<i.length;t++)n.push(i[t-1]),n.push(i[t]);e.push(n)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const r=t[e+1];r===fc&&(t[e+1]=-32767),r===mc&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,i,n,o){i>n!=(o===fc)?(t.push(e),t.push(r),t.push(this._vertexToIndex(i,o)),t.push(r),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(i,o))):(t.push(r),t.push(e),t.push(this._vertexToIndex(i,o)),t.push(this._vertexToIndex(n,o)),t.push(r),t.push(this._vertexToIndex(i,o)))}_fillPoles(t,e,r){const i=this._vertexBuffer,n=I,o=t.length;for(let a=2;a<o;a+=3){const o=t[a-2],s=t[a-1],l=t[a],c=i[2*o],u=i[2*o+1],h=i[2*s],p=i[2*s+1],d=i[2*l],f=i[2*l+1];e&&(0===u&&0===p&&this._generatePoleQuad(t,o,s,c,h,fc),0===p&&0===f&&this._generatePoleQuad(t,s,l,h,d,fc),0===f&&0===u&&this._generatePoleQuad(t,l,o,d,c,fc)),r&&(u===n&&p===n&&this._generatePoleQuad(t,o,s,c,h,mc),p===n&&f===n&&this._generatePoleQuad(t,s,l,h,d,mc),f===n&&u===n&&this._generatePoleQuad(t,l,o,d,c,mc))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:i}=function(t){const e=[],r=[];for(const i of t)if(0!==i.length){i!==t[0]&&e.push(r.length/2);for(let t=0;t<i.length;t++)r.push(i[t].x),r.push(i[t].y)}return{flattened:r,holeIndices:e}}(t);let n;this._initializeVertices(r);try{const t=function(t,e,r=2){const i=e&&e.length,n=i?e[0]*r:t.length;let o=Vl(t,0,n,r,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(i&&(o=function(t,e,r,i){const n=[];for(let r=0,o=e.length;r<o;r++){const a=Vl(t,e[r]*i,r<o-1?e[r+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),n.push(Jl(a))}n.sort(Hl);for(let t=0;t<n.length;t++)r=Xl(n[t],r);return r}(t,e,o,r)),t.length>80*r){s=t[0],l=t[1];let e=s,i=l;for(let o=r;o<n;o+=r){const r=t[o],n=t[o+1];r<s&&(s=r),n<l&&(l=n),r>e&&(e=r),n>i&&(i=n)}c=Math.max(e-s,i-l),c=0!==c?32767/c:0}return $l(o,a,r,s,l,c,0),a}(r,i),e=this._convertIndices(r,t);n=this._subdivideTrianglesScanline(e)}catch(t){console.error(t)}let o=[];return e&&(o=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(t,e){const r=[];for(let i=0;i<e.length;i++)r.push(this._vertexToIndex(t[2*e[i]],t[2*e[i]+1]));return r}_pointArrayToIndices(t){const e=[];for(let r=0;r<t.length;r++){const i=t[r];e.push(this._vertexToIndex(i.x,i.y))}return e}}function _c(t,e,r,i=!0){return new gc(r,e).subdividePolygonInternal(t,i)}function yc(t,e,i=!1){if(!t||t.length<1)return[];if(t.length<2)return[];const n=t[0],o=t[t.length-1],a=i&&(n.x!==o.x||n.y!==o.y);if(e<2)return a?[...t,t[0]]:[...t];const s=Math.floor(I/e),l=[];l.push(new r(t[0].x,t[0].y));const c=t.length,u=a?c:c-1;for(let e=0;e<u;e++){const i=t[e],n=e<c-1?t[e+1]:t[0],o=i.x,a=i.y,u=n.x,h=n.y,p=o!==u,d=a!==h;if(!p&&!d)continue;const f=u-o,m=h-a,g=Math.abs(f),_=Math.abs(m);let y=o,v=a;for(;;){const t=f>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,e=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,i=Math.abs(y-t),n=Math.abs(v-e),o=Math.abs(y-u),a=Math.abs(v-h),c=p?i/g:Number.POSITIVE_INFINITY,b=d?n/_:Number.POSITIVE_INFINITY;if((o<=i||!p)&&(a<=n||!d))break;if(c<b&&p||!d){y=t,v+=m*c;const e=new r(y,Math.round(v));l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}else{y+=f*b,v=e;const t=new r(Math.round(y),v);l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}}const b=new r(u,h);l[l.length-1].x===b.x&&l[l.length-1].y===b.y||l.push(b)}return l}function vc(t,e,r){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let i=0,n=t[2*e[0]];for(let r=1;r<e.length;r++){const o=t[2*e[r]];o<n&&(n=o,i=r)}const o=e.length;let a=i,s=(a+1)%o;for(;;){const i=a-1>=0?a-1:o-1,n=(s+1)%o,l=t[2*e[i]],c=t[2*e[n]],u=t[2*e[a]],h=t[2*e[a]+1],p=t[2*e[s]+1];let d=!1;if(l<c)d=!0;else if(l>c)d=!1;else{const r=p-h,o=-(t[2*e[s]]-u),a=h<p?1:-1;((l-u)*r+(t[2*e[i]+1]-h)*o)*a>((c-u)*r+(t[2*e[n]+1]-h)*o)*a&&(d=!0)}if(d){const t=e[i],n=e[a],l=e[s];t!==n&&t!==l&&n!==l&&r.push(l,n,t),a--,a<0&&(a=o-1)}else{const t=e[n],i=e[a],l=e[s];t!==i&&t!==l&&i!==l&&r.push(l,i,t),s++,s>=o&&(s=0)}if(i===n)break}}function bc(t,e,r,i,n,o,a,s,l){const c=n.length/2,u=a&&s&&l;if(c<ns.MAX_VERTEX_ARRAY_LENGTH){const h=e.prepareSegment(c,r,i),p=h.vertexLength;for(let t=0;t<o.length;t+=3)i.emplaceBack(p+o[t],p+o[t+1],p+o[t+2]);let d,f;h.vertexLength+=c,h.primitiveLength+=o.length/3,u&&(f=a.prepareSegment(c,r,s),d=f.vertexLength,f.vertexLength+=c);for(let e=0;e<n.length;e+=2)t(n[e],n[e+1]);if(u)for(let t=0;t<l.length;t++){const e=l[t];for(let t=1;t<e.length;t+=2)s.emplaceBack(d+e[t-1],d+e[t]);f.primitiveLength+=e.length/2}}else!function(t,e,r,i,n,o){const a=[];for(let t=0;t<i.length/2;t++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,r),u=c.vertexLength;for(let h=2;h<n.length;h+=3){const p=n[h-2],d=n[h-1],f=n[h];let m=a[p]<l,g=a[d]<l,_=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>ns.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,r),l=s.count,m=!0,g=!0,_=!0,u=0);const y=xc(a,i,o,s,p,m,c),v=xc(a,i,o,s,d,g,c),b=xc(a,i,o,s,f,_,c);r.emplaceBack(u+y-l,u+v-l,u+b-l),c.primitiveLength++}}(e,r,i,n,o,t),u&&function(t,e,r,i,n,o){const a=[];for(let t=0;t<i.length/2;t++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,r),u=c.vertexLength;for(let h=0;h<n.length;h++){const p=n[h];for(let d=1;d<n[h].length;d+=2){const n=p[d-1],h=p[d];let f=a[n]<l,m=a[h]<l;c.vertexLength+((f?1:0)+(m?1:0))>ns.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,r),l=s.count,f=!0,m=!0,u=0);const g=xc(a,i,o,s,n,f,c),_=xc(a,i,o,s,h,m,c);r.emplaceBack(u+g-l,u+_-l),c.primitiveLength++}}}(a,r,s,n,l,t),e.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function xc(t,e,r,i,n,o,a){if(o){const o=i.count;return r(e[2*n],e[2*n+1]),t[n]=i.count,i.count++,a.vertexLength++,o}return t[n]}class wc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new $a,this.indexArray=new ts,this.indexArray2=new es,this.programConfigurations=new Rs(t.layers,t.zoom),this.segments=new ns,this.segments2=new ns,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){this.hasDependencies=jl("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ns(a,t);if(!this.layers[0]._featureFilter.filter(new ko(this.zoom),u,r))continue;const h=n?i.evaluate(u,{},r,e.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:t?u.geometry:js(a),patterns:{},sortKey:h};o.push(p)}n&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const i of o){const{geometry:n,index:o,sourceLayerIndex:a}=i;if(this.hasDependencies){const t=Nl("fill",this.layers,i,{zoom:this.zoom},e);this.patternFeatures.push(t)}else this.addFeature(i,n,o,r,{},e.subdivisionGranularity);e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t,e,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ol),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,o){for(const t of Qr(e,500)){const e=_c(t,i,o.fill.getGranularityForZoomLevel(i.z)),r=this.layoutVertexArray;bc((t,e)=>{r.emplaceBack(t,e)},this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}}let Tc,Sc;ho("FillBucket",wc,{omit:["layers","patternFeatures"]});var Pc={get paint(){return Sc=Sc||new Xo({"fill-antialias":new Go(vt.paint_fill["fill-antialias"]),"fill-opacity":new qo(vt.paint_fill["fill-opacity"]),"fill-color":new qo(vt.paint_fill["fill-color"]),"fill-outline-color":new qo(vt.paint_fill["fill-outline-color"]),"fill-translate":new Go(vt.paint_fill["fill-translate"]),"fill-translate-anchor":new Go(vt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Zo(vt.paint_fill["fill-pattern"])})},get layout(){return Tc=Tc||new Xo({"fill-sort-key":new qo(vt.layout_fill["fill-sort-key"])})}};class Mc extends Yo{constructor(t,e){super(t,Pc,e)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new wc(t)}queryRadius(){return rl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Zs(il(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}}const Ac=ia([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ec=ia([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Ic}=Ac;class Cc{constructor(t,e,r,i,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n,t.readFields(Dc,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,i=[];let n,o=1,a=0,s=0,l=0;for(;t.pos<e;){if(a<=0){const e=t.readVarint();o=7&e,a=e>>3}if(a--,1===o||2===o)s+=t.readSVarint(),l+=t.readSVarint(),1===o&&(n&&i.push(n),n=[]),n&&n.push(new r(s,l));else{if(7!==o)throw new Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;t.pos<e;){if(i<=0){const e=t.readVarint();r=7&e,i=e>>3}if(i--,1===r||2===r)n+=t.readSVarint(),o+=t.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>c&&(c=o);else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,l,s,c]}toGeoJSON(t,e,r){const i=this.extent*Math.pow(2,r),n=this.extent*t,o=this.extent*e,a=this.loadGeometry();function s(t){return[360*(t.x+n)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+o)/i)*Math.PI))-90]}function l(t){return t.map(s)}let c;if(1===this.type){const t=[];for(const e of a)t.push(e[0]);const e=l(t);c=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){const t=a.map(l);c=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw new Error("unknown feature type");{const t=zc(a),e=[];for(const r of t)e.push(r.map(l));c=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function Dc(t,e,r){1===t?e.id=r.readVarint():2===t?function(t,e){const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos)}function zc(t){const e=t.length;if(e<=1)return[t];const r=[];let i,n;for(let o=0;o<e;o++){const e=kc(t[o]);0!==e&&(void 0===n&&(n=e<0),n===e<0?(i&&r.push(i),i=[t[o]]):i&&i.push(t[o]))}return i&&r.push(i),r}function kc(t){let e=0;for(let r,i,n=0,o=t.length,a=o-1;n<o;a=n++)r=t[n],i=t[a],e+=(i.x-r.x)*(r.y+i.y);return e}Cc.types=["Unknown","Point","LineString","Polygon"];class Rc{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Lc,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new Cc(this._pbf,e,this.extent,this._keys,this._values)}}function Lc(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){let e=null;const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==e)throw new Error("unknown feature value");return e}(r))}class Fc{constructor(t,e){this.layers=t.readFields(Bc,{},e)}}function Bc(t,e,r){if(3===t){const t=new Rc(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}const Oc=Math.pow(2,13);function jc(t,e,r,i,n,o,a,s){t.emplaceBack(e,r,2*Math.floor(i*Oc)+a,n*Oc*2,o*Oc*2,Math.round(s))}class Nc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Ga,this.centroidVertexArray=new Va,this.indexArray=new ts,this.programConfigurations=new Rs(t.layers,t.zoom),this.segments=new ns,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){this.features=[],this.hasDependencies=jl("fill-extrusion",this.layers,e);for(const{feature:i,id:n,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=Ns(i,t);if(!this.layers[0]._featureFilter.filter(new ko(this.zoom),s,r))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:t?s.geometry:js(i),properties:i.properties,type:i.type,patterns:{}};this.hasDependencies?this.features.push(Nl("fill-extrusion",this.layers,l,{zoom:this.zoom},e)):this.addFeature(l,l.geometry,o,r,{},e.subdivisionGranularity),e.featureIndex.insert(i,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,r){for(const i of this.features){const{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ic),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ec.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,o){for(const r of Qr(e,500)){const e={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(e,i,t,r,o);const a=this.layoutVertexArray.length-n,s=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<a;t++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}processPolygon(t,e,r,i,n){if(i.length<1)return;if($c(i[0]))return;for(const e of i)0!==e.length&&Vc(t,e);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(e.z),s="Polygon"===Cc.types[r.type];for(const t of i){if(0===t.length)continue;if($c(t))continue;const e=yc(t,a,s);this._generateSideFaces(e,o)}if(!s)return;const l=_c(i,e,a,!1),c=this.layoutVertexArray;bc((t,e)=>{jc(c,t,e,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){const n=t[i],o=t[i-1];if(Uc(n,o))continue;e.segment.vertexLength+4>ns.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const a=n.sub(o)._perp()._unit(),s=o.dist(n);r+s>32768&&(r=0),jc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,r),jc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,r),r+=s,jc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,r),jc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,r);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function Vc(t,e){for(let r=0;r<e.length;r++){const i=e[r];r===e.length-1&&e[0].x===i.x&&e[0].y===i.y||(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}function Uc(t,e){return t.x===e.x&&(t.x<0||t.x>I)||t.y===e.y&&(t.y<0||t.y>I)}function $c(t){return t.every(t=>t.x<0)||t.every(t=>t.x>I)||t.every(t=>t.y<0)||t.every(t=>t.y>I)}let Gc;ho("FillExtrusionBucket",Nc,{omit:["layers","features"]});var qc={get paint(){return Gc=Gc||new Xo({"fill-extrusion-opacity":new Go(vt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qo(vt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Go(vt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Go(vt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zo(vt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new qo(vt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qo(vt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Go(vt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Zc extends Yo{constructor(t,e){super(t,qc,e)}createBucket(t){return new Nc(t)}queryRadius(){return rl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){const l=il(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),h=function(t,e){const i=[];for(const n of t){const t=[n.x,n.y,0,1];S(t,t,e),i.push(new r(t[0]/t[3],t[1]/t[3]))}return i}(l,s),p=function(t,e,i,n){const o=[],a=[],s=n[8]*e,l=n[9]*e,c=n[10]*e,u=n[11]*e,h=n[8]*i,p=n[9]*i,d=n[10]*i,f=n[11]*i;for(const e of t){const t=[],i=[];for(const o of e){const e=o.x,a=o.y,m=n[0]*e+n[4]*a+n[12],g=n[1]*e+n[5]*a+n[13],_=n[2]*e+n[6]*a+n[14],y=n[3]*e+n[7]*a+n[15],v=_+c,b=y+u,x=m+h,w=g+p,T=_+d,S=y+f,P=new r((m+s)/b,(g+l)/b);P.z=v/b,t.push(P);const M=new r(x/S,w/S);M.z=T/S,i.push(M)}o.push(t),a.push(i)}return[o,a]}(n,u,c,s);return function(t,e,r){let i=1/0;Zs(r,e)&&(i=Hc(r,e[0]));for(let n=0;n<e.length;n++){const o=e[n],a=t[n];for(let t=0;t<o.length-1;t++){const e=o[t],n=[e,o[t+1],a[t+1],a[t],e];Gs(r,n)&&(i=Math.min(i,Hc(r,n)))}}return i!==1/0&&i}(p[0],p[1],h)}}function Wc(t,e){return t.x*e.x+t.y*e.y}function Hc(t,e){if(1===t.length){let r=0;const i=e[r++];let n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){const o=e[r],a=t[0],s=n.sub(i),l=o.sub(i),c=a.sub(i),u=Wc(s,s),h=Wc(s,l),p=Wc(l,l),d=Wc(c,s),f=Wc(c,l),m=u*p-h*h,g=(p*d-h*f)/m,_=(u*f-h*d)/m,y=i.z*(1-g-_)+n.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const Xc=ia([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Yc}=Xc,Kc=ia([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Jc}=Kc,Qc=Math.cos(Math.PI/180*37.5),tu=Math.pow(2,14)/.5;class eu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new qa,this.layoutVertexArray2=new Za,this.indexArray=new ts,this.programConfigurations=new Rs(t.layers,t.zoom),this.segments=new ns,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){this.hasDependencies=jl("line",this.layers,e)||this.hasLineDasharray(this.layers);const i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),o=[];for(const{feature:e,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ns(e,t);if(!this.layers[0]._featureFilter.filter(new ko(this.zoom),c,r))continue;const u=n?i.evaluate(c,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:js(e),patterns:{},dashes:{},sortKey:u};o.push(h)}n&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const i of o){const{geometry:n,index:o,sourceLayerIndex:a}=i;this.hasDependencies?(jl("line",this.layers,e)?Nl("line",this.layers,i,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,i,this.zoom,e),this.patternFeatures.push(i)):this.addFeature(i,n,o,r,{},{},e.subdivisionGranularity),e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(t,e,r,i){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Jc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yc),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,e,r,i,n,o,a){const s=this.layers[0].layout,l=s.get("line-join").evaluate(t,{}),c=s.get("line-cap"),u=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,l,c,u,h,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:o,canonical:i})}addLine(t,e,r,i,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=yc(t,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===Cc.types[e.type];let c=t.length;for(;c>=2&&t[c-1].equals(t[c-2]);)c--;let u=0;for(;u<c-1&&t[u].equals(t[u+1]);)u++;if(c<(l?3:2))return;"bevel"===r&&(n=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let d,f,m,g,_;this.e1=this.e2=-1,l&&(d=t[c-2],_=t[u].sub(d)._unit()._perp());for(let e=u;e<c;e++){if(m=e===c-1?l?t[u+1]:void 0:t[e+1],m&&t[e].equals(m))continue;_&&(g=_),d&&(f=d),d=t[e],_=m?m.sub(d)._unit()._perp():g,g=g||_;let a=g.add(_);0===a.x&&0===a.y||a._unit();const s=g.x*_.x+g.y*_.y,y=a.x*_.x+a.y*_.y,v=0!==y?1/y:1/0,b=2*Math.sqrt(2-2*y),x=y<Qc&&f&&m,w=g.x*_.y-g.y*_.x>0;if(x&&e>u){const t=d.dist(f);if(t>2*h){const e=d.sub(d.sub(f)._mult(h/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,g,0,0,p),f=e}}const T=f&&m;let S=T?r:l?"butt":i;if(T&&"round"===S&&(v<o?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>n&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<n&&(S="miter")),f&&this.updateDistance(f,d),"miter"===S)a._mult(v),this.addCurrentVertex(d,a,0,0,p);else if("flipbevel"===S){if(v>100)a=_.mult(-1);else{const t=v*g.add(_).mag()/g.sub(_).mag();a._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(d,a,0,0,p),this.addCurrentVertex(d,a.mult(-1),0,0,p)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(v*v-1),e=w?t:0,r=w?0:t;if(f&&this.addCurrentVertex(d,g,e,r,p),"fakeround"===S){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*t*t+(.848013+s*(.215638*s-1.06021)))}const i=_.sub(g)._mult(r)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(d,i.x,i.y,!1,w,0,p)}}m&&this.addCurrentVertex(d,_,-e,-r,p)}else if("butt"===S)this.addCurrentVertex(d,a,0,0,p);else if("square"===S){const t=f?1:-1;this.addCurrentVertex(d,a,t,t,p)}else"round"===S&&(f&&(this.addCurrentVertex(d,g,0,0,p),this.addCurrentVertex(d,g,1,1,p,!0)),m&&(this.addCurrentVertex(d,_,-1,-1,p,!0),this.addCurrentVertex(d,_,0,0,p)));if(x&&e<c-1){const t=d.dist(m);if(t>2*h){const e=d.add(m.sub(d)._mult(h/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,_,0,0,p),d=e}}}}addCurrentVertex(t,e,r,i,n,o=!1){const a=e.y*i-e.x,s=-e.y-e.x*i;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,n),this.addHalfVertex(t,a,s,o,!0,-i,n),this.distance>tu/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,o))}addHalfVertex({x:t,y:e},r,i,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(tu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),s.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(const e of t){const t=e.paint.get("line-dasharray");if(t&&!t.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(const n of t){const t=n.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;const o="round"===n.layout.get("line-cap"),a={dasharray:t.value.evaluate({zoom:r-1},e,{}),round:o},s={dasharray:t.value.evaluate({zoom:r},e,{}),round:o},l={dasharray:t.value.evaluate({zoom:r+1},e,{}),round:o},c=`${a.dasharray.join(",")},${a.round}`,u=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`;i.dashDependencies[c]=a,i.dashDependencies[u]=s,i.dashDependencies[h]=l,e.dashes[n.id]={min:c,mid:u,max:h}}}}let ru,iu;ho("LineBucket",eu,{omit:["layers","patternFeatures"]});var nu={get paint(){return iu=iu||new Xo({"line-opacity":new qo(vt.paint_line["line-opacity"]),"line-color":new qo(vt.paint_line["line-color"]),"line-translate":new Go(vt.paint_line["line-translate"]),"line-translate-anchor":new Go(vt.paint_line["line-translate-anchor"]),"line-width":new qo(vt.paint_line["line-width"]),"line-gap-width":new qo(vt.paint_line["line-gap-width"]),"line-offset":new qo(vt.paint_line["line-offset"]),"line-blur":new qo(vt.paint_line["line-blur"]),"line-dasharray":new Zo(vt.paint_line["line-dasharray"]),"line-pattern":new Zo(vt.paint_line["line-pattern"]),"line-gradient":new Ho(vt.paint_line["line-gradient"])})},get layout(){return ru=ru||new Xo({"line-cap":new Go(vt.layout_line["line-cap"]),"line-join":new qo(vt.layout_line["line-join"]),"line-miter-limit":new Go(vt.layout_line["line-miter-limit"]),"line-round-limit":new Go(vt.layout_line["line-round-limit"]),"line-sort-key":new qo(vt.layout_line["line-sort-key"])})}};class ou extends qo{possiblyEvaluate(t,e){return e=new ko(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=O({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}}let au;class su extends Yo{constructor(t,e){super(t,nu,e),this.gradientVersion=0,au||(au=new ou(nu.paint.properties["line-width"].specification),au.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof sr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=au.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new eu(t)}queryRadius(t){const e=t,r=lu(el("line-width",this,e),el("line-gap-width",this,e)),i=el("line-offset",this,e);return r/2+Math.abs(i)+rl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a}){const s=il(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*lu(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const o=nl(t[n]),a=[];for(let t=0;t<o.length;t++){const i=o[t],n=o[t-1],s=o[t+1],l=0===t?new r(0,0):i.sub(n)._unit()._perp(),c=t===o.length-1?new r(0,0):s.sub(i)._unit()._perp(),u=l._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),a.push(u._mult(e)._add(i))}i.push(a)}return i}(n,c*a)),function(t,e,r){for(let i=0;i<e.length;i++){const n=e[i];if(t.length>=3)for(let e=0;e<n.length;e++)if(Qs(t,n[e]))return!0;if(Ws(t,n,r))return!0}return!1}(s,n,l)}isTileClipped(){return!0}}function lu(t,e){return e>0?e+2*t:t}const cu=ia([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),uu=ia([{name:"a_projected_pos",components:3,type:"Float32"}],4);ia([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const hu=ia([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ia([{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 pu=ia([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),du=ia([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function fu(t,e,r){return t.sections.forEach(t=>{t.text=function(t,e,r){const i=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),zo.applyArabicShaping&&(t=zo.applyArabicShaping(t)),t}(t.text,e,r)}),t}ia([{name:"triangle",components:3,type:"Uint16"}]),ia([{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"}]),ia([{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"}]),ia([{type:"Float32",name:"offsetX"}]),ia([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ia([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var mu=24;const gu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},_u={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},yu={40:!0};function vu(t,e,r,i,n,o){if("fontStack"in e){const i=r[e.fontStack],o=i&&i[t];return o?o.metrics.advance*e.scale+n:0}{const t=i[e.imageName];return t?t.displaySize[0]*e.scale*mu/o+n:0}}function bu(t,e,r,i){const n=Math.pow(t-e,2);return i?t<e?n/2:2*n:n+Math.abs(r)*r}function xu(t,e,r){let i=0;return 10===t&&(i-=1e4),r&&(i+=150),40!==t&&65288!==t||(i+=50),41!==e&&65289!==e||(i+=50),i}function wu(t,e,r,i,n,o){let a=null,s=bu(e,r,n,o);for(const t of i){const i=bu(e-t.x,r,n,o)+t.badness;i<=s&&(a=t,s=i)}return{index:t,x:e,priorBreak:a,badness:s}}function Tu(t){return t?Tu(t.priorBreak).concat(t.index):[]}class Su{constructor(t="",e=[],r=[]){this.text=t,this.sections=e,this.sectionIndex=r,this.imageSectionID=null}static fromFeature(t,e){const r=new Su;for(let i=0;i<t.sections.length;i++){const n=t.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,e)}return r}length(){return[...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let e="",r={premature:!0,value:void 0};const i=t[Symbol.iterator]();let n=i.next();const o=t[Symbol.iterator]();o.next();let a=o.next();for(;!n.done;)e+=!a.done&&Ao(a.value.codePointAt(0))&&!gu[a.value]||!r.premature&&Ao(r.value.codePointAt(0))&&!gu[r.value]||!gu[n.value]?n.value:gu[n.value],r={value:n.value,premature:!1},n=i.next(),a=o.next();return e}(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const t=this.text.match(/^\s*/),e=t?t[0].length:0,r=this.text.match(/\S\s*$/),i=r?r[0].length-1:0;this.text=this.text.substring(e,this.text.length-i),this.sectionIndex=this.sectionIndex.slice(e,this.sectionIndex.length-i)}substring(t,e){const r=[...this.text].slice(t,e).join(""),i=this.sectionIndex.slice(t,e);return new Su(r,this.sections,i)}toCodeUnitIndex(t){return[...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,e)=>Math.max(t,this.sections[e].scale),0)}getMaxImageSize(t){let e=0,r=0;for(let i=0;i<this.length();i++){const n=this.getSection(i);if("imageName"in n){const i=t[n.imageName];if(!i)continue;const o=i.displaySize;e=Math.max(e,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:e,maxImageHeight:r}}addTextSection(t,e){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||e});const r=this.sections.length-1;this.sectionIndex.push(...[...t.text].map(()=>r))}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void G("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:e}),this.sectionIndex.push(this.sections.length-1)):G("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,e,r,i,n){const o=[],a=this.determineAverageLineWidth(t,e,r,i,n),s=this.hasZeroWidthSpaces();let l=0,c=0;const u=this.text[Symbol.iterator]();let h=u.next();const p=this.text[Symbol.iterator]();p.next();let d=p.next();const f=this.text[Symbol.iterator]();f.next(),f.next();let m=f.next();for(;!h.done;){const e=this.getSection(c),g=h.value.codePointAt(0);if(xo(g)||(l+=vu(g,e,r,i,t,n)),!d.done){const t=vo(g),r=d.value.codePointAt(0);(_u[g]||t||"imageName"in e||!m.done&&yu[r])&&o.push(wu(c+1,l,a,o,xu(g,r,t&&s),!1))}c++,h=u.next(),d=p.next(),m=f.next()}return Tu(wu(this.length(),l,a,o,0,!0))}determineAverageLineWidth(t,e,r,i,n){let o=0,a=0;for(const e of this.text){const s=this.getSection(a);o+=vu(e.codePointAt(0),s,r,i,t,n),a++}return o/Math.max(1,Math.ceil(o/e))}}const Pu=4294967296,Mu=1/Pu,Au="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Eu{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,r=this.length){for(;this.pos<r;){const r=this.readVarint(),i=r>>3,n=this.pos;this.type=7&r,t(i,e,this),this.pos===n&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Pu;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Pu;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let r,i;return i=e[this.pos++],r=127&i,i<128?r:(i=e[this.pos++],r|=(127&i)<<7,i<128?r:(i=e[this.pos++],r|=(127&i)<<14,i<128?r:(i=e[this.pos++],r|=(127&i)<<21,i<128?r:(i=e[this.pos],r|=(15&i)<<28,function(t,e,r){const i=r.buf;let n,o;if(o=i[r.pos++],n=(112&o)>>4,o<128)return Iu(t,n,e);if(o=i[r.pos++],n|=(127&o)<<3,o<128)return Iu(t,n,e);if(o=i[r.pos++],n|=(127&o)<<10,o<128)return Iu(t,n,e);if(o=i[r.pos++],n|=(127&o)<<17,o<128)return Iu(t,n,e);if(o=i[r.pos++],n|=(127&o)<<24,o<128)return Iu(t,n,e);if(o=i[r.pos++],n|=(1&o)<<31,o<128)return Iu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(r,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Au?Au.decode(this.buf.subarray(e,t)):function(t,e,r){let i="",n=e;for(;n<r;){const e=t[n];let o,a,s,l=null,c=e>239?4:e>223?3:e>191?2:1;if(n+c>r)break;1===c?e<128&&(l=e):2===c?(o=t[n+1],128==(192&o)&&(l=(31&e)<<6|63&o,l<=127&&(l=null))):3===c?(o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(l=(15&e)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&e)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Mu),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Mu),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),4294967295^r?r=r+1|0:(r=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){const r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,r){for(let i,n,o=0;o<e.length;o++){if(i=e.charCodeAt(o),i>55295&&i<57344){if(!n){i>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=i;continue}if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=63&i|128)}return r}(this.buf,t,this.pos);const r=this.pos-e;r>=128&&Cu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let r=0;r<e;r++)this.buf[this.pos++]=t[r]}writeRawMessage(t,e){this.pos++;const r=this.pos;t(e,this);const i=this.pos-r;i>=128&&Cu(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Du,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,zu,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Lu,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,ku,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Ru,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Fu,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Bu,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Ou,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,ju,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Iu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Cu(t,e,r){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(i);for(let e=r.pos-1;e>=t;e--)r.buf[e+i]=r.buf[e]}function Du(t,e){for(let r=0;r<t.length;r++)e.writeVarint(t[r])}function zu(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function ku(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function Ru(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function Lu(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function Fu(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function Bu(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Ou(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function ju(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Nu(t,e,r){1===t&&r.readMessage(Vu,e)}function Vu(t,e,r){if(3===t){const{id:t,bitmap:i,width:n,height:o,left:a,top:s,advance:l}=r.readMessage(Uu,{});e.push({id:t,bitmap:new xl({width:n+6,height:o+6},i),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function Uu(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function $u(t){let e=0,r=0;for(const i of t)e+=i.w*i.h,r=Math.max(r,i.w);t.sort((t,e)=>e.h-t.h);const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let n=0,o=0;for(const e of t)for(let t=i.length-1;t>=0;t--){const r=i[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,o=Math.max(o,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===r.w&&e.h===r.h){const e=i.pop();e&&t<i.length&&(i[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(i.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}class Gu{constructor(t,{pixelRatio:e,version:r,stretchX:i,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=n,this.content=o,this.version=r,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class qu{constructor(t,e){const r={},i={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,r,n),this.addImages(e,i,n);const{w:o,h:a}=$u(n),s=new wl({width:o||1,height:a||1});for(const e in t){const i=t[e],n=r[e].paddedRect;wl.copy(i.data,s,{x:0,y:0},{x:n.x+1,y:n.y+1},i.data)}for(const t in e){const r=e[t],n=i[t].paddedRect,o=n.x+1,a=n.y+1,l=r.data.width,c=r.data.height;wl.copy(r.data,s,{x:0,y:0},{x:o,y:a},r.data),wl.copy(r.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),wl.copy(r.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),wl.copy(r.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),wl.copy(r.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(const i in t){const n=t[i],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),e[i]=new Gu(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[i,n]=t.tl;r.update(e.data,void 0,{x:i,y:n})}}var Zu;function Wu(e,r,i,n,o,a,s,l,c,u,h,p,d,f,m){const g=Su.fromFeature(e,o);let _;p===t.az.vertical&&g.verticalizePunctuation();let y=g.determineLineBreaks(u,a,r,n,f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=zo;if(v&&1===g.sections.length){_=[],y=y.map(t=>g.toCodeUnitIndex(t));const t=v(g.toString(),y);for(const e of t){const t=[...e].map(()=>0);_.push(new Su(e,g.sections,t))}}else if(b){_=[],y=y.map(t=>g.toCodeUnitIndex(t));let t=0;const e=[];for(const r of g.text)e.push(...Array(r.length).fill(g.sectionIndex[t])),t++;const r=b(g.text,e,y);for(const t of r){const e=[];let r="";for(const i of t[0])e.push(t[1][r.length]),r+=i;_.push(new Su(t[0],g.sections,e))}}else _=function(t,e){const r=[];let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<t.length()&&r.push(t.substring(i,t.length())),r}(g,y);const x=[],w={positionedLines:x,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,r,i,n,o,a,s,l,c,u,h){let p=0,d=0,f=0,m=0;const g="right"===s?1:"left"===s?0:.5,_=mu/h;let y=0;for(const a of n){a.trim();const n=a.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=s;const h=s.positionedGlyphs;let v=0;if(!a.length()){d+=o,++y;continue}const b=Xu(i,a,_);let x=0;for(const o of a.text){const s=a.getSection(x),f=o.codePointAt(0),m=Ku(l,u,f),g={glyph:f,imageName:null,x:p,y:d+-17,vertical:m,scale:1,fontStack:"",sectionIndex:a.getSectionIndex(x),metrics:null,rect:null};let y;if("fontStack"in s){if(y=Ju(s,f,m,b,e,r),!y)continue;g.fontStack=s.fontStack}else{if(t.iconsInText=!0,s.scale*=_,y=Qu(s,m,n,b,i),!y)continue;v=Math.max(v,y.imageOffset),g.imageName=s.imageName}const{rect:w,metrics:T,baselineOffset:S}=y;g.y+=S,g.scale=s.scale,g.metrics=T,g.rect=w,h.push(g),m?(t.verticalizable=!0,p+=("imageName"in s?T.advance:mu)*s.scale+c):p+=T.advance*s.scale+c,x++}0!==h.length&&(f=Math.max(p-c,f),th(h,0,h.length-1,g)),p=0,s.lineOffset=Math.max(v,(n-1)*mu);const w=o*n+v;d+=w,m=Math.max(w,m),++y}const{horizontalAlign:v,verticalAlign:b}=Hu(a);(function(t,e,r,i,n,o,a,s,l){const c=(e-r)*n;let u=0;u=o!==a?-s*i- -17:-i*l*a+.5*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=u})(t.positionedLines,g,v,b,f,m,o,d,n.length),t.top+=-b*d,t.bottom=t.top+d,t.left+=-v*f,t.right=t.left+f}(w,r,i,n,_,s,l,c,p,u,d,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(x)&&w}function Hu(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Xu(t,e,r){const i=e.getMaxScale()*mu,{maxImageWidth:n,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(i,o*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:a}}function Yu(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function Ku(e,r,i){return!(e===t.az.horizontal||!r&&!bo(i)||r&&(xo(i)||(n=i,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function Ju(t,e,r,i,n,o){const a=o[t.fontStack],s=function(t,e,r,i){if(t&&t.rect)return t;const n=e[r.fontStack],o=n&&n[i];return o?{rect:null,metrics:o.metrics}:null}(a&&a[e],n,t,e);if(null===s)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*mu;else{const e=Yu(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*mu)*e}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function Qu(t,e,r,i,n){const o=n[t.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:1,top:-3,advance:e?s[1]:s[0]};let c;if(e)c=i.verticalLineContentWidth-s[1]*t.scale;else{const e=Yu(t.verticalAlign);c=(i.horizontalLineContentHeight-s[1]*t.scale)*e}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(e?s[0]:s[1])*t.scale-mu*r}}function th(t,e,r,i){if(0===i)return;const n=t[r],o=(t[r].x+n.metrics.advance*n.scale)*i;for(let i=e;i<=r;i++)t[i].x-=o}function eh(t,e,r){const{horizontalAlign:i,verticalAlign:n}=Hu(r),o=e[0]-t.displaySize[0]*i,a=e[1]-t.displaySize[1]*n;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function rh(t){var e,r;let i=t.left,n=t.top,o=t.right-i,a=t.bottom-n;const s=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(r=t.image.textFitHeight)&&void 0!==r?r:"stretchOrShrink",c=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const t=Math.ceil(a*c);i*=t/o,o=t}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const t=Math.ceil(o/c);n*=t/a,a=t}return{x1:i,y1:n,x2:i+o,y2:n+a}}function ih(t,e,r,i,n,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let u,h,p,d;"width"===r||"both"===r?(d=n[0]+l-i[3],h=n[0]+c+i[1]):(d=n[0]+(l+c-a.displaySize[0])/2,h=d+a.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===r||"both"===r?(u=n[1]+f-i[0],p=n[1]+m+i[2]):(u=n[1]+(f+m-a.displaySize[1])/2,p=u+a.displaySize[1]),{image:a,top:u,right:h,bottom:p,left:d,collisionPadding:s}}ho("ImagePosition",Gu),ho("ImageAtlas",qu),t.az=void 0,(Zu=t.az||(t.az={}))[Zu.none=0]="none",Zu[Zu.horizontal=1]="horizontal",Zu[Zu.vertical=2]="vertical",Zu[Zu.horizontalOnly=3]="horizontalOnly";const nh=128,oh=32640;function ah(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new ko(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:i}=r;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let o=n;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[n],s=e[o];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:i}:{kind:"camera",minZoom:a,maxZoom:s,minSize:r.evaluate(new ko(a)),maxSize:r.evaluate(new ko(s)),interpolationType:i}}}function sh(t,e,r){let i="never";const n=t.get(e);return n?i=n:t.get(r)&&(i="always"),i}const lh=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ch(t,e,r,i,n,o,a,s,l,c,u,h,p){const d=s?Math.min(oh,Math.round(s[0])):0,f=s?Math.min(oh,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*i),Math.round(32*n),o,a,(d<<1)+(l?1:0),f,16*c,16*u,256*h,256*p)}function uh(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function hh(t){for(const e of t.sections)if(Do(e.text))return!0;return!1}class ph{constructor(t){this.layoutVertexArray=new Xa,this.indexArray=new ts,this.programConfigurations=t,this.segments=new ns,this.dynamicLayoutVertexArray=new Ya,this.opacityVertexArray=new Ka,this.hasVisibleVertices=!1,this.placedSymbolArray=new za}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,cu.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,uu.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,lh,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&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())}}ho("SymbolBuffers",ph);class dh{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new ns,this.collisionVertexArray=new Qa}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,hu.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ho("CollisionBuffers",dh);class fh{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ah(this.zoom,r["text-size"]),this.iconSizeData=ah(this.zoom,r["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.canOverlap="never"!==sh(i,"text-overlap","text-allow-overlap")||"never"!==sh(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map(e=>t.az[e])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=e.sourceID}createArrays(){this.text=new ph(new Rs(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new ph(new Rs(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new La,this.lineVertexArray=new Fa,this.symbolInstances=new Ra,this.textAnchorOffsets=new Oa}calculateGlyphDependencies(t,e,r,i,n){for(const o of t)if(e[o.codePointAt(0)]=!0,(r||i)&&n){const t=gu[o];t&&(e[t.codePointAt(0)]=!0)}}populate(e,r,i){const n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof De&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const p=r.iconDependencies,d=r.glyphDependencies,f=r.availableImages,m=new ko(this.zoom);for(const{feature:r,id:s,index:l,sourceLayerIndex:g}of e){const e=n._featureFilter.needGeometry,_=Ns(r,e);if(!n._featureFilter.filter(m,_,i))continue;let y,v;if(e||(_.geometry=js(r)),c){const t=n.getValueAndResolveTokens("text-field",_,i,f),e=De.factory(t),r=this.hasRTLText=this.hasRTLText||hh(e);(!r||"unavailable"===zo.getRTLTextPluginStatus()||r&&zo.isParsed())&&(y=fu(e,n,_))}if(u){const t=n.getValueAndResolveTokens("icon-image",_,i,f);v=t instanceof Oe?t:Oe.fromString(t)}if(!y&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(_,{},i):void 0;if(this.features.push({id:s,text:y,icon:v,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:r.properties,type:Cc.types[r.type],sortKey:b}),v&&(p[v.name]=!0),y){const e=a.evaluate(_,{},i).join(","),r="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.az.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const i=wo(y.toString()),n=t.fontStack||e,o=d[n]=d[n]||{};this.calculateGlyphDependencies(t.text,o,r,this.allowVerticalPlacement,i)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},r={},i=[];let n=0;function o(e){i.push(t[e]),n++}function a(t,e,n){const o=r[t];return delete r[t],r[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function s(t,r,n){const o=e[r];return delete e[r],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(t,e,r){const i=r?e[0][e[0].length-1]:e[0][0];return`${t}:${i.x}:${i.y}`}for(let c=0;c<t.length;c++){const u=t[c],h=u.geometry,p=u.text?u.text.toString():null;if(!p){o(c);continue}const d=l(p,h),f=l(p,h,!0);if(d in r&&f in e&&r[d]!==e[f]){const t=s(d,f,h),n=a(d,f,i[t].geometry);delete e[d],delete r[f],r[l(p,i[n].geometry,!0)]=n,i[t].geometry=null}else d in r?a(d,f,h):f in e?s(d,f,h):(o(c),e[d]=n-1,r[f]=n-1)}return i.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,e)=>t.sortKey-e.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]);const n={};for(let i=t.segment+1;i<e.length;i++)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i<e.length-1&&(r+=e[i+1].dist(e[i]));for(let r=t.segment||0;r>=0;r--)n[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r>0&&(i+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,r,i,n,o,a,s,l,c,u,h,p){const d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*r.length,f,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===t.az.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let t=0;t<r.length;t++){const{tl:n,tr:o,bl:s,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:w,sectionIndex:T}=r[t],S=m.vertexLength,P=x[1];ch(f,l.x,l.y,n.x,P+n.y,u.x,u.y,i,w,h.x,h.y,_,b),ch(f,l.x,l.y,o.x,P+o.y,u.x+u.w,u.y,i,w,g.x,h.y,_,b),ch(f,l.x,l.y,s.x,P+s.y,u.x,u.y+u.h,i,w,h.x,g.y,_,b),ch(f,l.x,l.y,c.x,P+c.y,u.x+u.w,u.y+u.h,i,w,g.x,g.y,_,b),uh(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(S,S+2,S+1),d.emplaceBack(S+1,S+2,S+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),t!==r.length-1&&T===r[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,a,a.index,{imagePositions:{},canonical:p,formattedSection:v&&v[T]})}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,u,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,h)}_addCollisionDebugVertex(t,e,r,i,n,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,n,o,a,s){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,u=o.layoutVertexArray,h=o.collisionVertexArray,p=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(u,h,a,p,d,new r(t,e)),this._addCollisionDebugVertex(u,h,a,p,d,new r(i,e)),this._addCollisionDebugVertex(u,h,a,p,d,new r(i,n)),this._addCollisionDebugVertex(u,h,a,p,d,new r(t,n)),l.vertexLength+=4;const f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,i?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new dh(Ja,pu.members,es),this.iconCollisionBox=new dh(Ja,pu.members,es);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,o,a,s,l){const c={};for(let i=e;i<r;i++){const e=t.get(i);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=i;e<n;e++){const r=t.get(e);c.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.verticalTextFeatureIndex=r.featureIndex;break}for(let e=o;e<a;e++){const r=t.get(e);c.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.iconFeatureIndex=r.featureIndex;break}for(let e=s;e<l;e++){const r=t.get(e);c.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.verticalIconFeatureIndex=r.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<i;e+=4)t.indexArray.emplaceBack(e,e+2,e+1),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),i=[],n=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const a=this.symbolInstances.get(t);i.push(0|Math.round(e*a.anchorX+r*a.anchorY)),n.push(a.featureIndex)}return o.sort((t,e)=>i[t]-i[e]||n[e]-n[t]),o}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let mh,gh;ho("SymbolBucket",fh,{omit:["layers","collisionBoxArray","features","compareText"]}),fh.MAX_GLYPHS=65535,fh.addDynamicAttributes=uh;var _h={get paint(){return gh=gh||new Xo({"icon-opacity":new qo(vt.paint_symbol["icon-opacity"]),"icon-color":new qo(vt.paint_symbol["icon-color"]),"icon-halo-color":new qo(vt.paint_symbol["icon-halo-color"]),"icon-halo-width":new qo(vt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qo(vt.paint_symbol["icon-halo-blur"]),"icon-translate":new Go(vt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Go(vt.paint_symbol["icon-translate-anchor"]),"text-opacity":new qo(vt.paint_symbol["text-opacity"]),"text-color":new qo(vt.paint_symbol["text-color"],{runtimeType:jt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new qo(vt.paint_symbol["text-halo-color"]),"text-halo-width":new qo(vt.paint_symbol["text-halo-width"]),"text-halo-blur":new qo(vt.paint_symbol["text-halo-blur"]),"text-translate":new Go(vt.paint_symbol["text-translate"]),"text-translate-anchor":new Go(vt.paint_symbol["text-translate-anchor"])})},get layout(){return mh=mh||new Xo({"symbol-placement":new Go(vt.layout_symbol["symbol-placement"]),"symbol-spacing":new Go(vt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Go(vt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new qo(vt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Go(vt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Go(vt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Go(vt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Go(vt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Go(vt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Go(vt.layout_symbol["icon-rotation-alignment"]),"icon-size":new qo(vt.layout_symbol["icon-size"]),"icon-text-fit":new Go(vt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Go(vt.layout_symbol["icon-text-fit-padding"]),"icon-image":new qo(vt.layout_symbol["icon-image"]),"icon-rotate":new qo(vt.layout_symbol["icon-rotate"]),"icon-padding":new qo(vt.layout_symbol["icon-padding"]),"icon-keep-upright":new Go(vt.layout_symbol["icon-keep-upright"]),"icon-offset":new qo(vt.layout_symbol["icon-offset"]),"icon-anchor":new qo(vt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Go(vt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Go(vt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Go(vt.layout_symbol["text-rotation-alignment"]),"text-field":new qo(vt.layout_symbol["text-field"]),"text-font":new qo(vt.layout_symbol["text-font"]),"text-size":new qo(vt.layout_symbol["text-size"]),"text-max-width":new qo(vt.layout_symbol["text-max-width"]),"text-line-height":new Go(vt.layout_symbol["text-line-height"]),"text-letter-spacing":new qo(vt.layout_symbol["text-letter-spacing"]),"text-justify":new qo(vt.layout_symbol["text-justify"]),"text-radial-offset":new qo(vt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Go(vt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new qo(vt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new qo(vt.layout_symbol["text-anchor"]),"text-max-angle":new Go(vt.layout_symbol["text-max-angle"]),"text-writing-mode":new Go(vt.layout_symbol["text-writing-mode"]),"text-rotate":new qo(vt.layout_symbol["text-rotate"]),"text-padding":new Go(vt.layout_symbol["text-padding"]),"text-keep-upright":new Go(vt.layout_symbol["text-keep-upright"]),"text-transform":new qo(vt.layout_symbol["text-transform"]),"text-offset":new qo(vt.layout_symbol["text-offset"]),"text-allow-overlap":new Go(vt.layout_symbol["text-allow-overlap"]),"text-overlap":new Go(vt.layout_symbol["text-overlap"]),"text-ignore-placement":new Go(vt.layout_symbol["text-ignore-placement"]),"text-optional":new Go(vt.layout_symbol["text-optional"])})}};class yh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Lt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ho("FormatSectionOverride",yh,{omit:["defaultValue"]});class vh extends Yo{constructor(t,e){super(t,_h,e)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,i){const n=this.layout.get(t).evaluate(e,{},r,i),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||tn(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,(e,r)=>t&&r in t?String(t[r]):"")}(e.properties,n)}createBucket(t){return new fh(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of _h.paint.overridableProperties){if(!vh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new yh(e),i=new Qi(r,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new rn("source",i):new nn("composite",i,e.value.zoomStops),this.paint._values[t]=new Uo(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&vh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),i=_h.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(i.overrides&&i.overrides.hasOverride(e))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof De)o(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){const t=e=>{n||(e instanceof Ge&&Ue(e.value)===Gt?o(e.value.sections):e instanceof Ar?o(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let bh;var xh={get paint(){return bh=bh||new Xo({"background-color":new Go(vt.paint_background["background-color"]),"background-pattern":new Wo(vt.paint_background["background-pattern"]),"background-opacity":new Go(vt.paint_background["background-opacity"])})}};class wh extends Yo{constructor(t,e){super(t,xh,e)}}class Th extends Yo{constructor(t,e){super(t,{},e),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Sh{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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 Ph={once:!0},Mh=6371008.8;class Ah{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ah(B(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,i=t.lat*e,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return Mh*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof Ah)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ah(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ah(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 Eh=2*Math.PI*Mh;function Ih(t){return Eh*Math.cos(t*Math.PI/180)}function Ch(t){return(180+t)/360}function Dh(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function zh(t,e){return t/Ih(e)}function kh(t){return 360*t-180}function Rh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Lh(t,e){return t*Ih(Rh(e))}class Fh{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=Ah.convert(t);return new Fh(Ch(r.lng),Dh(r.lat),zh(e,r.lat))}toLngLat(){return new Ah(kh(this.x),Rh(this.y))}toAltitude(){return Lh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Eh*(t=Rh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Bh(t,e,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}class Oh{constructor(t,e,r){if(!function(t,e,r){return!(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,r))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Vh(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const i=(o=this.y,a=this.z,s=Bh(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=Bh(256*(n+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,o,a,s,l;const c=function(t,e,r){let i,n="";for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}(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("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new r((t.x*e-this.x)*I,(t.y*e-this.y)*I)}toString(){return`${this.z}/${this.x}/${this.y}`}}class jh{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Vh(t,e.z,e.z,e.x,e.y)}}class Nh{constructor(t,e,r,i,n){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Oh(r,+i,+n),this.key=Vh(e,t,r,i,n)}clone(){return new Nh(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 e=this.canonical.z-t;return t>this.canonical.z?new Nh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Nh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?Vh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Vh(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;if(this.overscaledZ-t.overscaledZ<=0)return!1;if(0===t.overscaledZ)return this.overscaledZ>0;const e=this.canonical.z-t.canonical.z;return!(e<0)&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Nh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new Nh(e,this.wrap,e,r,i),new Nh(e,this.wrap,e,r+1,i),new Nh(e,this.wrap,e,r,i+1),new Nh(e,this.wrap,e,r+1,i+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 Nh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Nh(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 jh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Fh(t.x-this.wrap,t.y))}normalizeCoordinates(t,e,r=8192){if(t>=0&&t<r&&e>=0&&e<r)return{tileID:this,x:t,y:e};const i=Math.floor(t/r),n=Math.floor(e/r),o=t-i*r,a=e-n*r,s=this.canonical.z,l=1<<s,c=this.canonical.y+n;if(c<0||c>=l)return null;let u=this.canonical.x+i,h=this.wrap;return u<0?(h-=Math.ceil(-u/l),u=(u%l+l)%l):u>=l&&(h+=Math.floor(u/l),u%=l),{tileID:new Nh(this.overscaledZ,h,s,u,c),x:o,y:a}}}function Vh(t,e,r,i,n){(t*=2)<0&&(t=-1*t-1);const o=1<<r;return(o*o*t+o*n+i).toString(36)+r.toString(36)+e.toString(36)}function Uh(t,e){return e?t.properties[e]:t.id}function $h(t,e){const r={id:t.id};if(e.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(const r of e.removeProperties){const e=t.addOrUpdateProperties.findIndex(t=>t.key===r);e>-1&&t.addOrUpdateProperties.splice(e,1)}return(t.removeAllProperties||e.removeAllProperties)&&(r.removeAllProperties=!0),(t.removeProperties||e.removeProperties)&&(r.removeProperties=[...t.removeProperties||[],...e.removeProperties||[]]),(t.addOrUpdateProperties||e.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(t.newGeometry||e.newGeometry)&&(r.newGeometry=e.newGeometry||t.newGeometry),r}function Gh(t){var e,r;if(!t)return{};const i={};return i.removeAll=t.removeAll,i.remove=new Set(t.remove||[]),i.add=new Map(null===(e=t.add)||void 0===e?void 0:e.map(t=>[t.id,t])),i.update=new Map(null===(r=t.update)||void 0===r?void 0:r.map(t=>[t.id,t])),i}ho("CanonicalTileID",Oh),ho("OverscaledTileID",Nh,{omit:["terrainRttPosMatrix32f"]});class qh{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const e=new qh;return e.extend(t(new r(this.minX,this.minY))),e.extend(t(new r(this.maxX,this.minY))),e.extend(t(new r(this.minX,this.maxY))),e.extend(t(new r(this.maxX,this.maxY))),e}static fromPoints(t){const e=new qh;for(const r of t)e.extend(r);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class Zh{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}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 Wh{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e,this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[360*(t.x+e)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+r)/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(t=>this.projectPoint(t,e,r,i))}get geometry(){if(this._geometry)return this._geometry;const t=this._vectorTileFeature,e=t.extent*Math.pow(2,this._z),r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{const t=[];for(const e of n)t.push(e[0]);const o=this.projectLine(t,r,i,e);this._geometry=1===t.length?{type:"Point",coordinates:o[0]}:{type:"MultiPoint",coordinates:o};break}case 2:{const t=n.map(t=>this.projectLine(t,r,i,e));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}case 3:{const t=zc(n),o=[];for(const n of t)o.push(n.map(t=>this.projectLine(t,r,i,e)));this._geometry=1===o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o};break}default:throw new Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"_x"!==e&&"_y"!==e&&"_z"!==e&&(t[e]=this[e]);return t}}class Hh{_name;dataBuffer;nullabilityBuffer;_size;constructor(t,e,r){this._name=t,this.dataBuffer=e,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer&&this.nullabilityBuffer.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Xh extends Hh{}class Yh extends Xh{getValueFromBuffer(t){return this.dataBuffer[t]}}class Kh extends Xh{getValueFromBuffer(t){return this.dataBuffer[t]}}class Jh extends Hh{delta;constructor(t,e,r,i){super(t,e,i),this.delta=r}}class Qh extends Jh{constructor(t,e,r,i){super(t,Int32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class tp extends Hh{constructor(t,e,r){super(t,Int32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}class ep{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(t,e,r,i,n=4096){this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(t)}*[Symbol.iterator](){const t=this.geometryVector[Symbol.iterator]();let e=0;for(;e<this.numFeatures;){let r;this.idVector&&(r=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(e)):this.idVector.getValue(e));const i=t?.next().value,n={};for(const t of this.propertyVectors){if(!t)continue;const r=t.name,i=t.getValue(e);null!==i&&(n[r]=i)}e++,yield{id:r,geometry:i,properties:n}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const t=[],e=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;this.idVector&&(i=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(r)):this.idVector.getValue(r));const n={coordinates:e[r],type:this.geometryVector.geometryType(r)},o={};for(const t of this.propertyVectors){if(!t)continue;const e=t.name,i=t.getValue(r);null!==i&&(o[e]=i)}t.push({id:i,geometry:n,properties:o})}return t}containsMaxSaveIntegerValues(t){return t instanceof Yh||t instanceof tp&&t instanceof Qh||t instanceof Kh}}class rp{value;constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}var ip,np,op,ap,sp,lp,cp,up,hp,pp;function dp(t,e,r){const i=new Int32Array(r);let n=0,o=e.get();for(let e=0;e<i.length;e++){let e=t[o++],r=127&e;e<128||(e=t[o++],r|=(127&e)<<7,e<128||(e=t[o++],r|=(127&e)<<14,e<128||(e=t[o++],r|=(127&e)<<21,e<128||(e=t[o++],r|=(15&e)<<28)))),i[n++]=r}return e.set(o),i}function fp(t,e,r){const i=new BigInt64Array(r);for(let r=0;r<i.length;r++)i[r]=mp(t,e);return i}function mp(t,e){let r=0n,i=0,n=e.get();for(;n<t.length;){const e=t[n++];if(r|=BigInt(127&e)<<BigInt(i),!(128&e))break;if(i+=7,i>=64)throw new Error("Varint too long")}return e.set(n),r}function gp(t,e){let r,i;return i=t[e.get()],e.increment(),r=127&i,i<128?r:(i=t[e.get()],e.increment(),r|=(127&i)<<7,i<128?r:(i=t[e.get()],e.increment(),r|=(127&i)<<14,i<128?r:(i=t[e.get()],e.increment(),r|=(127&i)<<21,i<128?r:(i=t[e.get()],r|=(15&i)<<28,function(t,e,r){let i,n;if(n=e[r.get()],r.increment(),i=(112&n)>>4,n<128)return 4294967296*i+(t>>>0);if(n=e[r.get()],r.increment(),i|=(127&n)<<3,n<128)return 4294967296*i+(t>>>0);if(n=e[r.get()],r.increment(),i|=(127&n)<<10,n<128)return 4294967296*i+(t>>>0);if(n=e[r.get()],r.increment(),i|=(127&n)<<17,n<128)return 4294967296*i+(t>>>0);if(n=e[r.get()],r.increment(),i|=(127&n)<<24,n<128)return 4294967296*i+(t>>>0);if(n=e[r.get()],r.increment(),i|=(1&n)<<31,n<128)return 4294967296*i+(t>>>0);throw new Error("Expected varint not more than 10 bytes")}(r,t,e)))))}function _p(t){return t>>>1^-(1&t)}function yp(t){return t>>1n^-(1n&t)}function vp(t){return t%2==1?(t+1)/-2:t/2}function bp(t,e,r){if(void 0===r){r=0;for(let i=0;i<e;i++)r+=t[i]}const i=new Int32Array(r);let n=0;for(let r=0;r<e;r++){const o=t[r];i.fill(t[r+e],n,n+o),n+=o}return i}function xp(t,e,r){if(void 0===r){r=0;for(let i=0;i<e;i++)r+=Number(t[i])}const i=new BigInt64Array(r);let n=0;for(let r=0;r<e;r++){const o=Number(t[r]);i.fill(t[r+e],n,n+o),n+=o}return i}function wp(t,e,r){const i=new Float64Array(r);let n=0;for(let r=0;r<e;r++){const o=t[r];i.fill(t[r+e],n,n+o),n+=o}return i}function Tp(t){const e=t.length/4*4;let r=1;if(e>=4)for(let i=t[0];r<e-4;r+=4)i=t[r]+=i,i=t[r+1]+=i,i=t[r+2]+=i,i=t[r+3]+=i;for(;r!=t.length;)t[r]+=t[r-1],++r}!function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE"}(ip||(ip={})),function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT",t.ALP="ALP"}(np||(np={})),function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"}(op||(op={}));class Sp{_dictionaryType;_offsetType;_lengthType;constructor(t,e,r){this._dictionaryType=t,this._offsetType=e,this._lengthType=r}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function Pp(t,e){const r=function(t,e){const r=t[e.get()],i=Object.values(op)[r>>4];let n=null;switch(i){case op.DATA:n=new Sp(Object.values(ap)[15&r]);break;case op.OFFSET:n=new Sp(null,Object.values(sp)[15&r]);break;case op.LENGTH:n=new Sp(null,null,Object.values(lp)[15&r])}e.increment();const o=t[e.get()],a=Object.values(ip)[o>>5],s=Object.values(ip)[o>>2&7],l=Object.values(np)[3&o];e.increment();const c=dp(t,e,2),u=c[0];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:a,logicalLevelTechnique2:s,physicalLevelTechnique:l,numValues:u,byteLength:c[1],decompressedCount:u}}(t,e);return r.logicalLevelTechnique1===ip.MORTON?function(t,e,r){const i=dp(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}(r,t,e):ip.RLE!==r.logicalLevelTechnique1&&ip.RLE!==r.logicalLevelTechnique2||np.NONE===r.physicalLevelTechnique?r:function(t,e,r){const i=dp(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}(r,t,e)}!function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"}(ap||(ap={})),function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"}(sp||(sp={})),function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"}(lp||(lp={})),function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(cp||(cp={}));class Mp{values;_size;constructor(t,e){this.values=t,this._size=e}get(t){const e=Math.floor(t/8);return 1==(this.values[e]>>t%8&1)}set(t,e){const r=Math.floor(t/8);this.values[r]=this.values[r]|(e?1:0)<<t%8}getInt(t){const e=Math.floor(t/8);return this.values[e]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function Ap(t,e,r){if(!e)return t;const i=e.size(),n=new(0,t.constructor)(i);let o=0;for(let a=0;a<i;a++)n[a]=e.get(a)?t[o++]:r;return n}function Ep(t,e,r,i,n,o){return function(t,e,r,i,n){switch(e.logicalLevelTechnique1){case ip.DELTA:if(e.logicalLevelTechnique2===ip.RLE){const r=e;if(!n)return function(t,e,r){const i=new Int32Array(r);let n=0,o=0;for(let r=0;r<e;r++){const a=t[r],s=_p(t[r+e]);for(let t=0;t<a;t++)o+=s,i[n++]=o}return i}(t,r.runs,r.numRleValues);t=bp(t,r.runs,r.numRleValues)}!function(t){t[0]=_p(t[0]);const e=t.length/4*4;let r=1;if(e>=4)for(;r<e-4;r+=4){const e=t[r+1],i=t[r+2],n=t[r+3];t[r]=_p(t[r])+t[r-1],t[r+1]=_p(e)+t[r],t[r+2]=_p(i)+t[r+1],t[r+3]=_p(n)+t[r+2]}for(;r!=t.length;++r)t[r]=_p(t[r])+t[r-1]}(t);break;case ip.RLE:t=function(t,e,r){return r?function(t,e,r){if(void 0===r){r=0;for(let i=0;i<e;i++)r+=t[i]}const i=new Int32Array(r);let n=0;for(let r=0;r<e;r++){const o=t[r];let a=t[r+e];a=_p(a),i.fill(a,n,n+o),n+=o}return i}(t,e.runs,e.numRleValues):bp(t,e.runs,e.numRleValues)}(t,e,r);break;case ip.MORTON:Tp(t);break;case ip.COMPONENTWISE_DELTA:!function(t){if(t.length<2)return;t[0]=_p(t[0]),t[1]=_p(t[1]);const e=t.length/4*4;let r=2;if(e>=4)for(;r<e-4;r+=4){const e=t[r+1],i=t[r+2],n=t[r+3];t[r]=_p(t[r])+t[r-2],t[r+1]=_p(e)+t[r-1],t[r+2]=_p(i)+t[r],t[r+3]=_p(n)+t[r+1]}for(;r!=t.length;r+=2)t[r]=_p(t[r])+t[r-2],t[r+1]=_p(t[r+1])+t[r-1]}(t);break;case ip.NONE:r&&function(t){for(let e=0;e<t.length;e++)t[e]=_p(t[e])}(t);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Ap(t,n,0):t}(Cp(t,e,r),r,i,0,o)}function Ip(t,e,r){return function(t,e){if(e.logicalLevelTechnique1===ip.DELTA&&e.logicalLevelTechnique2===ip.NONE)return function(t){const e=new Int32Array(t.length+1);e[0]=0,e[1]=_p(t[0]);let r=e[1];for(let i=2;i!=e.length;++i)r+=_p(t[i-1]),e[i]=e[i-1]+r;return new Uint32Array(e)}(t);if(e.logicalLevelTechnique1===ip.RLE&&e.logicalLevelTechnique2===ip.NONE)return function(t,e,r){const i=new Int32Array(r+1);i[0]=0;let n=1,o=i[0];for(let r=0;r<e;r++){const a=t[r],s=t[r+e];for(let t=n;t<n+a;t++)i[t]=s+o,o=i[t];n+=a}return new Uint32Array(i)}(t,e.runs,e.numRleValues);if(e.logicalLevelTechnique1===ip.NONE&&e.logicalLevelTechnique2===ip.NONE){!function(t){let e=0;for(let r=0;r<t.length;r++)t[r]+=e,e=t[r]}(t);const r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===ip.DELTA&&e.logicalLevelTechnique2===ip.RLE){const r=function(t,e,r){const i=new Int32Array(r+1);i[0]=0;let n=1,o=i[0];for(let r=0;r<e;r++){const a=t[r];let s=t[r+e];s=_p(s);for(let t=n;t<n+a;t++)i[t]=s+o,o=i[t];n+=a}return new Uint32Array(i)}(t,e.runs,e.numRleValues);return Tp(r),r}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Cp(t,e,r),r)}function Cp(t,e,r){const i=r.physicalLevelTechnique;if(i===np.FAST_PFOR)return function(){throw new Error("FastPFor is not implemented yet.")}();if(i===np.VARINT)return dp(t,e,r.numValues);if(i===np.NONE){const i=e.get();e.add(r.byteLength);const n=t.subarray(i,e.get());return new Int32Array(n)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function Dp(t,e,r,i){const n=Cp(t,e,r);if(1===n.length){const t=n[0];return i?_p(t):t}return i?function(t){return _p(t[1])}(n):function(t){return t[1]}(n)}function zp(t,e,r){return function(t){if(2==t.length){const e=_p(t[1]);return[e,e]}return[_p(t[2]),_p(t[3])]}(Cp(t,e,r))}function kp(t,e,r){return function(t){if(2==t.length){const e=yp(t[1]);return[e,e]}return[yp(t[2]),yp(t[3])]}(fp(t,e,r.numValues))}function Rp(t,e,r,i,n){return function(t,e,r,i){switch(e.logicalLevelTechnique1){case ip.DELTA:if(e.logicalLevelTechnique2===ip.RLE){const r=e;if(!i)return function(t,e,r){const i=new BigInt64Array(r);let n=0,o=0n;for(let r=0;r<e;r++){const a=Number(t[r]),s=yp(t[r+e]);for(let t=0;t<a;t++)o+=s,i[n++]=o}return i}(t,r.runs,r.numRleValues);t=xp(t,r.runs,r.numRleValues)}!function(t){t[0]=yp(t[0]);const e=t.length/4*4;let r=1;if(e>=4)for(;r<e-4;r+=4){const e=t[r+1],i=t[r+2],n=t[r+3];t[r]=yp(t[r])+t[r-1],t[r+1]=yp(e)+t[r],t[r+2]=yp(i)+t[r+1],t[r+3]=yp(n)+t[r+2]}for(;r!=t.length;++r)t[r]=yp(t[r])+t[r-1]}(t);break;case ip.RLE:t=function(t,e,r){return r?function(t,e,r){if(void 0===r){r=0;for(let i=0;i<e;i++)r+=Number(t[i])}const i=new BigInt64Array(r);let n=0;for(let r=0;r<e;r++){const o=Number(t[r]);let a=t[r+e];a=yp(a),i.fill(a,n,n+o),n+=o}return i}(t,e.runs,e.numRleValues):xp(t,e.runs,e.numRleValues)}(t,e,r);break;case ip.NONE:r&&function(t){for(let e=0;e<t.length;e++)t[e]=yp(t[e])}(t);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ap(t,i,0n):t}(fp(t,e,r.numValues),r,i,n)}function Lp(t,e,r,i){const n=fp(t,e,r.numValues);if(1===n.length){const t=n[0];return i?yp(t):t}return i?function(t){return yp(t[1])}(n):function(t){return t[1]}(n)}function Fp(t,e,r,i){const n=t.logicalLevelTechnique1;if(n===ip.RLE)return 1===t.runs?cp.CONST:cp.FLAT;if(n!==ip.DELTA||t.logicalLevelTechnique2!==ip.RLE)return 1===t.numValues?cp.CONST:cp.FLAT;const o=e instanceof Mp?e.size():e;if(t.numRleValues!==o)return cp.FLAT;if(1===t.runs)return cp.SEQUENCE;if(2!==t.runs)return 1===t.numValues?cp.CONST:cp.FLAT;const a=i.get();let s;if(t.physicalLevelTechnique===np.VARINT)s=dp(r,i,4);else{const t=i.get();s=new Int32Array(r.buffer,r.byteOffset+t,4)}return i.set(a),2===s[2]&&2===s[3]?cp.SEQUENCE:1===t.numValues?cp.CONST:cp.FLAT}class Bp extends Xh{getValueFromBuffer(t){return this.dataBuffer[t]}}class Op extends Jh{constructor(t,e,r,i){super(t,BigInt64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}class jp{_geometryOffsets;_partOffsets;_ringOffsets;constructor(t,e,r){this._geometryOffsets=t,this._partOffsets=e,this._ringOffsets=r}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function Np(t,e,r){return{x:Vp(t,e)-r,y:Vp(t>>1,e)-r}}function Vp(t,e){let r=0;for(let i=0;i<e;i++)r|=(t&1<<2*i)>>i;return r}!function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"}(up||(up={})),function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"}(hp||(hp={})),function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"}(pp||(pp={}));class Up{createPoint(t){return[[t]]}createMultiPoint(t){return t.map(t=>[t])}createLineString(t){return[t]}createMultiLineString(t){return t}createPolygon(t,e){return[t].concat(e)}createMultiPolygon(t){return t.flat()}}function $p(t){const e=new Array(t.numGeometries);let i=1,n=1,o=1,a=0;const s=new Up;let l=0,c=0;const u=t.mortonSettings,h=t.topologyVector,p=h.geometryOffsets,d=h.partOffsets,f=h.ringOffsets,m=t.vertexOffsets,g=t.containsPolygonGeometry(),_=t.vertexBuffer;for(let h=0;h<t.numGeometries;h++){const y=t.geometryType(h);if(y===up.POINT){if(m&&0!==m.length)if(t.vertexBufferType===pp.VEC_2){const t=2*m[c++],i=new r(_[t],_[t+1]);e[a++]=s.createPoint(i)}else{const t=Np(_[m[c++]],u.numBits,u.coordinateShift),i=new r(t.x,t.y);e[a++]=s.createPoint(i)}else{const t=new r(_[l++],_[l++]);e[a++]=s.createPoint(t)}p&&o++,d&&i++,f&&n++}else if(y===up.MULTIPOINT){const t=p[o]-p[o-1];o++;const i=new Array(t);if(m&&0!==m.length){for(let e=0;e<t;e++){const t=2*m[c++];i[e]=new r(_[t],_[t+1])}e[a++]=s.createMultiPoint(i)}else{for(let e=0;e<t;e++){const t=_[l++],n=_[l++];i[e]=new r(t,n)}e[a++]=s.createMultiPoint(i)}}else if(y===up.LINESTRING){let r,h=0;g?(h=f[n]-f[n-1],n++):h=d[i]-d[i-1],i++,m&&0!==m.length?(r=t.vertexBufferType===pp.VEC_2?Hp(_,m,c,h,!1):Xp(_,m,c,h,!1,u),c+=h):(r=Wp(_,l,h,!1),l+=2*h),e[a++]=s.createLineString(r),p&&o++}else if(y===up.POLYGON){const r=d[i]-d[i-1];i++;const h=new Array(r-1);let g=f[n]-f[n-1];if(n++,m&&0!==m.length){const r=t.vertexBufferType===pp.VEC_2?qp(_,m,c,g):Zp(_,m,c,g,0,u);c+=g;for(let e=0;e<h.length;e++)g=f[n]-f[n-1],n++,h[e]=t.vertexBufferType===pp.VEC_2?qp(_,m,c,g):Zp(_,m,c,g,0,u),c+=g;e[a++]=s.createPolygon(r,h)}else{const t=Gp(_,l,g);l+=2*g;for(let t=0;t<h.length;t++)g=f[n]-f[n-1],n++,h[t]=Gp(_,l,g),l+=2*g;e[a++]=s.createPolygon(t,h)}p&&o++}else if(y===up.MULTILINESTRING){const r=p[o]-p[o-1];o++;const h=new Array(r);if(m&&0!==m.length){for(let e=0;e<r;e++){let r=0;g?(r=f[n]-f[n-1],n++):r=d[i]-d[i-1],i++;const o=t.vertexBufferType===pp.VEC_2?Hp(_,m,c,r,!1):Xp(_,m,c,r,!1,u);h[e]=o,c+=r}e[a++]=s.createMultiLineString(h)}else{for(let t=0;t<r;t++){let e=0;g?(e=f[n]-f[n-1],n++):e=d[i]-d[i-1],i++,h[t]=Wp(_,l,e,!1),l+=2*e}e[a++]=s.createMultiLineString(h)}}else{if(y!==up.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const r=p[o]-p[o-1];o++;const h=new Array(r);let g=0;if(m&&0!==m.length){for(let e=0;e<r;e++){const r=d[i]-d[i-1];i++;const o=new Array(r-1);g=f[n]-f[n-1],n++;const a=t.vertexBufferType===pp.VEC_2?qp(_,m,c,g):Zp(_,m,c,g,0,u);c+=g;for(let e=0;e<o.length;e++)g=f[n]-f[n-1],n++,o[e]=t.vertexBufferType===pp.VEC_2?qp(_,m,c,g):Zp(_,m,c,g,0,u),c+=g;h[e]=s.createPolygon(a,o)}e[a++]=s.createMultiPolygon(h)}else{for(let t=0;t<r;t++){const e=d[i]-d[i-1];i++;const r=new Array(e-1);g=f[n]-f[n-1],n++;const o=Gp(_,l,g);l+=2*g;for(let t=0;t<r.length;t++){const e=f[n]-f[n-1];n++,r[t]=Gp(_,l,e),l+=2*e}h[t]=s.createPolygon(o,r)}e[a++]=s.createMultiPolygon(h)}}}}return e}function Gp(t,e,r){return Wp(t,e,r,!0)}function qp(t,e,r,i){return Hp(t,e,r,i,!0)}function Zp(t,e,r,i,n,o){return Xp(t,e,r,i,!0,o)}function Wp(t,e,i,n){const o=new Array(n?i+1:i);for(let n=0;n<2*i;n+=2)o[n/2]=new r(t[e+n],t[e+n+1]);return n&&(o[o.length-1]=o[0]),o}function Hp(t,e,i,n,o){const a=new Array(o?n+1:n);for(let o=0;o<2*n;o+=2){const n=2*e[i+o/2];a[o/2]=new r(t[n],t[n+1])}return o&&(a[a.length-1]=a[0]),a}function Xp(t,e,i,n,o,a){const s=new Array(o?n+1:n);for(let o=0;o<n;o++){const n=Np(t[e[i+o]],a.numBits,a.coordinateShift);s[o]=new r(n.x,n.y)}return o&&(s[s.length-1]=s[0]),s}class Yp{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(t,e,r,i,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const t=$p(this);let e=0;for(;e<this.numGeometries;)yield{coordinates:t[e],type:this.geometryType(e)},e++}getSimpleEncodedVertex(t){const e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){const e=Np(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[e.x,e.y]}const e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return $p(this)}get mortonSettings(){return this._mortonSettings}}class Kp extends Yp{_numGeometries;_geometryType;constructor(t,e,r,i,n,o,a){super(r,i,n,o,a),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===up.POLYGON||this._geometryType===up.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class Jp extends Yp{_geometryTypes;constructor(t,e,r,i,n,o){super(t,r,i,n,o),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===up.POLYGON||this.geometryType(t)===up.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Qp{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(t,e,r,i){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const t=new Array(this.numGeometries),e=this._topologyVector,i=e.partOffsets,n=e.ringOffsets,o=e.geometryOffsets;let a=0,s=1,l=1,c=1;for(let e=0;e<this.numGeometries;e++)switch(this.geometryType(e)){case up.POLYGON:{const u=i[s]-i[s-1];s++;const h=[];for(let t=0;t<u;t++){const t=n[l]-n[l-1];l++;const e=[];for(let i=0;i<t;i++){const t=this._vertexBuffer[a++],i=this._vertexBuffer[a++];e.push(new r(t,i))}e.length>0&&e.push(e[0]),h.push(e)}t[e]=h,o&&c++}break;case up.MULTIPOLYGON:{const u=o[c]-o[c-1];c++;const h=[];for(let t=0;t<u;t++){const t=i[s]-i[s-1];s++;for(let e=0;e<t;e++){const t=n[l]-n[l-1];l++;const e=[];for(let i=0;i<t;i++){const t=this._vertexBuffer[a++],i=this._vertexBuffer[a++];e.push(new r(t,i))}e.length>0&&e.push(e[0]),h.push(e)}}t[e]=h}}return t}[Symbol.iterator](){return null}}function td(t,e,r,i,n,o){return new ed(t,e,r,i,n,o)}class ed extends Qp{_numGeometries;_geometryType;constructor(t,e,r,i,n,o){super(r,i,n,o),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function rd(t,e,r,i,n){return new id(t,e,r,i,n)}class id extends Qp{_geometryTypes;constructor(t,e,r,i,n){super(e,r,i,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function nd(t,e,r,i,n){const o=Pp(t,r);let a=null,s=null,l=null,c=null;if(Fp(o,i,t,r)===cp.CONST){const n=Dp(t,r,o,!1);let u=null,h=null,p=null,d=null;for(let i=0;i<e-1;i++){const e=Pp(t,r);switch(e.physicalStreamType){case op.LENGTH:switch(e.logicalStreamType.lengthType){case lp.GEOMETRIES:u=Ip(t,r,e);break;case lp.PARTS:h=Ip(t,r,e);break;case lp.RINGS:p=Ip(t,r,e);break;case lp.TRIANGLES:d=Ip(t,r,e)}break;case op.OFFSET:switch(e.logicalStreamType.offsetType){case sp.VERTEX:a=Ep(t,r,e,!1);break;case sp.INDEX:c=Ep(t,r,e,!1)}break;case op.DATA:ap.VERTEX===e.logicalStreamType.dictionaryType?s=Ep(t,r,e,!0):(l={numBits:e.numBits,coordinateShift:e.coordinateShift},s=Ep(t,r,e,!1))}}return null!==c?null!=u||null!=h?td(i,n,d,c,s,new jp(u,h,p)):td(i,n,d,c,s):null===l?function(t,e,r,i,n){return new Kp(t,e,pp.VEC_2,r,i,n)}(i,n,new jp(u,h,p),a,s):function(t,e,r,i,n,o){return new Kp(t,e,pp.MORTON,r,i,n,o)}(i,n,new jp(u,h,p),a,s,l)}const u=Ep(t,r,o,!1);let h=null,p=null,d=null,f=null;for(let i=0;i<e-1;i++){const e=Pp(t,r);switch(e.physicalStreamType){case op.LENGTH:switch(e.logicalStreamType.lengthType){case lp.GEOMETRIES:h=Ep(t,r,e,!1);break;case lp.PARTS:p=Ep(t,r,e,!1);break;case lp.RINGS:d=Ep(t,r,e,!1);break;case lp.TRIANGLES:f=Ip(t,r,e)}break;case op.OFFSET:switch(e.logicalStreamType.offsetType){case sp.VERTEX:a=Ep(t,r,e,!1);break;case sp.INDEX:c=Ep(t,r,e,!1)}break;case op.DATA:ap.VERTEX===e.logicalStreamType.dictionaryType?s=Ep(t,r,e,!0):(l={numBits:e.numBits,coordinateShift:e.coordinateShift},s=Ep(t,r,e,!1))}}let m=null,g=null,_=null;return null!==h?(m=od(u,h,2),null!==p&&null!==d?(g=ad(u,m,p,!1),_=function(t,e,r,i){const n=new Uint32Array(r[r.length-1]+1);let o=0;n[0]=o;let a=1,s=1,l=0;for(let c=0;c<t.length;c++){const u=t[c],h=e[c+1]-e[c];if(0!==u&&3!==u)for(let t=0;t<h;t++){const t=r[a]-r[a-1];a++;for(let e=0;e<t;e++)o=n[s++]=o+i[l++]}else for(let t=0;t<h;t++)n[s++]=++o,a++}return n}(u,m,g,d)):null!==p&&(g=function(t,e,r){const i=new Uint32Array(e[e.length-1]+1);let n=0;i[0]=n;let o=1,a=0;for(let s=0;s<t.length;s++){const l=t[s],c=e[s+1]-e[s];if(4===l||1===l)for(let t=0;t<c;t++)n=i[o++]=n+r[a++];else for(let t=0;t<c;t++)i[o++]=++n}return i}(u,m,p))):null!==p&&null!==d?(g=od(u,p,1),_=ad(u,g,d,!0)):null!==p&&(g=od(u,p,0)),null!==c&&null===g?rd(u,f,c,s):null!==c?rd(u,f,c,s,new jp(m,g,_)):null===l?function(t,e,r,i){return new Jp(pp.VEC_2,t,e,r,i)}(u,new jp(m,g,_),a,s):function(t,e,r,i,n){return new Jp(pp.MORTON,t,e,r,i,n)}(u,new jp(m,g,_),a,s,l)}function od(t,e,r){const i=new Uint32Array(t.length+1);let n=0;i[0]=n;let o=0;for(let a=0;a<t.length;a++)n=i[a+1]=n+(t[a]>r?e[o++]:1);return i}function ad(t,e,r,i){const n=new Uint32Array(e[e.length-1]+1);let o=0;n[0]=o;let a=1,s=0;for(let l=0;l<t.length;l++){const c=t[l],u=e[l+1]-e[l];if(5===c||2===c||i&&(4===c||1===c))for(let t=0;t<u;t++)o=n[a++]=o+r[s++];else for(let t=0;t<u;t++)n[a++]=++o}return n}class sd extends Hh{dataVector;constructor(t,e,r){super(t,e.getBuffer(),r),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}}class ld extends Xh{getValueFromBuffer(t){return this.dataBuffer[t]}}class cd extends Hh{constructor(t,e,r){super(t,BigInt64Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}function ud(t,e,r,i,n){const o=function(t,e,r,i){const n=new Uint8Array(e);let o=0;const a=i.get()+r;for(;o<e&&!(i.get()>=a);){const r=t[i.increment()];if(r<=127){const a=r+3,s=t[i.increment()],l=Math.min(o+a,e);n.fill(s,o,l),o=l}else{const a=256-r;for(let r=0;r<a&&o<e;r++)n[o++]=t[i.increment()]}}return i.set(a),n}(t,Math.ceil(e/8),r,i);return n?function(t,e,r){if(!r)return t;const i=r.size(),n=new Mp(t,e),o=new Mp(new Uint8Array(Math.ceil(i/8)),i);let a=0;for(let t=0;t<i;t++){const e=!!r.get(t)&&n.get(a++);o.set(t,e)}return o.getBuffer()}(o,e,n):o}const hd=new TextDecoder;function pd(t,e,r){return r-e>=12?hd.decode(t.subarray(e,r)):function(t,e,r){let i="",n=e;for(;n<r;){const e=t[n];let o,a,s,l=null,c=e>239?4:e>223?3:e>191?2:1;if(n+c>r)break;1===c?e<128&&(l=e):2===c?(o=t[n+1],128==(192&o)&&(l=(31&e)<<6|63&o,l<=127&&(l=null))):3===c?(o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(l=(15&e)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&e)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(t,e,r)}class dd extends Hh{offsetBuffer;constructor(t,e,r,i){super(t,r,i),this.offsetBuffer=e}}class fd extends dd{textEncoder;constructor(t,e,r,i){super(t,e,r,i??e.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(t){return pd(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class md extends dd{indexBuffer;textEncoder;constructor(t,e,r,i,n){super(t,r,i,n??e.length),this.indexBuffer=e,this.indexBuffer=e,this.textEncoder=new TextEncoder}getValueFromBuffer(t){const e=this.indexBuffer[t];return pd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class gd extends dd{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(t,e,r,i,n,o,a){super(t,r,i,a),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=o,this.textEncoder=new TextEncoder}getValueFromBuffer(t){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(t,e,r){const i=[],n=new Array(e.length).fill(0);for(let t=1;t<e.length;t++)n[t]=n[t-1]+e[t-1];for(let o=0;o<r.length;o++)if(255===r[o])i.push(r[++o]);else{const a=e[r[o]],s=n[r[o]];for(let e=0;e<a;e++)i.push(t[s+e])}return new Uint8Array(i)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const e=this.indexBuffer[t];return pd(this.decodedDictionary,this.offsetBuffer[e],this.offsetBuffer[e+1])}offsetToLengthBuffer(t){const e=new Uint32Array(t.length-1);let r=t[0];for(let i=1;i<t.length;i++){const n=t[i];e[i-1]=n-r,r=n}return e}}function _d(t,e,r,i,n,o){return"scalarType"===r.type?function(t,e,r,i,n,o){let a=null,s=0;if(0===t)return null;if(o.nullable){const t=Pp(e,r);s=t.numValues;const i=r.get(),n=ud(e,s,t.byteLength,r);r.set(i+t.byteLength),a=new Mp(n,t.numValues)}const l=a??i;switch(n.physicalType){case 4:case 3:return function(t,e,r,i,n){const o=Pp(t,e),a=Fp(o,n,t,e),s=3===i.physicalType;if(a===cp.FLAT){const i=Ep(t,e,o,s,0,yd(n)?n:void 0);return new Yh(r.name,i,n)}if(a===cp.SEQUENCE){const i=zp(t,e,o);return new Qh(r.name,i[0],i[1],o.numRleValues)}{const i=Dp(t,e,o,s);return new tp(r.name,i,n)}}(e,r,o,n,l);case 9:return function(t,e,r,i,n){let o=null,a=null,s=null,l=null,c=null,u=null,h=null,p=null;for(let t=0;t<i;t++){const t=Pp(e,r);if(0!==t.byteLength)switch(t.physicalStreamType){case op.PRESENT:{const i=ud(e,t.numValues,t.byteLength,r);u=new Mp(i,t.numValues);break}case op.OFFSET:a=Ep(e,r,t,!1,0,null!=n||null!=u?n??u:void 0);break;case op.LENGTH:{const i=Ip(e,r,t);lp.DICTIONARY===t.logicalStreamType.lengthType?o=i:lp.SYMBOL===t.logicalStreamType.lengthType?l=i:h=i;break}case op.DATA:{const i=e.subarray(r.get(),r.get()+t.byteLength);r.add(t.byteLength);const n=t.logicalStreamType.dictionaryType;ap.FSST===n?c=i:ap.SINGLE===n||ap.SHARED===n?s=i:ap.NONE===n&&(p=i);break}}}return function(t,e,r,i,n,o,a){return e?new gd(t,r,i,n,o,e,a):null}(t,c,a,o,s,l,n??u)??function(t,e,r,i,n){return e?n?new md(t,r,i,e,n):new md(t,r,i,e):null}(t,s,a,o,n??u)??function(t,e,r,i,n){if(!e||!r)return null;if(i)return n?new md(t,i,e,r,n):new md(t,i,e,r);if(n&&n.size()!==e.length-1){const i=new Int32Array(n.size());let o=0;for(let t=0;t<n.size();t++)i[t]=n.get(t)?o++:0;return new md(t,i,e,r,n)}return n?new fd(t,e,r,n):new fd(t,e,r)}(t,h,p,a,n??u)}(o.name,e,r,o.nullable?t-1:t,a);case 0:return function(t,e,r,i,n){const o=Pp(t,e),a=o.numValues,s=e.get(),l=yd(n)?n:void 0,c=ud(t,a,o.byteLength,e,l);e.set(s+o.byteLength);const u=new Mp(c,a);return new sd(r.name,u,n)}(e,r,o,0,l);case 6:case 5:return function(t,e,r,i,n){const o=Pp(t,e),a=Fp(o,i,t,e),s=5===n.physicalType;if(a===cp.FLAT){const n=Rp(t,e,o,s,yd(i)?i:void 0);return new Bp(r.name,n,i)}if(a===cp.SEQUENCE){const i=kp(t,e,o);return new Op(r.name,i[0],i[1],o.numRleValues)}{const n=Lp(t,e,o,s);return new cd(r.name,n,i)}}(e,r,o,l,n);case 7:return function(t,e,r,i){const n=Pp(t,e),o=yd(i)?i:void 0,a=function(t,e,r,i){const n=e.get(),o=n+r*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(t.subarray(n,o)).buffer,s=new Float32Array(a);return e.set(o),i?Ap(s,i,0):s}(t,e,n.numValues,o);return new ld(r.name,a,i)}(e,r,o,l);case 8:return function(t,e,r,i){const n=Pp(t,e),o=yd(i)?i:void 0,a=function(t,e,r,i){const n=e.get(),o=n+r*Float64Array.BYTES_PER_ELEMENT,a=new Uint8Array(t.subarray(n,o)).buffer,s=new Float64Array(a);return e.set(o),i?Ap(s,i,0):s}(t,e,n.numValues,o);return new Kh(r.name,a,i)}(e,r,o,l);default:throw new Error(`The specified data type for the field is currently not supported: ${n}`)}}(i,t,e,n,r.scalarType,r):0===i?null:function(t,e,r,i){let n=null,o=null,a=null,s=null,l=!1;for(;!l;){const r=Pp(t,e);switch(r.physicalStreamType){case op.LENGTH:lp.DICTIONARY===r.logicalStreamType.lengthType?n=Ip(t,e,r):a=Ip(t,e,r);break;case op.DATA:ap.SINGLE===r.logicalStreamType.dictionaryType||ap.SHARED===r.logicalStreamType.dictionaryType?(o=t.subarray(e.get(),e.get()+r.byteLength),l=!0):s=t.subarray(e.get(),e.get()+r.byteLength),e.add(r.byteLength)}}const c=r.complexType.children,u=[];let h=0;for(const l of c){const c=dp(t,e,1)[0];if(0==c)continue;const p=l.name?`${r.name}${l.name}`:r.name;if(2!==c||"scalarField"!==l.type||9!==l.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const d=Pp(t,e),f=ud(t,d.numValues,d.byteLength,e),m=Pp(t,e),g=Ep(t,e,m,!1,0,m.decompressedCount!==i?new Mp(f,d.numValues):void 0);u[h++]=s?new gd(p,g,n,o,a,s,new Mp(f,d.numValues)):new md(p,g,n,o,new Mp(f,d.numValues))}return u}(t,e,r,n)}function yd(t){return t instanceof Mp}function vd(t){switch(t){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&t),e.columnScope=0;const r={};return r.physicalType=t>1?6:4,r.type="physicalType",e.scalarType=r,e.type="scalarType",e}case 4:{const t={nullable:!1,columnScope:0},e={type:"physicalType",physicalType:0};return t.type="complexType",t.complexType=e,t}case 30:{const t={nullable:!1,columnScope:0},e={type:"physicalType",physicalType:1};return t.type="complexType",t.complexType=e,t}default:return function(t){let e=null;switch(t){case 10:case 11:e=0;break;case 12:case 13:e=1;break;case 14:case 15:e=2;break;case 16:case 17:e=3;break;case 18:case 19:e=4;break;case 20:case 21:e=5;break;case 22:case 23:e=6;break;case 24:case 25:e=7;break;case 26:case 27:e=8;break;case 28:case 29:e=9;break;default:return null}const r={};r.nullable=!!(1&t),r.columnScope=0;const i={type:"physicalType"};return i.physicalType=e,r.type="scalarType",r.scalarType=i,r}(t)}}function bd(t){return t>=10}function xd(t){return 30===t}function wd(t){if("id"===t.name)return!1;if("scalarType"===t.type){const e=t.scalarType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if("logicalType"===e.type)return!1}else if("complexType"===t.type){const e=t.complexType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}const Td=new TextDecoder;function Sd(t,e){const r=dp(t,e,1)[0];if(0===r)return"";const i=e.get(),n=t.subarray(i,i+r);return e.add(r),Td.decode(n)}function Pd(t,e){const r=dp(t,e,1)[0]>>>0;if(r<10||r>30)throw new Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT)`);const i=vd(r);if(bd(r)&&(i.name=Sd(t,e)),xd(r)){const r=dp(t,e,1)[0]>>>0;i.complexType.children=new Array(r);for(let n=0;n<r;n++)i.complexType.children[n]=Pd(t,e)}return function(t){return{name:t.name,nullable:t.nullable,scalarField:t.scalarType,complexField:t.complexType,type:"scalarType"===t.type?"scalarField":"complexField"}}(i)}function Md(t,e){const r=dp(t,e,1)[0]>>>0,i=vd(r);if(!i)throw new Error(`Unsupported column type code ${r}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(bd(r)?i.name=Sd(t,e):r>=0&&r<=3?i.name="id":4===r&&(i.name="geometry"),xd(r)){const r=dp(t,e,1)[0]>>>0,n=i.complexType;n.children=new Array(r);for(let i=0;i<r;i++)n.children[i]=Pd(t,e)}return i}function Ad(t,e){const r={featureTables:[]},i={};i.name=Sd(t,e);const n=dp(t,e,1)[0]>>>0,o=dp(t,e,1)[0]>>>0;i.columns=new Array(o);for(let r=0;r<o;r++)i.columns[r]=Md(t,e);return r.featureTables.push(i),[r,n]}function Ed(t,e,r,i,n,o,a=!1){const s=e.scalarType.physicalType,l=Fp(n,o,t,r);if(4===s)switch(l){case cp.FLAT:{const e=Ep(t,r,n,!1);return new Yh(i,e,o)}case cp.SEQUENCE:{const e=zp(t,r,n);return new Qh(i,e[0],e[1],n.numRleValues)}case cp.CONST:{const e=Dp(t,r,n,!1);return new tp(i,e,o)}}else switch(l){case cp.FLAT:{if(a){const e=function(t,e,r){const i=function(t,e,r){const i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=gp(t,e);return i}(t,e,r.numValues);return function(t,e){switch(e.logicalLevelTechnique1){case ip.DELTA:return e.logicalLevelTechnique2===ip.RLE&&(t=wp(t,e.runs,e.numRleValues)),function(t){t[0]=vp(t[0]);const e=t.length/4*4;let r=1;if(e>=4)for(;r<e-4;r+=4){const e=t[r+1],i=t[r+2],n=t[r+3];t[r]=vp(t[r])+t[r-1],t[r+1]=vp(e)+t[r],t[r+2]=vp(i)+t[r+1],t[r+3]=vp(n)+t[r+2]}for(;r!=t.length;++r)t[r]=vp(t[r])+t[r-1]}(t),t;case ip.RLE:return function(t,e){return wp(t,e.runs,e.numRleValues)}(t,e);case ip.NONE:return t;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}(i,r)}(t,r,n);return new Kh(i,e,o)}const e=Rp(t,r,n,!1);return new Bp(i,e,o)}case cp.SEQUENCE:{const e=kp(t,r,n);return new Op(i,e[0],e[1],n.numRleValues)}case cp.CONST:{const e=Lp(t,r,n,!1);return new cd(i,e,o)}}throw new Error("Vector type not supported for id column.")}class Id{constructor(t,e){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},null===(r=this._featureData.geometry)||void 0===r?void 0:r.type){case up.POINT:case up.MULTIPOINT:this.type=1;break;case up.LINESTRING:case up.MULTILINESTRING:this.type=2;break;case up.POLYGON:case up.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){const t=[];for(const e of this._featureData.geometry.coordinates){const i=[];for(const t of e)i.push(new r(t.x,t.y));t.push(i)}return t}}class Cd{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new Id(this.features[t],this.extent)}}class Dd{constructor(t){this.layers={};const e=function(t,e,r=!0){const i=new rp(0),n=[];for(;i.get()<t.length;){const e=dp(t,i,1)[0]>>>0,o=i.get()+e;if(o>t.length)throw new Error(`Block overruns tile: ${o} > ${t.length}`);if(1!=dp(t,i,1)[0]>>>0){i.set(o);continue}const a=Ad(t,i),s=a[1],l=a[0].featureTables[0];let c=null,u=null;const h=[];let p=0;for(const e of l.columns){const n=e.name;if("id"===n){let o=null;if(e.nullable){const e=Pp(t,i),r=i.get(),n=ud(t,e.numValues,e.byteLength,i);i.set(r+e.byteLength),o=new Mp(n,e.numValues)}const a=Pp(t,i);p=a.decompressedCount,c=Ed(t,e,i,n,a,o??p,r)}else if("geometry"===n){const e=dp(t,i,1)[0];if(0===p){const e=i.get();p=Pp(t,i).decompressedCount,i.set(e)}u=nd(t,e,i,p)}else{const r=wd(e)?dp(t,i,1)[0]:1;if(0===r)continue;const n=_d(t,i,e,r,p);if(n)if(Array.isArray(n))for(const t of n)h.push(t);else h.push(n)}}const d=new ep(l.name,u,c,h,s);n.push(d),i.set(o)}return n}(new Uint8Array(t));this.layers=e.reduce((t,e)=>Object.assign(Object.assign({},t),{[e.name]:new Cd(e)}),{})}}class zd{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=e,"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id))}loadGeometry(){const t=[],e=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of e){const e=[];for(const t of i)e.push(new r(t[0],t[1]));t.push(e)}return t}}const kd="_geojsonTileLayer";function Rd(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);const r={keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,Ld,r);const i=r.keys;for(const t of i)e.writeStringField(3,t);const n=r.values;for(const t of n)e.writeMessage(4,Nd,t)}function Ld(t,e){if(!t.feature)return;const r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,Fd,t),e.writeVarintField(3,r.type),e.writeMessage(4,jd,r)}function Fd(t,e){for(const r in t.feature?.properties){let i=t.feature.properties[r],n=t.keycache[r];if(null==i)continue;void 0===n&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),e.writeVarint(n),"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i&&(i=JSON.stringify(i));const o=typeof i+":"+i;let a=t.valuecache[o];void 0===a&&(t.values.push(i),a=t.values.length-1,t.valuecache[o]=a),e.writeVarint(a)}}function Bd(t,e){return(e<<3)+(7&t)}function Od(t){return t<<1^t>>31}function jd(t,e){const r=t.loadGeometry(),i=t.type;let n=0,o=0;for(const a of r){let r=1;1===i&&(r=a.length),e.writeVarint(Bd(1,r));const s=3===i?a.length-1:a.length;for(let t=0;t<s;t++){1===t&&1!==i&&e.writeVarint(Bd(2,s-1));const r=a[t].x-n,l=a[t].y-o;e.writeVarint(Od(r)),e.writeVarint(Od(l)),n+=r,o+=l}3===t.type&&e.writeVarint(Bd(7,1))}}function Nd(t,e){const r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}class Vd{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new co(I,16,0),this.grid3D=new co(I,16,0),this.featureIndexArray=new Na,this.promoteId=e}insert(t,e,r,i,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);const s=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],i=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];i[0]=Math.min(i[0],e.x),i[1]=Math.min(i[1],e.y),i[2]=Math.max(i[2],e.x),i[3]=Math.max(i[3],e.y)}i[0]<I&&i[1]<I&&i[2]>=0&&i[3]>=0&&s.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Fc(new Eu(this.rawTileData)).layers:new Dd(this.rawTileData).layers,this.sourceLayerCoder=new Zh(this.vtLayers?Object.keys(this.vtLayers).sort():[kd])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const o=t.params,a=I/t.tileSize/t.scale,s=pn(o.filter,o.globalState),l=t.queryGeometry,c=t.queryPadding*a,u=qh.fromPoints(l),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),p=qh.fromPoints(t.cameraQueryGeometry).expandBy(c),d=this.grid3D.query(p.minX,p.minY,p.maxX,p.maxY,(e,i,n,o)=>function(t,e,i,n,o){for(const r of t)if(e<=r.x&&i<=r.y&&n>=r.x&&o>=r.y)return!0;const a=[new r(e,i),new r(e,o),new r(n,o),new r(n,i)];if(t.length>2)for(const e of a)if(Qs(t,e))return!0;for(let e=0;e<t.length-1;e++)if(tl(t[e],t[e+1],a))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,n+c,o+c));for(const t of d)h.push(t);h.sort($d);const f={};let m;for(let r=0;r<h.length;r++){const c=h[r];if(c===m)continue;m=c;const u=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,o.layers,o.availableImages,e,i,n,(e,r,i)=>(p||(p=js(e)),r.queryIntersectsFeature({queryGeometry:l,feature:e,featureState:i,geometry:p,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,o,a,s,l,c,u){const h=this.bucketLayerIDs[e];if(o&&!h.some(t=>o.has(t)))return;const p=this.sourceLayerCoder.decode(r),d=this.vtLayers[p].feature(i);if(n.needGeometry){const t=Ns(d,!0);if(!n.filter(new ko(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new ko(this.tileID.overscaledZ),d))return;const f=this.getId(d,p);for(let e=0;e<h.length;e++){const r=h[e];if(o&&!o.has(r))continue;const n=s[r];if(!n)continue;let p={};f&&c&&(p=c.getState(n.sourceLayer||kd,f));const m=O({},l[r]);m.paint=Ud(m.paint,n.paint,d,p,a),m.layout=Ud(m.layout,n.layout,d,p,a);const g=!u||u(d,n,p);if(!g)continue;const _=new Wh(d,this.z,this.x,this.y,f);_.layer=m;let y=t[r];void 0===y&&(y=t[r]=[]),y.push({featureIndex:i,feature:_,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,i,n,o,a,s){const l={};this.loadVTLayers();const c=pn(n.filterSpec,n.globalState);for(const n of t)this.loadMatchingFeature(l,r,i,n,c,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){var r;let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i)),void 0===i&&(null===(r=t.properties)||void 0===r?void 0:r.cluster)&&this.promoteId&&(i=Number(t.properties.cluster_id))),i}}function Ud(t,e,r,i,n){return N(t,(t,o)=>{const a=e instanceof $o?e.get(o):null;return a&&a.evaluate?a.evaluate(r,i,n):a})}function $d(t,e){return e-t}function Gd(t,e,i,n,o){const a=[];for(let s=0;s<t.length;s++){const l=t[s];let c;for(let t=0;t<l.length-1;t++){let s=l[t],u=l[t+1];s.x<e&&u.x<e||(s.x<e?s=new r(e,s.y+(e-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<e&&(u=new r(e,s.y+(e-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<i&&u.y<i||(s.y<i?s=new r(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y<i&&(u=new r(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),s.x>=n&&u.x>=n||(s.x>=n?s=new r(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=n&&(u=new r(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=o&&u.y>=o||(s.y>=o?s=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round():u.y>=o&&(u=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(u)))))}}return a}function qd(t,e,r,i,n){switch(e){case 1:return function(t,e,r,i){const n=[];for(const o of t)for(const t of o){const o=0===i?t.x:t.y;o>=e&&o<=r&&n.push([t])}return n}(t,r,i,n);case 2:return Wd(t,r,i,n,!1);case 3:return Wd(t,r,i,n,!0)}return[]}function Zd(t,e,i,n,o){const a=0===n?Hd:Xd;let s=[];const l=[];for(let r=0;r<t.length-1;r++){const c=t[r],u=t[r+1],h=0===n?c.x:c.y,p=0===n?u.x:u.y;let d=!1;h<e?p>e&&s.push(a(c,u,e)):h>i?p<i&&s.push(a(c,u,i)):s.push(c),p<e&&h>=e&&(s.push(a(c,u,e)),d=!0),p>i&&h<=i&&(s.push(a(c,u,i)),d=!0),!o&&d&&(l.push(s),s=[])}const c=t.length-1,u=0===n?t[c].x:t[c].y;return u>=e&&u<=i&&s.push(t[c]),o&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new r(s[0].x,s[0].y)),s.length>0&&l.push(s),l}function Wd(t,e,r,i,n){const o=[];for(const a of t){const t=Zd(a,e,r,i,n);t.length>0&&o.push(...t)}return o}function Hd(t,e,i){return new r(i,t.y+(i-t.x)/(e.x-t.x)*(e.y-t.y))}function Xd(t,e,i){return new r(t.x+(i-t.y)/(e.y-t.y)*(e.x-t.x),i)}ho("FeatureIndex",Vd,{omit:["rawTileData","sourceLayerCoder"]});class Yd extends r{constructor(t,e,r,i){super(t,e),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new Yd(this.x,this.y,this.angle,this.segment)}}function Kd(t,e,r,i,n){if(void 0===e.segment||0===r)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;s<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let o=t[a-1].angleTo(e)-e.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>i;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=e.dist(r)}return!0}function Jd(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Qd(t,e,r){return t?.6*e*r:0}function tf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function ef(t,e,r,i,n,o){const a=Qd(r,n,o),s=tf(r,i)*o;let l=0;const c=Jd(t)/2;for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1],o=i.dist(n);if(l+o>c){const u=(c-l)/o,h=fr.number(i.x,n.x,u),p=fr.number(i.y,n.y,u),d=new Yd(h,p,n.angleTo(i),r);return d._round(),!a||Kd(t,d,s,a,e)?d:void 0}l+=o}}function rf(t,e,r,i,n,o,a,s,l){const c=Qd(i,o,a),u=tf(i,n),h=u*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),nf(t,p?e/2*s%e:(u/2+2*o)*a*s%e,e,c,r,h,p,!1,l)}function nf(t,e,r,i,n,o,a,s,l){const c=o/2,u=Jd(t);let h=0,p=e-r,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],s=t[e+1],f=a.dist(s),m=s.angleTo(a);for(;p+r<h+f;){p+=r;const g=(p-h)/f,_=fr.number(a.x,s.x,g),y=fr.number(a.y,s.y,g);if(_>=0&&_<l&&y>=0&&y<l&&p-c>=0&&p+c<=u){const r=new Yd(_,y,m,e);r._round(),i&&!Kd(t,r,o,i,n)||d.push(r)}}h+=f}return s||d.length||a||(d=nf(t,h/2,r,i,n,o,a,!0,l)),d}function of(t,e,i,n){const o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2;let u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const h=a.stretchX||[[0,l]],p=a.stretchY||[[0,c]],d=(t,e)=>t+e[1]-e[0],f=h.reduce(d,0),m=p.reduce(d,0),g=l-f,_=c-m;let y=0,v=f,b=0,x=m,w=0,T=g,S=0,P=_;if(a.content&&n){const e=a.content,r=e[2]-e[0],i=e[3]-e[1];(a.textFitWidth||a.textFitHeight)&&(u=rh(t)),y=af(h,0,e[0]),b=af(p,0,e[1]),v=af(h,e[0],e[2]),x=af(p,e[1],e[3]),w=e[0]-y,S=e[1]-b,T=r-v,P=i-x}const M=u.x1,A=u.y1,E=u.x2-M,I=u.y2-A,C=(t,n,o,l)=>{const c=lf(t.stretch-y,v,E,M),u=cf(t.fixed-w,T,t.stretch,f),h=lf(n.stretch-b,x,I,A),p=cf(n.fixed-S,P,n.stretch,m),d=lf(o.stretch-y,v,E,M),g=cf(o.fixed-w,T,o.stretch,f),_=lf(l.stretch-b,x,I,A),C=cf(l.fixed-S,P,l.stretch,m),D=new r(c,h),z=new r(d,h),k=new r(d,_),R=new r(c,_),L=new r(u/s,p/s),F=new r(g/s,C/s),B=e*Math.PI/180;if(B){const t=Math.sin(B),e=Math.cos(B),r=[e,-t,t,e];D._matMult(r),z._matMult(r),R._matMult(r),k._matMult(r)}const O=t.stretch+t.fixed,j=n.stretch+n.fixed;return{tl:D,tr:z,bl:R,br:k,tex:{x:a.paddedRect.x+1+O,y:a.paddedRect.y+1+j,w:o.stretch+o.fixed-O,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:F,minFontScaleX:T/s/E,minFontScaleY:P/s/I,isSDF:i}};if(n&&(a.stretchX||a.stretchY)){const t=sf(h,g,f),e=sf(p,_,m);for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1];for(let t=0;t<e.length-1;t++)o.push(C(i,e[t],n,e[t+1]))}}else o.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function af(t,e,r){let i=0;for(const n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function sf(t,e,r){const i=[{fixed:-1,stretch:0}];for(const[e,r]of t){const t=i[i.length-1];i.push({fixed:e-t.stretch,stretch:t.stretch}),i.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return i.push({fixed:e+1,stretch:r}),i}function lf(t,e,r,i){return t/e*r+i}function cf(t,e,r,i){return t-e*r/i}ho("Anchor",Yd);class uf{constructor(t,e,i,n,o,a,s,l,c,u){var h;if(this.boxStartIndex=t.length,c){let t=a.top,e=a.bottom;const r=a.collisionPadding;r&&(t-=r[1],e+=r[3]);let i=e-t;i>0&&(i=Math.max(10,i),this.circleDiameter=i)}else{const c=(null===(h=a.image)||void 0===h?void 0:h.content)&&(a.image.textFitWidth||a.image.textFitHeight)?rh(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-l[0],c.y2=c.y2*s+l[2],c.x1=c.x1*s-l[3],c.x2=c.x2*s+l[1];const p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),u){const t=new r(c.x1,c.y1),e=new r(c.x2,c.y1),i=new r(c.x1,c.y2),n=new r(c.x2,c.y2),o=u*Math.PI/180;t._rotate(o),e._rotate(o),i._rotate(o),n._rotate(o),c.x1=Math.min(t.x,e.x,i.x,n.x),c.x2=Math.max(t.x,e.x,i.x,n.x),c.y1=Math.min(t.y,e.y,i.y,n.y),c.y2=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,i,n,o)}this.boxEndIndex=t.length}}class hf{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let i=1+(t<<1);const o=i+1;if(o<this.length&&r(e[o],e[i])<0&&(i=o),r(e[i],n)>=0)break;e[t]=e[i],t=i}e[t]=n}}function pf(t,e=1,i=!1){const n=qh.fromPoints(t[0]),o=Math.min(n.width(),n.height());let a=o/2;const s=new hf([],df),{minX:l,minY:c,maxX:u,maxY:h}=n;if(0===o)return new r(l,c);for(let e=l;e<u;e+=o)for(let r=c;r<h;r+=o)s.push(new ff(e+a,r+a,a,t));let p=function(t){let e=0,r=0,i=0;const n=t[0];for(let t=0,o=n.length,a=o-1;t<o;a=t++){const o=n[t],s=n[a],l=o.x*s.y-s.x*o.y;r+=(o.x+s.x)*l,i+=(o.y+s.y)*l,e+=3*l}return new ff(r/e,i/e,0,t)}(t),d=s.length;for(;s.length;){const r=s.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(a=r.h/2,s.push(new ff(r.p.x-a,r.p.y-a,a,t)),s.push(new ff(r.p.x+a,r.p.y-a,a,t)),s.push(new ff(r.p.x-a,r.p.y+a,a,t)),s.push(new ff(r.p.x+a,r.p.y+a,a,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function df(t,e){return e.max-t.max}function ff(t,e,i,n){this.p=new r(t,e),this.h=i,this.d=function(t,e){let r=!1,i=1/0;for(let n=0;n<e.length;n++){const o=e[n];for(let e=0,n=o.length,a=n-1;e<n;a=e++){const n=o[e],s=o[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(r=!r),i=Math.min(i,Ks(t,n,s))}}return(r?1:-1)*Math.sqrt(i)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var mf;t.aP=void 0,(mf=t.aP||(t.aP={}))[mf.center=1]="center",mf[mf.left=2]="left",mf[mf.right=3]="right",mf[mf.top=4]="top",mf[mf.bottom=5]="bottom",mf[mf["top-left"]=6]="top-left",mf[mf["top-right"]=7]="top-right",mf[mf["bottom-left"]=8]="bottom-left",mf[mf["bottom-right"]=9]="bottom-right";const gf=Number.POSITIVE_INFINITY;function _f(t,e){return e[1]!==gf?function(t,e,r){let i=0,n=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(t){case"top-right":case"bottom-right":case"right":i=-e;break;case"top-left":case"bottom-left":case"left":i=e}return[i,n]}(t,e[0],e[1]):function(t,e){let r=0,i=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-e;break;case"top":i=e-7}switch(t){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=e;break;case"right":r=-e}return[r,i]}(t,e[0])}function yf(t,e,r){var i;const n=t.layout,o=null===(i=n.get("text-variable-anchor-offset"))||void 0===i?void 0:i.evaluate(e,{},r);if(o){const t=o.values,e=[];for(let r=0;r<t.length;r+=2){const i=e[r]=t[r],n=t[r+1].map(t=>t*mu);i.startsWith("top")?n[1]-=7:i.startsWith("bottom")&&(n[1]+=7),e[r+1]=n}return new Be(e)}const a=n.get("text-variable-anchor");if(a){let i;i=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},r)*mu,gf]:n.get("text-offset").evaluate(e,{},r).map(t=>t*mu);const o=[];for(const t of a)o.push(t,_f(t,i));return new Be(o)}return null}function vf(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function bf(e,r,i,n,o,a,s,l,c,u,h,p){let d=a.textMaxSize.evaluate(r,{});void 0===d&&(d=s);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(r,{},h),g=wf(i.horizontal),_=s/24,y=e.tilePixelRatio*_,v=e.tilePixelRatio*d/24,b=e.tilePixelRatio*l,x=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,T=function(t,e,r,i=1){const n=t.get("icon-padding").evaluate(e,{},r),o=n&&n.values;return[o[0]*i,o[1]*i,o[2]*i,o[3]*i]}(f,r,h,e.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,P="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),M="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),A=f.get("symbol-placement"),E=x/2,C=f.get("icon-text-fit");let D;n&&"none"!==C&&(e.allowVerticalPlacement&&i.vertical&&(D=ih(n,i.vertical,C,f.get("icon-text-fit-padding"),m,_)),g&&(n=ih(n,g,C,f.get("icon-text-fit-padding"),m,_)));const z=h?p.line.getGranularityForZoomLevel(h.z):1,k=(l,p)=>{p.x<0||p.x>=I||p.y<0||p.y>=I||function(e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y,v,b,x,w,T,S,P){const M=e.addToLineVertexArray(r,i);let A,E,I,C,D=0,z=0,k=0,R=0,L=-1,F=-1;const B={};let O=ms("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(x,{},S)+90;I=new uf(c,r,u,h,p,n.vertical,d,f,m,t),s&&(C=new uf(c,r,u,h,p,s,_,y,m,t))}if(o){const i=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),a=of(o,i,T,n),d=s?of(s,i,T,n):void 0;E=new uf(c,r,u,h,p,o,_,y,!1,i),D=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[nh*l.layout.get("icon-size").evaluate(x,{})],m[0]>oh&&G(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[nh*w.compositeIconSizes[0].evaluate(x,{},S),nh*w.compositeIconSizes[1].evaluate(x,{},S)],(m[0]>oh||m[1]>oh)&&G(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,b,v,x,t.az.none,r,M.lineStartIndex,M.lineLength,-1,S),L=e.icon.placedSymbolArray.length-1,d&&(z=4*d.length,e.addSymbols(e.icon,d,m,b,v,x,t.az.vertical,r,M.lineStartIndex,M.lineLength,-1,S),F=e.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const i of j){const o=n.horizontal[i];if(!A){O=ms(o.text);const t=l.layout.get("text-rotate").evaluate(x,{},S);A=new uf(c,r,u,h,p,o,d,f,m,t)}const s=1===o.positionedLines.length;if(k+=xf(e,r,o,a,l,m,x,g,M,n.vertical?t.az.horizontal:t.az.horizontalOnly,s?j:[i],B,L,w,S),s)break}n.vertical&&(R+=xf(e,r,n.vertical,a,l,m,x,g,M,t.az.vertical,["vertical"],B,F,w,S));const N=A?A.boxStartIndex:e.collisionBoxArray.length,V=A?A.boxEndIndex:e.collisionBoxArray.length,U=I?I.boxStartIndex:e.collisionBoxArray.length,$=I?I.boxEndIndex:e.collisionBoxArray.length,q=E?E.boxStartIndex:e.collisionBoxArray.length,Z=E?E.boxEndIndex:e.collisionBoxArray.length,W=C?C.boxStartIndex:e.collisionBoxArray.length,H=C?C.boxEndIndex:e.collisionBoxArray.length;let X=-1;const Y=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=Y(A,X),X=Y(I,X),X=Y(E,X),X=Y(C,X);const K=X>-1?1:0;K&&(X*=P/mu),e.glyphOffsetArray.length>=fh.MAX_GLYPHS&&G("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey);const J=yf(l,x,S),[Q,tt]=function(e,r){const i=e.length,n=null==r?void 0:r.values;if((null==n?void 0:n.length)>0)for(let r=0;r<n.length;r+=2){const i=n[r+1];e.emplaceBack(t.aP[n[r]],i[0],i[1])}return[i,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(r.x,r.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,L,F,O,N,V,U,$,q,Z,W,H,u,k,R,D,z,K,0,d,X,Q,tt)}(e,p,l,i,n,o,D,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,y,[w,w,w,w],P,c,b,T,M,m,r,a,u,h,s)};if("line"===A)for(const t of Gd(r.geometry,0,0,I,I)){const r=yc(t,z),o=rf(r,x,S,i.vertical||g,n,24,v,e.overscaling,I);for(const t of o)g&&Tf(e,g.text,E,t)||k(r,t)}else if("line-center"===A){for(const t of r.geometry)if(t.length>1){const e=yc(t,z),r=ef(e,S,i.vertical||g,n,24,v);r&&k(e,r)}}else if("Polygon"===r.type)for(const t of Qr(r.geometry,0)){const e=pf(t,16);k(yc(t[0],z,!0),new Yd(e.x,e.y,0))}else if("LineString"===r.type)for(const t of r.geometry){const e=yc(t,z);k(e,new Yd(e[0].x,e[0].y,0))}else if("Point"===r.type)for(const t of r.geometry)for(const e of t)k([e],new Yd(e.x,e.y,0))}function xf(t,e,i,n,o,a,s,l,c,u,h,p,d,f,m){const g=function(t,e,i,n,o,a,s,l){const c=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const a=n.rect||{};let h=4,p=!0,d=1,f=0;const m=(o||l)&&n.vertical,g=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(f=t.lineOffset/2-(n.imageName?-(mu-n.metrics.width*n.scale)/2:(n.scale-1)*mu)),n.imageName){const t=s[n.imageName];p=t.sdf,d=t.pixelRatio,h=1/d}const _=o?[n.x+g,n.y]:[0,0];let y=o?[0,0]:[n.x+g+i[0],n.y+i[1]-f],v=[0,0];m&&(v=y,y=[0,0]);const b=n.metrics.isDoubleResolution?2:1,x=(n.metrics.left-h)*n.scale-g+y[0],w=(-n.metrics.top-h)*n.scale+y[1],T=x+a.w/b*n.scale/d,S=w+a.h/b*n.scale/d,P=new r(x,w),M=new r(T,w),A=new r(x,S),E=new r(T,S);if(m){const t=new r(-g,g- -17),e=-Math.PI/2,i=12-g,o=new r(22-i,-(n.imageName?i:0)),a=new r(...v);P._rotateAround(e,t)._add(o)._add(a),M._rotateAround(e,t)._add(o)._add(a),A._rotateAround(e,t)._add(o)._add(a),E._rotateAround(e,t)._add(o)._add(a)}if(c){const t=Math.sin(c),e=Math.cos(c),r=[e,-t,t,e];P._matMult(r),M._matMult(r),A._matMult(r),E._matMult(r)}const I=new r(0,0),C=new r(0,0);u.push({tl:P,tr:M,bl:A,br:E,tex:a,writingMode:e.writingMode,glyphOffset:_,sectionIndex:n.sectionIndex,isSDF:p,pixelOffsetTL:I,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,l,o,a,s,n,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[nh*o.layout.get("text-size").evaluate(s,{})],y[0]>oh&&G(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[nh*f.compositeTextSizes[0].evaluate(s,{},m),nh*f.compositeTextSizes[1].evaluate(s,{},m)],(y[0]>oh||y[1]>oh)&&G(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,y,l,a,s,u,e,c.lineStartIndex,c.lineLength,d,m);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function wf(t){for(const e in t)return t[e];return null}function Tf(t,e,r,i){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(i.dist(t[e])<r)return!0}else n[e]=[];return n[e].push(i),!1}const Sf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Pf{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=r>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const n=Sf[15&r];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Pf(a,o,n,t)}constructor(t,e=64,r=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=Sf.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Mf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=a){for(let a=h;a<=u;a++){const s=o[2*a],c=o[2*a+1];s>=t&&s<=r&&c>=e&&c<=i&&l.push(n[a])}continue}const p=h+u>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=r&&f>=e&&f<=i&&l.push(n[p]),(0===c?t<=d:e<=f)&&(s.push(h),s.push(p-1),s.push(1-c)),(0===c?r>=d:i>=f)&&(s.push(p+1),s.push(u),s.push(1-c))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:n,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=r*r;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let r=h;r<=u;r++)Cf(n[2*r],n[2*r+1],t,e)<=l&&s.push(i[r]);continue}const p=h+u>>1,d=n[2*p],f=n[2*p+1];Cf(d,f,t,e)<=l&&s.push(i[p]),(0===c?t-r<=d:e-r<=f)&&(a.push(h),a.push(p-1),a.push(1-c)),(0===c?t+r>=d:e+r>=f)&&(a.push(p+1),a.push(u),a.push(1-c))}return s}}function Mf(t,e,r,i,n,o){if(n-i<=r)return;const a=i+n>>1;Af(t,e,a,i,n,o),Mf(t,e,r,i,a-1,1-o),Mf(t,e,r,a+1,n,1-o)}function Af(t,e,r,i,n,o){for(;n>i;){if(n-i>600){const a=n-i+1,s=r-i+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Af(t,e,r,Math.max(i,Math.floor(r-s*c/a+u)),Math.min(n,Math.floor(r+(a-s)*c/a+u)),o)}const a=e[2*r+o];let s=i,l=n;for(Ef(t,e,i,r),e[2*n+o]>a&&Ef(t,e,i,n);s<l;){for(Ef(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*i+o]===a?Ef(t,e,i,l):(l++,Ef(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function Ef(t,e,r,i){If(t,r,i),If(e,2*r,2*i),If(e,2*r+1,2*i+1)}function If(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function Cf(t,e,r,i){const n=t-r,o=e-i;return n*n+o*o}var Df;t.cI=void 0,(Df=t.cI||(t.cI={})).create="create",Df.load="load",Df.fullLoad="fullLoad";let zf=null,kf=[];const Rf=1e3/60,Lf="loadTime",Ff="fullLoadTime",Bf={mark(t){performance.mark(t)},recordStartOfFrameAt(t){null!=zf&&kf.push(t-zf),zf=t},resetRuntimeMetrics(){zf=null,kf=[]},clearInitializationMetrics(){performance.clearMeasures(Lf),performance.clearMeasures(Ff);for(const e in t.cI)performance.clearMarks(t.cI[e])},remove(){this.resetRuntimeMetrics(),this.clearInitializationMetrics()},getPerformanceMetrics(){performance.measure(Lf,t.cI.create,t.cI.load),performance.measure(Ff,t.cI.create,t.cI.fullLoad);const e=performance.getEntriesByName(Lf)[0].duration,r=performance.getEntriesByName(Ff)[0].duration,i=kf.length;return{loadTimeMs:e,fullLoadTimeMs:r,averageFramesPerSecond:1/(kf.reduce((t,e)=>t+e,0)/i/1e3),virtualDroppedFramesCount:kf.filter(t=>t>Rf).reduce((t,e)=>t+(e-Rf)/Rf,0),totalFramesCount:i}}};t.$=u,t.A=d,t.B=lo,t.C=io,t.D=Go,t.E=yt,t.F=function([t,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(r),y:t*Math.sin(e)*Math.sin(r),z:t*Math.cos(r)}},t.G=fr,t.H=ko,t.I=Gu,t.J=oo,t.K=function(t){if(null==W){const e=t.navigator?t.navigator.userAgent:null;W=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return W},t.L=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Sh(()=>this.process()),this.subscription=Q(this.target,"message",t=>this.receive(t),!1),this.globalScope=Z(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=e?Q(e.signal,"abort",()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const e={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)},Ph):null;this.resolveRejects[n]={resolve:t=>{null==o||o.unsubscribe(),r(t)},reject:t=>{null==o||o.unsubscribe(),i(t)}};const a=[],s=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:go(t.data,a)});this.target.postMessage(s,{transfer:a})})}receive(t){const e=t.data,r=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&"resource://android"!==e.origin&&"resource://android"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[r];const t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(Z(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,r){return e(this,void 0,void 0,function*(){if("<response>"===r.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(r.error?e.reject(_o(r.error)):e.resolve(_o(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=_o(r.data),i=new AbortController;this.abortControllers[t]=i;try{const n=yield this.messageHandlers[r.type](r.sourceMapId,e,i);this.completeTask(t,null,n)}catch(e){this.completeTask(t,e)}})}completeTask(t,e,r){const i=[];delete this.abortControllers[t];const n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?go(e):null,data:go(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.M=ct,t.N=function(){var t=new d(16);return d!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.O=function(t,e,r){var i,n,o,a,s,l,c,u,h,p,d,f,m=r[0],g=r[1],_=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*_+e[12],t[13]=e[1]*m+e[5]*g+e[9]*_+e[13],t[14]=e[2]*m+e[6]*g+e[10]*_+e[14],t[15]=e[3]*m+e[7]*g+e[11]*_+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=i=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=i*m+s*g+h*_+e[12],t[13]=n*m+l*g+p*_+e[13],t[14]=o*m+c*g+d*_+e[14],t[15]=a*m+u*g+f*_+e[15]),t},t.P=r,t.Q=function(t,e,r){var i=r[0],n=r[1],o=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.R=wl,t.S=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],v=r[0],b=r[1],x=r[2],w=r[3];return t[0]=v*i+b*s+x*h+w*m,t[1]=v*n+b*l+x*p+w*g,t[2]=v*o+b*c+x*d+w*_,t[3]=v*a+b*u+x*f+w*y,t[4]=(v=r[4])*i+(b=r[5])*s+(x=r[6])*h+(w=r[7])*m,t[5]=v*n+b*l+x*p+w*g,t[6]=v*o+b*c+x*d+w*_,t[7]=v*a+b*u+x*f+w*y,t[8]=(v=r[8])*i+(b=r[9])*s+(x=r[10])*h+(w=r[11])*m,t[9]=v*n+b*l+x*p+w*g,t[10]=v*o+b*c+x*d+w*_,t[11]=v*a+b*u+x*f+w*y,t[12]=(v=r[12])*i+(b=r[13])*s+(x=r[14])*h+(w=r[15])*m,t[13]=v*n+b*l+x*p+w*g,t[14]=v*o+b*c+x*d+w*_,t[15]=v*a+b*u+x*f+w*y,t},t.T=kl,t.U=function(t,e){const r={};for(let i=0;i<e.length;i++){const n=e[i];n in t&&(r[n]=t[n])}return r},t.V=Ah,t.W=B,t.X=Dh,t.Y=Ch,t.Z=at,t._=e,t.a=ot,t.a$=b,t.a0=h,t.a1=Y,t.a2=Nh,t.a3=kh,t.a4=Rh,t.a5=I,t.a6=function(t,e,r){if(!t)return e||{};if(!e)return t||{};const i=Gh(t),n=Gh(e);!function(t,e){e.removeAll&&(t.add.clear(),t.update.clear(),t.remove.clear(),e.remove.clear());for(const r of e.remove)t.add.delete(r),t.update.delete(r);for(const[r,i]of e.update){const n=t.update.get(r);n&&(e.update.set(r,$h(n,i)),t.update.delete(r))}}(i,n);const o={};if((i.removeAll||n.removeAll)&&(o.removeAll=!0),o.remove=new Set([...i.remove,...n.remove]),o.add=new Map([...i.add,...n.add]),o.update=new Map([...i.update,...n.update]),o.remove.size&&o.add.size)for(const t of o.add.keys())o.remove.delete(t);return function(t){const e={};return t.removeAll&&(e.removeAll=t.removeAll),t.remove&&(e.remove=Array.from(t.remove)),t.add&&(e.add=Array.from(t.add.values())),t.update&&(e.update=Array.from(t.update.values())),e}(o)},t.a7=function(t,e){const r=new Map;if(null==t)return r;if(null==t.type)return r;if("Feature"===t.type){const i=Uh(t,e);if(null==i)return;return r.set(i,t),r}if("FeatureCollection"===t.type){const i=new Set;for(const n of t.features){const t=Uh(n,e);if(null==t)return;if(i.has(t))return;i.add(t),r.set(t,n)}return r}},t.a8=function(t,e,r){var i,n;const o=[];if(e.removeAll)t.clear();else if(e.remove)for(const r of e.remove){const e=t.get(r);e&&(o.push(e.geometry),t.delete(r))}if(e.add)for(const i of e.add){const e=Uh(i,r);if(null==e)continue;const n=t.get(e);n&&o.push(n.geometry),o.push(i.geometry),t.set(e,i)}if(e.update)for(const r of e.update){const e=t.get(r.id);if(!e)continue;const a=!!r.newGeometry,s=r.removeAllProperties||(null===(i=r.removeProperties)||void 0===i?void 0:i.length)>0||(null===(n=r.addOrUpdateProperties)||void 0===n?void 0:n.length)>0;if(!a&&!s)continue;o.push(e.geometry);const l=Object.assign({},e);if(t.set(r.id,l),a&&(o.push(r.newGeometry),l.geometry=r.newGeometry),s){if(l.properties=r.removeAllProperties?{}:Object.assign({},l.properties||{}),r.removeProperties)for(const t of r.removeProperties)delete l.properties[t];if(r.addOrUpdateProperties)for(const{key:t,value:e}of r.addOrUpdateProperties)l.properties[t]=e}}return o},t.a9=Fh,t.aA=function(t,{uSize:e,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===t.kind?i/nh:"composite"===t.kind?fr.number(i/nh,n/nh,r):e},t.aB=function(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=r*s-i*a,v=r*l-n*a,b=r*c-o*a,x=i*l-n*s,w=i*c-o*s,T=n*c-o*l,S=u*m-h*f,P=u*g-p*f,M=u*_-d*f,A=h*g-p*m,E=h*_-d*m,I=p*_-d*g,C=y*I-v*E+b*A+x*M-w*P+T*S;return C?(t[0]=(s*I-l*E+c*A)*(C=1/C),t[1]=(n*E-i*I-o*A)*C,t[2]=(m*T-g*w+_*x)*C,t[3]=(p*w-h*T-d*x)*C,t[4]=(l*M-a*I-c*P)*C,t[5]=(r*I-n*M+o*P)*C,t[6]=(g*b-f*T-_*v)*C,t[7]=(u*T-p*b+d*v)*C,t[8]=(a*E-s*M+c*S)*C,t[9]=(i*M-r*E-o*S)*C,t[10]=(f*w-m*b+_*y)*C,t[11]=(h*b-u*w-d*y)*C,t[12]=(s*P-a*A-l*S)*C,t[13]=(r*A-i*P+n*S)*C,t[14]=(m*v-f*x-g*y)*C,t[15]=(u*x-h*v+p*y)*C,t):null},t.aC=A,t.aD=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},t.aE=function(t){return t[0]=0,t[1]=0,t},t.aF=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},t.aG=uh,t.aH=S,t.aI=function(t,e,i,n){const o=e.y-t.y,a=e.x-t.x,s=n.y-i.y,l=n.x-i.x,c=s*a-l*o;if(0===c)return null;const u=(l*(t.y-i.y)-s*(t.x-i.x))/c;return new r(t.x+u*a,t.y+u*o)},t.aJ=Gd,t.aK=Gs,t.aL=function(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return[e,r,i,n]},t.aM=mu,t.aN=C,t.aO=function(t,e,r,i,n=!1){if(!r[0]&&!r[1])return[0,0];const o=n?"map"===i?-t.bearingInRadians:0:"viewport"===i?t.bearingInRadians:0;if(o){const t=Math.sin(o),e=Math.cos(o);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}return[n?r[0]:C(e,r[0],t.zoom),n?r[1]:C(e,r[1],t.zoom)]},t.aQ=sh,t.aR=vf,t.aS=Hu,t.aT=Pf,t.aU=ia,t.aV=dc,t.aW=Va,t.aX=ns,t.aY=ts,t.aZ=et,t.a_=Lh,t.aa=qh,t.ab=25,t.ac=Oh,t.ad=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const r of t){const t=window.document.createElement("source");dt(r)||(e.crossOrigin="Anonymous"),t.src=r,e.appendChild(t)}})},t.ae=Dt,t.af=function(){return j++},t.ag=Ca,t.ah=fh,t.ai=kd,t.aj=pn,t.ak=Ns,t.al=Wh,t.am=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,r,i,n)=>{const o=i||n;return e[r]=!o||o.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.an=F,t.ao=85.051129,t.ap=tt,t.aq=function(t){return Math.pow(2,t)},t.ar=m,t.as=zh,t.at=function(t){return Math.log(t)/Math.LN2},t.au=function(t){var e=t[0],r=t[1];return e*e+r*r},t.av=function(t){if(!t.length)return new Set;const e=Math.max(...t.map(t=>t.canonical.z));let r=1/0,i=-1/0,n=1/0,o=-1/0;const a=[];for(const s of t){const{x:t,y:l,z:c}=s.canonical,u=Math.pow(2,e-c),h=t*u,p=l*u;a.push({id:s,x:h,y:p}),h<r&&(r=h),h>i&&(i=h),p<n&&(n=p),p>o&&(o=p)}const s=new Set;for(const t of a)t.x!==r&&t.x!==i&&t.y!==n&&t.y!==o||s.add(t.id);return s},t.aw=function(t,e){const r=Math.abs(2*t.wrap)-+(t.wrap<0),i=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||i-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x},t.ax=class{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){const i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);const n={value:e,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(t,n)},r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const r=t.wrapped().key,i=void 0===e?0:this.data[r].indexOf(e),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const r in this.data)for(const i of this.data[r])t(i.value)||e.push(i);for(const t of e)this.remove(t.value.tileID,t)}},t.ay=function(t,e){let r=0,i=0;if("constant"===t.kind)i=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=t,s=n?F(pr.interpolationFactor(n,e,o,a),0,1):0;"camera"===t.kind?i=fr.number(t.minSize,t.maxSize,s):r=s}return{uSizeT:r,uSize:i}},t.b=H,t.b$=Ts,t.b0=v,t.b1=function(t){var e=new d(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.b2=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},t.b3=function(t,e){var r=e[0],i=e[1],n=e[2],o=r*r+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.b4=x,t.b5=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.b6=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},t.b7=_,t.b8=function(t,e,r){const i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2];return 0===i?null:(-(t[0]*r[0]+t[1]*r[1]+t[2]*r[2])-r[3])/i},t.b9=T,t.bA=function(){return new Float64Array(3)},t.bB=M,t.bC=function(t,e,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=e[0],l=e[1],c=e[2],u=n*c-o*l,h=o*s-i*c,p=i*l-n*s;return t[0]=s+a*(u+=u)+n*(p+=p)-o*(h+=h),t[1]=l+a*h+o*u-i*p,t[2]=c+a*p+i*h-n*u,t},t.bD=function(t,e,r){const i=(n=[t[0],t[1],t[2],e[0],e[1],e[2],r[0],r[1],r[2]])[0]*((u=n[8])*(a=n[4])-(s=n[5])*(c=n[7]))+n[1]*(-u*(o=n[3])+s*(l=n[6]))+n[2]*(c*o-a*l);var n,o,a,s,l,c,u;if(0===i)return null;const h=x([],[e[0],e[1],e[2]],[r[0],r[1],r[2]]),p=x([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),d=x([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),f=b([],h,-t[3]);return v(f,f,b([],p,-e[3])),v(f,f,b([],d,-r[3])),b(f,f,1/i),f},t.bE=Mh,t.bF=function(){return new Float64Array(4)},t.bG=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bH=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bI=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bJ=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[8],u=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-c*i,t[1]=a*n-u*i,t[2]=s*n-h*i,t[3]=l*n-p*i,t[8]=o*i+c*n,t[9]=a*i+u*n,t[10]=s*i+h*n,t[11]=l*i+p*n,t},t.bK=function(t,e){const r=D(t,360),i=D(e,360),n=i-r,o=i>r?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},t.bL=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bM=function(t,e,r,i){const n=Math.sqrt(t*t+e*e),o=Math.sqrt(r*r+i*i);t/=n,e/=n,r/=o,i/=o;const a=Math.acos(t*r+e*i);return-e*r+t*i>0?a:-a},t.bN=function(t,e){const r=D(t,2*Math.PI),i=D(e,2*Math.PI);return Math.min(Math.abs(r-i),Math.abs(r-i+2*Math.PI),Math.abs(r-i-2*Math.PI))},t.bO=function(){const t={},e=vt.$version;for(const r in vt.$root){const i=vt.$root[r];if(i.required){let n=null;n="version"===r?e:"array"===i.type?[]:{},null!=n&&(t[r]=n)}}return t},t.bP=ht,t.bQ=yo,t.bR=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(!t(e[i],r[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const i in e)if(!t(e[i],r[i]))return!1;return!0}return e===r},t.bS=function(t){t=t.slice();const e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=xt(t[r],e[t[r].ref]));return t},t.bT=function(t,e){if("custom"===t.type)return new Th(t,e);switch(t.type){case"background":return new wh(t,e);case"circle":return new fl(t,e);case"color-relief":return new Fl(t,e);case"fill":return new Mc(t,e);case"fill-extrusion":return new Zc(t,e);case"heatmap":return new Ml(t,e);case"hillshade":return new Il(t,e);case"line":return new su(t,e);case"raster":return new Qo(t,e);case"symbol":return new vh(t,e)}},t.bU=t=>"raster"===t.type,t.bV=U,t.bW=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let r=[];try{if(!wt(t.version,e.version))return[{command:"setStyle",args:[e]}];wt(t.center,e.center)||r.push({command:"setCenter",args:[e.center]}),wt(t.state,e.state)||r.push({command:"setGlobalState",args:[e.state]}),wt(t.centerAltitude,e.centerAltitude)||r.push({command:"setCenterAltitude",args:[e.centerAltitude]}),wt(t.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),wt(t.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),wt(t.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),wt(t.roll,e.roll)||r.push({command:"setRoll",args:[e.roll]}),wt(t.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),wt(t.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),wt(t.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),wt(t.light,e.light)||r.push({command:"setLight",args:[e.light]}),wt(t.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),wt(t.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),wt(t.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const i={},n=[];!function(t,e,r,i){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||Pt(n,r,i));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?wt(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&At(t,e,n)?Tt(r,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):Mt(n,e,r,i)):St(n,e,r))}(t.sources,e.sources,n,i);const o=[];t.layers&&t.layers.forEach(t=>{"source"in t&&i[t.source]?r.push({command:"removeLayer",args:[t.id]}):o.push(t)}),r=r.concat(n),function(t,e,r){e=e||[];const i=(t=t||[]).map(It),n=e.map(It),o=t.reduce(Ct,{}),a=e.reduce(Ct,{}),s=i.slice(),l=Object.create(null);let c,u,h,p,d;for(let t=0,e=0;t<i.length;t++)c=i[t],Object.prototype.hasOwnProperty.call(a,c)?e++:(Tt(r,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,e),1));for(let t=0,e=0;t<n.length;t++)c=n[n.length-1-t],s[s.length-1-t]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(Tt(r,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-e),1)):e++,p=s[s.length-t],Tt(r,{command:"addLayer",args:[a[c],p]}),s.splice(s.length-t,0,c),l[c]=!0);for(let t=0;t<n.length;t++)if(c=n[t],u=o[c],h=a[c],!l[c]&&!wt(u,h))if(wt(u.source,h.source)&&wt(u["source-layer"],h["source-layer"])&&wt(u.type,h.type)){for(d in Et(u.layout,h.layout,r,c,null,"setLayoutProperty"),Et(u.paint,h.paint,r,c,null,"setPaintProperty"),wt(u.filter,h.filter)||Tt(r,{command:"setFilter",args:[c,h.filter]}),wt(u.minzoom,h.minzoom)&&wt(u.maxzoom,h.maxzoom)||Tt(r,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?Et(u[d],h[d],r,c,d.slice(6),"setPaintProperty"):wt(u[d],h[d])||Tt(r,{command:"setLayerProperty",args:[c,d,h[d]]}));for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&!Object.prototype.hasOwnProperty.call(u,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?Et(u[d],h[d],r,c,d.slice(6),"setPaintProperty"):wt(u[d],h[d])||Tt(r,{command:"setLayerProperty",args:[c,d,h[d]]}))}else Tt(r,{command:"removeLayer",args:[c]}),p=s[s.lastIndexOf(c)+1],Tt(r,{command:"addLayer",args:[h,p]})}(o,e.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:"setStyle",args:[e]}]}return r},t.bX=function(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},t.bY=N,t.bZ=V,t.b_=class extends bs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.ba=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},t.bb=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]},t.bc=jh,t.bd=Vh,t.be=function(t,e,r,i,n){var o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0){var a=1/(i-n);t[10]=(n+i)*a,t[14]=2*n*i*a}else t[10]=-1,t[14]=-2*i;return t},t.bf=function(t){var e=new d(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.bg=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],u=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+c*i,t[1]=a*n+u*i,t[2]=s*n+h*i,t[3]=l*n+p*i,t[4]=c*n-o*i,t[5]=u*n-a*i,t[6]=h*n-s*i,t[7]=p*n-l*i,t},t.bh=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+c*i,t[5]=a*n+u*i,t[6]=s*n+h*i,t[7]=l*n+p*i,t[8]=c*n-o*i,t[9]=u*n-a*i,t[10]=h*n-s*i,t[11]=p*n-l*i,t},t.bi=function(){const t=new Float32Array(16);return m(t),t},t.bj=function(){const t=new Float64Array(16);return m(t),t},t.bk=function(){return new Float64Array(16)},t.bl=function(t,e,r){const i=new Float64Array(4);return M(i,t,e-90,r),i},t.bm=function(t,e,r,i){var n,o,a,s,l,c=e[0],u=e[1],h=e[2],d=e[3],f=r[0],m=r[1],g=r[2],_=r[3];return(o=c*f+u*m+h*g+d*_)<0&&(o=-o,f=-f,m=-m,g=-g,_=-_),1-o>p?(n=Math.acos(o),a=Math.sin(n),s=Math.sin((1-i)*n)/a,l=Math.sin(i*n)/a):(s=1-i,l=i),t[0]=s*c+l*f,t[1]=s*u+l*m,t[2]=s*h+l*g,t[3]=s*d+l*_,t},t.bn=function(t){const e=new Float64Array(9);var r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y,v;h=(n=(i=t)[0])*(l=n+n),p=(o=i[1])*l,f=(a=i[2])*l,m=a*(c=o+o),_=(s=i[3])*l,y=s*c,v=s*(u=a+a),(r=e)[0]=1-(d=o*c)-(g=a*u),r[3]=p-v,r[6]=f+y,r[1]=p+v,r[4]=1-h-g,r[7]=m-_,r[2]=f-y,r[5]=m+_,r[8]=1-h-d;const b=et(-Math.asin(F(e[2],-1,1)));let x,w;return Math.hypot(e[5],e[8])<.001?(x=0,w=-et(Math.atan2(e[3],e[4]))):(x=et(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),w=et(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:x,pitch:b+90,bearing:w}},t.bo=function(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing},t.bp=Ae,t.bq=xs,t.br=fc,t.bs=mc,t.bt=pc,t.bu=z,t.bv=k,t.bw=je,t.bx=function(t,e,r,i,n){return z(i,n,F((t-e)/(r-e),0,1))},t.by=function(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t},t.bz=D,t.c=st,t.c$=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return 0===t.length&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},t.c0=class extends bs{constructor(t,e){super(t,e),this.current=Ss}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.c1=ws,t.c2=class extends bs{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.c3=class extends bs{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.c4=f,t.c5=function(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=-r,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.c6=function(t,e,r){var i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t},t.c7=function(t,e,r,i,n,o,a){var s=1/(e-r),l=1/(i-n),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(n+i)*l,t[14]=(a+o)*c,t[15]=1,t},t.c8=class extends bs{constructor(t,e){super(t,e),this.current=new Array}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(4*t.length);for(let r=0;r<t.length;r++)e[4*r]=t[r].r,e[4*r+1]=t[r].g,e[4*r+2]=t[r].b,e[4*r+3]=t[r].a;this.gl.uniform4fv(this.location,e)}}},t.c9=class extends bs{constructor(t,e){super(t,e),this.current=new Array}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(t);this.gl.uniform1fv(this.location,e)}}},t.cA=function(t,e){var r;if(!it[e])return!1;const i=null==t?void 0:t.target,n=(null===(r=null==i?void 0:i.ownerDocument)||void 0===r?void 0:r.defaultView)||window;return t instanceof n.MouseEvent||t instanceof n.WheelEvent},t.cB=function(t,e){return rt[e]&&"touches"in t},t.cC=function(t){return rt[t]||it[t]},t.cD=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t},t.cE=function(t,e){const{x:r,y:i}=Fh.fromLngLat(e);return!(t<0||t>25||i<0||i>=1||r<0||r>=1)},t.cF=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.cG=class extends aa{},t.cH=Bf,t.cJ=ut,t.cK=function(t,e){st.REGISTERED_PROTOCOLS[t]=e},t.cL=function(t){delete st.REGISTERED_PROTOCOLS[t]},t.cM=function(t,e){const r={};for(let i=0;i<t.length;i++){const n=e&&e[t[i].id]||xn(t[i]);e&&(e[t[i].id]=n);let o=r[n];o||(o=r[n]=[]),o.push(t[i])}const i=[];for(const t in r)i.push(r[t]);return i},t.cN=ho,t.cO=Zh,t.cP=Vd,t.cQ=qu,t.cR=function(e){var r;e.bucket.createArrays(),e.bucket.tilePixelRatio=I/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],n=i.layout,o=i._unevaluatedLayout._values,a={layoutIconSize:o["icon-size"].possiblyEvaluate(new ko(e.bucket.zoom+1),e.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new ko(e.bucket.zoom+1),e.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new ko(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.textSizeData;a.compositeTextSizes=[o["text-size"].possiblyEvaluate(new ko(t),e.canonical),o["text-size"].possiblyEvaluate(new ko(r),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;a.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new ko(t),e.canonical),o["icon-size"].possiblyEvaluate(new ko(r),e.canonical)]}const s=n.get("text-line-height")*mu,l="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),c=n.get("text-keep-upright"),u=n.get("text-size");for(const o of e.bucket.features){const h=n.get("text-font").evaluate(o,{},e.canonical).join(","),p=u.evaluate(o,{},e.canonical),d=a.layoutTextSize.evaluate(o,{},e.canonical),f=a.layoutIconSize.evaluate(o,{},e.canonical),m={horizontal:{},vertical:void 0},g=o.text;let _,y=[0,0];if(g){const r=g.toString(),a=n.get("text-letter-spacing").evaluate(o,{},e.canonical)*mu,u=To(r)?a:0,f=n.get("text-anchor").evaluate(o,{},e.canonical),_=yf(i,o,e.canonical);if(!_){const t=n.get("text-radial-offset").evaluate(o,{},e.canonical);y=t?_f(f,[t*mu,gf]):n.get("text-offset").evaluate(o,{},e.canonical).map(t=>t*mu)}let v=l?"center":n.get("text-justify").evaluate(o,{},e.canonical);const b="point"===n.get("symbol-placement")?n.get("text-max-width").evaluate(o,{},e.canonical)*mu:1/0,x=()=>{e.bucket.allowVerticalPlacement&&wo(r)&&(m.vertical=Wu(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,f,"left",u,y,t.az.vertical,!0,d,p))};if(!l&&_){const r=new Set;if("auto"===v)for(let t=0;t<_.values.length;t+=2)r.add(vf(_.values[t]));else r.add(v);let i=!1;for(const n of r)if(!m.horizontal[n])if(i)m.horizontal[n]=m.horizontal[0];else{const r=Wu(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,"center",n,u,y,t.az.horizontal,!1,d,p);r&&(m.horizontal[n]=r,i=1===r.positionedLines.length)}x()}else{"auto"===v&&(v=vf(f));const i=Wu(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,f,v,u,y,t.az.horizontal,!1,d,p);i&&(m.horizontal[v]=i),x(),wo(r)&&l&&c&&(m.vertical=Wu(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,f,v,u,y,t.az.vertical,!1,d,p))}}let v=!1;if(o.icon&&o.icon.name){const t=e.imageMap[o.icon.name];t&&(_=eh(e.imagePositions[o.icon.name],n.get("icon-offset").evaluate(o,{},e.canonical),n.get("icon-anchor").evaluate(o,{},e.canonical)),v=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&G("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const b=wf(m.horizontal)||m.vertical;(r=e.bucket).iconsInText||(r.iconsInText=!!b&&b.iconsInText),(b||_)&&bf(e.bucket,o,m,_,e.imageMap,a,d,f,y,v,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.cS=wc,t.cT=Nc,t.cU=eu,t.cV=function(t){const e=new Eu;return function(t,e){for(const r in t.layers)e.writeMessage(3,Rd,t.layers[r])}(t,e),e.finish()},t.cW=function(t,e,r,i,n,o){let a=qd(t,e,r,n,0);return a=qd(a,e,i,o,1),a},t.cX=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){const e=this.map.get(t);return void 0!==e&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}clear(){this.map.clear()}},t.cY=Fc,t.cZ=Eu,t.c_=Dd,t.ca=class extends ya{},t.cb=du,t.cc=class extends ba{},t.cd=Pl,t.ce=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.cf=Sl,t.cg=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return t[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/(a=a||1),t[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,t[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,t},t.ch=class extends sa{},t.ci=class extends Aa{},t.cj=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},t.ck=function(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=e[0],b=e[1],x=e[2],w=e[3],T=e[4],S=e[5],P=e[6],M=e[7],A=e[8],E=e[9],I=e[10],C=e[11],D=e[12],z=e[13],k=e[14],R=e[15];return Math.abs(r-v)<=p*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-b)<=p*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(n-x)<=p*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-w)<=p*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=p*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=p*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-P)<=p*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-M)<=p*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(u-A)<=p*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(h-E)<=p*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(d-I)<=p*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(f-C)<=p*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(m-D)<=p*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(g-z)<=p*Math.max(1,Math.abs(g),Math.abs(z))&&Math.abs(_-k)<=p*Math.max(1,Math.abs(_),Math.abs(k))&&Math.abs(y-R)<=p*Math.max(1,Math.abs(y),Math.abs(R))},t.cl=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.cm=t=>"symbol"===t.type,t.cn=t=>"circle"===t.type,t.co=t=>"heatmap"===t.type,t.cp=t=>"line"===t.type,t.cq=t=>"fill"===t.type,t.cr=t=>"fill-extrusion"===t.type,t.cs=t=>"hillshade"===t.type,t.ct=t=>"color-relief"===t.type,t.cu=t=>"background"===t.type,t.cv=t=>"custom"===t.type,t.cw=R,t.cx=function(t,e,r){if(e<=0)return t;const i=1/e;return void 0===r||Math.abs(r)<1e-10?Math.round(t*i)/i:(r>0?Math.ceil(t*i-1e-9):Math.floor(t*i+1e-10))/i},t.cy=function(t,e,r){const i=E(e.x-r.x,e.y-r.y),n=E(t.x-r.x,t.y-r.y);var o,a;return et(Math.atan2(i[0]*n[1]-i[1]*n[0],(o=i)[0]*(a=n)[0]+o[1]*a[1]))},t.cz=L,t.d=dt,t.d0=function(t,r,i,n,o){return e(this,void 0,void 0,function*(){if(h())try{return yield Y(t,r,i,n,o)}catch(t){}return function(t,e,r,i,n){const o=t.width,a=t.height;K&&J||(K=new OffscreenCanvas(o,a),J=K.getContext("2d",{willReadFrequently:!0})),K.width=o,K.height=a,J.drawImage(t,0,0,o,a);const s=J.getImageData(e,r,i,n);return J.clearRect(0,0,o,a),s.data}(t,r,i,n,o)})},t.d1=Rl,t.d2=i,t.d3=class{constructor(t,e){this.layers={[kd]:this},this.name=kd,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t}feature(t){return new zd(this.features[t],this.extent)}},t.d4=en,t.d5=zo,t.e=O,t.f=t=>e(void 0,void 0,void 0,function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),t.g=lt,t.h=t=>new Promise((e,r)=>{const i=new Image;i.onload=()=>{e(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=X})},i.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 n=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):X}),t.i=Z,t.j=(t,e)=>pt(O(t,{type:"json"}),e),t.k=_t,t.l=gt,t.m=pt,t.n=(t,e)=>pt(O(t,{type:"arrayBuffer"}),e),t.o=function(t){return new Eu(t).readFields(Nu,[])},t.p=$u,t.q=function(t){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))},t.r=xl,t.s=Q,t.t=Xo,t.u=vt,t.v=ro,t.w=G,t.x=Oo,t.y=no,t.z=Lo}),r("worker",0,function(t){class e{constructor(t,e){this.keyCache={},t&&this.replace(t,e)}replace(t,e){this._layerConfigs={},this._layers={},this.update(t,[],e)}update(e,r,i){for(const r of e){this._layerConfigs[r.id]=r;const e=this._layers[r.id]=t.bT(r,i);e._featureFilter=t.aj(e.filter,i),this.keyCache[r.id]&&delete this.keyCache[r.id]}for(const t of r)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const n=t.cM(Object.values(this._layerConfigs),this.keyCache);for(const e of n){const r=e.map(t=>this._layers[t.id]),i=r[0];if(i.isHidden())continue;const n=i.source||"";let o=this.familiesBySource[n];o||(o=this.familiesBySource[n]={});const a=i.sourceLayer||t.ai;let s=o[a];s||(s=o[a]=[]),s.push(r)}}}class r{constructor(e){const r={},i=[];for(const t in e){const n=e[t],o=r[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const r={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};i.push(r),o[t]={rect:r,metrics:e.metrics}}}const{w:n,h:o}=t.p(i),a=new t.r({width:n||1,height:o||1});for(const i in e){const n=e[i];for(const e in n){const o=n[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=r[i][e].rect;t.r.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=r}}t.cN("GlyphAtlas",r);class i{constructor(e){this.tileID=new t.a2(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}parse(e,i,o,a,s){return t._(this,void 0,void 0,function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.ag;const l=new t.cO(Object.keys(e.layers).sort()),c=new t.cP(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:o,subdivisionGranularity:s},p=i.familiesBySource[this.source];for(const r in p){const i=e.layers[r];if(!i)continue;1===i.version&&t.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(r),s=[];for(let t=0;t<i.length;t++){const e=i.feature(t),n=c.getId(e,r);s.push({feature:e,id:n,index:t,sourceLayerIndex:a})}for(const e of p[r]){const r=e[0];r.source!==this.source&&t.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.isHidden(this.zoom,!0)||(n(e,this.zoom,o),(u[r.id]=r.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,h,this.tileID.canonical),c.bucketLayerIDs.push(e.map(t=>t.id)))}}const d=t.bY(h.glyphDependencies,t=>Object.keys(t).map(Number));this.inFlightDependencies.forEach(t=>null==t?void 0:t.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(d).length){const t=new AbortController;this.inFlightDependencies.push(t),f=a.sendAsync({type:"GG",data:{stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const m=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(m.length){const t=new AbortController;this.inFlightDependencies.push(t),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},t)}const _=Object.keys(h.patternDependencies);let y=Promise.resolve({});if(_.length){const t=new AbortController;this.inFlightDependencies.push(t),y=a.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const v=h.dashDependencies;let b=Promise.resolve({});if(Object.keys(v).length){const t=new AbortController;this.inFlightDependencies.push(t),b=a.sendAsync({type:"GDA",data:{dashes:v}},t)}const[x,w,T,S]=yield Promise.all([f,g,y,b]),P=new r(x),M=new t.cQ(w,T);for(const e in u){const r=u[e];r instanceof t.ah?(n(r.layers,this.zoom,o),t.cR({bucket:r,glyphMap:x,glyphPositions:P.positions,imageMap:w,imagePositions:M.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):r.hasDependencies&&(r instanceof t.cS||r instanceof t.cT||r instanceof t.cU)&&(n(r.layers,this.zoom,o),r.addFeatures(h,this.tileID.canonical,M.patternPositions,S))}return this.status="done",{buckets:Object.values(u).filter(t=>!t.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:P.image,imageAtlas:M,dashPositions:S,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?P.positions:null}})}}function n(e,r,i){const n=new t.H(r);for(const t of e)t.recalculate(n,i)}class o{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){const e=this.loading[t];(null==e?void 0:e.abort)&&(e.abort.abort(),delete this.loading[t])}setParsing(t,e){this.parsing[t]=e}consumeParsing(t){const e=this.parsing[t];if(e)return delete this.parsing[t],e}clearParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){const e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}}class a{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(e=>e.map(e=>new t.P(e.x,e.y)))}}class s{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}}class l{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}}function c(e){let r=t.cV(e);return 0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),{vectorTile:e,rawData:r.buffer}}function u(e,r,i){const{extent:n}=e,o=Math.pow(2,i.z-r.z),l=(i.x-r.x*o)*n,c=(i.y-r.y*o)*n,u=[];for(let r=0;r<e.length;r++){const i=e.feature(r);let s=i.loadGeometry();for(const t of s)for(const e of t)e.x=e.x*o-l,e.y=e.y*o-c;const h=128;s=t.cW(s,i.type,-h,-h,n+h,n+h),0!==s.length&&u.push(new a(i.type,s,i.properties,i.id,n))}return new s(u,e.name,n)}class h{constructor(e,r,i){this.actor=e,this.layerIndex=r,this.availableImages=i,this.tileState=new o,this.overzoomedTileResultCache=new t.cX(1e3)}loadVectorTile(e,r){return t._(this,void 0,void 0,function*(){const i=yield t.n(e.request,r);try{return{vectorTile:"mlt"!==e.encoding?new t.cY(new t.cZ(i.data)):new t.c_(i.data),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires}}catch(t){const r=new Uint8Array(i.data);let n=`Unable to parse the tile at ${e.request.url}, `;throw n+=31===r[0]&&139===r[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(n)}})}loadTile(e){return t._(this,void 0,void 0,function*(){const{uid:t,overzoomParameters:r}=e;r&&(e.request=r.overzoomRequest);const n=this._startRequestTiming(e),o=new i(e);this.tileState.startLoading(t,o);const a=new AbortController;o.abort=a;try{const i=yield this.loadVectorTile(e,a);if(this.tileState.finishLoading(t),!i)return null;let{vectorTile:s,rawData:l}=i;r&&({vectorTile:s,rawData:l}=this._getOverzoomTile(e,i.vectorTile));const c=this._getExpiryData(i),u=this._finishRequestTiming(n);o.vectorTile=s,this.tileState.markLoaded(t,o);const h={rawData:l,cacheControl:c,resourceTiming:u};this.tileState.setParsing(t,h);try{return yield this._parseWorkerTile(o,e,h)}finally{this.tileState.clearParsing(t)}}catch(e){throw this.tileState.finishLoading(t),o.status="done",this.tileState.markLoaded(t,o),e}})}_parseWorkerTile(e,r,i){return t._(this,void 0,void 0,function*(){let n=yield e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.actor,r.subdivisionGranularity);if(i){const{rawData:e,cacheControl:o,resourceTiming:a}=i;n=t.e({rawTileData:e.slice(0),encoding:r.encoding},n,o,a)}return n})}_getExpiryData(t){const{expires:e,cacheControl:r}=t,i={};return e&&(i.expires=e),r&&(i.cacheControl=r),i}_startRequestTiming(e){var r;if(null===(r=e.request)||void 0===r?void 0:r.collectResourceTiming)return new t.c$(e.request.url)}_finishRequestTiming(t){const e=null==t?void 0:t.finish();return e?{resourceTiming:JSON.parse(JSON.stringify(e))}:{}}_getOverzoomTile(t,e){const{tileID:r,source:i,overzoomParameters:n}=t,{maxZoomTileID:o}=n,a=`${o.key}_${r.key}`,s=this.overzoomedTileResultCache.get(a);if(s)return s;const h=new l,p=this.layerIndex.familiesBySource[i];for(const t in p){const i=e.layers[t];if(!i)continue;const n=u(i,o,r.canonical);n.length>0&&h.addLayer(n)}const d=c(h);return this.overzoomedTileResultCache.set(a,d),d}reloadTile(e){return t._(this,void 0,void 0,function*(){const t=e.uid,r=this.tileState.getLoaded(t);if(!r)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const i=this.tileState.consumeParsing(t);return yield this._parseWorkerTile(r,e,i)}if("done"===r.status&&r.vectorTile)return yield this._parseWorkerTile(r,e)})}abortTile(e){return t._(this,void 0,void 0,function*(){this.tileState.abort(e.uid)})}removeTile(e){return t._(this,void 0,void 0,function*(){this.tileState.removeLoaded(e.uid)})}}class p{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,function*(){const{uid:r,encoding:i,rawImageData:n,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,c=n.width+2,u=n.height+2,h=t.b(n)?new t.R({width:c,height:u},yield t.d0(n,-1,-1,c,u)):n,p=new t.d1(r,h,i,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=p,p})}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}var d,f,m=function(){if(f)return d;function t(t,r){if(0!==t.length){e(t[0],r);for(var i=1;i<t.length;i++)e(t[i],!r)}}function e(t,e){for(var r=0,i=0,n=0,o=t.length,a=o-1;n<o;a=n++){var s=(t[n][0]-t[a][0])*(t[a][1]+t[n][1]),l=r+s;i+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+i>=0!=!!e&&t.reverse()}return f=1,d=function e(r,i){var n,o=r&&r.type;if("FeatureCollection"===o)for(n=0;n<r.features.length;n++)e(r.features[n],i);else if("GeometryCollection"===o)for(n=0;n<r.geometries.length;n++)e(r.geometries[n],i);else if("Feature"===o)e(r.geometry,i);else if("Polygon"===o)t(r.coordinates,i);else if("MultiPolygon"===o)for(n=0;n<r.coordinates.length;n++)t(r.coordinates[n],i);return r}}(),g=t.d2(m);const _={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},y=Math.fround||(v=new Float32Array(1),t=>(v[0]=+t,v[0]));var v;class b{constructor(t){this.options=Object.assign(Object.create(_),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const o=[];for(let e=0;e<t.length;e++){const r=t[e];if(!r.geometry)continue;const[i,n]=r.geometry.coordinates,a=y(T(i)),s=y(S(n));o.push(a,s,1/0,e,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[i+1]=this._createTree(o);e&&console.timeEnd(n);for(let t=i;t>=r;t--){const r=+Date.now();a=this.trees[t]=this._createTree(this._cluster(a,t)),e&&console.log("z%d: %d clusters in %dms",t,a.numItems,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){const t=this.getClusters([r,i,180,o],e),a=this.getClusters([-180,i,n,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(T(r),S(o),T(n),S(i)),l=a.data,c=[];for(const t of s){const e=this.stride*t;c.push(l[e+5]>1?x(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);const o=n.data;if(e*this.stride>=o.length)throw new Error(i);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=n.within(o[e*this.stride],o[e*this.stride+1],a),l=[];for(const e of s){const r=e*this.stride;o[r+4]===t&&l.push(o[r+5]>1?x(o,r,this.clusterProps):this.points[o[r+3]])}if(0===l.length)throw new Error(i);return l}getLeaves(t,e,r){const i=[];return this._appendLeaves(i,t,e=e||10,r=r||0,0),i}getTile(t,e,r){const i=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(r-s)/n,c=(r+1+s)/n,u={features:[]};return this._addTileFeatures(i.range((e-s)/n,l,(e+1+s)/n,c),i.data,e,r,n,u),0===e&&this._addTileFeatures(i.range(1-s/n,l,1,c),i.data,n,r,n,u),e===n-1&&this._addTileFeatures(i.range(0,l,s/n,c),i.data,-1,r,n,u),u.features.length?u:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,i,n){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this._appendLeaves(t,o.cluster_id,r,i,n):n<i?n++:t.push(e),t.length===r)break}return n}_createTree(e){const r=new t.aT(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)r.add(e[t],e[t+1]);return r.finish(),r.data=e,r}_addTileFeatures(t,e,r,i,n,o){for(const a of t){const t=a*this.stride,s=e[t+5]>1;let l,c,u;if(s)l=w(e,t,this.clusterProps),c=e[t],u=e[t+1];else{const r=this.points[e[t+3]];l=r.properties;const[i,n]=r.geometry.coordinates;c=T(i),u=S(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-r)),Math.round(this.options.extent*(u*n-i))]],tags:l};let p;p=s||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:i,reduce:n,minPoints:o}=this.options,a=r/(i*Math.pow(2,e)),s=t.data,l=[],c=this.stride;for(let r=0;r<s.length;r+=c){if(s[r+2]<=e)continue;s[r+2]=e;const i=s[r],u=s[r+1],h=t.within(s[r],s[r+1],a),p=s[r+5];let d=p;for(const t of h){const r=t*c;s[r+2]>e&&(d+=s[r+5])}if(d>p&&d>=o){let t,o=i*p,a=u*p,f=-1;const m=(r/c<<5)+(e+1)+this.points.length;for(const i of h){const l=i*c;if(s[l+2]<=e)continue;s[l+2]=e;const u=s[l+5];o+=s[l]*u,a+=s[l+1]*u,s[l+4]=m,n&&(t||(t=this._map(s,r,!0),f=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(s,l)))}s[r+4]=m,l.push(o/d,a/d,1/0,m,-1,d),n&&l.push(f)}else{for(let t=0;t<c;t++)l.push(s[r+t]);if(d>1)for(const t of h){const r=t*c;if(!(s[r+2]<=e)){s[r+2]=e;for(let t=0;t<c;t++)l.push(s[r+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const i=this.clusterProps[t[e+6]];return r?Object.assign({},i):i}const i=this.points[t[e+3]].properties,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}}function x(t,e,r){return{type:"Feature",id:t[e+3],properties:w(t,e,r),geometry:{type:"Point",coordinates:[(i=t[e],360*(i-.5)),P(t[e+1])]}};var i}function w(t,e,r){const i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,o=t[e+6],a=-1===o?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}function T(t){return t/360+.5}function S(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function P(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function M(t,e,r,i){let n=i;const o=e+(r-e>>1);let a,s=r-e;const l=t[e],c=t[e+1],u=t[r],h=t[r+1];for(let i=e+3;i<r;i+=3){const e=A(t[i],t[i+1],l,c,u,h);if(e>n)a=i,n=e;else if(e===n){const t=Math.abs(i-o);t<s&&(a=i,s=t)}}n>i&&(a-e>3&&M(t,e,a,i),t[a+2]=n,r-a>3&&M(t,a,r,i))}function A(t,e,r,i,n,o){let a=n-r,s=o-i;if(0!==a||0!==s){const l=((t-r)*a+(e-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return a=t-r,s=e-i,a*a+s*s}function E(t,e,r,i){const n={type:e,geom:r},o={id:null==t?null:t,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":case"LineString":I(o,n.geom);break;case"Polygon":I(o,n.geom[0]);break;case"MultiLineString":for(const t of n.geom)I(o,t);break;case"MultiPolygon":for(const t of n.geom)I(o,t[0])}return o}function I(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function C(t,e){const r=[];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)D(r,t.features[i],e,i);break;case"Feature":D(r,t,e);break;default:D(r,{geometry:t,properties:void 0},e)}return r}function D(t,e,r,i){if(!e.geometry)return;if("GeometryCollection"===e.geometry.type){for(const n of e.geometry.geometries)D(t,{id:e.id,geometry:n,properties:e.properties},r,i);return}const n=e.geometry.coordinates;if(!n?.length)return;const o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let a=e.id;switch(r.promoteId?a=e.properties?.[r.promoteId]:r.generateId&&(a=i||0),e.geometry.type){case"Point":{const r=[];return z(e.geometry.coordinates,r),void t.push(E(a,e.geometry.type,r,e.properties))}case"MultiPoint":{const r=[];for(const t of e.geometry.coordinates)z(t,r);return void t.push(E(a,e.geometry.type,r,e.properties))}case"LineString":{const r=[];return k(e.geometry.coordinates,r,o,!1),void t.push(E(a,e.geometry.type,r,e.properties))}case"MultiLineString":{if(r.lineMetrics){for(const r of e.geometry.coordinates){const i=[];k(r,i,o,!1),t.push(E(a,"LineString",i,e.properties))}return}const i=[];return R(e.geometry.coordinates,i,o,!1),void t.push(E(a,e.geometry.type,i,e.properties))}case"Polygon":{const r=[];return R(e.geometry.coordinates,r,o,!0),void t.push(E(a,e.geometry.type,r,e.properties))}case"MultiPolygon":{const r=[];for(const t of e.geometry.coordinates){const e=[];R(t,e,o,!0),r.push(e)}return void t.push(E(a,e.geometry.type,r,e.properties))}default:throw new Error("Input data is not a valid GeoJSON object.")}}function z(t,e){e.push(L(t[0]),F(t[1]),0)}function k(t,e,r,i){let n,o,a=0;for(let r=0;r<t.length;r++){const s=L(t[r][0]),l=F(t[r][1]);e.push(s,l,0),r>0&&(a+=i?(n*l-s*o)/2:Math.sqrt(Math.pow(s-n,2)+Math.pow(l-o,2))),n=s,o=l}const s=e.length-3;e[2]=1,r>0&&M(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function R(t,e,r,i){for(let n=0;n<t.length;n++){const o=[];k(t[n],o,r,i),e.push(o)}}function L(t){return t/360+.5}function F(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function B(t,e,r,i,n,o,a,s){if(i/=e,o>=(r/=e)&&a<i)return t;if(a<r||o>=i)return null;const l=[];for(const e of t){const t=0===n?e.minX:e.minY,o=0===n?e.maxX:e.maxY;if(t>=r&&o<i)l.push(e);else if(!(o<r||t>=i))switch(e.type){case"Point":case"MultiPoint":{const t=[];if(O(e.geometry,t,r,i,n),!t.length)continue;l.push(E(e.id,3===t.length?"Point":"MultiPoint",t,e.tags));continue}case"LineString":{const t=[];if(j(e.geometry,t,r,i,n,!1,s.lineMetrics),!t.length)continue;if(s.lineMetrics){for(const r of t)l.push(E(e.id,e.type,r,e.tags));continue}if(t.length>1){l.push(E(e.id,"MultiLineString",t,e.tags));continue}l.push(E(e.id,e.type,t[0],e.tags));continue}case"MultiLineString":{const t=[];if(V(e.geometry,t,r,i,n,!1),!t.length)continue;if(1===t.length){l.push(E(e.id,"LineString",t[0],e.tags));continue}l.push(E(e.id,e.type,t,e.tags));continue}case"Polygon":{const t=[];if(V(e.geometry,t,r,i,n,!0),!t.length)continue;l.push(E(e.id,e.type,t,e.tags));continue}case"MultiPolygon":{const t=[];for(const o of e.geometry){const e=[];V(o,e,r,i,n,!0),e.length&&t.push(e)}if(!t.length)continue;l.push(E(e.id,e.type,t,e.tags));continue}}}return l.length?l:null}function O(t,e,r,i,n){for(let o=0;o<t.length;o+=3){const a=t[o+n];a>=r&&a<=i&&U(e,t[o],t[o+1],t[o+2])}}function j(t,e,r,i,n,o,a){let s=N(t);const l=0===n?$:G;let c,u,h=t.start;for(let p=0;p<t.length-3;p+=3){const d=t[p],f=t[p+1],m=t[p+2],g=t[p+3],_=t[p+4],y=0===n?d:f,v=0===n?g:_;let b=!1;a&&(c=Math.sqrt(Math.pow(d-g,2)+Math.pow(f-_,2))),y<r?v>r&&(u=l(s,d,f,g,_,r),a&&(s.start=h+c*u)):y>i?v<i&&(u=l(s,d,f,g,_,i),a&&(s.start=h+c*u)):U(s,d,f,m),v<r&&y>=r&&(u=l(s,d,f,g,_,r),b=!0),v>i&&y<=i&&(u=l(s,d,f,g,_,i),b=!0),!o&&b&&(a&&(s.end=h+c*u),e.push(s),s=N(t)),a&&(h+=c)}let p=t.length-3;const d=t[p],f=t[p+1],m=0===n?d:f;m>=r&&m<=i&&U(s,d,f,t[p+2]),p=s.length-3,o&&p>=3&&(s[p]!==s[0]||s[p+1]!==s[1])&&U(s,s[0],s[1],s[2]),s.length&&e.push(s)}function N(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function V(t,e,r,i,n,o){for(const a of t)j(a,e,r,i,n,o,!1)}function U(t,e,r,i){t.push(e,r,i)}function $(t,e,r,i,n,o){const a=(o-e)/(i-e);return U(t,o,r+(n-r)*a,1),a}function G(t,e,r,i,n,o){const a=(o-r)/(n-r);return U(t,e+(i-e)*a,o,1),a}function q(t,e){const r=e.buffer/e.extent;let i=t;const n=B(t,1,-1-r,r,0,-1,2,e),o=B(t,1,1-r,2+r,0,-1,2,e);return n||o?(i=B(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=Z(n,1).concat(i)),o&&(i=i.concat(Z(o,-1))),i):i}function Z(t,e){const r=[];for(const i of t)switch(i.type){case"Point":case"MultiPoint":case"LineString":{const t=W(i.geometry,e);r.push(E(i.id,i.type,t,i.tags));continue}case"MultiLineString":case"Polygon":{const t=[];for(const r of i.geometry)t.push(W(r,e));r.push(E(i.id,i.type,t,i.tags));continue}case"MultiPolygon":{const t=[];for(const r of i.geometry){const i=[];for(const t of r)i.push(W(t,e));t.push(i)}r.push(E(i.id,i.type,t,i.tags));continue}}return r}function W(t,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function H(t,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,n=t.y;for(const o of t.features){if(1===o.type){const t=[];for(let a=0;a<o.geometry.length;a+=2)t.push(X(o.geometry[a],o.geometry[a+1],e,r,i,n));o.geometry=t;continue}const t=[];for(const a of o.geometry){const o=[];for(let t=0;t<a.length;t+=2)o.push(X(a[t],a[t+1],e,r,i,n));t.push(o)}o.geometry=t}return t.transformed=!0,t}function X(t,e,r,i,n,o){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-o))]}function Y(t,e,r,i,n){const o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:i,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)K(a,e,o,n);return a}function K(t,e,r,i){t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY);let n,o=e.tags||null;switch(e.type){case"Point":case"MultiPoint":{const r=[];for(let i=0;i<e.geometry.length;i+=3)r.push(e.geometry[i],e.geometry[i+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;n={type:1,tags:o,geometry:r};break}case"LineString":{const a=[];if(J(a,e.geometry,t,r,!1,!1),!a.length)return;if(i.lineMetrics){o={};for(const t in e.tags)o[t]=e.tags[t];o.mapbox_clip_start=e.geometry.start/e.geometry.size,o.mapbox_clip_end=e.geometry.end/e.geometry.size}n={type:2,tags:o,geometry:a};break}case"MultiLineString":case"Polygon":{const i=[];for(let n=0;n<e.geometry.length;n++)J(i,e.geometry[n],t,r,"Polygon"===e.type,0===n);if(!i.length)return;n={type:"Polygon"===e.type?3:2,tags:o,geometry:i};break}case"MultiPolygon":{const i=[];for(let n=0;n<e.geometry.length;n++){const o=e.geometry[n];for(let e=0;e<o.length;e++)J(i,o[e],t,r,!0,0===e)}if(!i.length)return;n={type:3,tags:o,geometry:i};break}}null!==e.id&&(n.id=e.id),t.features.push(n)}function J(t,e,r,i,n,o){const a=i*i;if(i>0&&e.size<(n?a:i))return void(r.numPoints+=e.length/3);const s=[];for(let t=0;t<e.length;t+=3)(0===i||e[t+2]>a)&&(r.numSimplified++,s.push(e[t],e[t+1])),r.numPoints++;n&&function(t,e){let r=0;for(let e=0,i=t.length,n=i-2;e<i;n=e,e+=2)r+=(t[e]-t[n])*(t[e+1]+t[n+1]);if(r>0===e)for(let e=0,r=t.length;e<r/2;e+=2){const i=t[e],n=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=i,t[r-1-e]=n}}(s,o),t.push(s)}function Q(t,e,r){const i=!!e.newGeometry,n=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(i){let i=C({type:"FeatureCollection",features:[{type:"Feature",id:t.id,geometry:e.newGeometry,properties:n?tt(t.tags,e):t.tags}]},r);return i=q(i,r),i[0]}if(n){const r={...t};return r.tags=tt(r.tags,e),r}return null}function tt(t,e){if(e.removeAllProperties)return{};const r={...t||{}};if(e.removeProperties)for(const t of e.removeProperties)delete r[t];if(e.addOrUpdateProperties)for(const{key:t,value:i}of e.addOrUpdateProperties)r[t]=i;return r}const et={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,debug:0};class rt{options;tiles;tileCoords;stats={};total=0;source;constructor(t,e){const r=(e=this.options=Object.assign({},et,e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=C(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=q(i,e),i.length&&this.splitTile(i,0,0,0),e.updateable&&(this.source=i),r&&(i.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(t,e,r,i,n,o,a){const s=[t,e,r,i],l=this.options,c=l.debug;for(;s.length;){i=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();const u=1<<e,h=it(e,r,i);let p=this.tiles[h];if(!p&&(c>1&&console.time("creation"),p=this.tiles[h]=Y(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:h}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==n){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(null!=n){const t=n-e;if(r!==o>>t||i!==a>>t)continue}}if(p.source=null,!t.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,f=.5-d,m=.5+d,g=1+d;let _=null,y=null,v=null,b=null;const x=B(t,u,r-d,r+m,0,p.minX,p.maxX,l),w=B(t,u,r+f,r+g,0,p.minX,p.maxX,l);x&&(_=B(x,u,i-d,i+m,1,p.minY,p.maxY,l),y=B(x,u,i+f,i+g,1,p.minY,p.maxY,l)),w&&(v=B(w,u,i-d,i+m,1,p.minY,p.maxY,l),b=B(w,u,i+f,i+g,1,p.minY,p.maxY,l)),c>1&&console.timeEnd("clipping"),s.push(_||[],e+1,2*r,2*i),s.push(y||[],e+1,2*r,2*i+1),s.push(v||[],e+1,2*r+1,2*i),s.push(b||[],e+1,2*r+1,2*i+1)}}getTile(t,e,r){t=+t,e=+e,r=+r;const i=this.options,{extent:n,debug:o}=i;if(t<0||t>24)return null;const a=1<<t,s=it(t,e=e+a&a-1,r);if(this.tiles[s])return H(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);let l,c=t,u=e,h=r;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[it(c,u,h)];return l?.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?H(this.tiles[s],n):null):null}invalidateTiles(t){const e=this.options,{debug:r}=e;let i=1/0,n=-1/0,o=1/0,a=-1/0;for(const e of t)i=Math.min(i,e.minX),n=Math.max(n,e.maxX),o=Math.min(o,e.minY),a=Math.max(a,e.maxY);const s=e.buffer/e.extent,l=new Set;for(const e in this.tiles){const c=this.tiles[e],u=1<<c.z,h=(c.x-s)/u,p=(c.x+1+s)/u,d=(c.y-s)/u,f=(c.y+1+s)/u;if(n<h||i>=p||a<d||o>=f)continue;let m=!1;for(const e of t)if(e.maxX>=h&&e.minX<p&&e.maxY>=d&&e.minY<f){m=!0;break}if(m){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c.z,c.x,c.y,c.numFeatures,c.numPoints,c.numSimplified);const t=`z${c.z}`;this.stats[t]=(this.stats[t]||0)-1,this.total--}delete this.tiles[e],l.add(e)}}l.size&&(this.tileCoords=this.tileCoords.filter(t=>!l.has(t.id)))}updateData(t){const e=this.options,r=e.debug;if(!e.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");const{affected:i,source:n}=function(t,e,r){const i=function(t){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map(t=>[t.id,t])),update:new Map(t.update?.map(t=>[t.id,t]))}:{remove:new Set,add:new Map,update:new Map}}(e);let n=[];if(i.removeAll&&(n=t,t=[]),i.remove.size||i.add.size){const e=[];for(const r of t){const{id:t}=r;(i.remove.has(t)||i.add.has(t))&&e.push(r)}if(e.length){n.push(...e);const r=new Set(e.map(t=>t.id));t=t.filter(t=>!r.has(t.id))}if(i.add.size){let e=C({type:"FeatureCollection",features:Array.from(i.add.values())},r);e=q(e,r),n.push(...e),t.push(...e)}}if(i.update.size)for(const[e,o]of i.update){const i=t.findIndex(t=>t.id===e);if(-1===i)continue;const a=t[i],s=Q(a,o,r);s&&(n.push(a,s),t[i]=s)}return{affected:n,source:t}}(this.source,t,e);if(!i.length)return;this.source=n,r>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),r>1&&console.timeEnd("invalidating");const[o,a,s]=[0,0,0],l=Y(this.source,o,a,s,this.options);l.source=this.source;const c=it(o,a,s);if(this.tiles[c]=l,this.tileCoords.push({z:o,x:a,y:s,id:c}),r){const t=`z${o}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}}}function it(t,e,r){return 32*((1<<t)*r+e)+t}class nt{constructor(t,e,r,i=ot){this._dataUpdateable=new Map,this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new o,this._createGeoJSONIndex=i}loadVectorTile(e){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:r,x:i,y:n}=e.tileID.canonical,o=this._geoJSONIndex.getTile(r,i,n);return o?c(new t.d3(o.features,{version:2,extent:t.a5})):null}loadTile(e){return t._(this,void 0,void 0,function*(){const{uid:t}=e,r=new i(e);r.abort=new AbortController;try{const i=this.loadVectorTile(e);if(!i)return null;const{vectorTile:n,rawData:o}=i;r.vectorTile=n,this.tileState.markLoaded(t,r);const a={rawData:o};this.tileState.setParsing(t,a);try{return yield this._parseWorkerTile(r,e,a)}finally{this.tileState.clearParsing(t)}}catch(e){throw r.status="done",this.tileState.markLoaded(t,r),e}})}_reloadLoadedTile(e){return t._(this,void 0,void 0,function*(){const t=e.uid,r=this.tileState.getLoaded(t);if(!r)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const i=this.tileState.consumeParsing(t);return yield this._parseWorkerTile(r,e,i)}if("done"===r.status&&r.vectorTile)return yield this._parseWorkerTile(r,e)})}_parseWorkerTile(e,r,i){return t._(this,void 0,void 0,function*(){let n=yield e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.actor,r.subdivisionGranularity);if(i){const{rawData:e}=i;n=t.e({rawTileData:e.slice(0)},n)}return n})}abortTile(e){return t._(this,void 0,void 0,function*(){this.tileState.abort(e.uid)})}removeTile(e){return t._(this,void 0,void 0,function*(){this.tileState.removeLoaded(e.uid)})}loadData(e){return t._(this,void 0,void 0,function*(){var r;null===(r=this._pendingRequest)||void 0===r||r.abort();const i=this._startRequestTiming(e);this._pendingRequest=new AbortController;try{(!this._pendingData||e.request||e.data||e.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(e,this._pendingRequest));const t=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(t,e),this.tileState.clearLoaded();const r={};return e.request&&(r.data=t),this._finishRequestTiming(i,e,r),r}catch(e){if(delete this._pendingRequest,t.Z(e))return{abandoned:!0};throw e}})}_startRequestTiming(e){var r;if(null===(r=e.request)||void 0===r?void 0:r.collectResourceTiming)return new t.c$(e.request.url)}_finishRequestTiming(t,e,r){const i=null==t?void 0:t.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}getData(){return t._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(t){return this.tileState.getLoaded(t.uid)?this._reloadLoadedTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,r){return t._(this,void 0,void 0,function*(){let t;if(e.request?t=yield this.loadGeoJSONFromUrl(e.request,e.promoteId,r):e.data?t=this._loadGeoJSONFromObject(e.data,e.promoteId):e.dataDiff&&(t=this._loadGeoJSONFromDiff(e.dataDiff,e.promoteId,e.source)),delete this._pendingRequest,"object"!=typeof t)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);return g(t,!0),e.filter&&(t=this._filterGeoJSON(t,e.filter)),t})}loadGeoJSONFromUrl(e,r,i){return t._(this,void 0,void 0,function*(){const n=yield t.j(e,i);return this._dataUpdateable=t.a7(n.data,r),n.data})}_loadGeoJSONFromObject(e,r){return this._dataUpdateable=t.a7(e,r),e}_loadGeoJSONFromDiff(e,r,i){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${i}`);t.a8(this._dataUpdateable,e,r);const n=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(n)}_filterGeoJSON(e,r){const i=t.d4(r,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));const n=e.features.filter(t=>i.value.evaluate({zoom:0},t));return this._toFeatureCollection(n)}_toFeatureCollection(t){return{type:"FeatureCollection",features:t}}removeSource(e){return t._(this,void 0,void 0,function*(){var t;null===(t=this._pendingRequest)||void 0===t||t.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}function ot(e,r){return r.cluster?new b(function({superclusterOptions:e,clusterProperties:r}){if(!r||!e)return e;const i={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(r);for(const e of s){const[o,a]=r[e],s=t.d4(a),l=t.d4("string"==typeof o?[o,["accumulated"],["get",e]]:o);i[e]=s.value,n[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=i[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=n[e].evaluate(o,a)},e}(r)).load(e.features):function(t,e){return new rt(t,e)}(e,r.geojsonVtOptions)}class at{constructor(e){this.self=e,this.actor=new t.L(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.cK,this.self.removeProtocol=t.cL,this.self.registerRTLTextPlugin=e=>{t.d5.setMethods(e)},this.actor.registerMessageHandler("LDT",(t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e)),this.actor.registerMessageHandler("RDT",(e,r)=>t._(this,void 0,void 0,function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(e,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(e,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(e,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e)),this.actor.registerMessageHandler("GD",(t,e)=>this._getWorkerSource(t,e.type,e.source).getData()),this.actor.registerMessageHandler("LT",(t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e)),this.actor.registerMessageHandler("RT",(t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e)),this.actor.registerMessageHandler("AT",(t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e)),this.actor.registerMessageHandler("RMT",(t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e)),this.actor.registerMessageHandler("RS",(e,r)=>t._(this,void 0,void 0,function*(){if(!this.workerSources[e]||!this.workerSources[e][r.type]||!this.workerSources[e][r.type][r.source])return;const t=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],void 0!==t.removeSource&&t.removeSource(r)})),this.actor.registerMessageHandler("RM",e=>t._(this,void 0,void 0,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)})),this.actor.registerMessageHandler("SR",(e,r)=>t._(this,void 0,void 0,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(t,e)=>this._syncRTLPluginState(t,e)),this.actor.registerMessageHandler("IS",(e,r)=>t._(this,void 0,void 0,function*(){this.self.importScripts(r)})),this.actor.registerMessageHandler("SI",(t,e)=>this._setImages(t,e)),this.actor.registerMessageHandler("UL",(e,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))})),this.actor.registerMessageHandler("UGS",(e,r)=>t._(this,void 0,void 0,function*(){const t=this._getGlobalState(e);for(const e in r)t[e]=r[e]})),this.actor.registerMessageHandler("SL",(e,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(e).replace(r,this._getGlobalState(e))}))}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}_setImages(e,r){return t._(this,void 0,void 0,function*(){this.availableImages[e]=r;for(const t in this.workerSources[e]){const i=this.workerSources[e][t];for(const t in i)i[t].availableImages=r}})}_syncRTLPluginState(e,r){return t._(this,void 0,void 0,function*(){return yield t.d5.syncState(r,this.self.importScripts)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new e),r}_getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const i={sendAsync:(e,r)=>(e.targetMapId=t,this.actor.sendAsync(e,r))};switch(e){case"vector":this.workerSources[t][e][r]=new h(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new nt(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](i,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new p),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new at(self)),at}),r("index",0,function(t,e){var r="5.19.0";function i(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let n,o,a;const s={frame(t,r,i,n){const o=n||window,a=o.requestAnimationFrame(t=>{s(),r(t)}),{unsubscribe:s}=e.s(t.signal,"abort",()=>{s(),o.cancelAnimationFrame(a),i(new e.a(t.signal.reason))},!1)},frameAsync(t,e){return new Promise((r,i)=>{this.frame(t,r,i,e)})},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>(n||(n=document.createElement("a")),n.href=t,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==a?a:!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)},set prefersReducedMotion(t){a=t}},l=new class{constructor(){this._realTime="undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:this._realTime()}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function c(){return l.getCurrentTime()}class u{static testProp(t){if(!u.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in u.docStyle)return t[e];return t[0]}static create(t,e,r){const i=window.document.createElement(t);return void 0!==e&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){u.docStyle&&u.selectProp&&(u.userSelect=u.docStyle[u.selectProp],u.docStyle[u.selectProp]="none")}static enableDrag(){u.docStyle&&u.selectProp&&(u.docStyle[u.selectProp]=u.userSelect)}static setTransform(t,e){t.style[u.transformProp]=e}static addEventListener(t,e,r,i={}){t.addEventListener(e,r,"passive"in i?i:i.capture)}static removeEventListener(t,e,r,i={}){t.removeEventListener(e,r,"passive"in i?i:i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",u.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",u.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",u.suppressClickInternal,!0)},0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,r,i){const n=r.boundingClientRect;return new e.P((i.clientX-n.left)/r.x-t.clientLeft,(i.clientY-n.top)/r.y-t.clientTop)}static mousePos(t,e){const r=u.getScale(t);return u.getPoint(t,r,e)}static touchPos(t,e){const r=[],i=u.getScale(t);for(let n=0;n<e.length;n++)r.push(u.getPoint(t,i,e[n]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const e=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),r=e.querySelectorAll("script");for(const t of r)t.remove();return u.clean(e),e.innerHTML}static isPossiblyDangerous(t,e){const r=e.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!r.includes("javascript:")&&!r.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const e=t.children;for(const t of e)u.removeAttributes(t),u.clean(t)}static removeAttributes(t){for(const{name:e,value:r}of t.attributes)u.isPossiblyDangerous(e,r)&&t.removeAttribute(e)}}u.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,u.selectProp=u.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),u.transformProp=u.testProp(["transform","WebkitTransform"]);const h={supported:!1,testSupport:function(t){!f&&d&&(m?g(t):p=t)}};let p,d,f=!1,m=!1;function g(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,d),t.isContextLost())return;h.supported=!0}catch(t){}t.deleteTexture(e),f=!0}var _;"undefined"!=typeof document&&(d=document.createElement("img"),d.onload=()=>{p&&g(p),p=null,m=!0},d.onerror=()=>{f=!0,p=null},d.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let r,i,n,o;t.resetRequestQueue=()=>{r=[],i=0,n=0,o={}},t.addThrottleControl=t=>{const e=n++;return o[e]=t,e},t.removeThrottleControl=t=>{delete o[t],s()},t.getImage=(t,i,n=!0)=>new Promise((o,a)=>{h.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),r.push({abortController:i,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{a(t)},onSuccess:t=>{o(t)}}),s()});const a=t=>e._(this,void 0,void 0,function*(){t.state="running";const{requestParameters:r,supportImageRefresh:n,onError:o,onSuccess:a,abortController:c}=t,u=!1===n&&!e.i(self)&&!e.g(r.url)&&(!r.headers||Object.keys(r.headers).reduce((t,e)=>t&&"accept"===e,!0));i++;const h=u?l(r,c):e.m(r,c);try{const r=yield h;delete t.abortController,t.state="completed",r.data instanceof HTMLImageElement||e.b(r.data)?a(r):r.data&&a({data:yield(p=r.data,"function"==typeof createImageBitmap?e.f(p):e.h(p)),cacheControl:r.cacheControl,expires:r.expires})}catch(e){delete t.abortController,o(e)}finally{i--,s()}var p}),s=()=>{const t=(()=>{for(const t of Object.keys(o))if(o[t]())return!0;return!1})()?e.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=i;e<t&&r.length>0;e++){const t=r.shift();t.abortController.signal.aborted?e--:a(t)}},l=(t,r)=>new Promise((i,n)=>{const o=new Image,a=t.url,s=t.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!e.d(a))&&(o.crossOrigin="anonymous"),r.signal.addEventListener("abort",()=>{o.src="",n(new e.a(r.signal.reason))}),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,i({data:o})},o.onerror=()=>{o.onerror=o.onload=null,r.signal.aborted||n(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."))},o.src=a})}(_||(_={})),_.resetRequestQueue();class y{constructor(t){this._transformRequestFn=null!=t?t:null}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function v(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const r=[];for(const{id:i,url:n}of t){const t=`${i}${n}`;-1===r.indexOf(t)&&(r.push(t),e.push({id:i,url:n}))}}return e}function b(t,e,r){try{const i=new URL(t);return i.pathname+=`${e}${r}`,i.toString()}catch(e){throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function x(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class w extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const r=this.images[t];if(r&&!r.data&&r.spriteData){const t=r.spriteData;r.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),r.spriteData=null}return r}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,r){let i=!0;const n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let r=0;for(const i of t){if(i[0]<r||i[1]<i[0]||e<i[1])return!1;r=i[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const r=e.spriteData,i=r&&r.width||e.data.width,n=r&&r.height||e.data.height;return!(t[0]<0||i<t[0]||t[1]<0||n<t[1]||t[2]<0||i<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,r=!0){const i=this.getImage(t);if(r&&(i.data.width!==e.data.width||i.data.height!==e.data.height))throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=i.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((e,r)=>{let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})})}_getImagesForIds(t){const r={};for(const i of t){let t=this.getImage(i);t||(this.fire(new e.l("styleimagemissing",{id:i})),t=this.getImage(i)),t?r[i]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return r}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const r=this.patterns[t],i=this.getImage(t);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{const r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},n=new e.I(r,i);this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const r=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new e.T(t,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:r,h:i}=e.p(t),n=this.atlasImage;n.resize({width:r||1,height:i||1});for(const t in this.patterns){const{bin:r}=this.patterns[t],i=r.x+1,o=r.y+1,a=this.getImage(t).data,s=a.width,l=a.height;e.R.copy(a,n,{x:0,y:0},{x:i,y:o},{width:s,height:l}),e.R.copy(a,n,{x:0,y:l-1},{x:i,y:o-1},{width:s,height:1}),e.R.copy(a,n,{x:0,y:0},{x:i,y:o+l},{width:s,height:1}),e.R.copy(a,n,{x:s-1,y:0},{x:i-1,y:o},{width:1,height:l}),e.R.copy(a,n,{x:0,y:0},{x:i+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const r of t){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;const t=this.getImage(r);t||e.w(`Image with ID: "${r}" was not found`),x(t)&&this.updateImage(r,t)}}cloneImages(){const t={};for(const e in this.images){const r=this.images[e];t[e]=Object.assign(Object.assign({},r),{data:r.data?r.data.clone():null})}return t}}const T=1e20;function S(t,e,r,i,n,o,a,s,l){for(let c=e;c<e+i;c++)P(t,r*o+c,o,n,a,s,l);for(let c=r;c<r+n;c++)P(t,c*o+e,1,i,a,s,l)}function P(t,e,r,i,n,o,a){o[0]=0,a[0]=-T,a[1]=T,n[0]=t[e];for(let s=1,l=0,c=0;s<i;s++){n[s]=t[e+s*r];const i=s*s;do{const t=o[l];c=(n[s]-n[t]+i-t*t)/(s-t)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=T}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;const i=o[l],c=s-i;t[e+s*r]=n[i]+c*c}}const M=e.v.layout_symbol["text-font"].default.join(",");class A{constructor(t,e,r){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={},this.lang=r}setURL(t){this.url=t}getGlyphs(t){return e._(this,void 0,void 0,function*(){const e=[];for(const r in t)for(const i of t[r])e.push(this._getAndCacheGlyphsPromise(r,i));const r=yield Promise.all(e),i={};for(const{stack:t,id:e,glyph:n}of r)i[t]||(i[t]={}),i[t][e]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return i})}_getAndCacheGlyphsPromise(t,r){return e._(this,void 0,void 0,function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let i=e.glyphs[r];return void 0!==i?{stack:t,id:r,glyph:i}:!this.url||this._charUsesLocalIdeographFontFamily(r)?(i=e.glyphs[r]=this._drawGlyph(e,t,r),{stack:t,id:r,glyph:i}):yield this._downloadAndCacheRangePromise(t,r)})}_downloadAndCacheRangePromise(t,r){return e._(this,void 0,void 0,function*(){const e=this.entries[t],i=Math.floor(r/256);if(e.ranges[i])return{stack:t,id:r,glyph:null};if(!e.requests[i]){const r=A.loadGlyphRange(t,i,this.url,this.requestManager);e.requests[i]=r}try{const n=yield e.requests[i];for(const t in n)e.glyphs[+t]=n[+t];return e.ranges[i]=!0,{stack:t,id:r,glyph:n[r]||null}}catch(n){const o=e.glyphs[r]=this._drawGlyph(e,t,r);return this._warnOnMissingGlyphRange(o,i,r,n),{stack:t,id:r,glyph:o}}})}_warnOnMissingGlyphRange(t,r,i,n){const o=256*r,a=o+255,s=i.toString(16).padStart(4,"0").toUpperCase();e.w(`Unable to load glyph range ${r}, ${o}-${a}. Rendering codepoint U+${s} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&e.q(t)}_drawGlyph(t,r,i){const n=r===M&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i),o=n?"ideographTinySDF":"tinySDF";t[o]||(t[o]=this._createTinySDF(n?this.localIdeographFontFamily:r));const a=t[o].draw(String.fromCodePoint(i)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(i));return{id:i,bitmap:new e.r({width:a.width||60,height:a.height||60},a.data),metrics:{width:s?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:s?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const e=t?t.split(","):[];e.push("sans-serif");const r=e.map(t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`).join(",");return new A.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:r,fontWeight:this._fontWeight(e[0]),fontStyle:this._fontStyle(e[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const e={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let r;for(const[i,n]of Object.entries(e))new RegExp(`\\b${i}\\b`,"i").test(t)&&(r=`${n}`);return r}destroy(){for(const t in this.entries){const e=this.entries[t];e.tinySDF&&(e.tinySDF=null),e.ideographTinySDF&&(e.ideographTinySDF=null),e.glyphs={},e.requests={},e.ranges={}}this.entries={}}}A.loadGlyphRange=function(t,r,i,n){return e._(this,void 0,void 0,function*(){const o=256*r,a=o+255,s=n.transformRequest(i.replace("{fontstack}",t).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield e.n(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${r}, ${o}-${a}`);const c={};for(const t of e.o(l.data))c[t.id]=t;return c})},A.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal",lang:s=null}={}){this.buffer=e,this.cutoff=i,this.radius=r,this.lang=s;const l=this.size=t+4*e,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${t}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(r),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(i)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),p=new Uint8ClampedArray(h),d={data:p,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,s,l),f.fillText(t,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(T,0,h),g.fill(0,0,h);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const r=y.data[4*(t*s+e)+3]/255;if(0===r)continue;const i=(t+m)*c+e+m;if(1===r)_[i]=0,g[i]=T;else{const t=.5-r;_[i]=t>0?t*t:0,g[i]=t<0?t*t:0}}S(_,0,0,c,u,c,this.f,this.v,this.z),S(g,m,m,s,l,c,this.f,this.v,this.z);for(let t=0;t<h;t++){const e=Math.sqrt(_[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class E{constructor(){this.specification=e.u.light.position}possiblyEvaluate(t,r){return e.F(t.expression.evaluate(r))}interpolate(t,r,i){return{x:e.G.number(t.x,r.x,i),y:e.G.number(t.y,r.y,i),z:e.G.number(t.z,r.z,i)}}}let I;class C extends e.E{constructor(t){super(),I=I||new e.t({anchor:new e.D(e.u.light.anchor),position:new E,color:new e.D(e.u.light.color),intensity:new e.D(e.u.light.intensity)}),this._transitionable=new e.x(I,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r={}){if(!this._validate(e.y,t,r))for(const r in t){const i=t[r];r.endsWith(e.z)?this._transitionable.setTransition(r.slice(0,-e.z.length),i):this._transitionable.setValue(r,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i){return(!i||!1!==i.validate)&&e.B(this,t.call(e.C,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.u}))}}const D=new e.t({"sky-color":new e.D(e.u.sky["sky-color"]),"horizon-color":new e.D(e.u.sky["horizon-color"]),"fog-color":new e.D(e.u.sky["fog-color"]),"fog-ground-blend":new e.D(e.u.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.u.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.u.sky["atmosphere-blend"])});class z extends e.E{constructor(t){super(),this._transitionable=new e.x(D,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.H(0))}setSky(t,r={}){if(!this._validate(e.J,t,r)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const r in t){const i=t[r];r.endsWith(e.z)?this._transitionable.setTransition(r.slice(0,-e.z.length),i):this._transitionable.setValue(r,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i={}){return!1!==(null==i?void 0:i.validate)&&e.B(this,t.call(e.C,e.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class k{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,r){const i=[];let n=t.length%2==1?-t[t.length-1]*r:0,o=t[0]*r,a=!0;i.push({left:n,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];n=s*r,s+=l,o=s*r,i.push({left:n,right:o,isDash:a,zeroLength:0===l})}return i}addRoundDash(t,e,r){const i=e/2;for(let e=-r;e<=r;e++){const n=this.width*(this.nextRow+r+e);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const p=e/r*(i+1);if(a.isDash){const t=i-Math.abs(p);h=Math.sqrt(u*u+t*t)}else h=i-Math.sqrt(u*u+p*p);this.data[n+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const r=t[e],i=t[e+1];r.zeroLength?t.splice(e,1):i&&i.isDash===r.isDash&&(i.left=r.left,t.splice(e,1))}const e=t[0],r=t[t.length-1];e.isDash===r.isDash&&(e.left=r.left-this.width,r.right=e.right+this.width);const i=this.width*this.nextRow;let n=0,o=t[n];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++n]);const r=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(r,a);this.data[i+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(t,r){const i=r?7:0,n=2*i+1;if(this.nextRow+n>this.height)return e.w("LineAtlas out of space"),null;let o=0;for(let e=0;e<t.length;e++)o+=t[e];if(0!==o){const e=this.width/o,n=this.getDashRanges(t,this.width,e);r?this.addRoundDash(n,e,i):this.addRegularDash(n)}const a={y:this.nextRow+i,height:2*i,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}const R="maplibre_preloaded_worker_pool";class L{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<L.workerCount;)this.workers.push(new Worker(e.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[R]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(s.hardwareConcurrency/2);let B,O;function j(){return B||(B=new L),B}L.workerCount=e.K(globalThis)?Math.max(Math.min(F,3),1):1;class N{constructor(t,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;const i=this.workerPool.acquire(r);for(let t=0;t<i.length;t++){const n=new e.L(i[t],r);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const r=[];for(const i of this.actors)r.push(i.sendAsync({type:t,data:e}));return Promise.all(r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(const r of this.actors)r.registerMessageHandler(t,e)}unregisterMessageHandler(t){for(const e of this.actors)e.unregisterMessageHandler(t)}}function V(){return O||(O=new N(j(),e.M),O.registerMessageHandler("GR",(t,r,i)=>e.m(r,i))),O}function U(t,r){const i=e.N();return e.O(i,i,[1,1,0]),e.Q(i,i,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?e.S(i,i,t.calculatePosMatrix(r.toUnwrapped())):i}function $(t,e,r,i,n,o,a){var s;const l=function(t,e,r){if(t)for(const i of t){const t=e[i];if(t&&t.source===r&&"fill-extrusion"===t.type)return!0}else for(const t in e){const i=e[t];if(i.source===r&&"fill-extrusion"===i.type)return!0}return!1}(null!==(s=null==n?void 0:n.layers)&&void 0!==s?s:null,e,t.id),c=o.maxPitchScaleFactor(),u=t.tilesIn(i,c,l);u.sort(G);const h=[];for(const i of u)h.push({wrappedTileID:i.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(e,r,t.getState(),i.queryGeometry,i.cameraQueryGeometry,i.scale,n,o,c,U(o,i.tileID),a?(t,e)=>a(i.tileID,t,e):void 0)});return function(t,e){for(const r in t)for(const i of t[r])q(i,e);return t}(function(t){const e={},r={};for(const i of t){const t=i.queryResults,n=i.wrappedTileID,o=r[n]=r[n]||{};for(const r in t){const i=t[r],n=o[r]=o[r]||{},a=e[r]=e[r]||[];for(const t of i)n[t.featureIndex]||(n[t.featureIndex]=!0,a.push(t))}}return e}(h),t)}function G(t,e){const r=t.tileID,i=e.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function q(t,e){const r=t.feature,i=e.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}function Z(t,r,i,n){return e._(this,void 0,void 0,function*(){let o=t;if(t.url?o=(yield e.j(r.transformRequest(t.url,"Source"),i)).data:yield s.frameAsync(i,n),!o)return null;const a=e.U(e.e(o,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(a.vectorLayerIds=o.vector_layers.map(t=>t.id)),a})}class W{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof e.V?new e.V(t.lng,t.lat):e.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.V?new e.V(t.lng,t.lat):e.V.convert(t),this}extend(t){const r=this._sw,i=this._ne;let n,o;if(t instanceof e.V)n=t,o=t;else{if(!(t instanceof W))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(W.convert(t)):this.extend(e.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.V.convert(t)):this;if(n=t._sw,o=t._ne,!n||!o)return this}return r||i?(r.lng=Math.min(n.lng,r.lng),r.lat=Math.min(n.lat,r.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)):(this._sw=new e.V(n.lng,n.lat),this._ne=new e.V(o.lng,o.lat)),this}getCenter(){return new e.V((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 e.V(this.getWest(),this.getNorth())}getSouthEast(){return new e.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:r,lat:i}=e.V.convert(t);let n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}intersects(t){if(!((t=W.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const r=Math.abs(this.getEast()-this.getWest()),i=Math.abs(t.getEast()-t.getWest());if(r>=360||i>=360)return!0;const n=e.W(this.getWest(),-180,180),o=e.W(this.getEast(),-180,180),a=e.W(t.getWest(),-180,180),s=e.W(t.getEast(),-180,180),l=n>o,c=a>s;return!(!l||!c)||(l?s>=n||a<=o:c?o>=a||n<=s:a<=o&&s>=n)}static convert(t){return t instanceof W?t:t?new W(t):t}static fromLngLat(t,r=0){const i=360*r/40075017,n=i/Math.cos(Math.PI/180*t.lat);return new W(new e.V(t.lng-n,t.lat-i),new e.V(t.lng+n,t.lat+i))}adjustAntiMeridian(){const t=new e.V(this._sw.lng,this._sw.lat),r=new e.V(this._ne.lng,this._ne.lat);return new W(t,t.lng>r.lng?new e.V(r.lng+360,r.lat):r)}}class H{constructor(t,e,r){this.bounds=W.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const r=Math.pow(2,t.z),i=Math.floor(e.Y(this.bounds.getWest())*r),n=Math.floor(e.X(this.bounds.getNorth())*r),o=Math.ceil(e.Y(this.bounds.getEast())*r),a=Math.ceil(e.X(this.bounds.getSouth())*r);return t.x>=i&&t.x<o&&t.y>=n&&t.y<a}}class X extends e.E{constructor(t,r,i,n){if(super(),this.id=t,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.U(r,["url","scheme","tileSize","promoteId","encoding"])),this._options=e.e({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),t&&(e.e(this,t),t.bounds&&(this.tileBounds=new H(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,e.Z(t)||this.fire(new e.k(t))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(t)};r.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((e,r)=>{t.reloadPromise={resolve:e,reject:r}})}else t.actor=this.dispatcher.getActor(),i="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:i,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}})}_getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const e=t.tileID.scaledTo(this.maxzoom).canonical,r=e.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:e,overzoomRequest:this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Y extends e.E{constructor(t,r,i,n){super(),this.id=t,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},r),e.e(this,e.U(r,["url","scheme","tileSize"]))}load(){return e._(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,r&&(e.e(this,r),r.bounds&&(this.tileBounds=new H(r.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,e.Z(t)||this.fire(new e.k(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,function*(){const r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield _.getImage(this.map._requestManager.transformRequest(r,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const r=this.map.painter.context,n=r.gl,o=i.data;t.texture=this.map.painter.getTileTexture(o.width),t.texture?t.texture.update(o,{useMipmap:!0}):(t.texture=new e.T(r,o,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}})}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class K extends Y{constructor(t,r,i,n){super(t,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}loadTile(t){return e._(this,void 0,void 0,function*(){const r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const r=yield _.getImage(i,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(r&&r.data){const i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});const n=e.b(i)&&e.$()?i:yield this.readImageNow(i),o={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:"LDT",data:o});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}})}readImageNow(t){return e._(this,void 0,void 0,function*(){if("undefined"!=typeof VideoFrame&&e.a0()){const r=t.width+2,i=t.height+2;try{return new e.R({width:r,height:i},yield e.a1(t,-1,-1,r,i))}catch(t){}}return s.getImageData(t,1)})}_getNeighboringTiles(t){const r=t.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?t.wrap-1:t.wrap,a=(r.x+1+i)%i,s=r.x+1===i?t.wrap+1:t.wrap,l={};return l[new e.a2(t.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new e.a2(t.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new e.a2(t.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new e.a2(t.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}function J(t){return t&&0!==t.length?"number"==typeof t[0]?[t]:t.flatMap(t=>J(t)):[]}function Q(t){return"GeometryCollection"===t.type?t.geometries.flatMap(t=>Q(t)):J(t.coordinates)}function tt(t){const e=new W;let r;switch(t.type){case"FeatureCollection":r=t.features.flatMap(t=>Q(t.geometry));break;case"Feature":r=Q(t.geometry);break;default:r=Q(t)}if(0===r.length)return e;for(let t=0;t<r.length;t++){const[i,n]=r[t];e.extend([i,n])}return e}class et extends e.E{constructor(t,r,i,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:r.data},this.actor=i.getActor(),this.setEventedParent(n),this._data="string"==typeof r.data?{url:r.data}:{geojson:r.data},this._options=e.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=e.e({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==r.buffer?r.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==r.tolerance?r.tolerance:.375),extent:e.a5,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.a5,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(t){return t*(e.a5/this.tileSize)}_getClusterMaxZoom(t){const r=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||e.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${r}"`),r}load(){return e._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t,e){this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const r=this._updateWorkerData();return e?r:this}updateData(t,r){this._pendingWorkerUpdate.diff=e.a6(this._pendingWorkerUpdate.diff,t);const i=this._updateWorkerData();return r?i:this}getData(){return e._(this,void 0,void 0,function*(){const t=e.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}getBounds(){return e._(this,void 0,void 0,function*(){return tt(yield this.getData())})}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:r}})}_updateWorkerData(){return e._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void e.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(t,r);void 0!==t?this._pendingWorkerUpdate.data=void 0:r&&(this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,yield this._dispatchWorkerUpdate(i)})}_getLoadGeoJSONParameters(t,r){const i=e.e({type:this.type},this.workerOptions);return"string"==typeof t?(i.request=this.map._requestManager.transformRequest(s.resolveURL(t),"Source"),i.request.collectResourceTiming=this._collectResourceTiming,i):void 0!==t?(i.data=t,i):r?(i.dataDiff=r,i):i}_dispatchWorkerUpdate(t){return e._(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new e.l("dataloading",{dataType:"source"}));try{const r=yield this.actor.sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new e.l("dataabort",{dataType:"source"}));r.data&&(this._data={geojson:r.data});const i=this._applyDiffToSource(t.dataDiff),n=this._getShouldReloadTileOptions(i),o={dataType:"source"};this._applyResourceTiming(o,r),this.fire(new e.l("data",Object.assign(Object.assign({},o),{sourceDataType:"metadata"}))),this.fire(new e.l("data",Object.assign(Object.assign({},o),{sourceDataType:"content",shouldReloadTileOptions:n})))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new e.l("dataabort",{dataType:"source"}));this.fire(new e.k(t))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(t,r){var i;if(!this._collectResourceTiming)return;const n=null===(i=r.resourceTiming)||void 0===i?void 0:i[this.id];if(!n)return;const o=n.slice(0);(null==o?void 0:o.length)&&e.e(t,{resourceTiming:o})}_applyDiffToSource(t){if(!t)return;const r="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const t=e.a7(this._data.geojson,r);if(!t)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;const i=e.a8(this._data.updateable,t,r);return t.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map(t=>tt(t))}}shouldReloadTile(t,{affectedBounds:r}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;const{buffer:i,extent:n}=this.workerOptions.geojsonVtOptions,o=function({x:t,y:r,z:i},n=0){const o=e.a3((t-n)/Math.pow(2,i)),a=e.a4((r+1+n)/Math.pow(2,i)),s=e.a3((t+1+n)/Math.pow(2,i)),l=e.a4((r-n)/Math.pow(2,i));return new W([o,a],[s,l])}(t.tileID.canonical,i/n);for(const t of r)if(o.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const i=yield this.actor.sendAsync({type:e,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(i,this.map.painter,"RT"===e)})}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return e.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class rt extends e.E{constructor(t,e,r,i){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=r,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=e}load(t){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield _.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,e.Z(t)||this.fire(new e.k(t))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const r=t.map(e.a9.fromLngLat);var i;return this.tileID=function(t){const r=e.aa.fromPoints(t),i=r.width(),n=r.height(),o=Math.max(i,n),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),s=Math.pow(2,a);return new e.ac(a,Math.floor((r.minX+r.maxX)/2*s),Math.floor((r.minY+r.maxY)/2*s))}(r),this.terrainTileRanges=this._getOverlappingTileRanges(r),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=r.map(t=>this.tileID.getTilePoint(t)._round()),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[0].x)<0,this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,r=t.gl;this.texture||(this.texture=new e.T(t,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:r,minY:i,maxX:n,maxY:o}=e.aa.fromPoints(t),a={};for(let t=0;t<=e.ab;t++){const e=Math.pow(2,t),s=Math.floor(r*e),l=Math.floor(i*e),c=Math.floor(n*e),u=Math.floor(o*e),h=(s%e+e)%e,p=c%e,d=Math.floor(s/e),f=Math.floor(c/e);a[t]={minWrap:d,maxWrap:f,minTileXWrapped:h,maxTileXWrapped:p,minTileY:l,maxTileY:u}}return a}}class it extends rt{constructor(t,e,r,i){super(t,e,r,i),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.ad(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new e.k(t))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new e.k(new e.ae(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new e.l("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 nt extends rt{constructor(t,r,i,n){super(t,r,i,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new e.k(new e.ae(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.k(new e.ae(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.k(new e.ae(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.k(new e.ae(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.k(new e.ae(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){return e._(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 e.k(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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const r=this.map.painter.context,i=r.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new e.T(r,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ot={},at=t=>{switch(t){case"geojson":return et;case"image":return rt;case"raster":return Y;case"raster-dem":return K;case"vector":return X;case"video":return it;case"canvas":return nt}return ot[t]},st="RTLPluginLoaded";class lt extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=V()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return e._(this,arguments,void 0,function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=s.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return e._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.l(st))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let ct=null;function ut(){return ct||(ct=new lt),ct}var ht,pt;!function(t){t[t.Base=0]="Base",t[t.Parent=1]="Parent"}(ht||(ht={})),function(t){t[t.Departing=0]="Departing",t[t.Incoming=1]="Incoming"}(pt||(pt={}));class dt{constructor(t,r){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=e.af(),this.uses=0,this.tileSize=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:e,fadingParentID:r,fadeEndTime:i}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=e,this.fadingParentID=r,this.fadeEndTime=i}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=c(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,r,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const r={};if(!e)return r;for(const i of t){const t=i.layerIds.map(t=>e.getLayer(t)).filter(Boolean);if(0!==t.length){i.layers=t,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(e=>t.filter(t=>t.id===e)[0]));for(const e of t)r[e.id]=i}}return r}(t.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.ah){if(this.hasSymbolBuckets=!0,!i)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.ah&&r.hasRTLText){this.hasRTLText=!0,ut().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new e.ag}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t)}const r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new e.T(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,i,n,o,a,s,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l,getElevation:u},t,e,r):{}}querySourceFeatures(t,r){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=r&&r.sourceLayer?r.sourceLayer:"",a=n[e.ai]||n[o];if(!a)return;const s=e.aj(null==r?void 0:r.filter,null==r?void 0:r.globalState),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let r=0;r<a.length;r++){const n=a.feature(r);if(s.needGeometry){const t=e.ak(n,!0);if(!s.filter(new e.H(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new e.H(this.tileID.overscaledZ),n))continue;const p=i.getId(n,o),d=new e.al(n,l,c,u,p);d.tile=h,t.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const r=this.expirationTime;if(t.cacheControl){const r=e.am(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(r)if(this.expirationTime<r)e=!0;else{const i=this.expirationTime-r;i?this.expirationTime=t+Math.max(i,3e4):e=!0}else e=!0;e?(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(t,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!r.style.hasLayer(n))continue;const o=this.buckets[n],a=o.layers[0].sourceLayer||e.ai,s=i[a],l=t[a];if(!s||!l||0===Object.keys(l).length)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const c=r&&r.style&&r.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=c()+t}setDependencies(t,e){const r={};for(const t of e)r[t]=!0;this.dependencies[t]=r}hasDependency(t,e){for(const r of t){const t=this.dependencies[r];if(t)for(const r of e)if(t[r])return!0}return!1}}class ft{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,r,i){const n=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.e(this.stateChanges[t][n],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])i[e]||(this.deletedStates[t][n][e]=null)}else for(const e in i)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,r){if(null===this.deletedStates[t])return;const i=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][i]&&(this.deletedStates[t][i]=this.deletedStates[t][i]||{},this.deletedStates[t][i][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][i])for(r in this.deletedStates[t][i]={},this.stateChanges[t][i])this.deletedStates[t][i][r]=null;else this.deletedStates[t][i]=null;else this.deletedStates[t]=null}getState(t,r){const i=String(r),n=e.e({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][r];if(null===e)return{};for(const t in e)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,r){const i={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const r={};for(const i in this.stateChanges[t])this.state[t][i]||(this.state[t][i]={}),e.e(this.state[t][i],this.stateChanges[t][i]),r[i]=this.state[t][i];i[t]=r}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const r={};if(null===this.deletedStates[t])for(const e in this.state[t])r[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const r of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][r];r[e]=this.state[t][e]}i[t]=i[t]||{},e.e(i[t],r)}this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length&&(this.revision++,t.setFeatureState(i,r))}}const mt=89.25;function gt(t,r){const i=e.an(r.lat,-e.ao,e.ao);return new e.P(e.Y(r.lng)*t,e.X(i)*t)}function _t(t,r){return new e.a9(r.x/t,r.y/t).toLngLat()}function yt(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(e.ap(90-t.pitch)),Math.tan(e.ap(mt-t.pitch)))}function vt(t,r){const i=t.canonical,n=r/e.aq(i.z),o=i.x+Math.pow(2,i.z)*t.wrap,a=e.ar(new Float64Array(16));return e.O(a,a,[o*n,i.y*n,0]),e.Q(a,a,[n/e.a5,n/e.a5,1]),a}function bt(t,r,i,n,o){const a=e.a9.fromLngLat(t,r),s=o*e.as(1,t.lat),{x:l,y:c,z:u}=xt(i,n);return new e.a9(a.x+s*-l,a.y+s*-c,a.z+s*-u)}function xt(t,r){const i=e.ap(t),n=e.ap(r),o=Math.cos(-i),a=Math.sin(i);return{x:a*Math.sin(n),y:-a*Math.cos(n),z:o}}function wt(t,e,r){const i=e.intersectsFrustum(t);if(!r||0===i)return i;const n=e.intersectsPlane(r);return 0===n?0:2===i&&2===n?2:1}function Tt(t,e,r){let i=0;const n=(r-e)/10;for(let o=0;o<10;o++)i+=n*Math.pow(Math.cos(e+(o+.5)/10*(r-e)),t);return i}function St(t,r){return function(i,n,o,a,s){const l=2*((t-1)/e.at(Math.cos(e.ap(mt-s))/Math.cos(e.ap(mt)))-1),c=Math.acos(o/a),u=2*Tt(l-1,0,e.ap(s/2)),h=Math.min(e.ap(mt),c+e.ap(s/2)),p=Tt(l-1,Math.min(h,c-e.ap(s/2)),h),d=Math.atan(n/o),f=Math.hypot(n,o);let m=i;return m+=e.at(a/f/Math.max(.5,Math.cos(e.ap(s/2)))),m+=l*e.at(Math.cos(d))/2,m-=e.at(Math.max(1,p/u/r))/2,m}}const Pt=St(9.314,3);function Mt(t,r){const i=(r.roundZoom?Math.round:Math.floor)(t.zoom+e.at(t.tileSize/r.tileSize));return Math.max(0,i)}function At(t,r){const i=t.getCameraFrustum(),n=t.getClippingPlane(),o=t.screenPointToMercatorCoordinate(t.getCameraPoint()),a=e.a9.fromLngLat(t.center,t.elevation);o.z=a.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;const s=t.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(t,r),c=Mt(t,r),u=r.minzoom||0,h=void 0!==r.maxzoom?r.maxzoom:t.maxZoom,p=Math.min(Math.max(0,c),h),d=Math.pow(2,p),f=[d*o.x,d*o.y,0],m=[d*a.x,d*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),_=Math.abs(a.z-o.z),y=Math.hypot(g,_),v=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),b=[],x=[];if(t.renderWorldCopies&&s.allowWorldCopies())for(let t=1;t<=3;t++)b.push(v(-t)),b.push(v(t));for(b.push(v(0));b.length>0;){const d=b.pop(),g=d.x,v=d.y;let w=d.fullyVisible;const T={x:g,y:v,z:d.zoom},S=s.getTileBoundingVolume(T,d.wrap,t.elevation,r);if(!w){const t=wt(i,S,n);if(0===t)continue;w=2===t}const P=s.distanceToTile2d(o.x,o.y,T,S);let M=c;l&&(M=(r.calculateTileZoom||Pt)(t.zoom+e.at(t.tileSize/r.tileSize),P,_,y,t.fov)),M=(r.roundZoom?Math.round:Math.floor)(M),M=Math.max(0,M);const A=Math.min(M,h);if(d.wrap=s.getWrap(a,T,d.wrap),d.zoom>=A){if(d.zoom<u)continue;const t=p-d.zoom,i=f[0]-.5-(g<<t),n=f[1]-.5-(v<<t),o=r.reparseOverscaled?Math.max(d.zoom,M):d.zoom;x.push({tileID:new e.a2(d.zoom===h?o:d.zoom,d.wrap,d.zoom,g,v),distanceSq:e.au([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let t=0;t<4;t++)b.push({zoom:d.zoom+1,x:(g<<1)+t%2,y:(v<<1)+(t>>1),wrap:d.wrap,fullyVisible:w})}return x.sort((t,e)=>t.distanceSq-e.distanceSq).map(t=>t.tileID)}const Et=e.aa.fromPoints([new e.P(0,0),new e.P(e.a5,e.a5)]);function It(t){return"raster"===t||"image"===t||"video"===t}function Ct(t,e,r,i,n,o,a){if(!e.hasData())return!1;const{tileID:s,fadingRole:l,fadingDirection:c,fadingParentID:u}=e;if(l===ht.Base&&c===pt.Incoming&&u)return r[u.key]=u,!0;const h=Math.max(s.overscaledZ-n,o);for(let n=s.overscaledZ-1;n>=h;n--){const o=s.scaledTo(n),l=t.getLoadedTile(o);if(l)return e.setCrossFadeLogic({fadingRole:ht.Base,fadingDirection:pt.Incoming,fadingParentID:l.tileID,fadeEndTime:i+a}),l.setCrossFadeLogic({fadingRole:ht.Parent,fadingDirection:pt.Departing,fadeEndTime:i+a}),r[o.key]=o,!0}return!1}function Dt(t,e,r,i,n,o){if(!e.hasData())return!1;const a=e.tileID.children(n);let s=zt(t,e,a,r,i,n,o);if(s)return!0;for(const l of a)zt(t,e,l.children(n),r,i,n,o)&&(s=!0);return s}function zt(t,e,r,i,n,o,a){if(r[0].overscaledZ>=o)return!1;let s=!1;for(const o of r){const r=t.getLoadedTile(o);if(!r)continue;const{fadingRole:l,fadingDirection:c,fadingParentID:u}=r;l===ht.Base&&c===pt.Departing&&u||(r.setCrossFadeLogic({fadingRole:ht.Base,fadingDirection:pt.Departing,fadingParentID:e.tileID,fadeEndTime:n+a}),e.setCrossFadeLogic({fadingRole:ht.Parent,fadingDirection:pt.Incoming,fadeEndTime:n+a})),i[o.key]=o,s=!0}return s}function kt(t,e,r,i){const n=t.tileID;return!!t.selfFading||!t.hasData()&&!!e.has(n)&&(t.setSelfFadeLogic(r+i),!0)}function Rt(t,e){var r;t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,o=Math.pow(2,t.tileID.canonical.z),a=e.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),(null===(r=t.neighboringTiles)||void 0===r?void 0:r[a])&&(t.neighboringTiles[a].backfilled=!0)))}class Lt{constructor(){this._tiles={}}handleWrapJump(t){const e={};for(const r in this._tiles){const i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),e[i.tileID.key]=i}this._tiles=e}setFeatureState(t,e){for(const r in this._tiles)this._tiles[r].setFeatureState(t,e)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map(t=>t.tileID).sort(e.aw).map(t=>t.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,e){this._tiles[t]=e}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const e=this.getTileById(t.key);return(null==e?void 0:e.hasData())?e:null}isIdRenderable(t,e=!1){var r;return null===(r=this.getTileById(t))||void 0===r?void 0:r.isRenderable(e)}getRenderableIds(t=0,r){const i=[];for(const t of this.getAllIds())this.isIdRenderable(t,r)&&i.push(this.getTileById(t));return r?i.sort((r,i)=>{const n=r.tileID,o=i.tileID,a=new e.P(n.canonical.x,n.canonical.y)._rotate(-t),s=new e.P(o.canonical.x,o.canonical.y)._rotate(-t);return n.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x}).map(t=>t.tileID.key):i.map(t=>t.tileID).sort(e.aw).map(t=>t.key)}}class Ft extends e.E{constructor(t,r,i){super(),this.id=t,this.dispatcher=i,this.on("data",t=>this._dataHandler(t)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,e,r,i)=>{const n=new(at(e.type))(t,e,r,i);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,r,i,this),this._inViewTiles=new Lt,this._outOfViewCache=new e.ax(0,t=>this._unloadTile(t)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new ft,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){for(const t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new Lt}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,r,i){return e._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,r,i)}catch(r){t.state="errored",404!==r.status?this._source.fire(new e.k(r,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const e of this._inViewTiles.getAllTiles())e.upload(t),e.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var e;return this._inViewTiles.getRenderableIds(null===(e=this.transform)||void 0===e?void 0:e.bearingInRadians,t)}hasRenderableParent(t){const e=t.overscaledZ-1;if(e>=this._source.minzoom){const r=this.getLoadedTile(t.scaledTo(e));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(t,e=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const r of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(r);e&&!this._source.shouldReloadTile(i,e)||(t?this._reloadTile(r,"expired"):"errored"!==i.state&&this._reloadTile(r,"reloading"))}}}_reloadTile(t,r){return e._(this,void 0,void 0,function*(){const e=this._inViewTiles.getTileById(t);e&&("loading"!==e.state&&(e.state=r),yield this._loadTile(e,t,r))})}_tileLoaded(t,r,i){t.timeAdded=c(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),"raster-dem"===this.getSource().type&&t.dem&&function(t,e){var r,i;const n=e.getRenderableIds();for(const o of n){if(!t.neighboringTiles||!t.neighboringTiles[o])continue;const n=e.getTileById(o);t.neighboringTiles[o].backfilled||Rt(t,n),(null===(i=null===(r=n.neighboringTiles)||void 0===r?void 0:r[t.tileID.key])||void 0===i?void 0:i.backfilled)||Rt(n,t)}}(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.l("data",{dataType:"source",tile:t,coord:t.tileID}))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,e){const r=this._getLoadedDescendents(e),i=new Set;for(const n of e){const e=r[n.key];if(!(null==e?void 0:e.length)){i.add(n);continue}const o=n.overscaledZ+Ft.maxOverzooming,a=e.filter(t=>t.tileID.overscaledZ<=o);if(!a.length){i.add(n);continue}const s=Math.min(...a.map(t=>t.tileID.overscaledZ)),l=a.filter(t=>t.tileID.overscaledZ===s).map(t=>t.tileID);for(const e of l)t[e.key]=e;this._areDescendentsComplete(l,s,n.overscaledZ)||i.add(n)}return i}_getLoadedDescendents(t){var e;const r={};for(const i of this._inViewTiles.getAllTiles().filter(t=>t.hasData()))for(const n of t)i.tileID.isChildOf(n)&&(r[e=n.key]||(r[e]=[])).push(i);return r}_areDescendentsComplete(t,e,r){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===e:Math.pow(4,e-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const r=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(r*i*(null===this._maxTileCacheZoomLevels?e.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._outOfViewCache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,e&&(this._inViewTiles.handleWrapJump(e),this._resetTileReloadTimers())}update(t,r){if(!this._sourceLoaded||this._paused)return;let i;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.a2(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(i=At(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter(t=>this._source.hasTile(t)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));const n=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new e.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const o=Mt(t,this._source),a=this._updateRetainedTiles(i,o),s=It(this._source.type);s&&this._rasterFadeDuration>0&&!r&&function(t,r,i,n,o,a,s){const l=c(),u=e.av(r);for(const e of r){const r=t.getTileById(e.key);r.fadingDirection!==pt.Departing&&0!==r.fadeOpacity||r.resetFadeLogic(),Ct(t,r,i,l,n,o,s)||Dt(t,r,i,l,a,s)||kt(r,u,l,s)||r.resetFadeLogic()}}(this._inViewTiles,i,a,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(t){for(const e of this._inViewTiles.getAllIds())t[e]||this._removeTile(e)}_cleanUpVectorTiles(t){for(const e of this._inViewTiles.getAllIds()){const r=this._inViewTiles.getTileById(e);t[e]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(e):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(e)}}_addTerrainIdealTiles(t){const e=[];for(const r of t)if(r.canonical.z>this._source.minzoom){const t=r.scaledTo(r.canonical.z-1);e.push(t);const i=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));e.push(i)}return t.concat(e)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var r;const i=new Set;for(const e of t)this._addTile(e).hasData()||i.add(e);const n=t.reduce((t,e)=>(t[e.key]=e,t),{}),o=this._retainLoadedChildren(n,i),a={},s=Math.max(e-Ft.maxUnderzooming,this._source.minzoom);for(const t of o){let e=this._inViewTiles.getTileById(t.key),i=null==e?void 0:e.wasRequested();for(let o=t.overscaledZ-1;o>=s;--o){const s=t.scaledTo(o);if(a[s.key])break;if(a[s.key]=!0,e=this.getTile(s),!e&&i&&(e=this._addTile(s)),e){const t=e.hasData();if((t||!(null===(r=this.map)||void 0===r?void 0:r.cancelPendingTileRequestsWhileZooming)||i)&&(n[s.key]=s),i=e.wasRequested(),t)break}}}return n}_addTile(t){let r=this._inViewTiles.getTileById(t.key);if(r)return r;r=this._outOfViewCache.getAndRemove(t),r&&(r.resetFadeLogic(),this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null));const i=r;return r||(r=new dt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state)),r.uses++,this._inViewTiles.setTile(t.key,r),i||this._source.fire(new e.l("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(t,e){this._clearTileReloadTimer(t);const r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}_clearTileReloadTimer(t){const e=this._timers[t];e&&(clearTimeout(e),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const e=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,e)}}refreshTiles(t){for(const e of this._inViewTiles.getAllIds()){const r=this._inViewTiles.getTileById(e);(this._inViewTiles.isIdRenderable(e)||"errored"==r.state)&&t.some(t=>t.equals(r.tileID.canonical))&&this._reloadTile(e,"expired")}}_removeTile(t){const e=this._inViewTiles.getTileById(t);e&&(e.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._outOfViewCache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){"source"===t.dataType&&("metadata"!==t.sourceDataType?"content"===t.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,r,i){const n=[],o=this.transform;if(!o)return n;const a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?o.getCameraQueryGeometry(t):t,l=t=>o.screenPointToMercatorCoordinate(t,this.terrain),c=this.transformBbox(t,l,!a),u=this.transformBbox(s,l,!a),h=this.getIds(),p=e.aa.fromPoints(u);for(let t=0;t<h.length;t++){const i=this._inViewTiles.getTileById(h[t]);if(i.holdingForSymbolFade())continue;const s=a?[i.tileID]:[i.tileID.unwrapTo(-1),i.tileID.unwrapTo(0)],l=Math.pow(2,o.zoom-i.tileID.overscaledZ),d=r*i.queryPadding*e.a5/i.tileSize/l;for(const t of s){const r=p.map(r=>t.getTilePoint(new e.a9(r.x,r.y)));if(r.expandBy(d),r.intersects(Et)){const e=c.map(e=>t.getTilePoint(e)),r=u.map(e=>t.getTilePoint(e));n.push({tile:i,tileID:a?t:t.unwrapTo(0),queryGeometry:e,cameraQueryGeometry:r,scale:l})}}}return n}transformBbox(t,r,i){let n=t.map(r);if(i){const i=e.aa.fromPoints(t);i.shrinkBy(.001*Math.min(i.width(),i.height()));const o=i.map(r);e.aa.fromPoints(n).covers(o)||(n=n.map(t=>t.x>.5?new e.a9(t.x-1,t.y,t.z):t))}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map(t=>this._inViewTiles.getTileById(t).tileID);return this.transform&&this.transform.populateCache(e),e}hasTransition(){return!!this._source.hasTransition()||!(!It(this._source.type)||!function(t,e){if(e<=0)return!1;const r=c();for(const e of t.getAllTiles())if(e.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,r,i){this._state.updateState(t=t||e.ai,r,i)}removeFeatureState(t,r,i){this._state.removeFeatureState(t=t||e.ai,r,i)}getFeatureState(t,r){return this._state.getState(t=t||e.ai,r)}setDependencies(t,e,r){const i=this._inViewTiles.getTileById(t);i&&i.setDependencies(e,r)}reloadTilesForDependencies(t,e){for(const r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t,e)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(t,e))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}}Ft.maxUnderzooming=10,Ft.maxOverzooming=3;class Bt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.an(t,0,1);let r=1,i=this._distances[r];const n=t*this.paddedLength+this.padding;for(;i<n&&r<this._distances.length;)i=this._distances[++r];const o=r-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))}}function Ot(t,e){let r=!0;return"always"===t||"never"!==t&&"never"!==e||(r=!1),r}class jt{constructor(t,e,r){const i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(let t=0;t<this.xCellCount*this.yCellCount;t++)i.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(t,e,r,i){this._forEachCell(e-i,r-i,e+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(i)}_insertBoxCell(t,e,r,i,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,r,i,n,o){this.circleCells[n].push(o)}_query(t,e,r,i,n,o,a){if(r<0||t>this.width||i<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){if(n)return[{key:null,x1:t,y1:e,x2:r,y2:i}];for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],r=this.circles[3*t+1],i=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-i,y1:r-i,x2:e+i,y2:r+i})}}else this._forEachCell(t,e,r,i,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,r,i){return this._query(t,e,r,i,!1,null)}hitTest(t,e,r,i,n,o){return this._query(t,e,r,i,!0,n,o).length>0}hitTestCircle(t,e,r,i,n){const o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,r,i,n,o,a,s){const{seenUids:l,hitTest:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const n=this.bboxes;for(const a of h)if(!l.box[a]){l.box[a]=!0;const h=4*a,p=this.boxKeys[a];if(t<=n[h+2]&&e<=n[h+3]&&r>=n[h+0]&&i>=n[h+1]&&(!s||s(p))&&(!c||!Ot(u,p.overlapMode))&&(o.push({key:p,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],t,e,r,i)&&(!s||s(p))&&(!c||!Ot(u,p.overlapMode))){const t=n[h],e=n[h+1],r=n[h+2];if(o.push({key:p,x1:t-r,y1:e-r,x2:t+r,y2:e+r}),c)return!0}}}return!1}_queryCellCircle(t,e,r,i,n,o,a,s){const{circle:l,seenUids:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const t=this.bboxes;for(const e of h)if(!c.box[e]){c.box[e]=!0;const r=4*e,i=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!s||s(i))&&!Ot(u,i.overlapMode))return o.push(!0),!0}}const p=this.circleCells[n];if(null!==p){const t=this.circles;for(const e of p)if(!c.circle[e]){c.circle[e]=!0;const r=3*e,i=this.circleKeys[e];if(this._circlesCollide(t[r],t[r+1],t[r+2],l.x,l.y,l.radius)&&(!s||s(i))&&!Ot(u,i.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,r,i,n,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),u=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let p=l;p<=u;p++)for(let l=c;l<=h;l++)if(n.call(this,t,e,r,i,this.xCellCount*l+p,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,r,i,n,o){const a=i-t,s=n-e,l=r+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,r,i,n,o,a){const s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+r)return!1;const c=(a-n)/2,u=Math.abs(e-(n+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;const h=l-s,p=u-c;return h*h+p*p<=r*r}}function Nt(t,r,n){const o=e.N();if(!t){const{vecSouth:t,vecEast:e}=Ut(r),n=i();n[0]=e[0],n[1]=e[1],n[2]=t[0],n[3]=t[1],a=n,(p=(l=(s=n)[0])*(h=s[3])-(u=s[2])*(c=s[1]))&&(a[0]=h*(p=1/p),a[1]=-c*p,a[2]=-u*p,a[3]=l*p),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var a,s,l,c,u,h,p;return e.Q(o,o,[1/n,1/n,1]),o}function Vt(t,r,i,n){if(t){const t=e.N();if(!r){const{vecSouth:e,vecEast:r}=Ut(i);t[0]=r[0],t[1]=r[1],t[4]=e[0],t[5]=e[1]}return e.Q(t,t,[n,n,1]),t}return i.pixelsToClipSpaceMatrix}function Ut(t){const r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),o=Math.cos(t.bearingInRadians),a=Math.sin(t.bearingInRadians),s=e.aC();s[0]=-o*n*i-a*r,s[1]=-a*n*i+o*r;const l=e.aD(s);l<1e-9?e.aE(s):e.aF(s,s,1/l);const c=e.aC();c[0]=o*n*r-a*i,c[1]=a*n*r+o*i;const u=e.aD(c);return u<1e-9?e.aE(c):e.aF(c,c,1/u),{vecEast:c,vecSouth:s}}function $t(t,r,i,n){let o;n?(o=[t,r,n(t,r),1],e.aH(o,o,i)):(o=[t,r,0,1],ae(o,o,i));const a=o[3];return{point:new e.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function Gt(t,e){return.5+t/e*.5}function qt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function Zt(t,r,i,n,o,a,s,l,c,u,h,p,d){const f=i?t.textSizeData:t.iconSizeData,m=e.ay(f,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],_=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();const y=t.lineVertexArray,v=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=r.transform.width/r.transform.height;let x=!1;for(let i=0;i<v.length;i++){const w=v.get(i);if(w.hidden||w.writingMode===e.az.vertical&&!x){oe(w.numGlyphs,_);continue}x=!1;const T=new e.P(w.anchorX,w.anchorY),S={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:T,unwrappedTileID:c,width:u,height:h,translation:p},P=te(w.anchorX,w.anchorY,S);if(!qt(P.point,g)){oe(w.numGlyphs,_);continue}const M=Gt(r.transform.cameraToCenterDistance,P.signedDistanceFromCamera),A=e.aA(f,m,w),E=a?A*r.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/M:A*M,I=Xt({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:E,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:l});x=I.useVertical,(I.notEnoughRoom||x||I.needsFlipping&&Xt({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:E,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&oe(w.numGlyphs,_)}i?t.text.dynamicLayoutVertexBuffer.updateData(_):t.icon.dynamicLayoutVertexBuffer.updateData(_)}function Wt(t,e,r,i,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=e.getoffsetX(o.glyphStartIndex),p=e.getoffsetX(l-1),d=ie(t*h,r,i,n,o.segment,c,u,s,a);if(!d)return null;const f=ie(t*p,r,i,n,o.segment,c,u,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}:null}function Ht(t,r,i,n){return t===e.az.horizontal&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(t===e.az.vertical?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function Xt(t){const{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=t,p=o/24,d=n.lineOffsetX*p,f=n.lineOffsetY*p;let m;if(n.numGlyphs>1){const t=n.glyphStartIndex+n.numGlyphs,e=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Wt(p,l,d,f,a,n,h,r);if(!c)return{notEnoughRoom:!0};const g=Qt(c.first.point.x,c.first.point.y,r,i),_=Qt(c.last.point.x,c.last.point.y,r,i);if(s&&!a){const t=Ht(n.writingMode,g,_,u);if(t)return t}m=[c.first];for(let i=n.glyphStartIndex+1;i<t-1;i++){const t=ie(p*l.getoffsetX(i),d,f,a,n.segment,e,o,r,h);if(!t)return{notEnoughRoom:!0};m.push(t)}m.push(c.last)}else{if(s&&!a){const t=Jt(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,o=n.lineStartIndex+n.segment+1,a=new e.P(r.lineVertexArray.getx(o),r.lineVertexArray.gety(o)),s=Jt(a.x,a.y,r),l=s.signedDistanceFromCamera>0?s.point:Yt(r.tileAnchorPoint,a,t,1,r),c=Qt(t.x,t.y,r,i),h=Qt(l.x,l.y,r,i),p=Ht(n.writingMode,c,h,u);if(p)return p}const t=ie(p*l.getoffsetX(n.glyphStartIndex),d,f,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,h);if(!t||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(const t of m)e.aG(c,t.point,t.angle);return{}}function Yt(t,e,r,i,n){const o=t.add(t.sub(e)._unit()),a=Jt(o.x,o.y,n).point,s=r.sub(a);return r.add(s._mult(i/s.mag()))}function Kt(t,r,i){const n=r.projectionCache;if(n.projections[t])return n.projections[t];const o=new e.P(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),a=Jt(o.x,o.y,r);if(a.signedDistanceFromCamera>0)return n.projections[t]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=t-i.direction;return Yt(0===i.distanceFromAnchor?r.tileAnchorPoint:new e.P(r.lineVertexArray.getx(s),r.lineVertexArray.gety(s)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,r)}function Jt(t,e,r){const i=t+r.translation[0],n=e+r.translation[1];let o;return r.pitchWithMap?(o=$t(i,n,r.pitchedLabelPlaneMatrix,r.getElevation),o.isOccluded=!1):(o=r.transform.projectTileCoordinates(i,n,r.unwrappedTileID,r.getElevation),o.point.x=(.5*o.point.x+.5)*r.width,o.point.y=(.5*-o.point.y+.5)*r.height),o}function Qt(t,r,i,n){if(i.pitchWithMap){const o=[t,r,0,1];return e.aH(o,o,n),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:t/i.width*2-1,y:1-r/i.height*2}}function te(t,e,r){return r.transform.projectTileCoordinates(t,e,r.unwrappedTileID,r.getElevation)}function ee(t,e,r){return t._unit()._perp()._mult(e*r)}function re(t,r,i,n,o,a,s,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const u=i.add(r);if(t+c.direction<n||t+c.direction>=o)return l.projectionCache.offsets[t]=u,u;const h=Kt(t+c.direction,l,c),p=ee(h.sub(i),s,c.direction),d=i.add(p),f=h.add(p);return l.projectionCache.offsets[t]=e.aI(a,u,d,f)||u,l.projectionCache.offsets[t]}function ie(t,e,r,i,n,o,a,s,l){const c=i?t-e:t+e;let u=c>0?1:-1,h=0;i&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let p,d=u>0?o+n:o+n+1;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=Jt(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let f,m,g=p,_=p,y=0,v=0;const b=Math.abs(c),x=[];let w;for(;y+v<=b;){if(d+=u,d<o||d>=a)return null;y+=v,_=g,m=f;const t={absOffsetX:b,direction:u,distanceFromAnchor:y,previousVertex:_};if(g=Kt(d,s,t),0===r)x.push(_),w=g.sub(_);else{let e;const i=g.sub(_);e=0===i.mag()?ee(Kt(d+u,s,t).sub(g),r,u):ee(i,r,u),m||(m=_.add(e)),f=re(d,e,g,o,a,m,r,s,t),x.push(m),w=f.sub(m)}v=w.mag()}const T=w._mult((b-y)/v)._add(m||_),S=h+Math.atan2(g.y-_.y,g.x-_.x);return x.push(T),{point:T,angle:l?S:0,path:x}}const ne=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function oe(t,e){for(let r=0;r<t;r++){const t=e.length;e.resize(t+4),e.float32.set(ne,3*t)}}function ae(t,e,r){const i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t[3]=r[3]*i+r[7]*n+r[15],t}const se=100;class le{constructor(t,e=new jt(t.width+200,t.height+200,25),r=new jt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+se,this.screenBottomBoundary=t.height+se,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,r,i,n,o,a,s,l,c,u,h){const p=this.projectAndGetPerspectiveRatio(t.anchorPointX+s[0],t.anchorPointY+s[1],n,c,h),d=r*p.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(t,d,i,n,o,a,s,p,c,u,h);else{const e=p.x+(u?u.x*d:0),r=p.y+(u?u.y*d:0);f={allPointsOccluded:!1,box:[e+t.x1*d,r+t.y1*d,e+t.x2*d,r+t.y2*d]}}const[m,g,_,y]=f.box,v=o?f.allPointsOccluded:p.isOccluded;let b=v;return b||(b=p.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(m,g,_,y)),b||"always"!==e&&this.grid.hitTest(m,g,_,y,e,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:v}}placeCollisionCircles(t,r,i,n,o,a,s,l,c,u,h,p,d,f){const m=[],g=new e.P(r.anchorX,r.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),y=(c?o*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,a)/_:o*_)/e.aM,v={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:d},b=Wt(y,n,r.lineOffsetX*y,r.lineOffsetY*y,!1,r,!1,v);let x=!1,w=!1,T=!0;if(b){const r=.5*h*_+p,i=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Bt,a=b.first,s=b.last;let d=[];for(let t=a.path.length-1;t>=1;t--)d.push(a.path[t]);for(let t=1;t<s.path.length;t++)d.push(s.path[t]);const f=2.5*r;if(c){const t=this.projectPathToScreenSpace(d,v);d=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(d.length>0){const t=d[0].clone(),r=d[0].clone();for(let e=1;e<d.length;e++)t.x=Math.min(t.x,d[e].x),t.y=Math.min(t.y,d[e].y),r.x=Math.max(r.x,d[e].x),r.y=Math.max(r.y,d[e].y);g=t.x>=i.x&&r.x<=n.x&&t.y>=i.y&&r.y<=n.y?[d]:r.x<i.x||t.x>n.x||r.y<i.y||t.y>n.y?[]:e.aJ([d],i.x,i.y,n.x,n.y)}for(const e of g){o.reset(e,.25*r);let i=0;i=o.length<=.5*r?1:Math.ceil(o.paddedLength/f)+1;for(let e=0;e<i;e++){const n=e/Math.max(i-1,1),a=o.lerp(n),s=a.x+se,c=a.y+se;m.push(s,c,r,0);const h=s-r,p=c-r,d=s+r,f=c+r;if(T=T&&this.isOffscreen(h,p,d,f),w=w||this.isInsideGrid(h,p,d,f),"always"!==t&&this.grid.hitTestCircle(s,c,r,t,u)&&(x=!0,!l))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!l&&x||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:x}}projectPathToScreenSpace(t,r){const i=function(t,r){const i=e.N();return e.aB(i,r.pitchedLabelPlaneMatrix),t.map(t=>{const e=$t(t.x,t.y,i,r.getElevation),n=r.transform.projectTileCoordinates(e.point.x,e.point.y,r.unwrappedTileID,r.getElevation);return n.point.x=(.5*n.point.x+.5)*r.width,n.point.y=(.5*-n.point.y+.5)*r.height,n})}(t,r);return function(t){let e=0,r=0,i=0,n=0;for(let o=0;o<t.length;o++)t[o].isOccluded?(i=o+1,n=0):(n++,n>r&&(r=n,e=i));return t.slice(e,e+r)}(i)}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const r=[],i=new e.aa;for(const n of t){const t=new e.P(n.x+se,n.y+se);i.extend(t),r.push(t)}const{minX:n,minY:o,maxX:a,maxY:s}=i,l=this.grid.query(n,o,a,s).concat(this.ignoredGrid.query(n,o,a,s)),c={},u={};for(const t of l){const i=t.key;if(void 0===c[i.bucketInstanceId]&&(c[i.bucketInstanceId]={}),c[i.bucketInstanceId][i.featureIndex])continue;const n=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.aK(r,n)&&(c[i.bucketInstanceId][i.featureIndex]=!0,void 0===u[i.bucketInstanceId]&&(u[i.bucketInstanceId]=[]),u[i.bucketInstanceId].push(i.featureIndex))}return u}insertCollisionBox(t,e,r,i,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,r,i,n,o){const a=r?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)a.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(t,r,i,n,o){if(o){let i;n?(i=[t,r,n(t,r),1],e.aH(i,i,o)):(i=[t,r,0,1],ae(i,i,o));const a=i[3];return{x:(i[0]/a+1)/2*this.transform.width+se,y:(-i[1]/a+1)/2*this.transform.height+se,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const e=this.transform.projectTileCoordinates(t,r,i,n);return{x:(e.point.x+1)/2*this.transform.width+se,y:(1-e.point.y)/2*this.transform.height+se,perspectiveRatio:.5+this.transform.cameraToCenterDistance/e.signedDistanceFromCamera*.5,isOccluded:e.isOccluded,signedDistanceFromCamera:e.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,r,i){const n=this.transform.projectTileCoordinates(t,e,r,i);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,r,i){return r<se||t>=this.screenRightBoundary||i<se||e>this.screenBottomBoundary}isInsideGrid(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.ar([]);return e.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,r,i,n,o,a,s,l,c,u,h){let p=1,d=0,f=0,m=1;const g=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(a&&!o){const t=this.projectAndGetPerspectiveRatio(g+1,_,n,c,h),e=t.x-l.x,r=Math.atan((t.y-l.y)/e)+(e<0?Math.PI:0),i=Math.sin(r),o=Math.cos(r);p=o,d=i,f=-i,m=o}else if(!a&&o){const t=Ut(this.transform);p=t.vecEast[0],d=t.vecEast[1],f=t.vecSouth[0],m=t.vecSouth[1]}let y=l.x,v=l.y,b=r;o&&(y=g,v=_,b=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),b*=this.transform.getPitchedTextCorrection(g,_,n),u||(b*=e.an(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(y+=p*u.x*b+f*u.y*b,v+=d*u.x*b+m*u.y*b);const x=t.x1*b,w=t.x2*b,T=(x+w)/2,S=t.y1*b,P=t.y2*b,M=(S+P)/2,A=[{offsetX:x,offsetY:S},{offsetX:T,offsetY:S},{offsetX:w,offsetY:S},{offsetX:w,offsetY:M},{offsetX:w,offsetY:P},{offsetX:T,offsetY:P},{offsetX:x,offsetY:P},{offsetX:x,offsetY:M}];let E=[];for(const{offsetX:t,offsetY:r}of A)E.push(new e.P(y+p*t+f*r,v+d*t+m*r));let I=!1;if(o){const t=E.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,c,h));I=t.some(t=>!t.isOccluded),E=t.map(t=>new e.P(t.x,t.y))}else I=!0;return{box:e.aL(E),allPointsOccluded:!I}}}class ce{constructor(t,e,r,i){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class ue{constructor(t,e,r,i,n){this.text=new ce(t?t.text:null,e,r,n),this.icon=new ce(t?t.icon:null,e,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class he{constructor(t,e,r){this.text=t,this.icon=e,this.skipFade=r}}class pe{constructor(t,e,r,i,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}}class de{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function fe(t,r,i,n,o){const{horizontalAlign:a,verticalAlign:s}=e.aS(t);return new e.P(-(a-.5)*r+n[0]*o,-(s-.5)*i+n[1]*o)}class me{constructor(t,e,r,i,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new le(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new de(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(r,i)=>e.getElevation(t,r,i):null}getBucketParts(t,r,i,n){const o=i.getBucket(r),a=i.latestFeatureIndex;if(!o||!a||r.id!==o.layerIds[0])return;const s=i.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/e.a5,p=i.tileID.toUnwrapped(),d="map"===l.get("text-rotation-alignment"),f=e.aN(i,1,this.transform.zoom),m=e.aO(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),g=e.aO(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),_=Nt(d,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new pe(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const y={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:h,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.ay(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const e of o.sortKeyRanges){const{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=e;t.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y,v,b){const x=e.aP[t.textAnchor],w=[t.textOffset0,t.textOffset1],T=fe(x,i,n,w,o),S=this.collisionIndex.placeCollisionBox(r,p,l,c,u,s,a,g,h.predicate,v,T,b);if((!y||this.collisionIndex.placeCollisionBox(y,p,l,c,u,s,a,_,h.predicate,v,T,b).placeable)&&S.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:w,width:i,height:n,anchor:x,textBoxScale:o,prevAnchor:t},this.markUsedJustification(f,x,d,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,d),this.placedOrientations[d.crossTileID]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(t,r,i){const{bucket:n,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:p,partiallyEvaluatedTextSize:d,collisionGroup:f}=t.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=e.aQ(o,"text-overlap","text-allow-overlap"),y="always"===_,v=e.aQ(o,"icon-overlap","icon-allow-overlap"),b="always"===v,x="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),P=y&&(b||!n.hasIconData()||g),M=b&&(y||!n.hasTextData()||m);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);const A=this.retainedQueryData[n.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(A),I=this.transform.getFastPathSimpleProjectionMatrix(A),C=(t,p,b)=>{var S,C;if(r[t.crossTileID])return;if(h)return void(this.placements[t.crossTileID]=new he(!1,!1,!1));let D=!1,z=!1,k=!0,R=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},F={placeable:!1},B=null,O=null,j=null,N=0,V=0,U=0;p.textFeatureIndex?N=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(N=t.featureIndex),p.verticalTextFeatureIndex&&(V=p.verticalTextFeatureIndex);const $=p.textBox;if($){const r=r=>{let i=e.az.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,i=e,this.markUsedOrientation(n,i,t))}return i},o=(r,i)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const t of n.writingModes)if(t===e.az.vertical?(L=i(),F=L):L=r(),L&&L.placeable)break}else L=r()},c=t.textAnchorOffsetStartIndex,h=t.textAnchorOffsetEndIndex;if(h===c){const i=(e,r)=>{const i=this.collisionIndex.placeCollisionBox(e,_,u,A,l,w,x,a,f.predicate,E,void 0,I);return i&&i.placeable&&(this.markUsedOrientation(n,r,t),this.placedOrientations[t.crossTileID]=r),i};o(()=>i($,e.az.horizontal),()=>{const r=p.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&r?i(r,e.az.vertical):{box:null,offscreen:null}}),r(L&&L.placeable)}else{let d=e.aP[null===(C=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[t.crossTileID])||void 0===C?void 0:C.anchor];const m=(e,r,o)=>{const p=e.x2-e.x1,m=e.y2-e.y1,g=t.textBoxScale,y=T&&"never"===v?r:null;let b=null,S="never"===_?1:2,P="never";d&&S++;for(let r=0;r<S;r++){for(let r=c;r<h;r++){const i=n.textAnchorOffsets.get(r);if(d&&i.textAnchor!==d)continue;const c=this.attemptAnchorPlacement(i,e,p,m,g,x,w,u,A,l,f,P,t,n,o,a,s,y,E);if(c&&(b=c.placedGlyphBoxes,b&&b.placeable))return D=!0,R=c.shift,b}d?d=null:P=_}return i&&!b&&(b={box:this.collisionIndex.placeCollisionBox($,"always",u,A,l,w,x,a,f.predicate,E,void 0,I).box,offscreen:!1,placeable:!1,occluded:!1}),b};o(()=>m($,p.iconBox,e.az.horizontal),()=>{const r=p.verticalTextBox;return n.allowVerticalPlacement&&(!L||!L.placeable)&&t.numVerticalGlyphVertices>0&&r?m(r,p.verticalIconBox,e.az.vertical):{box:null,occluded:!0,offscreen:null}}),L&&(D=L.placeable,k=L.offscreen);const g=r(L&&L.placeable);if(!D&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(n,e.anchor,t,g))}}}if(B=L,D=B&&B.placeable,k=B&&B.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){const r=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),s=e.aA(n.textSizeData,d,r),u=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(_,r,n.lineVertexArray,n.glyphOffsetArray,s,l,c,i,w,f.predicate,t.collisionCircleDiameter,u,a,E),O.circles.length&&O.collisionDetected&&!i&&e.w("Collisions detected, but collision boxes are not shown"),D=y||O.circles.length>0&&!O.collisionDetected,k=k&&O.offscreen}if(p.iconFeatureIndex&&(U=p.iconFeatureIndex),p.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,v,u,A,l,w,x,s,f.predicate,E,T&&R?R:void 0,I);F&&F.placeable&&p.verticalIconBox?(j=t(p.verticalIconBox),z=j.placeable):(j=t(p.iconBox),z=j.placeable),k=k&&j.offscreen}const G=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,q=g||0===t.numIconVertices;G||q?q?G||(z=z&&D):D=z&&D:z=D=z&&D;const Z=z&&j.placeable;if(D&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,_,o.get("text-ignore-placement"),n.bucketInstanceId,F&&F.placeable&&V?V:N,f.ID),Z&&this.collisionIndex.insertCollisionBox(j.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,U,f.ID),O&&D&&this.collisionIndex.insertCollisionCircles(O.circles,_,o.get("text-ignore-placement"),n.bucketInstanceId,N,f.ID),i&&this.storeCollisionData(n.bucketInstanceId,b,p,B,j,O),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new he((D||P)&&!(null==B?void 0:B.occluded),(z||M)&&!(null==j?void 0:j.occluded),k||n.justReloaded),r[t.crossTileID]=!0};if(S){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){const r=e[t];C(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)C(n.symbolInstances.get(e),n.collisionArrays[e],e);n.justReloaded=!1}storeCollisionData(t,e,r,i,n,o){if(r.textBox||r.iconBox){let o,a;this.collisionBoxArrays.has(t)?o=this.collisionBoxArrays.get(t):(o=new Map,this.collisionBoxArrays.set(t,o)),o.has(e)?a=o.get(e):(a={text:null,icon:null},o.set(e,a)),r.textBox&&(a.text=i.box),r.iconBox&&(a.icon=n.box)}if(o){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<o.circles.length;t+=4)e.push(o.circles[t+0]-se),e.push(o.circles[t+1]-se),e.push(o.circles[t+2]),e.push(o.collisionDetected?1:0)}}markUsedJustification(t,r,i,n){let o;o=n===e.az.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[e.aR(r)];const a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(const e of a)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=o>=0&&e!==o?0:i.crossTileID)}markUsedOrientation(t,r,i){const n=r===e.az.horizontal||r===e.az.horizontalOnly?r:0,o=r===e.az.vertical?r:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const e of a)t.text.placedSymbolArray.get(e).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const i=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=n[t];o?(this.opacities[t]=new ue(o,i,e.text,e.icon),r=r||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new ue(null,i,e.text,e.icon,e.skipFade),r=r||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new ue(e,i,!1,!1);n.isHidden()||(this.opacities[t]=n,r=r||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const r={};for(const i of e){const e=i.getBucket(t);e&&i.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(t,r,i,n){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const o=t.layers[0],a=o.layout,s=new ue(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===a.get("text-rotation-alignment"),p="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),f=new ue(null,0,l&&(c||!t.hasIconData()||a.get("icon-optional")),c&&(l||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const m=(t,e,r)=>{for(let i=0;i<e/4;i++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices=t.hasVisibleVertices||r!==Pe},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let r=0;r<t.symbolInstances.length;r++){const n=t.symbolInstances.get(r),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:a,crossTileID:l}=n;let c=this.opacities[l];i[l]?c=s:c||(c=f,this.opacities[l]=c),i[l]=!0;const _=n.numIconVertices>0,y=this.placedOrientations[n.crossTileID],v=y===e.az.vertical,b=y===e.az.horizontal||y===e.az.horizontalOnly;if(o>0||a>0){const e=Se(c.text);m(t.text,o,v?Pe:e),m(t.text,a,b?Pe:e);const r=c.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=r||v?1:0)}),n.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=r||b?1:0);const i=this.variableOffsets[n.crossTileID];i&&this.markUsedJustification(t,i.anchor,n,y);const s=this.placedOrientations[n.crossTileID];s&&(this.markUsedJustification(t,"left",n,s),this.markUsedOrientation(t,s,n))}if(_){const e=Se(c.icon),r=!(d&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(m(t.icon,n.numIconVertices,r?e:Pe),t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,n.numVerticalIconVertices,r?Pe:e),t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const x=g&&g.has(r)?g.get(r):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[r];if(i){let r=new e.P(0,0);if(i.textBox||i.verticalTextBox){let e=!0;if(u){const t=this.variableOffsets[l];t?(r=fe(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),h&&r._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):e=!1}if(i.textBox||i.verticalTextBox){let n;i.textBox&&(n=v),i.verticalTextBox&&(n=b),ge(t.textCollisionBox.collisionVertexArray,c.text.placed,!e||n,x.text,r.x,r.y)}}if(i.iconBox||i.verticalIconBox){const e=Boolean(!b&&i.verticalIconBox);let n;i.iconBox&&(n=e),i.verticalIconBox&&(n=!e),ge(t.iconCollisionBox.collisionVertexArray,c.icon.placed,n,x.icon,d?r.x:0,d?r.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}}function ge(t,e,r,i,n,o){i&&0!==i.length||(i=[0,0,0,0]);const a=i[0]-se,s=i[1]-se,l=i[2]-se,c=i[3]-se;t.emplaceBack(e?1:0,r?1:0,n||0,o||0,a,s),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,l,s),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,l,c),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,a,c)}const _e=Math.pow(2,25),ye=Math.pow(2,24),ve=Math.pow(2,17),be=Math.pow(2,16),xe=Math.pow(2,9),we=Math.pow(2,8),Te=Math.pow(2,1);function Se(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*_e+e*ye+r*ve+e*be+r*xe+e*we+r*Te+e}const Pe=0;class Me{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,r,i,n){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,i,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((t,e)=>t.sortKey-e.sortKey));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0;return!1}}class Ae{constructor(t,e,r,i,n,o,a,s){this.placement=new me(t,e,o,a,s),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,r){const i=c(),n=()=>!this._forceFullPlacement&&c()-i>2;for(;this._currentPlacementIndex>=0;){const i=e[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new Me(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ee=512/e.a5/2;class Ie{constructor(t,r,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};const n=new Map;for(let t=0;t<r.length;t++){const e=r.get(t),i=e.key,o=n.get(i);o?o.push(e):n.set(i,[e])}for(const[t,r]of n){const i={positions:r.map(t=>({x:Math.floor(t.anchorX*Ee),y:Math.floor(t.anchorY*Ee)})),crossTileIDs:r.map(t=>t.crossTileID)};if(i.positions.length>128){const t=new e.aT(i.positions.length,16,Uint16Array);for(const{x:e,y:r}of i.positions)t.add(e,r);t.finish(),delete i.positions,i.index=t}this._symbolsByKey[t]=i}}getScaledCoordinates(t,r){const{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=r.canonical,c=Ee/Math.pow(2,l-o),u=(s*e.a5+t.anchorY)*c,h=n*e.a5*Ee;return{x:Math.floor((a*e.a5+t.anchorX)*c-i*e.a5*Ee),y:Math.floor(u-h)}}findMatches(t,e,r){const i=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const o=t.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);if(a.index){const t=a.index.range(s.x-i,s.y-i,s.x+i,s.y+i).sort();for(const e of t){const t=a.crossTileIDs[e];if(!r[t]){r[t]=!0,o.crossTileID=t;break}}}else if(a.positions)for(let t=0;t<a.positions.length;t++){const e=a.positions[t],n=a.crossTileIDs[t];if(Math.abs(e.x-s.x)<=i&&Math.abs(e.y-s.y)<=i&&!r[n]){r[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Ce{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class De{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const r=this.indexes[t],i={};for(const t in r){const n=r[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),i[n.tileID.key]=n}this.indexes[t]=i}this.lng=t}addBucket(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const i=this.usedCrossTileIDs[t.overscaledZ];for(const r in this.indexes){const n=this.indexes[r];if(Number(r)>t.overscaledZ)for(const r in n){const o=n[r];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,i)}else{const o=n[t.scaledTo(Number(r)).key];o&&o.findMatches(e.symbolInstances,t,i)}}for(let t=0;t<e.symbolInstances.length;t++){const n=e.symbolInstances.get(t);n.crossTileID||(n.crossTileID=r.generate(),i[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ie(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const r of e.getCrossTileIDsLists())for(const e of r)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const r in this.indexes){const i=this.indexes[r];for(const n in i)t[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],e=!0)}return e}}class ze{constructor(){this.layerIndexes={},this.crossTileIDs=new Ce,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,r){let i=this.layerIndexes[t.id];void 0===i&&(i=this.layerIndexes[t.id]=new De);let n=!1;const o={};i.handleWrapJump(r);for(const r of e){const e=r.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(r.tileID,e,this.crossTileIDs)&&(n=!0),o[e.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach(t=>{e[t]=!0});for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}var ke="void main() {fragColor=vec4(1.0);}";const Re={prelude:Le("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:Le("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Le("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:Le("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Le("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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:Le("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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:Le(ke,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Le("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:Le("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:Le("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;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:Le("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Le("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Le(ke,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:Le("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:Le("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:Le("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:Le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);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:Le("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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:Le("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*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:Le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Le("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Le("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:Le("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:Le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:Le("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Le("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Le("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Le("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 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:Le("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(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);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,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:Le("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 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:Le("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;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in 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=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && 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);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out 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=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Le("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Le("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Le("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Le("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Le("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Le(t,e){const r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:t=t.replace(r,(t,e,r,i,n)=>(s[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = u_${n};\n#endif\n`)),vertexSource:e=e.replace(r,(t,e,r,i,n)=>{const o="float"===i?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\nout ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`}),staticAttributes:i,staticUniforms:a}}class Fe{constructor(t,e,r){this.vertexBuffer=t,this.indexBuffer=e,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Be=e.aU([{name:"a_pos",type:"Int16",components:2}]);const Oe="#define PROJECTION_MERCATOR",je="mercator";class Ne{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return je}get shaderDefine(){return Oe}get shaderPreludeCode(){return Re.projectionMercator}get vertexShaderPreludeCode(){return Re.projectionMercator.vertexSource}get subdivisionGranularity(){return e.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,r,i,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new e.aW;a.emplaceBack(0,0),a.emplaceBack(e.a5,0),a.emplaceBack(0,e.a5),a.emplaceBack(e.a5,e.a5);const s=t.createVertexBuffer(a,Be.members),l=e.aX.simpleSegment(0,0,4,2),c=new e.aY;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=t.createIndexBuffer(c);return this._cachedMesh=new Fe(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Ve{constructor(t=0,e=0,r=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=i}interpolate(t,r,i){return null!=r.top&&null!=t.top&&(this.top=e.G.number(t.top,r.top,i)),null!=r.bottom&&null!=t.bottom&&(this.bottom=e.G.number(t.bottom,r.bottom,i)),null!=r.left&&null!=t.left&&(this.left=e.G.number(t.left,r.left,i)),null!=r.right&&null!=t.right&&(this.right=e.G.number(t.right,r.right,i)),this}getCenter(t,r){const i=e.an((this.left+t-this.right)/2,0,t),n=e.an((this.top+r-this.bottom)/2,0,r);return new e.P(i,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ve(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ue(t,e){if(!t.renderWorldCopies||t.lngRange)return;const r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}function $e(t){return Math.max(0,Math.floor(t))}class Ge{constructor(t,r){var i;this.applyConstrain=(t,e)=>null!==this._constrainOverride?this._constrainOverride(t,e):this._callbacks.defaultConstrain(t,e),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===(null==r?void 0:r.renderWorldCopies)||!!(null==r?void 0:r.renderWorldCopies),this._minZoom=(null==r?void 0:r.minZoom)||0,this._maxZoom=(null==r?void 0:r.maxZoom)||22,this._minPitch=null==(null==r?void 0:r.minPitch)?0:null==r?void 0:r.minPitch,this._maxPitch=null==(null==r?void 0:r.maxPitch)?60:null==r?void 0:r.maxPitch,this._constrainOverride=null!==(i=null==r?void 0:r.constrainOverride)&&void 0!==i?i:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new e.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=$e(this._zoom),this._scale=e.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ve,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r,i){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=$e(this._zoom),this._scale=e.aq(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Ve(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!i&&t.autoCalculateNearFarZ,r&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const r=e.W(t,-180,180)*Math.PI/180;var n,o,a,s,l,c,u,h,p;this._bearingInRadians!==r&&(this._unmodified=!1,this._bearingInRadians=r,this._calcMatrices(),this._rotationMatrix=i(),n=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(a),p=Math.cos(a),n[0]=s*p+c*h,n[1]=l*p+u*h,n[2]=s*-h+c*p,n[3]=l*-h+u*p)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const r=e.an(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return e.aZ(this._fovInRadians)}setFov(t){t=e.an(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=e.ap(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const r=this.applyConstrain(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=e.aq(r),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this.constrainInternal(),this._calcMatrices()}resize(t,e,r=!0){this._width=t,this._height=e,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new W([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-e.ao,e.ao])}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{const{minX:i,minY:n,maxX:o,maxY:a}=e.aa.fromPoints(r).extend(t);return[new e.P(i,n),new e.P(o,n),new e.P(o,a),new e.P(i,a),new e.P(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(e),this.setZoom(r),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=e.ar(new Float64Array(16));e.Q(t,t,[this._width/2,-this._height/2,1]),e.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=e.ar(new Float64Array(16)),e.Q(t,t,[1,-1,1]),e.O(t,t,[-1,-1,0]),e.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,r,i,n){const o=void 0!==i?i:this.bearing,a=n=void 0!==n?n:this.pitch,{distanceToCenter:s,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,a),{x:c,y:u}=xt(a,o),h=e.a9.fromLngLat(t,r);let p,d,f=e.a_(1,h.y),m=0;do{if(m+=1,m>10)break;d=s/f,p=new e.a9(h.x+c*d,h.y+u*d),f=1/p.meterInMercatorCoordinateUnits()}while(Math.abs(s-d*f)>1e-12);return{center:p.toLngLat(),elevation:l,zoom:e.at(this.height/2/Math.tan(this.fovInRadians/2)/d/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const r=1/this.worldSize,i=e.as(1,this.center.lat)*this.worldSize,n=e.a9.fromLngLat(this.center,this.elevation),o=n.x/r,a=n.y/r,s=n.z/r,l=this.pitch,c=this.bearing,{x:u,y:h,z:p}=xt(l,c),d=this.cameraToCenterDistance,f=o+d*-u,m=a+d*-h,g=s+d*p,{distanceToCenter:_,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(g/i,t,l),v=_*i,b=new e.a9((f+u*v)*r,(m+h*v)*r,0).toLngLat(),x=e.as(1,b.lat),w=e.at(this.height/2/Math.tan(this.fovInRadians/2)/_/x/this.tileSize);this._elevation=y,this._center=b,this.setZoom(w)}_distanceToCenterFromAltElevationPitch(t,r,i){const n=-Math.cos(e.ap(i)),o=t-r;let a,s=r;return n*o>=0||Math.abs(n)<.1?(a=1e4,s=t+a*n):a=-o/n,{distanceToCenter:a,clampedElevation:s}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=e.as(1,this.center.lat)*this.worldSize;return bt(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const r=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/r,t.canonical.y/r,1/r/e.a5,1/r/e.a5]}}class qe{constructor(t,r){this.min=t,this.max=r,this.center=e.a$([],e.b0([],this.min,this.max),.5)}quadrant(t){const r=[t%2==0,t<2],i=e.b1(this.min),n=e.b1(this.max);for(let t=0;t<r.length;t++)i[t]=r[t]?this.min[t]:this.center[t],n[t]=r[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new qe(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let e=!0;for(let r=0;r<t.planes.length;r++){const i=this.intersectsPlane(t.planes[r]);if(0===i)return 0;1===i&&(e=!1)}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],r=t[3];for(let i=0;i<3;i++)t[i]>0?(e+=t[i]*this.min[i],r+=t[i]*this.max[i]):(r+=t[i]*this.min[i],e+=t[i]*this.max[i]);return e>=0?2:r<0?0:1}}class Ze{distanceToTile2d(t,e,r,i){const n=i.distanceX([t,e]),o=i.distanceY([t,e]);return Math.hypot(n,o)}getWrap(t,e,r){return r}getTileBoundingVolume(t,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new e.a2(t.z,r,t.z,t.x,t.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,i)}const c=1<<t.z;return new qe([r+t.x/c,t.y/c,s],[r+(t.x+1)/c,(t.y+1)/c,l])}allowVariableZoom(t,r){const i=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=e.an(78.5-i/2,0,60);return!!r.terrain||t.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class We{constructor(t,e,r){this.points=t,this.planes=e,this.aabb=r}static fromInvProjectionMatrix(t,r=1,i=0,n,o){const a=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=Math.pow(2,i),l=[[-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(i=>function(t,r,i,n){const o=e.aH([],t,r),a=1/o[3]/i*n;return e.b6(o,o,[a,a,1/o[3],a])}(i,t,r,s));n&&function(t,r,i,n){const o=n?4:0,a=n?0:4;let s=0;const l=[],c=[];for(let r=0;r<4;r++){const i=e.b2([],t[r+a],t[r+o]),n=e.b7(i);e.a$(i,i,1/n),l.push(n),c.push(i)}for(let r=0;r<4;r++){const n=e.b8(t[r+o],c[r],i);s=null!==n&&n>=0?Math.max(s,n):Math.max(s,l[r])}const u=function(t,r){const i=e.b2([],t[r[0]],t[r[1]]),n=e.b2([],t[r[2]],t[r[1]]),o=[0,0,0,0];return e.b3(o,e.b4([],i,n)),o[3]=-e.b5(o,t[r[0]]),o}(t,r),h=function(t,r){const i=e.b9(t),n=e.ba([],t,1/i),o=e.b2([],r,e.a$([],n,e.b5(r,n))),a=e.b9(o);if(a>0){const t=Math.sqrt(1-n[3]*n[3]),i=e.a$([],n,-n[3]),s=e.b0([],i,e.a$([],o,t/a));return e.bb(r,s)}return null}(i,u);if(null!==h){const t=h/e.b5(c[0],u);s=Math.min(s,t)}for(let e=0;e<4;e++){const r=Math.min(s,l[e]);t[e+a]=[t[e+o][0]+c[e][0]*r,t[e+o][1]+c[e][1]*r,t[e+o][2]+c[e][2]*r,1]}}(l,a[0],n,o);const c=a.map(t=>{const r=e.b2([],l[t[0]],l[t[1]]),i=e.b2([],l[t[2]],l[t[1]]),n=e.b3([],e.b4([],r,i)),o=-e.b5(n,l[t[1]]);return n.concat(o)}),u=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const t of l)for(let e=0;e<3;e++)u[e]=Math.min(u[e],t[e]),h[e]=Math.max(h[e],t[e]);return new We(l,c,new qe(u,h))}}class He{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,r=!0){this._helper.resize(t,e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,r)=>{r=e.an(+r,this.minZoom,this.maxZoom);const i={center:new e.V(t.lng,t.lat),zoom:r};let n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===n){const t=180-1e-10;n=[-t,t]}const o=this.tileSize*e.aq(i.zoom);let a=0,s=o,l=0,c=o,u=0,h=0;const{x:p,y:d}=this.size;if(this._helper._latRange){const t=this._helper._latRange;a=e.X(t[1])*o,s=e.X(t[0])*o,s-a<d&&(u=d/(s-a))}n&&(l=e.W(e.Y(n[0])*o,0,o),c=e.W(e.Y(n[1])*o,0,o),c<l&&(c+=o),c-l<p&&(h=p/(c-l)));const{x:f,y:m}=gt(o,t);let g,_;const y=Math.max(h||0,u||0);if(y){const t=new e.P(h?(c+l)/2:f,u?(s+a)/2:m);return i.center=_t(o,t).wrap(),i.zoom+=e.at(y),i}if(this._helper._latRange){const t=d/2;m-t<a&&(_=a+t),m+t>s&&(_=s-t)}if(n){const t=(l+c)/2;let r=f;this._helper._renderWorldCopies&&(r=e.W(f,t-o/2,t+o/2));const i=p/2;r-i<l&&(g=l+i),r+i>c&&(g=c-i)}if(void 0!==g||void 0!==_){const t=new e.P(null!=g?g:f,null!=_?_:m);i.center=_t(o,t).wrap()}return i},this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new Ge({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._coveringTilesDetailsProvider=new Ze}clone(){const t=new He;return t.apply(this,!1),t}apply(t,e,r){this._helper.apply(t,e,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const r=[new e.bc(0,t)];if(this._helper._renderWorldCopies){const i=this.screenPointToMercatorCoordinate(new e.P(0,0)),n=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new e.P(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),c=1;for(let i=s-c;i<=l+c;i++)0!==i&&r.push(new e.bc(i,t))}return r}getCameraFrustum(){return We.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const e=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,r){const i=e.as(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,i),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),a=e.a9.fromLngLat(t),s=new e.a9(a.x-(n.x-o.x),a.y-(n.y-o.y));this.setCenter(null==s?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(e.a9.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(e.a9.fromLngLat(t))}screenPointToLocation(t,e){var r;return null===(r=this.screenPointToMercatorCoordinate(t,e))||void 0===r?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){const r=e.pointCoordinate(t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,r){const i=r||0,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.aH(n,n,this._pixelMatrixInverse),e.aH(o,o,this._pixelMatrixInverse);const a=n[3],s=o[3],l=n[1]/a,c=o[1]/s,u=n[2]/a,h=o[2]/s,p=u===h?0:(i-u)/(h-u);return new e.a9(e.G.number(n[0]/a,o[0]/s,p)/this.worldSize,e.G.number(l,c,p)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){const n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return e.aH(n,n,i),new e.P(n[0]/n[3],n[1]/n[3])}getBounds(){const t=Math.max(0,this._helper._height/2-yt(this));return(new W).extend(this.screenPointToLocation(new e.P(0,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new e.P(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?null!=e.pointCoordinate(t):t.y>this.height/2-yt(this)}calculatePosMatrix(t,r=!1,i){var n;const o=null!==(n=t.key)&&void 0!==n?n:e.bd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const t=a.get(o);return i?t.f32:t.f64}const s=vt(t,this.worldSize);e.S(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),i?l.f32:l.f64}calculateFogMatrix(t){const r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);const n=vt(t,this.worldSize);return e.S(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=t-n*this._helper._pixelPerMeter/Math.cos(r),a=n<0?o:t,s=Math.PI/2+this.pitchInRadians,l=e.ap(this.fov)*(Math.abs(Math.cos(e.ap(this.roll)))*this.height+Math.abs(Math.sin(e.ap(this.roll)))*this.width)/this.height*(.5+i.y/this.height),c=Math.sin(l)*a/Math.sin(e.an(Math.PI-s-l,.01,Math.PI-.01)),u=yt(this),h=Math.atan(u/this._helper.cameraToCenterDistance),p=e.ap(.75),d=h>p?2*h*(.5+i.y/(2*u)):p,f=Math.sin(d)*a/Math.sin(e.an(Math.PI-s-d,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-r)*m+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,r=gt(this.worldSize,this.center),i=r.x,n=r.y;this._helper._pixelPerMeter=e.as(1,this.center.lat)*this.worldSize;const o=e.ap(Math.min(this.pitch,mt)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let s;this._calculateNearFarZIfNeeded(a,o,t),s=new Float64Array(16),e.be(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),e.aB(this._invProjMatrix,s),s[8]=2*-t.x/this._helper._width,s[9]=2*t.y/this._helper._height,this._projectionMatrix=e.bf(s),e.Q(s,s,[1,-1,1]),e.O(s,s,[0,0,-this._helper.cameraToCenterDistance]),e.bg(s,s,-this.rollInRadians),e.bh(s,s,this.pitchInRadians),e.bg(s,s,-this.bearingInRadians),e.O(s,s,[-i,-n,0]),this._mercatorMatrix=e.Q([],s,[this.worldSize,this.worldSize,this.worldSize]),e.Q(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=e.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),e.O(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=e.aB([],s);const l=[0,0,-1,1];e.aH(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),e.be(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,e.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),e.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),e.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),e.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),e.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),e.O(this._fogMatrix,this._fogMatrix,[-i,-n,0]),e.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),e.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=e.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=i-Math.round(i)+h*c+p*u,f=n-Math.round(n)+h*u+p*c,m=new Float64Array(s);if(e.O(m,m,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=e.aB(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new e.P(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.aH(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=e.as(1,this.center.lat)*this.worldSize;return bt(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,r){const i=e.a9.fromLngLat(t),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return e.aH(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){const{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=t,o=this._helper.getMercatorTileCoordinates(r),a=r?this.calculatePosMatrix(r,i,!0):null;let s;return s=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:a||e.bi(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,r){return 1}transformLightDirection(t){return e.b1(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,r,i,n){const o=this.calculatePosMatrix(i);let a;n?(a=[t,r,n(t,r),1],e.aH(a,a,o)):(a=[t,r,0,1],ae(a,a,o));const s=a[3];return{point:new e.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(const e of t)this.calculatePosMatrix(e)}getMatrixForModel(t,r){const i=e.a9.fromLngLat(t,r),n=i.meterInMercatorCoordinateUnits(),o=e.bj();return e.O(o,o,[i.x,i.y,i.z]),e.bg(o,o,Math.PI),e.bh(o,o,Math.PI/2),e.Q(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const r=new e.a2(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=vt(r,this.worldSize);e.S(n,this._viewProjMatrix,n),i.tileMercatorCoords=[0,0,1,1];const o=[e.a5,e.a5,this.worldSize/this._helper.pixelsPerMeter],a=e.bk();return e.Q(a,n,o),i.fallbackMatrix=a,i.mainMatrix=a,i}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Xe(){e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Ye(t){if(t.useSlerp)if(t.k<1){const r=e.bl(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),i=e.bl(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);e.bm(n,r,i,t.k);const o=e.bn(n);t.tr.setRoll(o.roll),t.tr.setPitch(o.pitch),t.tr.setBearing(o.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(e.G.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(e.G.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(e.G.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Ke(t,r,i,n,o){const a=o.padding,s=gt(o.worldSize,i.getNorthWest()),l=gt(o.worldSize,i.getNorthEast()),c=gt(o.worldSize,i.getSouthEast()),u=gt(o.worldSize,i.getSouthWest()),h=e.ap(-n),p=s.rotate(h),d=l.rotate(h),f=c.rotate(h),m=u.rotate(h),g=new e.P(Math.max(p.x,d.x,m.x,f.x),Math.max(p.y,d.y,m.y,f.y)),_=new e.P(Math.min(p.x,d.x,m.x,f.x),Math.min(p.y,d.y,m.y,f.y)),y=g.sub(_),v=(o.width-(a.left+a.right+r.left+r.right))/y.x,b=(o.height-(a.top+a.bottom+r.top+r.bottom))/y.y;if(b<0||v<0)return void Xe();const x=Math.min(e.at(o.scale*Math.min(v,b)),t.maxZoom),w=e.P.convert(t.offset),T=new e.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(e.ap(n)),S=w.add(T).mult(o.scale/e.aq(x));return{center:_t(o.worldSize,s.add(c).div(2).sub(S)),zoom:x,bearing:n}}class Je{get useGlobeControls(){return!1}handlePanInertia(t,e){const r=t.mag(),i=Math.abs(yt(e));return{easingOffset:t.mult(Math.min(.75*i/r,1)),easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,r){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(r,t.around)}cameraForBoxAndBearing(t,e,r,i,n){return Ke(t,e,r,i,n)}handleJumpToCenterZoom(t,r){t.zoom!==(void 0!==r.zoom?+r.zoom:t.zoom)&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(e.V.convert(r.center))}handleEaseTo(t,r){const i=t.zoom,n=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},a={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},s=void 0!==r.zoom,l=!t.isPaddingEqual(r.padding);let c=!1;const u=s?+r.zoom:t.zoom;let h=t.centerPoint.add(r.offsetAsPoint);const p=t.screenPointToLocation(h),{center:d,zoom:f}=t.applyConstrain(e.V.convert(r.center||p),null!=u?u:i);Ue(t,d);const m=gt(t.worldSize,p),g=gt(t.worldSize,d).sub(m),_=e.aq(f-i);return c=f!==i,{easeFunc:s=>{if(c&&t.setZoom(e.G.number(i,f,s)),e.bo(o,a)||Ye({startEulerAngles:o,endEulerAngles:a,tr:t,k:s,useSlerp:o.roll!=a.roll}),l&&(t.interpolatePadding(n,r.padding,s),h=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{const r=e.aq(t.zoom-i),n=f>i?Math.min(2,_):Math.max(.5,_),o=Math.pow(n,1-s),a=_t(t.worldSize,m.add(g.mult(s*o)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,h)}},isZooming:c,elevationCenter:d}}handleFlyTo(t,r){const i=void 0!==r.zoom,n=t.zoom,o=t.applyConstrain(e.V.convert(r.center||r.locationAtOffset),i?+r.zoom:n),a=o.center,s=o.zoom;Ue(t,a);const l=gt(t.worldSize,r.locationAtOffset),c=gt(t.worldSize,a).sub(l),u=c.mag(),h=e.aq(s-n);let p;if(void 0!==r.minZoom){const i=Math.min(+r.minZoom,n,s),o=t.applyConstrain(a,i).zoom;p=e.aq(o-n)}return{easeFunc:(r,i,o,u)=>{t.setZoom(1===r?s:n+e.at(i));const h=1===r?a:_t(t.worldSize,l.add(c.mult(o)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:u}}}class Qe{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}}Qe.Replace=[1,0],Qe.disabled=new Qe(Qe.Replace,e.bp.transparent,[!1,!1,!1,!1]),Qe.unblended=new Qe(Qe.Replace,e.bp.transparent,[!0,!0,!0,!0]),Qe.alphaBlended=new Qe([1,771],e.bp.transparent,[!0,!0,!0,!0]);const tr=2305;class er{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r}}er.disabled=new er(!1,1029,tr),er.backCCW=new er(!0,1029,tr),er.frontCCW=new er(!0,1028,tr);class rr{constructor(t,e,r){this.func=t,this.mask=e,this.range=r}}rr.ReadOnly=!1,rr.ReadWrite=!0,rr.disabled=new rr(519,rr.ReadOnly,[0,1]);const ir=7680;class nr{constructor(t,e,r,i,n,o){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o}}nr.disabled=new nr({func:519,mask:0},0,0,ir,ir,ir);const or=new WeakMap;function ar(t){var e;if(or.has(t))return or.get(t);{const r=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return or.set(t,r),r}}class sr{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const r=t.context,i=r.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;const n=new e.aW;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new e.aY;o.emplaceBack(0,1,2),this._fullscreenTriangle=new Fe(r.createVertexBuffer(n,Be.members),r.createIndexBuffer(o),e.aX.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(i.TEXTURE1);const a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texImage2D(i.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),ar(i)&&(this._pbo=i.createBuffer(),i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.bufferData(i.PIXEL_PACK_BUFFER,4,i.STREAM_READ),i.bindBuffer(i.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,e){const r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,r){const i=this._cachedRenderContext.context,n=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:e.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,n.TRIANGLES,rr.disabled,nr.disabled,Qe.unblended,er.disabled,((t,e)=>({u_input:t,u_output_expected:e}))(t,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&ar(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const t=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&ar(t)){const r=t.clientWaitSync(this._readbackQueue.sync,0,0);if(r===t.WAIT_FAILED)return e.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=sr._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}const lr=e.a5/128;function cr(t,r){const i=void 0!==t.granularity?Math.max(t.granularity,1):1,n=i+(t.generateBorders?2:0),o=i+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),a=n+1,s=o+1,l=t.generateBorders?-1:0,c=t.generateBorders||t.extendToNorthPole?-1:0,u=i+(t.generateBorders?1:0),h=i+(t.generateBorders||t.extendToSouthPole?1:0),p=a*s,d=n*o*6,f=a*s>65536;if(f&&"16bit"===r)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===r,g=new Int16Array(2*p);let _=0;for(let r=c;r<=h;r++)for(let n=l;n<=u;n++){let o=n/i*e.a5;-1===n&&(o=-lr),n===i+1&&(o=e.a5+lr);let a=r/i*e.a5;-1===r&&(a=t.extendToNorthPole?e.br:-lr),r===i+1&&(a=t.extendToSouthPole?e.bs:e.a5+lr),g[_++]=o,g[_++]=a}const y=m?new Uint32Array(d):new Uint16Array(d);let v=0;for(let t=0;t<o;t++)for(let e=0;e<n;e++){const r=e+1+t*a,i=e+(t+1)*a,n=e+1+(t+1)*a;y[v++]=e+t*a,y[v++]=i,y[v++]=r,y[v++]=r,y[v++]=i,y[v++]=n}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const ur=new e.aV({fill:new e.bt(128,2),line:new e.bt(512,0),tile:new e.bt(128,32),stencil:new e.bt(128,1),circle:3});class hr{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Re.projectionGlobe}get vertexShaderPreludeCode(){return Re.projectionMercator.vertexSource}get subdivisionGranularity(){return ur}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new sr(t));const r=e.X(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,i),o=c();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const a=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=e.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,e.bv(a))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,r,i,n){const o=("stencil"===n?ur.stencil:ur.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:o,generateBorders:r,extendToNorthPole:0===e.y&&i,extendToSouthPole:e.y===(1<<e.z)-1&&i})}_getMesh(t,r){const i=this._getMeshKey(r);if(i in this._tileMeshCache)return this._tileMeshCache[i];const n=function(t,r){const i=cr(r,"16bit"),n=e.aW.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),o=e.aY.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new Fe(t.createVertexBuffer(n,Be.members),t.createIndexBuffer(o),e.aX.simpleSegment(0,0,n.length,o.length))}(t,r);return this._tileMeshCache[i]=n,n}recalculate(t){}hasTransition(){const t=c();let e=!1;return e=e||(t-this._errorMeasurementLastChangeTime)/1e3<.7,e=e||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,e}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const pr=new e.t({type:new e.D(e.u.projection.type)});class dr extends e.E{constructor(t){super(),this._transitionable=new e.x(pr,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.H(0)),this._mercatorProjection=new Ne,this._verticalPerspectiveProjection=new hr}get transitionState(){const t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof e.bw){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,e,r,i,n){return this.currentProjection.getMeshFromTileID(t,e,r,i,n)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function fr(t){const e=_r(t.worldSize,t.center.lat);return 2*Math.PI*e}function mr(t,r,i,n,o){const a=1/(1<<o),s=r/e.a5*a+n*a,l=e.bz((t/e.a5*a+i*a)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,u=Math.cos(c),h=new Float64Array(3);return h[0]=Math.sin(l)*u,h[1]=Math.sin(c),h[2]=Math.cos(l)*u,h}function gr(t){return function(t,e){const r=Math.cos(e),i=new Float64Array(3);return i[0]=Math.sin(t)*r,i[1]=Math.sin(e),i[2]=Math.cos(t)*r,i}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function _r(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function yr(t){const r=Math.asin(t[1])/Math.PI*180,i=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(i>1e-6){const n=t[0]/i,o=Math.acos(t[2]/i),a=(n>0?o:-o)/Math.PI*180;return new e.V(e.W(a,-180,180),r)}return new e.V(0,r)}function vr(t){return Math.cos(t*Math.PI/180)}function br(t,r){const i=vr(t),n=vr(r);return e.at(n/i)}function xr(t,r){const i=t.rotate(r.bearingInRadians),n=r.zoom+br(r.center.lat,0),o=e.bu(1/vr(r.center.lat),1/vr(Math.min(Math.abs(r.center.lat),60)),e.bx(n,7,3,0,1)),a=360/fr({worldSize:r.worldSize,center:{lat:r.center.lat}});return new e.V(r.center.lng-i.x*a*o,e.an(r.center.lat+i.y*a,-e.ao,e.ao))}function wr(t){const e=.5*t,r=Math.sin(e),i=Math.cos(e);return Math.log(r+i)-Math.log(i-r)}function Tr(t,r,i,n){const o=t.lat+i*n;if(Math.abs(i)>1){const a=(Math.sign(t.lat+i)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,s=Math.abs(t.lat+i)*Math.PI/180,l=wr(a+n*(s-a)),c=wr(a),u=wr(s);return new e.V(t.lng+r*((l-c)/(u-c)),o)}return new e.V(t.lng+r*n,o)}class Sr{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,e,r,i){const n=`${t.z}_${t.x}_${t.y}_${(null==i?void 0:i.terrain)?"t":""}`,o=this._cache.get(n);if(o)return o;const a=this._cachePrevious.get(n);if(a)return this._cache.set(n,a),a;const s=this._boundingVolumeFactory(t,e,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}class Pr{constructor(t,e,r,i){this.min=r,this.max=i,this.points=t,this.planes=e}static fromAabb(t,e){const r=[];for(let i=0;i<8;i++)r.push([1&~i?t[0]:e[0],1==(i>>1&1)?e[1]:t[1],1==(i>>2&1)?e[2]:t[2]]);return new Pr(r,[[-1,0,0,e[0]],[1,0,0,-t[0]],[0,-1,0,e[1]],[0,1,0,-t[1]],[0,0,-1,e[2]],[0,0,1,-t[2]]],t,e)}static fromCenterSizeAngles(t,r,i){const n=e.bB([],i[0],i[1],i[2]),o=e.bC([],[r[0],0,0],n),a=e.bC([],[0,r[1],0],n),s=e.bC([],[0,0,r[2]],n),l=[...t],c=[...t];for(let e=0;e<8;e++)for(let r=0;r<3;r++){const i=t[r]+o[r]*(1&~e?-1:1)+a[r]*(1==(e>>1&1)?1:-1)+s[r]*(1==(e>>2&1)?1:-1);l[r]=Math.min(l[r],i),c[r]=Math.max(c[r],i)}const u=[];for(let r=0;r<8;r++){const i=[...t];e.b0(i,i,e.a$([],o,1&~r?-1:1)),e.b0(i,i,e.a$([],a,1==(r>>1&1)?1:-1)),e.b0(i,i,e.a$([],s,1==(r>>2&1)?1:-1)),u.push(i)}return new Pr(u,[[...o,-e.b5(o,u[0])],[...a,-e.b5(a,u[0])],[...s,-e.b5(s,u[0])],[-o[0],-o[1],-o[2],-e.b5(o,u[7])],[-a[0],-a[1],-a[2],-e.b5(a,u[7])],[-s[0],-s[1],-s[2],-e.b5(s,u[7])]],l,c)}intersectsFrustum(t){let e=!0;const r=this.points.length,i=this.planes.length,n=t.planes.length,o=t.points.length;for(let i=0;i<n;i++){const n=t.planes[i];let o=0;for(let t=0;t<r;t++){const e=this.points[t];n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]>=0&&o++}if(0===o)return 0;o<r&&(e=!1)}if(e)return 2;for(let e=0;e<i;e++){const r=this.planes[e];let i=0;for(let e=0;e<o;e++){const n=t.points[e];r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]>=0&&i++}if(0===i)return 0}return 1}intersectsPlane(t){const e=this.points.length;let r=0;for(let i=0;i<e;i++){const e=this.points[i];t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0&&r++}return r===e?2:0===r?0:1}}function Mr(t,e,r){const i=t-e;return i<0?-i:Math.max(0,i-r)}function Ar(t,e,r,i,n){const o=t-r;let a;return a=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(a,Mr(e,i,n))}class Er{constructor(){this._boundingVolumeCache=new Sr(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,e,r,i){const n=1<<r.z,o=1/n,a=r.x/n,s=r.y/n;let l=2;return l=Math.min(l,Ar(t,e,a,s,o)),l=Math.min(l,Ar(t,e,a+.5,-s-o,o)),l=Math.min(l,Ar(t,e,a+.5,2-s-o,o)),l}getWrap(t,e,r){const i=1<<e.z,n=1/i,o=e.x/i,a=Mr(t.x,o,n),s=Mr(t.x,o-1,n),l=Mr(t.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(t,e){return Mt(t,e)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,e,r,i){return this._boundingVolumeCache.getTileBoundingVolume(t,e,r,i)}_computeTileBoundingVolume(t,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new e.a2(t.z,r,t.z,t.x,t.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,i)}if(s/=e.bE,l/=e.bE,s+=1,l+=1,t.z<=0)return Pr.fromAabb([-l,-l,-l],[l,l,l]);if(1===t.z)return Pr.fromAabb([0===t.x?-l:0,0===t.y?0:-l,-l],[0===t.x?0:l,0===t.y?l:0,l]);{const r=[mr(0,0,t.x,t.y,t.z),mr(e.a5,0,t.x,t.y,t.z),mr(e.a5,e.a5,t.x,t.y,t.z),mr(0,e.a5,t.x,t.y,t.z)],i=[];for(const t of r)i.push(e.a$([],t,l));if(l!==s)for(const t of r)i.push(e.a$([],t,s));0===t.y&&i.push([0,1,0]),t.y===(1<<t.z)-1&&i.push([0,-1,0]);const n=[1,1,1],o=[-1,-1,-1];for(const t of i)for(let e=0;e<3;e++)n[e]=Math.min(n[e],t[e]),o[e]=Math.max(o[e],t[e]);const a=mr(e.a5/2,e.a5/2,t.x,t.y,t.z),c=e.b4([],[0,1,0],a);e.b3(c,c);const u=e.b4([],a,c);e.b3(u,u);const h=e.b4([],r[2],r[1]);e.b3(h,h);const p=e.b4([],r[0],r[3]);e.b3(p,p),i.push(e.a$([],a,l)),t.y>=(1<<t.z)/2&&i.push(e.a$([],mr(e.a5/2,0,t.x,t.y,t.z),l)),t.y<(1<<t.z)/2&&i.push(e.a$([],mr(e.a5/2,e.a5,t.x,t.y,t.z),l));const d=Ir(a,i),f=Ir(u,i),m=[-a[0],-a[1],-a[2],d.max],g=[a[0],a[1],a[2],-d.min],_=[-u[0],-u[1],-u[2],f.max],y=[u[0],u[1],u[2],-f.min],v=[...h,0],b=[...p,0],x=[];return 0===t.y?x.push(e.bD(b,v,m),e.bD(b,v,g)):x.push(e.bD(_,v,m),e.bD(_,v,g),e.bD(_,b,m),e.bD(_,b,g)),t.y===(1<<t.z)-1?x.push(e.bD(b,v,m),e.bD(b,v,g)):x.push(e.bD(y,v,m),e.bD(y,v,g),e.bD(y,b,m),e.bD(y,b,g)),new Pr(x,[m,g,_,y,v,b],n,o)}}}function Ir(t,r){let i=1/0,n=-1/0;for(const o of r){const r=e.b5(t,o);i=Math.min(i,r),n=Math.max(n,r)}return{min:i,max:n}}class Cr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=e.bF(),this._projectionMatrix=e.bj(),this._globeViewProjMatrix32f=e.bi(),this._globeViewProjMatrixNoCorrection=e.bj(),this._globeViewProjMatrixNoCorrectionInverted=e.bj(),this._globeProjMatrixInverted=e.bj(),this._cameraPosition=e.bA(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(t,r)=>{const i=e.an(t.lat,-e.ao,e.ao),n=e.an(+r,this.minZoom+br(0,i),this.maxZoom);return{center:new e.V(t.lng,i),zoom:n}},this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new Ge({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._coveringTilesDetailsProvider=new Er}clone(){const t=new Cr;return t.apply(this,!1),t}apply(t,e,r){this._globeLatitudeErrorCorrectionRadians=r||0,this._helper.apply(t,e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=e.bA();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:e,applyGlobeMatrix:r}=t,i=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const r=this.pitchInRadians,i=this.cameraToCenterDistance/t,n=Math.sin(r)*i,o=Math.cos(r)*i+1,a=1/Math.sqrt(n*n+o*o)*1;let s=-n,l=o;const c=Math.sqrt(s*s+l*l);s/=c,l/=c;const u=[0,s,l];e.bG(u,u,[0,0,0],-this.bearingInRadians),e.bH(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),e.bI(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/e.b7(u);return e.a$(u,u,h),[...u,-a*h]}isLocationOccluded(t){return!this.isSurfacePointVisible(gr(t))}transformLightDirection(t){const r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),o=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],a=[o[2],0,-o[0]],s=[0,0,0];e.b4(s,a,o),e.b3(a,a),e.b3(s,s);const l=[0,0,0];return e.b3(l,[a[0]*t[0]+s[0]*t[1]+o[0]*t[2],a[1]*t[0]+s[1]*t[1]+o[1]*t[2],a[2]*t[0]+s[2]*t[1]+o[2]*t[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){const n=function(t,r,i){const n=1/(1<<i.z);return new e.a9(t/e.a5*n+i.x*n,r/e.a5*n+i.y*n)}(t,r,i.canonical),o=(a=n.y,[e.bz(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);var a;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(t,r,i,n){const o=i.canonical,a=mr(t,r,o.x,o.y,o.z),s=1+(n?n(t,r):0)/e.bE,l=[a[0]*s,a[1]*s,a[2]*s,1];e.aH(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,u=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new e.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=_r(this.worldSize,this.center.lat),r=e.bk(),i=e.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),e.be(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;r[8]=2*-n.x/this._helper._width,r[9]=2*n.y/this._helper._height,this._projectionMatrix=e.bf(r),this._globeProjMatrixInverted=e.bk(),e.aB(this._globeProjMatrixInverted,r),e.O(r,r,[0,0,-this.cameraToCenterDistance]),e.bg(r,r,this.rollInRadians),e.bh(r,r,-this.pitchInRadians),e.bg(r,r,this.bearingInRadians),e.O(r,r,[0,0,-t]);const o=e.bA();o[0]=t,o[1]=t,o[2]=t,e.bh(i,r,this.center.lat*Math.PI/180),e.bJ(i,i,-this.center.lng*Math.PI/180),e.Q(i,i,o),this._globeViewProjMatrixNoCorrection=i,e.bh(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),e.bJ(r,r,-this.center.lng*Math.PI/180),e.Q(r,r,o),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=e.bk(),e.aB(this._globeViewProjMatrixNoCorrectionInverted,i);const a=e.bA();this._cameraPosition=e.bA(),this._cameraPosition[2]=this.cameraToCenterDistance/t,e.bG(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),e.bH(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),e.bG(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),e.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),e.bH(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),e.bI(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const s=e.bf(this._globeViewProjMatrixNoCorrectionInverted);e.Q(s,s,[1,1,-1]),this._cachedFrustum=We.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){e.w("calculateFogMatrix is not supported on globe projection.");const r=e.bk();return e.ar(r),r}getVisibleUnwrappedCoordinates(t){return[new e.bc(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&e.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixNoCorrection)return 1;const i=gr(t);e.a$(i,i,1+r/e.bE);const n=e.bF();return e.aH(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){const t=.5*this.width,r=.5*this.height,i=[new e.P(0,0),new e.P(t,0),new e.P(this.width,0),new e.P(this.width,r),new e.P(this.width,this.height),new e.P(t,this.height),new e.P(0,this.height),new e.P(0,r)],n=[];for(const t of i)n.push(this.unprojectScreenPoint(t));let o=0,a=0,s=0,l=0;const c=this.center;for(const t of n){const r=e.bK(c.lng,t.lng),i=e.bK(c.lat,t.lat);r<a&&(a=r),r>o&&(o=r),i<l&&(l=i),i>s&&(s=i)}const u=[c.lng+a,c.lat+l,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new W(u)}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}setLocationAtPoint(t,r){const i=gr(this.unprojectScreenPoint(r)),n=gr(t),o=e.bA();e.bL(o);const a=e.bA();e.bI(a,i,o,-this.center.lng*Math.PI/180),e.bH(a,a,o,this.center.lat*Math.PI/180);const s=n[0]*n[0]+n[2]*n[2],l=a[0]*a[0];if(s<l)return;const c=Math.sqrt(s-l),u=-c,h=e.bM(n[0],n[2],a[0],c),p=e.bM(n[0],n[2],a[0],u),d=e.bA();e.bI(d,n,o,-h);const f=e.bM(d[1],d[2],a[1],a[2]),m=e.bA();e.bI(m,n,o,-p);const g=e.bM(m[1],m[2],a[1],a[2]),_=.5*Math.PI,y=f>=-_&&f<=_,v=g>=-_&&g<=_;let b,x;if(y&&v){const t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;e.bN(h,t)+e.bN(f,r)<e.bN(p,t)+e.bN(g,r)?(b=h,x=f):(b=p,x=g)}else if(y)b=h,x=f;else{if(!v)return;b=p,x=g}const w=b/Math.PI*180,T=x/Math.PI*180,S=this.center.lat;this.setCenter(new e.V(w,e.an(T,-90,90))),this.setZoom(this.zoom+br(S,this.center.lat))}locationToScreenPoint(t,r){const i=gr(t);if(r){const n=r.getElevationForLngLatZoom(t,this._helper._tileZoom);e.a$(i,i,1+n/e.bE)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){const r=e.bF();return e.aH(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new e.P((.5*r[0]+.5)*this.width,(.5*-r[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){const e=r.pointCoordinate(t);if(e)return e}return e.a9.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var r;return null===(r=this.screenPointToMercatorCoordinate(t,e))||void 0===r?void 0:r.toLngLat()}isPointOnMapSurface(t,e){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,i)}getRayDirectionFromPixel(t){const r=e.bF();r[0]=t.x/this.width*2-1,r[1]=-1*(t.y/this.height*2-1),r[2]=1,r[3]=1,e.aH(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];const i=e.bA();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];const n=e.bA();return e.b3(n,i),n}isSurfacePointVisible(t){const e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const r=e.bF();return e.aH(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(t,r){const i=e.b5(t,r),n=e.bA(),o=e.bA();e.a$(o,r,i),e.b2(n,t,o);const a=1-e.b5(n,n);if(a<0)return null;const s=e.b5(t,t)-1,l=-i+(i<0?1:-1)*Math.sqrt(a),c=s/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(t){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(r,i);if(n){const t=e.bA();e.b0(t,r,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);const o=e.bA();return e.b3(o,t),yr(o)}const o=this._cachedClippingPlane,a=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],s=-e.bb(o,r)/a,l=e.bA();if(s>0)e.b0(l,r,[i[0]*s,i[1]*s,i[2]*s]);else{const t=e.bA();e.b0(t,r,[2*i[0],2*i[1],2*i[2]]);const n=e.bb(this._cachedClippingPlane,t);e.b2(l,t,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(t){const r=e.bA();return r[0]=t[0]*-t[3],r[1]=t[1]*-t[3],r[2]=t[2]*-t[3],{center:r,radius:Math.sqrt(1-t[3]*t[3])}}(o);return yr(function(t,r,i){const n=e.bA();e.b2(n,i,t);const o=e.bA();return e.by(o,t,n,r/e.b9(n)),o}(c.center,c.radius,l))}getMatrixForModel(t,r){const i=e.V.convert(t),n=1/e.bE,o=e.bj();return e.bJ(o,o,i.lng/180*Math.PI),e.bh(o,o,-i.lat/180*Math.PI),e.O(o,o,[0,0,1+r/e.bE]),e.bh(o,o,.5*Math.PI),e.Q(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const r=this.getProjectionData({overscaledTileID:new e.a2(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}}class Dr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,r=!0){this._helper.resize(t,e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(t,e)=>this.currentTransform.defaultConstrain(t,e),this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new Ge({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._globeness=1,this._mercatorTransform=new He,this._verticalPerspectiveTransform=new Cr}clone(){const t=new Dr;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,e){this._helper.apply(t,e),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const e=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:e.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return e.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return e.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,i){const n=this._mercatorTransform.getPitchedTextCorrection(t,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return e.bu(n,o,this._globeness)}projectTileCoordinates(t,e,r,i){return this.currentTransform.projectTileCoordinates(t,e,r,i)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){const e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;const r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=e.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class zr{get useGlobeControls(){return!0}handlePanInertia(t,r){const i=xr(t,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new e.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){const i=t.around,n=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);const o=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);const a=r.zoom-o;if(0===a)return;const s=e.bK(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=e.bK(r.center.lat,n.lat),u=r.getRayDirectionFromPixel(i),h=r.cameraPosition,p=-1*e.b5(h,u),d=e.bA();e.b0(d,h,[u[0]*p,u[1]*p,u[2]*p]);const f=e.b7(d)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=_r(r.worldSize,r.center.lat)/Math.min(r.width,r.height),_=e.bx(g,.9,.5,1,.25),y=(1-e.aq(-a))*Math.min(m,_),v=r.center.lat,b=r.zoom,x=new e.V(r.center.lng+l*y,e.an(r.center.lat+c*y,-e.ao,e.ao));r.setLocationAtPoint(n,i);const w=r.center,T=e.bx(Math.abs(s),45,85,0,1),S=e.bx(g,.75,.35,0,1),P=Math.pow(Math.max(T,S),.25),M=e.bK(w.lng,x.lng),A=e.bK(w.lat,x.lat);r.setCenter(new e.V(w.lng+M*P,w.lat+A*P).wrap()),r.setZoom(b+br(v,r.center.lat))}handleMapControlsPan(t,e,r){if(!t.panDelta)return;const i=e.center.lat,n=e.zoom;e.setCenter(xr(t.panDelta,e).wrap()),e.setZoom(n+br(i,e.center.lat))}cameraForBoxAndBearing(t,r,i,n,o){const a=Ke(t,r,i,n,o),s=r.left/o.width*2-1,l=(o.width-r.right)/o.width*2-1,c=r.top/o.height*-2+1,u=(o.height-r.bottom)/o.height*-2+1,h=e.bK(i.getWest(),i.getEast())<0,p=h?i.getEast():i.getWest(),d=h?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=p+.5*e.bK(p,d),_=f+.5*e.bK(f,m),y=o.clone();y.setCenter(a.center),y.setBearing(a.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(a.zoom);const v=y.modelViewProjectionMatrix,b=[gr(i.getNorthWest()),gr(i.getNorthEast()),gr(i.getSouthWest()),gr(i.getSouthEast()),gr(new e.V(d,_)),gr(new e.V(p,_)),gr(new e.V(g,f)),gr(new e.V(g,m))],x=gr(a.center);let w=Number.POSITIVE_INFINITY;for(const t of b)s<0&&(w=zr.getLesserNonNegativeNonNull(w,zr.solveVectorScale(t,x,v,"x",s))),l>0&&(w=zr.getLesserNonNegativeNonNull(w,zr.solveVectorScale(t,x,v,"x",l))),c>0&&(w=zr.getLesserNonNegativeNonNull(w,zr.solveVectorScale(t,x,v,"y",c))),u<0&&(w=zr.getLesserNonNegativeNonNull(w,zr.solveVectorScale(t,x,v,"y",u)));if(Number.isFinite(w)&&0!==w)return a.zoom=y.zoom+e.at(w),a;Xe()}handleJumpToCenterZoom(t,r){const i=t.center.lat,n=t.applyConstrain(r.center?e.V.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());const o=void 0!==r.zoom?+r.zoom:t.zoom+br(i,n.lat);t.zoom!==o&&t.setZoom(o)}handleEaseTo(t,r){const i=t.zoom,n=t.center,o=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,c=!t.isPaddingEqual(r.padding);let u=!1;const h=r.center?e.V.convert(r.center):n,p=t.applyConstrain(h,i).center;Ue(t,p);const d=t.clone();d.setCenter(p),d.setZoom(l?+r.zoom:i+br(n.lat,h.lat)),d.setBearing(r.bearing);const f=new e.P(e.an(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),e.an(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(p,f);const m=(r.offset&&r.offsetAsPoint.mag())>0?d.center:p,g=l?+r.zoom:i+br(n.lat,m.lat),_=i+br(n.lat,0),y=g+br(m.lat,0),v=e.bK(n.lng,m.lng),b=e.bK(n.lat,m.lat),x=e.aq(y-_);return u=g!==i,{easeFunc:i=>{if(e.bo(a,s)||Ye({startEulerAngles:a,endEulerAngles:s,tr:t,k:i,useSlerp:a.roll!=s.roll}),c&&t.interpolatePadding(o,r.padding,i),r.around)e.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{const e=y>_?Math.min(2,x):Math.max(.5,x),r=Math.pow(e,1-i),o=Tr(n,v,b,i*r);t.setCenter(o.wrap())}if(u){const r=e.G.number(_,y,i)+br(0,t.center.lat);t.setZoom(r)}},isZooming:u,elevationCenter:m}}handleFlyTo(t,r){const i=void 0!==r.zoom,n=t.center,o=t.zoom,a=t.padding,s=!t.isPaddingEqual(r.padding),l=t.applyConstrain(e.V.convert(r.center||r.locationAtOffset),o).center,c=i?+r.zoom:t.zoom+br(t.center.lat,l.lat),u=t.clone();u.setCenter(l),u.setZoom(c),u.setBearing(r.bearing);const h=new e.P(e.an(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),e.an(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));u.setLocationAtPoint(l,h);const p=u.center;Ue(t,p);const d=function(t,r,i){const n=gr(r),o=gr(i),a=e.b5(n,o),s=Math.acos(a),l=fr(t);return s/(2*Math.PI)*l}(t,n,p),f=o+br(n.lat,0),m=c+br(p.lat,0),g=e.aq(m-f);let _;if("number"==typeof r.minZoom){const i=+r.minZoom+br(p.lat,0),n=Math.min(i,f,m)+br(0,p.lat),o=t.applyConstrain(p,n).zoom+br(p.lat,0);_=e.aq(o-f)}const y=e.bK(n.lng,p.lng),v=e.bK(n.lat,p.lat);return{easeFunc:(i,o,l,u)=>{const h=Tr(n,y,v,l);s&&t.interpolatePadding(a,r.padding,i);const d=1===i?p:h;t.setCenter(d.wrap());const m=f+e.at(o);t.setZoom(1===i?c:m+br(0,d.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:_,pixelPathLength:d}}static solveVectorScale(t,e,r,i,n){const o="x"===i?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],a=[r[3],r[7],r[11],r[15]],s=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],l=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],u=e[0]*a[0]+e[1]*a[1]+e[2]*a[2];return c+n*l===s+n*u||a[3]*(s-c)+o[3]*(u-l)+s*u==c*l?null:(c+o[3]-n*u-n*a[3])/(c-s-n*u+n*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}}class kr{constructor(t){this._globe=t,this._mercatorCameraHelper=new Je,this._verticalPerspectiveCameraHelper=new zr}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,r){this.currentHelper.handleMapControlsPan(t,e,r)}cameraForBoxAndBearing(t,e,r,i,n){return this.currentHelper.cameraForBoxAndBearing(t,e,r,i,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}const Rr=(t,r)=>e.B(t,r&&r.filter(t=>"source.canvas"!==t.identifier)),Lr=e.bO();class Fr extends e.E{constructor(t,r={}){var i,n;super(),this._rtlPluginLoaded=()=>{for(const t in this.tileManagers){const e=this.tileManagers[t].getSource().type;"vector"!==e&&"geojson"!==e||this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new N(j(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,e)=>this.getGlyphs(t,e)),this.dispatcher.registerMessageHandler("GI",(t,e)=>this.getImages(t,e)),this.dispatcher.registerMessageHandler("GDA",(t,e)=>this.getDashes(t,e)),this.imageManager=new w,this.imageManager.setEventedParent(this);const o=(null===(i=t._container)||void 0===i?void 0:i.lang)||"undefined"!=typeof document&&(null===(n=document.documentElement)||void 0===n?void 0:n.lang)||void 0;this.glyphManager=new A(t._requestManager,r.localIdeographFontFamily,o),this.lineAtlas=new k(256,512),this.crossTileSymbolIndex=new ze,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",e.bP()),ut().on(st,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.tileManagers[t.sourceId];if(!e)return;const r=e.getSource();if(r&&r.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===r.id&&this._validateLayer(e)}})}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new e.bQ,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(t=this.crossTileSymbolIndex)||void 0===t?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,r){var i,n,o;this._checkLoaded();const a=null===r?null!==(o=null===(n=null===(i=this.stylesheet.state)||void 0===i?void 0:i[t])||void 0===n?void 0:n.default)&&void 0!==o?o:null:r;if(e.bR(a,this._globalState[t]))return this;this._globalState[t]=a,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const r=[];for(const i in t)!e.bR(this._globalState[i],t[i].default)&&(r.push(i),this._globalState[i]=t[i].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(t){if(0===t.length)return;const e=new Set,r={};for(const i of t){r[i]=this._globalState[i];for(const t in this._layers){const r=this._layers[t],n=r.getLayoutAffectingGlobalStateRefs(),o=r.getPaintAffectingGlobalStateRefs(),a=r.getVisibilityAffectingGlobalStateRefs();if(n.has(i)&&e.add(r.source),o.has(i))for(const{name:t,value:e}of o.get(i))this._updatePaintProperty(r,t,e);(null==a?void 0:a.has(i))&&(r.recalculateVisibility(),this._updateLayer(r))}}this.dispatcher.broadcast("UGS",r);for(const t in this.tileManagers)e.has(t)&&(this._reloadSource(t),this._changed=!0)}loadURL(t,r={},i){this.fire(new e.l("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.validate;const n=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;e.j(n,this._loadStyleRequest).then(t=>{this._loadStyleRequest=null,this._load(t.data,r,i)}).catch(t=>{this._loadStyleRequest=null,t&&!o.signal.aborted&&this.fire(new e.k(t))})}loadJSON(t,r={},i){this.fire(new e.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new e.l("dataloading",{dataType:"style"})),this._load(Lr,{validate:!1})}_load(t,r,i){var n,o;let a=r.transformStyle?r.transformStyle(i,t):t;if(!r.validate||!Rr(this,e.C(a))){a=Object.assign({},a),this._loaded=!0,this.stylesheet=a;for(const t in a.sources)this.addSource(t,a.sources[t],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new C(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new z(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new e.l("data",{dataType:"style"})),this.fire(new e.l("style.load"))}}_createLayers(){var t,r,i;const n=e.bS(this.stylesheet.layers);this.setGlobalState(null!==(t=this.stylesheet.state)&&void 0!==t?t:null),this.dispatcher.broadcast("SL",n),this._order=n.map(t=>t.id),this._layers={},this._serializedLayers=null;for(const t of n){const n=e.bT(t,this._globalState);if(n.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=n,e.bU(n)&&this.tileManagers[n.source]){const e=null!==(i=null===(r=t.paint)||void 0===r?void 0:r["raster-fade-duration"])&&void 0!==i?i:n.paint.get("raster-fade-duration");this.tileManagers[n.source].setRasterFadeDuration(e)}}}_loadSprite(t,r=!1,i=void 0){this.imageManager.setLoaded(!1);const n=new AbortController;let o;this._spriteRequest=n,function(t,r,i,n){return e._(this,void 0,void 0,function*(){const o=v(t),a=i>1?"@2x":"",l={},c={};for(const{id:t,url:i}of o){const o=r.transformRequest(b(i,a,".json"),"SpriteJSON");l[t]=e.j(o,n);const s=r.transformRequest(b(i,a,".png"),"SpriteImage");c[t]=_.getImage(s,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,r){return e._(this,void 0,void 0,function*(){const e={};for(const i in t){e[i]={};const n=s.getImageCanvasContext((yield r[i]).data),o=(yield t[i]).data;for(const t in o){const{width:r,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:p,content:d,textFitWidth:f,textFitHeight:m}=o[t];e[i][t]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:p,content:d,textFitWidth:f,textFitHeight:m,spriteData:{width:r,height:a,x:s,y:l,context:n}}}}return e})}(l,c)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const i=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter(e=>!(e in t)):[];for(const t of i)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const i in t[e]){const n="default"===e?i:`${e}:${i}`;this._spritesImagesIds[e].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,t[e][i],!1):this.imageManager.addImage(n,t[e][i]),r&&(this._changedImages[n]=!0)}}}).catch(t=>{this._spriteRequest=null,o=t,n.signal.aborted||this.fire(new e.k(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}_validateLayer(t){const r=this.tileManagers[t.source];if(!r)return;const i=t.sourceLayer;if(!i)return;const n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new e.k(new Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,r=!1){const i=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?e.bV(i):i);const n=[];for(const o of t)if(i[o]){const t=r?e.bV(i[o]):i[o];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const r of e){const e=this._layers[r];"custom"!==e.type&&(t[r]=e.serialize())}return t}hasTransitions(){var t,e,r;if(null===(t=this.light)||void 0===t?void 0:t.hasTransition())return!0;if(null===(e=this.sky)||void 0===e?void 0:e.hasTransition())return!0;if(null===(r=this.projection)||void 0===r?void 0:r.hasTransition())return!0;for(const t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const r=this._changed;if(r){const e=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(e.length||r.length)&&this._updateWorkerLayers(e,r);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const i={};for(const t in this.tileManagers){const e=this.tileManagers[t];i[t]=e.used,e.used=!1}for(const e of this._order){const r=this._layers[e];r.recalculate(t,this._availableImages),!r.isHidden(t.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(const t in i){const r=this.tileManagers[t];!!i[t]!=!!r.used&&r.fire(new e.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new e.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){var i;this._checkLoaded();const n=this.serialize();if(t=r.transformStyle?r.transformStyle(n,t):t,(null===(i=r.validate)||void 0===i||i)&&Rr(this,e.C(t)))return!1;(t=e.bV(t)).layers=e.bS(t.layers);const o=e.bW(n,t),a=this._getOperationsToPerform(o);if(a.unimplemented.length>0)throw new Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(const t of a.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new e.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const e=[],r=[];for(const i of t)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":e.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":e.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":e.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":e.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":e.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":e.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":e.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":e.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":e.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":e.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":e.push(()=>this.setGlyphs.apply(this,i.args));break;case"setSprite":e.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":e.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":e.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":e.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":e.push(()=>{});break;default:r.push(i.command)}return{operations:e,unimplemented:r}}addImage(t,r){if(this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,r),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw new Error(`Source "${t}" already exists.`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(e.C.source,`sources.${t}`,r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const n=this.tileManagers[t]=new Ft(t,r,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t})),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw new Error(`There is no source with this ID=${t}`);for(const r in this._layers)if(this._layers[r].source===t)return this.fire(new e.k(new Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));const r=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],r.fire(new e.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.tileManagers[t])throw new Error(`There is no source with this ID=${t}`);const r=this.tileManagers[t].getSource();if("geojson"!==r.type)throw new Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(e),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,r,i={}){this._checkLoaded();const n=t.id;if(this.getLayer(n))return void this.fire(new e.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===t.type){if(Rr(this,e.bX(t)))return;o=e.bT(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(n,t.source),t=e.bV(t),t=e.e(t,{source:n})),this._validate(e.C.layer,`layers.${n}`,t,{arrayIndex:-1},i))return;o=e.bT(t,this._globalState),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new e.k(new Error(`Cannot add layer "${n}" before non-existing layer "${r}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.tileManagers[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;const i=this._order.indexOf(t);this._order.splice(i,1);const n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new e.k(new Error(`Cannot move layer "${t}" before non-existing layer "${r}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const r=this._layers[t];if(!r)return void this.fire(new e.k(new Error(`Cannot remove non-existing layer "${t}".`)));r.setEventedParent(null);const i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=r,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],r.onRemove&&r.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,i){this._checkLoaded();const n=this.getLayer(t);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new e.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,i={}){this._checkLoaded();const n=this.getLayer(t);if(n){if(!e.bR(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(e.C.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(e.bV(r)),this._updateLayer(n)))}else this.fire(new e.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.bV(this.getLayer(t).filter)}setLayoutProperty(t,r,i,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bR(o.getLayoutProperty(r),i)||(o.setLayoutProperty(r,i,n),this._updateLayer(o)):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){const i=this.getLayer(t);if(i)return i.getLayoutProperty(r);this.fire(new e.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,i,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bR(o.getPaintProperty(r),i)||this._updatePaintProperty(o,r,i,n):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,r,i,n={}){t.setPaintProperty(r,i,n)&&this._updateLayer(t),e.bU(t)&&"raster-fade-duration"===r&&this.tileManagers[t.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,r){this._checkLoaded();const i=t.source,n=t.sourceLayer,o=this.tileManagers[i];if(void 0===o)return void this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&n?this.fire(new e.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,t.id,r)):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,r){this._checkLoaded();const i=t.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?t.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,t.id,r):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const r=t.source,i=t.sourceLayer,n=this.tileManagers[r];if(void 0!==n)return"vector"!==n.getSource().type||i?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,t.id)):void this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.k(new Error(`The source '${r}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.bY(this.tileManagers,t=>t.serialize()),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return e.bZ({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:t,layers:r,terrain:i},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,r={},i=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(e(o)){r[o]=n;for(const e of t){const t=e[o];if(t)for(const e of t)i.push(e)}}}i.sort((t,e)=>e.intersectionZ-t.intersectionZ);const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=i.length-1;t>=0;t--){const e=i[t].feature;if(r[e.layer.id]<o)break;n.push(e),i.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(t,r,i){r&&r.filter&&this._validate(e.C.filter,"queryRenderedFeatures.filter",r.filter,null,r);const n={};if(r&&r.layers){if(!(Array.isArray(r.layers)||r.layers instanceof Set))return this.fire(new e.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const t of r.layers){const r=this._layers[t];if(!r)return this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}const o=[];r.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,l=Object.assign(Object.assign({},r),{layers:s,globalState:this._globalState});for(const e in this.tileManagers)r.layers&&!n[e]||o.push($(this.tileManagers[e],this._layers,a,t,l,i,this.map.terrain?(t,e,r)=>this.map.terrain.getElevation(t,e,r):void 0));return this.placement&&o.push(function(t,e,r,i,n,o,a){const s={},l=o.queryRenderedSymbols(i),c=[];for(const t of Object.keys(l).map(Number))c.push(a[t]);c.sort(G);for(const r of c){const i=r.featureIndex.lookupSymbolFeatures(l[r.bucketInstanceId],e,r.bucketIndex,r.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,t);for(const t in i){const e=s[t]=s[t]||[],n=i[t];n.sort((t,e)=>{const i=r.featureSortOrder;if(i){const r=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-r}return e.featureIndex-t.featureIndex});for(const t of n)e.push(t)}}return function(t,e,r){for(const i in t)for(const n of t[i])q(n,r[e[i].source]);return t}(s,t,r)}(this._layers,a,this.tileManagers,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,r){(null==r?void 0:r.filter)&&this._validate(e.C.filter,"querySourceFeatures.filter",r.filter,null,r);const i=this.tileManagers[t];return i?function(t,e){const r=t.getRenderableIds().map(e=>t.getTileByID(e)),i=[],n={};for(let t=0;t<r.length;t++){const o=r[t],a=o.tileID.canonical.key;n[a]||(n[a]=!0,o.querySourceFeatures(i,e))}return i}(i,r?Object.assign(Object.assign({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();const i=this.light.getLight();let n=!1;for(const r in t)if(!e.bR(t[r],i[r])){n=!0;break}if(!n)return;const o={now:c(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(o)}getProjection(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.stylesheet.projection=t,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.sky}setSky(t,r={}){this._checkLoaded();const i=this.getSky();let n=!1;if(!t&&!i)return;if(t&&!i)n=!0;else if(!t&&i)n=!0;else for(const r in t)if(!e.bR(t[r],i[r])){n=!0;break}if(!n)return;const o={now:c(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,r),this.sky.updateTransitions(o)}_setProjectionInternal(t){const r=function(t,r){const i={constrainOverride:r};if(Array.isArray(t)){const e=new dr({type:t});return{projection:e,transform:new Dr(i),cameraHelper:new kr(e)}}switch(t){case"mercator":return{projection:new Ne,transform:new He(i),cameraHelper:new Je};case"globe":{const t=new dr({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new Dr(i),cameraHelper:new kr(t)}}case"vertical-perspective":return{projection:new hr,transform:new Cr(i),cameraHelper:new zr};default:return e.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new Ne,transform:new He(i),cameraHelper:new Je}}}(t,this.map.transformConstrain);this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper);for(const t in this.tileManagers)this.tileManagers[t].reload()}_validate(t,r,i,n,o={}){return(!o||!1!==o.validate)&&Rr(this,t.call(e.C,e.e({key:r,style:this.serialize(),value:i,styleSpec:e.u},n)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ut().off(st,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const e in this.tileManagers)this.tileManagers[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,e,r,i,n=!1){let o=!1,a=!1;const s={};for(const e of this._order){const r=this._layers[e];if("symbol"!==r.type)continue;if(!s[r.source]){const t=this.tileManagers[r.source];s[r.source]=t.getRenderableIds(!0).map(e=>t.getTileByID(e)).sort((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1))}const i=this.crossTileSymbolIndex.addLayer(r,s[r.source],t.center.lng);o=o||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c(),t.zoom))&&(this.pauseablePlacement=new Ae(t,this.map.terrain,this._order,n,e,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,s[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,r){return e._(this,void 0,void 0,function*(){const t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();const e=this.tileManagers[r.source];return e&&e.setDependencies(r.tileID.key,r.type,r.icons),t})}getGlyphs(t,r){return e._(this,void 0,void 0,function*(){const t=yield this.glyphManager.getGlyphs(r.stacks),e=this.tileManagers[r.source];return e&&e.setDependencies(r.tileID.key,r.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}){this._checkLoaded(),t&&this._validate(e.C.glyphs,"glyphs",t,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,r){return e._(this,void 0,void 0,function*(){const t={};for(const[e,i]of Object.entries(r.dashes))t[e]=this.lineAtlas.getDash(i.dasharray,i.round);return t})}addSprite(t,r,i={},n){this._checkLoaded();const o=[{id:t,url:r}],a=[...v(this.stylesheet.sprite),...o];this._validate(e.C.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(t){this._checkLoaded();const r=v(this.stylesheet.sprite);if(r.find(e=>e.id===t)){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;r.splice(r.findIndex(e=>e.id===t),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}else this.fire(new e.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return v(this.stylesheet.sprite)}setSprite(t,r={},i){this._checkLoaded(),t&&this._validate(e.C.sprite,"sprite",t,null,r)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const e=this._layers[t];e.setEventedParent(null),e.onRemove&&e.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Br=e.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Or{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,r,i,n,o,a,s,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==i.length;for(let t=0;!c&&t<i.length;t++)this.boundPaintVertexBuffers[t]!==i[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,r,i,n,o,a,s,l):(t.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(t,e,r,i,n,o,a,s){const l=t.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,e.enableAttributes(u,t);for(const e of r)e.enableAttributes(u,t);o&&o.enableAttributes(u,t),a&&a.enableAttributes(u,t),s&&s.enableAttributes(u,t),e.bind(),e.setVertexAttribPointers(u,t,n);for(const e of r)e.bind(),e.setVertexAttribPointers(u,t,n);o&&(o.bind(),o.setVertexAttribPointers(u,t,n)),i&&i.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,t,n)),s&&(s.bind(),s.setVertexAttribPointers(u,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const jr=(t,r,i,n,o)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):e.bp.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):e.bp.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Nr={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Vr(t){const e=[];for(let r=0;r<t.length;r++){if(null===t[r])continue;const i=t[r].split(" ");e.push(i.pop())}return e}class Ur{constructor(t,r,i,n,o,a,s,l,c=[]){const u=t.gl;this.program=u.createProgram();const h=Vr(r.staticAttributes),p=i?i.getBinderAttributes():[],d=h.concat(p),f=Re.prelude.staticUniforms?Vr(Re.prelude.staticUniforms):[],m=s.staticUniforms?Vr(s.staticUniforms):[],g=r.staticUniforms?Vr(r.staticUniforms):[],_=i?i.getBinderUniforms():[],y=f.concat(m).concat(g).concat(_),v=[];for(const t of y)v.indexOf(t)<0&&v.push(t);const b=i?i.defines():[];ar(u)&&b.unshift("#version 300 es"),o&&b.push("#define OVERDRAW_INSPECTOR;"),a&&b.push("#define TERRAIN3D;"),l&&b.push(l),c&&b.push(...c);let x=b.concat(Re.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join("\n"),w=b.concat(Re.prelude.vertexSource,s.vertexSource,r.vertexSource).join("\n");ar(u)||(x=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),w=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,x),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);const S=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S),this.attributes={};const P={};this.numAttributes=d.length;for(let t=0;t<this.numAttributes;t++)d[t]&&(u.bindAttribLocation(this.program,t,d[t]),this.attributes[d[t]]=t);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(S),u.deleteShader(T);for(let t=0;t<v.length;t++){const e=v[t];if(e&&!P[e]){const t=u.getUniformLocation(this.program,e);t&&(P[e]=t)}}this.fixedUniforms=n(t,P),this.terrainUniforms=((t,r)=>({u_depth:new e.b_(t,r.u_depth),u_terrain:new e.b_(t,r.u_terrain),u_terrain_dim:new e.bq(t,r.u_terrain_dim),u_terrain_matrix:new e.c0(t,r.u_terrain_matrix),u_terrain_unpack:new e.c1(t,r.u_terrain_unpack),u_terrain_exaggeration:new e.bq(t,r.u_terrain_exaggeration)}))(t,P),this.projectionUniforms=((t,r)=>({u_projection_matrix:new e.c0(t,r.u_projection_matrix),u_projection_tile_mercator_coords:new e.c1(t,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new e.c1(t,r.u_projection_clipping_plane),u_projection_transition:new e.bq(t,r.u_projection_transition),u_projection_fallback_matrix:new e.c0(t,r.u_projection_fallback_matrix)}))(t,P),this.binderUniforms=i?i.getUniforms(t,P):[]}draw(t,e,r,i,n,o,a,s,l,c,u,h,p,d,f,m,g,_,y){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(n),t.setCullFace(o),s){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(s[t])}if(l)for(const t in l)this.projectionUniforms[Nr[t]].set(l[t]);if(a)for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);m&&m.setUniforms(t,this.binderUniforms,d,{zoom:f});let b=0;switch(e){case v.LINES:b=2;break;case v.TRIANGLES:b=3;break;case v.LINE_STRIP:b=1}for(const r of p.get()){const i=r.vaos||(r.vaos={});(i[c]||(i[c]=new Or)).bind(t,this,u,m?m.getPaintVertexBuffers():[],h,r.vertexOffset,g,_,y),v.drawElements(e,r.primitiveLength*b,v.UNSIGNED_SHORT,r.primitiveOffset*b*2)}}}function $r(t,r,i){const n=1/e.aN(i,1,r.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,r.transform.tileZoom)/o,s=a*(i.tileID.canonical.x+i.tileID.wrap*o),l=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Gr=(t,r,i,n)=>{const o=t.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=e.c4();"viewport"===o.properties.get("anchor")&&e.c5(l,t.transform.bearingInRadians),e.c6(s,s,l);const c=t.transform.transformLightDirection(s),u=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+r,u_opacity:i,u_fill_translate:n}},qr=(t,r,i,n,o,a,s)=>e.e(Gr(t,r,i,n),$r(a,t,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),Zr=(t,r,i,n)=>e.e($r(r,t,i),{u_fill_translate:n}),Wr=(t,e)=>({u_world:t,u_fill_translate:e}),Hr=(t,r,i,n,o)=>e.e(Zr(t,r,i,o),{u_world:n}),Xr=(t,r,i,n,o)=>{const a=t.transform;let s,l,c=0;if("map"===i.paint.get("circle-pitch-alignment")){const t=e.aN(r,1,a.zoom);s=!0,l=[t,t],c=t/(e.a5*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*o}else s=!1,l=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},Yr=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),Kr=t=>({u_viewport_size:[t.width,t.height]}),Jr=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),Qr=(t,r,i,n)=>{const o=e.aN(t,1,r)/(e.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:e.aN(t,1,r),u_intensity:i,u_globe_extrude_scale:o}},ti=(t,r,i,n)=>{const o=e.N();e.c7(o,0,t.width,t.height,0,0,1);const a=t.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},ei=(t,e,r)=>{const i=r.paint.get("hillshade-accent-color");let n;switch(r.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0}const o=r.getIlluminationProperties();for(let e=0;e<o.directionRadians.length;e++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(o.directionRadians[e]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:ii(0,e.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:i,u_method:n,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},ri=(t,r)=>{const i=r.stride,n=e.N();return e.c7(n,0,e.a5,-e.a5,0,0,1),e.O(n,n,[0,-e.a5,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}};function ii(t,r){const i=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.a9(0,n/i).toLngLat().lat,new e.a9(0,(n+1)/i).toLngLat().lat]}const ni=(t,e,r=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),oi=(t,r,i,n)=>{const o=t.transform;return{u_translation:hi(t,r,i),u_ratio:n/e.aN(r,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},ai=(t,r,i,n,o)=>e.e(oi(t,r,i,n),{u_image:0,u_image_height:o}),si=(t,r,i,n,o)=>{const a=t.transform,s=ui(r,a);return{u_translation:hi(t,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/e.aN(r,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},li=(t,r,i,n,o)=>{const a=ui(r,t.transform);return e.e(oi(t,r,i,n),{u_tileratio:a,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},ci=(t,r,i,n,o,a)=>{const s=ui(r,t.transform);return e.e(oi(t,r,i,n),{u_image:0,u_image_height:a,u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function ui(t,r){return 1/e.aN(t,1,r.tileZoom)}function hi(t,r,i){return e.aO(t.transform,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const pi=(t,e,r,i,n)=>{return{u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:di(i.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,a};function di(t){t*=Math.PI/180;const e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}const fi=(t,e,r,i,n,o,a,s,l,c,u,h,p)=>{const d=a.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:d.width/d.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+i,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:p}},mi=(t,r,i,n,o,a,s,l,c,u,h,p,d,f)=>{const m=s.transform;return e.e(fi(t,r,i,n,o,a,s,l,c,u,h,p,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},gi=(t,r,i,n,o,a,s,l,c,u,h,p,d)=>e.e(mi(t,r,i,n,o,a,s,l,c,u,!0,h,0,d),{u_texsize_icon:p,u_texture_icon:1}),_i=(t,e)=>({u_opacity:t,u_color:e}),yi=(t,r,i,n,o)=>e.e(function(t,r,i,n){const o=i.imageManager.getPattern(t.from.toString()),a=i.imageManager.getPattern(t.to.toString()),{width:s,height:l}=i.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,i.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),p=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:r.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/e.aN(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,p>>16],u_pixel_coord_lower:[65535&h,65535&p]}}(i,o,r,n),{u_opacity:t}),vi=(t,e)=>{},bi={fillExtrusion:(t,r)=>({u_lightpos:new e.c2(t,r.u_lightpos),u_lightpos_globe:new e.c2(t,r.u_lightpos_globe),u_lightintensity:new e.bq(t,r.u_lightintensity),u_lightcolor:new e.c2(t,r.u_lightcolor),u_vertical_gradient:new e.bq(t,r.u_vertical_gradient),u_opacity:new e.bq(t,r.u_opacity),u_fill_translate:new e.c3(t,r.u_fill_translate)}),fillExtrusionPattern:(t,r)=>({u_lightpos:new e.c2(t,r.u_lightpos),u_lightpos_globe:new e.c2(t,r.u_lightpos_globe),u_lightintensity:new e.bq(t,r.u_lightintensity),u_lightcolor:new e.c2(t,r.u_lightcolor),u_vertical_gradient:new e.bq(t,r.u_vertical_gradient),u_height_factor:new e.bq(t,r.u_height_factor),u_opacity:new e.bq(t,r.u_opacity),u_fill_translate:new e.c3(t,r.u_fill_translate),u_image:new e.b_(t,r.u_image),u_texsize:new e.c3(t,r.u_texsize),u_pixel_coord_upper:new e.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.c3(t,r.u_pixel_coord_lower),u_scale:new e.c2(t,r.u_scale),u_fade:new e.bq(t,r.u_fade)}),fill:(t,r)=>({u_fill_translate:new e.c3(t,r.u_fill_translate)}),fillPattern:(t,r)=>({u_image:new e.b_(t,r.u_image),u_texsize:new e.c3(t,r.u_texsize),u_pixel_coord_upper:new e.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.c3(t,r.u_pixel_coord_lower),u_scale:new e.c2(t,r.u_scale),u_fade:new e.bq(t,r.u_fade),u_fill_translate:new e.c3(t,r.u_fill_translate)}),fillOutline:(t,r)=>({u_world:new e.c3(t,r.u_world),u_fill_translate:new e.c3(t,r.u_fill_translate)}),fillOutlinePattern:(t,r)=>({u_world:new e.c3(t,r.u_world),u_image:new e.b_(t,r.u_image),u_texsize:new e.c3(t,r.u_texsize),u_pixel_coord_upper:new e.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.c3(t,r.u_pixel_coord_lower),u_scale:new e.c2(t,r.u_scale),u_fade:new e.bq(t,r.u_fade),u_fill_translate:new e.c3(t,r.u_fill_translate)}),circle:(t,r)=>({u_camera_to_center_distance:new e.bq(t,r.u_camera_to_center_distance),u_scale_with_map:new e.b_(t,r.u_scale_with_map),u_pitch_with_map:new e.b_(t,r.u_pitch_with_map),u_extrude_scale:new e.c3(t,r.u_extrude_scale),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_globe_extrude_scale:new e.bq(t,r.u_globe_extrude_scale),u_translate:new e.c3(t,r.u_translate)}),collisionBox:(t,r)=>({u_pixel_extrude_scale:new e.c3(t,r.u_pixel_extrude_scale)}),collisionCircle:(t,r)=>({u_viewport_size:new e.c3(t,r.u_viewport_size)}),debug:(t,r)=>({u_color:new e.b$(t,r.u_color),u_overlay:new e.b_(t,r.u_overlay),u_overlay_scale:new e.bq(t,r.u_overlay_scale)}),depth:vi,clippingMask:vi,heatmap:(t,r)=>({u_extrude_scale:new e.bq(t,r.u_extrude_scale),u_intensity:new e.bq(t,r.u_intensity),u_globe_extrude_scale:new e.bq(t,r.u_globe_extrude_scale)}),heatmapTexture:(t,r)=>({u_matrix:new e.c0(t,r.u_matrix),u_world:new e.c3(t,r.u_world),u_image:new e.b_(t,r.u_image),u_color_ramp:new e.b_(t,r.u_color_ramp),u_opacity:new e.bq(t,r.u_opacity)}),hillshade:(t,r)=>({u_image:new e.b_(t,r.u_image),u_latrange:new e.c3(t,r.u_latrange),u_exaggeration:new e.bq(t,r.u_exaggeration),u_altitudes:new e.c9(t,r.u_altitudes),u_azimuths:new e.c9(t,r.u_azimuths),u_accent:new e.b$(t,r.u_accent),u_method:new e.b_(t,r.u_method),u_shadows:new e.c8(t,r.u_shadows),u_highlights:new e.c8(t,r.u_highlights)}),hillshadePrepare:(t,r)=>({u_matrix:new e.c0(t,r.u_matrix),u_image:new e.b_(t,r.u_image),u_dimension:new e.c3(t,r.u_dimension),u_zoom:new e.bq(t,r.u_zoom),u_unpack:new e.c1(t,r.u_unpack)}),colorRelief:(t,r)=>({u_image:new e.b_(t,r.u_image),u_unpack:new e.c1(t,r.u_unpack),u_dimension:new e.c3(t,r.u_dimension),u_elevation_stops:new e.b_(t,r.u_elevation_stops),u_color_stops:new e.b_(t,r.u_color_stops),u_color_ramp_size:new e.b_(t,r.u_color_ramp_size),u_opacity:new e.bq(t,r.u_opacity)}),line:(t,r)=>({u_translation:new e.c3(t,r.u_translation),u_ratio:new e.bq(t,r.u_ratio),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.c3(t,r.u_units_to_pixels)}),lineGradient:(t,r)=>({u_translation:new e.c3(t,r.u_translation),u_ratio:new e.bq(t,r.u_ratio),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.c3(t,r.u_units_to_pixels),u_image:new e.b_(t,r.u_image),u_image_height:new e.bq(t,r.u_image_height)}),linePattern:(t,r)=>({u_translation:new e.c3(t,r.u_translation),u_texsize:new e.c3(t,r.u_texsize),u_ratio:new e.bq(t,r.u_ratio),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_image:new e.b_(t,r.u_image),u_units_to_pixels:new e.c3(t,r.u_units_to_pixels),u_scale:new e.c2(t,r.u_scale),u_fade:new e.bq(t,r.u_fade)}),lineSDF:(t,r)=>({u_translation:new e.c3(t,r.u_translation),u_ratio:new e.bq(t,r.u_ratio),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.c3(t,r.u_units_to_pixels),u_image:new e.b_(t,r.u_image),u_mix:new e.bq(t,r.u_mix),u_tileratio:new e.bq(t,r.u_tileratio),u_crossfade_from:new e.bq(t,r.u_crossfade_from),u_crossfade_to:new e.bq(t,r.u_crossfade_to),u_lineatlas_width:new e.bq(t,r.u_lineatlas_width),u_lineatlas_height:new e.bq(t,r.u_lineatlas_height)}),lineGradientSDF:(t,r)=>({u_translation:new e.c3(t,r.u_translation),u_ratio:new e.bq(t,r.u_ratio),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.c3(t,r.u_units_to_pixels),u_image:new e.b_(t,r.u_image),u_image_height:new e.bq(t,r.u_image_height),u_tileratio:new e.bq(t,r.u_tileratio),u_crossfade_from:new e.bq(t,r.u_crossfade_from),u_crossfade_to:new e.bq(t,r.u_crossfade_to),u_image_dash:new e.b_(t,r.u_image_dash),u_mix:new e.bq(t,r.u_mix),u_lineatlas_width:new e.bq(t,r.u_lineatlas_width),u_lineatlas_height:new e.bq(t,r.u_lineatlas_height)}),raster:(t,r)=>({u_tl_parent:new e.c3(t,r.u_tl_parent),u_scale_parent:new e.bq(t,r.u_scale_parent),u_buffer_scale:new e.bq(t,r.u_buffer_scale),u_fade_t:new e.bq(t,r.u_fade_t),u_opacity:new e.bq(t,r.u_opacity),u_image0:new e.b_(t,r.u_image0),u_image1:new e.b_(t,r.u_image1),u_brightness_low:new e.bq(t,r.u_brightness_low),u_brightness_high:new e.bq(t,r.u_brightness_high),u_saturation_factor:new e.bq(t,r.u_saturation_factor),u_contrast_factor:new e.bq(t,r.u_contrast_factor),u_spin_weights:new e.c2(t,r.u_spin_weights),u_coords_top:new e.c1(t,r.u_coords_top),u_coords_bottom:new e.c1(t,r.u_coords_bottom)}),symbolIcon:(t,r)=>({u_is_size_zoom_constant:new e.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.b_(t,r.u_is_size_feature_constant),u_size_t:new e.bq(t,r.u_size_t),u_size:new e.bq(t,r.u_size),u_camera_to_center_distance:new e.bq(t,r.u_camera_to_center_distance),u_pitch:new e.bq(t,r.u_pitch),u_rotate_symbol:new e.b_(t,r.u_rotate_symbol),u_aspect_ratio:new e.bq(t,r.u_aspect_ratio),u_fade_change:new e.bq(t,r.u_fade_change),u_label_plane_matrix:new e.c0(t,r.u_label_plane_matrix),u_coord_matrix:new e.c0(t,r.u_coord_matrix),u_is_text:new e.b_(t,r.u_is_text),u_pitch_with_map:new e.b_(t,r.u_pitch_with_map),u_is_along_line:new e.b_(t,r.u_is_along_line),u_is_variable_anchor:new e.b_(t,r.u_is_variable_anchor),u_texsize:new e.c3(t,r.u_texsize),u_texture:new e.b_(t,r.u_texture),u_translation:new e.c3(t,r.u_translation),u_pitched_scale:new e.bq(t,r.u_pitched_scale)}),symbolSDF:(t,r)=>({u_is_size_zoom_constant:new e.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.b_(t,r.u_is_size_feature_constant),u_size_t:new e.bq(t,r.u_size_t),u_size:new e.bq(t,r.u_size),u_camera_to_center_distance:new e.bq(t,r.u_camera_to_center_distance),u_pitch:new e.bq(t,r.u_pitch),u_rotate_symbol:new e.b_(t,r.u_rotate_symbol),u_aspect_ratio:new e.bq(t,r.u_aspect_ratio),u_fade_change:new e.bq(t,r.u_fade_change),u_label_plane_matrix:new e.c0(t,r.u_label_plane_matrix),u_coord_matrix:new e.c0(t,r.u_coord_matrix),u_is_text:new e.b_(t,r.u_is_text),u_pitch_with_map:new e.b_(t,r.u_pitch_with_map),u_is_along_line:new e.b_(t,r.u_is_along_line),u_is_variable_anchor:new e.b_(t,r.u_is_variable_anchor),u_texsize:new e.c3(t,r.u_texsize),u_texture:new e.b_(t,r.u_texture),u_gamma_scale:new e.bq(t,r.u_gamma_scale),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_is_halo:new e.b_(t,r.u_is_halo),u_translation:new e.c3(t,r.u_translation),u_pitched_scale:new e.bq(t,r.u_pitched_scale)}),symbolTextAndIcon:(t,r)=>({u_is_size_zoom_constant:new e.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.b_(t,r.u_is_size_feature_constant),u_size_t:new e.bq(t,r.u_size_t),u_size:new e.bq(t,r.u_size),u_camera_to_center_distance:new e.bq(t,r.u_camera_to_center_distance),u_pitch:new e.bq(t,r.u_pitch),u_rotate_symbol:new e.b_(t,r.u_rotate_symbol),u_aspect_ratio:new e.bq(t,r.u_aspect_ratio),u_fade_change:new e.bq(t,r.u_fade_change),u_label_plane_matrix:new e.c0(t,r.u_label_plane_matrix),u_coord_matrix:new e.c0(t,r.u_coord_matrix),u_is_text:new e.b_(t,r.u_is_text),u_pitch_with_map:new e.b_(t,r.u_pitch_with_map),u_is_along_line:new e.b_(t,r.u_is_along_line),u_is_variable_anchor:new e.b_(t,r.u_is_variable_anchor),u_texsize:new e.c3(t,r.u_texsize),u_texsize_icon:new e.c3(t,r.u_texsize_icon),u_texture:new e.b_(t,r.u_texture),u_texture_icon:new e.b_(t,r.u_texture_icon),u_gamma_scale:new e.bq(t,r.u_gamma_scale),u_device_pixel_ratio:new e.bq(t,r.u_device_pixel_ratio),u_is_halo:new e.b_(t,r.u_is_halo),u_translation:new e.c3(t,r.u_translation),u_pitched_scale:new e.bq(t,r.u_pitched_scale)}),background:(t,r)=>({u_opacity:new e.bq(t,r.u_opacity),u_color:new e.b$(t,r.u_color)}),backgroundPattern:(t,r)=>({u_opacity:new e.bq(t,r.u_opacity),u_image:new e.b_(t,r.u_image),u_pattern_tl_a:new e.c3(t,r.u_pattern_tl_a),u_pattern_br_a:new e.c3(t,r.u_pattern_br_a),u_pattern_tl_b:new e.c3(t,r.u_pattern_tl_b),u_pattern_br_b:new e.c3(t,r.u_pattern_br_b),u_texsize:new e.c3(t,r.u_texsize),u_mix:new e.bq(t,r.u_mix),u_pattern_size_a:new e.c3(t,r.u_pattern_size_a),u_pattern_size_b:new e.c3(t,r.u_pattern_size_b),u_scale_a:new e.bq(t,r.u_scale_a),u_scale_b:new e.bq(t,r.u_scale_b),u_pixel_coord_upper:new e.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.c3(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new e.bq(t,r.u_tile_units_to_pixels)}),terrain:(t,r)=>({u_texture:new e.b_(t,r.u_texture),u_ele_delta:new e.bq(t,r.u_ele_delta),u_fog_matrix:new e.c0(t,r.u_fog_matrix),u_fog_color:new e.b$(t,r.u_fog_color),u_fog_ground_blend:new e.bq(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.bq(t,r.u_fog_ground_blend_opacity),u_horizon_color:new e.b$(t,r.u_horizon_color),u_horizon_fog_blend:new e.bq(t,r.u_horizon_fog_blend),u_is_globe_mode:new e.bq(t,r.u_is_globe_mode)}),terrainDepth:(t,r)=>({u_ele_delta:new e.bq(t,r.u_ele_delta)}),terrainCoords:(t,r)=>({u_texture:new e.b_(t,r.u_texture),u_terrain_coords_id:new e.bq(t,r.u_terrain_coords_id),u_ele_delta:new e.bq(t,r.u_ele_delta)}),projectionErrorMeasurement:(t,r)=>({u_input:new e.bq(t,r.u_input),u_output_expected:new e.bq(t,r.u_output_expected)}),atmosphere:(t,r)=>({u_sun_pos:new e.c2(t,r.u_sun_pos),u_atmosphere_blend:new e.bq(t,r.u_atmosphere_blend),u_globe_position:new e.c2(t,r.u_globe_position),u_globe_radius:new e.bq(t,r.u_globe_radius),u_inv_proj_matrix:new e.c0(t,r.u_inv_proj_matrix)}),sky:(t,r)=>({u_sky_color:new e.b$(t,r.u_sky_color),u_horizon_color:new e.b$(t,r.u_horizon_color),u_horizon:new e.c3(t,r.u_horizon),u_horizon_normal:new e.c3(t,r.u_horizon_normal),u_sky_horizon_blend:new e.bq(t,r.u_sky_horizon_blend),u_sky_blend:new e.bq(t,r.u_sky_blend)})};class xi{constructor(t,e,r){this.context=t;const i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const wi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ti{constructor(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let r=0;r<this.attributes.length;r++){const i=e.attributes[this.attributes[r].name];void 0!==i&&t.enableVertexAttribArray(i)}}setVertexAttribPointers(t,e,r){for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[wi[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Si{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Pi extends Si{getDefault(){return e.bp.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Mi extends Si{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ai extends Si{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ei extends Si{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ii extends Si{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ci extends Si{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Di extends Si{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class zi extends Si{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class ki extends Si{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Ri extends Si{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Li extends Si{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class Fi extends Si{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Bi extends Si{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class Oi extends Si{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ji extends Si{getDefault(){return e.bp.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ni extends Si{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Vi extends Si{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class Ui extends Si{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class $i extends Si{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Gi extends Si{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class qi extends Si{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Zi extends Si{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Wi extends Si{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Hi extends Si{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Xi extends Si{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Yi extends Si{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ki extends Si{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ji extends Si{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const r=this.gl;ar(r)?r.bindVertexArray(t):null===(e=r.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Qi extends Si{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class tn extends Si{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class en extends Si{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class rn extends Si{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class nn extends rn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class on extends rn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class an extends rn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const sn="Framebuffer is not complete";class ln{constructor(t,e,r,i,n){this.context=t,this.width=e,this.height=r;const o=t.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new nn(t,a),i)this.depthAttachment=n?new an(t,a):new on(t,a);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(sn)}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class cn{constructor(t){var e,r;if(this.gl=t,this.clearColor=new Pi(this),this.clearDepth=new Mi(this),this.clearStencil=new Ai(this),this.colorMask=new Ei(this),this.depthMask=new Ii(this),this.stencilMask=new Ci(this),this.stencilFunc=new Di(this),this.stencilOp=new zi(this),this.stencilTest=new ki(this),this.depthRange=new Ri(this),this.depthTest=new Li(this),this.depthFunc=new Fi(this),this.blend=new Bi(this),this.blendFunc=new Oi(this),this.blendColor=new ji(this),this.blendEquation=new Ni(this),this.cullFace=new Vi(this),this.cullFaceSide=new Ui(this),this.frontFace=new $i(this),this.program=new Gi(this),this.activeTexture=new qi(this),this.viewport=new Zi(this),this.bindFramebuffer=new Wi(this),this.bindRenderbuffer=new Hi(this),this.bindTexture=new Xi(this),this.bindVertexBuffer=new Yi(this),this.bindElementBuffer=new Ki(this),this.bindVertexArray=new Ji(this),this.pixelStoreUnpack=new Qi(this),this.pixelStoreUnpackPremultiplyAlpha=new tn(this),this.pixelStoreUnpackFlipY=new en(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),ar(t)){this.HALF_FLOAT=t.HALF_FLOAT;const i=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!==(r=t.RGB16F)&&void 0!==r?r:null==i?void 0:i.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.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(t,e){return new xi(this,t,e)}createVertexBuffer(t,e,r){return new Ti(this,t,e,r)}createRenderbuffer(t,e,r){const i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,r,i){return new ln(this,t,e,r,i)}clear({color:t,depth:e,stencil:r}){const i=this.gl;let n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==r&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bR(t.blendFunction,Qe.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return ar(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return ar(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let un;function hn(t,r,i,n,o){const a=t.context,s=t.transform,l=a.gl,c=t.useProgram("collisionBox"),u=[];let h=0,p=0;for(let e=0;e<n.length;e++){const d=n[e],f=r.getTile(d).getBucket(i);if(!f)continue;const m=o?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;g.length>0&&(u.push({circleArray:g,circleOffset:p,coord:d}),h+=g.length/4,p=h),m&&c.draw(a,l.LINES,rr.disabled,nr.disabled,t.colorModeForRenderPass(),er.disabled,Yr(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(d),s.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,t.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!u.length)return;const d=t.useProgram("collisionCircle"),f=new e.ca;f.resize(4*h),f._trim();let m=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const r=4*e,i=t.circleArray[r+0],n=t.circleArray[r+1],o=t.circleArray[r+2],a=t.circleArray[r+3];f.emplace(m++,i,n,o,a,0),f.emplace(m++,i,n,o,a,1),f.emplace(m++,i,n,o,a,2),f.emplace(m++,i,n,o,a,3)}(!un||un.length<2*h)&&(un=function(t){const r=2*t,i=new e.cc;i.resize(r),i._trim();for(let t=0;t<r;t++){const e=6*t;i.uint16[e+0]=4*t+0,i.uint16[e+1]=4*t+1,i.uint16[e+2]=4*t+2,i.uint16[e+3]=4*t+2,i.uint16[e+4]=4*t+3,i.uint16[e+5]=4*t+0}return i}(h));const g=a.createIndexBuffer(un,!0),_=a.createVertexBuffer(f,e.cb.members,!0);for(const r of u){const n=Kr(t.transform);d.draw(a,l.TRIANGLES,rr.disabled,nr.disabled,t.colorModeForRenderPass(),er.disabled,n,t.style.map.terrain&&t.style.map.terrain.getTerrainData(r.coord),null,i.id,_,g,e.aX.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,t.transform.zoom,null,null,null)}_.destroy(),g.destroy()}const pn=e.ar(new Float32Array(16));function dn(t,r,i,n,o,a){const{horizontalAlign:s,verticalAlign:l}=e.aS(t);return new e.P((-(s-.5)*r/o+n[0])*a,(-(l-.5)*i/o+n[1])*a)}function fn(t,r,i,n,o,a){const s=r.tileAnchorPoint.add(new e.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let t=n.mult(a);i||(t=t.rotate(-o));const e=s.add(t);return $t(e.x,e.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(i){const e=Jt(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(t),i=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(n.rotate(i))}return t.add(n)}function mn(t,r,i,n,o,a,s,l,c,u,h,p){const d=t.text.placedSymbolArray,f=t.text.dynamicLayoutVertexArray,m=t.icon.dynamicLayoutVertexArray,g={};f.clear();for(let m=0;m<d.length;m++){const _=d.get(m),y=_.hidden||!_.crossTileID||t.allowVerticalPlacement&&!_.placedOrientation?null:n[_.crossTileID];if(y){const n=new e.P(_.anchorX,_.anchorY),d={getElevation:p,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,pitchWithMap:i,transform:o,tileAnchorPoint:n,translation:u,unwrappedTileID:h},m=i?te(n.x,n.y,d):Jt(n.x,n.y,d),v=Gt(o.cameraToCenterDistance,m.signedDistanceFromCamera);let b=e.aA(t.textSizeData,l,_)*v/e.aM;i&&(b*=t.tilePixelRatio/s);const{width:x,height:w,anchor:T,textOffset:S,textBoxScale:P}=y,M=dn(T,x,w,S,P,b),A=o.getPitchedTextCorrection(n.x+u[0],n.y+u[1],h),E=fn(m.point,d,r,M,-o.bearingInRadians,A),I=t.allowVerticalPlacement&&_.placedOrientation===e.az.vertical?Math.PI/2:0;for(let t=0;t<_.numGlyphs;t++)e.aG(f,E,I);c&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:E,angle:I})}else oe(_.numGlyphs,f)}if(c){m.clear();const r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){const i=r.get(t);if(i.hidden)oe(i.numGlyphs,m);else{const r=g[t];if(r)for(let t=0;t<i.numGlyphs;t++)e.aG(m,r.shiftedAnchor,r.angle);else oe(i.numGlyphs,m)}}t.icon.dynamicLayoutVertexBuffer.updateData(m)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function gn(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function _n(t,r,i,n,o,a,s,l,c,u,h,p,d){const f=t.context,m=f.gl,g=t.transform,_="map"===l,y="map"===c,v="viewport"!==l&&"point"!==i.layout.get("symbol-placement"),b=_&&!y&&!v,x=!i.layout.get("symbol-sort-key").isConstant();let w=!1;const T=t.getDepthModeForSublayer(0,rr.ReadOnly),S=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=[],M=g.getCircleRadiusCorrection();for(const l of n){const n=r.getTile(l),c=n.getBucket(i);if(!c)continue;const h=o?c.text:c.icon;if(!h||!h.segments.get().length||!h.hasVisibleVertices)continue;const p=h.programConfigurations.get(i.id),f=o||c.sdfIcons,T=o?c.textSizeData:c.iconSizeData,A=y||0!==g.pitch,E=t.useProgram(gn(f,o,c),p),I=e.ay(T,g.zoom),C=t.style.map.terrain&&t.style.map.terrain.getTerrainData(l);let D,z,k,R,L=[0,0],F=null;if(o)z=n.glyphAtlasTexture,k=m.LINEAR,D=n.glyphAtlasTexture.size,c.iconsInText&&(L=n.imageAtlasTexture.size,F=n.imageAtlasTexture,R=A||t.options.rotating||t.options.zooming||"composite"===T.kind||"camera"===T.kind?m.LINEAR:m.NEAREST);else{const e=1!==i.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;z=n.imageAtlasTexture,k=f||t.options.rotating||t.options.zooming||e||A?m.LINEAR:m.NEAREST,D=n.imageAtlasTexture.size}const B=e.aN(n,1,t.transform.zoom),O=Nt(_,t.transform,B),j=e.N();e.aB(j,O);const N=Vt(y,_,t.transform,B),V=e.aO(g,n,a,s),U=g.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),$=S&&c.hasTextData(),G="none"!==i.layout.get("icon-text-fit")&&$&&c.hasIconData();if(v){const e=t.style.map.terrain?(e,r)=>t.style.map.terrain.getElevation(l,e,r):null,r="map"===i.layout.get("text-rotation-alignment");Zt(c,t,o,O,j,y,u,r,l.toUnwrapped(),g.width,g.height,V,e)}const q=o&&S||G,Z=v||q?pn:y?O:t.transform.clipSpaceToPixelsMatrix,W=f&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=f?c.iconsInText?gi(T.kind,I,b,y,v,q,t,Z,N,V,D,L,M):mi(T.kind,I,b,y,v,q,t,Z,N,V,o,D,0,M):fi(T.kind,I,b,y,v,q,t,Z,N,V,o,D,M);const X={program:E,buffers:h,uniformValues:H,projectionData:U,atlasTexture:z,atlasTextureIcon:F,atlasInterpolation:k,atlasInterpolationIcon:R,isSDF:f,hasHalo:W};if(x&&c.canOverlap){w=!0;const t=h.segments.get();for(const r of t)P.push({segments:new e.aX([r]),sortKey:r.sortKey,state:X,terrainData:C})}else P.push({segments:h.segments,sortKey:0,state:X,terrainData:C})}w&&P.sort((t,e)=>t.sortKey-e.sortKey);for(const e of P){const r=e.state;if(f.activeTexture.set(m.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,m.CLAMP_TO_EDGE),r.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),r.isSDF){const n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,yn(r.buffers,e.segments,i,t,r.program,T,h,p,n,r.projectionData,e.terrainData)),n.u_is_halo=0}yn(r.buffers,e.segments,i,t,r.program,T,h,p,r.uniformValues,r.projectionData,e.terrainData)}}function yn(t,e,r,i,n,o,a,s,l,c,u){const h=i.context;n.draw(h,h.gl.TRIANGLES,o,a,s,er.backCCW,l,u,c,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,i.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function vn(t,r,i,n,o){const a=t.context,s=a.gl,l=nr.disabled,c=new Qe([s.ONE,s.ONE],e.bp.transparent,[!0,!0,!0,!0]),u=r.getBucket(i);if(!u)return;const h=n.key;let p=i.heatmapFbos.get(h);p||(p=xn(a,r.tileSize,r.tileSize),i.heatmapFbos.set(h,p)),a.bindFramebuffer.set(p.framebuffer),a.viewport.set([0,0,r.tileSize,r.tileSize]),a.clear({color:e.bp.transparent});const d=u.programConfigurations.get(i.id),f=t.useProgram("heatmap",d,!o),m=t.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);f.draw(a,s.TRIANGLES,rr.disabled,l,c,er.disabled,Qr(r,t.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,t.transform.zoom,d)}function bn(t,e,r,i,n){const o=t.context,a=o.gl,s=t.transform;o.setColorMode(t.colorModeForRenderPass());const l=wn(o,e),c=r.key,u=e.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=s.getProjectionData({overscaledTileID:r,applyTerrainMatrix:n,applyGlobeMatrix:!i});t.useProgram("heatmapTexture").draw(o,a.TRIANGLES,rr.disabled,nr.disabled,t.colorModeForRenderPass(),er.disabled,ti(t,e,0,1),null,h,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,s.zoom),u.destroy(),e.heatmapFbos.delete(c)}function xn(t,e,r){var i,n;const o=t.gl,a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const s=null!==(i=t.HALF_FLOAT)&&void 0!==i?i:o.UNSIGNED_BYTE,l=null!==(n=t.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e,r,0,o.RGBA,s,null);const c=t.createFramebuffer(e,r,!1,!1);return c.colorAttachment.set(a),c}function wn(t,r){return r.colorRampTexture||(r.colorRampTexture=new e.T(t,r.colorRamp,t.gl.RGBA)),r.colorRampTexture}function Tn(t,r,i,n,o,a,s,l){let c=256;if(o.stepInterpolant){const n=r.getSource().maxzoom,o=s.canonical.z===n?Math.ceil(1<<t.transform.maxZoom-s.canonical.z):1;c=e.an(e.ce(a.maxLineLength/e.a5*1024*o),256,i.maxTextureSize)}return l.gradient=e.cf({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:l.gradient||void 0,clips:a.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new e.T(i,l.gradient,n.RGBA),l.version=o.gradientVersion,l.texture}function Sn(t,e,r,i,n){t.activeTexture.set(e.TEXTURE0),r.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),i.updatePaintBuffers(n)}function Pn(t,e,r,i,n,o){(n||t.lineAtlas.dirty)&&(e.activeTexture.set(r.TEXTURE0),t.lineAtlas.bind(e)),i.updatePaintBuffers(o)}function Mn(t,e,r,i,n,o,a){const s=o.gradients[n.id];let l=s.texture;n.gradientVersion!==s.version&&(l=Tn(t,e,r,i,n,o,a,s)),r.activeTexture.set(i.TEXTURE0),l.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function An(t,e,r,i,n,o,a,s,l){const c=o.gradients[n.id];let u=c.texture;n.gradientVersion!==c.version&&(u=Tn(t,e,r,i,n,o,a,c)),r.activeTexture.set(i.TEXTURE0),u.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE),r.activeTexture.set(i.TEXTURE1),t.lineAtlas.bind(r),s.updatePaintBuffers(l)}function En(t,e,r,i,n){if(!r||!i||!i.imageAtlas)return;const o=i.imageAtlas.patternPositions;let a=o[r.to.toString()],s=o[r.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){const t=n.getPaintProperty(e);a=o[t],s=o[t]}a&&s&&t.setConstantPatternPositions(a,s)}function In(t,r,i,n,o,a,s,l){const c=t.context.gl,u="fill-pattern",h=i.paint.get(u),p=h&&h.constantOr(1),d=i.getCrossfadeParameters();let f,m,g,_,y;const v=t.transform,b=i.paint.get("fill-translate"),x=i.paint.get("fill-translate-anchor");s?(m=p&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=p?"fillPattern":"fill",f=c.TRIANGLES);const w=h.constantOr(null);for(const h of n){const n=r.getTile(h);if(p&&!n.patternsLoaded())continue;const T=n.getBucket(i);if(!T)continue;const S=T.programConfigurations.get(i.id),P=t.useProgram(m,S),M=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h);p&&(t.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers(d)),En(S,u,w,n,i);const A=v.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),E=e.aO(v,n,b,x);if(s){_=T.indexBuffer2,y=T.segments2;const e=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&p?Hr(t,d,n,e,E):Wr(e,E)}else _=T.indexBuffer,y=T.segments,g=p?Zr(t,d,n,E):{u_fill_translate:E};const I=t.stencilModeForClipping(h);P.draw(t.context,f,o,I,a,er.backCCW,g,M,A,i.id,T.layoutVertexBuffer,_,y,i.paint,t.transform.zoom,S)}}function Cn(t,r,i,n,o,a,s,l){const c=t.context,u=c.gl,h="fill-extrusion-pattern",p=i.paint.get(h),d=p.constantOr(1),f=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=p.constantOr(null),_=t.transform;for(const p of n){const n=r.getTile(p),y=n.getBucket(i);if(!y)continue;const v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),b=y.programConfigurations.get(i.id),x=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",b);d&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),b.updatePaintBuffers(f));const w=_.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!l,applyTerrainMatrix:!0});En(b,h,g,n,i);const T=e.aO(_,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),S=i.paint.get("fill-extrusion-vertical-gradient"),P=d?qr(t,S,m,T,p,f,n):Gr(t,S,m,T);x.draw(c,c.gl.TRIANGLES,o,a,s,er.backCCW,P,v,w,i.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,i.paint,t.transform.zoom,b,t.style.map.terrain&&y.centroidVertexBuffer)}}function Dn(t,e,r,i,n,o,a,s,l){var c;const u=t.style.projection,h=t.context,p=t.transform,d=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],m=t.useProgram("hillshade",null,!1,f),g=!t.options.moving;for(const f of i){const i=e.getTile(f),_=i.fbo;if(!_)continue;const y=u.getMeshFromTileID(h,f.canonical,s,!0,"raster"),v=null===(c=t.style.map.terrain)||void 0===c?void 0:c.getTerrainData(f);h.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,_.colorAttachment.get());const b=p.getProjectionData({overscaledTileID:f,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,d.TRIANGLES,o,n[f.overscaledZ],a,er.backCCW,ei(t,i,r),v,b,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function zn(t,r,i,n,o,a,s,l,c){var u;const h=t.style.projection,p=t.context,d=t.transform,f=p.gl,m=t.useProgram("colorRelief"),g=!t.options.moving;let _=!0,y=0;for(const v of n){const n=r.getTile(v),b=n.dem;if(_){const t=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:e,colorTexture:r}=i.getColorRampTextures(p,t,b.getUnpackVector());p.activeTexture.set(f.TEXTURE1),e.bind(f.NEAREST,f.CLAMP_TO_EDGE),p.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),_=!1,y=e.size[0]}if(!b||!b.data)continue;const x=b.stride,w=b.getPixels();if(p.activeTexture.set(f.TEXTURE0),p.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(x),n.demTexture){const t=n.demTexture;t.update(w,{premultiply:!1}),t.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else n.demTexture=new e.T(p,w,f.RGBA,{premultiply:!1}),n.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const T=h.getMeshFromTileID(p,v.canonical,l,!0,"raster"),S=null===(u=t.style.map.terrain)||void 0===u?void 0:u.getTerrainData(v),P=d.getProjectionData({overscaledTileID:v,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(p,f.TRIANGLES,a,o[v.overscaledZ],s,er.backCCW,ni(i,n.dem,y),S,P,i.id,T.vertexBuffer,T.indexBuffer,T.segments)}}const kn=[new e.P(0,0),new e.P(e.a5,0),new e.P(e.a5,e.a5),new e.P(0,e.a5)];function Rn(t,e,r,i,n,o,a,s,l=!1,c=!1){const u=i[i.length-1].overscaledZ,h=t.context,p=h.gl,d=t.useProgram("raster"),f=t.transform,m=t.style.projection,g=t.colorModeForRenderPass(),_=!t.options.moving,y=r.paint.get("raster-opacity"),v=r.paint.get("raster-resampling"),b=r.paint.get("raster-fade-duration"),x=!!t.style.map.terrain;for(const w of i){const i=t.getDepthModeForSublayer(w.overscaledZ-u,1===y?rr.ReadWrite:rr.ReadOnly,p.LESS),T=e.getTile(w),S="nearest"===v?p.NEAREST:p.LINEAR;h.activeTexture.set(p.TEXTURE0),T.texture.bind(S,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(p.TEXTURE1);const{parentTile:P,parentScaleBy:M,parentTopLeft:A,fadeValues:E}=Ln(T,e,b,x);T.fadeOpacity=E.tileOpacity,P?(P.fadeOpacity=E.parentTileOpacity,P.texture.bind(S,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)):T.texture.bind(S,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&h.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&p.texParameterf(p.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const I=t.style.map.terrain&&t.style.map.terrain.getTerrainData(w),C=f.getProjectionData({overscaledTileID:w,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),D=pi(A,M,E.fadeMix,r,s),z=m.getMeshFromTileID(h,w.canonical,o,a,"raster");d.draw(h,p.TRIANGLES,i,n?n[w.overscaledZ]:nr.disabled,g,l?er.frontCCW:er.backCCW,D,I,C,r.id,z.vertexBuffer,z.indexBuffer,z.segments)}}function Ln(t,r,i,n){const o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||n)return o;if(t.fadingParentID){const n=r.getLoadedTile(t.fadingParentID);if(!n)return o;const a=Math.pow(2,n.tileID.overscaledZ-t.tileID.overscaledZ),s=[t.tileID.canonical.x*a%1,t.tileID.canonical.y*a%1],l=function(t,r,i){const n=c(),o=(n-r.timeAdded)/i,a=t.fadingDirection===pt.Incoming,s=e.an((n-t.timeAdded)/i,0,1),l=e.an(1-o,0,1),u=a?s:l;return{tileOpacity:u,parentTileOpacity:a?l:s,fadeMix:{opacity:1,mix:1-u}}}(t,n,i);return{parentTile:n,parentScaleBy:a,parentTopLeft:s,fadeValues:l}}if(t.selfFading){const r=function(t,r){const i=(c()-t.timeAdded)/r,n=e.an(i,0,1);return{tileOpacity:n,fadeMix:{opacity:n,mix:0}}}(t,i);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:r}}return o}const Fn=new e.bp(1,0,0,1),Bn=new e.bp(0,1,0,1),On=new e.bp(0,0,1,1),jn=new e.bp(1,0,1,1),Nn=new e.bp(0,1,1,1);function Vn(t,e,r,i){$n(t,0,e+r/2,t.transform.width,r,i)}function Un(t,e,r,i){$n(t,e-r/2,0,r,t.transform.height,i)}function $n(t,e,r,i,n,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,r*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Gn(t,r,i){const n=t.context,o=n.gl,a=t.useProgram("debug"),s=rr.disabled,l=nr.disabled,c=t.colorModeForRenderPass(),u="$debug",h=t.style.map.terrain&&t.style.map.terrain.getTerrainData(i);n.activeTexture.set(o.TEXTURE0);const p=r.getTileByID(i.key).latestRawTileData,d=Math.floor((p&&p.byteLength||0)/1024),f=r.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/t.transform.zoom)*.5;let g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const r=t.debugOverlayCanvas,i=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(t,`${g} ${d}kB`);const _=t.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,Qe.alphaBlended,er.disabled,Jr(e.bp.transparent,m),null,_,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,er.disabled,Jr(e.bp.red),h,_,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function qn(t,e,r,i){const{isRenderingGlobe:n}=i,o=t.context,a=o.gl,s=t.transform,l=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),u=t.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);for(const i of r){const r=e.getTerrainMesh(i.tileID),h=t.renderToTexture.getTexture(i),p=e.getTerrainData(i.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,h.texture);const d=e.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(i.tileID.toUnwrapped()),m=jr(d,f,t.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:i.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,a.TRIANGLES,c,nr.disabled,l,er.backCCW,m,p,g,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function Zn(t,r){if(!r.mesh){const i=new e.aW;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const n=new e.aY;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new Fe(t.createVertexBuffer(i,Be.members),t.createIndexBuffer(n),e.aX.simpleSegment(0,0,i.length,n.length))}return r.mesh}class Wn{constructor(t,r){this.context=new cn(t),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ft.maxOverzooming+Ft.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ze}resize(t,e,r){if(this.width=Math.floor(t*r),this.height=Math.floor(e*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const t=this.context,r=new e.aW;r.emplaceBack(0,0),r.emplaceBack(e.a5,0),r.emplaceBack(0,e.a5),r.emplaceBack(e.a5,e.a5),this.tileExtentBuffer=t.createVertexBuffer(r,Be.members),this.tileExtentSegments=e.aX.simpleSegment(0,0,4,2);const i=new e.aW;i.emplaceBack(0,0),i.emplaceBack(e.a5,0),i.emplaceBack(0,e.a5),i.emplaceBack(e.a5,e.a5),this.debugBuffer=t.createVertexBuffer(i,Be.members),this.debugSegments=e.aX.simpleSegment(0,0,4,5);const n=new e.ch;n.emplaceBack(0,0,0,0),n.emplaceBack(e.a5,0,e.a5,0),n.emplaceBack(0,e.a5,0,e.a5),n.emplaceBack(e.a5,e.a5,e.a5,e.a5),this.rasterBoundsBuffer=t.createVertexBuffer(n,Br.members),this.rasterBoundsSegments=e.aX.simpleSegment(0,0,4,2);const o=new e.aW;o.emplaceBack(0,0),o.emplaceBack(e.a5,0),o.emplaceBack(0,e.a5),o.emplaceBack(e.a5,e.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(o,Be.members),this.rasterBoundsSegmentsPosOnly=e.aX.simpleSegment(0,0,4,5);const a=new e.aW;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(a,Be.members),this.viewportSegments=e.aX.simpleSegment(0,0,4,2);const s=new e.ci;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);const l=new e.aY;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new nr({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new Fe(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const i=e.N();e.c7(i,0,this.width,this.height,0,0,1),e.Q(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);const n={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,rr.disabled,this.stencilClearMode,Qe.disabled,er.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();const i=this.context;i.setColorMode(Qe.disabled),i.setDepthMode(rr.disabled);const n={};for(const t of e)n[t.key]=this.nextStencilID++;this._renderTileMasks(n,e,r,!0),this._renderTileMasks(n,e,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,e,r,i){const n=this.context,o=n.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of e){const e=t[c.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),h=a.getMeshFromTileID(this.context,c.canonical,i,!0,"stencil"),p=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!r,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,rr.disabled,new nr({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),Qe.disabled,r?er.disabled:er.backCCW,null,u,p,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const t=this.context,e=t.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=At(i,{tileSize:i.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=r.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=i.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,e.TRIANGLES,o,nr.disabled,Qe.disabled,er.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new nr({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new nr({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const e=this.context.gl,r=t.sort((t,e)=>e.overscaledZ-t.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let r=0;r<n;r++)t[r+i]=new nr({func:e.GEQUAL,mask:255},r+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,r]}return[{[i]:nr.disabled},r]}stencilConfigForOverlapTwoPass(t){const e=this.context.gl,r=t.sort((t,e)=>e.overscaledZ-t.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){const t={},o={};for(let r=0;r<n;r++)t[r+i]=new nr({func:e.GREATER,mask:255},n+1+r,255,e.KEEP,e.KEEP,e.REPLACE),o[r+i]=new nr({func:e.GREATER,mask:255},1+r,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[t,o,r]}return this.nextStencilID=3,[{[i]:new nr({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[i]:new nr({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},r]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const r=1/8;return new Qe([t.CONSTANT_COLOR,t.ONE],new e.bp(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Qe.unblended:Qe.alphaBlended}getDepthModeForSublayer(t,e,r){if(!this.opaquePassEnabledForLayer())return rr.disabled;const i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new rr(r||this.context.gl.LEQUAL,e,[i,i])}getDepthModeFor3D(){return new rr(this.context.gl.LEQUAL,rr.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){var i,n;this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(c()),this.imageManager.beginFrame();const o=this.style._order,a=this.style.tileManagers,s={},l={},u={},h={isRenderingToTexture:!1,isRenderingGlobe:(null===(i=t.projection)||void 0===i?void 0:i.transitionState)>0};for(const t in a){const e=a[t];e.used&&e.prepare(this.context),s[t]=e.getVisibleCoordinates(!1),l[t]=s[t].slice().reverse(),u[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of o){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=l[e.source];("custom"===e.type||r.length)&&this.renderLayer(this,a[e.source],e,r,h)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?e.bp.black:e.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,e){const r=t.context,i=r.gl,n=((t,e,r)=>{const i=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),o=yt(e),a=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-o*n)*r,(e.height/2+o*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*r,u_sky_blend:a}})(e,t.style.map.transform,t.pixelRatio),o=new rr(i.LEQUAL,rr.ReadWrite,[0,1]),a=nr.disabled,s=t.colorModeForRenderPass(),l=t.useProgram("sky"),c=Zn(r,e);l.draw(r,i.TRIANGLES,o,a,s,er.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[o[this.currentLayer]],e=a[t.source],r=s[t.source];this._renderTileClippingMasks(t,r,!1),this.renderLayer(this,e,t,r,h)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const t=this.style._layers[o[this.currentLayer]],e=a[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,h))continue;this.opaquePassEnabledForLayer()||p||(p=!0,h.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const r=("symbol"===t.type?u:l)[t.source];this._renderTileClippingMasks(t,s[t.source],!!this.renderToTexture),this.renderLayer(this,e,t,r,h)}if(h.isRenderingGlobe&&function(t,r,i){const n=t.context,o=n.gl,a=t.useProgram("atmosphere"),s=new rr(o.LEQUAL,rr.ReadOnly,[0,1]),l=t.transform,c=function(t,r){const i=t.properties.get("position"),n=[-i.x,-i.y,-i.z],o=e.ar(new Float64Array(16));return"map"===t.properties.get("anchor")&&(e.bg(o,o,r.rollInRadians),e.bh(o,o,-r.pitchInRadians),e.bg(o,o,r.bearingInRadians),e.bh(o,o,r.center.lat*Math.PI/180),e.bJ(o,o,-r.center.lng*Math.PI/180)),e.cg(n,n,o),n}(i,t.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=r.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const p=_r(l.worldSize,l.center.lat),d=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,e.aH(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,e.aH(f,f,d),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((t,e,r,i,n)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],p,d),g=Zn(n,r);a.draw(n,o.TRIANGLES,s,nr.disabled,Qe.alphaBlended,er.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const t=function(t,e){let r=null;const i=Object.values(t._layers).flatMap(r=>r.source&&!r.isHidden(e)?[t.tileManagers[r.source]]:[]),n=i.filter(t=>"vector"===t.getSource().type),o=i.filter(t=>"vector"!==t.getSource().type),a=t=>{(!r||r.getSource().maxzoom<t.getSource().maxzoom)&&(r=t)};return n.forEach(t=>a(t)),r||o.forEach(t=>a(t)),r}(this.style,this.transform.zoom);t&&function(t,e,r){for(let i=0;i<r.length;i++)Gn(t,e,r[i])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Vn(t,t.transform.height-(e.top||0),3,Fn),Vn(t,e.bottom||0,3,Bn),Un(t,e.left||0,3,On),Un(t,t.transform.width-(e.right||0),3,jn);const r=t.transform.centerPoint;!function(t,e,r,i){$n(t,e-1,r-10,2,20,i),$n(t,e-10,r-1,20,2,i)}(t,r.x,t.transform.height-r.y,Nn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const r=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=t?!e.cj(r,i):!e.ck(r,i)),n||(n=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(e.cl(r,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,r){const i=t.context,n=i.gl,o=t.transform,a=Qe.unblended,s=new rr(n.LEQUAL,rr.ReadWrite,[0,1]),l=r.tileManager.getRenderableTiles(),c=t.useProgram("terrainDepth");i.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:e.bp.transparent,depth:1});for(const t of l){const e=r.getTerrainMesh(t.tileID),l=r.getTerrainData(t.tileID),u=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:r.getMeshFrameDelta(o.zoom)};c.draw(i,n.TRIANGLES,s,nr.disabled,a,er.backCCW,h,l,u,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,r){const i=t.context,n=i.gl,o=t.transform,a=Qe.unblended,s=new rr(n.LEQUAL,rr.ReadWrite,[0,1]),l=r.getCoordsTexture(),c=r.tileManager.getRenderableTiles(),u=t.useProgram("terrainCoords");i.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:e.bp.transparent,depth:1}),r.coordsIndex=[];for(const t of c){const e=r.getTerrainMesh(t.tileID),c=r.getTerrainData(t.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const h={u_terrain_coords_id:(255-r.coordsIndex.length)/255,u_texture:0,u_ele_delta:r.getMeshFrameDelta(o.zoom)},p=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,n.TRIANGLES,s,nr.disabled,a,er.backCCW,h,c,p,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),r.coordsIndex.push(t.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,r,i,n,o){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(n||[]).length)&&(this.id=i.id,e.cm(i)?function(t,r,i,n,o,a){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:s}=a,l=nr.disabled,c=t.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,r,i,n,o,a,s,l,c){const u=r.transform,h=r.style.map.terrain,p="map"===o,d="map"===a;for(const o of t){const t=n.getTile(o),a=t.getBucket(i);if(!a||!a.text||!a.text.segments.get().length)continue;const f=e.ay(a.textSizeData,u.zoom),m=e.aN(t,1,r.transform.zoom),g=Nt(p,r.transform,m),_="none"!==i.layout.get("icon-text-fit")&&a.hasIconData();if(f){const r=Math.pow(2,u.zoom-t.tileID.overscaledZ),i=h?(t,e)=>h.getElevation(o,t,e):null;mn(a,p,d,c,u,g,r,f,_,e.aO(u,t,s,l),o.toUnwrapped(),i)}}}(n,t,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&_n(t,r,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),l,c,s),0!==i.paint.get("text-opacity").constantOr(1)&&_n(t,r,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),l,c,s),r.map.showCollisionBoxes&&(hn(t,r,i,n,!0),hn(t,r,i,n,!1))}(t,r,i,n,this.style.placement.variableOffsets,o):e.cn(i)?function(t,r,i,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=i.paint.get("circle-opacity"),l=i.paint.get("circle-stroke-width"),c=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=t.context,p=h.gl,d=t.transform,f=t.getDepthModeForSublayer(0,rr.ReadOnly),m=nr.disabled,g=t.colorModeForRenderPass(),_=[],y=d.getCircleRadiusCorrection();for(let o=0;o<n.length;o++){const s=n[o],l=r.getTile(s),c=l.getBucket(i);if(!c)continue;const h=i.paint.get("circle-translate"),p=i.paint.get("circle-translate-anchor"),f=e.aO(d,l,h,p),m=c.programConfigurations.get(i.id),g=t.useProgram("circle",m),v=c.layoutVertexBuffer,b=c.indexBuffer,x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(s),w={programConfiguration:m,program:g,layoutVertexBuffer:v,indexBuffer:b,uniformValues:Xr(t,l,i,f,y),terrainData:x,projectionData:d.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){const t=c.segments.get();for(const r of t)_.push({segments:new e.aX([r]),sortKey:r.sortKey,state:w})}else _.push({segments:c.segments,sortKey:0,state:w})}u&&_.sort((t,e)=>t.sortKey-e.sortKey);for(const e of _){const{programConfiguration:r,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=e.state;n.draw(h,p.TRIANGLES,f,m,g,er.backCCW,s,l,c,i.id,o,a,e.segments,i.paint,t.transform.zoom,r)}}(t,r,i,n,o):e.co(i)?function(t,r,i,n,o){if(0===i.paint.get("heatmap-opacity"))return;const a=t.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(t.style.map.terrain){for(const e of n){const n=r.getTile(e);r.hasRenderableParent(e)||("offscreen"===t.renderPass?vn(t,n,i,e,l):"translucent"===t.renderPass&&bn(t,i,e,s,l))}a.viewport.set([0,0,t.width,t.height])}else"offscreen"===t.renderPass?function(t,r,i,n){const o=t.context,a=o.gl,s=t.transform,l=nr.disabled,c=new Qe([a.ONE,a.ONE],e.bp.transparent,[!0,!0,!0,!0]);(function(t,r,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,r.width/4,r.height/4]);let o=i.heatmapFbos.get(e.cd);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer)):(o=xn(t,r.width/4,r.height/4),i.heatmapFbos.set(e.cd,o))})(o,t,i),o.clear({color:e.bp.transparent});for(let e=0;e<n.length;e++){const u=n[e];if(r.hasRenderableParent(u))continue;const h=r.getTile(u),p=h.getBucket(i);if(!p)continue;const d=p.programConfigurations.get(i.id),f=t.useProgram("heatmap",d),m=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,rr.disabled,l,c,er.backCCW,Qr(h,s.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,i.paint,s.zoom,d)}o.viewport.set([0,0,t.width,t.height])}(t,r,i,n):"translucent"===t.renderPass&&function(t,r){const i=t.context,n=i.gl;i.setColorMode(t.colorModeForRenderPass());const o=r.heatmapFbos.get(e.cd);o&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),wn(i,r).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(i,n.TRIANGLES,rr.disabled,nr.disabled,t.colorModeForRenderPass(),er.disabled,ti(t,r,0,1),null,null,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,r.paint,t.transform.zoom))}(t,i)}(t,r,i,n,o):e.cp(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:o}=n,a=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===a.constantOr(1)||0===s.constantOr(1))return;const l=t.getDepthModeForSublayer(0,rr.ReadOnly),c=t.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),h=u.constantOr(1),p=r.paint.get("line-pattern"),d=p.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters();let g;g=d?"linePattern":h&&f?"lineGradientSDF":h?"lineSDF":f?"lineGradient":"line";const _=t.context,y=_.gl,v=t.transform;let b=!0;for(const n of i){const i=e.getTile(n);if(d&&!i.patternsLoaded())continue;const a=i.getBucket(r);if(!a)continue;const s=a.programConfigurations.get(r.id),x=t.context.program.get(),w=t.useProgram(g,s),T=b||w.program!==x,S=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n),P=p.constantOr(null),M=u&&u.constantOr(null);if(P&&i.imageAtlas){const t=i.imageAtlas,e=t.patternPositions[P.to.toString()],r=t.patternPositions[P.from.toString()];e&&r&&s.setConstantPatternPositions(e,r)}else if(M){const e="round"===r.layout.get("line-cap"),i=t.lineAtlas.getDash(M.to,e),n=t.lineAtlas.getDash(M.from,e);s.setConstantDashPositions(i,n)}const A=v.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),E=v.getPixelScale();let I;d?(I=si(t,i,r,E,m),Sn(_,y,i,s,m)):h&&f?(I=ci(t,i,r,E,m,a.lineClipsArray.length),An(t,e,_,y,r,a,n,s,m)):h?(I=li(t,i,r,E,m),Pn(t,_,y,s,T,m)):f?(I=ai(t,i,r,E,a.lineClipsArray.length),Mn(t,e,_,y,r,a,n)):I=oi(t,i,r,E);const C=t.stencilModeForClipping(n);w.draw(_,y.TRIANGLES,l,C,c,er.disabled,I,S,A,r.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,r.paint,t.transform.zoom,s,a.layoutVertexBuffer2),b=!1}}(t,r,i,n,o):e.cq(i)?function(t,r,i,n,o){const a=i.paint.get("fill-color"),s=i.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=t.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=t.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===a.constantOr(e.bp.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===h){const e=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?rr.ReadWrite:rr.ReadOnly);In(t,r,i,n,e,c,!1,l)}if("translucent"===t.renderPass&&i.paint.get("fill-antialias")){const e=t.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,rr.ReadOnly);In(t,r,i,n,e,c,!0,l)}}(t,r,i,n,o):e.cr(i)?function(t,e,r,i,n){const o=r.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===t.renderPass){const n=new rr(t.context.gl.LEQUAL,rr.ReadWrite,t.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))Cn(t,e,r,i,n,nr.disabled,Qe.disabled,a),Cn(t,e,r,i,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),a);else{const o=t.colorModeForRenderPass();Cn(t,e,r,i,n,nr.disabled,o,a)}}}(t,r,i,n,o):e.cs(i)?function(t,r,i,n,o){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=t.context,l=t.style.projection.useSubdivision,c=t.getDepthModeForSublayer(0,rr.ReadOnly),u=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,r,i,n,o,a,s){const l=t.context,c=l.gl;for(const u of i){const i=r.getTile(u),h=i.dem;if(!h||!h.data)continue;if(!i.needsHillshadePrepare)continue;const p=h.dim,d=h.stride,f=h.getPixels();if(l.activeTexture.set(c.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(d),i.demTexture){const t=i.demTexture;t.update(f,{premultiply:!1}),t.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else i.demTexture=new e.T(l,f,c.RGBA,{premultiply:!1}),i.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);l.activeTexture.set(c.TEXTURE0);let m=i.fbo;if(!m){const t=new e.T(l,{width:p,height:p,data:null},c.RGBA);t.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=i.fbo=l.createFramebuffer(p,p,!0,!1),m.colorAttachment.set(t.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,p,p]),t.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,a,s,er.disabled,ri(i.tileID,h),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(t,r,n,i,c,nr.disabled,u),s.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(l){const[e,o,s]=t.stencilConfigForOverlapTwoPass(n);Dn(t,r,i,s,e,c,u,!1,a),Dn(t,r,i,s,o,c,u,!0,a)}else{const[e,o]=t.getStencilConfigForOverlapAndUpdateStencilID(n);Dn(t,r,i,o,e,c,u,!1,a)}}(t,r,i,n,o):e.ct(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=t.style.projection.useSubdivision,s=t.getDepthModeForSublayer(0,rr.ReadOnly),l=t.colorModeForRenderPass();if(a){const[n,a,c]=t.stencilConfigForOverlapTwoPass(i);zn(t,e,r,c,n,s,l,!1,o),zn(t,e,r,c,a,s,l,!0,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(i);zn(t,e,r,a,n,s,l,!1,o)}}(t,r,i,n,o):e.bU(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=e.getSource(),s=t.style.projection.useSubdivision;if(a instanceof rt)Rn(t,e,r,i,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=t.stencilConfigForOverlapTwoPass(i);Rn(t,e,r,s,n,!1,!0,kn,!1,o),Rn(t,e,r,s,a,!0,!0,kn,!1,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(i);Rn(t,e,r,a,n,!1,!0,kn,!1,o)}}(t,r,i,n,o):e.cu(i)?function(t,e,r,i,n){const o=r.paint.get("background-color"),a=r.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:s}=n,l=t.context,c=l.gl,u=t.style.projection,h=t.transform,p=h.tileSize,d=r.paint.get("background-pattern");if(t.isPatternMissing(d))return;const f=!d&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;const m=nr.disabled,g=t.getDepthModeForSublayer(0,"opaque"===f?rr.ReadWrite:rr.ReadOnly),_=t.colorModeForRenderPass(),y=t.useProgram(d?"backgroundPattern":"background"),v=i||At(h,{tileSize:p,terrain:t.style.map.terrain});d&&(l.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context));const b=r.getCrossfadeParameters();for(const e of v){const i=h.getProjectionData({overscaledTileID:e,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),n=d?yi(a,t,d,{tileID:e,tileSize:p},b):_i(a,o),f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e),v=u.getMeshFromTileID(l,e.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,g,m,_,er.backCCW,n,f,i,r.id,v.vertexBuffer,v.indexBuffer,v.segments)}}(t,0,i,n,o):e.cv(i)&&function(t,e,r,i){const{isRenderingGlobe:n}=i,o=t.context,a=r.implementation,s=t.style.projection,l=t.transform,c=l.getProjectionDataForCustomLayer(n),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:c},h=a.renderingMode?a.renderingMode:"2d";if("offscreen"===t.renderPass){const e=a.prerender;e&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),e.call(a,o.gl,u),o.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(nr.disabled);const e="3d"===h?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,rr.ReadOnly);o.setDepthMode(e),a.render(o.gl,u),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}(t,0,i,o))}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r}useProgram(t,e,r=!1,i=[]){this.cache=this.cache||{};const n=!!this.style.map.terrain,o=this.style.projection,a=r?Re.projectionMercator:o.shaderPreludeCode,s=r?Oe:o.shaderDefine,l=t+(e?e.cacheKey:"")+`/${r?je:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(i?`/${i.join("/")}`:"");return this.cache[l]||(this.cache[l]=new Ur(this.context,Re[t],e,bi[t],this._showOverdrawInspector,n,a,s,i)),this.cache[l]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,e;if(this._tileTextures){for(const t in this._tileTextures){const e=this._tileTextures[t];if(e)for(const t of e)t.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.vertexBuffer)||void 0===t||t.destroy()),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.indexBuffer)||void 0===e||e.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const t in this.cache){const e=this.cache[t];e&&e.program&&this.context.gl.deleteProgram(e.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function Hn(t,e){let r,i=!1,n=null,o=null;const a=()=>{n=null,i&&(t.apply(o,r),n=setTimeout(a,e),i=!1)};return(...t)=>(i=!0,o=this,r=t,n||a(),n)}class Xn{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(t=>t.split("=")).forEach(t=>{t[0]===this._hashName&&(e=t)}),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(!this._isValidHash(t))return!1;const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let r=e;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${e}`);let i=window.location.hash.replace(r,"");i.startsWith("#&")?i=i.slice(0,1)+i.slice(2):"#"===i&&(i="");let n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Hn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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(t){const e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${a}/${r}`:`${r}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const r=window.location.hash.slice(1).split("&").map(r=>{const i=r.split("=")[0];return i===t?(e=!0,`${i}=${c}`):r}).filter(t=>t);return e||r.push(`${t}=${c}`),`#${r.join("&")}`}return`#${c}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new e.V(+t[2],+t[1])}catch(t){return!1}const r=+t[0],i=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Yn={linearity:.3,easing:e.cw(0,0,.3,1)},Kn=e.e({deceleration:2500,maxSpeed:1400},Yn),Jn=e.e({deceleration:20,maxSpeed:1400},Yn),Qn=e.e({deceleration:1e3,maxSpeed:360},Yn),to=e.e({deceleration:1e3,maxSpeed:90},Yn),eo=e.e({deceleration:1e3,maxSpeed:360},Yn);class ro{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=c();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const r={zoom:0,bearing:0,pitch:0,roll:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta),t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){const o=no(r.pan.mag(),i,e.e({},Kn,t||{})),a=r.pan.mult(o.amount/r.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);n.center=s.easingCenter,n.offset=s.easingOffset,io(n,o)}if(r.zoom){const t=no(r.zoom,i,Jn),o=e.cx(this._map.transform.zoom+t.amount,this._map.getZoomSnap(),t.amount);n.zoom=o,io(n,t)}if(r.bearing){const t=no(r.bearing,i,Qn);n.bearing=this._map.transform.bearing+e.an(t.amount,-179,179),io(n,t)}if(r.pitch){const t=no(r.pitch,i,to);n.pitch=this._map.transform.pitch+t.amount,io(n,t)}if(r.roll){const t=no(r.roll,i,eo);n.roll=this._map.transform.roll+e.an(t.amount,-179,179),io(n,t)}if(n.zoom||n.bearing){const t=void 0===r.pinchAround?r.around:r.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(n,{noMoveStart:!0})}}function io(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function no(t,r,i){const{maxSpeed:n,linearity:o,deceleration:a}=i,s=e.an(t*o/(r/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:i.easing,duration:1e3*l,amount:s*(l/2)}}class oo extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(t,i);const o=u.mousePos(r.getCanvas(),i),a=r.unproject(o);super(t,e.e({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}}class ao extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i){const n="touchend"===t?i.changedTouches:i.touches,o=u.touchPos(r.getCanvasContainer(),n),a=o.map(t=>r.unproject(t)),s=o.reduce((t,e,r,i)=>t.add(e.div(i.length)),new e.P(0,0));super(t,{points:o,point:s,lngLats:a,lngLat:r.unproject(s),originalEvent:i}),this._defaultPrevented=!1}}class so extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,r){super(t,{originalEvent:r}),this._defaultPrevented=!1}}class lo{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new so(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new oo(t.type,this._map,t))}mouseup(t){this._map.fire(new oo(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new oo(t.type,this._map,t))}dblclick(t){return this._firePreventable(new oo(t.type,this._map,t))}mouseover(t){this._map.fire(new oo(t.type,this._map,t))}mouseout(t){this._map.fire(new oo(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ao(t.type,this._map,t))}touchmove(t){this._map.fire(new ao(t.type,this._map,t))}touchend(t){this._map.fire(new ao(t.type,this._map,t))}touchcancel(t){this._map.fire(new ao(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class co{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new oo(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new oo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new oo(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uo{constructor(t){this._map=t}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(t){return this.transform.screenPointToLocation(e.P.convert(t),this._map.terrain)}}class ho{constructor(t,e){this._map=t,this._tr=new uo(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(u.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const i=this._startPos;this._lastPos=r,this._box||(this._box=u.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const n=Math.min(i.x,r.x),o=Math.max(i.x,r.x),a=Math.min(i.y,r.y),s=Math.max(i.y,r.y);u.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"}mouseupWindow(t,r){if(!this._active)return;if(0!==t.button)return;const i=this._startPos,n=r;if(this.reset(),u.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new e.l("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(u.remove(this._box),this._box=null),u.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new e.l(t,{originalEvent:r}))}}function po(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const r={};for(let i=0;i<t.length;i++)r[t[i].identifier]=e[i];return r}class fo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){const r=new e.P(0,0);for(const e of t)r._add(e);return r.div(t.length)}(r),this.touches=po(i,r)))}touchmove(t,e,r){if(this.aborted||!this.centroid)return;const i=po(r,e);for(const t in this.touches){const e=i[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class mo{constructor(t){this.singleTap=new fo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,r){this.singleTap.touchstart(t,e,r)}touchmove(t,e,r){this.singleTap.touchmove(t,e,r)}touchend(t,e,r){const i=this.singleTap.touchend(t,e,r);if(i){const e=t.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if(e&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class go{constructor(t){this._tr=new uo(t),this._zoomIn=new mo({numTouches:1,numTaps:2}),this._zoomOut=new mo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)}touchmove(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)}touchend(t,r,i){const n=this._zoomIn.touchend(t,r,i),o=this._zoomOut.touchend(t,r,i),a=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:e.cx(a.zoom+1,r.getZoomSnap()),around:a.unproject(n)},{originalEvent:t})}):o?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:e.cx(a.zoom-1,r.getZoomSnap()),around:a.unproject(o)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _o{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const i=Array.isArray(e)?e[0]:e;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&u.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const yo=0,vo=2,bo={[yo]:1,[vo]:2};class xo{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=u.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const r=bo[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton)}isValidEndEvent(t){return u.mouseButton(t)===this._eventButton}}class wo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class To{constructor(t=new xo({checkCorrectEvent:()=>!0}),e=new wo){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e}_executeRelevantHandler(t,e,r){return t instanceof MouseEvent?e(t):"undefined"!=typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.startMove(t),t=>this.oneFingerTouchMoveStateManager.startMove(t))}endMove(t){this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.endMove(t),t=>this.oneFingerTouchMoveStateManager.endMove(t))}isValidStartEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}}const So=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class Po{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,r){return this._calculateTransform(t,e,r)}touchmove(t,e,r){if(this._active){if(!this._shouldBePrevented(r.length))return t.preventDefault(),this._calculateTransform(t,e,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,r){this._calculateTransform(t,e,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);const n=po(i,r),o=new e.P(0,0),a=new e.P(0,0);let s=0;for(const t in n){const e=n[t],r=this._touches[t];r&&(o._add(e),a._add(e.sub(r)),s++,n[t]=e)}if(this._touches=n,this._shouldBePrevented(s)||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,r){if(!this._firstTwoTouches)return;t.preventDefault();const[i,n]=this._firstTwoTouches,o=Ao(r,e,i),a=Ao(r,e,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;const[i,n]=this._firstTwoTouches,o=Ao(r,e,i),a=Ao(r,e,n);o&&a||(this._active&&u.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Ao(t,e,r){for(let i=0;i<t.length;i++)if(t[i].identifier===r)return e[i]}function Eo(t,e){return Math.log(t/e)/Math.LN2}class Io extends Mo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Eo(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Eo(this._distance,r),pinchAround:e}}}function Co(t,e){return 180*t.angleWith(e)/Math.PI}class Do extends Mo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,r){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Co(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,r=Co(t,this._startVector);return Math.abs(r)<e}}function zo(t){return Math.abs(t.y)>Math.abs(t.x)}class ko extends Mo{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,r){super.touchstart(t,e,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,zo(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const i=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,r){if(void 0!==this._valid)return this._valid;const i=t.mag()>=2,n=e.mag()>=2;if(!i&&!n)return;if(!i||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return zo(t)&&zo(e)&&o}}const Ro={panStep:100,bearingStep:15,pitchStep:10};class Lo{constructor(t){this._tr=new uo(t);const e=Ro;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,i=0,n=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{const l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:Fo,zoom:r?e.cx(l.zoom+r*(t.shiftKey?2:1),s.getZoomSnap()):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:l.center},{originalEvent:t})}}}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 Fo(t){return t*(2-t)}const Bo=4.000244140625,Oo=1/450;class jo{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new uo(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Oo}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=c(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==e&&e%Bo==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(i*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){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 r=u.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(e.V.convert(i.center)):r,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e)}if(0!==this._delta){const r="wheel"===this._type&&Math.abs(this._delta)>Bo?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);const n="number"!=typeof this._targetZoom?t.scale:e.aq(this._targetZoom),o=t.applyConstrain(t.getCameraLngLat(),e.at(n*i)).zoom,a=this._map.getZoomSnap();if("wheel"===this._type&&a>0){const r=e.cx(t.zoom,a);this._targetZoom=e.cx(o,a,o-r)}else this._targetZoom=o;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,i=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&i&&n){const t=c()-this._lastWheelEventTime,s=Math.min((t+5)/200,1),l=n(s);o=e.G.number(i,r,l),s<1?this._frameId||(this._frameId=!0):a=!0}else o=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=e.cz;if(this._prevEase){const t=this._prevEase,i=(c()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),o=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-o*o);r=e.cw(o,a,.25,1)}return this._prevEase={start:c(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class No{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 Vo{constructor(t){this._tr=new uo(t),this.reset()}reset(){this._active=!1}dblclick(t,r){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:e.cx(this._tr.zoom+(t.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Uo{constructor(){this._tap=new mo({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(t,e,r){if(!this._swipePoint)if(this._tapTime){const i=e[0],n=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(i)<30;n&&o?r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,e,r)}touchmove(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const i=e[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,r)}touchend(t,e,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{const i=this._tap.touchend(t,e,r);i&&(this._tapTime=t.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $o{constructor(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r}enable(t){this._inertiaOptions=t||{},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 Go{constructor(t,e,r,i){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class qo{constructor(t,e,r,i){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),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 Zo{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=u.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=e,this._container.appendChild(i);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(u.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(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new e.l("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Wo=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class Ho extends e.l{}function Xo(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class Yo{get _ownerDocument(){var t;return(null===(t=this._el)||void 0===t?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,e;return(null===(e=null===(t=this._el)||void 0===t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView)||window}constructor(t,r){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},o={},a={};for(const{handlerName:s,handler:l,allowed:c}of this._handlers){if(!l.isEnabled())continue;let h;if(this._blockedByActive(a,c,s))l.reset();else if(l[r||t.type]){if(e.cA(t,r||t.type)){const e=u.mousePos(this._map.getCanvas(),t);h=l[r||t.type](t,e)}else if(e.cB(t,r||t.type)){const e=this._getMapTouches(t.touches),i=u.touchPos(this._map.getCanvas(),e);h=l[r||t.type](t,i,e)}else e.cC(r||t.type)||(h=l[r||t.type](t));this.mergeHandlerResult(n,o,h,s,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()}(h||l.isActive())&&(a[s]=l)}const s={};for(const t in this._previousActiveHandlers)a[t]||(s[t]=i);this._previousActiveHandlers=a,(Object.keys(s).length||Xo(n))&&(this._changes.push([n,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||Xo(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:l}=n;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ro(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[t,e,r]of this._listeners)u.addEventListener(t,e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(const[t,e,r]of this._listeners)u.removeEventListener(t,e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new lo(r,t));const n=r.boxZoom=new ho(r,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const o=r.cooperativeGestures=new Zo(r,t.cooperativeGestures);this._add("cooperativeGestures",o),t.cooperativeGestures&&o.enable();const a=new go(r),s=new Vo(r);r.doubleClickZoom=new No(s,a),this._add("tapZoom",a),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();const l=new Uo;this._add("tapDragZoom",l);const c=r.touchPitch=new ko(r);this._add("touchPitch",c),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);const h=()=>r.project(r.getCenter()),p=function({enable:t,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const s=new xo({checkCorrectEvent:t=>0===u.mouseButton(t)&&t.ctrlKey||2===u.mouseButton(t)&&!t.ctrlKey});return new _o({clickTolerance:r,move:(t,r)=>{const s=a();if(i&&Math.abs(s.y-t.y)>n)return{bearingDelta:e.cy(new e.P(t.x,r.y),r,s)};let l=(r.x-t.x)*o;return i&&r.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:s,enable:t,assignEvents:So})}(t,h),d=function({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5}){const i=new xo({checkCorrectEvent:t=>0===u.mouseButton(t)&&t.ctrlKey||2===u.mouseButton(t)});return new _o({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*r}),moveStateManager:i,enable:t,assignEvents:So})}(t),f=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:r=.3},i){const n=new xo({checkCorrectEvent:t=>2===u.mouseButton(t)&&t.ctrlKey});return new _o({clickTolerance:e,move:(t,e)=>{const n=i();let o=(e.x-t.x)*r;return e.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:t,assignEvents:So})}(t,h);r.dragRotate=new Go(t,p,d,f),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();const m=function({enable:t,clickTolerance:e}){const r=new xo({checkCorrectEvent:t=>0===u.mouseButton(t)&&!t.ctrlKey});return new _o({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:So})}(t),g=new Po(t,r);r.dragPan=new $o(i,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);const _=new Do,y=new Io;r.touchZoomRotate=new qo(i,y,_,l),this._add("touchRotate",_,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new co(r));const v=r.scrollZoom=new jo(r,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);const b=r.keyboard=new Lo(r);this._add("keyboard",b),t.interactive&&t.keyboard&&r.keyboard.enable()}_add(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Wo(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,r){for(const i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const r of t)this._el.contains(r.target)&&e.push(r);return e}mergeHandlerResult(t,r,i,n,o){if(!i)return;e.e(t,i);const a={handlerName:n,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(r.zoom=a),void 0!==i.panDelta&&(r.drag=a),void 0!==i.rollDelta&&(r.roll=a),void 0!==i.pitchDelta&&(r.pitch=a),void 0!==i.bearingDelta&&(r.rotate=a)}_applyChanges(){const t={},r={},i={};for(const[n,o,a]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.e(r,o),e.e(i,a);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,e,r){const i=this._map,n=i._getTransformForUpdate(),o=i.terrain;if(!(Xo(t)||o&&this._terrainMovement))return this._fireEvents(e,r,!0);i._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:p}=t;void 0!==p&&(h=p),h=h||i.transform.centerPoint,o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const d={panDelta:a,zoomDelta:s,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(a?h.sub(a):h);this._handleMapControls({terrain:o,tr:n,deltasForHelper:d,preZoomAroundLoc:f,combinedEventsInProgress:e,panDelta:a}),i._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)}_handleMapControls({terrain:t,tr:e,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:n,panDelta:o}){const a=this._map.cameraHelper;if(a.handleMapControlsRollPitchBearingZoom(r,e),t)return a.useGlobeControls?(this._terrainMovement||!n.drag&&!n.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void a.handleMapControlsPan(r,e,i)):this._terrainMovement||!n.drag&&!n.zoom?void(n.drag&&this._terrainMovement&&o?e.setCenter(e.screenPointToLocation(e.centerPoint.sub(o))):a.handleMapControlsPan(r,e,i)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void a.handleMapControlsPan(r,e,i));a.handleMapControlsPan(r,e,i)}_fireEvents(t,r,i){const n=Wo(this._eventsInProgress),o=Wo(t),a={};for(const e in t){const{originalEvent:r}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=r),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:r}=t[e];this._fireEvent(e,r)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=r[e]||i,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const u=Wo(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(i&&h){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&s.prefersReducedMotion?(this._map.fire(new e.l("moveend",{originalEvent:c})),r(this._map.getBearing())&&this._map.resetNorth()):(r(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new e.l(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Ho("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Ko extends e.E{constructor(t,e,r){super(),this._renderFrameCallback=()=>{const t=Math.min((c()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this._zoomSnap=r.zoomSnap,this.cameraHelper=e,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,e){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=e}getCenter(){return new e.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,i){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},r),i)}panTo(t,r,i){return this.easeTo(e.e({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,r,i){return this.easeTo(e.e({zoom:t},r),i)}zoomIn(t,r){return this.zoomTo(e.cx(this.getZoom()+1,this._zoomSnap),t,r),this}zoomOut(t,r){return this.zoomTo(e.cx(this.getZoom()-1,this._zoomSnap),t,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new e.l("movestart",r)).fire(new e.l("move",r)).fire(new e.l("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,r,i){return this.easeTo(e.e({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,e.e({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(e.e({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=W.convert(t).adjustAntiMeridian();const r=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,e)}_cameraForBoxAndBearing(t,r,i,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=e.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}const a=e.e(o,n.padding);n.padding=a;const s=this.transform,l=new W(t,r);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,i,s)}fitBounds(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)}fitScreenCoordinates(t,r,i,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(e.P.convert(t)),this.transform.screenPointToLocation(e.P.convert(r)),i,n),n,o)}_fitInternal(t,r,i){return t?(delete(r=e.e(t,r)).padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(t,r){this.stop();const i=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,t);const l=i.zoom!==s;return"elevation"in t&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),"bearing"in t&&i.bearing!==+t.bearing&&(n=!0,i.setBearing(+t.bearing)),"pitch"in t&&i.pitch!==+t.pitch&&(o=!0,i.setPitch(+t.pitch)),"roll"in t&&i.roll!==+t.roll&&(a=!0,i.setRoll(+t.roll)),null==t.padding||i.isPaddingEqual(t.padding)||i.setPadding(t.padding),this._applyUpdatedTransform(i),this.fire(new e.l("movestart",r)).fire(new e.l("move",r)),l&&this.fire(new e.l("zoomstart",r)).fire(new e.l("zoom",r)).fire(new e.l("zoomend",r)),n&&this.fire(new e.l("rotatestart",r)).fire(new e.l("rotate",r)).fire(new e.l("rotateend",r)),o&&this.fire(new e.l("pitchstart",r)).fire(new e.l("pitch",r)).fire(new e.l("pitchend",r)),a&&this.fire(new e.l("rollstart",r)).fire(new e.l("roll",r)).fire(new e.l("rollend",r)),this.fire(new e.l("moveend",r))}calculateCameraOptionsFromTo(t,r,i,n=0){const o=e.a9.fromLngLat(t,r),a=e.a9.fromLngLat(i,n),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,u=Math.hypot(s,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(s,l),p=e.at(this.transform.cameraToCenterDistance/u/this.transform.tileSize),d=180*Math.atan2(s,-l)/Math.PI;let f=180*Math.acos(h/u)/Math.PI;return f=c<0?90-f:90+f,{center:a.toLngLat(),elevation:n,zoom:p,pitch:f,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,r,i,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(t,e,r,i);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:r,pitch:i,roll:n}}easeTo(t,r){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.cz},t)).animate||!t.essential&&s.prefersReducedMotion)&&(t.duration=0);const i=this._getTransformForUpdate(),n=this.getBearing(),o=i.pitch,a=i.roll,l="bearing"in t?this._normalizeBearing(t.bearing,n):n,c="pitch"in t?+t.pitch:o,u="roll"in t?this._normalizeBearing(t.roll,a):a,h="padding"in t?t.padding:i.padding,p=e.P.convert(t.offset);let d,f;t.around&&(d=e.V.convert(t.around),f=i.locationToScreenPoint(d));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(i,{bearing:l,pitch:c,roll:u,padding:h,around:d,aroundPoint:f,offsetAsPoint:p,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||u!==a,this._padding=!i.isPaddingEqual(h),this._zooming=this._zooming||g.isZooming,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(e=>{g.easeFunc(e),this.terrain&&!t.freezeElevation&&this._updateElevation(e),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,e)},t),this}_prepareEase(t,r,i={}){this._moving=!0,r||i.moving||this.fire(new e.l("movestart",t)),this._zooming&&!i.zooming&&this.fire(new e.l("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new e.l("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new e.l("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new e.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&r!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(r-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=r}this.transform.setElevation(e.G.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const e=t.getCameraLngLat(),r=t.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(r<i){const r=this.calculateCameraOptionsFromTo(e,i,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(t){const e=[];if(e.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&e.push(t=>this.transformCameraUpdate(t)),!e.length)return;const r=t.clone();for(const t of e){const e=r.clone(),{center:i,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=t(e);i&&e.setCenter(i),void 0!==l&&e.setElevation(l),void 0!==n&&e.setZoom(n),void 0!==o&&e.setRoll(o),void 0!==a&&e.setPitch(a),void 0!==s&&e.setBearing(s),r.apply(e,!1)}this.transform.apply(r,!1)}_fireMoveEvents(t){this.fire(new e.l("move",t)),this._zooming&&this.fire(new e.l("zoom",t)),this._rotating&&this.fire(new e.l("rotate",t)),this._pitching&&this.fire(new e.l("pitch",t)),this._rolling&&this.fire(new e.l("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;const i=this._zooming,n=this._rotating,o=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new e.l("zoomend",t)),n&&this.fire(new e.l("rotateend",t)),o&&this.fire(new e.l("pitchend",t)),a&&this.fire(new e.l("rollend",t)),this.fire(new e.l("moveend",t))}flyTo(t,r){if(!t.essential&&s.prefersReducedMotion){const i=e.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,r)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.cz},t);const i=this._getTransformForUpdate(),n=i.bearing,o=i.pitch,a=i.roll,l=i.padding,c="bearing"in t?this._normalizeBearing(t.bearing,n):n,u="pitch"in t?+t.pitch:o,h="roll"in t?this._normalizeBearing(t.roll,a):a,p="padding"in t?t.padding:i.padding,d=e.P.convert(t.offset);let f=i.centerPoint.add(d);const m=i.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(i,{bearing:c,pitch:u,roll:h,padding:p,locationAtOffset:m,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let _=t.curve;const y=Math.max(i.width,i.height),v=y/g.scaleOfZoom,b=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/b*2));const x=_*_;function w(t){const e=(v*v-y*y+(t?-1:1)*x*x*b*b)/(2*(t?v:y)*x*b);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function S(t){return(Math.exp(t)+Math.exp(-t))/2}const P=w(!1);let M=function(t){return S(P)/S(P+_*t)},A=function(t){return y*((S(P)*(T(e=P+_*t)/S(e))-T(P))/x)/b;var e},E=(w(!0)-P)/_;if(Math.abs(b)<2e-6||!isFinite(E)){if(Math.abs(y-v)<1e-6)return this.easeTo(t,r);const e=v<y?-1:1;E=Math.abs(Math.log(v/y))/_,A=()=>0,M=t=>Math.exp(e*_*t)}return t.duration="duration"in t?+t.duration:1e3*E/("screenSpeed"in t?+t.screenSpeed/_:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==a,this._padding=!i.isPaddingEqual(p),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(s=>{const m=s*E,_=1/M(m),y=A(m);this._rotating&&i.setBearing(e.G.number(n,c,s)),this._pitching&&i.setPitch(e.G.number(o,u,s)),this._rolling&&i.setRoll(e.G.number(a,h,s)),this._padding&&(i.interpolatePadding(l,p,s),f=i.centerPoint.add(d)),g.easeFunc(s,_,y,f),this.terrain&&!t.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(r=this.handlers)||void 0===r||r.stop(!1),this}_ease(t,e,r){!1===r.animate||0===r.duration?(t(1),e()):(this._easeStart=c(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){t=e.W(t,-180,180);const i=Math.abs(t-r);return Math.abs(t-360-r)<i&&(t-=360),Math.abs(t+360-r)<i&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(e.V.convert(t),this.transform):null}}const Jo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Qo{constructor(t=Jo){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=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=u.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=u.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u.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(){u.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(t,e){const r=this._map._getUIString(`AttributionControl.${e}`);t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.tileManagers;for(const r in e){const i=e[r];if(i.used||i.usedForTerrain){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,r)=>{for(let i=r+1;i<t.length;i++)if(t[i].indexOf(e)>=0)return!1;return!0});const r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=u.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ta{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=u.create("div","maplibregl-ctrl");const e=u.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){u.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ea{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,r=e?this._queue.concat(e):this._queue;for(const e of r)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const r of e)if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ra=e.aU([{name:"a_pos3d",type:"Int16",components:3}]);class ia extends e.E{constructor(t){super(),this._lastTilesetChange=c(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,r){this.tileManager.update(t,r),this._renderableTilesKeys=[];const i={};for(const n of At(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),e.c7(n.terrainRttPosMatrix32f,0,e.a5,e.a5,0,0,1),this._tiles[n.key]=new dt(n,this.tileSize),this._lastTilesetChange=c());for(const t in this._tiles)i[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const r=this._tiles[e];(!t||r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const r={};for(const i of this._renderableTilesKeys){const n=this._tiles[i].tileID,o=t.clone(),a=e.bk();if(n.canonical.equals(t.canonical))e.c7(a,0,e.a5,e.a5,0,0,1);else if(n.canonical.isChildOf(t.canonical)){const r=n.canonical.z-t.canonical.z,i=n.canonical.x-(n.canonical.x>>r<<r),o=n.canonical.y-(n.canonical.y>>r<<r),s=e.a5>>r;e.c7(a,0,s,s,0,0,1),e.O(a,a,[-i*s,-o*s,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{const r=t.canonical.z-n.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r),o=t.canonical.y-(t.canonical.y>>r<<r),s=e.a5>>r;e.c7(a,0,e.a5,e.a5,0,0,1),e.O(a,a,[i*s,o*s,0]),e.Q(a,a,[1/2**r,1/2**r,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),r[i]=o}return r}_getTerrainCoordsForTileRanges(t,r){const i={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,r))continue;const a=t.clone(),s=e.bk();if(o.canonical.z===t.canonical.z){const r=t.canonical.x-o.canonical.x+t.wrap*(1<<t.canonical.z),i=t.canonical.y-o.canonical.y;e.c7(s,0,e.a5,e.a5,0,0,1),e.O(s,s,[r*e.a5,i*e.a5,0])}else if(o.canonical.z>t.canonical.z){const r=o.canonical.z-t.canonical.z,i=o.canonical.x-(o.canonical.x>>r<<r)+t.wrap*(1<<o.canonical.z),n=o.canonical.y-(o.canonical.y>>r<<r),a=t.canonical.x-(o.canonical.x>>r),l=t.canonical.y-(o.canonical.y>>r),c=e.a5>>r;e.c7(s,0,c,c,0,0,1),e.O(s,s,[-i*c+a*e.a5,-n*c+l*e.a5,0])}else{const r=t.canonical.z-o.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r)+t.wrap*(1<<t.canonical.z),n=t.canonical.y-(t.canonical.y>>r<<r),a=(t.canonical.x>>r)-o.canonical.x,l=(t.canonical.y>>r)-o.canonical.y,c=e.a5<<r;e.c7(s,0,c,c,0,0,1),e.O(s,s,[i*e.a5+a*c,n*e.a5+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),i[n]=a}return i}getSourceTile(t,e){const r=this.tileManager._source;let i=t.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(i).key);let n=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(null==n?void 0:n.dem)&&e)for(;i>=r.minzoom&&!(null==n?void 0:n.dem);)n=this.findTileInCaches(t.scaledTo(i--).key);return n}findTileInCaches(t){let e=this.tileManager.getTileByID(t);return e||(e=this.tileManager._outOfViewCache.getByKey(t),e)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){const r=e[t.canonical.z];return!!r&&(t.wrap>r.minWrap||t.wrap<r.maxWrap||t.canonical.x>=r.minTileXWrapped&&t.canonical.x<=r.maxTileXWrapped&&t.canonical.y>=r.minTileY&&t.canonical.y<=r.maxTileY)}}class na{constructor(t,e,r){this._meshCache={},this.painter=t,this.tileManager=new ia(e),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,r,i,n=e.a5){var o;const a=t.normalizeCoordinates(r,i,n);if(!a)return 0;const s=this.getTerrainData(a.tileID),l=null===(o=s.tile)||void 0===o?void 0:o.dem;if(!l)return 0;const c=e.cD([],[a.x/n*e.a5,a.y/n*e.a5],s.u_terrain_matrix),u=[c[0]*l.dim,c[1]*l.dim],h=Math.floor(u[0]),p=Math.floor(u[1]),d=u[0]-h,f=u[1]-p;return l.get(h,p)*(1-d)*(1-f)+l.get(h+1,p)*d*(1-f)+l.get(h,p+1)*(1-d)*f+l.get(h+1,p+1)*d*f}getElevationForLngLatZoom(t,r){if(!e.cE(r,t.wrap()))return 0;const{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(i,n%e.a5,o%e.a5,e.a5)}getElevationForLngLat(t,e){const r=At(e,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let i=0;for(const t of r)t.canonical.z>i&&(i=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,i)}getElevation(t,r,i,n=e.a5){return this.getDEMElevation(t,r,i,n)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,r=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new e.T(t,r,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new e.T(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.ar([])}const r=this.tileManager.getSourceTile(t,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){const t=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new e.T(t,r.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),r.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}const i=r&&r.toString()+r.tileID.key+t.key;if(i&&!this._demMatrixCache[i]){const i=this.tileManager.getSource().maxzoom;let n=t.canonical.z-r.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=i?n=t.canonical.z-i:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=t.canonical.x-(t.canonical.x>>n<<n),a=t.canonical.y-(t.canonical.y>>n<<n),s=e.cF(new Float64Array(16),[1/(e.a5<<n),1/(e.a5<<n),0]);e.O(s,s,[o*e.a5,a*e.a5,0]),this._demMatrixCache[t.key]={matrix:s,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:r&&r.dem&&r.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r&&r.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(t){const r=this.painter,i=r.width/devicePixelRatio,n=r.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new e.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new e.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let i=0;i<this._coordsTextureSize;i++,e+=4)r[e+0]=255&i,r[e+1]=255&t,r[e+2]=i>>8<<4|t>>8,r[e+3]=0;const i=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new e.T(t,i,t.gl.RGBA,{premultiply:!1});return n.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const r=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,r),i.bindFramebuffer.set(null);const l=r[0]+(r[2]>>4<<8),c=r[1]+((15&r[2])<<8),u=this.coordsIndex[255-r[3]],h=u&&this.tileManager.getTileByID(u);if(!h)return null;const p=this._coordsTextureSize,d=(1<<h.tileID.canonical.z)*p;return new e.a9((h.tileID.canonical.x*p+l)/d+h.tileID.wrap,(h.tileID.canonical.y*p+c)/d,this.getElevation(h.tileID,l,c,p))}depthAtPoint(t){const e=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,e),r.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var r;const i=(null===(r=this.painter.style.projection)||void 0===r?void 0:r.transitionState)>0,n=i&&0===t.canonical.y,o=i&&t.canonical.y===(1<<t.canonical.z)-1,a=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new e.cG,c=new e.aY,u=this.meshSize,h=e.a5/u,p=u*u;for(let t=0;t<=u;t++)for(let e=0;e<=u;e++)l.emplaceBack(e*h,t*h,0);for(let t=0;t<p;t+=u+1)for(let e=0;e<u;e++)c.emplaceBack(e+t,u+e+t+1,u+e+t+2),c.emplaceBack(e+t,u+e+t+2,e+t+1);const d=l.length,f=d+(u+1),m=(u+1)*u,g=n?e.br:0,_=n?0:1,y=o?e.bs:e.a5,v=o?0:1;for(let t=0;t<=u;t++)l.emplaceBack(t*h,g,_);for(let t=0;t<=u;t++)l.emplaceBack(t*h,y,v);for(let t=0;t<u;t++)c.emplaceBack(m+t,f+t,f+t+1),c.emplaceBack(m+t,f+t+1,m+t+1),c.emplaceBack(0+t,d+t+1,d+t),c.emplaceBack(0+t,0+t+1,d+t+1);const b=l.length,x=b+2*(u+1);for(const t of[0,1])for(let r=0;r<=u;r++)for(const i of[0,1])l.emplaceBack(t*e.a5,r*h,i);for(let t=0;t<2*u;t+=2)c.emplaceBack(b+t,b+t+1,b+t+3),c.emplaceBack(b+t,b+t+3,b+t+2),c.emplaceBack(x+t,x+t+3,x+t+1),c.emplaceBack(x+t,x+t+2,x+t+3);const w=new Fe(s.createVertexBuffer(l,ra.members),s.createIndexBuffer(c),e.aX.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(t){return 2*Math.PI*e.bE/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,r){var i;if(!e.cE(r,t.wrap()))return 0;const{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(t,r);return null!==(i=this.getMinMaxElevation(n).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return e&&e.dem&&(r.minElevation=e.dem.min*this.exaggeration,r.maxElevation=e.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,r){const i=e.a9.fromLngLat(t.wrap()),n=(1<<r)*e.a5,o=i.x*n,a=i.y*n,s=Math.floor(o/e.a5),l=Math.floor(a/e.a5);return{tileID:new e.a2(r,0,r,s,l),mercatorX:o,mercatorY:a}}}class oa{constructor(t,e,r){this._context=t,this._size=e,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new e.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(i.texture),{id:t,fbo:r,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(e=>t.id!==e),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(t=>!t.inUse)}}const aa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class sa{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new oa(t.context,30,e.tileManager.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){var r,i;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(e)),this._coordsAscending={};for(const e in t.tileManagers){this._coordsAscending[e]={};const r=t.tileManagers[e].getVisibleCoordinates(),i=t.tileManagers[e].getSource(),n=i instanceof rt?i.terrainTileRanges:null;for(const t of r){const r=this.terrain.tileManager.getTerrainCoords(t,n);for(const t in r)this._coordsAscending[e][t]||(this._coordsAscending[e][t]=[]),this._coordsAscending[e][t].push(r[t])}}this._rttFingerprints={};for(const e of t._order){const n=t._layers[e],o=n.source;if(aa[n.type]&&!this._rttFingerprints[o]){this._rttFingerprints[o]={};const e=null!==(i=null===(r=t.tileManagers[o])||void 0===r?void 0:r.getState().revision)&&void 0!==i?i:0;for(const t in this._coordsAscending[o])this._rttFingerprints[o][t]=`${this._coordsAscending[o][t].map(t=>t.key).sort().join()}#${e}`}}for(const t of this._renderableTiles)for(const e in this._rttFingerprints){const r=this._rttFingerprints[e][t.tileID.key];r&&r!==t.rttFingerprint[e]&&(t.rtt=[])}}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;const i=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(aa[n]&&(this._prevType&&aa[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(aa[this._prevType]||aa[n]&&a){this._prevType=n;const t=this._stacks.length-1,r=this._stacks[t]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(qn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){const e=this.pool.getObjectForId(n.rtt[t].id);if(e.stamp===n.rtt[t].stamp){this.pool.useObject(e);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),n.rtt[t]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:e.bp.transparent,stencil:0}),o.currentStencilSource=void 0;for(let t=0;t<r.length;t++){const e=o.style._layers[r[t]],s=e.source?this._coordsAscending[e.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(e,s,!0),o.renderLayer(o,o.style.tileManagers[e.source],e,s,i),e.source&&(n.rttFingerprint[e.source]=this._rttFingerprints[e.source][n.tileID.key])}}return qn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),aa[n]}return!1}}const la={"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":"Drag to rotate map, click to reset 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","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","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"},ca=r,ua={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Jo,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 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],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:e.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},ha={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class pa{constructor(t,r,i=!1){this.mousedown=t=>{this.startMove(t,u.mousePos(this.element,t)),u.addEventListener(window,"mousemove",this.mousemove),u.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,u.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),u.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=u.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;const n=new To;this._rotatePitchHandler=new _o({clickTolerance:3,move:(t,n)=>{const o=r.getBoundingClientRect(),a=new e.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:e.cy(new e.P(t.x,n.y),n,a),pitchDelta:i?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,u.addEventListener(r,"mousedown",this.mousedown),u.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),u.addEventListener(r,"touchcancel",this.reset)}startMove(t,e){this._rotatePitchHandler.dragStart(t,e),u.disableDrag()}move(t,e){const r=this.map,{bearingDelta:i,pitchDelta:n}=this._rotatePitchHandler.dragMove(t,e)||{};i&&r.setBearing(r.getBearing()+i),n&&r.setPitch(r.getPitch()+n)}off(){const t=this.element;u.removeEventListener(t,"mousedown",this.mousedown),u.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend),u.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){u.enableDrag(),u.removeEventListener(window,"mousemove",this.mousemove),u.removeEventListener(window,"mouseup",this.mouseup),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend)}}let da;function fa(t,r,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return null==t?void 0:t.wrap();const o=new e.V(t.lng,t.lat);if(t=new e.V(t.lng,t.lat),r){const n=new e.V(t.lng-360,t.lat),o=new e.V(t.lng+360,t.lat),a=i.locationToScreenPoint(t).distSqr(r);i.locationToScreenPoint(n).distSqr(r)<a?t=n:i.locationToScreenPoint(o).distSqr(r)<a&&(t=o)}for(;Math.abs(t.lng-i.center.lng)>180;){const e=i.locationToScreenPoint(t);if(e.x>=0&&e.y>=0&&e.x<=i.width&&e.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t.lng!==o.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(t))?t:o}const ma={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 ga(t,e,r){const i=t.classList;for(const t in ma)i.remove(`maplibregl-${r}-anchor-${t}`);i.add(`maplibregl-${r}-anchor-${e}`)}class _a extends e.E{constructor(t){if(super(),this._onClick=t=>{this.fire(new e.l("click",{originalEvent:t}))},this._onKeyPress=t=>{const e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._lngLat=fa(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),u.setTransform(this._element,`${ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),s.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(t&&"moveend"===t.type)}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.l("dragstart"))),this.fire(new e.l("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),"active"===this._state&&this.fire(new e.l("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=u.create("div");const r=u.createNS("http://www.w3.org/2000/svg","svg"),i=41,n=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${i}px`),r.setAttributeNS(null,"width",`${n}px`),r.setAttributeNS(null,"viewBox",`0 0 ${n} ${i}`);const o=u.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=u.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const s=u.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");const l=[{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 t of l){const e=u.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),s.appendChild(e)}const c=u.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=u.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),c.appendChild(h);const p=u.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=u.createNS("http://www.w3.org/2000/svg","path");d.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"),p.appendChild(d);const f=u.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=u.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=u.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=u.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),a.appendChild(s),a.appendChild(c),a.appendChild(p),a.appendChild(f),a.appendChild(m),r.appendChild(a),r.setAttributeNS(null,"height",i*this._scale+"px"),r.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(r),this._offset=e.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),ga(this._element,this._anchor,"marker"),this._element.addEventListener("click",this._onClick),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",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("projectiontransition",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),u.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.V.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,r=13.5,i=Math.abs(r)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[i,-1*(e-r+i)],"bottom-right":[-i,-1*(e-r+i)],left:[r,-1*(e-r)],right:[-r,-1*(e-r)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var r,i;const n=null===(r=this._map)||void 0===r?void 0:r.terrain,o=this._map.transform.isLocationOccluded(this._lngLat);if(!n||o){const t=o?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,s=a.terrain.depthAtPoint(this._pos),l=a.terrain.getElevationForLngLat(this._lngLat,a.transform);if(a.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006)return void(this._element.style.opacity=this._opacity);const c=-this._offset.y/a.transform.pixelsPerMeter,u=Math.sin(a.getPitch()*Math.PI/180)*c,h=a.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),p=a.transform.lngLatToCameraDepth(this._lngLat,l+u)-h>.006;(null===(i=this._popup)||void 0===i?void 0:i.isOpen())&&p&&this._popup.remove(),this._element.style.opacity=p?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return(void 0===this._opacity||void 0===t&&void 0===e)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const ya={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let va=0,ba=!1;const xa={maxWidth:100,unit:"metric"};function wa(t,e,r){const i=r&&r.maxWidth||100,n=t._container.clientHeight/2,o=t._container.clientWidth/2,a=t.unproject([o-i/2,n]),s=t.unproject([o+i/2,n]),l=Math.round(t.project(s).x-t.project(a).x),c=Math.min(i,l,t._container.clientWidth),u=a.distanceTo(s);if(r&&"imperial"===r.unit){const r=3.2808*u;r>5280?Ta(e,c,r/5280,t._getUIString("ScaleControl.Miles")):Ta(e,c,r,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Ta(e,c,u/1852,t._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Ta(e,c,u/1e3,t._getUIString("ScaleControl.Kilometers")):Ta(e,c,u,t._getUIString("ScaleControl.Meters"))}function Ta(t,e,r,i){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let r=t/e;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(r),e*r}(r);t.style.width=e*(n/r)+"px",t.innerHTML=`${n}&nbsp;${i}`}const Sa={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Pa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ma(t){if(t){if("number"==typeof t){const r=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(r,r),"top-right":new e.P(-r,r),bottom:new e.P(0,-t),"bottom-left":new e.P(r,-r),"bottom-right":new e.P(-r,-r),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const r=e.P.convert(t);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return Ma(new e.P(0,0))}const Aa=r;t.AJAXError=e.cJ,t.EXTENT=e.a5,t.Event=e.l,t.Evented=e.E,t.LngLat=e.V,t.MercatorCoordinate=e.a9,t.Point=e.P,t.addProtocol=e.cK,t.config=e.c,t.removeProtocol=e.cL,t.AttributionControl=Qo,t.BoxZoomHandler=ho,t.CanvasSource=nt,t.CooperativeGesturesHandler=Zo,t.DoubleClickZoomHandler=No,t.DragPanHandler=$o,t.DragRotateHandler=Go,t.EdgeInsets=Ve,t.FullscreenControl=class extends e.E{constructor(t={}){var r;super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!==(r=t.pseudo)&&void 0!==r&&r,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.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(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){u.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=u.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);u.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new e.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=et,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const r=new e.V(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=this._map.getBearing(),o=e.e({bearing:n},this.options.fitBoundsOptions),a=W.fromLngLat(r,i);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const r=new e.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(1===t.code){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 t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&ba)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=u.create("button","maplibregl-ctrl-geolocate",this._container),u.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new _a({element:this._dotElement}),this._circleElement=u.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new _a({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{const r=(null==t?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.l("trackuserlocationend")),this.fire(new e.l("userlocationlostfocus")))})}},this.options=e.e({},ya,t)}onAdd(t){return this._map=t,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,function*(t=!1){if(void 0!==da&&!t)return da;if(void 0===window.navigator.permissions)return da=!!window.navigator.geolocation,da;try{const t=yield window.navigator.permissions.query({name:"geolocation"});da="denied"!==t.state}catch(t){da=!!window.navigator.geolocation}return da})}().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(),u.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,va=0,ba=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitude<e.getWest()||r.longitude>e.getEast()||r.latitude<e.getSouth()||r.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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const t=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&t))return;const e=this._map.project(t),r=this._map.unproject([e.x+100,e.y]),i=t.distanceTo(r)/100,n=2*this._accuracy/i;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return e.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 e.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":va--,ba=!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 e.l("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 e.l("trackuserlocationstart")),this.fire(new e.l("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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),va++,va>1?(t={maximumAge:6e5,timeout:0},ba=!0):(t=this.options.positionOptions,ba=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;const e=null===(t=this._map.getProjection())||void 0===t?void 0:t.type;this._map.setProjection("mercator"!==e&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(t=this._map.getProjection())||void 0===t?void 0:t.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=u.create("button","maplibregl-ctrl-globe",this._container),u.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){u.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=Xn,t.ImageSource=rt,t.KeyboardHandler=Lo,t.LngLatBounds=W,t.LogoControl=ta,t.Map=class extends Ko{get _ownerWindow(){var t,e;return(null===(e=null===(t=this._container)||void 0===t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView)||window}constructor(t){var r,i;e.cH.mark(e.cI.create);const n=Object.assign(Object.assign(Object.assign({},ua),t),{canvasContextAttributes:Object.assign(Object.assign({},ua.canvasContextAttributes),t.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new He,a=new Je;void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),null!==n.transformConstrain&&o.setConstrainOverride(n.transformConstrain),super(o,a,{bearingSnap:n.bearingSnap,zoomSnap:n.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ea,this._controls=[],this._mapId=e.af(),this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(const[e]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${e}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new e.l("webglcontextlost",{originalEvent:t}))}else this.fire(new e.l("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new e.l("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._zoomSnap=n.zoomSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},la),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this._zoomLevelsToOverscale=n.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=n.transformCameraUpdate,this.transformConstrain=n.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(n.anisotropicFilterPitch),void 0!==n.reduceMotion&&(s.prefersReducedMotion=n.reduceMotion),this._imageQueueHandle=_.addThrottleControl(()=>this.isMoving()),this._requestManager=new y(n.transformRequest),this._container=this._resolveContainer(n.container),n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),"undefined"!=typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Yo(this,n),this._hash=n.hash&&new Xn("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,e.e({},n.fitBoundsOptions,{duration:0}))));const l="string"==typeof n.style||!("globe"===(null===(i=null===(r=n.style)||void 0===r?void 0:r.projection)||void 0===i?void 0:i.type));this.resize(null,l),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Qo("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new ta,n.logoPosition),this.on("style.load",()=>{if(l||this._resizeTransform(),this.transform.unmodified){const t=e.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.l(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new e.l(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new e.l("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,e){return this.style.setGlobalStateProperty(t,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}coveringTiles(t){return At(this.transform,t)}calculateCameraOptionsFromTo(t,e,r,i){return null==i&&this.terrain&&(i=this.terrain.getElevationForLngLat(r,this.transform)),super.calculateCameraOptionsFromTo(t,e,r,i)}resize(t,r=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(r);const i=!this._moving;return i&&(this.stop(),this.fire(new e.l("movestart",t)).fire(new e.l("move",t))),this.fire(new e.l("resize",t)),i&&this.fire(new e.l("moveend",t)),this}_resizeInternal(t=!0){const[e,r]=this._containerDimensions(),i=this._getClampedPixelRatio(e,r);if(this._resizeCanvas(e,r,i),this.painter.resize(e,r,i),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const i=this._getClampedPixelRatio(e,r);this._resizeCanvas(e,r,i),this.painter.resize(e,r,i)}this._resizeTransform(t)}_resizeTransform(t=!0){var e;const[r,i]=this._containerDimensions();this.transform.resize(r,i,t),null===(e=this._requestedCameraState)||void 0===e||e.resize(r,i,t)}_getClampedPixelRatio(t,e){const{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),o=t*n,a=e*n;return Math.min(o>r?r/o:1,a>i?i/a:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(W.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom){const r=this.transform.zoom,i=this._getTransformForUpdate();return i.setMinZoom(t),this._applyUpdatedTransform(i),this._update(),r!==this.transform.zoom&&this.fire(new e.l("zoomstart")).fire(new e.l("zoom")).fire(new e.l("zoomend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom){const r=this.transform.zoom,i=this._getTransformForUpdate();return i.setMaxZoom(t),this._applyUpdatedTransform(i),this._update(),r!==this.transform.zoom&&this.fire(new e.l("zoomstart")).fire(new e.l("zoom")).fire(new e.l("zoomend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch){const r=this.transform.pitch,i=this._getTransformForUpdate();return i.setMinPitch(t),this._applyUpdatedTransform(i),this._update(),r!==this.transform.pitch&&this.fire(new e.l("pitchstart")).fire(new e.l("pitch")).fire(new e.l("pitchend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>180)throw new Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch){const r=this.transform.pitch,i=this._getTransformForUpdate();return i.setMaxPitch(t),this._applyUpdatedTransform(i),this._update(),r!==this.transform.pitch&&this.fire(new e.l("pitchstart")).fire(new e.l("pitch")).fire(new e.l("pitchend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t=null==t?20:t)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this.transform.setConstrainOverride(t),this._update()}project(t){return this.transform.locationToScreenPoint(e.V.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,r){if("mouseenter"===t||"mouseover"===t){let i=!1;const n=n=>{const o=e.filter(t=>this.getLayer(t)),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?i||(i=!0,r.call(this,new oo(t,this,n.originalEvent,{features:a}))):i=!1};return{layers:e,listener:r,delegates:{mousemove:n,mouseout:()=>{i=!1}}}}if("mouseleave"===t||"mouseout"===t){let i=!1;const n=n=>{const o=e.filter(t=>this.getLayer(t));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?i=!0:i&&(i=!1,r.call(this,new oo(t,this,n.originalEvent)))},o=e=>{i&&(i=!1,r.call(this,new oo(t,this,e.originalEvent)))};return{layers:e,listener:r,delegates:{mousemove:n,mouseout:o}}}{const i=t=>{const i=e.filter(t=>this.getLayer(t)),n=0!==i.length?this.queryRenderedFeatures(t.point,{layers:i}):[];n.length&&(t.features=n,r.call(this,t),delete t.features)};return{layers:e,listener:r,delegates:{[t]:i}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,r){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const i=this._delegatedListeners[t];for(let t=0;t<i.length;t++){const n=i[t];if(n.listener===r&&n.layers.length===e.length&&n.layers.every(t=>e.includes(t))){for(const t in n.delegates)this.off(t,n.delegates[t]);return void i.splice(t,1)}}}on(t,e,r){if(void 0===r)return super.on(t,e);const i="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,i,r);this._saveDelegatedListener(t,n);for(const t in n.delegates)this.on(t,n.delegates[t]);return{unsubscribe:()=>{this._removeDelegatedListener(t,i,r)}}}once(t,e,r){if(void 0===r)return super.once(t,e);const i="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,i,r);for(const e in n.delegates){const o=n.delegates[e];n.delegates[e]=(...e)=>{this._removeDelegatedListener(t,i,r),o(...e)}}this._saveDelegatedListener(t,n);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,r){return void 0===r?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,r),this)}queryRenderedFeatures(t,r){if(!this.style)return[];let i;const n=t instanceof e.P||Array.isArray(t),o=n?t:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:t)||{},o instanceof e.P||"number"==typeof o[0])i=[e.P.convert(o)];else{const t=e.P.convert(o[0]),r=e.P.convert(o[1]);i=[t,new e.P(r.x,t.y),r,new e.P(t.x,r.y),t]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,r){return!1!==(r=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var r,i;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,e));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new Fr(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,n):this.style.loadJSON(t,e,n),this):(null===(i=null===(r=this.style)||void 0===r?void 0:r.projection)||void 0===i||i.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Fr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){if("string"==typeof t){const i=this._requestManager.transformRequest(t,"Style");e.j(i,new AbortController).then(t=>{this._updateDiff(t.data,r)}).catch(t=>{t&&this.fire(new e.k(t))})}else"object"==typeof t&&this._updateDiff(t,r)}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(i){e.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const r=this.style&&this.style.tileManagers[t];if(void 0!==r)return r.loaded();this.fire(new e.k(new Error(`There is no tile manager with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const r=this.style.tileManagers[t.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&r.reload();for(const r in this.style._layers){const i=this.style._layers[r];"hillshade"===i.type&&i.source===t.source&&e.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."),"color-relief"===i.type&&i.source===t.source&&e.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new na(this.painter,r,t),this.painter.renderToTexture=new sa(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=e=>{var r;"style"===e.dataType?this.terrain.tileManager.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(r=e.source)||void 0===r?void 0:r.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new e.l("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.tileManagers;for(const e of Object.values(t))if(!e.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,e,r){if(r){const i=this.getSource(r);if(!i)throw new Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=St(Math.max(1,t),Math.max(1,e))}else for(const r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=St(Math.max(1,t),Math.max(1,e));return this._update(!0),this}refreshTiles(t,r){const i=this.style.tileManagers[t];if(!i)throw new Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(t=>new e.ac(t.z,t.x,t.y)))}addImage(t,r,i={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=i;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||e.b(r))){if(void 0===r.width||void 0===r.height)return this.fire(new e.k(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:i,height:s,data:p}=r,d=r;return this.style.addImage(t,{data:new e.R({width:i,height:s},new Uint8Array(p)),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}{const{width:i,height:p,data:d}=s.getImageData(r);this.style.addImage(t,{data:new e.R({width:i,height:p},d),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(t,r){const i=this.style.getImage(t);if(!i)return this.fire(new e.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=r instanceof HTMLImageElement||e.b(r)?s.getImageData(r):r,{width:o,height:a,data:l}=n;if(void 0===o||void 0===a)return this.fire(new e.k(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!==i.data.width||a!==i.data.height)return this.fire(new e.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(r instanceof HTMLImageElement||e.b(r));return i.data.replace(l,c),this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.k(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return _.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)}setFilter(t,e,r={}){return this.style.setFilter(t,e,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,r,i={}){return this.style.setPaintProperty(t,e,r,i),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,r,i={}){return this.style.setLayoutProperty(t,e,r,i),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,r,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,t=>{t||this._update(!0)}),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupResizeObserver(){var t;let e=!1;const r=Hn(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),i=null!==(t=this._ownerWindow.ResizeObserver)&&void 0!==t?t:ResizeObserver;this._resizeObserver=new i(t=>{e?r(t):e=!0}),this._resizeObserver.observe(this._container)}_resolveContainer(t){if("string"==typeof t){const e=document.getElementById(t);if(!e)throw new Error(`Container '${t}' not found.`);return e}if(t instanceof HTMLElement)return t;if(t&&"object"==typeof t&&1===t.nodeType)return t;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=u.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=u.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 r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);const n=this._controlContainer=u.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{o[t]=u.create("div",`maplibregl-ctrl-${t} `,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{e={requestedAttributes:t},r&&(e.statusMessage=r.statusMessage,e.type=r.type)},{once:!0});let r=null;if(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!r){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new Wn(r,this.transform),h.testSupport(r)}migrateProjection(t,r){super.migrateProjection(t,r),this.painter.transform=t,this.fire(new e.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,i,n,o,a;const s=this._idleTriggered?this._fadeDuration:0,l=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,r=c();this.style.zoomHistory.update(t,r);const i=new e.H(t,{now:r,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=i.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(i)}const h=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0!==l;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new e.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.cH.mark(e.cI.load),this.fire(new e.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.l("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,e.cH.mark(e.cI.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.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),"undefined"!=typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),_.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==r?void 0:r.loseContext)&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),u.remove(this._canvasContainer),u.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),e.cH.remove(),this._removed=!0,this.fire(new e.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,t=>{e.cH.recordStartOfFrameAt(t),this._frameRequest=null;try{this._render(t)}catch(t){if(!e.Z(t)&&!function(t){return t.message===sn}(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return ca}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},t.MapMouseEvent=oo,t.MapTouchEvent=ao,t.MapWheelEvent=so,t.Marker=_a,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,e)=>{const r=this._map._getUIString(`NavigationControl.${e}`);t.title=r,t.setAttribute("aria-label",r)},this.options=e.e({},ha,t),this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),u.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),u.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=u.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new pa(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){u.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const r=u.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}},t.Popup=class extends e.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&u.remove(this._content),this._container&&(u.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 e.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=u.create("div","maplibregl-popup",this._map.getContainer()),this._tip=u.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);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=fa(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const e=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor;const i=Ma(this.options.offset);if(!r){const t=this._container.offsetWidth,n=this._container.offsetHeight,o=function(t){var e,r,i,n;return t?{top:null!==(e=t.top)&&void 0!==e?e:0,right:null!==(r=t.right)&&void 0!==r?r:0,bottom:null!==(i=t.bottom)&&void 0!==i?i:0,left:null!==(n=t.left)&&void 0!==n?n:0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);let a;a=e.y+i.bottom.y<n+o.top?["top"]:e.y>this._map.transform.height-n-o.bottom?["bottom"]:[],e.x<t/2+o.left?a.push("left"):e.x>this._map.transform.width-t/2-o.right&&a.push("right"),r=0===a.length?"bottom":a.join("-")}let n=e.add(i[r]);this.options.subpixelPositioning||(n=n.round()),u.setTransform(this._container,`${ma[r]} translate(${n.x}px,${n.y}px)`),ga(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(Sa),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new e.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.V.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),r=document.createElement("body");let i;for(r.innerHTML=t;i=r.firstChild,i;)e.appendChild(i);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=u.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=u.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 t=this._container.querySelector(Pa);t&&t.focus()}},t.RasterDEMTileSource=K,t.RasterTileSource=Y,t.ScaleControl=class{constructor(t){this._onMove=()=>{wa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,wa(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},xa),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){u.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=jo,t.Style=Fr,t.TerrainControl=class{constructor(t){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=t}onAdd(t){return this._map=t,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=u.create("button","maplibregl-ctrl-terrain",this._container),u.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(){u.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=ko,t.TwoFingersTouchRotateHandler=Do,t.TwoFingersTouchZoomHandler=Io,t.TwoFingersTouchZoomRotateHandler=qo,t.VectorTileSource=X,t.VideoSource=it,t.addSourceType=(t,r)=>e._(void 0,void 0,void 0,function*(){if(at(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{ot[t]=e})(t,r)}),t.clearPrewarmedResources=function(){const t=B;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(R),B=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()"))},t.createTileMesh=cr,t.getMaxParallelImageRequests=function(){return e.c.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return ut().getRTLTextPluginStatus()},t.getVersion=function(){return Aa},t.getWorkerCount=function(){return L.workerCount},t.getWorkerUrl=function(){return e.c.WORKER_URL},t.importScriptInWorkers=function(t){return V().broadcast("IS",t)},t.isTimeFrozen=function(){return l.isFrozen()},t.now=c,t.prewarm=function(){j().acquire(R)},t.restoreNow=function(){l.restoreNow()},t.setMaxParallelImageRequests=function(t){e.c.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setNow=function(t){l.setNow(t)},t.setRTLTextPlugin=function(t,e){return ut().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){L.workerCount=t},t.setWorkerUrl=function(t){e.c.WORKER_URL=t}}),t}()},6537:t=>{"use strict";t.exports=function(t){return!!t&&("function"==typeof t||"object"==typeof t)}},6539:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},6549:t=>{"use strict";t.exports=Object.getOwnPropertyDescriptor},6556:(t,e,r)=>{"use strict";var i=r(453),n=r(3126),o=n([i("%String.prototype.indexOf%")]);t.exports=function(t,e){var r=i(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?n([r]):r}},6570:(t,e,r)=>{"use strict";var i=r(453),n=r(5880),o=i("%Number%"),a=i("%BigInt%",!0);t.exports=function(t,e,r,i){for(var s=i?a:o,l=s(0),c=0;c<t.length;c++)l+=s(t[c]*n(2,8*c));if(!r){var u=8*e;128&t[e-1]&&(l-=s(n(2,u)))}return l}},6575:(t,e,r)=>{"use strict";var i=r(9675),n=r(6556),o=n("%ArrayBuffer.prototype.resizable%",!0),a=n("%SharedArrayBuffer.prototype.growable%",!0),s=r(4670),l=r(7070);t.exports=function(t){var e=s(t),r=l(t);if(!e&&!r)throw new i("Assertion failed: `arrayBuffer` must be an ArrayBuffer or SharedArrayBuffer");return e&&o?!o(t):!r||!a||!a(t)}},6578:t=>{"use strict";t.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},6587:(t,e,r)=>{"use strict";var i=r(5880);t.exports=function(t){var e=128&t[7]?-1:1,r=(127&t[7])<<4|(240&t[6])>>4,n=281474976710656*(15&t[6])+1099511627776*t[5]+4294967296*t[4]+16777216*t[3]+65536*t[2]+256*t[1]+t[0];return 0===r&&0===n?0*e:2047===r&&0!==n?NaN:2047===r&&0===n?e*(1/0):-1023==(r-=1023)?e*n*5e-324:e*(1+n/4503599627370496)*i(2,r)}},6600:t=>{"use strict";t.exports=function(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},6623:(t,e,r)=>{"use strict";var i=r(5767),n=r(3432),o=r(5795);function a(t){return Object.prototype.toString.call(t)}var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function l(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)}var c=Object.keys||function(t){var e=[];for(var r in t)e[e.length]=r;return e},u=Object.prototype.propertyIsEnumerable,h=Object.getOwnPropertySymbols;function p(t){var e=c(t);if(h)for(var r=h(t),i=0;i<r.length;i++)u.call(t,r[i])&&(e[e.length]=r[i]);return e}var d=Object.prototype.hasOwnProperty||function(t,e){return e in t};function f(t,e){if("object"==typeof t&&null!==t){var r;if(s(t))r=[];else if("[object Date]"===a(t))r=new Date(t.getTime?t.getTime():t);else if("[object RegExp]"===a(t))r=new RegExp(t);else if(function(t){return"[object Error]"===a(t)}(t))r={message:t.message};else if(function(t){return"[object Boolean]"===a(t)}(t)||function(t){return"[object Number]"===a(t)}(t)||function(t){return"[object String]"===a(t)}(t))r=Object(t);else{if(i(t))return n(t);if(Object.create&&Object.getPrototypeOf)r=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)r={};else{var o=t.constructor&&t.constructor.prototype||t.__proto__||{},u=function(){};u.prototype=o,r=new u}}return l((e.includeSymbols?p:c)(t),function(e){r[e]=t[e]}),r}return t}var m={__proto__:null};function g(t,e){var r=[],i=[],n=!0,a=arguments.length>2?arguments[2]:m,u=a.includeSymbols?p:c,h=!!a.immutable;return function t(c){var p=h?f(c,a):c,m={__proto__:null},g=!0,_={node:p,node_:c,path:[].concat(r),parent:i[i.length-1],parents:i,key:r[r.length-1],removedKeys:{__proto__:null},isRoot:0===r.length,level:r.length,circular:null,update:function(t,e){_.isRoot||(_.parent.node[_.key]=t),_.node=t,e&&(g=!1)},delete:function(t){delete _.parent.node[_.key],_.parent.removedKeys[_.key]=!0,t&&(g=!1)},remove:function(t){s(_.parent.node)?(_.parent.node.splice(_.key,1),_.parent.removedKeys[_.key]=!0,t&&(g=!1)):_.delete(t)},keys:null,before:function(t){m.before=t},after:function(t){m.after=t},pre:function(t){m.pre=t},post:function(t){m.post=t},stop:function(){n=!1},block:function(){g=!1}};if(!n)return _;function y(){if("object"==typeof _.node&&null!==_.node){_.keys&&_.node_===_.node||(_.keys=u(_.node)),_.isLeaf=0===_.keys.length;for(var t=0;t<i.length;t++)if(i[t].node_===c){_.circular=i[t];break}}else _.isLeaf=!0,_.keys=null;_.notLeaf=!_.isLeaf,_.notRoot=!_.isRoot}y();var v=e.call(_,_.node);return void 0!==v&&_.update&&_.update(v),m.before&&m.before.call(_,_.node),g?("object"!=typeof _.node||null===_.node||_.circular||(i[i.length]=_,y(),l(_.keys,function(e,i){var n=i-1 in _.removedKeys;n&&(e=_.keys[i-1]),r[r.length]=e,m.pre&&m.pre.call(_,_.node[e],e);var a=t(_.node[e]);h&&d.call(_.node,e)&&!function(t,e){if("function"!=typeof o)return!0;var r=o(t,e);return!r||!r.writable}(_.node,e)&&!n&&(_.node[e]=a.node),a.isLast=i===_.keys.length-1,a.isFirst=0===i,m.post&&m.post.call(_,a),r.pop()}),i.pop()),m.after&&m.after.call(_,_.node),_):_}(t).node}function _(t){this.options=arguments.length>1?arguments[1]:m,this.value=t}function y(t){return new _(t,arguments.length>1?arguments[1]:m)}_.prototype.get=function(t){for(var e=this.value,r=0;e&&r<t.length;r++){var i=t[r];if(!d.call(e,i)||!this.options.includeSymbols&&"symbol"==typeof i)return;e=e[i]}return e},_.prototype.has=function(t){var e=this.value;if(!e&&t.length>0)return!1;for(var r=0;e&&r<t.length;r++){var i=t[r];if(!d.call(e,i)||!this.options.includeSymbols&&"symbol"==typeof i)return!1;e=e[i]}return!0},_.prototype.set=function(t,e){for(var r=this.value,i=0;i<t.length-1;i++){var n=t[i];d.call(r,n)||(r[n]={}),r=r[n]}return r[t[i]]=e,e},_.prototype.map=function(t){return g(this.value,t,{__proto__:null,immutable:!0,includeSymbols:!!this.options.includeSymbols})},_.prototype.forEach=function(t){return this.value=g(this.value,t,this.options),this.value},_.prototype.reduce=function(t,e){var r=1===arguments.length,i=r?this.value:e;return this.forEach(function(e){this.isRoot&&r||(i=t.call(this,i,e))}),i},_.prototype.paths=function(){var t=[];return this.forEach(function(){t[t.length]=this.path}),t},_.prototype.nodes=function(){var t=[];return this.forEach(function(){t[t.length]=this.node}),t},_.prototype.clone=function(){var t=[],e=[],r=this.options;return i(this.value)?n(this.value):function i(n){for(var o=0;o<t.length;o++)if(t[o]===n)return e[o];if("object"==typeof n&&null!==n){var a=f(n,r);return t[t.length]=n,e[e.length]=a,l((r.includeSymbols?p:c)(n),function(t){a[t]=i(n[t])}),t.pop(),e.pop(),a}return n}(this.value)},l(p(_.prototype),function(t){y[t]=function(e){var r=[].slice.call(arguments,1),i=new _(e);return i[t].apply(i,r)}}),t.exports=y},6681:(t,e,r)=>{"use strict";var i=r(9675),n=r(7149),o=r(5910),a=r(5680),s=r(4372);t.exports=function(t,e){if(!a(t))throw new i("Assertion failed: `obj` must be a Typed Array");if("SEQ-CST"!==e&&"UNORDERED"!==e)throw new i("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");var r=s(t);return{"[[Object]]":t,"[[CachedBufferByteLength]]":o(r)?"DETACHED":n(r,e)}}},6694:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},6743:(t,e,r)=>{"use strict";var i=r(9353);t.exports=Function.prototype.bind||i},6897:(t,e,r)=>{"use strict";var i=r(453),n=r(41),o=r(592)(),a=r(5795),s=r(9675),l=i("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new s("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||l(e)!==e)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,c=!0;if("length"in t&&a){var u=a(t,"length");u&&!u.configurable&&(i=!1),u&&!u.writable&&(c=!1)}return(i||c||!r)&&(o?n(t,"length",e,!0,!0):n(t,"length",e)),t}},6966:(t,e,r)=>{"use strict";t.exports=r(9600)},7030:(t,e,r)=>{"use strict";var i=r(9675),n=r(5701),o=r(2997);t.exports=function(t){if(void 0!==t&&!n(t))throw new i("Assertion failed: `Desc` must be a Property Descriptor");return o(t)}},7035:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},7057:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(5767),a=r(9209)(),s=r(533),l=r(7732),c=r(9531),u=r(2697);t.exports=function(t,e){if(0===a.length)throw new i("Assertion failed: Typed Arrays are not supported in this environment");var r=o(t);if(!r)throw new n("Assertion failed: exemplar must be a TypedArray");if(!s(e))throw new n("Assertion failed: `argumentList` must be a List");var h=u(r);if("function"!=typeof h)throw new i("Assertion failed: `constructor` of `exemplar` ("+r+") must exist. Please report this!");var p=l(t,h);return c(p,e)}},7070:(t,e,r)=>{"use strict";var i=r(6556)("SharedArrayBuffer.prototype.byteLength",!0);t.exports=i?function(t){if(!t||"object"!=typeof t)return!1;try{return i(t),!0}catch(t){return!1}}:function(t){return!1}},7088:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,256);return s>=128?s-256:s}},7119:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},7149:(t,e,r)=>{"use strict";var i=r(9675),n=r(5910),o=r(4670),a=r(7070),s=r(9511),l=r(6556)("SharedArrayBuffer.prototype.byteLength",!0);t.exports=function(t,e){var r=a(t);if(!o(t)&&!r)throw new i("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if("SEQ-CST"!==e&&"UNORDERED"!==e)throw new i("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if(n(t))throw new i("Assertion failed: `arrayBuffer` must not be detached");return r?l(t):s(t)}},7176:(t,e,r)=>{"use strict";var i,n=r(3126),o=r(5795);try{i=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var a=!!i&&o&&o(Object.prototype,"__proto__"),s=Object,l=s.getPrototypeOf;t.exports=a&&"function"==typeof a.get?n([a.get]):"function"==typeof l&&function(t){return l(null==t?t:s(t))}},7196:(t,e,r)=>{"use strict";var i=r(8410),n=r(3384),o=r(4459),a=r(3331);t.exports=function(t){var e=i(t);return o(e)||0===e?0:a(e)?n(e):e}},7440:(t,e,r)=>{"use strict";var i=r(1514),n=r(8968),o=r(4459),a=r(3331);t.exports=function(t){if("number"!=typeof t||o(t)||!a(t))return!1;var e=i(t);return n(e)===e}},7603:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z%27/%3E%3C/svg%3E"},7659:t=>{"use strict";var e={};t.exports=function(t,r){var i=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(r)}},7695:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3C/svg%3E"},7732:(t,e,r)=>{"use strict";var i=r(453)("%Symbol.species%",!0),n=r(9675),o=r(6537),a=r(4528);t.exports=function(t,e){if(!o(t))throw new n("Assertion failed: Type(O) is not Object");var r=t.constructor;if(void 0===r)return e;if(!o(r))throw new n("O.constructor is not an Object");var s=i?r[i]:void 0;if(null==s)return e;if(a(s))return s;throw new n("no constructor found")}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(r){!function(t,e,r){var i="";r.supports&&(i+="@supports (".concat(r.supports,") {")),r.media&&(i+="@media ".concat(r.media," {"));var n=void 0!==r.layer;n&&(i+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),i+=r.css,n&&(i+="}"),r.media&&(i+="}"),r.supports&&(i+="}");var o=r.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,r)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},7842:t=>{"use strict";var e,r="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;r||(e=function(t){return!1});var n=r?r.prototype.has:null,o=i?i.prototype.has:null;e||n||(e=function(t){return!1}),t.exports=e||function(t){if(!t||"object"!=typeof t)return!1;try{if(n.call(t,n),o)try{o.call(t,o)}catch(t){return!0}return t instanceof r}catch(t){}return!1}},7881:t=>{"use strict";t.exports=function(t){return"BIGUINT64"===t||"BIGINT64"===t}},7914:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2788%27 height=%2723%27 fill=%27none%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 fill-rule=%27evenodd%27 d=%27M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%27/%3E%3Cpath fill=%27%23fff%27 d=%27m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z%27/%3E%3Cpath d=%27M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z%27 style=%27fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001%27/%3E%3Cg style=%27stroke-width:1.12603545%27%3E%3Cpath d=%27M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668%27 style=%27color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3Cpath d=%27M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3%27 style=%27clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3Cpath d=%27M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%27 style=%27clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3C/g%3E%3C/svg%3E"},8002:t=>{"use strict";t.exports=Math.min},8013:(t,e,r)=>{"use strict";var i=r(8452).supportsDescriptors,n=r(4462)(),o=r(2747),a=Object.defineProperty,s=TypeError;t.exports=function(){var t=o();if(n)return t;if(!i)throw new s("Shimming Function.prototype.name support requires ES5 property descriptor support.");var e=Function.prototype;return a(e,"name",{configurable:!0,enumerable:!1,get:function(){var r=t.call(this);return this!==e&&a(this,"name",{configurable:!0,enumerable:!1,value:r,writable:!1}),r}}),t}},8017:t=>{"use strict";t.exports=function(t){return 0===t&&1/t==-1/0}},8068:t=>{"use strict";t.exports=SyntaxError},8131:(t,e,r)=>{"use strict";var i=r(9675),n=r(9957),o=r(5701);t.exports=function(t){if(void 0===t)return!1;if(!o(t))throw new i("Assertion failed: `Desc` must be a Property Descriptor");return!(!n(t,"[[Value]]")&&!n(t,"[[Writable]]"))}},8164:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},8173:(t,e,r)=>{"use strict";var i=r(6556)("WeakRef.prototype.deref",!0);t.exports="undefined"==typeof WeakRef?function(t){return!1}:function(t){if(!t||"object"!=typeof t)return!1;try{return i(t),!0}catch(t){return!1}}},8184:(t,e,r)=>{"use strict";var i=r(6556),n=r(9721)(/^\s*(?:function)?\*/),o=r(9092)(),a=r(3628),s=i("Object.prototype.toString"),l=i("Function.prototype.toString"),c=r(4233);t.exports=function(t){if("function"!=typeof t)return!1;if(n(l(t)))return!0;if(!o)return"[object GeneratorFunction]"===s(t);if(!a)return!1;var e=c();return e&&a(t)===e.prototype}},8186:t=>{t.exports=function(t){if(!t||!t.type)return null;var r=e[t.type];return r?"geometry"===r?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===r?{type:"FeatureCollection",features:[t]}:"featurecollection"===r?t:void 0:null};var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},8206:(t,e,r)=>{"use strict";var i=r(5388),n=r(4810),o=r(6556)("String.prototype.replace"),a=/^\s$/.test("᠎"),s=a?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,l=a?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;t.exports=function(){var t=n(i(this));return o(o(t,s,""),l,"")}},8213:(t,e,r)=>{"use strict";var i=r(8968);t.exports=function(t){for(var e,r="";t>0;)r=(e=t/2)===(t=i(e))?"0"+r:"1"+r;return r}},8268:(t,e,r)=>{"use strict";var i=r(9675),n=r(280),o=r(9901),a=r(5910),s=r(6188),l=r(8002),c=r(2076),u=r(2138),h=r(7196),p=r(4810),d=r(4742),f=r(6419),m=r(7057),g=r(1509),_=r(4372),y=r(2308);t.exports=function(t,e){var r=this;g(r,"SEQ-CST");var v,b=r.length,x=h(t);v=x===-1/0?0:x<0?s(b+x,0):l(x,b);var w,T=void 0===e?b:h(e);w=T===-1/0?0:T<0?s(b+T,0):l(T,b);var S=s(w-v,0),P=m(r,[S]);if(S>0){if(a(_(r)))throw new i("Cannot use a Typed Array with an underlying ArrayBuffer that is detached");if(f(r)===f(P))for(var M=_(r),A=_(P),E=d(r),I=v*E+y(r),C=y(P),D=C+S*E;C<D;){var z=o(M,I,"UINT8",!0,"UNORDERED");u(A,C,"UINT8",z,!0,"UNORDERED"),I+=1,C+=1}else for(var k=0;v<w;){var R=p(v),L=n(r,R);c(P,p(k),L,!0),v+=1,k+=1}}return P}},8410:(t,e,r)=>{"use strict";var i=r(453),n=r(9675),o=i("%Number%"),a=r(6600),s=r(866),l=r(8679);t.exports=function(t){var e=a(t)?t:s(t,o);if("symbol"==typeof e)throw new n("Cannot convert a Symbol value to a number");if("bigint"==typeof e)throw new n("Conversion from 'BigInt' to 'number' is not allowed.");return"string"==typeof e?l(e):+e}},8452:(t,e,r)=>{"use strict";var i=r(1189),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=r(41),l=r(592)(),c=function(t,e,r,i){if(e in t)if(!0===i){if(t[e]===r)return}else if("function"!=typeof(n=i)||"[object Function]"!==o.call(n)||!i())return;var n;l?s(t,e,r,!0):s(t,e,r)},u=function(t,e){var r=arguments.length>2?arguments[2]:{},o=i(e);n&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s<o.length;s+=1)c(t,o[s],e[o[s]],r[o[s]])};u.supportsDescriptors=!!l,t.exports=u},8460:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23999%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},8599:(t,e,r)=>{"use strict";var i=r(8452),n=r(3628),o=r(2521);t.exports=function(){if("function"==typeof Uint8Array){var t=o(),e=n(Uint8Array.prototype);i(e,{slice:t},{slice:function(){return e.slice!==t}})}return t}},8605:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},8648:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},8679:(t,e,r)=>{"use strict";var i=r(453),n=i("%RegExp%"),o=r(9675),a=i("%parseInt%"),s=r(6556),l=r(9721),c=s("String.prototype.slice"),u=l(/^0b[01]+$/i),h=l(/^0o[0-7]+$/i),p=l(/^[-+]0x[0-9a-f]+$/i),d=l(new n("["+["…","​","￾"].join("")+"]","g")),f=r(214);t.exports=function t(e){if("string"!=typeof e)throw new o("Assertion failed: `argument` is not a String");if(u(e))return+a(c(e,2),2);if(h(e))return+a(c(e,2),8);if(d(e)||p(e))return NaN;var r=f(e);return r!==e?t(r):+e}},8859:(t,e,r)=>{var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=i&&n&&"function"==typeof n.get?n.get:null,a=i&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&l&&"function"==typeof l.get?l.get:null,u=s&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,p="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,_=String.prototype.match,y=String.prototype.slice,v=String.prototype.replace,b=String.prototype.toUpperCase,x=String.prototype.toLowerCase,w=RegExp.prototype.test,T=Array.prototype.concat,S=Array.prototype.join,P=Array.prototype.slice,M=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,E=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,C="function"==typeof Symbol&&"object"==typeof Symbol.iterator,D="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,z=Object.prototype.propertyIsEnumerable,k=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function R(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||w.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-M(-t):M(t);if(i!==t){var n=String(i),o=y.call(e,n.length+1);return v.call(n,r,"$&_")+"."+v.call(v.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(e,r,"$&_")}var L=r(2634),F=L.custom,B=q(F)?F:null,O={__proto__:null,double:'"',single:"'"},j={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function N(t,e,r){var i=r.quoteStyle||e,n=O[i];return n+t+n}function V(t){return v.call(String(t),/"/g,"&quot;")}function U(t){return!D||!("object"==typeof t&&(D in t||void 0!==t[D]))}function $(t){return"[object Array]"===H(t)&&U(t)}function G(t){return"[object RegExp]"===H(t)&&U(t)}function q(t){if(C)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!I)return!1;try{return I.call(t),!0}catch(t){}return!1}t.exports=function t(e,i,n,s){var l=i||{};if(W(l,"quoteStyle")&&!W(O,l.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(l,"maxStringLength")&&("number"==typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=!W(l,"customInspect")||l.customInspect;if("boolean"!=typeof m&&"symbol"!==m)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(l,"numericSeparator")&&"boolean"!=typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var b=l.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return Y(e,l);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var w=String(e);return b?R(e,w):w}if("bigint"==typeof e){var M=String(e)+"n";return b?R(e,M):M}var E=void 0===l.depth?5:l.depth;if(void 0===n&&(n=0),n>=E&&E>0&&"object"==typeof e)return $(e)?"[Array]":"[Object]";var F,j=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=S.call(Array(t.indent+1)," ")}return{base:r,prev:S.call(Array(e+1),r)}}(l,n);if(void 0===s)s=[];else if(X(s,e)>=0)return"[Circular]";function Z(e,r,i){if(r&&(s=P.call(s)).push(r),i){var o={depth:l.depth};return W(l,"quoteStyle")&&(o.quoteStyle=l.quoteStyle),t(e,o,n+1,s)}return t(e,l,n+1,s)}if("function"==typeof e&&!G(e)){var K=function(t){if(t.name)return t.name;var e=_.call(g.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),it=rt(e,Z);return"[Function"+(K?": "+K:" (anonymous)")+"]"+(it.length>0?" { "+S.call(it,", ")+" }":"")}if(q(e)){var nt=C?v.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(e);return"object"!=typeof e||C?nt:J(nt)}if((F=e)&&"object"==typeof F&&("undefined"!=typeof HTMLElement&&F instanceof HTMLElement||"string"==typeof F.nodeName&&"function"==typeof F.getAttribute)){for(var ot="<"+x.call(String(e.nodeName)),at=e.attributes||[],st=0;st<at.length;st++)ot+=" "+at[st].name+"="+N(V(at[st].value),"double",l);return ot+=">",e.childNodes&&e.childNodes.length&&(ot+="..."),ot+"</"+x.call(String(e.nodeName))+">"}if($(e)){if(0===e.length)return"[]";var lt=rt(e,Z);return j&&!function(t){for(var e=0;e<t.length;e++)if(X(t[e],"\n")>=0)return!1;return!0}(lt)?"["+et(lt,j)+"]":"[ "+S.call(lt,", ")+" ]"}if(function(t){return"[object Error]"===H(t)&&U(t)}(e)){var ct=rt(e,Z);return"cause"in Error.prototype||!("cause"in e)||z.call(e,"cause")?0===ct.length?"["+String(e)+"]":"{ ["+String(e)+"] "+S.call(ct,", ")+" }":"{ ["+String(e)+"] "+S.call(T.call("[cause]: "+Z(e.cause),ct),", ")+" }"}if("object"==typeof e&&m){if(B&&"function"==typeof e[B]&&L)return L(e,{depth:E-n});if("symbol"!==m&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ut=[];return a&&a.call(e,function(t,r){ut.push(Z(r,e,!0)+" => "+Z(t,e))}),tt("Map",o.call(e),ut,j)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var ht=[];return u&&u.call(e,function(t){ht.push(Z(t,e))}),tt("Set",c.call(e),ht,j)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t,h);try{p.call(t,p)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Q("WeakMap");if(function(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t,p);try{h.call(t,h)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Q("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return Q("WeakRef");if(function(t){return"[object Number]"===H(t)&&U(t)}(e))return J(Z(Number(e)));if(function(t){if(!t||"object"!=typeof t||!A)return!1;try{return A.call(t),!0}catch(t){}return!1}(e))return J(Z(A.call(e)));if(function(t){return"[object Boolean]"===H(t)&&U(t)}(e))return J(f.call(e));if(function(t){return"[object String]"===H(t)&&U(t)}(e))return J(Z(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||void 0!==r.g&&e===r.g)return"{ [object globalThis] }";if(!function(t){return"[object Date]"===H(t)&&U(t)}(e)&&!G(e)){var pt=rt(e,Z),dt=k?k(e)===Object.prototype:e instanceof Object||e.constructor===Object,ft=e instanceof Object?"":"null prototype",mt=!dt&&D&&Object(e)===e&&D in e?y.call(H(e),8,-1):ft?"Object":"",gt=(dt||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(mt||ft?"["+S.call(T.call([],mt||[],ft||[]),": ")+"] ":"");return 0===pt.length?gt+"{}":j?gt+"{"+et(pt,j)+"}":gt+"{ "+S.call(pt,", ")+" }"}return String(e)};var Z=Object.prototype.hasOwnProperty||function(t){return t in this};function W(t,e){return Z.call(t,e)}function H(t){return m.call(t)}function X(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function Y(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return Y(y.call(t,0,e.maxStringLength),e)+i}var n=j[e.quoteStyle||"single"];return n.lastIndex=0,N(v.call(v.call(t,n,"\\$1"),/[\x00-\x1f]/g,K),"single",e)}function K(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+b.call(e.toString(16))}function J(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function tt(t,e,r,i){return t+" ("+e+") {"+(i?et(r,i):S.call(r,", "))+"}"}function et(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+S.call(t,","+r)+"\n"+e.prev}function rt(t,e){var r=$(t),i=[];if(r){i.length=t.length;for(var n=0;n<t.length;n++)i[n]=W(t,n)?e(t[n],t):""}var o,a="function"==typeof E?E(t):[];if(C){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var l in t)W(t,l)&&(r&&String(Number(l))===l&&l<t.length||C&&o["$"+l]instanceof Symbol||(w.call(/[^\w$]/,l)?i.push(e(l,t)+": "+e(t[l],t)):i.push(l+": "+e(t[l],t))));if("function"==typeof E)for(var c=0;c<a.length;c++)z.call(t,a[c])&&i.push("["+e(a[c])+"]: "+e(t[a[c]],t));return i}},8869:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e54e33%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3C/svg%3E"},8875:(t,e,r)=>{"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1093),s=Object.prototype.propertyIsEnumerable,l=!s.call({toString:null},"toString"),c=s.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(t){var e=t.constructor;return e&&e.prototype===t},p={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{h(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();i=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=a(t),s=e&&"[object String]"===o.call(t),p=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var f=c&&r;if(s&&t.length>0&&!n.call(t,0))for(var m=0;m<t.length;++m)p.push(String(m));if(i&&t.length>0)for(var g=0;g<t.length;++g)p.push(String(g));else for(var _ in t)f&&"prototype"===_||!n.call(t,_)||p.push(String(_));if(l)for(var y=function(t){if("undefined"==typeof window||!d)return h(t);try{return h(t)}catch(t){return!1}}(t),v=0;v<u.length;++v)y&&"constructor"===u[v]||!n.call(t,u[v])||p.push(u[v]);return p}}t.exports=i},8894:(t,e,r)=>{"use strict";var i=r(453)("%parseInt%"),n=r(1514),o=r(8968),a=r(8017),s=r(6556),l=s("String.prototype.indexOf"),c=s("String.prototype.slice"),u=r(9154),h=r(8213),p="11111111111",d="00000000000",f=d+d+d+d+"0000000";t.exports=function(t,e){var r,s,m=t<0||a(t)?"1":"0";if(isNaN(t))r=p,s="1"+f;else if(isFinite(t))if(0===t)r=d,s="0"+f;else{t=n(t);var g,_=o(t),y=h(_),v=u(t-_);if(y)r=y.length-1;else{var b=l(v,"1");b>-1&&(g=b+1),r=-g}s=y+v,r<0?(r<=-1023&&(g=1022),s=c(s,g)):s=c(s,1),r=c(d+h(r+1023),-11),s=c(s+f+"0",0,52)}else r=p,s="0"+f;for(var x=m+r+s,w=[],T=0;T<8;T++)w[e?8-T-1:T]=i(c(x,8*T,8*(T+1)),2);return w}},8968:t=>{"use strict";t.exports=Math.floor},9002:t=>{t.exports='<svg viewBox="0 0 28 38" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><ellipse fill-opacity=".3" fill="#000" cx="14" cy="36.5" rx="3" ry="1.5"></ellipse><g transform="translate(1 1)"><path d="M26.495 13.018l.002.05c.011.32-.006.775-.068 1.295-.003.062-.003.062-.005.076l.001-.008a16.517 16.517 0 01-.247 1.5c-1.208 5.775-5.112 12.154-12.865 18.457l-.344.28-.319-.309-.537-.518-.621-.603c-.511-.498-.978-.96-1.445-1.434a68.208 68.208 0 01-3.37-3.656C2.894 23.714.411 19.456-.288 15.414A12.974 12.974 0 01-.48 13.43a2.981 2.981 0 00-.007-.132v-.013a3.206 3.206 0 01-.012-.252c0-.055 0-.055.003-.09v-.002l.002-.028-.002-.048a1.288 1.288 0 01-.003-.157l.024-.475h.01C-.05 5.12 5.827-.5 12.998-.5c7.45 0 13.49 6.05 13.497 13.518zm-.07 1.413v.003z" stroke="#FFF" fill="#666" fill-rule="nonzero" class="left"></path><path d="M13 0c7.176 0 12.995 5.834 12.995 13.033 0 0 .031.472-.066 1.33v.011a15.863 15.863 0 01-.24 1.455c-.777 3.71-3.463 10.668-12.689 18.17V0z" fill="#2D2D2D" fill-rule="nonzero" class="right"></path><circle fill="#FFF" cx="13" cy="13" r="6"></circle></g></g></svg>'},9092:(t,e,r)=>{"use strict";var i=r(1333);t.exports=function(){return i()&&!!Symbol.toStringTag}},9154:t=>{"use strict";var e=1075;t.exports=function(t){var r="";if(0===t)return r;for(var i,n=e,o=0;o<e;o+=1)if((i=2*t)>=1?(t=i-1,r+="1",n===e&&(n=o)):(t=i,r+="0"),1===i||o-n>54)return r;return r}},9209:(t,e,r)=>{"use strict";var i=r(6578),n="undefined"==typeof globalThis?r.g:globalThis;t.exports=function(){for(var t=[],e=0;e<i.length;e++)"function"==typeof n[i[e]]&&(t[t.length]=i[e]);return t}},9271:(t,e,r)=>{"use strict";var i=r(9675),n=r(5986),o=r(6575),a=r(5291),s=r(4742),l=r(9346),c=r(4372),u=r(2308),h=r(6058);t.exports=function(t){if(!l(t))throw new i("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");if(a(t))throw new i("Assertion failed: `taRecord` is out of bounds");var e=t["[[Object]]"],r=o(c(e)),p=r?h(e):"AUTO";if("AUTO"!==p)return p;if(r)throw new i("Assertion failed: array buffer is not fixed length");var d=u(e),f=s(e),m=t["[[CachedBufferByteLength]]"];if("DETACHED"===m)throw new i("Assertion failed: typed array is detached");return n((m-d)/f)}},9290:t=>{"use strict";t.exports=RangeError},9308:(t,e,r)=>{"use strict";var i=r(9719),n=r(8410),o=r(5986),a=r(4459);t.exports=function(t){var e=n(t);if(a(e))return 0;var r=i(e,0,255),s=o(r);return r<s+.5?s:r>s+.5?s+1:s%2==0?s:s+1}},9346:(t,e,r)=>{"use strict";var i=r(9957),n=r(5680),o=r(1087);t.exports=function(t){return!!t&&"object"==typeof t&&i(t,"[[Object]]")&&i(t,"[[CachedBufferByteLength]]")&&(o(t["[[CachedBufferByteLength]]"])&&t["[[CachedBufferByteLength]]"]>=0||"DETACHED"===t["[[CachedBufferByteLength]]"])&&n(t["[[Object]]"])}},9353:t=>{"use strict";var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var n=0;n<e.length;n+=1)r[n+t.length]=e[n];return r};t.exports=function(t){var n=this;if("function"!=typeof n||"[object Function]"!==e.apply(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var o,a=function(t){for(var e=[],r=1,i=0;r<t.length;r+=1,i+=1)e[i]=t[r];return e}(arguments),s=r(0,n.length-a.length),l=[],c=0;c<s;c++)l[c]="$"+c;if(o=Function("binder","return function ("+function(t){for(var e="",r=0;r<t.length;r+=1)e+=t[r],r+1<t.length&&(e+=",");return e}(l)+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof o){var e=n.apply(this,i(a,arguments));return Object(e)===e?e:this}return n.apply(t,i(a,arguments))}),n.prototype){var u=function(){};u.prototype=n.prototype,o.prototype=new u,u.prototype=null}return o}},9373:t=>{"use strict";t.exports=function(t){return"UINT8"===t||"UINT8C"===t||"UINT16"===t||"UINT32"===t||"BIGUINT64"===t}},9377:(t,e,r)=>{"use strict";var i=r(592)(),n=r(41),o=r(4895);t.exports=function(){var t=o();return String.prototype.trim!==t&&(i?n(String.prototype,"trim",t,!0):n(String.prototype,"trim",t)),t}},9383:t=>{"use strict";t.exports=Error},9387:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27none%27 stroke=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Ccircle cx=%2711%27 cy=%2711%27 r=%278.5%27/%3E%3Cpath d=%27M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z%27/%3E%3Cpath d=%27M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z%27/%3E%3Cpath d=%27M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z%27/%3E%3C/svg%3E"},9511:(t,e,r)=>{"use strict";var i=r(6556)("ArrayBuffer.prototype.byteLength",!0),n=r(4670);t.exports=function(t){return n(t)?i?i(t):t.byteLength:NaN}},9531:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(533),a=r(4528),s=r(5291),l=r(9271),c=r(1509),u=r(9209)();t.exports=function(t,e){if(!a(t))throw new n("Assertion failed: `constructor` must be a constructor");if(!o(e))throw new n("Assertion failed: `argumentList` must be a List");if(0===u.length)throw new i("Assertion failed: Typed Arrays are not supported in this environment");var r;r=0===e.length?new t:1===e.length?new t(e[0]):2===e.length?new t(e[0],e[1]):new t(e[0],e[1],e[2]);var h=c(r,"SEQ-CST");if(1===e.length&&"number"==typeof e[0]){if(s(h))throw new n("new Typed Array is out of bounds");if(l(h)<e[0])throw new n("`argumentList[0]` must be <= `newTypedArray.length`")}return r}},9538:t=>{"use strict";t.exports=ReferenceError},9600:t=>{"use strict";var e,r,i=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},n(function(){throw 42},null,e)}catch(t){t!==r&&(n=null)}else n=null;var o=/^\s*class\b/,a=function(t){try{var e=i.call(t);return o.test(e)}catch(t){return!1}},s=function(t){try{return!a(t)&&(i.call(t),!0)}catch(t){return!1}},l=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,u=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var p=document.all;l.call(p)===l.call(document.all)&&(h=function(t){if((u||!t)&&(void 0===t||"object"==typeof t))try{var e=l.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=n?function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{n(t,null,e)}catch(t){if(t!==r)return!1}return!a(t)&&s(t)}:function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return s(t);if(a(t))return!1;var e=l.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&s(t)}},9612:t=>{"use strict";t.exports=Object},9675:t=>{"use strict";t.exports=TypeError},9693:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(9675),o=r(8068);t.exports=function(t){if("string"!=typeof t)throw new n("`argument` must be a string");if(!i)throw new o("BigInts are not supported in this environment");try{return i(t)}catch(t){return}}},9719:(t,e,r)=>{"use strict";var i=r(9675),n=r(6188),o=r(8002);t.exports=function(t,e,r){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof r||!(e<=r))throw new i("Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`");return o(n(e,t),r)}},9721:(t,e,r)=>{"use strict";var i=r(6556),n=r(4035),o=i("RegExp.prototype.exec"),a=r(9675);t.exports=function(t){if(!n(t))throw new a("`regex` must be a RegExp");return function(e){return null!==o(t,e)}}},9723:(t,e,r)=>{"use strict";var i=r(1539),n=r(593),o=r(5767),a=r(4634),s=r(2120),l=r(4035),c=r(8173),u=r(3811),h=r(1482),p=r(8184),d=r(5351),f=r(6556),m=r(9092)()&&Symbol.toStringTag,g=Object,_=f("Promise.prototype.then",!0),y=function(t){return!!t&&"BigInt"!==t&&"Boolean"!==t&&"Null"!==t&&"Number"!==t&&"String"!==t&&"Symbol"!==t&&"Undefined"!==t&&"Math"!==t&&"JSON"!==t&&"Reflect"!==t&&"Atomics"!==t&&"Map"!==t&&"Set"!==t&&"WeakMap"!==t&&"WeakSet"!==t&&"BigInt64Array"!==t&&"BigUint64Array"!==t&&"Float32Array"!==t&&"Float64Array"!==t&&"Int16Array"!==t&&"Int32Array"!==t&&"Int8Array"!==t&&"Uint16Array"!==t&&"Uint32Array"!==t&&"Uint8Array"!==t&&"Uint8ClampedArray"!==t&&"Array"!==t&&"Date"!==t&&"FinalizationRegistry"!==t&&"Promise"!==t&&"RegExp"!==t&&"WeakRef"!==t&&"Function"!==t&&"GeneratorFunction"!==t&&"AsyncFunction"!==t};t.exports=function(t){if(null==t)return t;var e=i(g(t))||n(t)||o(t);if(e)return e;if(a(t))return"Array";if(s(t))return"Date";if(l(t))return"RegExp";if(c(t))return"WeakRef";if(u(t))return"FinalizationRegistry";if("function"==typeof t)return p(t)?"GeneratorFunction":d(t)?"AsyncFunction":"Function";if(function(t){if(!t||"object"!=typeof t||!_)return!1;try{return _(t,null,function(){}),!0}catch(t){}return!1}(t))return"Promise";if(m&&m in t){var r=t[m];if(y(r))return r}if("function"==typeof t.constructor){var f=h(t.constructor);if(y(f))return f}return"Object"}},9790:t=>{"use strict";var e="undefined"!=typeof BigInt&&BigInt;t.exports=function(){return"function"==typeof e&&"function"==typeof BigInt&&"bigint"==typeof e(42)&&"bigint"==typeof BigInt(42)}},9803:(t,e,r)=>{"use strict";if(r(9790)()){var i=BigInt.prototype.valueOf;t.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return i.call(t),!0}catch(t){}return!1}(t))}}else t.exports=function(t){return!1}},9819:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e58978%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},9883:t=>{t.exports=function(t){return function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce(function(e,r){return Array.isArray(r)&&Array.isArray(r[0])?e.concat(t(r)):(e.push(r),e)},[])}(t)}},9887:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(5880),o=r(2964),a=r(9969),s=r(122),l=i&&BigInt(n(2,32))*BigInt(n(2,32));t.exports=function(t){var e=o(t);return s(a,e,l)}},9897:(t,e,r)=>{"use strict";var i=r(6268),n=r(3628);t.exports=function(){return"object"==typeof Reflect&&Reflect&&Reflect.getPrototypeOf?Reflect.getPrototypeOf:n?function(t){return n(t)}:i}},9901:(t,e,r)=>{"use strict";var i=r(453),n=r(8068),o=r(9675),a=r(6556),s=r(7440),l=i("%Uint8Array%",!0),c=a("Array.prototype.slice"),u=r(5910),h=r(6167),p=r(4670),d=r(7070),f=r(4399),m=r(4097),g=r(5100);t.exports=function(t,e,r,i,a){var _=d(t);if(!p(t)&&!_)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!s(e))throw new o("Assertion failed: `byteIndex` must be an integer");if("string"!=typeof r||"number"!=typeof m.size["$"+r])throw new o("Assertion failed: `type` must be one of "+m.choices);if("boolean"!=typeof i)throw new o("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==a&&"UNORDERED"!==a)throw new o("Assertion failed: `order` must be either `SEQ-CST` or `UNORDERED`");if(arguments.length>5&&"boolean"!=typeof arguments[5])throw new o("Assertion failed: `isLittleEndian` must be a boolean, if present");if(u(t))throw new o("Assertion failed: `arrayBuffer` is detached");if(e<0)throw new o("Assertion failed: `byteIndex` must be non-negative");var y,v=m.size["$"+r];if(!v)throw new o("Assertion failed: `type` must be one of "+m.choices);if(_)throw new n("SharedArrayBuffer is not supported by this implementation");y=c(new l(t,e),0,v);var b=arguments.length>5?arguments[5]:"little"===g,x=b?c(f([0,0,0,0,0,0,0,0],y),-v):c(f(y,[0,0,0,0,0,0,0,0]),0,v);return h(r,x,b)}},9957:(t,e,r)=>{"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(6743);t.exports=o.call(i,n)},9969:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(9290),o=r(9675),a=i&&i(0);t.exports=function(t,e){if("bigint"!=typeof t||"bigint"!=typeof e)throw new o("Assertion failed: `n` and `d` arguments must be BigInts");if(e===a)throw new n("Division by zero");return t===a?a:t%e}}},o={};function a(t){var e=o[t];if(void 0!==e)return e.exports;var r=o[t]={id:t,exports:{}};return n[t].call(r.exports,r,r.exports,a),r.exports}a.m=n,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"==typeof r.then)return r}var n=Object.create(null);a.r(n);var o={};t=t||[null,e({}),e([]),e(e)];for(var s=2&i&&r;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach(t=>o[t]=()=>r[t]);return o.default=()=>r,a.d(n,o),n},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce((e,r)=>(a.f[r](t,e),e),[])),a.u=t=>"embed-chunks/"+{445:"1492645e3d07fd3de940",728:"8a521e8312a5b4da123d"}[t]+".js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="geoloniaEmbedCore:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var h=c[u];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+n){s=h;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var p=(e,i)=>{s.onerror=s.onload=null,clearTimeout(d);var n=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach(t=>t(i)),e)return e(i)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!t||!/^http(s?):/.test(t));)t=r[i--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{a.b="undefined"!=typeof document&&document.baseURI||self.location.href;var t={792:0};a.f.j=(e,r)=>{var i=a.o(t,e)?t[e]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((r,n)=>i=t[e]=[r,n]);r.push(i[2]=n);var o=a.p+a.u(e),s=new Error;a.l(o,r=>{if(a.o(t,e)&&(0!==(i=t[e])&&(t[e]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,i[1](s)}},"chunk-"+e,e)}};var e=(e,r)=>{var i,n,[o,s,l]=r,c=0;if(o.some(e=>0!==t[e])){for(i in s)a.o(s,i)&&(a.m[i]=s[i]);l&&l(a)}for(e&&e(r);c<o.length;c++)n=o[c],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},r=self.webpackChunkgeoloniaEmbedCore=self.webpackChunkgeoloniaEmbedCore||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})(),a.nc=void 0;var s={};return(()=>{"use strict";a.r(s),a.d(s,{GeoloniaMap:()=>Le,GeoloniaMarker:()=>re,SimpleStyle:()=>Ie,SimpleStyleVector:()=>Re,embedVersion:()=>tr,keyring:()=>Ht,registerPlugin:()=>Qe});var t=a(6443),e=a.n(t),r=Math.pow,i=(t,e,r)=>new Promise((i,n)=>{var o=t=>{try{s(r.next(t))}catch(t){n(t)}},a=t=>{try{s(r.throw(t))}catch(t){n(t)}},s=t=>t.done?i(t.value):Promise.resolve(t.value).then(o,a);s((r=r.apply(t,e)).next())}),n=Uint8Array,o=Uint16Array,l=Int32Array,c=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),u=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),h=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=function(t,e){for(var r=new o(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];var n=new l(r[30]);for(i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return{b:r,r:n}},d=p(c,2),f=d.b,m=d.r;f[28]=258,m[258]=28;var g,_=p(u,0),y=_.b,v=(_.r,new o(32768));for(w=0;w<32768;++w)g=(61680&(g=(52428&(g=(43690&w)>>1|(21845&w)<<1))>>2|(13107&g)<<2))>>4|(3855&g)<<4,v[w]=((65280&g)>>8|(255&g)<<8)>>1;var b=function(t,e,r){for(var i=t.length,n=0,a=new o(e);n<i;++n)t[n]&&++a[t[n]-1];var s,l=new o(e);for(n=1;n<e;++n)l[n]=l[n-1]+a[n-1]<<1;if(r){s=new o(1<<e);var c=15-e;for(n=0;n<i;++n)if(t[n])for(var u=n<<4|t[n],h=e-t[n],p=l[t[n]-1]++<<h,d=p|(1<<h)-1;p<=d;++p)s[v[p]>>c]=u}else for(s=new o(i),n=0;n<i;++n)t[n]&&(s[n]=v[l[t[n]-1]++]>>15-t[n]);return s},x=new n(288);for(w=0;w<144;++w)x[w]=8;for(w=144;w<256;++w)x[w]=9;for(w=256;w<280;++w)x[w]=7;for(w=280;w<288;++w)x[w]=8;var w,T=new n(32);for(w=0;w<32;++w)T[w]=5;var S=b(x,9,1),P=b(T,5,1),M=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},A=function(t,e,r){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&r},E=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},I=function(t){return(t+7)/8|0},C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],D=function(t,e,r){var i=new Error(e||C[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,D),!r)throw i;return i},z=function(t,e,r,i){var o=t.length,a=i?i.length:0;if(!o||e.f&&!e.l)return r||new n(0);var s=!r||2!=e.i,l=e.i;r||(r=new n(3*o));var p=function(t){var e=r.length;if(t>e){var i=new n(Math.max(2*e,t));i.set(r),r=i}},d=e.f||0,m=e.p||0,g=e.b||0,_=e.l,v=e.d,x=e.m,w=e.n,T=8*o;do{if(!_){d=A(t,m,1);var C=A(t,m+1,3);if(m+=3,!C){var z=t[($=I(m)+4)-4]|t[$-3]<<8,k=$+z;if(k>o){l&&D(0);break}s&&p(g+z),r.set(t.subarray($,k),g),e.b=g+=z,e.p=m=8*k,e.f=d;continue}if(1==C)_=S,v=P,x=9,w=5;else if(2==C){var R=A(t,m,31)+257,L=A(t,m+10,15)+4,F=R+A(t,m+5,31)+1;m+=14;for(var B=new n(F),O=new n(19),j=0;j<L;++j)O[h[j]]=A(t,m+3*j,7);m+=3*L;var N=M(O),V=(1<<N)-1,U=b(O,N,1);for(j=0;j<F;){var $,G=U[A(t,m,V)];if(m+=15&G,($=G>>4)<16)B[j++]=$;else{var q=0,Z=0;for(16==$?(Z=3+A(t,m,3),m+=2,q=B[j-1]):17==$?(Z=3+A(t,m,7),m+=3):18==$&&(Z=11+A(t,m,127),m+=7);Z--;)B[j++]=q}}var W=B.subarray(0,R),H=B.subarray(R);x=M(W),w=M(H),_=b(W,x,1),v=b(H,w,1)}else D(1);if(m>T){l&&D(0);break}}s&&p(g+131072);for(var X=(1<<x)-1,Y=(1<<w)-1,K=m;;K=m){var J=(q=_[E(t,m)&X])>>4;if((m+=15&q)>T){l&&D(0);break}if(q||D(2),J<256)r[g++]=J;else{if(256==J){K=m,_=null;break}var Q=J-254;if(J>264){var tt=c[j=J-257];Q=A(t,m,(1<<tt)-1)+f[j],m+=tt}var et=v[E(t,m)&Y],rt=et>>4;if(et||D(3),m+=15&et,H=y[rt],rt>3&&(tt=u[rt],H+=E(t,m)&(1<<tt)-1,m+=tt),m>T){l&&D(0);break}s&&p(g+131072);var it=g+Q;if(g<H){var nt=a-H,ot=Math.min(H,it);for(nt+g<0&&D(3);g<ot;++g)r[g]=i[nt+g]}for(;g<it;g+=4)r[g]=r[g-H],r[g+1]=r[g+1-H],r[g+2]=r[g+2-H],r[g+3]=r[g+3-H];g=it}}e.l=_,e.p=K,e.b=g,e.f=d,_&&(d=1,e.m=x,e.d=v,e.n=w)}while(!d);return g==r.length?r:function(t,e,r){(null==e||e<0)&&(e=0),(null==r||r>t.length)&&(r=t.length);var i=new n(r-e);return i.set(t.subarray(e,r)),i}(r,0,g)},k=new n(0);function R(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){var r,i,o=function(t){31==t[0]&&139==t[1]&&8==t[2]||D(6,"invalid gzip data");var e=t[3],r=10;4&e&&(r+=2+(t[10]|t[11]<<8));for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[r++]);return r+(2&e)}(t);return o+8>t.length&&D(6,"invalid gzip data"),z(t.subarray(o,-8),{i:2},e&&e.out||new n((i=(r=t).length,(r[i-4]|r[i-3]<<8|r[i-2]<<16|r[i-1]<<24)>>>0)),e&&e.dictionary)}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return z(t,{i:2},e&&e.out,e&&e.dictionary)}(t,e):function(t,e){return z(t.subarray((r=t,i=e&&e.dictionary,(8!=(15&r[0])||r[0]>>4>7||(r[0]<<8|r[1])%31)&&D(6,"invalid zlib data"),(r[1]>>5&1)==+!i&&D(6,"invalid zlib data: "+(32&r[1]?"need":"unexpected")+" dictionary"),2+(r[1]>>3&4)),-4),{i:2},e&&e.out,e&&e.dictionary);var r,i}(t,e)}var L="undefined"!=typeof TextDecoder&&new TextDecoder;try{L.decode(k,{stream:!0})}catch(t){}var F=(t,e)=>t*r(2,e),B=(t,e)=>Math.floor(t/r(2,e)),O=(t,e)=>F(t.getUint16(e+1,!0),8)+t.getUint8(e),j=(t,e)=>F(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),N=(t,e,r,i,n)=>{if(t!==i.getUint8(n))return t-i.getUint8(n);const o=O(i,n+1);if(e!==o)return e-o;const a=O(i,n+4);return r!==a?r-a:0},V=(t,e,r,i)=>{const n=U(t,e,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],isDir:!1}:null},U=(t,e,r,i)=>{let n=0,o=t.byteLength/17-1;for(;n<=o;){const a=o+n>>1,s=N(e,r,i,t,17*a);if(s>0)n=a+1;else{if(!(s<0))return[j(t,17*a+7),t.getUint32(17*a+13,!0)];o=a-1}}return null},$=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,G=(t,e)=>{const r=t.getUint8(17*e);return{z:127&r,x:O(t,17*e+1),y:O(t,17*e+4),offset:j(t,17*e+7),length:t.getUint32(17*e+13,!0),isDir:r>>7==1}},q=t=>{const e=[],r=new DataView(t);for(let t=0;t<r.byteLength/17;t++)e.push(G(r,t));return Z(e)},Z=t=>{t.sort($);const e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let e=0;e<t.length;e++){const i=t[e];let n=i.z;i.isDir&&(n|=128),r[17*e]=n,r[17*e+1]=255&i.x,r[17*e+2]=i.x>>8&255,r[17*e+3]=i.x>>16&255,r[17*e+4]=255&i.y,r[17*e+5]=i.y>>8&255,r[17*e+6]=i.y>>16&255,r[17*e+7]=255&i.offset,r[17*e+8]=255&B(i.offset,8),r[17*e+9]=255&B(i.offset,16),r[17*e+10]=255&B(i.offset,24),r[17*e+11]=255&B(i.offset,32),r[17*e+12]=255&B(i.offset,48),r[17*e+13]=255&i.length,r[17*e+14]=i.length>>8&255,r[17*e+15]=i.length>>16&255,r[17*e+16]=i.length>>24&255}return e},W={getHeader:function(t){return i(this,null,function*(){const e=yield t.getBytes(0,512e3),r=new DataView(e.data),i=r.getUint32(4,!0),n=r.getUint16(8,!0),o=new TextDecoder("utf-8"),a=JSON.parse(o.decode(new DataView(e.data,10,i)));let s=0;"gzip"===a.compression&&(s=2);let l=0;"minzoom"in a&&(l=+a.minzoom);let c=0;"maxzoom"in a&&(c=+a.maxzoom);let u=0,h=0,p=0,d=-180,f=-85,m=180,g=85;if(a.bounds){const t=a.bounds.split(",");d=+t[0],f=+t[1],m=+t[2],g=+t[3]}if(a.center){const t=a.center.split(",");u=+t[0],h=+t[1],p=+t[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+i,rootDirectoryLength:17*n,jsonMetadataOffset:10,jsonMetadataLength:i,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:s,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:f,maxLon:m,maxLat:g,centerZoom:p,centerLon:u,centerLat:h,etag:e.etag}})},getZxy:function(t,e,r,n,o,a,s){return i(this,null,function*(){let i=yield r.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);1===t.specVersion&&(i=q(i));const l=V(new DataView(i),n,o,a);if(l){let t=(yield e.getBytes(l.offset,l.length,s)).data;const r=new DataView(t);return 31===r.getUint8(0)&&139===r.getUint8(1)&&(t=R(new Uint8Array(t))),{data:t}}const c=((t,e)=>{if(t.byteLength<17)return null;const r=t.byteLength/17,i=G(t,r-1);if(i.isDir){const t=i.z,r=e.z-t;return{z:t,x:Math.trunc(e.x/(1<<r)),y:Math.trunc(e.y/(1<<r))}}return null})(new DataView(i),{z:n,x:o,y:a});if(c){const l=((t,e,r,i)=>{const n=U(t,128|e,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],isDir:!0}:null})(new DataView(i),c.z,c.x,c.y);if(l){let i=yield r.getArrayBuffer(e,l.offset,l.length,t);1===t.specVersion&&(i=q(i));const c=V(new DataView(i),n,o,a);if(c){let t=(yield e.getBytes(c.offset,c.length,s)).data;const r=new DataView(t);return 31===r.getUint8(0)&&139===r.getUint8(1)&&(t=R(new Uint8Array(t))),{data:t}}}}})}};function H(t,e){return 4294967296*(e>>>0)+(t>>>0)}function X(t){const e=t.buf;let r=e[t.pos++],i=127&r;return r<128?i:(r=e[t.pos++],i|=(127&r)<<7,r<128?i:(r=e[t.pos++],i|=(127&r)<<14,r<128?i:(r=e[t.pos++],i|=(127&r)<<21,r<128?i:(r=e[t.pos],i|=(15&r)<<28,function(t,e){const r=e.buf;let i=r[e.pos++],n=(112&i)>>4;if(i<128)return H(t,n);if(i=r[e.pos++],n|=(127&i)<<3,i<128)return H(t,n);if(i=r[e.pos++],n|=(127&i)<<10,i<128)return H(t,n);if(i=r[e.pos++],n|=(127&i)<<17,i<128)return H(t,n);if(i=r[e.pos++],n|=(127&i)<<24,i<128)return H(t,n);if(i=r[e.pos++],n|=(1&i)<<31,i<128)return H(t,n);throw new Error("Expected varint not more than 10 bytes")}(i,t)))))}function Y(t,e,r,i){if(0===i){1===r&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const i=e[0];e[0]=e[1],e[1]=i}}var K=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function J(t,e){return i(this,null,function*(){if(1===e||0===e)return t;if(2===e){if(void 0===globalThis.DecompressionStream)return R(new Uint8Array(t));const e=new Response(t).body;if(!e)throw Error("Failed to read response stream");const r=e.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}function Q(t,e){let r=0,i=t.length-1;for(;r<=i;){const n=i+r>>1,o=e-t[n].tileId;if(o>0)r=n+1;else{if(!(o<0))return t[n];i=n-1}}if(i>=0){if(0===t[i].runLength)return t[i];if(e-t[i].tileId<t[i].runLength)return t[i]}return null}var tt=class{constructor(t,e=new Headers){this.url=t,this.customHeaders=e,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");const i=r.indexOf("Windows")>-1,n=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,i&&n&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(t){this.customHeaders=t}getBytes(t,e,r,n){return i(this,null,function*(){let i,o;r?o=r:(i=new AbortController,o=i.signal);const a=new Headers(this.customHeaders);let s;a.set("range",`bytes=${t}-${t+e-1}`),this.mustReload?s="reload":this.chromeWindowsNoCache&&(s="no-store");let l=yield fetch(this.url,{signal:o,cache:s,headers:a});if(0===t&&416===l.status){const t=l.headers.get("Content-Range");if(!t||!t.startsWith("bytes */"))throw Error("Missing content-length on 416 response");const e=+t.substr(8);l=yield fetch(this.url,{signal:o,cache:"reload",headers:{range:"bytes=0-"+(e-1)}})}let c=l.headers.get("Etag");if((null==c?void 0:c.startsWith("W/"))&&(c=null),416===l.status||n&&c&&c!==n)throw this.mustReload=!0,new it(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);const u=l.headers.get("Content-Length");if(200===l.status&&(!u||+u>e))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function et(t,e){const i=t.getUint32(e+4,!0),n=t.getUint32(e+0,!0);return i*r(2,32)+n}function rt(t){const e={buf:new Uint8Array(t),pos:0},r=X(e),i=[];let n=0;for(let t=0;t<r;t++){const t=X(e);i.push({tileId:n+t,offset:0,length:0,runLength:1}),n+=t}for(let t=0;t<r;t++)i[t].runLength=X(e);for(let t=0;t<r;t++)i[t].length=X(e);for(let t=0;t<r;t++){const r=X(e);i[t].offset=0===r&&t>0?i[t-1].offset+i[t-1].length:r-1}return i}var it=class extends Error{};var nt=class{constructor(t=100,e=!0,r=J){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return i(this,null,function*(){const e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;const n=new Promise((e,r)=>{(function(t,e){return i(this,null,function*(){const r=yield t.getBytes(0,16384);if(19792!==new DataView(r.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");if(function(t){const e=new DataView(t);return 2===e.getUint16(2,!0)?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):1===e.getUint16(2,!0)?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}(r.data)<3)return[yield W.getHeader(t)];const i=function(t,e){const r=new DataView(t),i=r.getUint8(7);if(i>3)throw Error(`Archive is spec version ${i} but this library supports up to spec version 3`);return{specVersion:i,rootDirectoryOffset:et(r,8),rootDirectoryLength:et(r,16),jsonMetadataOffset:et(r,24),jsonMetadataLength:et(r,32),leafDirectoryOffset:et(r,40),leafDirectoryLength:et(r,48),tileDataOffset:et(r,56),tileDataLength:et(r,64),numAddressedTiles:et(r,72),numTileEntries:et(r,80),numTileContents:et(r,88),clustered:1===r.getUint8(96),internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}(r.data.slice(0,127),r.etag),n=r.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),o=`${t.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,a=rt(yield e(n,i.internalCompression));return[i,[o,a.length,a]]})})(t,this.decompress).then(t=>{t[1]&&this.cache.set(t[1][0],{lastUsed:this.counter++,data:Promise.resolve(t[1][2])}),e(t[0]),this.prune()}).catch(t=>{r(t)})});return this.cache.set(e,{lastUsed:this.counter++,data:n}),n})}getDirectory(t,e,r,n){return i(this,null,function*(){const o=`${t.getKey()}|${n.etag||""}|${e}|${r}`,a=this.cache.get(o);if(a)return a.lastUsed=this.counter++,yield a.data;const s=new Promise((o,a)=>{(function(t,e,r,n,o){return i(this,null,function*(){const i=yield t.getBytes(r,n,void 0,o.etag),a=rt(yield e(i.data,o.internalCompression));if(0===a.length)throw new Error("Empty directory is invalid");return a})})(t,this.decompress,e,r,n).then(t=>{o(t),this.prune()}).catch(t=>{a(t)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(t,e,r,n){return i(this,null,function*(){const i=`${t.getKey()}|${n.etag||""}|${e}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;const a=new Promise((o,a)=>{t.getBytes(e,r,void 0,n.etag).then(t=>{o(t.data),this.cache.has(i),this.prune()}).catch(t=>{a(t)})});return this.cache.set(i,{lastUsed:this.counter++,data:a}),a})}prune(){if(this.cache.size>=this.maxCacheEntries){let t,e=1/0;this.cache.forEach((r,i)=>{r.lastUsed<e&&(e=r.lastUsed,t=i)}),t&&this.cache.delete(t)}}invalidate(t){return i(this,null,function*(){const e=t.getKey();if(this.invalidations.get(e))return yield this.invalidations.get(e);this.cache.delete(t.getKey());const r=new Promise((r,i)=>{this.getHeader(t).then(t=>{r(),this.invalidations.delete(e)}).catch(t=>{i(t)})});this.invalidations.set(e,r)})}},ot=class{constructor(t,e,r){this.source="string"==typeof t?new tt(t):t,this.decompress=r||J,this.cache=e||new nt}getHeader(){return i(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,n,o){return i(this,null,function*(){const i=function(t,e,i){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>r(2,t)-1||i>r(2,t)-1)throw Error("tile x/y outside zoom level bounds");const n=K[t];let o=0,a=0,s=0;const l=[e,i];let c=r(2,t)/2;for(;c>0;)o=(l[0]&c)>0?1:0,a=(l[1]&c)>0?1:0,s+=c*c*(3*o^a),Y(c,l,o,a),c/=2;return n+s}(t,e,n),a=yield this.cache.getHeader(this.source);if(a.specVersion<3)return W.getZxy(a,this.source,this.cache,t,e,n,o);if(t<a.minZoom||t>a.maxZoom)return;let s=a.rootDirectoryOffset,l=a.rootDirectoryLength;for(let t=0;t<=3;t++){const t=Q(yield this.cache.getDirectory(this.source,s,l,a),i);if(!t)return;if(t.runLength>0){const e=yield this.source.getBytes(a.tileDataOffset+t.offset,t.length,o,a.etag);return{data:yield this.decompress(e.data,a.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}s=a.leafDirectoryOffset+t.offset,l=t.length}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,n){return i(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,n)}catch(i){if(i instanceof it)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,n);throw i}})}getMetadataAttempt(){return i(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),i=new TextDecoder("utf-8");return JSON.parse(i.decode(r))})}getMetadata(){return i(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof it)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}getTileJson(t){return i(this,null,function*(){const e=yield this.getHeader(),r=yield this.getMetadata(),i=1===(n=e.tileType)?".mvt":2===n?".png":3===n?".jpg":4===n?".webp":5===n?".avif":"";var n;return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${t}/{z}/{x}/{y}${i}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],center:[e.centerLon,e.centerLat,e.centerZoom],minzoom:e.minZoom,maxzoom:e.maxZoom}})}};function at(t){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},at(t)}var st=/^\s+/,lt=/\s+$/;function ct(t,e){if(e=e||{},(t=t||"")instanceof ct)return t;if(!(this instanceof ct))return new ct(t,e);var r=function(t){var e,r,i,n={r:0,g:0,b:0},o=1,a=null,s=null,l=null,c=!1,u=!1;return"string"==typeof t&&(t=function(t){t=t.replace(st,"").replace(lt,"").toLowerCase();var e,r=!1;if(Mt[t])t=Mt[t],r=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=jt.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=jt.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=jt.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=jt.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=jt.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=jt.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=jt.hex8.exec(t))?{r:Dt(e[1]),g:Dt(e[2]),b:Dt(e[3]),a:Lt(e[4]),format:r?"name":"hex8"}:(e=jt.hex6.exec(t))?{r:Dt(e[1]),g:Dt(e[2]),b:Dt(e[3]),format:r?"name":"hex"}:(e=jt.hex4.exec(t))?{r:Dt(e[1]+""+e[1]),g:Dt(e[2]+""+e[2]),b:Dt(e[3]+""+e[3]),a:Lt(e[4]+""+e[4]),format:r?"name":"hex8"}:!!(e=jt.hex3.exec(t))&&{r:Dt(e[1]+""+e[1]),g:Dt(e[2]+""+e[2]),b:Dt(e[3]+""+e[3]),format:r?"name":"hex"}}(t)),"object"==at(t)&&(Nt(t.r)&&Nt(t.g)&&Nt(t.b)?(e=t.r,r=t.g,i=t.b,n={r:255*It(e,255),g:255*It(r,255),b:255*It(i,255)},c=!0,u="%"===String(t.r).substr(-1)?"prgb":"rgb"):Nt(t.h)&&Nt(t.s)&&Nt(t.v)?(a=kt(t.s),s=kt(t.v),n=function(t,e,r){t=6*It(t,360),e=It(e,100),r=It(r,100);var i=Math.floor(t),n=t-i,o=r*(1-e),a=r*(1-n*e),s=r*(1-(1-n)*e),l=i%6;return{r:255*[r,a,o,o,s,r][l],g:255*[s,r,r,a,o,o][l],b:255*[o,o,s,r,r,a][l]}}(t.h,a,s),c=!0,u="hsv"):Nt(t.h)&&Nt(t.s)&&Nt(t.l)&&(a=kt(t.s),l=kt(t.l),n=function(t,e,r){var i,n,o;function a(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=It(t,360),e=It(e,100),r=It(r,100),0===e)i=n=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=a(l,s,t+1/3),n=a(l,s,t),o=a(l,s,t-1/3)}return{r:255*i,g:255*n,b:255*o}}(t.h,a,l),c=!0,u="hsl"),t.hasOwnProperty("a")&&(o=t.a)),o=Et(o),{ok:c,format:t.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:o}}(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}function ut(t,e,r){t=It(t,255),e=It(e,255),r=It(r,255);var i,n,o=Math.max(t,e,r),a=Math.min(t,e,r),s=(o+a)/2;if(o==a)i=n=0;else{var l=o-a;switch(n=s>.5?l/(2-o-a):l/(o+a),o){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4}i/=6}return{h:i,s:n,l:s}}function ht(t,e,r){t=It(t,255),e=It(e,255),r=It(r,255);var i,n,o=Math.max(t,e,r),a=Math.min(t,e,r),s=o,l=o-a;if(n=0===o?0:l/o,o==a)i=0;else{switch(o){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4}i/=6}return{h:i,s:n,v:s}}function pt(t,e,r,i){var n=[zt(Math.round(t).toString(16)),zt(Math.round(e).toString(16)),zt(Math.round(r).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function dt(t,e,r,i){return[zt(Rt(i)),zt(Math.round(t).toString(16)),zt(Math.round(e).toString(16)),zt(Math.round(r).toString(16))].join("")}function ft(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.s-=e/100,r.s=Ct(r.s),ct(r)}function mt(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.s+=e/100,r.s=Ct(r.s),ct(r)}function gt(t){return ct(t).desaturate(100)}function _t(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.l+=e/100,r.l=Ct(r.l),ct(r)}function yt(t,e){e=0===e?0:e||10;var r=ct(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-e/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-e/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-e/100*255))),ct(r)}function vt(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.l-=e/100,r.l=Ct(r.l),ct(r)}function bt(t,e){var r=ct(t).toHsl(),i=(r.h+e)%360;return r.h=i<0?360+i:i,ct(r)}function xt(t){var e=ct(t).toHsl();return e.h=(e.h+180)%360,ct(e)}function wt(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=ct(t).toHsl(),i=[ct(t)],n=360/e,o=1;o<e;o++)i.push(ct({h:(r.h+o*n)%360,s:r.s,l:r.l}));return i}function Tt(t){var e=ct(t).toHsl(),r=e.h;return[ct(t),ct({h:(r+72)%360,s:e.s,l:e.l}),ct({h:(r+216)%360,s:e.s,l:e.l})]}function St(t,e,r){e=e||6,r=r||30;var i=ct(t).toHsl(),n=360/r,o=[ct(t)];for(i.h=(i.h-(n*e>>1)+720)%360;--e;)i.h=(i.h+n)%360,o.push(ct(i));return o}function Pt(t,e){e=e||6;for(var r=ct(t).toHsv(),i=r.h,n=r.s,o=r.v,a=[],s=1/e;e--;)a.push(ct({h:i,s:n,v:o})),o=(o+s)%1;return a}ct.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,i=this.toRgb();return t=i.r/255,e=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=Et(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=ht(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=ht(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),i=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+i+"%)":"hsva("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=ut(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ut(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),i=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+i+"%)":"hsla("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return pt(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,i,n){var o=[zt(Math.round(t).toString(16)),zt(Math.round(e).toString(16)),zt(Math.round(r).toString(16)),zt(Rt(i))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*It(this._r,255))+"%",g:Math.round(100*It(this._g,255))+"%",b:Math.round(100*It(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*It(this._r,255))+"%, "+Math.round(100*It(this._g,255))+"%, "+Math.round(100*It(this._b,255))+"%)":"rgba("+Math.round(100*It(this._r,255))+"%, "+Math.round(100*It(this._g,255))+"%, "+Math.round(100*It(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(At[pt(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+dt(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var n=ct(t);r="#"+dt(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0;return e||!i||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return ct(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(_t,arguments)},brighten:function(){return this._applyModification(yt,arguments)},darken:function(){return this._applyModification(vt,arguments)},desaturate:function(){return this._applyModification(ft,arguments)},saturate:function(){return this._applyModification(mt,arguments)},greyscale:function(){return this._applyModification(gt,arguments)},spin:function(){return this._applyModification(bt,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(St,arguments)},complement:function(){return this._applyCombination(xt,arguments)},monochromatic:function(){return this._applyCombination(Pt,arguments)},splitcomplement:function(){return this._applyCombination(Tt,arguments)},triad:function(){return this._applyCombination(wt,[3])},tetrad:function(){return this._applyCombination(wt,[4])}},ct.fromRatio=function(t,e){if("object"==at(t)){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]="a"===i?t[i]:kt(t[i]));t=r}return ct(t,e)},ct.equals=function(t,e){return!(!t||!e)&&ct(t).toRgbString()==ct(e).toRgbString()},ct.random=function(){return ct.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},ct.mix=function(t,e,r){r=0===r?0:r||50;var i=ct(t).toRgb(),n=ct(e).toRgb(),o=r/100;return ct({r:(n.r-i.r)*o+i.r,g:(n.g-i.g)*o+i.g,b:(n.b-i.b)*o+i.b,a:(n.a-i.a)*o+i.a})},ct.readability=function(t,e){var r=ct(t),i=ct(e);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},ct.isReadable=function(t,e,r){var i,n,o,a,s,l=ct.readability(t,e);switch(n=!1,(o=r,"AA"!==(a=((o=o||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==a&&(a="AA"),"small"!==(s=(o.size||"small").toLowerCase())&&"large"!==s&&(s="small"),i={level:a,size:s}).level+i.size){case"AAsmall":case"AAAlarge":n=l>=4.5;break;case"AAlarge":n=l>=3;break;case"AAAsmall":n=l>=7}return n},ct.mostReadable=function(t,e,r){var i,n,o,a,s=null,l=0;n=(r=r||{}).includeFallbackColors,o=r.level,a=r.size;for(var c=0;c<e.length;c++)(i=ct.readability(t,e[c]))>l&&(l=i,s=ct(e[c]));return ct.isReadable(t,s,{level:o,size:a})||!n?s:(r.includeFallbackColors=!1,ct.mostReadable(t,["#fff","#000"],r))};var Mt=ct.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},At=ct.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(Mt);function Et(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function It(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Ct(t){return Math.min(1,Math.max(0,t))}function Dt(t){return parseInt(t,16)}function zt(t){return 1==t.length?"0"+t:""+t}function kt(t){return t<=1&&(t=100*t+"%"),t}function Rt(t){return Math.round(255*parseFloat(t)).toString(16)}function Lt(t){return Dt(t)/255}var Ft,Bt,Ot,jt=(Bt="[\\s|\\(]+("+(Ft="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Ft+")[,|\\s]+("+Ft+")\\s*\\)?",Ot="[\\s|\\(]+("+Ft+")[,|\\s]+("+Ft+")[,|\\s]+("+Ft+")[,|\\s]+("+Ft+")\\s*\\)?",{CSS_UNIT:new RegExp(Ft),rgb:new RegExp("rgb"+Bt),rgba:new RegExp("rgba"+Ot),hsl:new RegExp("hsl"+Bt),hsla:new RegExp("hsla"+Ot),hsv:new RegExp("hsv"+Bt),hsva:new RegExp("hsva"+Ot),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Nt(t){return!!jt.CSS_UNIT.exec(t)}var Vt,Ut,$t,Gt=a(9002),qt=a.n(Gt),Zt=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},Wt=function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r};Vt=new WeakMap,Ut=new WeakMap,$t=new WeakMap;const Ht=new class{constructor(){Vt.set(this,void 0),Ut.set(this,void 0),$t.set(this,void 0)}get apiKey(){return Zt(this,Vt,"f")||this.parse(),Zt(this,Vt,"f")}get isGeoloniaStyle(){return Zt(this,$t,"f")}set isGeoloniaStyle(t){Wt(this,$t,t,"f")}set apiKey(t){Wt(this,Vt,t,"f")}get stage(){return Zt(this,Ut,"f")||this.parse(),Zt(this,Ut,"f")}set stage(t){Wt(this,Ut,t,"f")}parse(t=document){const e=t.currentScript?[t.currentScript]:t.getElementsByTagName("script");for(const t of e){const e=new URL(t.src.startsWith("https://")||t.src.startsWith("http://")||t.src.startsWith("//")?t.src:`https://${location.host}/${t.src}`).searchParams.get("geolonia-api-key");if(e){Wt(this,Vt,e,"f"),Wt(this,Ut,"v1","f");break}}if(Zt(this,Ut,"f")||Wt(this,Ut,"dev","f"),Zt(this,$t,"f")&&!Zt(this,Vt,"f"))throw new Error("Cannot load API key.")}reset(){Wt(this,Vt,void 0,"f"),Wt(this,Ut,void 0,"f"),Wt(this,$t,!1,"f")}isGeoloniaStyleCheck(t){if(!t||""===t)return!0;if(t.startsWith("https://cdn.geolonia.com/style/")||t.startsWith("https://api.geolonia.com/"))return!0;if(t.match(/^https?:\/\//))return!1;if(t.endsWith(".json"))try{return new URL(t,location.href).href.includes("geolonia.com")}catch(t){return!1}return!0}};function Xt(t){if(t.match(/^https?:\/\//))return t;if(t.match(/^\//)||t.match(/^\.\.?/))try{return new URL(t,location.href).href}catch(t){return console.error("[Geolonia]",t),!1}return!1}function Yt(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}function Kt(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}function Jt(t){const e=t.toLowerCase();return["top-right","bottom-right","bottom-left","top-left"].includes(e)?{enabled:!0,position:e}:["on","off"].includes(e)?{enabled:"on"===e,position:void 0}:{enabled:!1,position:void 0}}let Qt="";const te=t=>{if(Qt)return Qt;{const e=new Uint8Array(t/2);window.crypto.getRandomValues(e);const r=Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");return Qt=r,r}},ee=async t=>{const{default:e}=await Promise.all([a.e(728),a.e(445)]).then(a.t.bind(a,4728,23));return e(t,{allowedTags:e.defaults.allowedTags.concat(["img"]),allowedAttributes:{...e.defaults.allowedAttributes,"*":["class"]}})};class re extends e().Marker{constructor(t={},e={}){if(t=function(t,e){return t&&Kt(t)?t={element:t,...e}:t||(t=e),t}(t,e),!t||!t.element){const e=document.createElement("div");e.className="geolonia-default-marker",e.innerHTML=qt(),e.style.margin="0",e.style.padding="0",e.style.width="26px",e.style.height="34px";const r=e.querySelector("svg");if(r.style.width="100%",r.style.height="100%",t.element=e,t.color)e.querySelector(".left").style.fill=t.color,e.querySelector(".right").style.fill=ct(t.color).darken().toString();else{const t="#E4402F";e.querySelector(".left").style.fill=t,e.querySelector(".right").style.fill=ct(t).darken().toString()}t.offset=[0,-15]}return super(t),this}}class ie{onAdd(){this.container=document.createElement("div"),this.container.className="maplibregl-ctrl";const t=document.createElement("img");t.src="https://cdn.geolonia.com/logo/geolonia-symbol_1.png",t.style.width="16px",t.style.height="16px",t.style.display="block",t.style.cursor="pointer",t.style.padding="0",t.style.margin="0",t.style.border="none",t.alt="Geolonia";const e=document.createElement("a");return e.href="https://geolonia.com/",e.appendChild(t),e.title="Powered by Geolonia",this.container.appendChild(e),this.container}onRemove(){this.container.parentNode.removeChild(this.container)}getDefaultPosition(){return"bottom-left"}}var ne,oe,ae,se,le,ce=a(4748),ue=a.n(ce),he=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class pe{static testProp(t){if(!he(ne,ne,"f",oe))return t[0];for(let e=0;e<t.length;e++)if(t[e]in he(ne,ne,"f",oe))return t[e];return t[0]}static create(t,e,r){const i=window.document.createElement(t);return void 0!==e&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){he(ne,ne,"f",oe)&&he(ne,ne,"f",se)&&(function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(t,r):n?n.value=r:e.set(t,r)}(ne,ne,he(ne,ne,"f",oe)[he(ne,ne,"f",se)],"f",ae),he(ne,ne,"f",oe)[he(ne,ne,"f",se)]="none")}static enableDrag(){he(ne,ne,"f",oe)&&he(ne,ne,"f",se)&&(he(ne,ne,"f",oe)[he(ne,ne,"f",se)]=he(ne,ne,"f",ae))}static setTransform(t,e){t.style[he(ne,ne,"f",le)]=e}static addEventListener(t,e,r,i){"passive"in i?t.addEventListener(e,r,i):t.addEventListener(e,r,i.capture)}static removeEventListener(t,e,r,i){"passive"in i?t.removeEventListener(e,r,i):t.removeEventListener(e,r,i.capture)}static suppressClick(){window.addEventListener("click",he(ne,ne,"f",le),!0),window.setTimeout(()=>{window.removeEventListener("click",he(ne,ne,"f",le),!0)},0)}static mousePos(t,e){const r=t.getBoundingClientRect();return new(ue())(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)}static touchPos(t,e){const r=t.getBoundingClientRect(),i=[];for(let n=0;n<e.length;n++)i.push(new(ue())(e[n].clientX-r.left-t.clientLeft,e[n].clientY-r.top-t.clientTop));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ne=pe,oe={value:"undefined"!=typeof window&&window.document&&window.document.documentElement.style},ae={value:void 0},se={value:ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"])},le={value:ne.testProp(["transform","WebkitTransform"])};const de=class{constructor(t={}){var e;this.options=t,e=this,["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"].forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}getDefaultPosition(){return"bottom-right"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=pe.create("div");const e=this._container.attachShadow({mode:"open"});this._shadowContainer=pe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=pe.create("summary","maplibregl-ctrl-attrib-button",this._shadowContainer),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=pe.create("div","maplibregl-ctrl-attrib-inner",this._shadowContainer);const r=document.createElement("style");return r.textContent="\n .maplibregl-ctrl {\n font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;\n clear: both;\n pointer-events: auto;\n transform: translate(0);\n }\n\n .maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus {\n box-shadow: 0 0 2px 2px #0096ff\n }\n\n .maplibregl-ctrl.maplibregl-ctrl-attrib {\n background-color: hsla(0,0%,100%,.5);\n margin: 0;\n padding: 0 5px\n }\n\n @media screen {\n .maplibregl-ctrl-attrib.maplibregl-compact {\n background-color: #fff;\n border-radius: 12px;\n box-sizing: content-box;\n min-height: 20px;\n padding: 2px 24px 2px 0;\n position: relative;\n margin: 10px 10px 10px auto;\n width: 0;\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show {\n padding: 2px 28px 2px 8px;\n visibility: visible;\n width: auto;\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show {\n border-radius: 12px;\n padding: 2px 8px 2px 28px\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none\n }\n\n .maplibregl-ctrl-attrib-button {\n background-color: hsla(0,0%,100%,.5);\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");\n border: 0;\n border-radius: 12px;\n box-sizing: border-box;\n cursor: pointer;\n display: none;\n height: 24px;\n outline: none;\n position: absolute;\n right: 0;\n top: 0;\n width: 24px\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {\n appearance: none;\n list-style: none\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {\n display: none\n }\n\n .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button {\n left: 0\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {\n display: block\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {\n background-color: rgb(0 0 0/5%)\n }\n\n .maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n right: 0\n }\n\n .maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n right: 0;\n top: 0\n }\n\n .maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n left: 0;\n top: 0\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n left: 0\n }\n }\n\n @media screen and (-ms-high-contrast:active) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media screen and (-ms-high-contrast:black-on-white) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media print {\n .maplibregl-ctrl-attrib-button {\n display: none!important;\n }\n }\n\n .maplibregl-ctrl-attrib a {\n color: rgba(0,0,0,.75);\n text-decoration: none;\n white-space: nowrap;\n }\n\n .maplibregl-ctrl-attrib a:hover {\n color: inherit;\n text-decoration: underline\n }\n\n .maplibregl-attrib-empty {\n display: none\n }\n ",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),e.appendChild(r),e.appendChild(this._shadowContainer),this.printQuery=window.matchMedia("print"),this.onMediaPrintChange=t=>{t.matches&&(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show"))},this.printQuery.addEventListener("change",this.onMediaPrintChange),this._container}onRemove(){pe.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,this.printQuery.removeEventListener("change",this.onMediaPrintChange)}_setElementTitle(t,e){const r=this._map._getUIString(`AttributionControl.${e}`);t.title=r,t.setAttribute("aria-label",r)}_toggleAttribution(){this._shadowContainer.classList.contains("maplibregl-compact")&&(this._shadowContainer.classList.contains("maplibregl-compact-show")?(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show")):(this._shadowContainer.classList.add("maplibregl-compact-show"),this._shadowContainer.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const r in e){const i=e[r];if(i.used||i.usedForTerrain){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,r)=>{for(let i=r+1;i<t.length;i++)if(t[i].indexOf(e)>=0)return!1;return!0});const r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=r,this._shadowContainer.classList.remove("maplibregl-attrib-empty")):this._shadowContainer.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._shadowContainer.setAttribute("open",""):this._shadowContainer.classList.contains("maplibregl-compact")||this._shadowContainer.classList.contains("maplibregl-attrib-empty")||(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.contains("maplibregl-compact-show")&&this._shadowContainer.classList.remove("maplibregl-compact-show")}};class fe{constructor(t={}){this.fullscreen=!1,this.id=`mbgl-gesture-handling-help-container-${fe.count}`,fe.count++,this.timer=null;const e="ctrl"!==t.modifierKey;let r=`Use ${e?"alt":"ctrl"} + scroll to zoom the map.`,i="Use two fingers to move the map.";if("ja"===("auto"!==t.lang&&t.lang?t.lang:function(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}())&&(r=(e?"Alt":"Ctrl")+" キーを押しながらスクロールしてください。",i="2本指を使って操作してください。"),this.settings={backgroundColor:"rgba(0, 0, 0, 0.8)",textColor:"#ffffff",textMessage:r,textMessageMobile:i,timeout:2e3,...t,modifierKey:e?"altKey":"ctrlKey"},this.helpElement=document.querySelector(`#${this.id}`),null===this.helpElement){this.helpElement=document.createElement("div"),this.helpElement.id=this.id,this.helpElement.style.backgroundColor=this.settings.backgroundColor,this.helpElement.style.position="absolute",this.helpElement.style.display="none",this.helpElement.style.zIndex=9999,this.helpElement.style.justifyContent="center",this.helpElement.style.alignItems="center";const t=document.createElement("div");t.style.textAlign="center",t.style.color=this.settings.textColor,t.innerText="",this.helpElement.appendChild(t)}}showHelp(t,e){this.helpElement.style.top=0,this.helpElement.style.left=0,this.helpElement.style.width="100%",this.helpElement.style.height="100%",this.helpElement.style.display="flex",this.helpElement.querySelector("div").innerText=e,t.getContainer().appendChild(this.helpElement)}hideHelp(t){try{t.getContainer().removeChild(this.helpElement)}catch(t){}}addTo(t){t.scrollZoom.disable(),this.helpElement.addEventListener("wheel",e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),this.hideHelp(t)):(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.hideHelp(t)},this.settings.timeout))}),t.getContainer().addEventListener("wheel",e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),t.scrollZoom.isEnabled()||(t.scrollZoom.reset(),t.scrollZoom.enable())):(t.scrollZoom.disable(),this.showHelp(t,this.settings.textMessage),this.timer=setTimeout(()=>{this.hideHelp(t)},this.settings.timeout))}),this.helpElement.addEventListener("touchstart",e=>{e.touches&&(2<=e.touches.length||!0===this.fullscreen)&&(clearTimeout(this.timer),this.hideHelp(t),t.dragPan.enable(),e.preventDefault())}),t.on("movestart",e=>{e.originalEvent&&"touches"in e.originalEvent&&2>e.originalEvent.touches.length&&!1===this.fullscreen&&(this.showHelp(t,this.settings.textMessageMobile),t.dragPan.disable(),this.timer=setTimeout(()=>{t.dragPan.enable(),this.hideHelp(t)},this.settings.timeout))}),document.addEventListener("fullscreenchange",()=>{document.fullscreenElement?this.fullscreen=!0:this.fullscreen=!1})}}fe.count=0;const me=fe,ge=(t,e={})=>{t.dataset||(t.dataset={});let r="auto";r=t.dataset.lang&&"auto"===t.dataset.lang?Yt():t.dataset.lang&&"ja"===t.dataset.lang?"ja":t.dataset.lang&&"ja"!==t.dataset.lang?"en":Yt(),Ht.parse(t);const i=t.dataset.style||"geolonia/basic-v2";return Ht.isGeoloniaStyle=Ht.isGeoloniaStyleCheck(i),{lat:0,lng:0,zoom:0,bearing:0,pitch:0,hash:"off",marker:"on",markerColor:"#E4402F",openPopup:"off",customMarker:"",customMarkerOffset:"0, 0",gestureHandling:!1===e.interactive?"off":"on",navigationControl:!1===e.interactive?"off":"on",geolocateControl:"off",fullscreenControl:"off",scaleControl:"off",geoloniaControl:"on",geojson:"",simpleVector:"",cluster:"on",clusterColor:"#ff0000",style:"geolonia/basic-v2",lang:r,plugin:"off",key:Ht.apiKey,apiUrl:`https://api.geolonia.com/${Ht.stage}`,stage:Ht.stage,loader:"on",minZoom:"",maxZoom:20,"3d":"",...t.dataset}};var _e=a(5879),ye=a.n(_e);function ve(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function be(t,e,r){if(null!==t)for(var i,n,o,a,s,l,c,u,h=0,p=0,d=t.type,f="FeatureCollection"===d,m="Feature"===d,g=f?t.features.length:1,_=0;_<g;_++){s=(u=!!(c=f?t.features[_].geometry:m?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var v=0,b=0;if(null!==(a=u?c.geometries[y]:c)){l=a.coordinates;var x=a.type;switch(h=!r||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===e(l,p,_,v,b))return!1;p++,v++;break;case"LineString":case"MultiPoint":for(i=0;i<l.length;i++){if(!1===e(l[i],p,_,v,b))return!1;p++,"MultiPoint"===x&&v++}"LineString"===x&&v++;break;case"Polygon":case"MultiLineString":for(i=0;i<l.length;i++){for(n=0;n<l[i].length-h;n++){if(!1===e(l[i][n],p,_,v,b))return!1;p++}"MultiLineString"===x&&v++,"Polygon"===x&&b++}"Polygon"===x&&v++;break;case"MultiPolygon":for(i=0;i<l.length;i++){for(b=0,n=0;n<l[i].length;n++){for(o=0;o<l[i][n].length-h;o++){if(!1===e(l[i][n][o],p,_,v,b))return!1;p++}b++}v++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(!1===be(a.geometries[i],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function xe(t){var e=[1/0,1/0,-1/0,-1/0];return be(t,function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])}),e}xe.default=xe;const we=xe,Te=function(t,e){void 0===e&&(e={});var r=we(t);return function(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ve(t[0])||!ve(t[1]))throw new Error("coordinates must contain numbers");return function(t,e,r){void 0===r&&(r={});var i={type:"Feature"};return(0===r.id||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=e||{},i.geometry=t,i}({type:"Point",coordinates:t},e,r)}([(r[0]+r[2])/2,(r[1]+r[3])/2],e.properties,e)},Se="#000000",Pe="#FFFFFF",Me="rgba(255, 0, 0, 0.4)",Ae="#FFFFFF",Ee={type:"FeatureCollection",features:[]};class Ie{constructor(t,e){this.callFitBounds=!1,this._eventHandlers=[],this.setGeoJSON(t),this.options={id:"geolonia-simple-style",cluster:!0,heatmap:!1,clusterColor:"#ff0000",...e}}updateData(t){this.setGeoJSON(t);const e=this.geojson.features,r=e.filter(t=>"point"!==t.geometry.type.toLowerCase()),i=e.filter(t=>"point"===t.geometry.type.toLowerCase());return this.map.getSource(this.options.id).setData({type:"FeatureCollection",features:r}),this.map.getSource(`${this.options.id}-points`).setData({type:"FeatureCollection",features:i}),this}addTo(t){this.map=t;const e=this.geojson.features,r=e.filter(t=>"point"!==t.geometry.type.toLowerCase()),i=e.filter(t=>"point"===t.geometry.type.toLowerCase());return this.map.addSource(this.options.id,{type:"geojson",data:{type:"FeatureCollection",features:r}}),this.setPolygonGeometries(),this.setLineGeometries(),this.map.addSource(`${this.options.id}-points`,{type:"geojson",data:{type:"FeatureCollection",features:i},cluster:this.options.cluster,clusterMaxZoom:14,clusterRadius:50}),this.map.addLayer({id:`${this.options.id}-polygon-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],Se],"text-halo-color":["string",["get","text-halo-color"],Pe],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.map.addLayer({id:`${this.options.id}-linestring-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],Se],"text-halo-color":["string",["get","text-halo-color"],Pe],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(),this.setCluster(),this}fitBounds(t={}){this.callFitBounds=!0;const e={duration:3e3,padding:30,...t},r=ye()(this.geojson);return r&&window.requestAnimationFrame(()=>{this.map.fitBounds(r,e)}),this}setPolygonGeometries(){this.map.addLayer({id:`${this.options.id}-polygon`,type:"fill",source:this.options.id,filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],Me],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],Ae]}}),this.setPopup(this.map,`${this.options.id}-polygon`)}setLineGeometries(){this.map.addLayer({id:`${this.options.id}-linestring`,type:"line",source:this.options.id,filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],Me],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(this.map,`${this.options.id}-linestring`)}setPointGeometries(){this.map.addLayer({id:`${this.options.id}-circle-points`,type:"circle",source:`${this.options.id}-points`,filter:["all",["!has","point_count"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],Me],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],Ae],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),this.map.addLayer({id:`${this.options.id}-symbol-points`,type:"symbol",source:`${this.options.id}-points`,filter:["!",["has","point_count"]],paint:{"text-color":["string",["get","text-color"],Se],"text-halo-color":["string",["get","text-halo-color"],Pe],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!0,"icon-allow-overlap":!0,"text-variable-anchor":["top","bottom","left","right"],"text-radial-offset":["case",["==","small",["get","marker-size"]],1,["==","large",["get","marker-size"]],1.6,1.2]}}),this.setPopup(this.map,`${this.options.id}-circle-points`),this.setPopup(this.map,`${this.options.id}-symbol-points`)}async setPopup(t,r){const i=async r=>{const i=Te(r.features[0]).geometry.coordinates,n=r.features[0].properties.description;if(n){const r=await ee(n);(new(e().Popup)).setLngLat(i).setHTML(r).addTo(t)}},n=e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")},o=()=>{t.getCanvas().style.cursor=""};t.on("click",r,i),t.on("mouseenter",r,n),t.on("mouseleave",r,o),this._eventHandlers.push({event:"click",layer:r,handler:i},{event:"mouseenter",layer:r,handler:n},{event:"mouseleave",layer:r,handler:o})}setCluster(){this.map.addLayer({id:`${this.options.id}-clusters`,type:"circle",source:`${this.options.id}-points`,filter:["has","point_count"],paint:{"circle-radius":20,"circle-color":this.options.clusterColor,"circle-opacity":1}}),this.map.addLayer({id:`${this.options.id}-cluster-count`,type:"symbol",source:`${this.options.id}-points`,filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-size":14,"text-font":["Noto Sans Regular"]}});const t=`${this.options.id}-clusters`,e=async e=>{const r=this.map.queryRenderedFeatures(e.point,{layers:[t]}),i=r[0].properties.cluster_id,n=await this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(i);this.map.easeTo({center:r[0].geometry.coordinates,zoom:n})},r=()=>{this.map.getCanvas().style.cursor="pointer"},i=()=>{this.map.getCanvas().style.cursor=""};this.map.on("click",t,e),this.map.on("mouseenter",t,r),this.map.on("mouseleave",t,i),this._eventHandlers.push({event:"click",layer:t,handler:e},{event:"mouseenter",layer:t,handler:r},{event:"mouseleave",layer:t,handler:i})}remove(){if(!this.map)return this;const t=this.options.id;for(const{event:t,layer:e,handler:r}of this._eventHandlers)this.map.off(t,e,r);this._eventHandlers=[];const e=[`${t}-polygon-symbol`,`${t}-linestring-symbol`,`${t}-circle-points`,`${t}-symbol-points`,`${t}-polygon`,`${t}-linestring`,`${t}-clusters`,`${t}-cluster-count`];for(const t of e)this.map.getLayer(t)&&this.map.removeLayer(t);for(const e of[t,`${t}-points`])this.map.getSource(e)&&this.map.removeSource(e);return this.map.getCanvas().style.cursor="",this}setGeoJSON(t){if("string"==typeof t&&Xt(t)){this.geojson=Ee;const e=async()=>{try{const e=await window.fetch(t),r=e.ok?await e.json():{};this.geojson=r,this.updateData(r),this.callFitBounds&&(this.fitBounds(),this.callFitBounds=!1)}catch(t){console.error("[Geolonia] Failed to load GeoJSON:",t)}};this._loadingPromise=e()}else this.geojson=t}}const Ce="#000000",De="#FFFFFF",ze="rgba(255, 0, 0, 0.4)",ke="#FFFFFF",Re=class{constructor(t){this.url=t,this.sourceName="vt-geolonia-simple-style"}addTo(t){const e=t.getContainer();if(!e.dataset||!e.dataset.lng&&!e.dataset.lat){let e=!1;t.on("sourcedata",r=>{if(r.sourceId!==this.sourceName)return;const i=t.getSource(r.sourceId);!0===(i&&i.loaded())&&(e||(e=!0,t.fitBounds(i.bounds,{duration:0,padding:30})))})}t.addSource(this.sourceName,{type:"vector",url:this.url}),this.setPolygonGeometries(t),this.setLineGeometries(t),t.addLayer({id:"vt-geolonia-simple-style-polygon-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],Ce],"text-halo-color":["string",["get","text-halo-color"],De],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),t.addLayer({id:"vt-geolonia-simple-style-linestring-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],Ce],"text-halo-color":["string",["get","text-halo-color"],De],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(t)}setPolygonGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-polygon",type:"fill",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],ze],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],ke]}}),this.setPopup(t,"vt-geolonia-simple-style-polygon")}setLineGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-linestring",type:"line",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],ze],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(t,"vt-geolonia-simple-style-linestring")}setPointGeometries(t){t.addLayer({id:"vt-circle-simple-style-points",type:"circle",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["all",["==","$type","Point"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],ze],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],ke],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),t.addLayer({id:"vt-geolonia-simple-style-points",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Point"],paint:{"text-color":["string",["get","text-color"],Ce],"text-halo-color":["string",["get","text-halo-color"],De],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,1]],["==","large",["get","marker-size"]],["literal",[0,1.6]],["literal",[0,1.2]]],"text-allow-overlap":!1}}),this.setPopup(t,"vt-circle-simple-style-points"),this.setPopup(t,"vt-geolonia-simple-style-points")}async setPopup(t,r){t.on("click",r,async r=>{const i=Te(r.features[0]).geometry.coordinates,n=r.features[0].properties.description;if(n){const r=await ee(n);(new(e().Popup)).setLngLat(i).setHTML(r).addTo(t)}}),t.on("mouseenter",r,e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")}),t.on("mouseleave",r,()=>{t.getCanvas().style.cursor=""})}};class Le extends e().Map{constructor(e){const r=function(t){if(Kt(t))return t;if("string"==typeof t)return document.querySelector(t)||document.getElementById(t)||!1;if(t.container){if(Kt(t.container))return t.container;if("string"==typeof t.container)return document.querySelector(t.container)||document.getElementById(t.container)||!1}return!1}(e);if(!r)throw"string"==typeof e?new Error(`[Geolonia] No HTML elements found matching \`${e}\`. Please ensure the map container element exists.`):new Error("[Geolonia] No HTML elements found. Please ensure the map container element exists.");if(r.geoloniaMap)return r.geoloniaMap;0===r.clientHeight&&console.warn("[Geolonia] Embed API failed to render the map because the container has no height. Please set the CSS property `height` to the container.");const i=ge(r,{interactive:"object"!=typeof e||e.interactive}),n=function(t,e,r){e.container&&delete e.container,e===t&&(e={});const i={style:r.style||e.style,container:t,center:[parseFloat(r.lng),parseFloat(r.lat)],bearing:parseFloat(r.bearing),pitch:parseFloat(r.pitch),zoom:parseFloat(r.zoom),hash:"on"===r.hash,localIdeographFontFamily:"sans-serif",attributionControl:!1};return""===r.minZoom||0!==Number(r.minZoom)&&!Number(r.minZoom)||(i.minZoom=Number(r.minZoom)),""!==r.maxZoom&&Number(r.maxZoom)&&(i.maxZoom=Number(r.maxZoom)),Object.assign(i,e),i}(r,e,i),o=r.innerHTML.trim();let a;r.innerHTML="","off"!==i.loader&&(a=document.createElement("div"),a.addEventListener("touchmove",t=>{t.touches&&t.touches.length>1&&t.preventDefault()}),a.className="loading-geolonia-map",a.innerHTML='<div class="lds-grid"><div></div><div></div><div></div>\n <div></div><div></div><div></div><div></div><div></div><div></div></div>',r.appendChild(a));const s=te(40),l=new URL(`${i.apiUrl}/sources`);l.searchParams.set("key",i.key),l.searchParams.set("sessionId",s);const c=n.transformRequest;n.transformRequest=(t,e)=>{if("Source"===e&&t.startsWith("https://api.geolonia.com"))return{url:l.toString()};let r=t;if(t.startsWith("geolonia://")){const e=t.match(/^geolonia:\/\/tiles\/(?<username>.+)\/(?<customtileId>.+)/);e&&(r=`https://tileserver.geolonia.com/customtiles/${e.groups.customtileId}/tiles.json`)}const n=new URL(r),o=function(t){try{const e="string"==typeof t?new URL(t):t;return"tileserver.geolonia.com"===e.hostname||e.hostname.endsWith(".tiles.geolonia.com")}catch(t){return!1}}(n);if("Source"===e&&o)return"dev"===i.stage&&"tileserver.geolonia.com"===n.hostname&&(n.hostname="tileserver-dev.geolonia.com"),n.searchParams.set("sessionId",s),n.searchParams.set("key",i.key),{url:n.toString()};if(("SpriteJSON"===e||"SpriteImage"===e)&&r.match(/^https:\/\/api\.geolonia\.com\/(dev|v1)\/sprites\//)){const t=n.pathname.split("/");return t[1]=String(i.stage),n.pathname=t.join("/"),n.searchParams.set("key",i.key),{url:n.toString()}}let a;return"function"==typeof c&&(a=c(r,e)),a};try{super(n)}catch(t){throw(t=>{const e=document.createElement("div");e.classList.add("geolonia__error-container");const r=document.createElement("div"),i=document.createElement("h2");i.textContent="Geolonia Maps",r.appendChild(i),r.classList.add("geolonia__error-message"),r.innerHTML+='<div class="geolonia__error-message-description">地図の初期化に失敗しました。管理者にお問い合わせ下さい。開発者の方は開発者ツールでエラー詳細をご確認下さい。</div>',e.appendChild(r),t.appendChild(e)})(r),t}const u=this;this.geoloniaSourcesUrl=l,this.__styleExtensionLoadRequired=!0;const{position:h}=Jt(i.geoloniaControl);u.addControl(new ie,h),u.addControl(new de,"bottom-right");const{enabled:p,position:d}=Jt(i.fullscreenControl);p&&u.addControl(new t.FullscreenControl,d);const{enabled:f,position:m}=Jt(i.navigationControl);f&&u.addControl(new t.NavigationControl,m);const{enabled:g,position:_}=Jt(i.geolocateControl);g&&u.addControl(new t.GeolocateControl({}),_);const{enabled:y,position:v}=Jt(i.scaleControl);return y&&u.addControl(new t.ScaleControl({}),v),u.on("load",e=>{const s=e.target;if("off"!==i.loader)try{r.removeChild(a)}catch(t){}if("off"!==i.gestureHandling&&function(){const t=document.body,e=document.documentElement;return t.scrollHeight>t.clientHeight||e.scrollHeight>e.clientHeight}()&&new me({lang:i.lang}).addTo(s),i.lat&&i.lng&&"on"===i.marker)if(o){const e=new t.Popup({offset:[0,-25]}).setHTML(o);let r;if(i.customMarker){const t=i.customMarkerOffset.split(/,/).map(t=>Number(t.trim())),o=document.querySelector(i.customMarker);o.style.display="block",r=new re({element:o,offset:t}).setLngLat(n.center).addTo(s).setPopup(e)}else r=new re({color:i.markerColor}).setLngLat(n.center).addTo(s).setPopup(e);"on"===i.openPopup&&r.togglePopup(),r.getElement().classList.add("geolonia-clickable-marker")}else new re({color:i.markerColor}).setLngLat(n.center).addTo(s)}),u.on("styledata",async t=>{const e=t.target;if(this.__styleExtensionLoadRequired){if(this.__styleExtensionLoadRequired=!1,i.simpleVector){const t=(n=i.simpleVector,/^(https?|geolonia):\/\//.test(n)?n:`geolonia://tiles/custom/${n}`);new Re(t).addTo(e)}var n;if(i.geojson){const t=(t=>{if(/^https?:\/\//.test(t))return!1;if(/^\//.test(t))return!1;if(/^\.\//.test(t))return!1;if(/^\.\.\//.test(t))return!1;try{return document.querySelector(t)}catch(t){return!1}})(i.geojson);let n;n=t?JSON.parse(t.textContent):i.geojson;const o=new Ie(n,{cluster:"on"===i.cluster,clusterColor:i.clusterColor});o.addTo(e),r.dataset&&(r.dataset.lng||r.dataset.lat)||o.fitBounds()}i["3d"]&&e.getStyle().layers.forEach(t=>{"on"===i["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]?e.setLayoutProperty(t.id,"visibility","visible"):"off"===i["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]||"on"===i["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]?e.setLayoutProperty(t.id,"visibility","none"):"off"===i["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]&&e.setLayoutProperty(t.id,"visibility","visible")})}}),u.on("error",async t=>{t.error&&402===t.error.status&&(t=>{if(!t._geolonia_restricted_mode_handled){t._geolonia_restricted_mode_handled=!0;const e=t.getContainer();t.remove(),e.innerHTML="",e.classList.add("geolonia__restricted-mode-image-container")}})(u)}),r.geoloniaMap=u,u}setStyle(t,e={}){if(null!==t){const e=ge(this.getContainer());"string"==typeof t&&(t=function(t,e){if(Ht.isGeoloniaStyleCheck(t)&&!e.key)throw new Error("[Geolonia] API key is required to use Geolonia styles. Please provide an API key or use an external style URL.");if(!t||""===t)return"ja"===e.lang?"https://cdn.geolonia.com/style/geolonia/basic-v2/ja.json":"https://cdn.geolonia.com/style/geolonia/basic-v2/en.json";const r=Xt(t);if(r)return"https:"===location.protocol&&r.startsWith("http:")&&console.warn(`[Geolonia] Mixed Content Warning: You are loading a style from an insecure HTTP URL (${r}) on an HTTPS page. This may fail in modern browsers.`),r;if(t.endsWith(".json"))try{const e=new URL(t,location.href).href;return"https:"===location.protocol&&e.startsWith("http:")&&console.warn(`[Geolonia] Mixed Content Warning: You are loading a style from an insecure HTTP URL (${e}) on an HTTPS page. This may fail in modern browsers.`),e}catch(e){return console.error("[Geolonia] Failed to resolve style URL:",t,e),t}return"ja"===e.lang?`https://cdn.geolonia.com/style/${t}/ja.json`:`https://cdn.geolonia.com/style/${t}/en.json`}(t,e))}return this.__styleExtensionLoadRequired=!0,super.setStyle.call(this,t,e),this}remove(){const t=this.getContainer();super.remove.call(this),delete t.geoloniaMap}loadImage(t,e){const r=super.loadImage(t);if(!e)return r;!function(t,e){t.then(t=>{e(null,t.data,{cacheControl:t.cacheControl,expires:t.expires})}).catch(t=>{e(t)})}(r,e)}}var Fe=a(5072),Be=a.n(Fe),Oe=a(7825),je=a.n(Oe),Ne=a(7659),Ve=a.n(Ne),Ue=a(5056),$e=a.n(Ue),Ge=a(540),qe=a.n(Ge),Ze=a(1113),We=a.n(Ze),He=a(5955),Xe={};Xe.styleTagTransform=We(),Xe.setAttributes=$e(),Xe.insert=Ve().bind(null,"head"),Xe.domAPI=je(),Xe.insertStyleElement=qe(),Be()(He.A,Xe),He.A&&He.A.locals&&He.A.locals;var Ye=a(1208),Ke={};Ke.styleTagTransform=We(),Ke.setAttributes=$e(),Ke.insert=Ve().bind(null,"head"),Ke.domAPI=je(),Ke.insertStyleElement=qe(),Be()(Ye.A,Ke),Ye.A&&Ye.A.locals&&Ye.A.locals;const Je=[],Qe=t=>{Je.push(t)},tr="5.2.1",er=new class{constructor(t){var e;this.tilev4=(t,e)=>i(this,null,function*(){if("json"===t.type){const e=t.url.substr(10);let r=this.tiles.get(e);if(r||(r=new ot(e),this.tiles.set(e,r)),this.metadata)return{data:yield r.getTileJson(t.url)};const i=yield r.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:i.minZoom,maxzoom:i.maxZoom,bounds:[i.minLon,i.minLat,i.maxLon,i.maxLat]}}}const r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),i=t.url.match(r);if(!i)throw new Error("Invalid PMTiles protocol URL");const n=i[1];let o=this.tiles.get(n);o||(o=new ot(n),this.tiles.set(n,o));const a=i[2],s=i[3],l=i[4],c=yield o.getHeader(),u=yield null==o?void 0:o.getZxy(+a,+s,+l,e.signal);return u?{data:new Uint8Array(u.data),cacheControl:u.cacheControl,expires:u.expires}:1===c.tileType?{data:new Uint8Array}:{data:null}}),this.tile=(e=this.tilev4,(t,r)=>{if(r instanceof AbortController)return e(t,r);const i=new AbortController;return e(t,i).then(t=>r(void 0,t.data,t.cacheControl||"",t.expires||""),t=>r(t)).catch(t=>r(t)),{cancel:()=>i.abort()}}),this.tiles=new Map,this.metadata=(null==t?void 0:t.metadata)||!1}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};e().addProtocol("pmtiles",er.tile)})(),s})());