From 83208b80ac04e5c146357495f957add8a6452bca Mon Sep 17 00:00:00 2001 From: Josh Reisner <1551689+joshreisner@users.noreply.github.com> Date: Fri, 27 Sep 2024 21:00:43 -0700 Subject: [PATCH] update url scheme for arc on ios (#417) --- public/app.js | 4 ++-- src/helpers/format-directions-url.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app.js b/public/app.js index 634e286c..f429eab9 100644 --- a/public/app.js +++ b/public/app.js @@ -1,5 +1,5 @@ /*! For license information please see app.js.LICENSE.txt */ -(()=>{var e,t,n={405:(e,t,n)=>{"use strict";t.ZM=void 0;var r=n(702),i=n(308);function o(e){return e in i.types}function a(e){return r.languages.includes(e)}t.ZM=function(e){var t={};for(var n in i.types)o(n)&&a(e)&&(t[n]=i.types[n][e]);return t}},702:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.languages=void 0,t.languages=["en","es","fr","ja","nl","pt","sk","sv"]},308:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0,t.types={11:{en:"11th Step Meditation",es:"Meditación del Paso 11",fr:"Méditation sur la 11e Étape",ja:"ステップ11 黙想",nl:"Stap 11 meditatie",pt:"Meditação do 11º Passo",sk:"Meditácia 11. kroku",sv:"11th Stegs Meditation"},"12x12":{en:"12 Steps & 12 Traditions",es:"12 Pasos y 12 Tradiciones",fr:"12 Étapes et 12 Traditions",ja:"12のステップと12の伝統",nl:"12 Stappen en 12 Tradities",pt:"12 Passos e 12 Tradições",sk:"12 Krokov & 12 Tradícií",sv:"12 Steg & 12 Traditioner"},A:{en:"Secular",es:"Secular",fr:"Séculier",ja:"無宗教",nl:"Seculier",pt:"Secular",sk:"Svetské",sv:"Sekulärt"},ABSI:{en:"As Bill Sees It",es:"Como lo ve Bill",fr:"Réflexions de Bill",ja:"ビルはこう思う",nl:"Zoals Bill het ziet",pt:"Na opinião de Bill",sk:"Ako to vidí Bill",sv:"Som Bill Ser Det"},AL:{en:"Concurrent with Alateen",es:"Concurrente con Alateen",fr:"En même temps qu’Alateen",ja:"アラティーンと同時進行",nl:"Gelijktijdig met Alateen",pt:"Em simultâneo com Alateen",sk:"Súbežne s Alateen",sv:"Tillsammans med Alateen"},"AL-AN":{en:"Concurrent with Al-Anon",es:"Concurrente con Al-Anon",fr:"En même temps qu’Al-Anon",ja:"アラノンと同時進行",nl:"Gelijktijdig met Al-Anon",pt:"Em simultâneo com Al-Anon",sk:"Súbežne s Al-Anon",sv:"Tillsammans med Al-Anon"},AM:{en:"Amharic",es:"Amárico",fr:"Amharique",ja:"アムハラ語",nl:"Amhaars",pt:"Amárico",sk:"Amharčina",sv:"Amhariska"},ASL:{en:"American Sign Language",es:"Lenguaje por señas",fr:"Langage des Signes",ja:"アメリカ手話",nl:"Amerikaanse gebaren taal",pt:"Língua Gestual Americana",sk:"Americký posunkový jazyk",sv:"Amerikanskt teckenspråk"},B:{en:"Big Book",es:"Libro Grande",fr:"Gros Livre",ja:"ビッグブック",nl:"Big Book",pt:"Livro Azul",sk:"Veľká Kniha",sv:"Stora Boken"},BA:{en:"Babysitting Available",es:"Guardería disponible",fr:"Garderie d’enfants disponible",ja:"ベビーシッターあり",nl:"Kinderopvang aanwezig",pt:"Babysitting disponível",sk:"Dostupné opatrovanie detí",sv:"Barnvakt Finns"},BE:{en:"Newcomer",es:"Principiantes",fr:"Nouveau/nouvelle",ja:"ビギナーズ",nl:"Nieuwkomer",pt:"Recém-chegados",sk:"Nováčikovia",sv:"Nykomling"},BI:{en:"Bisexual",es:"Bisexual",fr:"Bisexuel",ja:"バイセクシャル",nl:"Biseksueel",pt:"Bisexual",sk:"Bisexuálne",sv:"Bisexuellt"},BRK:{en:"Breakfast",es:"Desayuno",fr:"Petit déjeuner",ja:"朝食",nl:"Ontbijt",pt:"Pequeno-Almoço",sk:"Raňajky",sv:"Frukost"},C:{en:"Closed",es:"Cerrada",fr:"Fermé",ja:"クローズド",nl:"Gesloten",pt:"Fechada",sk:"Uzatvorené",sv:"Slutet"},CAN:{en:"Candlelight",es:"Luz de una vela",fr:"À la chandelle",ja:"キャンドル",nl:"Candlelight",pt:"Luz de Velas",sk:"Sviečky",sv:"Tända Ljus"},CF:{en:"Child-Friendly",es:"Niño amigable",fr:"Enfants acceptés",ja:"お子さま歓迎",nl:"Kindvriendelijk",pt:"Amigável para Crianças",sk:"Priateľský k deťom",sv:"Barnvänligt"},D:{en:"Discussion",es:"Discusión",fr:"Discussion",ja:"ディスカッション",nl:"Discussie",pt:"Discussão",sk:"Diskusia",sv:"Diskussion"},DA:{en:"Danish",es:"Danés",fr:"Danois",ja:"デンマーク語",nl:"Deens",pt:"Dinamarquês",sk:"Dánsky",sv:"Danska"},DB:{en:"Digital Basket",es:"Canasta digital",fr:"Panier numérique",ja:"電子献金",nl:"Digitale mand",pt:"Cesto Digital",sk:"Digitálny košík",sv:"Digital Korg"},DD:{en:"Dual Diagnosis",es:"Diagnóstico dual",fr:"Double diagnostic",ja:"重複診断",nl:"Dubbele diagnose",pt:"Duplo Diagnóstico",sk:"Duálna diagnóza",sv:"Dubbel Diagnos"},DE:{en:"German",es:"Alemán",fr:"Allemand",ja:"ドイツ語",nl:"Duits",pt:"Alemão",sk:"Nemecké",sv:"Tyska"},DR:{en:"Daily Reflections",es:"Reflexiones Diarias",fr:"Réflexions quotidiennes",ja:"今日を新たに",nl:"Dagelijkse weerspiegelingen",pt:"Reflexões Diárias",sv:"Dagliga Reflektioner",sk:"Denné úvahy"},EL:{en:"Greek",es:"Griego",fr:"Grec",ja:"ギリシャ語",nl:"Grieks",pt:"Grego",sk:"Grécke",sv:"Grekiska"},EN:{en:"English",es:"Inglés",fr:"Anglais",ja:"英語",nl:"Engels",pt:"Inglês",sk:"Anglické",sv:"Engelska"},FA:{en:"Persian",es:"Persa",fr:"Persan",ja:"ペルシア語",nl:"Perzisch",pt:"Persa",sk:"Perzské",sv:"Persiska"},FF:{en:"Fragrance Free",es:"Sin fragancia",fr:"Sans parfum",ja:"香水なし",nl:"Geen parfum",pt:"Sem Perfumes",sk:"Bez vône",sv:"Parfym Fritt"},FR:{en:"French",es:"Francés",fr:"Français",ja:"フランス語",nl:"Frans",pt:"Francês",sk:"Francúzsky",sv:"Franska"},G:{en:"Gay",es:"Gay",fr:"Gai",ja:"ゲイ",nl:"Homo",pt:"Gay",sk:"Gay",sv:"Gay"},GR:{en:"Grapevine",es:"La Viña",fr:"Grapevine",ja:"グレープバイン",nl:"Wijnstok",pt:"Grapevine",sk:"Grapevine",sv:"Grapevine"},H:{en:"Birthday",es:"Cumpleaños",fr:"Anniversaire",ja:"バースデー",nl:"Verjaardag",pt:"Aniversário",sk:"Narodeniny",sv:"Födelsedag"},HE:{en:"Hebrew",es:"Hebreo",fr:"Hébreu",ja:"ヘブライ語",nl:"Hebreeuws",pt:"Hebreu",sk:"Hebrejské",sv:"Hebreiska"},HI:{en:"Hindi",es:"Hindi",fr:"Hindi",ja:"ヒンディー語",nl:"Hindi",pt:"Hindi",sk:"Hindi",sv:"Hindi"},HR:{en:"Croatian",es:"Croata",fr:"Croate",ja:"クロアチア語",nl:"Kroatisch",pt:"Croata",sk:"Chorvátsky",sv:"Kroatiska"},HU:{en:"Hungarian",es:"Húngaro",fr:"Hongrois",ja:"ハンガリー語",nl:"Hongaars",pt:"Hungaro",sk:"Maďarské",sv:"Ungerska"},ITA:{en:"Italian",es:"Italiano",fr:"Italien",ja:"イタリア語",nl:"Italiaans",pt:"Italiano",sk:"Taliansky",sv:"Italienska"},JA:{en:"Japanese",es:"Japonés",fr:"Japonais",ja:"日本語",nl:"Japans",pt:"Japonês",sk:"Japonské",sv:"Japanska"},KOR:{en:"Korean",es:"Coreano",fr:"Coréen",ja:"韓国語",nl:"Koreaans",pt:"Coreano",sk:"Kórejske",sv:"Koreanska"},L:{en:"Lesbian",es:"Lesbiana",fr:"Lesbienne",ja:"レズビアン",nl:"Lesbisch",pt:"Lésbica",sk:"Lesbické",sv:"Lesbiskt"},LGBTQ:{en:"LGBTQ",es:"LGBTQ",fr:"LGBTQ",ja:"LGBTQ",nl:"LGBTQ",pt:"LGBTQ",sk:"LGBTQ",sv:"HBTQ"},LIT:{en:"Literature",es:"Literatura",fr:"Publications",ja:"書籍",nl:"Literatuur",pt:"Literatura",sk:"Literatúra",sv:"Litteratur"},LS:{en:"Living Sober",es:"Viviendo Sobrio",fr:"Vivre… Sans alcool",ja:"リビングソーバー",nl:"Sober leven",pt:"Viver Sóbrio",sk:"Triezvy život",sv:"Leva Nyktert"},LT:{en:"Lithuanian",es:"Lituano",fr:"Lituanien",ja:"リトアニア語",nl:"Litouws",pt:"Lituano",sk:"Litovské",sv:"Litauiska"},M:{en:"Men",es:"Hombres",fr:"Hommes",ja:"男性",nl:"Mannen",pt:"Homens",sk:"Muži",sv:"Mansmöte"},MED:{en:"Meditation",es:"Meditación",fr:"Méditation",ja:"黙想",nl:"Meditatie",pt:"Meditação",sk:"Meditácia",sv:"Meditationsmöte"},ML:{en:"Malayalam",es:"Malayalam",fr:"Malayalam",ja:"マラヤーラム語",nl:"Malayalam",pt:"Malaiala",sk:"Malajálamsky",sv:"Malayalam"},N:{en:"Native American",es:"Nativo Americano",fr:"Autochtone",ja:"ネイティブアメリカン",nl:"Indiaan",pt:"Nativo Americano",sk:"Domorodí Američania",sv:"Ur-amerikanskt"},NDG:{en:"Indigenous",es:"Indígena",fr:"Indigène",ja:"先住民",nl:"Inheems",pt:"Indígena",sk:"Domorodé",sv:"Urfolkligt"},NO:{en:"Norwegian",es:"Noruego",fr:"Norvégien",ja:"ノルウェー語",nl:"Noors",pt:"Norueguês",sk:"Nórsky",sv:"Norska"},O:{en:"Open",es:"Abierta",fr:"Ouvert(e)",ja:"オープン",nl:"Open",pt:"Aberta",sk:"Otvorené",sv:"Öppet"},OUT:{en:"Outdoor",es:"Al aire libre",fr:"En plein air",ja:"アウトドア",nl:"Buiten",pt:"Ao ar livre",sk:"Vonkajšie",sv:"Utomhus"},P:{en:"Professionals",es:"Profesionales",fr:"Professionnels",ja:"職業人",nl:"Professionals",pt:"Profissionais",sk:"Profesionáli",sv:"Professionella"},POA:{en:"Proof of Attendance",es:"Prueba de Asistencia",fr:"Preuve de Présence",ja:"出席証明",nl:"Bewijs van Aanwezigheid",pt:"Comprovante de Presença",sk:"Doklad o účasti",sv:"Närvarobevis"},POC:{en:"People of Color",es:"Gente de color",fr:"Gens de couleur",ja:"有色人種",nl:"Mensen van kleur",pt:"Pessoas de Côr",sk:"Farební ľudia",sv:"Färgade"},POL:{en:"Polish",es:"Polaco",fr:"Polonais",ja:"ポーランド語",nl:"Pools",pt:"Polaco",sk:"Poľské",sv:"Polska"},POR:{en:"Portuguese",es:"Portugués",fr:"Portugais",ja:"ポルトガル語",nl:"Portugees",pt:"Português",sk:"Portugalské",sv:"Portugisiska"},PUN:{en:"Punjabi",es:"Punjabi",fr:"Pendjabi",ja:"パンジャブ語",nl:"Punjabi",pt:"Punjabi",sk:"Pandžábske",sv:"Punjabi"},RUS:{en:"Russian",es:"Ruso",fr:"Russe",ja:"ロシア語",nl:"Russisch",pt:"Russo",sk:"Ruské",sv:"Ryska"},S:{en:"Spanish",es:"Español",fr:"Espagnol",ja:"スペイン語",nl:"Spaans",pt:"Espanhol",sk:"Španielské",sv:"Spanska"},SEN:{en:"Seniors",es:"Personas mayores",fr:"Séniors",ja:"シニア",nl:"Senioren",pt:"Séniores",sk:"Seniori",sv:"Seniorer"},SK:{en:"Slovak",es:"Eslovaco",fr:"Slovaque",ja:"スロバキア語",nl:"Slowaaks",pt:"Eslovaco",sk:"Slovenské",sv:"Slovakiska"},SM:{en:"Smoking Permitted",es:"Se permite fumar",fr:"Permis de fumer",ja:"喫煙可",nl:"Roken toegestaan",pt:"Permitido Fumar",sk:"Fajčenie povolené",sv:"Rökning Tillåten"},SP:{en:"Speaker",es:"Orador",fr:"Conférencier",ja:"スピーカー",nl:"Spreker",pt:"Partilhador",sk:"Spíker",sv:"Talare"},ST:{en:"Step Study",es:"Estudio de pasos",fr:"Sur les Étapes",ja:"ステップ",nl:"Stap studie",pt:"Estudo de Passos",sk:"Štúdium Krokov",sv:"Stegmöte"},SV:{en:"Swedish",es:"Sueco",fr:"Suédois",ja:"スウェーデン語",nl:"Zweeds",pt:"Sueco",sk:"Švédske",sv:"Svenska"},T:{en:"Transgender",es:"Transgénero",fr:"Transgenre",ja:"トランスジェンダー",nl:"Transgender",pt:"Transgénero",sk:"Transgender",sv:"Transpersoner"},TC:{en:"Location Temporarily Closed",es:"Ubicación temporalmente cerrada",fr:"Emplacement temporairement fermé",ja:"一時的休止中",nl:"Locatie tijdelijk gesloten",pt:"Local Temporáriamente Encerrado",sk:"Miesto dočasne zatvorené",sv:"Tillfälligt Stängt"},TH:{en:"Thai",es:"Tailandés",fr:"Thaï",ja:"タイ語",nl:"Thais",pt:"Tailandês",sk:"Thajské",sv:"Thailändska"},TL:{en:"Tagalog",es:"Tagalo",fr:"Tagalog",ja:"タガログ語",nl:"Tagalog",pt:"Tagalo",sk:"Tagalské",sv:"Tagalog"},TR:{en:"Tradition Study",es:"Estudio de tradicion",fr:"Étude des Traditions",ja:"伝統",nl:"Traditie Studie",pt:"Estudo de Tradições",sk:"Tradičné štúdium",sv:"Traditionsmöte"},UK:{en:"Ukrainian",es:"Ucraniano",fr:"Ukrainien",ja:"ウクライナ語",nl:"Oekraïens",pt:"Ucraniano",sk:"Ukrajinské",sv:"Ukrainska"},W:{en:"Women",es:"Mujer",fr:"Femmes",ja:"女性",nl:"Vrouwen",pt:"Mulheres",sk:"Ženy",sv:"Kvinnomöte"},X:{en:"Wheelchair Access",es:"Acceso en silla de ruedas",fr:"Accès aux fauteuils roulants",ja:"車いすアクセス",nl:"Toegankelijk voor rolstoelgebruikers",pt:"Acesso a Cadeiras de Rodas",sk:"Prístup pre vozíčkarov",sv:"Handikappanpassat"},XB:{en:"Wheelchair-Accessible Bathroom",es:"Baño accesible para sillas de ruedas",fr:"Toilettes accessibles aux fauteuils roulants",ja:"車いす使用者用トイレ",nl:"Rolstoeltoegankelijke badkamer",pt:"WC com Acesso a Cadeiras de Rodas",sk:"Bezbariérová kúpeľňa",sv:"Handikappanpassad WC"},XT:{en:"Cross Talk Permitted",es:"Se permite opinar",fr:"Conversation croisée permise",ja:"クロストーク可能",nl:"Cross-sharen toegestaan",pt:"Prtilhas Cruzadas Permitidas",sk:"Cross Talk povolený",sv:"Kommentarer Tilltåtna"},Y:{en:"Young People",es:"Gente joven",fr:"Jeunes",ja:"ヤング",nl:"Jongeren",pt:"Jovens",sk:"Mladí ľudia",sv:"Young People"}}},809:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(314),i=n.n(r)()((function(e){return e[1]}));i.push([e.id,".mapboxgl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.mapboxgl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;overflow:hidden;padding:0;width:29px}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl-group button:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:only-child{border-radius:inherit}.mapboxgl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 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 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.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.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 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 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.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.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M10 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 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M14.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.5z'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.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-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.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-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.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-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath d='m10.5 16 4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath d='m10.5 16 4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath d='m10.5 16 4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='m14 5 1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='m14 5 1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 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-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='m14 5 1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E\")}}@keyframes mapboxgl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 0 1 3.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 0 0-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 0 0 4.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 0 1-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 0 1 .3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 0 1-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg opacity='.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cg opacity='.9' fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 0 1 3.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 0 0-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 0 0 4.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 0 1-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 0 1 .3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 0 1-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/g%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 0 1 3.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 0 0-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 0 0 4.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 0 1-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 0 1 .3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 0 1-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{background-color:#fff;border-radius:12px;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg 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\");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}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg 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\")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg 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\")}}.mapboxgl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-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}.mapboxgl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{flex-direction:column-reverse}.mapboxgl-popup-anchor-left{flex-direction:row}.mapboxgl-popup-anchor-right{flex-direction:row-reverse}.mapboxgl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.mapboxgl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{left:0;opacity:1;position:absolute;top:0;transition:opacity .2s;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before{animation:mapboxgl-user-location-dot-pulse 2s infinite;content:\"\";position:absolute}.mapboxgl-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}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading{height:0;width:0}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after,.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-bottom:7.5px solid #4aa1eb;content:\"\";position:absolute}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-left:7.5px solid transparent;transform:translateY(-28px) skewY(-20deg)}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after{border-right:7.5px solid transparent;transform:translate(7.5px,-28px) skewY(20deg)}@keyframes mapboxgl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}@media print{.mapbox-improve-map{display:none}}.mapboxgl-scroll-zoom-blocker,.mapboxgl-touch-pan-blocker{align-items:center;background:rgba(0,0,0,.7);color:#fff;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;top:0;transition:opacity .75s ease-in-out;transition-delay:1s;width:100%}.mapboxgl-scroll-zoom-blocker-show,.mapboxgl-touch-pan-blocker-show{opacity:1;transition:opacity .1s ease-in-out}.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page,.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page .mapboxgl-canvas{touch-action:pan-x pan-y}",""]);const o=i},314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return r(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function s(e,t,n){var i={};return n.isMergeableObject(e)&&o(e).forEach((function(t){i[t]=r(e[t],n)})),o(t).forEach((function(o){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(a(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):i[o]=r(t[o],n))})),i}function l(e,n,o){(o=o||{}).arrayMerge=o.arrayMerge||i,o.isMergeableObject=o.isMergeableObject||t,o.cloneUnlessOtherwiseSpecified=r;var a=Array.isArray(n);return a===Array.isArray(e)?a?o.arrayMerge(e,n,o):s(e,n,o):r(n,o)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var c=l;e.exports=c},146:(e,t,n)=>{"use strict";var r=n(363),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function l(e){return r.isMemo(e)?a:s[e.$$typeof]||i}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=a;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,f=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(f){var i=p(n);i&&i!==f&&e(t,i,r)}var a=u(n);h&&(a=a.concat(h(n)));for(var s=l(t),m=l(n),g=0;g1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)i?a=n:s=n,n=.5*(s-a)+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var g=p(f),_=y;function y(e,t){this.x=e,this.y=t}y.prototype={clone:function(){return new y(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},y.convert=function(e){return e instanceof y?e:Array.isArray(e)?new y(e[0],e[1]):e};var v=p(_);const x=Math.PI/180,b=180/Math.PI;function w(e){return e*x}function E(e){return e*b}const T=[[0,0],[1,0],[1,1],[0,1]];function S(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function k(e,t,n,r){const i=new g(e,t,n,r);return function(e){return i.solve(e)}}const M=k(.25,.1,.25,1);function C(e,t,n){return Math.min(n,Math.max(t,e))}function A(e,t,n){return(n=C((n-e)/(t-e),0,1))*n*(3-2*n)}function I(e,t,n){const r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function z(e,t,n){if(!e.length)return n(null,[]);let r=e.length;const i=new Array(e.length);let o=null;e.forEach(((e,a)=>{t(e,((e,t)=>{e&&(o=e),i[a]=t,0==--r&&n(o,i)}))}))}function P(e){const t=[];for(const n in e)t.push(e[n]);return t}function L(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}let D=1;function R(){return D++}function O(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function B(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function F(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function N(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function j(e,t){return-1!==e.indexOf(t,e.length-t.length)}function U(e,t,n){const r={};for(const i in e)r[i]=t.call(n||this,e[i],i,e);return r}function V(e,t,n){const r={};for(const i in e)t.call(n||this,e[i],i,e)&&(r[i]=e[i]);return r}function $(e){return Array.isArray(e)?e.map($):"object"==typeof e&&e?U(e,$):e}const G={};function Z(e){G[e]||("undefined"!=typeof console&&console.warn(e),G[e]=!0)}function q(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function W(e){let t=0;for(let n,r,i=0,o=e.length,a=o-1;i@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,r,i)=>{const o=r||i;return t[n]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let Y=null;function K(e){if(null==Y){const t=e.navigator?e.navigator.userAgent:null;Y=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Y}function J(e){try{const n=t[e];return n.setItem("_mapbox_test_",1),n.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Q(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}const ee="mapbox-tiles";let te,ne,re=500,ie=50;function oe(){try{return t.caches}catch(e){}}function ae(){oe()&&!te&&(te=t.caches.open(ee))}function se(e){const t=e.indexOf("?");if(t<0)return e;const n=function(e){const t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e),r=n.filter((e=>{const t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return r.length?`${e.slice(0,t)}?${r.join("&")}`:e.slice(0,t)}let le=1/0;const ce={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ce);class ue extends Error{constructor(e,t,n){401===t&&be(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const he=H()?()=>self.worker&&self.worker.referrer:()=>("blob:"===t.location.protocol?t.parent:t).location.href,de=function(e,n){if(!(/^file:/.test(r=e.url)||/^file:/.test(he())&&!/^\w+:/.test(r))){if(t.fetch&&t.Request&&t.AbortController&&t.Request.prototype.hasOwnProperty("signal"))return function(e,n){const r=new t.AbortController,i=new t.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:he(),referrerPolicy:e.referrerPolicy,signal:r.signal});let o=!1,a=!1;const s=(l=i.url).indexOf("sku=")>0&&be(l);var l;"json"===e.type&&i.headers.set("Accept","application/json");const c=(r,o,l)=>{if(a)return;if(r&&"SecurityError"!==r.message&&Z(r.toString()),o&&l)return u(o);const c=Date.now();t.fetch(i).then((t=>{if(t.ok){const e=s?t.clone():null;return u(t,e,c)}return n(new ue(t.statusText,t.status,e.url))})).catch((t=>{"AbortError"!==t.name&&n(new Error(`${t.message} ${e.url}`))}))},u=(r,s,l)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then((e=>{a||(s&&l&&function(e,n,r){if(ae(),!te)return;const i={status:n.status,statusText:n.statusText,headers:new t.Headers};n.headers.forEach(((e,t)=>i.headers.set(t,e)));const o=X(n.headers.get("Cache-Control")||"");if(o["no-store"])return;o["max-age"]&&i.headers.set("Expires",new Date(r+1e3*o["max-age"]).toUTCString());const a=i.headers.get("Expires");a&&(new Date(a).getTime()-r<42e4||function(e,t){if(void 0===ne)try{new Response(new ReadableStream),ne=!0}catch(e){ne=!1}ne?t(e.body):e.blob().then(t)}(n,(n=>{const r=new t.Response(n,i);ae(),te&&te.then((t=>t.put(se(e.url),r))).catch((e=>Z(e.message)))})))}(i,s,l),o=!0,n(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((e=>{a||n(new Error(e.message))}))};return s?function(e,t){if(ae(),!te)return t(null);const n=se(e.url);te.then((e=>{e.match(n).then((r=>{const i=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),n=X(e.headers.get("Cache-Control")||"");return t>Date.now()&&!n["no-cache"]}(r);e.delete(n),i&&e.put(n,r.clone()),t(null,r,i)})).catch(t)})).catch(t)}(i,c):c(null,null),{cancel:()=>{a=!0,o||r.abort()}}}(e,n);if(H()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,n,void 0,!0)}var r;return function(e,n){const r=new t.XMLHttpRequest;r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer");for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{n(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let t=r.response;if("json"===e.type)try{t=JSON.parse(r.response)}catch(e){return n(e)}n(null,t,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else n(new ue(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,n)},pe=function(e,t){return de(L(e,{type:"arrayBuffer"}),t)};function fe(e){const n=t.document.createElement("a");return n.href=e,n.protocol===t.document.location.protocol&&n.host===t.document.location.host}const me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let ge,_e;ge=[],_e=0;const ye=function(e,n){if(a.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),_e>=o.MAX_PARALLEL_IMAGE_REQUESTS){const t={requestParameters:e,callback:n,cancelled:!1,cancel(){this.cancelled=!0}};return ge.push(t),t}_e++;let r=!1;const i=()=>{if(!r)for(r=!0,_e--;ge.length&&_e{i(),e?n(e):r&&(t.createImageBitmap?function(e,n){const r=new t.Blob([new Uint8Array(e)],{type:"image/png"});t.createImageBitmap(r).then((e=>{n(null,e)})).catch((e=>{n(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(r,((e,t)=>n(e,t,o,a))):function(e,n){const r=new t.Image,i=t.URL;r.onload=()=>{n(null,r),i.revokeObjectURL(r.src),r.onload=null,t.requestAnimationFrame((()=>{r.src=me}))},r.onerror=()=>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."));const o=new t.Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?i.createObjectURL(o):me}(r,((e,t)=>n(e,t,o,a))))}));return{cancel:()=>{s.cancel(),i()}}},ve="NO_ACCESS_TOKEN";function xe(e){return 0===e.indexOf("mapbox:")}function be(e){return o.API_URL_REGEX.test(e)}function we(e){return o.API_CDN_URL_REGEX.test(e)}function Ee(e){return o.API_STYLE_REGEX.test(e)&&!Te(e)}function Te(e){return o.API_SPRITE_REGEX.test(e)}const Se=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ke(e){const t=e.match(Se);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Me(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const Ce="mapbox.eventData";function Ae(e){if(!e)return null;const n=e.split(".");if(!n||3!==n.length)return null;try{return JSON.parse(decodeURIComponent(t.atob(n[1]).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(e){return null}}class Ie{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const n=Ae(o.ACCESS_TOKEN);let r="";return r=n&&n.u?t.btoa(encodeURIComponent(n.u).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t))))):o.ACCESS_TOKEN||"",e?`${Ce}.${e}:${r}`:`${Ce}:${r}`}fetchEventData(){const e=J("localStorage"),n=this.getStorageKey(),r=this.getStorageKey("uuid");if(e)try{const e=t.localStorage.getItem(n);e&&(this.eventData=JSON.parse(e));const i=t.localStorage.getItem(r);i&&(this.anonId=i)}catch(e){Z("Unable to read from LocalStorage")}}saveEventData(){const e=J("localStorage"),n=this.getStorageKey(),r=this.getStorageKey("uuid");if(e)try{t.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&t.localStorage.setItem(n,JSON.stringify(this.eventData))}catch(e){Z("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,n,r){if(!o.EVENTS_URL)return;const i=ke(o.EVENTS_URL);i.params.push(`access_token=${r||o.ACCESS_TOKEN||""}`);const a={event:this.type,created:new Date(e).toISOString()},s=t?L(a,t):a,l={url:Me(i),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=function(e,t){return de(L(e,{method:"POST"}),t)}(l,(e=>{this.pendingRequest=null,n(e),this.saveEventData(),this.processRequests(r)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const ze=new class extends Ie{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){o.EVENTS_URL&&o.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>xe(e)||be(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Ae(o.ACCESS_TOKEN),r=t?t.u:o.ACCESS_TOKEN;let i=r!==this.eventData.tokenU;F(this.anonId)||(this.anonId=O(),i=!0);const a=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(a),n=(a-this.eventData.lastSuccess)/864e5;i=i||n>=1||n<-1||e.getDate()!==t.getDate()}else i=!0;i?this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:d,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=a,this.eventData.tokenU=r)}),e):this.processRequests()}},Pe=ze.postTurnstileEvent.bind(ze),Le=new class extends Ie{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,n,r){this.skuToken=t,this.errorCb=r,o.EVENTS_URL&&(n||o.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},n):this.errorCb(new Error(ve)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:r}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),F(this.anonId)||(this.anonId=O()),this.postEvent(r,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:d,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e))}},De=Le.postMapLoadEvent.bind(Le),Re=new class extends Ie{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){o.EVENTS_URL&&(e||o.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:r,performanceData:i}=this.queue.shift(),o=function(e){const r=t.performance.getEntriesByType("resource"),i=t.performance.getEntriesByType("mark"),o=function(e){const t={};if(e)for(const n in e)if("other"!==n)for(const r of e[n]){const e=`${n}ResolveRangeMin`,i=`${n}ResolveRangeMax`,o=`${n}RequestCount`,a=`${n}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[i]=Math.max(t[i]||-1/0,r.responseEnd);const s=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&s(a),s(o)}return t}(function(e,t){const n={};if(e)for(const r of e){const e=t(r);void 0===n[e]&&(n[e]=[]),n[e].push(r)}return n}(r,Ve)),a=t.devicePixelRatio,s=t.navigator.connection||t.navigator.mozConnection||t.navigator.webkitConnection,l={counters:[],metadata:[],attributes:[]},c=(e,t,n)=>{null!=n&&e.push({name:t,value:n.toString()})};for(const e in o)c(l.counters,e,o[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(c(l.counters,"interactionRangeMin",e.interactionRange[0]),c(l.counters,"interactionRangeMax",e.interactionRange[1])),i)for(const e of Object.keys(je)){const t=je[e],n=i.find((e=>e.name===t));n&&c(l.counters,t,n.startTime)}return c(l.counters,"visibilityHidden",e.visibilityHidden),c(l.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(Ee(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(r)),c(l.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),c(l.attributes,"fogEnabled",e.fogEnabled?"true":"false"),c(l.attributes,"projection",e.projection),c(l.attributes,"zoom",e.zoom),c(l.metadata,"devicePixelRatio",a),c(l.metadata,"connectionEffectiveType",s?s.effectiveType:void 0),c(l.metadata,"navigatorUserAgent",t.navigator.userAgent),c(l.metadata,"screenWidth",t.screen.width),c(l.metadata,"screenHeight",t.screen.height),c(l.metadata,"windowWidth",t.innerWidth),c(l.metadata,"windowHeight",t.innerHeight),c(l.metadata,"mapWidth",e.width/a),c(l.metadata,"mapHeight",e.height/a),c(l.metadata,"webglRenderer",e.renderer),c(l.metadata,"webglVendor",e.vendor),c(l.metadata,"sdkVersion",n),c(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(i);for(const e of o.metadata);for(const e of o.counters);for(const e of o.attributes);this.postEvent(r,o,(()=>{}),e)}},Oe=Re.postPerformanceEvent.bind(Re),Be=new class extends Ie{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,n,r){if(!o.API_URL||!o.SESSION_PATH)return;const i=ke(o.API_URL+o.SESSION_PATH);i.params.push(`sku=${t||""}`),i.params.push(`access_token=${r||o.ACCESS_TOKEN||""}`);const a={url:Me(i),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return de(L(e,{method:"GET"}),t)}(a,(e=>{this.pendingRequest=null,n(e),this.saveEventData(),this.processRequests(r)}))}getSessionAPI(e,t,n,r){this.skuToken=t,this.errorCb=r,o.SESSION_PATH&&o.API_URL&&(n||o.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},n):this.errorCb(new Error(ve)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}},Fe=Be.getSessionAPI.bind(Be),Ne=new Set,je={create:"create",load:"load",fullLoad:"fullLoad"},Ue={mark(e){t.performance.mark(e)},measure(e,n,r){t.performance.measure(e,n,r)}};function Ve(e){const t=e.name.split("?")[0];return we(t)&&t.includes("mapbox-gl.js")?"javascript":we(t)&&t.includes("mapbox-gl.css")?"css":function(e){return o.API_FONTS_REGEX.test(e)}(t)?"fontRange":Te(t)?"sprite":Ee(t)?"style":function(e){return o.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}const $e=t.performance;function Ge(e){const t=e?e.url.toString():void 0;return $e.getEntriesByName(t)}let Ze,qe,We,He;const Xe={now:()=>void 0!==We?We:t.performance.now(),setNow(e){We=e},restoreNow(){We=void 0},frame(e){const n=t.requestAnimationFrame(e);return{cancel:()=>t.cancelAnimationFrame(n)}},getImageData(e,n=0){const{width:r,height:i}=e;He||(He=t.document.createElement("canvas"));const o=He.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return(r>He.width||i>He.height)&&(He.width=r,He.height=i),o.clearRect(-n,-n,r+2*n,i+2*n),o.drawImage(e,0,0,r,i),o.getImageData(-n,-n,r+2*n,i+2*n)},resolveURL:e=>(Ze||(Ze=t.document.createElement("a")),Ze.href=e,Ze.href),get devicePixelRatio(){return t.devicePixelRatio},get prefersReducedMotion(){return!!t.matchMedia&&(null==qe&&(qe=t.matchMedia("(prefers-reduced-motion: reduce)")),qe.matches)}};function Ye(e,t,n){n[e]&&-1!==n[e].indexOf(t)||(n[e]=n[e]||[],n[e].push(t))}function Ke(e,t,n){if(n&&n[e]){const r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}class Je{constructor(e,t={}){L(this,t),this.type=e}}class Qe extends Je{constructor(e,t={}){super("error",L({error:e},t))}}class et{on(e,t){return this._listeners=this._listeners||{},Ye(e,t,this._listeners),this}off(e,t){return Ke(e,t,this._listeners),Ke(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Ye(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new Je(e,t||{}));const n=e.type;if(this.listens(n)){e.target=this;const t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of t)n.call(this,e);const r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of r)Ke(n,t,this._oneTimeListeners),t.call(this,e);const i=this._eventedParent;i&&(L(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof Qe&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var tt=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"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":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"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":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"requires":["fill-extrusion-edge-radius"],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"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"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function nt(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}function rt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function it(e){if(Array.isArray(e))return e.map(it);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const n in e)t[n]=it(e[n]);return t}return rt(e)}class ot extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}var at=ot;class st{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,n]of t)this.bindings[e]=n}concat(e){return new st(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}var lt=st;const ct={kind:"null"},ut={kind:"number"},ht={kind:"string"},dt={kind:"boolean"},pt={kind:"color"},ft={kind:"object"},mt={kind:"value"},gt={kind:"collator"},_t={kind:"formatted"},yt={kind:"resolvedImage"};function vt(e,t){return{kind:"array",itemType:e,N:t}}function xt(e){if("array"===e.kind){const t=xt(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const bt=[ct,ut,ht,dt,pt,_t,ft,vt(mt),yt];function wt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!wt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of bt)if(!wt(e,t))return null}return`Expected ${xt(e)} but found ${xt(t)} instead.`}function Et(e,t){return t.some((t=>t.kind===e.kind))}function Tt(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}var St,kt={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Mt(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ct(e){return Mt("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function At(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function It(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{St={}.parseCSSColor=function(e){var t,n=e.replace(/ /g,"").toLowerCase();if(n in kt)return kt[n].slice();if("#"===n[0])return 4===n.length?(t=parseInt(n.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===n.length&&(t=parseInt(n.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var r=n.indexOf("("),i=n.indexOf(")");if(-1!==r&&i+1===n.length){var o=n.substr(0,r),a=n.substr(r+1,i-(r+1)).split(","),s=1;switch(o){case"rgba":if(4!==a.length)return null;s=At(a.pop());case"rgb":return 3!==a.length?null:[Ct(a[0]),Ct(a[1]),Ct(a[2]),s];case"hsla":if(4!==a.length)return null;s=At(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,c=At(a[1]),u=At(a[2]),h=u<=.5?u*(c+1):u+c-u*c,d=2*u-h;return[Mt(255*It(d,h,l+1/3)),Mt(255*It(d,h,l)),Mt(255*It(d,h,l-1/3)),s];default:return null}}return null}}catch(e){}class zt{constructor(e,t,n,r=1){this.r=e,this.g=t,this.b=n,this.a=r}static parse(e){if(!e)return;if(e instanceof zt)return e;if("string"!=typeof e)return;const t=St(e);return t?new zt(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,n,r]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(n)},${r})`}toArray(){const{r:e,g:t,b:n,a:r}=this;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*n/r,r]}toArray01(){const{r:e,g:t,b:n,a:r}=this;return 0===r?[0,0,0,0]:[e/r,t/r,n/r,r]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:n,a:r}=this;return[e,t,n,r]}}zt.black=new zt(0,0,0,1),zt.white=new zt(1,1,1,1),zt.transparent=new zt(0,0,0,0),zt.red=new zt(1,0,0,1),zt.blue=new zt(0,0,1,1);var Pt=zt;class Lt{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dt{constructor(e,t,n,r,i){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i}}class Rt{constructor(e){this.sections=e}static fromString(e){return new Rt([new Dt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Rt?e:Rt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.name]);continue}e.push(t.text);const n={};t.fontStack&&(n["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(n["font-scale"]=t.scale),t.textColor&&(n["text-color"]=["rgba"].concat(t.textColor.toArray())),e.push(n)}return e}}class Ot{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ot({name:e,available:!1}):null}serialize(){return["image",this.name]}}function Bt(e,t,n,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,n,r]:[e,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ft(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Pt)return!0;if(e instanceof Lt)return!0;if(e instanceof Rt)return!0;if(e instanceof Ot)return!0;if(Array.isArray(e)){for(const t of e)if(!Ft(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Ft(e[t]))return!1;return!0}return!1}function Nt(e){if(null===e)return ct;if("string"==typeof e)return ht;if("boolean"==typeof e)return dt;if("number"==typeof e)return ut;if(e instanceof Pt)return pt;if(e instanceof Lt)return gt;if(e instanceof Rt)return _t;if(e instanceof Ot)return yt;if(Array.isArray(e)){const t=e.length;let n;for(const t of e){const e=Nt(t);if(n){if(n===e)continue;n=mt;break}n=e}return vt(n||mt,t)}return ft}function jt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Pt||e instanceof Rt||e instanceof Ot?e.toString():JSON.stringify(e)}class Ut{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ft(e[1]))return t.error("invalid value");const n=e[1];let r=Nt(n);const i=t.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new Ut(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Pt?["rgba"].concat(this.value.toArray()):this.value instanceof Rt?this.value.serialize():this.value}}var Vt=Ut,$t=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};const Gt={string:ht,number:ut,boolean:dt,object:ft};class Zt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n,r=1;const i=e[0];if("array"===i){let i,o;if(e.length>2){const n=e[1];if("string"!=typeof n||!(n in Gt)||"object"===n)return t.error('The item type argument of "array" must be one of string, number, boolean',1);i=Gt[n],r++}else i=mt;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}n=vt(i,o)}else n=Gt[i];const o=[];for(;re.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const n=e.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){t.push(n.kind);const r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map((e=>e.serialize())))}}var qt=Zt;class Wt{constructor(e){this.type=_t,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&"object"==typeof n)return t.error("First argument must be an image or text section.");const r=[];let i=!1;for(let n=1;n<=e.length-1;++n){const o=e[n];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,ut),!e))return null;let n=null;if(o["text-font"]&&(n=t.parse(o["text-font"],1,vt(ht)),!n))return null;let a=null;if(o["text-color"]&&(a=t.parse(o["text-color"],1,pt),!a))return null;const s=r[r.length-1];s.scale=e,s.font=n,s.textColor=a}else{const o=t.parse(e[n],1,mt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new Wt(r)}evaluate(e){return new Rt(this.sections.map((t=>{const n=t.content.evaluate(e);return Nt(n)===yt?new Dt("",n,null,null,null):new Dt(jt(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const n={};t.scale&&(n["font-scale"]=t.scale.serialize()),t.font&&(n["text-font"]=t.font.serialize()),t.textColor&&(n["text-color"]=t.textColor.serialize()),e.push(n)}return e}}class Ht{constructor(e){this.type=yt,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ht);return n?new Ht(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=Ot.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Xt={"to-boolean":dt,"to-color":pt,"to-number":ut,"to-string":ht};class Yt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(("to-boolean"===n||"to-string"===n)&&2!==e.length)return t.error("Expected one argument.");const r=Xt[n],i=[];for(let n=1;n4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Bt(t[0],t[1],t[2],t[3]),!n))return new Pt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new $t(n||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const n of this.args){if(t=n.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new $t(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Rt.fromString(jt(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Ot.fromString(jt(this.args[0].evaluate(e))):jt(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Wt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ht(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}var Kt=Yt;const Jt=["Unknown","Point","LineString","Polygon"];var Qt=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Jt[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:n,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Pt.parse(e)),t}};class en{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const n=e[0],r=en.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let s=null;for(const[r,o]of a){s=new Cn(t.registry,t.path,null,t.scope);const a=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(xt).join(", ")})`:`(${xt(t.type)}...)`;var t})).join(" | "),r=[];for(let n=1;n=t[2]||e[1]<=t[1]||e[3]>=t[3])}function sn(e,t){const n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=Math.pow(2,t.z);return[Math.round(n*i*rn),Math.round(r*i*rn)]}function ln(e,t,n){const r=e[0]-t[0],i=e[1]-t[1],o=e[0]-n[0],a=e[1]-n[1];return r*a-o*i==0&&r*o<=0&&i*a<=0}function cn(e,t){let n=!1;for(let a=0,s=t.length;a(r=e)[1]!=(o=s[t+1])[1]>r[1]&&r[0]<(o[0]-i[0])*(r[1]-i[1])/(o[1]-i[1])+i[0]&&(n=!n)}}var r,i,o;return n}function un(e,t){for(let n=0;n0&&s<0||a<0&&s>0}function dn(e,t,n){for(const c of n)for(let n=0;nn[2]){const t=.5*r;let i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;0===i&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}on(t,e)}function yn(e,t,n,r){const i=Math.pow(2,r.z)*rn,o=[r.x*rn,r.y*rn],a=[];if(!e)return a;for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];_n(r,t,n,i),a.push(r)}return a}function vn(e,t,n,r){const i=Math.pow(2,r.z)*rn,o=[r.x*rn,r.y*rn],a=[];if(!e)return a;for(const n of e){const e=[];for(const r of n){const n=[r.x+o[0],r.y+o[1]];on(t,n),e.push(n)}a.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const r of e)_n(r,t,n,i)}var s;return a}class xn{constructor(e,t){this.type=dt,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ft(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e{t&&!wn(e)&&(t=!1)})),t}function En(e){if(e instanceof tn&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!En(e)&&(t=!1)})),t}function Tn(e,t){if(e instanceof tn&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!Tn(e,t)&&(n=!1)})),n}class Sn{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new Sn(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var kn=Sn;class Mn{constructor(e,t=[],n,r=new lt,i=[]){this.registry=e,this.path=t,this.key=t.map((e=>`[${e}]`)).join(""),this.scope=r,this.errors=i,this.expectedType=n}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return"assert"===n?new qt(t,[e]):"coerce"===n?new Kt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,i=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==i.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||"coerce");else r=n(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Vt)&&"resolvedImage"!==r.type.kind&&An(r)){const t=new Qt;try{r=new Vt(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const r="number"==typeof e?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new Mn(this.registry,r,t||null,i,this.errors)}error(e,...t){const n=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new at(n,e))}checkSubtype(e,t){const n=wt(e,t);return n&&this.error(n),n}}var Cn=Mn;function An(e){if(e instanceof kn)return An(e.boundExpression);if(e instanceof tn&&"error"===e.name)return!1;if(e instanceof nn)return!1;if(e instanceof bn)return!1;const t=e instanceof Kt||e instanceof qt;let n=!0;return e.eachChild((e=>{n=t?n&&An(e):n&&e instanceof Vt})),!!n&&wn(e)&&Tn(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function In(e,t){const n=e.length-1;let r,i,o=0,a=n,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=e[s],i=e[s+1],r<=t){if(s===n||tt))throw new $t("Input is not a number.");a=s-1}return 0}class zn{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,ut);if(!n)return null;const r=[];let i=null;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);for(let n=1;n=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,i);if(!c)return null;i=i||c.type,r.push([o,c])}return new zn(i,n,r)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[In(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}var Pn=zn;function Ln(e,t,n){return e*(1-n)+t*n}var Dn=Object.freeze({__proto__:null,array:function(e,t,n){return e.map(((e,r)=>Ln(e,t[r],n)))},color:function(e,t,n){return new Pt(Ln(e.r,t.r,n),Ln(e.g,t.g,n),Ln(e.b,t.b,n),Ln(e.a,t.a,n))},number:Ln});const Rn=.95047,On=1.08883,Bn=4/29,Fn=6/29,Nn=3*Fn*Fn,jn=Fn*Fn*Fn,Un=Math.PI/180,Vn=180/Math.PI;function $n(e){return e>jn?Math.pow(e,1/3):e/Nn+Bn}function Gn(e){return e>Fn?e*e*e:Nn*(e-Bn)}function Zn(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function qn(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Wn(e){const t=qn(e.r),n=qn(e.g),r=qn(e.b),i=$n((.4124564*t+.3575761*n+.1804375*r)/Rn),o=$n((.2126729*t+.7151522*n+.072175*r)/1);return{l:116*o-16,a:500*(i-o),b:200*(o-$n((.0193339*t+.119192*n+.9503041*r)/On)),alpha:e.a}}function Hn(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*Gn(t),n=Rn*Gn(n),r=On*Gn(r),new Pt(Zn(3.2404542*n-1.5371385*t-.4985314*r),Zn(-.969266*n+1.8760108*t+.041556*r),Zn(.0556434*n-.2040259*t+1.0572252*r),e.alpha)}function Xn(e,t,n){const r=t-e;return e+n*(r>180||r<-180?r-360*Math.round(r/360):r)}const Yn={forward:Wn,reverse:Hn,interpolate:function(e,t,n){return{l:Ln(e.l,t.l,n),a:Ln(e.a,t.a,n),b:Ln(e.b,t.b,n),alpha:Ln(e.alpha,t.alpha,n)}}},Kn={forward:function(e){const{l:t,a:n,b:r}=Wn(e),i=Math.atan2(r,n)*Vn;return{h:i<0?i+360:i,c:Math.sqrt(n*n+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Un,n=e.c;return Hn({l:e.l,a:Math.cos(t)*n,b:Math.sin(t)*n,alpha:e.alpha})},interpolate:function(e,t,n){return{h:Xn(e.h,t.h,n),c:Ln(e.c,t.c,n),l:Ln(e.l,t.l,n),alpha:Ln(e.alpha,t.alpha,n)}}};var Jn=Object.freeze({__proto__:null,hcl:Kn,lab:Yn});class Qn{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,n,r){let i=0;if("exponential"===e.name)i=er(t,e.base,n,r);else if("linear"===e.name)i=er(t,1,n,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;i=new g(o[0],o[1],o[2],o[3]).solve(er(t,1,n,r))}return i}static parse(e,t){let[n,r,i,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(i=t.parse(i,2,ut),!i)return null;const a=[];let s=null;"interpolate-hcl"===n||"interpolate-lab"===n?s=pt:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e=n)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=t.parse(r,l,s);if(!c)return null;s=s||c.type,a.push([n,c])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Qn(s,n,r,i,a):t.error(`Type ${xt(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);const o=In(t,r),a=Qn.interpolationFactor(this.interpolation,r,t[o],t[o+1]),s=n[o].evaluate(e),l=n[o+1].evaluate(e);return"interpolate"===this.operator?Dn[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Kn.reverse(Kn.interpolate(Kn.forward(s),Kn.forward(l),a)):Yn.reverse(Yn.interpolate(Yn.forward(s),Yn.forward(l),a))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let e=0;ewt(r,e.type)));return new nr(o?mt:n,i)}evaluate(e){let t,n=null,r=0;for(const i of this.args){if(r++,n=i.evaluate(e),n&&n instanceof Ot&&!n.available&&(t||(t=n),n=null,r===this.args.length))return t;if(null!==n)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var rr=nr;class ir{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let r=1;r=n.length)throw new $t(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new $t(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var sr=ar;class lr{constructor(e,t){this.type=dt,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,mt),r=t.parse(e[2],2,mt);return n&&r?Et(n.type,[dt,ht,ut,ct,mt])?new lr(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(n.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(null==n)return!1;if(!Tt(t,["boolean","string","number","null"]))throw new $t(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Nt(t))} instead.`);if(!Tt(n,["string","array"]))throw new $t(`Expected second argument to be of type array or string, but found ${xt(Nt(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var cr=lr;class ur{constructor(e,t,n){this.type=ut,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,mt),r=t.parse(e[2],2,mt);if(!n||!r)return null;if(!Et(n.type,[dt,ht,ut,ct,mt]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(n.type)} instead`);if(4===e.length){const i=t.parse(e[3],3,ut);return i?new ur(n,r,i):null}return new ur(n,r)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Tt(t,["boolean","string","number","null"]))throw new $t(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Nt(t))} instead.`);if(!Tt(n,["string","array"]))throw new $t(`Expected second argument to be of type array or string, but found ${xt(Nt(n))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(e);return n.indexOf(t,r)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var hr=ur;class dr{constructor(e,t,n,r,i,o){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let n,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const i={},o=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,Nt(e)))return null}else n=Nt(e);if(void 0!==i[String(e)])return c.error("Branch labels must be unique.");i[String(e)]=o.length}const u=t.parse(l,a,r);if(!u)return null;r=r||u.type,o.push(u)}const a=t.parse(e[1],1,mt);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,r);return s?"value"!==a.type.kind&&t.concat(1).checkSubtype(n,a.type)?null:new dr(n,r,a,i,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(Nt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),n=[],r={};for(const e of t){const t=r[this.cases[e]];void 0===t?(r[this.cases[e]]=n.length,n.push([this.cases[e],[e]])):n[t][1].push(e)}const i=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,r]of n)e.push(1===r.length?i(r[0]):r.map(i)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}var pr=dr;class fr{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const r=[];for(let i=1;it.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var mr=fr;class gr{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,mt),r=t.parse(e[2],2,ut);if(!n||!r)return null;if(!Et(n.type,[vt(mt),ht,mt]))return t.error(`Expected first argument to be of type array or string, but found ${xt(n.type)} instead`);if(4===e.length){const i=t.parse(e[3],3,ut);return i?new gr(n.type,n,r,i):null}return new gr(n.type,n,r)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!Tt(t,["string","array"]))throw new $t(`Expected first argument to be of type array or string, but found ${xt(Nt(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(n,r)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var _r=gr;function yr(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function vr(e,t,n,r){return 0===r.compare(t,n)}function xr(e,t,n){const r="=="!==e&&"!="!==e;return class i{constructor(e,t,n){this.type=dt,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const n=e[0];let o=t.parse(e[1],1,mt);if(!o)return null;if(!yr(n,o.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${xt(o.type)}'.`);let a=t.parse(e[2],2,mt);if(!a)return null;if(!yr(n,a.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${xt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${xt(o.type)}' and '${xt(a.type)}'.`);r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new qt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new qt(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,gt),!s)return null}return new i(o,a,s)}evaluate(i){const o=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const t=Nt(o),n=Nt(a);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new $t(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Nt(o),n=Nt(a);if("string"!==e.kind||"string"!==n.kind)return t(i,o,a)}return this.collator?n(i,o,a,this.collator.evaluate(i)):t(i,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const br=xr("==",(function(e,t,n){return t===n}),vr),wr=xr("!=",(function(e,t,n){return t!==n}),(function(e,t,n,r){return!vr(0,t,n,r)})),Er=xr("<",(function(e,t,n){return t",(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),Sr=xr("<=",(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),kr=xr(">=",(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class Mr{constructor(e,t,n,r,i,o){this.type=ht,this.number=e,this.locale=t,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ut);if(!n)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=t.parse(r.locale,1,ht),!i))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,ht),!o))return null;let a=null;if(r.unit&&(a=t.parse(r.unit,1,ht),!a))return null;let s=null;if(r["min-fraction-digits"]&&(s=t.parse(r["min-fraction-digits"],1,ut),!s))return null;let l=null;return r["max-fraction-digits"]&&(l=t.parse(r["max-fraction-digits"],1,ut),!l)?null:new Mr(n,i,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Cr{constructor(e){this.type=ut,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?t.error(`Expected argument of type string or array, but found ${xt(n.type)} instead.`):new Cr(n):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new $t(`Expected value to be of type string or array, but found ${xt(Nt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Ar={"==":br,"!=":wr,">":Tr,"<":Er,">=":kr,"<=":Sr,array:qt,at:sr,boolean:qt,case:mr,coalesce:rr,collator:nn,format:Wt,image:Ht,in:cr,"index-of":hr,interpolate:tr,"interpolate-hcl":tr,"interpolate-lab":tr,length:Cr,let:or,literal:Vt,match:pr,number:qt,"number-format":Mr,object:qt,slice:_r,step:Pn,string:qt,"to-boolean":Kt,"to-color":Kt,"to-number":Kt,"to-string":Kt,var:kn,within:bn};function Ir(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);const o=i?i.evaluate(e):1,a=Bt(t,n,r,o);if(a)throw new $t(a);return new Pt(t/255*o,n/255*o,r/255*o,o)}function zr(e,t){return e in t}function Pr(e,t){const n=t[e];return void 0===n?null:n}function Lr(e){return{type:e}}tn.register(Ar,{error:[{kind:"error"},[ht],(e,[t])=>{throw new $t(t.evaluate(e))}],typeof:[ht,[mt],(e,[t])=>xt(Nt(t.evaluate(e)))],"to-rgba":[vt(ut,4),[pt],(e,[t])=>t.evaluate(e).toArray()],rgb:[pt,[ut,ut,ut],Ir],rgba:[pt,[ut,ut,ut,ut],Ir],has:{type:dt,overloads:[[[ht],(e,[t])=>zr(t.evaluate(e),e.properties())],[[ht,ft],(e,[t,n])=>zr(t.evaluate(e),n.evaluate(e))]]},get:{type:mt,overloads:[[[ht],(e,[t])=>Pr(t.evaluate(e),e.properties())],[[ht,ft],(e,[t,n])=>Pr(t.evaluate(e),n.evaluate(e))]]},"feature-state":[mt,[ht],(e,[t])=>Pr(t.evaluate(e),e.featureState||{})],properties:[ft,[],e=>e.properties()],"geometry-type":[ht,[],e=>e.geometryType()],id:[mt,[],e=>e.id()],zoom:[ut,[],e=>e.globals.zoom],pitch:[ut,[],e=>e.globals.pitch||0],"distance-from-center":[ut,[],e=>e.distanceFromCenter()],"heatmap-density":[ut,[],e=>e.globals.heatmapDensity||0],"line-progress":[ut,[],e=>e.globals.lineProgress||0],"sky-radial-progress":[ut,[],e=>e.globals.skyRadialProgress||0],accumulated:[mt,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ut,Lr(ut),(e,t)=>{let n=0;for(const r of t)n+=r.evaluate(e);return n}],"*":[ut,Lr(ut),(e,t)=>{let n=1;for(const r of t)n*=r.evaluate(e);return n}],"-":{type:ut,overloads:[[[ut,ut],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[ut],(e,[t])=>-t.evaluate(e)]]},"/":[ut,[ut,ut],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[ut,[ut,ut],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(e,[t,n])=>Math.pow(t.evaluate(e),n.evaluate(e))],sqrt:[ut,[ut],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[ut,[ut],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[ut,[ut],(e,[t])=>Math.log(t.evaluate(e))],log2:[ut,[ut],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[ut,[ut],(e,[t])=>Math.sin(t.evaluate(e))],cos:[ut,[ut],(e,[t])=>Math.cos(t.evaluate(e))],tan:[ut,[ut],(e,[t])=>Math.tan(t.evaluate(e))],asin:[ut,[ut],(e,[t])=>Math.asin(t.evaluate(e))],acos:[ut,[ut],(e,[t])=>Math.acos(t.evaluate(e))],atan:[ut,[ut],(e,[t])=>Math.atan(t.evaluate(e))],min:[ut,Lr(ut),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[ut,Lr(ut),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[ut,[ut],(e,[t])=>Math.abs(t.evaluate(e))],round:[ut,[ut],(e,[t])=>{const n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[ut,[ut],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[ut,[ut],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[dt,[ht,mt],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[dt,[mt],(e,[t])=>e.id()===t.value],"filter-type-==":[dt,[ht],(e,[t])=>e.geometryType()===t.value],"filter-<":[dt,[ht,mt],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r{const n=e.id(),r=t.value;return typeof n==typeof r&&n":[dt,[ht,mt],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[dt,[mt],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[dt,[ht,mt],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[dt,[mt],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[dt,[ht,mt],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[dt,[mt],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[dt,[mt],(e,[t])=>t.value in e.properties()],"filter-has-id":[dt,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[dt,[vt(ht)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[dt,[vt(mt)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[dt,[ht,vt(mt)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[dt,[ht,vt(mt)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){const i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[Lr(dt),(e,t)=>{for(const n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[Lr(dt),(e,t)=>{for(const n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[dt,[dt],(e,[t])=>!t.evaluate(e)],"is-supported-script":[dt,[ht],(e,[t])=>{const n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[ht,[ht],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ht,[ht],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ht,Lr(mt),(e,t)=>t.map((t=>jt(t.evaluate(e)))).join("")],"resolved-locale":[ht,[gt],(e,[t])=>t.evaluate(e).resolvedLocale()]});var Dr=Ar;function Rr(e){return{result:"success",value:e}}function Or(e){return{result:"error",value:e}}function Br(e){return"data-driven"===e["property-type"]}function Fr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Nr(e){return!!e.expression&&e.expression.interpolated}function jr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Ur(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Vr(e){return e}function $r(e,t){const n="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],i=r||!(r||void 0!==e.property),o=e.type||(Nr(t)?"exponential":"interval");if(n&&((e=nt({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],Pt.parse(e[1])]))),e.default=Pt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Jn[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let a,s,l;if("exponential"===o)a=Wr;else if("interval"===o)a=qr;else if("categorical"===o){a=Zr,s=Object.create(null);for(const t of e.stops)s[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=Hr}if(r){const n={},r=[];for(let t=0;te[0])),evaluate:({zoom:n},r)=>Wr({stops:i,base:e.base},t,n).evaluate(n,r)}}if(i){const n="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:n,interpolationFactor:tr.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>a(e,t,n,s,l)}}return{kind:"source",evaluate(n,r){const i=r&&r.properties?r.properties[e.property]:void 0;return void 0===i?Gr(e.default,t.default):a(e,t,i,s,l)}}}function Gr(e,t,n){return void 0!==e?e:void 0!==t?t:void 0!==n?n:void 0}function Zr(e,t,n,r,i){return Gr(typeof n===i?r[n]:void 0,e.default,t.default)}function qr(e,t,n){if("number"!==jr(n))return Gr(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];const i=In(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function Wr(e,t,n){const r=void 0!==e.base?e.base:1;if("number"!==jr(n))return Gr(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];const o=In(e.stops.map((e=>e[0])),n),a=function(e,t,n,r){const i=r-n,o=e-n;return 0===i?0:1===t?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}(n,r,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1];let c=Dn[t.type]||Vr;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Jn[e.colorSpace];c=(e,n)=>t.reverse(t.interpolate(t.forward(e),t.forward(n),a))}return"function"==typeof s.evaluate?{evaluate(...e){const t=s.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==n)return c(t,n,a)}}:c(s,l,a)}function Hr(e,t,n){return"color"===t.type?n=Pt.parse(n):"formatted"===t.type?n=Rt.fromString(n.toString()):"resolvedImage"===t.type?n=Ot.fromString(n.toString()):jr(n)===t.type||"enum"===t.type&&t.values[n]||(n=void 0),Gr(n,e.default,t.default)}class Xr{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Qt,this._defaultValue=t?function(e){return"color"===e.type&&(Ur(e.default)||Array.isArray(e.default))?new Pt(0,0,0,0):"color"===e.type?Pt.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,n,r,i,o,a,s){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=s||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,o,a,s){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=s||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new $t(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Yr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Dr}function Kr(e,t){const n=new Cn(Dr,[],t?function(e){const t={color:pt,string:ht,number:ut,enum:ht,boolean:dt,formatted:_t,resolvedImage:yt};return"array"===e.type?vt(t[e.value]||mt,e.length):t[e.type]}(t):void 0),r=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?Rr(new Xr(r,t)):Or(n.errors)}class Jr{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!En(t.expression)}evaluateWithoutErrorHandling(e,t,n,r,i,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,o)}evaluate(e,t,n,r,i,o){return this._styleExpression.evaluate(e,t,n,r,i,o)}}class Qr{constructor(e,t,n,r){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!En(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,n,r,i,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,o)}evaluate(e,t,n,r,i,o){return this._styleExpression.evaluate(e,t,n,r,i,o)}interpolationFactor(e,t,n){return this.interpolationType?tr.interpolationFactor(this.interpolationType,e,t,n):0}}function ei(e,t){if("error"===(e=Kr(e,t)).result)return e;const n=e.value.expression,r=wn(n);if(!r&&!Br(t))return Or([new at("","data expressions not supported")]);const i=Tn(n,["zoom","pitch","distance-from-center"]);if(!i&&!Fr(t))return Or([new at("","zoom expressions not supported")]);const o=ni(n);return o||i?o instanceof at?Or([o]):o instanceof tr&&!Nr(t)?Or([new at("",'"interpolate" expressions cannot be used with this property')]):Rr(o?new Qr(r?"camera":"composite",e.value,o.labels,o instanceof tr?o.interpolation:void 0):new Jr(r?"constant":"source",e.value)):Or([new at("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ti{constructor(e,t){this._parameters=e,this._specification=t,nt(this,$r(this._parameters,this._specification))}static deserialize(e){return new ti(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ni(e){let t=null;if(e instanceof or)t=ni(e.result);else if(e instanceof rr){for(const n of e.args)if(t=ni(n),t)break}else(e instanceof Pn||e instanceof tr)&&e.input instanceof tn&&"zoom"===e.input.name&&(t=e);return t instanceof at||e.eachChild((e=>{const n=ni(e);n instanceof at?t=n:!t&&n?t=new at("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&n&&t!==n&&(t=new at("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}class ri{constructor(e,t,n,r){this.message=(e?`${e}: `:"")+n,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function ii(e){const t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},o=e.style,a=e.styleSpec;let s=[];const l=jr(n);if("object"!==l)return[new ri(t,n,`object expected, ${l} found`)];for(const e in n){const l=e.split(".")[0];let c;i[l]?c=i[l]:r[l]?c=Fi:i["*"]?c=i["*"]:r["*"]&&(c=Fi),c?s=s.concat(c({key:(t?`${t}.`:t)+e,value:n[e],valueSpec:r[l]||r["*"],style:o,styleSpec:a,object:n,objectKey:e},n)):s.push(new ri(t,n[e],`unknown property "${e}"`))}for(const e in r)i[e]||r[e].required&&void 0===r[e].default&&void 0===n[e]&&s.push(new ri(t,n,`missing required property "${e}"`));return s}function oi(e){const t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,o=e.key,a=e.arrayElementValidator||Fi;if("array"!==jr(t))return[new ri(o,t,`array expected, ${jr(t)} found`)];if(n.length&&t.length!==n.length)return[new ri(o,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.lengthi)return[new ri(t,n,`${n} is greater than the maximum value ${i}`)]}return[]}function si(e){const t=e.valueSpec,n=rt(e.value.type);let r,i,o,a={};const s="categorical"!==n&&void 0===e.value.property,l=!s,c="array"===jr(e.value.stops)&&"array"===jr(e.value.stops[0])&&"object"===jr(e.value.stops[0][0]),u=ii({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===n)return[new ri(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(oi({key:e.key,value:r,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===jr(r)&&0===r.length&&t.push(new ri(e.key,r,"array must have at least one stop")),t},default:function(e){return Fi({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&s&&u.push(new ri(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||u.push(new ri(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!Nr(e.valueSpec)&&u.push(new ri(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Br(e.valueSpec)?u.push(new ri(e.key,e.value,"property functions not supported")):s&&!Fr(e.valueSpec)&&u.push(new ri(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==e.value.property||u.push(new ri(e.key,e.value,'"property" property is required')),u;function h(e){let n=[];const r=e.value,s=e.key;if("array"!==jr(r))return[new ri(s,r,`array expected, ${jr(r)} found`)];if(2!==r.length)return[new ri(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==jr(r[0]))return[new ri(s,r,`object expected, ${jr(r[0])} found`)];if(void 0===r[0].zoom)return[new ri(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new ri(s,r,"object stop key must have value")];const t=rt(r[0].zoom);if("number"!=typeof t)return[new ri(s,r[0].zoom,"stop zoom values must be numbers")];if(o&&o>t)return[new ri(s,r[0].zoom,"stop zoom values must appear in ascending order")];t!==o&&(o=t,i=void 0,a={}),n=n.concat(ii({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:ai,value:d}}))}else n=n.concat(d({key:`${s}[0]`,value:r[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},r));return Yr(it(r[1]))?n.concat([new ri(`${s}[1]`,r[1],"expressions are not allowed in function stops.")]):n.concat(Fi({key:`${s}[1]`,value:r[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const s=jr(e.value),l=rt(e.value),c=null!==e.value?e.value:o;if(r){if(s!==r)return[new ri(e.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new ri(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let r=`number expected, ${s} found`;return Br(t)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ri(e.key,c,r)]}return"categorical"!==n||"number"!==s||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&"number"==typeof l&&"number"==typeof i&&void 0!==i&&lnew ri(`${e.key}${t.key}`,e.value,t.message)));const n=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!n.outputDefined())return[new ri(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!En(n))return[new ri(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return ci(n,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Tn(n,["zoom","feature-state"]))return[new ri(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!wn(n))return[new ri(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ci(e,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const e of t.valueSpec.expression.parameters)n.delete(e);if(0===n.size)return[];const r=[];return e instanceof tn&&n.has(e.name)?[new ri(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(e.eachChild((e=>{r.push(...ci(e,t))})),r)}function ui(e){const t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?-1===r.values.indexOf(rt(n))&&i.push(new ri(t,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(rt(n))&&i.push(new ri(t,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),i}function hi(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!hi(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function di(e,t="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};hi(e)||(e=vi(e));const n=e;let r=!0;try{r=function(e){if(!mi(e))return e;let t=it(e);return fi(t),t=pi(t),t}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(n,null,2)}\n `)}const i=tt[`filter_${t}`],o=Kr(r,i);let a=null;if("error"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a=(e,t,n)=>o.value.evaluate(e,t,{},n);let s=null,l=null;if(r!==n){const e=Kr(n,i);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(t,n,r,i,o)=>e.value.evaluate(t,n,{},r,void 0,void 0,i,o),l=!wn(e.value.expression)}return{filter:a,dynamicFilter:s||void 0,needGeometry:yi(r),needFeature:!!l}}function pi(e){if(!Array.isArray(e))return e;const t=function(e){if(gi.has(e[0]))for(let t=1;tpi(e)))}function fi(e){let t=!1;const n=[];if("case"===e[0]){for(let r=1;r",">=","<","<=","to-boolean"]);function _i(e,t){return et?1:0}function yi(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?xi(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(vi))):"all"===t?["all"].concat(e.slice(1).map(vi)):"none"===t?["all"].concat(e.slice(1).map(vi).map(Ei)):"in"===t?bi(e[1],e.slice(2)):"!in"===t?Ei(bi(e[1],e.slice(2))):"has"===t?wi(e[1]):"!has"===t?Ei(wi(e[1])):"within"!==t||e;var n}function xi(e,t,n){switch(e){case"$type":return[`filter-type-${n}`,t];case"$id":return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function bi(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(_i)]]:["filter-in-small",e,["literal",t]]}}function wi(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Ei(e){return["!",e]}function Ti(e){return hi(it(e.value))?li(nt({},e,{expressionContext:"filter",valueSpec:e.styleSpec[`filter_${e.layerType||"fill"}`]})):Si(e)}function Si(e){const t=e.value,n=e.key;if("array"!==jr(t))return[new ri(n,t,`array expected, ${jr(t)} found`)];const r=e.styleSpec;let i,o=[];if(t.length<1)return[new ri(n,t,"filter array must have at least 1 element")];switch(o=o.concat(ui({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),rt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===rt(t[1])&&o.push(new ri(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new ri(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(i=jr(t[1]),"string"!==i&&o.push(new ri(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let a=2;a{e in n&&t.push(new ri(r,n[e],`"${e}" is prohibited for ref layers`))})),i.layers.forEach((t=>{rt(t.id)===s&&(e=t)})),e?e.ref?t.push(new ri(r,n.ref,"ref cannot reference another ref layer")):a=rt(e.type):"string"==typeof s&&t.push(new ri(r,n.ref,`ref layer "${s}" not found`))}else if("background"!==a&&"sky"!==a)if(n.source){const e=i.sources&&i.sources[n.source],o=e&&rt(e.type);e?"vector"===o&&"raster"===a?t.push(new ri(r,n.source,`layer "${n.id}" requires a raster source`)):"raster"===o&&"raster"!==a?t.push(new ri(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==o||n["source-layer"]?"raster-dem"===o&&"hillshade"!==a?t.push(new ri(r,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!n.paint||!n.paint["line-gradient"]&&!n.paint["line-trim-offset"]||"geojson"===o&&e.lineMetrics||t.push(new ri(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ri(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new ri(r,n.source,`source "${n.source}" not found`))}else t.push(new ri(r,n,'missing required property "source"'));return t=t.concat(ii({key:r,value:n,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Fi({key:`${r}.type`,value:n.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,object:n,objectKey:"type"}),filter:e=>Ti(nt({layerType:a},e)),layout:e=>ii({layer:n,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Ci(nt({layerType:a},e))}}),paint:e=>ii({layer:n,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Mi(nt({layerType:a},e))}})}})),t}function Ii(e){const t=e.value,n=e.key,r=jr(t);return"string"!==r?[new ri(n,t,`string expected, ${r} found`)]:[]}const zi={promoteId:function({key:e,value:t}){if("string"===jr(t))return Ii({key:e,value:t});{const n=[];for(const r in t)n.push(...Ii({key:`${e}.${r}`,value:t[r]}));return n}}};function Pi(e){const t=e.value,n=e.key,r=e.styleSpec,i=e.style;if(!t.type)return[new ri(n,t,'"type" is required')];const o=rt(t.type);let a;switch(o){case"vector":case"raster":case"raster-dem":return a=ii({key:n,value:t,valueSpec:r[`source_${o.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:zi}),a;case"geojson":if(a=ii({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,objectElementValidators:zi}),t.cluster)for(const e in t.clusterProperties){const[r,i]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(...li({key:`${n}.${e}.map`,value:i,expressionContext:"cluster-map"})),a.push(...li({key:`${n}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return ii({key:n,value:t,valueSpec:r.source_video,style:i,styleSpec:r});case"image":return ii({key:n,value:t,valueSpec:r.source_image,style:i,styleSpec:r});case"canvas":return[new ri(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ui({key:`${n}.type`,value:t.type,valueSpec:{values:Li(r)},style:i,styleSpec:r})}}function Li(e){return e.source.reduce(((t,n)=>{const r=e[n];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values))),t}),[])}function Di(e){const t=e.value,n=e.styleSpec,r=n.light,i=e.style;let o=[];const a=jr(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new ri("light",t,`object expected, ${a} found`)]),o;for(const e in t){const a=e.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?Fi({key:e,value:t[e],valueSpec:n.transition,style:i,styleSpec:n}):r[e]?Fi({key:e,value:t[e],valueSpec:r[e],style:i,styleSpec:n}):[new ri(e,t[e],`unknown property "${e}"`)])}return o}function Ri(e){const t=e.value,n=e.key,r=e.style,i=e.styleSpec,o=i.terrain;let a=[];const s=jr(t);if(void 0===t)return a;if("object"!==s)return a=a.concat([new ri("terrain",t,`object expected, ${s} found`)]),a;for(const e in t){const n=e.match(/^(.*)-transition$/);a=a.concat(n&&o[n[1]]&&o[n[1]].transition?Fi({key:e,value:t[e],valueSpec:i.transition,style:r,styleSpec:i}):o[e]?Fi({key:e,value:t[e],valueSpec:o[e],style:r,styleSpec:i}):[new ri(e,t[e],`unknown property "${e}"`)])}if(t.source){const e=r.sources&&r.sources[t.source],i=e&&rt(e.type);e?"raster-dem"!==i&&a.push(new ri(n,t.source,`terrain cannot be used with a source of type ${String(i)}, it only be used with a "raster-dem" source type`)):a.push(new ri(n,t.source,`source "${t.source}" not found`))}else a.push(new ri(n,t,'terrain is missing required property "source"'));return a}function Oi(e){const t=e.value,n=e.style,r=e.styleSpec,i=r.fog;let o=[];const a=jr(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new ri("fog",t,`object expected, ${a} found`)]),o;for(const e in t){const a=e.match(/^(.*)-transition$/);o=o.concat(a&&i[a[1]]&&i[a[1]].transition?Fi({key:e,value:t[e],valueSpec:r.transition,style:n,styleSpec:r}):i[e]?Fi({key:e,value:t[e],valueSpec:i[e],style:n,styleSpec:r}):[new ri(e,t[e],`unknown property "${e}"`)])}return o}const Bi={"*":()=>[],array:oi,boolean:function(e){const t=e.value,n=e.key,r=jr(t);return"boolean"!==r?[new ri(n,t,`boolean expected, ${r} found`)]:[]},number:ai,color:function(e){const t=e.key,n=e.value,r=jr(n);return"string"!==r?[new ri(t,n,`color expected, ${r} found`)]:null===St(n)?[new ri(t,n,`color expected, "${n}" found`)]:[]},enum:ui,filter:Ti,function:si,layer:Ai,object:ii,source:Pi,light:Di,terrain:Ri,fog:Oi,string:Ii,formatted:function(e){return 0===Ii(e).length?[]:li(e)},resolvedImage:function(e){return 0===Ii(e).length?[]:li(e)},projection:function(e){const t=e.value,n=e.styleSpec,r=n.projection,i=e.style;let o=[];const a=jr(t);if("object"===a)for(const e in t)o=o.concat(Fi({key:e,value:t[e],valueSpec:r[e],style:i,styleSpec:n}));else"string"!==a&&(o=o.concat([new ri("projection",t,`object or string expected, ${a} found`)]));return o}};function Fi(e){const t=e.value,n=e.valueSpec,r=e.styleSpec;return n.expression&&Ur(rt(t))?si(e):n.expression&&Yr(it(t))?li(e):n.type&&Bi[n.type]?Bi[n.type](e):ii(nt({},e,{valueSpec:n.type?r[n.type]:n}))}function Ni(e){const t=e.value,n=e.key,r=Ii(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new ri(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new ri(n,t,'"glyphs" url must include a "{range}" token'))),r}function ji(e,t=tt){return $i(Fi({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Ni,"*":()=>[]}}))}const Ui=e=>$i(Mi(e)),Vi=e=>$i(Ci(e));function $i(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function Gi(e,t){let n=!1;if(t&&t.length)for(const r of t)e.fire(new Qe(new Error(r.message))),n=!0;return n}var Zi=Wi,qi=3;function Wi(e,t,n){var r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(var o=0;o=u[p+0]&&r>=u[p+1])?(a[d]=!0,o.push(c[d])):a[d]=!1}}},Wi.prototype._forEachCell=function(e,t,n,r,i,o,a,s){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(n),h=this._convertToCellCoord(r),d=l;d<=u;d++)for(var p=c;p<=h;p++){var f=this.d*p+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(p),this._convertFromCellCoord(d+1),this._convertFromCellCoord(p+1)))&&i.call(this,e,t,n,r,f,o,a,s))return}},Wi.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},Wi.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},Wi.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=qi+this.cells.length+1+1,n=0,r=0;r=0||(i[t]=Qi(e[t],n)));e instanceof Error&&(i.message=e.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(i.$name=r),i}throw new Error("can't serialize object of type "+typeof e)}function eo(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Ki(e)||Ji(e)||ArrayBuffer.isView(e)||e instanceof t.ImageData)return e;if(Array.isArray(e))return e.map(eo);if("object"==typeof e){const t=e.$name||"Object",{klass:n}=Xi[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);const r=Object.create(n.prototype);for(const t of Object.keys(e))"$name"!==t&&(r[t]=eo(e[t]));return r}throw new Error("can't deserialize object of type "+typeof e)}const to={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function no(e){for(const t of e)if(oo(t.charCodeAt(0)))return!0;return!1}function ro(e){for(const t of e)if(!io(t.charCodeAt(0)))return!1;return!0}function io(e){return!(to.Arabic(e)||to["Arabic Supplement"](e)||to["Arabic Extended-A"](e)||to["Arabic Presentation Forms-A"](e)||to["Arabic Presentation Forms-B"](e))}function oo(e){return!(746!==e&&747!==e&&(e<4352||!(to["Bopomofo Extended"](e)||to.Bopomofo(e)||to["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||to["CJK Compatibility Ideographs"](e)||to["CJK Compatibility"](e)||to["CJK Radicals Supplement"](e)||to["CJK Strokes"](e)||!(!to["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||to["CJK Unified Ideographs Extension A"](e)||to["CJK Unified Ideographs"](e)||to["Enclosed CJK Letters and Months"](e)||to["Hangul Compatibility Jamo"](e)||to["Hangul Jamo Extended-A"](e)||to["Hangul Jamo Extended-B"](e)||to["Hangul Jamo"](e)||to["Hangul Syllables"](e)||to.Hiragana(e)||to["Ideographic Description Characters"](e)||to.Kanbun(e)||to["Kangxi Radicals"](e)||to["Katakana Phonetic Extensions"](e)||to.Katakana(e)&&12540!==e||!(!to["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!to["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||to["Unified Canadian Aboriginal Syllabics"](e)||to["Unified Canadian Aboriginal Syllabics Extended"](e)||to["Vertical Forms"](e)||to["Yijing Hexagram Symbols"](e)||to["Yi Syllables"](e)||to["Yi Radicals"](e))))}function ao(e){return!(oo(e)||function(e){return!!(to["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||to["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||to["Letterlike Symbols"](e)||to["Number Forms"](e)||to["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||to["Control Pictures"](e)&&9251!==e||to["Optical Character Recognition"](e)||to["Enclosed Alphanumerics"](e)||to["Geometric Shapes"](e)||to["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||to["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||to["CJK Symbols and Punctuation"](e)||to.Katakana(e)||to["Private Use Area"](e)||to["CJK Compatibility Forms"](e)||to["Small Form Variants"](e)||to["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function so(e){return e>=1424&&e<=2303||to["Arabic Presentation Forms-A"](e)||to["Arabic Presentation Forms-B"](e)}function lo(e,t){return!(!t&&so(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||to.Khmer(e))}function co(e){for(const t of e)if(so(t.charCodeAt(0)))return!0;return!1}const uo="deferred",ho="loading",po="loaded";let fo=null,mo="unavailable",go=null;const _o=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(mo="error"),fo&&fo(e)};function yo(){vo.fire(new Je("pluginStateChange",{pluginStatus:mo,pluginURL:go}))}const vo=new et,xo=function(){return mo},bo=function(){if(mo!==uo||!go)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");mo=ho,yo(),go&&pe({url:go},(e=>{e?_o(e):(mo=po,yo())}))},wo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>mo===po||null!=wo.applyArabicShaping,isLoading:()=>mo===ho,setState(e){mo=e.pluginStatus,go=e.pluginURL},isParsed:()=>null!=wo.applyArabicShaping&&null!=wo.processBidirectionalText&&null!=wo.processStyledBidirectionalText,getPluginURL:()=>go};class Eo{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(e){return function(e,t){for(const n of e)if(!lo(n.charCodeAt(0),t))return!1;return!0}(e,wo.isLoaded())}}class To{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Ur(e))return new ti(e,t);if(Yr(e)){const n=ei(e,t);if("error"===n.result)throw new Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return n.value}{let n=e;return"string"==typeof e&&"color"===t.type&&(n=Pt.parse(e)),{kind:"constant",evaluate:()=>n}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class So{constructor(e){this.property=e,this.value=new To(e,void 0)}transitioned(e,t){return new Mo(this.property,this.value,t,L({},e.transition,this.transition),e.now)}untransitioned(){return new Mo(this.property,this.value,null,{},0)}}class ko{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return $(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new So(this._values[e].property)),this._values[e].value=new To(this._values[e].property,null===t?void 0:$(t))}getTransition(e){return $(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new So(this._values[e].property)),this._values[e].transition=$(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);void 0!==n&&(e[t]=n);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const n=new Co(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){const e=new Co(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Mo{constructor(e,t,n,r,i){const o=r.delay||0,a=r.duration||0;i=i||0,this.property=e,this.value=t,this.begin=i+o,this.end=this.begin+a,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),o=this.prior;if(o){if(r>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(rthis.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function jo(e,t=1){let n=0,r=0;return{members:e.map((e=>{const i=Bo[e.type].BYTES_PER_ELEMENT,o=n=Uo(n,Math.max(t,i)),a=e.components||1;return r=Math.max(r,i),n+=i*a,{name:e.name,type:e.type,components:a,offset:o}})),size:Uo(n,Math.max(r,t)),alignment:t}}function Uo(e,t){return Math.ceil(e/t)*t}class Vo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}Vo.prototype.bytesPerElement=4,Yi(Vo,"StructArrayLayout2i4");class $o extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}$o.prototype.bytesPerElement=6,Yi($o,"StructArrayLayout3i6");class Go extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=n,this.int16[o+2]=r,this.int16[o+3]=i,e}}Go.prototype.bytesPerElement=8,Yi(Go,"StructArrayLayout4i8");class Zo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,r,i,o,a)}emplace(e,t,n,r,i,o,a,s){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=o,this.uint8[c+7]=a,this.float32[u+2]=s,e}}Zo.prototype.bytesPerElement=12,Yi(Zo,"StructArrayLayout2i4ub1f12");class qo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.float32[o+3]=i,e}}qo.prototype.bytesPerElement=16,Yi(qo,"StructArrayLayout4f16");class Wo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i)}emplace(e,t,n,r,i,o){const a=6*e,s=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=n,this.uint16[a+2]=r,this.uint16[a+3]=i,this.float32[s+2]=o,e}}Wo.prototype.bytesPerElement=12,Yi(Wo,"StructArrayLayout4ui1f12");class Ho extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=n,this.uint16[o+2]=r,this.uint16[o+3]=i,e}}Ho.prototype.bytesPerElement=8,Yi(Ho,"StructArrayLayout4ui8");class Xo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i,o)}emplace(e,t,n,r,i,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,e}}Xo.prototype.bytesPerElement=12,Yi(Xo,"StructArrayLayout6i12");class Yo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,n,r,i,o,a,s,l,c,u,h)}emplace(e,t,n,r,i,o,a,s,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}Yo.prototype.bytesPerElement=24,Yi(Yo,"StructArrayLayout4i4ui4i24");class Ko extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i,o)}emplace(e,t,n,r,i,o,a){const s=10*e,l=5*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.float32[l+2]=i,this.float32[l+3]=o,this.float32[l+4]=a,e}}Ko.prototype.bytesPerElement=20,Yi(Ko,"StructArrayLayout3i3f20");class Jo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Jo.prototype.bytesPerElement=4,Yi(Jo,"StructArrayLayout1ul4");class Qo extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o,a,s,l,c,u,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,r,i,o,a,s,l,c,u,h,d)}emplace(e,t,n,r,i,o,a,s,l,c,u,h,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=n,this.int16[f+2]=r,this.int16[f+3]=i,this.int16[f+4]=o,this.float32[m+3]=a,this.float32[m+4]=s,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=u,this.uint32[m+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}Qo.prototype.bytesPerElement=40,Yi(Qo,"StructArrayLayout5i4f1i1ul2ui40");class ea extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,r,i,o,a)}emplace(e,t,n,r,i,o,a,s){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=n,this.int16[l+2]=r,this.int16[l+4]=i,this.int16[l+5]=o,this.int16[l+6]=a,this.int16[l+7]=s,e}}ea.prototype.bytesPerElement=16,Yi(ea,"StructArrayLayout3i2i2i16");class ta extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i)}emplace(e,t,n,r,i,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.int16[s+6]=i,this.int16[s+7]=o,e}}ta.prototype.bytesPerElement=16,Yi(ta,"StructArrayLayout2f1f2i16");class na extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){const o=12*e,a=3*e;return this.uint8[o+0]=t,this.uint8[o+1]=n,this.float32[a+1]=r,this.float32[a+2]=i,e}}na.prototype.bytesPerElement=12,Yi(na,"StructArrayLayout2ub2f12");class ra extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}ra.prototype.bytesPerElement=12,Yi(ra,"StructArrayLayout3f12");class ia extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}ia.prototype.bytesPerElement=6,Yi(ia,"StructArrayLayout3ui6");class oa extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x)}emplace(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b){const w=30*e,E=15*e,T=60*e;return this.int16[w+0]=t,this.int16[w+1]=n,this.int16[w+2]=r,this.float32[E+2]=i,this.float32[E+3]=o,this.uint16[w+8]=a,this.uint16[w+9]=s,this.uint32[E+5]=l,this.uint32[E+6]=c,this.uint32[E+7]=u,this.uint16[w+16]=h,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[E+10]=f,this.float32[E+11]=m,this.uint8[T+48]=g,this.uint8[T+49]=_,this.uint8[T+50]=y,this.uint32[E+13]=v,this.int16[w+28]=x,this.uint8[T+58]=b,e}}oa.prototype.bytesPerElement=60,Yi(oa,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class aa extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,E,T,S,k,M,C,A){const I=this.length;return this.resize(I+1),this.emplace(I,e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,E,T,S,k,M,C,A)}emplace(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,E,T,S,k,M,C,A,I){const z=38*e,P=19*e;return this.int16[z+0]=t,this.int16[z+1]=n,this.int16[z+2]=r,this.float32[P+2]=i,this.float32[P+3]=o,this.int16[z+8]=a,this.int16[z+9]=s,this.int16[z+10]=l,this.int16[z+11]=c,this.int16[z+12]=u,this.int16[z+13]=h,this.uint16[z+14]=d,this.uint16[z+15]=p,this.uint16[z+16]=f,this.uint16[z+17]=m,this.uint16[z+18]=g,this.uint16[z+19]=_,this.uint16[z+20]=y,this.uint16[z+21]=v,this.uint16[z+22]=x,this.uint16[z+23]=b,this.uint16[z+24]=w,this.uint16[z+25]=E,this.uint16[z+26]=T,this.uint16[z+27]=S,this.uint16[z+28]=k,this.uint32[P+15]=M,this.float32[P+16]=C,this.float32[P+17]=A,this.float32[P+18]=I,e}}aa.prototype.bytesPerElement=76,Yi(aa,"StructArrayLayout3i2f6i15ui1ul3f76");class sa extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}sa.prototype.bytesPerElement=4,Yi(sa,"StructArrayLayout1f4");class la extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i)}emplace(e,t,n,r,i,o){const a=5*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,this.float32[a+4]=o,e}}la.prototype.bytesPerElement=20,Yi(la,"StructArrayLayout5f20");class ca extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=n,this.uint16[o+3]=r,this.uint16[o+4]=i,e}}ca.prototype.bytesPerElement=12,Yi(ca,"StructArrayLayout1ul3ui12");class ua extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}ua.prototype.bytesPerElement=4,Yi(ua,"StructArrayLayout2ui4");class ha extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ha.prototype.bytesPerElement=2,Yi(ha,"StructArrayLayout1ui2");class da extends No{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}da.prototype.bytesPerElement=8,Yi(da,"StructArrayLayout2f8");class pa extends Fo{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}pa.prototype.size=40;class fa extends Qo{get(e){return new pa(this,e)}}Yi(fa,"CollisionBoxArray");class ma extends Fo{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}ma.prototype.size=60;class ga extends oa{get(e){return new ma(this,e)}}Yi(ga,"PlacedSymbolArray");class _a extends Fo{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(e){this._structArray.uint32[this._pos4+15]=e}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}_a.prototype.size=76;class ya extends aa{get(e){return new _a(this,e)}}Yi(ya,"SymbolInstanceArray");class va extends sa{getoffsetX(e){return this.float32[1*e+0]}}Yi(va,"GlyphOffsetArray");class xa extends Vo{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Yi(xa,"SymbolLineVertexArray");class ba extends Fo{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}ba.prototype.size=12;class wa extends ca{get(e){return new ba(this,e)}}Yi(wa,"FeatureIndexArray");class Ea extends ua{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Yi(Ea,"FillExtrusionCentroidArray");const Ta=jo([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Sa=jo([{name:"a_dash",components:4,type:"Uint16"}]);var ka={exports:{}},Ma={exports:function(e,t){var n,r,i,o,a,s,l,c;for(r=e.length-(n=3&e.length),i=t,a=3432918353,s=461845907,c=0;c>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}},Ca={exports:function(e,t){for(var n,r=e.length,i=t^r,o=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:i^=(255&e.charCodeAt(o+2))<<16;case 2:i^=(255&e.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}},Aa=Ma.exports,Ia=Ca.exports;ka.exports=Aa,ka.exports.murmur3=Aa,ka.exports.murmur2=Ia;var za=p(ka.exports);class Pa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(La(e)),this.positions.push(t,n,r)}getPositions(e){const t=La(e);let n=0,r=this.ids.length-1;for(;n>1;this.ids[e]>=t?r=e:n=e+1}const i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){const n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Da(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){const t=new Pa;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function La(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:za(String(e))}function Da(e,t,n,r){for(;n>1];let o=n-1,a=r+1;for(;;){do{o++}while(e[o]i);if(o>=a)break;Ra(e,o,a),Ra(t,3*o,3*a),Ra(t,3*o+1,3*a+1),Ra(t,3*o+2,3*a+2)}a-n`u_${e}`)),this.type=n}setUniform(e,t,n,r,i){t.set(e,i,r.constantOr(this.value))}getBinding(e,t){return"color"===this.type?new Na(e):new Ba(e)}}class Za{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,n,r,i){const o="u_pattern"===i||"u_dash"===i?this.pattern:"u_pixel_ratio"===i?this.pixelRatio:null;o&&t.set(e,i,o)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new Fa(e):new Ba(e)}}class qa{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===n?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,n,r,i,o){const a=this.paintVertexArray.length,s=this.expression.evaluate(new Eo(0),t,{},i,r,o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,n,r,i){const o=this.expression.evaluate({zoom:0},n,r,void 0,i);this._setPaintValue(e,t,o)}_setPaintValue(e,t,n){if("color"===this.type){const r=$a(n);for(let n=e;n`u_${e}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===n?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,n,r,i,o){const a=this.expression.evaluate(new Eo(this.zoom),t,{},i,r,o),s=this.expression.evaluate(new Eo(this.zoom+1),t,{},i,r,o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,t,n,r,i){const o=this.expression.evaluate({zoom:this.zoom},n,r,void 0,i),a=this.expression.evaluate({zoom:this.zoom+1},n,r,void 0,i);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,n,r){if("color"===this.type){const i=$a(n),o=$a(r);for(let n=e;n!0)){this.binders={},this._buffers=[];const r=[];for(const i in e.paint._values){if(!n(i))continue;const o=e.paint.get(i);if(!(o instanceof Io&&Br(o.property.specification)))continue;const a=Ja(i,e.type),s=o.value,l=o.property.specification.type,c=!!o.property.useIntegerZoom,u="line-dasharray"===i||i.endsWith("pattern"),h="line-dasharray"===i&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==s.kind||h)if("source"===s.kind||h||u){const t=ts(i,l,"source");this.binders[i]=u?new Ha(s,a,l,t,e.id):new qa(s,a,l,t),r.push(`/a_${i}`)}else{const e=ts(i,l,"composite");this.binders[i]=new Wa(s,a,l,c,t,e),r.push(`/z_${i}`)}else this.binders[i]=u?new Za(s.value,a):new Ga(s.value,a,l),r.push(`/u_${i}`)}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof qa||t instanceof Wa?t.maxValue:0}populatePaintArrays(e,t,n,r,i,o){for(const a in this.binders){const s=this.binders[a];(s instanceof qa||s instanceof Wa||s instanceof Ha)&&s.populatePaintArray(e,t,n,r,i,o)}}setConstantPatternPositions(e){for(const t in this.binders){const n=this.binders[t];n instanceof Za&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,t,n,r,i,o){let a=!1;for(const s in e){const l=t.getPositions(s);for(const t of l){const l=n.feature(t.index);for(const n in this.binders){const c=this.binders[n];if((c instanceof qa||c instanceof Wa||c instanceof Ha)&&!0===c.expression.isStateDependent){const u=r.paint.get(n);c.expression=u.value,c.updatePaintArray(t.start,t.end,l,e[s],i,o),a=!0}}}}return a}defines(){const e=[];for(const t in this.binders){const n=this.binders[t];(n instanceof Ga||n instanceof Za)&&e.push(...n.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const n=this.binders[t];if(n instanceof qa||n instanceof Wa||n instanceof Ha)for(let t=0;t!0)){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new Xa(r,t,n);this.needsUpload=!1,this._featureMap=new Pa,this._bufferOffset=0}populatePaintArrays(e,t,n,r,i,o,a){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r,i,o,a);void 0!==t.id&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r,i){for(const o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,r,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Ka={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Ja(e,t){return Ka[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Qa={"line-pattern":{source:Wo,composite:Wo},"fill-pattern":{source:Wo,composite:Wo},"fill-extrusion-pattern":{source:Wo,composite:Wo},"line-dasharray":{source:Ho,composite:Ho}},es={color:{source:da,composite:qo},number:{source:sa,composite:da}};function ts(e,t,n){const r=Qa[e];return r&&r[n]||es[t][n]}Yi(Ga,"ConstantBinder"),Yi(Za,"PatternConstantBinder"),Yi(qa,"SourceExpressionBinder"),Yi(Ha,"PatternCompositeBinder"),Yi(Wa,"CompositeExpressionBinder"),Yi(Xa,"ProgramConfiguration",{omit:["_buffers"]}),Yi(Ya,"ProgramConfigurationSet");const ns="-transition";class rs extends et{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Ao(t.layout)),t.paint)){this._transitionablePaint=new ko(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new zo(t.paint)}}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,n={}){null!=t&&this._validate(Vi,`layers.${this.id}.layout.${e}`,e,t,n)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return j(e,ns)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(null!=t&&this._validate(Ui,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(j(e,ns))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const n=this._transitionablePaint._values[e],r=n.value.isDataDriven(),i=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const o=this._transitionablePaint._values[e].value,a=o.isDataDriven(),s=j(e,"pattern")||"line-dasharray"===e;return a||r||s||this._handleOverridablePaintPropertyUpdate(e,i,o)}}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getProgramConfiguration(e){return null}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),V(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,n,r,i={}){return(!i||!1!==i.validate)&&Gi(this,e.call(ji,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:tt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Io&&Br(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=di(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const is=jo([{name:"a_pos",components:2,type:"Int16"}],4),os=jo([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class as{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>as.MAX_VERTEX_ARRAY_LENGTH&&Z(`Max vertices per segment is ${as.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!i||i.vertexLength+e>as.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r)&&(i={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==r&&(i.sortKey=r),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new as([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}as.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Yi(as,"SegmentVector");var ss=8192;class ls{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Vl?new Vl(e.lng,e.lat):Vl.convert(e),this}setSouthWest(e){return this._sw=e instanceof Vl?new Vl(e.lng,e.lat):Vl.convert(e),this}extend(e){const t=this._sw,n=this._ne;let r,i;if(e instanceof Vl)r=e,i=e;else{if(!(e instanceof ls))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(ls.convert(e)):this.extend(Vl.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Vl.convert(e)):this;if(r=e._sw,i=e._ne,!r||!i)return this}return t||n?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),n.lng=Math.max(i.lng,n.lng),n.lat=Math.max(i.lat,n.lat)):(this._sw=new Vl(r.lng,r.lat),this._ne=new Vl(i.lng,i.lat)),this}getCenter(){return new Vl((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 Vl(this.getWest(),this.getNorth())}getSouthEast(){return new Vl(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:n}=Vl.convert(e);let r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&r}static convert(e){return!e||e instanceof ls?e:new ls(e)}}var cs=1e-6,us="undefined"!=typeof Float32Array?Float32Array:Array;function hs(){var e=new us(9);return us!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ds(e,t,n){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=n[0],p=n[1],f=n[2],m=n[3],g=n[4],_=n[5],y=n[6],v=n[7],x=n[8];return e[0]=d*r+p*a+f*c,e[1]=d*i+p*s+f*u,e[2]=d*o+p*l+f*h,e[3]=m*r+g*a+_*c,e[4]=m*i+g*s+_*u,e[5]=m*o+g*l+_*h,e[6]=y*r+v*a+x*c,e[7]=y*i+v*s+x*u,e[8]=y*o+v*l+x*h,e}function ps(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function fs(e,t){var n=t[0],r=t[1],i=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],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=n*s-r*a,v=n*l-i*a,x=n*c-o*a,b=r*l-i*s,w=r*c-o*s,E=i*c-o*l,T=u*m-h*f,S=u*g-d*f,k=u*_-p*f,M=h*g-d*m,C=h*_-p*m,A=d*_-p*g,I=y*A-v*C+x*M+b*k-w*S+E*T;return I?(e[0]=(s*A-l*C+c*M)*(I=1/I),e[1]=(i*C-r*A-o*M)*I,e[2]=(m*E-g*w+_*b)*I,e[3]=(d*w-h*E-p*b)*I,e[4]=(l*k-a*A-c*S)*I,e[5]=(n*A-i*k+o*S)*I,e[6]=(g*x-f*E-_*v)*I,e[7]=(u*E-d*x+p*v)*I,e[8]=(a*C-s*k+c*T)*I,e[9]=(r*k-n*C-o*T)*I,e[10]=(f*w-m*x+_*y)*I,e[11]=(h*x-u*w-p*y)*I,e[12]=(s*S-a*M-l*T)*I,e[13]=(n*M-r*S+i*T)*I,e[14]=(m*v-f*b-g*y)*I,e[15]=(u*b-h*v+d*y)*I,e):null}function ms(e,t,n){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=n[0],x=n[1],b=n[2],w=n[3];return e[0]=v*r+x*s+b*h+w*m,e[1]=v*i+x*l+b*d+w*g,e[2]=v*o+x*c+b*p+w*_,e[3]=v*a+x*u+b*f+w*y,e[4]=(v=n[4])*r+(x=n[5])*s+(b=n[6])*h+(w=n[7])*m,e[5]=v*i+x*l+b*d+w*g,e[6]=v*o+x*c+b*p+w*_,e[7]=v*a+x*u+b*f+w*y,e[8]=(v=n[8])*r+(x=n[9])*s+(b=n[10])*h+(w=n[11])*m,e[9]=v*i+x*l+b*d+w*g,e[10]=v*o+x*c+b*p+w*_,e[11]=v*a+x*u+b*f+w*y,e[12]=(v=n[12])*r+(x=n[13])*s+(b=n[14])*h+(w=n[15])*m,e[13]=v*i+x*l+b*d+w*g,e[14]=v*o+x*c+b*p+w*_,e[15]=v*a+x*u+b*f+w*y,e}function gs(e,t,n){var r,i,o,a,s,l,c,u,h,d,p,f,m=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+t[15]):(i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+s*g+h*_+t[12],e[13]=i*m+l*g+d*_+t[13],e[14]=o*m+c*g+p*_+t[14],e[15]=a*m+u*g+f*_+t[15]),e}function _s(e,t,n){var r=n[0],i=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ys(e,t,n){var r=Math.sin(n),i=Math.cos(n),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+c*r,e[5]=a*i+u*r,e[6]=s*i+h*r,e[7]=l*i+d*r,e[8]=c*i-o*r,e[9]=u*i-a*r,e[10]=h*i-s*r,e[11]=d*i-l*r,e}function vs(e,t,n){var r=Math.sin(n),i=Math.cos(n),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-c*r,e[1]=a*i-u*r,e[2]=s*i-h*r,e[3]=l*i-d*r,e[8]=o*r+c*i,e[9]=a*r+u*i,e[10]=s*r+h*i,e[11]=l*r+d*i,e}function xs(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function bs(e,t,n){var r,i,o,a=n[0],s=n[1],l=n[2],c=Math.hypot(a,s,l);return c0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Rs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Os(e,t,n){var r=t[0],i=t[1],o=t[2],a=n[0],s=n[1],l=n[2];return e[0]=i*l-o*s,e[1]=o*a-r*l,e[2]=r*s-i*a,e}function Bs(e,t,n){var r=t[0],i=t[1],o=t[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/(a=a||1),e[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,e[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,e}function Fs(e,t,n){var r=n[0],i=n[1],o=n[2],a=t[0],s=t[1],l=t[2],c=i*l-o*s,u=o*a-r*l,h=r*s-i*a,d=i*h-o*u,p=o*c-r*h,f=r*u-i*c,m=2*n[3];return u*=m,h*=m,p*=2,f*=2,e[0]=a+(c*=m)+(d*=2),e[1]=s+u+p,e[2]=l+h+f,e}var Ns,js=Cs,Us=As,Vs=Ss;function $s(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Gs(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=n*a,e[1]=r*a,e[2]=i*a,e[3]=o*a,e}function Zs(e,t,n){var r=t[0],i=t[1],o=t[2],a=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,e[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,e[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,e[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,e}function qs(){var e=new us(4);return us!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ws(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Hs(e,t,n){n*=.5;var r=t[0],i=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);return e[0]=r*l+a*s,e[1]=i*l+o*s,e[2]=o*l-i*s,e[3]=a*l-r*s,e}function Xs(e,t,n){n*=.5;var r=t[0],i=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);return e[0]=r*l-o*s,e[1]=i*l+a*s,e[2]=o*l+r*s,e[3]=a*l-i*s,e}Es(),Ns=new us(4),us!=Float32Array&&(Ns[0]=0,Ns[1]=0,Ns[2]=0,Ns[3]=0);var Ys=Gs;Es(),ks(1,0,0),ks(0,1,0),qs(),qs(),hs();const Ks=jo([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Js}=Ks,Qs=jo([{name:"a_pos_3",components:3,type:"Int16"}]);var el=jo([{name:"a_pos",type:"Int16",components:2}]);class tl{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,n){const r=Rs(t,this.dir);if(Math.abs(r)<1e-6)return!1;const i=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/r;return n[0]=this.pos[0]+this.dir[0]*i,n[1]=this.pos[1]+this.dir[1]*i,n[2]=this.pos[2]+this.dir[2]*i,!0}closestPointOnSphere(e,t,n){if(function(e,t){var n=e[0],r=e[1],i=e[2],o=t[0],a=t[1],s=t[2];return Math.abs(n-o)<=cs*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=cs*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=cs*Math.max(1,Math.abs(i),Math.abs(s))}(this.pos,e)||0===t)return n[0]=n[1]=n[2]=0,!1;const[r,i,o]=this.dir,a=this.pos[0]-e[0],s=this.pos[1]-e[1],l=this.pos[2]-e[2],c=r*r+i*i+o*o,u=2*(a*r+s*i+l*o),h=u*u-4*c*(a*a+s*s+l*l-t*t);if(h<0){const e=Math.max(-u/2,0),c=a+r*e,h=s+i*e,d=l+o*e,p=Math.hypot(c,h,d);return n[0]=c*t/p,n[1]=h*t/p,n[2]=d*t/p,!1}{const e=(-u-Math.sqrt(h))/(2*c);if(e<0){const e=Math.hypot(a,s,l);return n[0]=a*t/e,n[1]=s*t/e,n[2]=l*t/e,!1}return n[0]=a+r*e,n[1]=s+i*e,n[2]=l+o*e,!0}}}class nl{constructor(e,t,n,r,i){this.TL=e,this.TR=t,this.BR=n,this.BL=r,this.horizon=i}static fromInvProjectionMatrix(e,t,n){const r=[-1,1,1],i=[1,1,1],o=[1,-1,1],a=[-1,-1,1],s=Bs(r,r,e),l=Bs(i,i,e),c=Bs(o,o,e),u=Bs(a,a,e);return new nl(s,l,c,u,t/n)}}class rl{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(e,t,n,r){const i=Math.pow(2,n),o=[[-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((n=>{const o=Zs([],n,e),a=1/o[3]/t*i;return function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}(o,o,[a,a,r?1/o[3]:a,a])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=Ds([],Os([],js([],o[e[0]],o[e[1]]),js([],o[e[2]],o[e[1]]))),n=-Rs(t,o[e[1]]);return t.concat(n)}));return new rl(o,a)}}class il{static fromPoints(e){const t=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const r of e)Is(t,t,r),zs(n,n,r);return new il(t,n)}static applyTransform(e,t){const n=e.getCorners();for(let e=0;e=0;if(0===o)return 0;o!==t.length&&(n=!1)}if(n)return 2;for(let t=0;t<3;t++){let n=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let i=0;ithis.max[t]-this.min[t])return 0}return 1}}const ol=5,al=6,sl=ss/Math.PI/2,ll=16383,cl=64,ul=[cl,32,16],hl=-sl,dl=sl,pl=[new il([hl,hl,hl],[dl,dl,dl]),new il([hl,hl,hl],[0,0,dl]),new il([0,hl,hl],[dl,0,dl]),new il([hl,0,hl],[0,dl,dl]),new il([0,0,hl],[dl,dl,dl])];function fl(e){return e*sl/Nl}function ml(e,t,n,r=!0){const i=Ps([],e._camera.position,e.worldSize),o=[t,n,1,1];Zs(o,o,e.pixelMatrixInverse),$s(o,o,1/o[3]);const a=Ds([],js([],o,i)),s=e.globeMatrix,l=[s[12],s[13],s[14]],c=js([],l,i),u=Ss(c),h=Ds([],c),d=e.worldSize/(2*Math.PI),p=Rs(h,a),f=Math.asin(d/u);if(f1?null:function(e,t,n,r){const i=Math.sin(n);return e*(Math.sin((1-r)*n)/i)+t*(Math.sin(r*n)/i)}(e.a[t],e.b[t],e.angle,C(n,0,1))+e.center[t]}function yl(e){if(e.z<=1)return pl[e.z+2*e.y+e.x];const t=Tl(El(e));return il.fromPoints(t)}function vl(e,t,n){return Ps(e,e,1-n),Ls(e,e,t,n)}function xl(e,t){const n=Ll(t.zoom);if(0===n)return yl(e);const r=El(e),i=Tl(r),o=Gl(r.getWest())*t.worldSize,a=Gl(r.getEast())*t.worldSize,s=Zl(r.getNorth())*t.worldSize,l=Zl(r.getSouth())*t.worldSize,c=[o,s,0],u=[a,s,0],h=[o,l,0],d=[a,l,0],p=fs([],t.globeMatrix);return Bs(c,c,p),Bs(u,u,p),Bs(h,h,p),Bs(d,d,p),i[0]=vl(i[0],h,n),i[1]=vl(i[1],d,n),i[2]=vl(i[2],u,n),i[3]=vl(i[3],c,n),il.fromPoints(i)}function bl(e,t,n){for(const r of e)Bs(r,r,t),Ps(r,r,n)}function wl(e,t,n){const r=t/e.worldSize,i=e.globeMatrix;if(n.z<=1){const e=yl(n).getCorners();return bl(e,i,r),il.fromPoints(e)}const o=El(n),a=Tl(o);bl(a,i,r);const s=Number.MAX_VALUE,l=[-s,-s,-s],c=[s,s,s];if(o.contains(e.center)){for(const e of a)Is(c,c,e),zs(l,l,e);l[2]=0;const t=e.point,n=[t.x*r,t.y*r,0];return Is(c,c,n),zs(l,l,n),new il(c,l)}const u=[i[12]*r,i[13]*r,i[14]*r],h=o.getCenter(),d=C(e.center.lat,-Yl,Yl),p=C(h.lat,-Yl,Yl),f=Gl(e.center.lng),m=Zl(d);let g=f-Gl(h.lng);const _=m-Zl(p);g>.5?g-=1:g<-.5&&(g+=1);let y=0;Math.abs(g)>Math.abs(_)?y=g>=0?1:3:(y=_>=0?0:2,Ls(u,u,[i[4]*r,i[5]*r,i[6]*r],-Math.sin(w(_>=0?o.getSouth():o.getNorth()))*sl));const v=a[y],x=a[(y+1)%4],b=new gl(v,x,u),E=[_l(b,0)||v[0],_l(b,1)||v[1],_l(b,2)||v[2]],T=Ll(e.zoom);if(T>0){const r=function({x:e,y:t,z:n},r,i,o,a){const s=1/(1<.5?d=-1:p<-.5&&(d=1),l=((l+d)*r-(o*=r))*i+o,c=((c+d)*r-o)*i+o,u=(u*r-(a*=r))*i+a,h=(h*r-a)*i+a,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(n,t,e._pixelsPerMercatorPixel,f,m);for(let e=0;eMath.PI/2*1.01}const Ol=w(85),Bl=Math.cos(Ol),Fl=Math.sin(Ol),Nl=6371008.8,jl=2*Math.PI*Nl;class Ul{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ul(I(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Nl*Math.acos(Math.min(i,1))}toBounds(e=0){const t=360*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return new ls(new Ul(this.lng-n,this.lat-t),new Ul(this.lng+n,this.lat+t))}toEcef(e){const t=fl(e);return kl(this.lat,this.lng,sl+t)}static convert(e){if(e instanceof Ul)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Ul(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Ul(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}var Vl=Ul;function $l(e){return jl*Math.cos(e*Math.PI/180)}function Gl(e){return(180+e)/360}function Zl(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ql(e,t){return e/$l(t)}function Wl(e){return 360*e-180}function Hl(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Xl(e,t){return e*$l(Hl(t))}const Yl=85.051129;function Kl(e){return 1/Math.cos(e*Math.PI/180)}class Jl{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){const n=Vl.convert(e);return new Jl(Gl(n.lng),Zl(n.lat),ql(t,n.lat))}toLngLat(){return new Vl(Wl(this.x),Hl(this.y))}toAltitude(){return Xl(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/jl*Kl(Hl(this.y))}}function Ql(e,t,n,r,i,o,a,s,l){const c=(t+r)/2,u=(n+i)/2,h=new v(c,u);s(h),function(e,t,n,r,i,o){const a=n-i,s=r-o;return Math.abs((r-t)*a-(n-e)*s)/Math.hypot(a,s)}(h.x,h.y,o.x,o.y,a.x,a.y)>=l?(Ql(e,t,n,c,u,o,h,s,l),Ql(e,c,u,r,i,h,a,s,l)):e.push(a)}function ec(e,t,n){let r=e[0],i=r.x,o=r.y;t(r);const a=[r];for(let s=1;se.x+1||re.y+1)&&Z("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function ac(e,t,n){const r=e.loadGeometry(),i=e.extent,o=ss/i;if(t&&n&&n.projection.isReprojectedInTileSpace){const o=1<{const n=Wl((t.x+e.x/i)/o),r=Hl((t.y+e.y/i)/o),u=c.project(n,r);e.x=(u.x*a-s)*i,e.y=(u.y*a-l)*i};for(let t=0;t=i||n.y<0||n.y>=i||(u(n),e.push(n));r[t]=e}}for(const e of r)for(const t of e)oc(t,o);return r}function sc(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?ac(e):[]}}function lc(e,t,n,r,i){e.emplaceBack(2*t+(r+1)/2,2*n+(i+1)/2)}function cc(e,t,n){const r=16384;e.emplaceBack(t.x,t.y,t.z,n[0]*r,n[1]*r,n[2]*r)}class uc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Vo,this.indexArray=new ia,this.segments=new as,this.programConfigurations=new Ya(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n,r){const i=this.layers[0],o=[];let a=null;"circle"===i.type&&(a=i.layout.get("circle-sort-key"));for(const{feature:t,id:i,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=sc(t,e);if(!this.layers[0]._featureFilter.filter(new Eo(this.zoom),c,n))continue;const u=a?a.evaluate(c,{},n):void 0,h={id:i,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:ac(t,n,r),patterns:{},sortKey:u};o.push(h)}a&&o.sort(((e,t)=>e.sortKey-t.sortKey));let s=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Xo,s=r.projection);for(const r of o){const{geometry:i,index:o,sourceLayerIndex:a}=r,l=e[o].feature;this.addFeature(r,i,o,t.availableImages,n,s),t.featureIndex.insert(l,i,o,a,this.index)}}update(e,t,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,is.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,os.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,n,r,i,o){for(const n of t)for(const t of n){const n=t.x,r=t.y;if(n<0||n>=ss||r<0||r>=ss)continue;if(o){const e=o.projectTilePoint(n,r,i),t=o.upVector(i,n,r),a=this.globeExtVertexArray;cc(a,e,t),cc(a,e,t),cc(a,e,t),cc(a,e,t)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),s=a.vertexLength;lc(this.layoutVertexArray,n,r,-1,-1),lc(this.layoutVertexArray,n,r,1,-1),lc(this.layoutVertexArray,n,r,1,1),lc(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+2,s+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},r,i)}}function hc(e,t){for(let n=0;n1){if(mc(e,t))return!0;for(let r=0;r1?n:n.sub(t)._mult(i)._add(t))}function vc(e,t){let n,r,i,o=!1;for(let a=0;at.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(o=!o)}return o}function xc(e,t){let n=!1;for(let r=0,i=e.length-1;rt.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function bc(e,t,n,r,i){for(const o of e)if(t<=o.x&&n<=o.y&&r>=o.x&&i>=o.y)return!0;const o=[new v(t,n),new v(t,i),new v(r,i),new v(r,n)];if(e.length>2)for(const t of o)if(xc(e,t))return!0;for(let t=0;ti.x&&t.x>i.x||e.yi.y&&t.y>i.y)return!1;const o=q(e,t,n[0]);return o!==q(e,t,n[1])||o!==q(e,t,n[2])||o!==q(e,t,n[3])}function Ec(e,t,n){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function Tc(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Sc(e,t,n,r,i){if(!t[0]&&!t[1])return e;const o=v.convert(t)._mult(i);"viewport"===n&&o._rotate(-r);const a=[];for(let t=0;t0){const e=n.projection.upVector(c,h.x,h.y);p.x+=e[0]*u*d,p.y+=e[1]*u*d,p.z+=e[2]*u*d}const f=o?h:Ic(p.x,p.y,p.z,r),m=o?e.tilespaceRays.map((e=>Lc(e,d))):e.queryGeometry.screenGeometry,g=Zs([],[p.x,p.y,p.z,1],r);if(!a&&o?l*=g[3]/n.cameraToCenterDistance:a&&!o&&(l*=n.cameraToCenterDistance/g[3]),o){const e=Hl((t.y/ss+c.y)/(1<e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,s=t.data;for(let l=0;l{t[e.evaluationKey]=o;const a=e.expression.evaluate(t);i.data[n+r+0]=Math.floor(255*a.r/a.a),i.data[n+r+1]=Math.floor(255*a.g/a.a),i.data[n+r+2]=Math.floor(255*a.b/a.a),i.data[n+r+3]=Math.floor(255*a.a)};if(e.clips)for(let t=0,i=0;t80*n){r=o=e[0],i=a=e[1];for(var f=n;fo&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-r,a-i))?32767/c:0}return Xc(d,p,n,r,i,c,0),p}function Wc(e,t,n,r,i){var o,a;if(i===_u(e,t,n,r)>0)for(o=t;o=t;o-=r)a=fu(o,e[o],e[o+1],a);return a&&lu(a,a.next)&&(mu(a),a=a.next),a}function Hc(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!lu(r,r.next)&&0!==su(r.prev,r,r.next))r=r.next;else{if(mu(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function Xc(e,t,n,r,i,o,a){if(e){!a&&o&&function(e,t,n,r){var i=e;do{0===i.z&&(i.z=ru(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,o,a,s,l,c=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;t0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(a>1)}(i)}(e,r,i,o);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,o?Kc(e,r,i,o):Yc(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),mu(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?Xc(e=Jc(Hc(e),t,n),t,n,r,i,o,2):2===a&&Qc(e,t,n,r,i,o):Xc(Hc(e),t,n,r,i,o,1);break}}}function Yc(e){var t=e.prev,n=e,r=e.next;if(su(t,n,r)>=0)return!1;for(var i=t.x,o=n.x,a=r.x,s=t.y,l=n.y,c=r.y,u=io?i>a?i:a:o>a?o:a,p=s>l?s>c?s:c:l>c?l:c,f=r.next;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&ou(i,s,o,l,a,c,f.x,f.y)&&su(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Kc(e,t,n,r){var i=e.prev,o=e,a=e.next;if(su(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,c=a.x,u=i.y,h=o.y,d=a.y,p=sl?s>c?s:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,_=ru(p,f,t,n,r),y=ru(m,g,t,n,r),v=e.prevZ,x=e.nextZ;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==i&&v!==a&&ou(s,u,l,h,c,d,v.x,v.y)&&su(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==i&&x!==a&&ou(s,u,l,h,c,d,x.x,x.y)&&su(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==i&&v!==a&&ou(s,u,l,h,c,d,v.x,v.y)&&su(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==i&&x!==a&&ou(s,u,l,h,c,d,x.x,x.y)&&su(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Jc(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;!lu(i,o)&&cu(i,r,r.next,o)&&du(i,o)&&du(o,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),mu(r),mu(r.next),r=e=o),r=r.next}while(r!==e);return Hc(r)}function Qc(e,t,n,r,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&au(a,s)){var l=pu(a,s);return a=Hc(a,a.next),l=Hc(l,l.next),Xc(a,t,n,r,i,o,0),void Xc(l,t,n,r,i,o,0)}s=s.next}a=a.next}while(a!==e)}function eu(e,t){return e.x-t.x}function tu(e,t){var n=function(e,t){var n,r=t,i=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>a&&(a=s,n=r.x=r.x&&r.x>=u&&i!==r.x&&ou(on.x||r.x===n.x&&nu(n,r)))&&(n=r,d=l)),r=r.next}while(r!==c);return n}(e,t);if(!n)return t;var r=pu(n,e);return Hc(r,r.next),Hc(n,n.next)}function nu(e,t){return su(e.prev,e,t.prev)<0&&su(t.next,e,e.next)<0}function ru(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function iu(e){var t=e,n=e;do{(t.x=(e-a)*(o-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(o-s)>=(i-a)*(r-s)}function au(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&cu(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(du(e,t)&&du(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(su(e.prev,e,t.prev)||su(e,t.prev,t))||lu(e,t)&&su(e.prev,e,e.next)>0&&su(t.prev,t,t.next)>0)}function su(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function lu(e,t){return e.x===t.x&&e.y===t.y}function cu(e,t,n,r){var i=hu(su(e,t,n)),o=hu(su(e,t,r)),a=hu(su(n,r,e)),s=hu(su(n,r,t));return i!==o&&a!==s||!(0!==i||!uu(e,n,t))||!(0!==o||!uu(e,r,t))||!(0!==a||!uu(n,e,r))||!(0!==s||!uu(n,t,r))}function uu(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function hu(e){return e>0?1:e<0?-1:0}function du(e,t){return su(e.prev,e,e.next)<0?su(e,t,e.next)>=0&&su(e,e.prev,t)>=0:su(e,t,e.prev)<0||su(e,e.next,t)<0}function pu(e,t){var n=new gu(e.i,e.x,e.y),r=new gu(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function fu(e,t,n,r){var i=new gu(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function mu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function gu(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _u(e,t,n,r){for(var i=0,o=t,a=n-r;o0&&n.holes.push(r+=e[i-1].length)}return n};var yu=p(Zc.exports);function vu(e,t,n,r,i){xu(e,t,n||0,r||e.length-1,i||wu)}function xu(e,t,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,a=t-n+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);xu(e,t,Math.max(n,Math.floor(t-a*l/o+c)),Math.min(r,Math.floor(t+(o-a)*l/o+c)),i)}var u=e[t],h=n,d=r;for(bu(e,n,t),i(e[r],u)>0&&bu(e,n,r);h0;)d--}0===i(e[n],u)?bu(e,n,d):bu(e,++d,r),d<=t&&(n=d+1),t<=d&&(r=d-1)}}function bu(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function wu(e,t){return et?1:0}function Eu(e,t){const n=e.length;if(n<=1)return[e];const r=[];let i,o;for(let t=0;t1)for(let e=0;ee.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Vo,this.indexArray=new ia,this.indexArray2=new ua,this.programConfigurations=new Ya(e.layers,e.zoom),this.segments=new as,this.segments2=new as,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}populate(e,t,n,r){this.hasPattern=Su("fill",this.layers,t);const i=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=sc(a,e);if(!this.layers[0]._featureFilter.filter(new Eo(this.zoom),u,n))continue;const h=i?i.evaluate(u,{},n,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:ac(a,n,r),patterns:{},sortKey:h};o.push(d)}i&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:i,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const e=ku("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,o,n,{},t.availableImages);t.featureIndex.insert(e[o].feature,i,o,a,this.index)}}update(e,t,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n,r)}addFeatures(e,t,n,r,i){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Gc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,r,i,o=[]){for(const e of Eu(t,500)){let t=0;for(const n of e)t+=n.length;const n=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),r=n.vertexLength,i=[],o=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&o.push(i.length/2);const n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),i.push(t[0].x),i.push(t[0].y);for(let e=1;e>3}if(i--,1===r||2===r)o+=e.readSVarint(),a+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new Ru(o,a));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},Bu.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,r=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;e.pos>3}if(r--,1===n||2===n)(i+=e.readSVarint())s&&(s=i),(o+=e.readSVarint())c&&(c=o);else if(7!==n)throw new Error("unknown command "+n)}return[a,l,s,c]},Bu.prototype.toGeoJSON=function(e,t,n){var r,i,o=this.extent*Math.pow(2,n),a=this.extent*e,s=this.extent*t,l=this.loadGeometry(),c=Bu.types[this.type];function u(e){for(var t=0;t>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(n))}Vu.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new ju(this._pbf,t,this.extent,this._keys,this._values)};var Gu=Uu;function Zu(e,t,n){if(3===e){var r=new Gu(n,n.readVarint()+n.pos);r.length&&(t[r.name]=r)}}var qu=Du.VectorTile=function(e,t){this.layers=e.readFields(Zu,{},t)},Wu=Du.VectorTileFeature=Ou;function Hu(e,t,n,r){const i=[],o=0===r?(e,t,n,r,i,o)=>{e.push(new v(o,n+(o-t)/(r-t)*(i-n)))}:(e,t,n,r,i,o)=>{e.push(new v(t+(o-n)/(i-n)*(r-t),o))};for(const a of e){const e=[];for(const i of a){if(i.length<=2)continue;const a=[];for(let e=0;et&&o(a,s,l,c,u,t):h>n?d=t&&o(a,s,l,c,u,t),d>n&&h<=n&&o(a,s,l,c,u,n)}let s=i[i.length-1];const l=0===r?s.x:s.y;l>=t&&l<=n&&a.push(s),a.length&&(s=a[a.length-1],a[0].x===s.x&&a[0].y===s.y||a.push(a[0]),e.push(a))}e.length&&i.push(e)}return i}Du.VectorTileLayer=Uu;const Xu=Wu.types,Yu=Math.pow(2,13);function Ku(e,t,n,r,i,o,a,s){e.emplaceBack((t<<1)+a,(n<<1)+o,(Math.floor(r*Yu)<<1)+i,Math.round(s))}function Ju(e,t,n){const r=16384;e.emplaceBack(t.x,t.y,t.z,n[0]*r,n[1]*r,n[2]*r)}class Qu{constructor(){this.acc=new v(0,0),this.polyCount=[]}startRing(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new v(e.x,e.y),this.max=new v(e.x,e.y))}append(e,t){this.currentPolyCount.edges++,this.acc._add(e);const n=this.min,r=this.max;e.xr.x&&(r.x=e.x),e.yr.y&&(r.y=e.y),((0===e.x||e.x===ss)&&e.x===t.x)!=((0===e.y||e.y===ss)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Ln(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>ss!=e.x>ss&&this.addBorderIntersection(1,Ln(t.y,e.y,(ss-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Ln(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>ss!=e.y>ss&&this.addBorderIntersection(3,Ln(t.x,e.x,(ss-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];tn[1]&&(n[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const n=0===e.x?0:1;this.addBorderIntersection(n,t.y),this.addBorderIntersection(n,e.y)}else{const n=0===e.y?2:3;this.addBorderIntersection(n,t.x),this.addBorderIntersection(n,e.x)}}centroid(){const e=this.polyCount.reduce(((e,t)=>e+t.edges),0);return 0!==e?this.acc.div(e)._round():new v(0,0)}span(){return new v(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0)}}class eh{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.layoutVertexArray=new Go,this.centroidVertexArray=new Ea,this.indexArray=new ia,this.programConfigurations=new Ya(e.layers,e.zoom),this.segments=new as,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.enableTerrain=e.enableTerrain}populate(e,t,n,r){this.features=[],this.hasPattern=Su("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){const t=Math.exp(Math.PI*(1-e.y/(1<=0;e--){const t=d[e];(0===t.length||(p=t[0]).every((e=>e.x<=0))||p.every((e=>e.x>=ss))||p.every((e=>e.y<=0))||p.every((e=>e.y>=ss)))&&d.splice(e,1)}var p;let f;if(c)f=lh(d,s,r);else{f=[];for(const e of d)f.push({polygon:e,bounds:s})}const m=h?this.edgeRadius:0;for(const{polygon:e,bounds:t}of f){let n=0,i=0;for(const t of e)h&&!t[0].equals(t[t.length-1])&&t.push(t[0]),i+=h?t.length-1:t.length;const o=this.segments.prepareSegment((h?5:4)*i,this.layoutVertexArray,this.indexArray);if(h){const t=[],i=[];n=o.vertexLength;for(const n of e){let a,s;n.length&&n!==e[0]&&i.push(t.length/2),a=n[1].sub(n[0])._perp()._unit();for(let e=1;e4&&oh(i[i.length-2],i[0],i[1]),p=m?nh(i[i.length-2],i[0],i[1],m):0;a=i[1].sub(i[0])._perp()._unit();let f=!0;for(let g=1,_=0;g0?1:0,T=y.dist(v);if(_+T>32768&&(_=0),m){s=x.sub(v)._perp()._unit();let e=rh(y,v,x,th(a,s),m);isNaN(e)&&(e=0);const t=v.sub(y)._unit();y=y.add(t.mult(p))._round(),v=v.add(t.mult(-e))._round(),p=e,a=s}const S=o.vertexLength,k=i.length>4&&oh(y,v,x);let M=ah(_,d,f);if(Ku(this.layoutVertexArray,y.x,y.y,w,E,0,0,M),Ku(this.layoutVertexArray,y.x,y.y,w,E,0,1,M),_+=T,M=ah(_,k,!f),d=k,Ku(this.layoutVertexArray,v.x,v.y,w,E,0,0,M),Ku(this.layoutVertexArray,v.x,v.y,w,E,0,1,M),o.vertexLength+=4,this.indexArray.emplaceBack(S+0,S+1,S+2),this.indexArray.emplaceBack(S+1,S+3,S+2),o.primitiveLength+=2,m){const r=n+(1===g?i.length-2:g-2),a=1===g?n:r+1;if(this.indexArray.emplaceBack(S+1,r,S+3),this.indexArray.emplaceBack(r,a,S+3),o.primitiveLength+=2,void 0===e&&(e=S),!ih(x,i[g],t)){const t=g===i.length-1?e:o.vertexLength;this.indexArray.emplaceBack(S+2,S+3,t),this.indexArray.emplaceBack(S+3,t+1,t),this.indexArray.emplaceBack(S+3,a,t+1),o.primitiveLength+=3}f=!f}if(c){const e=this.layoutVertexExtArray,t=l.projectTilePoint(y.x,y.y,r),n=l.projectTilePoint(v.x,v.y,r),i=l.upVector(r,y.x,y.y),o=l.upVector(r,v.x,v.y);Ju(e,t,i),Ju(e,t,i),Ju(e,n,o),Ju(e,n,o)}}h&&(n+=i.length-1)}}if(u&&u.polyCount.length>0){if(u.borders){u.vertexArrayOffset=this.centroidVertexArray.length;const e=u.borders,t=this.featuresOnBorder.push(u)-1;for(let n=0;n<4;n++)e[n][0]!==Number.MAX_VALUE&&this.borders[n].push(t)}this.encodeCentroid(u.borders?void 0:u.centroid(),u)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,o,r)}sortBorders(){for(let e=0;e<4;e++)this.borders[e].sort(((t,n)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[n].borders[e][0]))}encodeCentroid(e,t,n=!0){let r,i;if(e)if(0!==e.y){const n=t.span()._mult(this.tileToMeter);r=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(n.x/10)),i=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else r=Math.ceil(7*(e.x+450)),i=0;else r=0,i=+n;let o=n?this.centroidVertexArray.length:t.vertexArrayOffset;for(const e of t.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*e.edges+e.top);for(let t=0;tn[1].x&&t.x>n[1].x||e.yn[1].y&&t.y>n[1].y}function oh(e,t,n){if(e.x<0||e.x>=ss||t.x<0||t.x>=ss||n.x<0||n.x>=ss)return!1;const r=n.sub(t),i=r.perp(),o=e.sub(t);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&i.x*o.x+i.y*o.y<0}function ah(e,t,n){const r=t?2|e:-3&e;return n?1|r:-2&r}function sh(){const e=Math.PI/32,t=Math.tan(e),n=Nl;return n*Math.sqrt(1+2*t*t)-n}function lh(e,t,n){const r=1<{for(const n of e)a.push({polygon:n,bounds:t})},l=Math.ceil(Math.log2(n)),c=Math.ceil(Math.log2(r)),u=l-c,h=[];for(let e=0;e0?0:1);for(let e=0;et+1?p.push({polygons:d,bounds:e,depth:t+1}):s(d,e)}if(f.length){const e=[new v(0===n?u:r.x,1===n?u:r.y),a];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):s(f,e)}}return a}(e,t,Math.ceil((o-i)/11.25),Math.ceil((a-s)/11.25),1,((e,t,i)=>{if(0===e)return.5*(t+i);{const e=Hl((n.y+t/ss)/r);return(Zl(.5*(Hl((n.y+i/ss)/r)+e))*r-n.y)*ss}}))}Yi(eh,"FillExtrusionBucket",{omit:["layers","features"]}),Yi(Qu,"PartMetadata");const ch=new Ro({"fill-extrusion-edge-radius":new Po(tt["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var uh={paint:new Ro({"fill-extrusion-opacity":new Po(tt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Lo(tt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Po(tt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Po(tt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Lo(tt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Lo(tt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Lo(tt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Po(tt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Po(tt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Po(tt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-rounded-roof":new Po(tt["paint_fill-extrusion"]["fill-extrusion-rounded-roof"])}),layout:ch};function hh(e,t,n){var r=2*Math.PI*6378137/256/Math.pow(2,n);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class dh{constructor(e,t,n){this.z=e,this.x=t,this.y=n,this.key=mh(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const n=function(e,t,n){var r=hh(256*e,256*(t=Math.pow(2,n)-t-1),n),i=hh(256*(e+1),256*(t+1),n);return r[0]+","+r[1]+","+i[0]+","+i[1]}(this.x,this.y,this.z),r=function(e,t,n){let r,i="";for(let o=e;o>0;o--)r=1<this.canonical.z?new fh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new fh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return mh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return mh(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new fh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new fh(t,this.wrap,t,n,r),new fh(t,this.wrap,t,n+1,r),new fh(t,this.wrap,t,n,r+1),new fh(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ye.id)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Zo,this.layoutVertexArray2=new qo,this.indexArray=new ia,this.programConfigurations=new Ya(e.layers,e.zoom),this.segments=new as,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n,r){this.hasPattern=Su("line",this.layers,t);const i=this.layers[0].layout.get("line-sort-key"),o=[];for(const{feature:t,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=sc(t,e);if(!this.layers[0]._featureFilter.filter(new Eo(this.zoom),c,n))continue;const u=i?i.evaluate(c,{},n):void 0,h={id:a,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:ac(t,n,r),patterns:{},sortKey:u};o.push(h)}i&&o.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:a,featureIndex:s}=t,l=this.addConstantDashes(a);for(const r of o){const{geometry:i,index:o,sourceLayerIndex:c}=r;if(l&&this.addFeatureDashes(r,a),this.hasPattern){const e=ku("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,o,n,a.positions,t.availableImages);s.insert(e[o].feature,i,o,c,this.index)}}addConstantDashes(e){let t=!1;for(const n of this.layers){const r=n.paint.get("line-dasharray").value,i=n.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==i.kind)t=!0;else{const t=i.value,n=r.value;if(!n)continue;e.addDash(n,t)}}return t}addFeatureDashes(e,t){const n=this.zoom;for(const r of this.layers){const i=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===o.kind)continue;let a,s;if("constant"===i.kind){if(a=i.value,!a)continue}else a=i.evaluate({zoom:n},e);s="constant"===o.kind?o.value:o.evaluate({zoom:n},e),t.addDash(a,s),e.patterns[r.id]=t.getKey(a,s)}}update(e,t,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n,r)}addFeatures(e,t,n,r,i){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Eh)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,r,i,o){const a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap").evaluate(e,{}),c=a.get("line-miter-limit"),u=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const n of t)this.addLine(n,e,s,l,c,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,o,r)}addLine(e,t,n,r,i,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[s-1].equals(e[s-2]);)s--;let l=0;for(;l0;if(b&&t>l){const e=h.dist(d);if(e>2*c){const t=h.sub(h.sub(d)._mult(c/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,f,0,0,u),d=t}}const E=d&&p;let T=E?n:a?"butt":r;if(E&&"round"===T&&(vi&&(T="bevel"),"bevel"===T&&(v>2&&(T="flipbevel"),v100)g=m.mult(-1);else{const e=v*f.add(m).mag()/f.sub(m).mag();g._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(h,g,0,0,u),this.addCurrentVertex(h,g.mult(-1),0,0,u)}else if("bevel"===T||"fakeround"===T){const e=-Math.sqrt(v*v-1),t=w?e:0,n=w?0:e;if(d&&this.addCurrentVertex(h,f,t,n,u),"fakeround"===T){const e=Math.round(180*x/Math.PI/20);for(let t=1;t2*c){const t=h.add(p.sub(h)._mult(c/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,m,0,0,u),h=t}}}}addCurrentVertex(e,t,n,r,i,o=!1){const a=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,o,!1,n,i),this.addHalfVertex(e,a,s,o,!0,-r,i)}addHalfVertex({x:e,y:t},n,r,i,o,a,s){this.layoutVertexArray.emplaceBack((e<<1)+(i?1:0),(t<<1)+(o?1:0),Math.round(63*n)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),s.primitiveLength++),o?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}Yi(kh,"LineBucket",{omit:["layers","patternFeatures"]});const Mh=new Ro({"line-cap":new Lo(tt.layout_line["line-cap"]),"line-join":new Lo(tt.layout_line["line-join"]),"line-miter-limit":new Po(tt.layout_line["line-miter-limit"]),"line-round-limit":new Po(tt.layout_line["line-round-limit"]),"line-sort-key":new Lo(tt.layout_line["line-sort-key"])});var Ch={paint:new Ro({"line-opacity":new Lo(tt.paint_line["line-opacity"]),"line-color":new Lo(tt.paint_line["line-color"]),"line-translate":new Po(tt.paint_line["line-translate"]),"line-translate-anchor":new Po(tt.paint_line["line-translate-anchor"]),"line-width":new Lo(tt.paint_line["line-width"]),"line-gap-width":new Lo(tt.paint_line["line-gap-width"]),"line-offset":new Lo(tt.paint_line["line-offset"]),"line-blur":new Lo(tt.paint_line["line-blur"]),"line-dasharray":new Lo(tt.paint_line["line-dasharray"]),"line-pattern":new Lo(tt.paint_line["line-pattern"]),"line-gradient":new Do(tt.paint_line["line-gradient"]),"line-trim-offset":new Po(tt.paint_line["line-trim-offset"])}),layout:Mh};const Ah=new class extends Lo{possiblyEvaluate(e,t){return t=new Eo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=L({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}(Ch.paint.properties["line-width"].specification);function Ih(e,t){return t>0?t+2*e:e}Ah.useIntegerZoom=!0;const zh=jo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ph=jo([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Lh=jo([{name:"a_projected_pos",components:4,type:"Float32"}],4);jo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Dh=jo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Rh=jo([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);jo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Oh=jo([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Bh=jo([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);jo([{name:"triangle",components:3,type:"Uint16"}]),jo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),jo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),jo([{type:"Float32",name:"offsetX"}]),jo([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Fh=24;const Nh=128;function jh(e,t){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new Eo(e+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=n;let i=0;for(;i{e.text=function(e,t,n){const r=t.layout.get("text-transform").evaluate(n,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),wo.applyArabicShaping&&(e=wo.applyArabicShaping(e)),e}(e.text,t,n)})),e}const Zh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function qh(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function Wh(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}var Hh=Kh,Xh=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,u=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+e[t+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},Yh=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(t*l-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=f,s/=256,i-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*m};function Kh(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Kh.Varint=0,Kh.Fixed64=1,Kh.Bytes=2,Kh.Fixed32=5;var Jh=4294967296,Qh=1/Jh,ed="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function td(e){return e.type===Kh.Bytes?e.readVarint()+e.pos:e.pos+1}function nd(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function rd(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function id(e,t){for(var n=0;n>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function md(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}Kh.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos>3,o=this.pos;this.type=7&r,e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=pd(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=md(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=pd(this.buf,this.pos)+pd(this.buf,this.pos+4)*Jh;return this.pos+=8,e},readSFixed64:function(){var e=pd(this.buf,this.pos)+md(this.buf,this.pos+4)*Jh;return this.pos+=8,e},readFloat:function(){var e=Xh(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Xh(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,i,o=n.buf;if(r=(112&(i=o[n.pos++]))>>4,i<128)return nd(e,r,t);if(r|=(127&(i=o[n.pos++]))<<3,i<128)return nd(e,r,t);if(r|=(127&(i=o[n.pos++]))<<10,i<128)return nd(e,r,t);if(r|=(127&(i=o[n.pos++]))<<17,i<128)return nd(e,r,t);if(r|=(127&(i=o[n.pos++]))<<24,i<128)return nd(e,r,t);if(r|=(1&(i=o[n.pos++]))<<31,i<128)return nd(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ed?function(e,t,n){return ed.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var r="",i=t;i239?4:l>223?3:l>191?2:1;if(i+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[i+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=e[i+2],128==(192&(o=e[i+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=e[i+2],s=e[i+3],128==(192&(o=e[i+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Kh.Bytes)return e.push(this.readVarint(t));var n=td(this);for(e=e||[];this.pos127;);else if(t===Kh.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Kh.Fixed32)this.pos+=4;else{if(t!==Kh.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var r,i,o=0;o55295&&r<57344){if(!i){r>56319||o+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&rd(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Yh(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Yh(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n=128&&rd(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,Kh.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,id,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,od,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,ld,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,ad,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,sd,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,cd,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,ud,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hd,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,dd,t)},writeBytesField:function(e,t){this.writeTag(e,Kh.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Kh.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Kh.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Kh.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Kh.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Kh.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Kh.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Kh.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Kh.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Kh.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var gd=p(Hh);const _d=3;function yd(e,t,n){t.glyphs=[],1===e&&n.readMessage(vd,t)}function vd(e,t,n){if(3===e){const{id:e,bitmap:r,width:i,height:o,left:a,top:s,advance:l}=n.readMessage(xd,{});t.glyphs.push({id:e,bitmap:new Fc({width:i+2*_d,height:o+2*_d},r),metrics:{width:i,height:o,left:a,top:s,advance:l}})}else 4===e?t.ascender=n.readSVarint():5===e&&(t.descender=n.readSVarint())}function xd(e,t,n){1===e?t.id=n.readVarint():2===e?t.bitmap=n.readBytes():3===e?t.width=n.readVarint():4===e?t.height=n.readVarint():5===e?t.left=n.readSVarint():6===e?t.top=n.readSVarint():7===e&&(t.advance=n.readVarint())}const bd=_d;function wd(e){let t=0,n=0;for(const r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let i=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,o=Math.max(o,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){const t=r.pop();ee.hasImage(t))),e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[r,i]=e.tl;n.update(t.data,void 0,{x:r,y:i})}}Yi(Td,"ImagePosition"),Yi(Sd,"ImageAtlas");const kd={horizontal:1,vertical:2,horizontalOnly:3},Md=-17;class Cd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const n=new Cd;return n.scale=e||1,n.fontStack=t,n}static forImage(e){const t=new Cd;return t.imageName=e,t}}class Ad{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const n=new Ad;for(let r=0;r=0&&n>=e&&zd[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const n=new Ad;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Cd.forText(e.scale,e.fontStack||t));const n=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Id(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f){const m=Ad.fromFeature(e,i);h===kd.vertical&&m.verticalizePunctuation(d);let g=[];const _=function(e,t,n,r,i,o){if(!e)return[];const a=[],s=function(e,t,n,r,i,o){let a=0;for(let n=0;n=0;let c=0;for(let n=0;n0&&o>b&&(b=o)}else{const e=n[s.fontStack];if(!e)continue;e[m]&&(T=e[m]);const r=t[s.fontStack];if(!r)continue;const o=r.glyphs[m];if(!o)continue;if(v=o.metrics,k=8203!==m?Fh:0,g){const e=void 0!==r.ascender?Math.abs(r.ascender):0,t=void 0!==r.descender?Math.abs(r.descender):0,n=(e+t)*_;w-n/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;const l=[];let c=0;for(;sr;)c-=l.shift().angleDelta;if(c>i)return!1;a++,s+=t.dist(n)}return!0}function Gd(e){let t=0;for(let n=0;nc){const u=(c-l)/o,h=Ln(r.x,i.x,u),d=Ln(r.y,i.y,u),p=new Vd(h,d,0,i.angleTo(r),n);return!a||$d(e,p,s,a,t)?p:void 0}l+=o}}function Hd(e,t,n,r,i,o,a,s,l){const c=Zd(r,o,a),u=qd(r,i),h=u*a,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&_=0&&y=0&&d+c<=u){const n=new Vd(_,y,0,m,t);n._round(),r&&!$d(e,n,o,r,i)||p.push(n)}}h+=f}return s||p.length||a||(p=Xd(e,h/2,n,r,i,o,a,!0,l)),p}function Yd(e,t,n,r,i){const o=[];for(let a=0;a=r&&c.x>=r||(a.x>=r?a=new v(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x>=r&&(c=new v(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y>=i&&c.y>=i||(a.y>=i?a=new v(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i)._round():c.y>=i&&(c=new v(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i)._round()),l&&a.equals(l[l.length-1])||(l=[a],o.push(l)),l.push(c)))))}}return o}Yi(Vd,"Anchor");const Kd=1e20;function Jd(e,t,n,r,i,o,a,s,l){for(let c=t;c-1);l++,o[l]=s,a[l]=c,a[l+1]=Kd}for(let s=0,l=0;s{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let i=r.glyphs[t];if(void 0!==i)return void n(null,{stack:e,id:t,glyph:i});if(i=this._tinySDF(r,e,t),i)return r.glyphs[t]=i,void n(null,{stack:e,id:t,glyph:i});const o=Math.floor(t/256);if(256*o>65535)return void n(new Error("glyphs > 65535 not supported"));if(r.ranges[o])return void n(null,{stack:e,id:t,glyph:i});let a=r.requests[o];a||(a=r.requests[o]=[],np.loadGlyphRange(e,o,this.url,this.requestManager,((e,t)=>{if(t){r.ascender=t.ascender,r.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t.glyphs[+e]);r.ranges[o]=!0}for(const n of a)n(e,t);delete r.requests[o]}))),a.push(((r,i)=>{r?n(r):i&&n(null,{stack:e,id:t,glyph:i.glyphs[t]||null})}))}),((e,n)=>{if(e)t(e);else if(n){const e={};for(const{stack:t,id:r,glyph:i}of n)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[r]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==tp.none&&(this.localGlyphMode===tp.all?!!this.localFontFamily:!!this.localFontFamily&&(to["CJK Unified Ideographs"](e)||to["Hangul Syllables"](e)||to.Hiragana(e)||to.Katakana(e)||to["CJK Symbols and Punctuation"](e)))}_tinySDF(e,t,n){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(n))return;let i=e.tinySDF;if(!i){let n="400";/bold/i.test(t)?n="900":/medium/i.test(t)?n="500":/light/i.test(t)&&(n="200"),i=e.tinySDF=new np.TinySDF({fontFamily:r,fontWeight:n,fontSize:24*ep,buffer:3*ep,radius:8*ep}),i.fontWeight=n}if(this.localGlyphs[i.fontWeight][n])return this.localGlyphs[i.fontWeight][n];const o=String.fromCharCode(n),{data:a,width:s,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:d,glyphAdvance:p}=i.draw(o);return this.localGlyphs[i.fontWeight][n]={id:n,bitmap:new Fc({width:s,height:l},a),metrics:{width:c/ep,height:u/ep,left:h/ep,top:d/ep-27,advance:p/ep,localGlyph:!0}}}}np.loadGlyphRange=function(e,t,n,r,i){const o=256*t,a=o+255,s=r.transformRequest(r.normalizeGlyphsURL(n).replace("{fontstack}",e).replace("{range}",`${o}-${a}`),ce.Glyphs);pe(s,((e,t)=>{if(e)i(e);else if(t){const e={},n=function(e){return new gd(e).readFields(yd,{})}(t);for(const t of n.glyphs)e[t.id]=t;i(null,{glyphs:e,ascender:n.ascender,descender:n.descender})}}))},np.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=n;const s=this.size=e+4*t,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${e}px ${i}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(n),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-i))),l=Math.min(this.size-this.buffer,a+Math.ceil(r)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return p;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;f.clearRect(m,m,s,l),f.fillText(e,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(Kd,0,h),g.fill(0,0,h);for(let e=0;e0?e*e:0,g[r]=e<0?e*e:0}}Jd(_,0,0,c,u,c,this.f,this.v,this.z),Jd(g,m,m,s,l,c,this.f,this.v,this.z);for(let e=0;ee+t[1]-t[0],f=h.reduce(p,0),m=d.reduce(p,0),g=s-f,_=l-m;let y=0,x=f,b=0,w=m,E=0,T=g,S=0,k=_;if(o.content&&r){const e=o.content;y=op(h,0,e[0]),b=op(d,0,e[1]),x=op(h,e[0],e[2]),w=op(d,e[1],e[3]),E=e[0]-y,S=e[1]-b,T=e[2]-e[0]-x,k=e[3]-e[1]-w}const M=(r,i,s,l)=>{const h=sp(r.stretch-y,x,c,e.left),d=lp(r.fixed-E,T,r.stretch,f),p=sp(i.stretch-b,w,u,e.top),g=lp(i.fixed-S,k,i.stretch,m),_=sp(s.stretch-y,x,c,e.left),M=lp(s.fixed-E,T,s.stretch,f),C=sp(l.stretch-b,w,u,e.top),A=lp(l.fixed-S,k,l.stretch,m),I=new v(h,p),z=new v(_,p),P=new v(_,C),L=new v(h,C),D=new v(d/a,g/a),R=new v(M/a,A/a),O=t*Math.PI/180;if(O){const e=Math.sin(O),t=Math.cos(O),n=[t,-e,e,t];I._matMult(n),z._matMult(n),L._matMult(n),P._matMult(n)}const B=r.stretch+r.fixed,F=i.stretch+i.fixed;return{tl:I,tr:z,bl:L,br:P,tex:{x:o.paddedRect.x+rp+B,y:o.paddedRect.y+rp+F,w:s.stretch+s.fixed-B,h:l.stretch+l.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:T/a/c,minFontScaleY:k/a/u,isSDF:n}};if(r&&(o.stretchX||o.stretchY)){const e=ap(h,g,f),t=ap(d,_,m);for(let n=0;n0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,r=t[e];for(;e>0;){const i=e-1>>1,o=t[i];if(n(r,o)>=0)break;t[e]=o,e=i}t[e]=r}_down(e){const{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e=0)break;t[e]=o,e=r}t[e]=i}}function hp(e,t){return et?1:0}function dp(e,t=1,n=!1){let r=1/0,i=1/0,o=-1/0,a=-1/0;const s=e[0];for(let e=0;eo)&&(o=t.x),(!e||t.y>a)&&(a=t.y)}const l=Math.min(o-r,a-i);let c=l/2;const u=new up([],pp);if(0===l)return new v(r,i);for(let t=r;th.d||!h.d)&&(h=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-h.d<=t||(c=r.h/2,u.push(new fp(r.p.x-c,r.p.y-c,c,e)),u.push(new fp(r.p.x+c,r.p.y-c,c,e)),u.push(new fp(r.p.x-c,r.p.y+c,c,e)),u.push(new fp(r.p.x+c,r.p.y+c,c,e)),d+=4)}return n&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function pp(e,t){return t.max-e.max}class fp{constructor(e,t,n,r){this.p=new v(e,t),this.h=n,this.d=function(e,t){let n=!1,r=1/0;for(let i=0;ie.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n),r=Math.min(r,yc(e,i,s))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}const mp=7,gp=Number.POSITIVE_INFINITY,_p=Math.sqrt(2);function yp(e,[t,n]){let r=0,i=0;if(n===gp){t<0&&(t=0);const n=t/_p;switch(e){case"top-right":case"top-left":i=n-mp;break;case"bottom-right":case"bottom-left":i=-n+mp;break;case"bottom":i=-t+mp;break;case"top":i=t-mp}switch(e){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),n=Math.abs(n),e){case"top-right":case"top-left":case"top":i=n-mp;break;case"bottom-right":case"bottom-left":case"bottom":i=-n+mp}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,i]}function vp(e,t,n,r,i,o,a,s,l,c){e.createArrays(),e.tilePixelRatio=ss/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const u=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,d={};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:n}=e.textSizeData;d.compositeTextSizes=[h["text-size"].possiblyEvaluate(new Eo(t),s),h["text-size"].possiblyEvaluate(new Eo(n),s)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:n}=e.iconSizeData;d.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new Eo(t),s),h["icon-size"].possiblyEvaluate(new Eo(n),s)]}d.layoutTextSize=h["text-size"].possiblyEvaluate(new Eo(l+1),s),d.layoutIconSize=h["icon-size"].possiblyEvaluate(new Eo(l+1),s),d.textMaxSize=h["text-size"].possiblyEvaluate(new Eo(18),s);const p="map"===u.get("text-rotation-alignment")&&"point"!==u.get("symbol-placement"),f=u.get("text-size");for(const o of e.features){const l=u.get("text-font").evaluate(o,{},s).join(","),h=f.evaluate(o,{},s),m=d.layoutTextSize.evaluate(o,{},s),g=(d.layoutIconSize.evaluate(o,{},s),{horizontal:{},vertical:void 0}),_=o.text;let y,v=[0,0];if(_){const r=_.toString(),a=u.get("text-letter-spacing").evaluate(o,{},s)*Fh,c=u.get("text-line-height").evaluate(o,{},s)*Fh,d=ro(r)?a:0,f=u.get("text-anchor").evaluate(o,{},s),y=u.get("text-variable-anchor");if(!y){const e=u.get("text-radial-offset").evaluate(o,{},s);v=e?yp(f,[e*Fh,gp]):u.get("text-offset").evaluate(o,{},s).map((e=>e*Fh))}let x=p?"center":u.get("text-justify").evaluate(o,{},s);const b="point"===u.get("symbol-placement"),w=b?u.get("text-max-width").evaluate(o,{},s)*Fh:1/0,E=o=>{e.allowVerticalPlacement&&no(r)&&(g.vertical=Id(_,t,n,i,l,w,c,f,o,d,v,kd.vertical,!0,m,h))};if(!p&&y){const e="auto"===x?y.map((e=>xp(e))):[x];let r=!1;for(let o=0;o=0||!no(r)){const e=Id(_,t,n,i,l,w,c,f,x,d,v,kd.horizontal,!1,m,h);e&&(g.horizontal[x]=e)}E(b?"left":x)}}let x=!1;if(o.icon&&o.icon.name){const t=r[o.icon.name];t&&(y=jd(i[o.icon.name],u.get("icon-offset").evaluate(o,{},s),u.get("icon-anchor").evaluate(o,{},s)),x=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&Z("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==u.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const b=Sp(g.horizontal)||g.vertical;e.iconsInText||(e.iconsInText=!!b&&b.iconsInText),(b||y)&&bp(e,o,g,y,r,d,m,0,v,x,a,s,c)}o&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)}function xp(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function bp(e,t,n,r,i,o,a,s,l,c,u,h,d){let p=o.textMaxSize.evaluate(t,{},h);void 0===p&&(p=a);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t,{},h),g=Sp(n.horizontal)||n.vertical,_="globe"===d.name,y=Fh,v=a/y,x=e.tilePixelRatio*p/y,b=(I=e.overscaling,e.zoom>18&&I>2&&(I>>=1),Math.max(ss/(512*I),1)*f.get("symbol-spacing")),E=f.get("text-padding")*e.tilePixelRatio,T=f.get("icon-padding")*e.tilePixelRatio,S=w(f.get("text-max-angle")),k="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),M="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),C=f.get("symbol-placement"),A=b/2;var I;const z=f.get("icon-text-fit");let P;r&&"none"!==z&&(e.allowVerticalPlacement&&n.vertical&&(P=Ud(r,n.vertical,z,f.get("icon-text-fit-padding"),m,v)),g&&(r=Ud(r,g,z,f.get("icon-text-fit-padding"),m,v)));const L=(a,s,p)=>{if(s.x<0||s.x>=ss||s.y<0||s.y>=ss)return;let f=null;if(_){const{x:e,y:t,z:n}=d.projectTilePoint(s.x,s.y,p);f={anchor:new Vd(e,t,n,0,void 0),up:d.upVector(p,s.x,s.y)}}!function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,E,T){const S=e.addToLineVertexArray(t,r);let k,M,C,A,I,z,P,L=0,D=0,R=0,O=0,B=-1,F=-1;const N={};let j=za("");const U=n?n.anchor:t;let V=0,$=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[V,$]=l.layout.get("text-offset").evaluate(x,{},T).map((e=>e*Fh)):(V=l.layout.get("text-radial-offset").evaluate(x,{},T)*Fh,$=gp),e.allowVerticalPlacement&&i.vertical){const e=i.vertical;if(f)z=Mp(e),s&&(P=Mp(s));else{const n=l.layout.get("text-rotate").evaluate(x,{},T)+90;C=kp(c,U,t,u,h,d,e,p,n,m),s&&(A=kp(c,U,t,u,h,d,s,_,n))}}if(o){const r=l.layout.get("icon-rotate").evaluate(x,{},T),i="none"!==l.layout.get("icon-text-fit"),a=ip(o,r,w,i),p=s?ip(s,r,w,i):void 0;M=kp(c,U,t,u,h,d,o,_,r),L=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[Nh*l.layout.get("icon-size").evaluate(x,{},T)],m[0]>Ep&&Z(`${e.layerIds[0]}: Value for "icon-size" is >= ${wp}. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[Nh*b.compositeIconSizes[0].evaluate(x,{},T),Nh*b.compositeIconSizes[1].evaluate(x,{},T)],(m[0]>Ep||m[1]>Ep)&&Z(`${e.layerIds[0]}: Value for "icon-size" is >= ${wp}. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,v,y,x,!1,n,t,S.lineStartIndex,S.lineLength,-1,E,T),B=e.icon.placedSymbolArray.length-1,p&&(D=4*p.length,e.addSymbols(e.icon,p,m,v,y,x,kd.vertical,n,t,S.lineStartIndex,S.lineLength,-1,E,T),F=e.icon.placedSymbolArray.length-1)}for(const r in i.horizontal){const o=i.horizontal[r];k||(j=za(o.text),f?I=Mp(o):k=kp(c,U,t,u,h,d,o,p,l.layout.get("text-rotate").evaluate(x,{},T),m));const s=1===o.positionedLines.length;if(R+=Tp(e,n,t,o,a,l,f,x,m,S,i.vertical?kd.horizontal:kd.horizontalOnly,s?Object.keys(i.horizontal):[r],N,B,b,E,T),s)break}i.vertical&&(O+=Tp(e,n,t,i.vertical,a,l,f,x,m,S,kd.vertical,["vertical"],N,F,b,E,T));let G=-1;const q=(e,t)=>e?Math.max(e,t):t;G=q(I,G),G=q(z,G),G=q(P,G);const W=G>-1?1:0;e.glyphOffsetArray.length>=sf.MAX_GLYPHS&&Z("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),e.symbolInstances.emplaceBack(U.x,U.y,U.z,t.x,t.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,B,F,j,void 0!==k?k:e.collisionBoxArray.length,void 0!==k?k+1:e.collisionBoxArray.length,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==M?M:e.collisionBoxArray.length,void 0!==M?M+1:e.collisionBoxArray.length,A||e.collisionBoxArray.length,A?A+1:e.collisionBoxArray.length,u,R,O,L,D,W,0,V,$,G)}(e,s,f,a,n,r,i,P,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,k,l,0,T,M,m,t,o,c,u,h)};if("line"===C)for(const i of Yd(t.geometry,0,0,ss,ss)){const t=Hd(i,b,S,n.vertical||g,r,y,x,e.overscaling,ss);for(const n of t)g&&Cp(e,g.text,A,n)||L(i,n,h)}else if("line-center"===C){for(const e of t.geometry)if(e.length>1){const t=Wd(e,S,n.vertical||g,r,y,x);t&&L(e,t,h)}}else if("Polygon"===t.type)for(const e of Eu(t.geometry,0)){const t=dp(e,16);L(e[0],new Vd(t.x,t.y,0,0,void 0),h)}else if("LineString"===t.type)for(const e of t.geometry)L(e,new Vd(e[0].x,e[0].y,0,0,void 0),h);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)L([t],new Vd(t.x,t.y,0,0,void 0),h)}const wp=255,Ep=wp*Nh;function Tp(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g){const _=function(e,t,n,r,i,o,a,s){const l=[];if(0===t.positionedLines.length)return l;const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],n=e[1],r=t*n;return r>0?[t,-n]:r<0?[-t,n]:0===t?[n,t]:[n,-t]}(n);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const d=t.positionedLines.length,p=h/d;let f=t.top-n[1];for(let e=0;eEp&&Z(`${e.layerIds[0]}: Value for "text-size" is >= ${wp}. Reduce your "text-size".`)):"composite"===y.kind&&(x=[Nh*f.compositeTextSizes[0].evaluate(s,{},g),Nh*f.compositeTextSizes[1].evaluate(s,{},g)],(x[0]>Ep||x[1]>Ep)&&Z(`${e.layerIds[0]}: Value for "text-size" is >= ${wp}. Reduce your "text-size".`)),e.addSymbols(e.text,_,x,l,a,s,u,t,n,c.lineStartIndex,c.lineLength,p,m,g);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*_.length}function Sp(e){for(const t in e)return e[t];return null}function kp(e,t,n,r,i,o,a,s,l,c){let u=a.top,h=a.bottom,d=a.left,p=a.right;const f=a.collisionPadding;if(f&&(d-=f[0],u-=f[1],p+=f[2],h+=f[3]),l){const e=new v(d,u),t=new v(p,u),n=new v(d,h),r=new v(p,h),i=w(l);let o=new v(0,0);c&&(o=new v(c[0],c[1])),e._rotateAround(i,o),t._rotateAround(i,o),n._rotateAround(i,o),r._rotateAround(i,o),d=Math.min(e.x,t.x,n.x,r.x),p=Math.max(e.x,t.x,n.x,r.x),u=Math.min(e.y,t.y,n.y,r.y),h=Math.max(e.y,t.y,n.y,r.y)}return e.emplaceBack(t.x,t.y,t.z,n.x,n.y,d,u,p,h,s,r,i,o),e.length-1}function Mp(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Cp(e,t,n,r){const i=e.compareText;if(t in i){const e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])v&&(x(e,c,r,i,s,l),x(c,n,s,l,o,a))}x(h,d,r,o,i,o),x(d,p,i,o,i,a),x(p,f,i,a,r,a),x(f,h,r,a,r,o),m-=v,g-=v,_+=v,y+=v;const b=1/Math.max(_-m,y-g);return{scale:b,x:m*b,y:g*b,x2:_*b,y2:y*b,projection:t}}const zp=ps(new Float32Array(16));class Pp{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new Vl(0,0)}projectTilePoint(e,t,n){return{x:e,y:t,z:0}}locationPoint(e,t,n=!0){return e._coordinatePoint(e.locationCoordinate(t),n)}pixelsPerMeter(e,t){return ql(1,e)*t}pixelSpaceConversion(e,t,n){return 1}farthestPixelDistance(e){return Ap(e,e.pixelsPerMeter)}pointCoordinate(e,t,n,r){const i=e.horizonLineFromTop(!1),o=new v(t,Math.max(i,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}pointCoordinate3D(e,t,n){const r=new v(t,n);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);const n=e.horizonLineFromTop();return t.y0?t<-Up+n&&(t=-Up+n):t>Up-n&&(t=Up-n);const o=i/Math.pow(Vp(t),r);let a=o*Math.sin(r*e),s=i-o*Math.cos(r*e);return a=.5*(a/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:a,y:this.southernCenter?s:1-s,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n,f:r}=this,i=r-t,o=Math.sign(i),a=Math.sign(n)*Math.sqrt(e*e+i*i);let s=Math.atan2(e,Math.abs(i))*o;i*n<0&&(s-=Math.PI*Math.sign(e)*o);const l=C(E(s/n)+this.center[0],-180,180),c=C(E(2*Math.atan(Math.pow(r/a,1/n))-Up),-Yl,Yl);return new Vl(l,this.southernCenter?-c:c)}}class Gp extends Pp{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Gl(e),y:Zl(t),z:0}}unproject(e,t){const n=Wl(e),r=Hl(t);return new Vl(n,r)}}const Zp=w(Yl);class qp extends Pp{project(e,t){const n=(t=w(t))*t,r=n*n;return{x:.5*((e=w(e))*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let n=t=(2*(1-t)-1)*Math.PI,r=25,i=0,o=n*n;do{o=n*n;const e=o*o;i=(n*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),n=C(n-i,-Zp,Zp)}while(Math.abs(i)>1e-6&&--r>0);o=n*n;const a=C(E(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),s=E(n);return new Vl(a,s)}}const Wp=w(Yl);class Hp extends Pp{project(e,t){t=w(t),e=w(e);const n=Math.cos(t),r=2/Math.PI,i=Math.acos(n*Math.cos(e/2)),o=Math.sin(i)/i,a=.5*(e*r+2*n*Math.sin(e/2)/o)||0,s=.5*(t+Math.sin(t)/o)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(s/Math.PI+1),z:0}}unproject(e,t){let n=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,i=25;const o=1e-6;let a=0,s=0;do{const i=Math.cos(r),o=Math.sin(r),l=2*o*i,c=o*o,u=i*i,h=Math.cos(n/2),d=Math.sin(n/2),p=2*h*d,f=d*d,m=1-u*h*h,g=m?1/m:0,_=m?Math.acos(i*h)*Math.sqrt(1/m):0,y=.5*(2*_*i*d+2*n/Math.PI)-e,v=.5*(_*o+r)-t,x=.5*g*(u*f+_*i*h*c)+1/Math.PI,b=g*(p*l/4-_*o*d),w=.125*g*(l*d-_*o*u*p),E=.5*g*(c*h+_*f*i)+.5,T=b*w-E*x;a=(v*b-y*E)/T,s=(y*w-v*x)/T,n=C(n-a,-Math.PI,Math.PI),r=C(r-s,-Wp,Wp)}while((Math.abs(a)>o||Math.abs(s)>o)&&--i>0);return new Vl(E(n),E(r))}}class Xp extends Pp{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(w(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:n,cosPhi:r}=this;return{x:w(e)*r*n+.5,y:-Math.sin(w(t))/r*n+.5,z:0}}unproject(e,t){const{scale:n,cosPhi:r}=this,i=-(t-.5)/n,o=C(E((e-.5)/n)/r,-180,180),a=Math.asin(C(i*r,-1,1)),s=C(E(a),-Yl,Yl);return new Vl(o,s)}}class Yp extends Gp{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,n){const r=Ml(e,t,n);return Bs(r,r,Il(yl(n))),{x:r[0],y:r[1],z:r[2]}}locationPoint(e,t){const n=kl(t.lat,t.lng),r=Ds([],n),i=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;Ls(n,n,r,ql(1,0)*ss*i);const o=ps(new Float64Array(16));return ms(o,e.pixelMatrix,e.globeMatrix),Bs(n,n,o),new v(n[0],n[1])}pixelsPerMeter(e,t){return ql(1,0)*t}pixelSpaceConversion(e,t,n){const r=ql(1,e)*t,i=Ln(ql(1,45)*t,r,n);return this.pixelsPerMeter(e,t)/i}createTileMatrix(e,t,n){const r=zl(yl(n.canonical));return ms(new Float64Array(16),e.globeMatrix,r)}createInversionMatrix(e,t){const{center:n}=e,r=Il(yl(t));return vs(r,r,w(n.lng)),ys(r,r,w(n.lat)),_s(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}pointCoordinate(e,t,n,r){return ml(e,t,n,!0)||new Jl(0,0)}pointCoordinate3D(e,t,n){const r=this.pointCoordinate(e,t,n,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!ml(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const n=e.cameraToCenterDistance,r=e._centerAltitude*t,i=e._camera,o=e._camera.forward(),a=Ms([],Ps([],o,-n),[0,0,r]),s=e.worldSize/(2*Math.PI),l=[0,0,-s],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=Ps([],i.up(),u),d=Ps([],i.right(),u*c),p=Ds([],Ms([],Ms([],o,h),d)),f=[];let m;if(new tl(a,p).closestPointOnSphere(l,s,f)){const t=Ms([],f,l),n=js([],t,a);m=Math.cos(e.fovAboveCenter)*Ss(n)}else{const e=js([],a,l),t=js([],l,a);Ds(t,t);const n=Ss(e)-s;m=Math.sqrt(n*(n+2*s));const r=Math.acos(m/(s+n))-Math.acos(Rs(o,t));m*=Math.cos(r)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Ll(e.zoom);if(n>0){const r=Ap(e,ql(1,e.center.lat)*e.worldSize),i=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ln(t,r+i*(1-Math.cos(o)),Math.pow(n,10))}return t}upVector(e,t,n){return Ml(t,n,e,1)}upVectorScale(e){return{metersToTile:fl(Cl(yl(e)))}}}function Kp(e){const t=e.parallels,n=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Gp(e);case"equirectangular":return new jp(e);case"naturalEarth":return new qp(e);case"equalEarth":return new Np(e);case"winkelTripel":return new Hp(e);case"albers":return n?new Xp(e):new Lp(e);case"lambertConformalConic":return n?new Xp(e):new $p(e);case"globe":return new Yp(e)}throw new Error(`Invalid projection name: ${e.name}`)}const Jp=Wu.types,Qp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ef(e,t,n,r,i,o,a,s,l,c,u,h,d){const p=s?Math.min(Ep,Math.round(s[0])):0,f=s?Math.min(Ep,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*r),Math.round(32*i),o,a,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function tf(e,t,n,r,i,o,a){e.emplaceBack(t,n,r,i,o,a)}function nf(e,t,n,r,i){e.emplaceBack(t,n,r,i),e.emplaceBack(t,n,r,i),e.emplaceBack(t,n,r,i),e.emplaceBack(t,n,r,i)}function rf(e){for(const t of e.sections)if(co(t.text))return!0;return!1}class of{constructor(e){this.layoutVertexArray=new Yo,this.indexArray=new ia,this.programConfigurations=e,this.segments=new as,this.dynamicLayoutVertexArray=new qo,this.opacityVertexArray=new Jo,this.placedSymbolArray=new ga,this.globeExtVertexArray=new Ko}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Lh.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Qp,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Ph.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Yi(of,"SymbolBuffers");class af{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new as,this.collisionVertexArray=new na,this.collisionVertexArrayExt=new ra}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Dh.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Rh.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Yi(af,"CollisionBuffers");class sf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ps([]),this.placementViewportMatrix=ps([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=jh(this.zoom,t["text-size"]),this.iconSizeData=jh(this.zoom,t["icon-size"]);const n=this.layers[0].layout,r=n.get("symbol-sort-key"),i=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map((e=>kd[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection}createArrays(){this.text=new of(new Ya(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new of(new Ya(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new va,this.lineVertexArray=new xa,this.symbolInstances=new ya}calculateGlyphDependencies(e,t,n,r,i){for(let n=0;n0)&&("constant"!==s.value.kind||s.value.value.length>0),h="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,d=o.get("symbol-sort-key");if(this.features=[],!u&&!h)return;const p=t.iconDependencies,f=t.glyphDependencies,m=t.availableImages,g=new Eo(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:_}of e){const e=i._featureFilter.needGeometry,y=sc(t,e);if(!i._featureFilter.filter(g,y,n))continue;if(e||(y.geometry=ac(t,n,r)),a&&1!==t.type&&n.z<=5){const e=y.geometry,t=.98078528056,r=(e,r)=>Rs(Ml(e.x,e.y,n,1),Ml(r.x,r.y,n,1))=0;for(const n of v.sections)if(n.image)p[n.image.name]=!0;else{const r=no(v.toString()),i=n.fontStack||e,o=f[i]=f[i]||{};this.calculateGlyphDependencies(n.text,o,t,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},n={},r=[];let i=0;function o(t){r.push(e[t]),i++}function a(e,t,i){const o=n[e];return delete n[e],n[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(i[0]),o}function s(e,n,i){const o=t[n];return delete t[n],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=i[0].concat(r[o].geometry[0]),o}function l(e,t,n){const r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;ce.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n,r),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Kp(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const n=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:n}of t)this.lineVertexArray.emplaceBack(e,n);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,t,n,r,i,o,a,s,l,c,u,h,d,p){const f=e.indexArray,m=e.layoutVertexArray,g=e.globeExtVertexArray,_=e.segments.prepareSegment(4*t.length,m,f,this.canOverlap?o.sortKey:void 0),y=this.glyphOffsetArray.length,v=_.vertexLength,x=this.allowVerticalPlacement&&a===kd.vertical?Math.PI/2:0,b=o.text&&o.text.sections;for(let r=0;r=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),o=Uh(this.textSizeData,e,i)/Fh;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,n){const r=this.icon.placedSymbolArray.get(n),i=Uh(this.iconSizeData,e,r);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(e,t,n){e.emplaceBack(t,-n,-n),e.emplaceBack(t,n,-n),e.emplaceBack(t,n,n),e.emplaceBack(t,-n,n)}_updateTextDebugCollisionBoxes(e,t,n,r,i,o){for(let a=r;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;tr[e]-r[t]||i[t]-i[e])),o}addToSortKeyRanges(e,t){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:s}=t;n>=0&&this.addIndicesForPlacedSymbol(this.text,n),r>=0&&r!==n&&this.addIndicesForPlacedSymbol(this.text,r),i>=0&&i!==r&&i!==n&&this.addIndicesForPlacedSymbol(this.text,i),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Yi(sf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),sf.MAX_GLYPHS=65535,sf.addDynamicAttributes=nf;const lf=new Ro({"symbol-placement":new Po(tt.layout_symbol["symbol-placement"]),"symbol-spacing":new Po(tt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Po(tt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Lo(tt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Po(tt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Po(tt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Po(tt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Po(tt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Po(tt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Lo(tt.layout_symbol["icon-size"]),"icon-text-fit":new Po(tt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Po(tt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Lo(tt.layout_symbol["icon-image"]),"icon-rotate":new Lo(tt.layout_symbol["icon-rotate"]),"icon-padding":new Po(tt.layout_symbol["icon-padding"]),"icon-keep-upright":new Po(tt.layout_symbol["icon-keep-upright"]),"icon-offset":new Lo(tt.layout_symbol["icon-offset"]),"icon-anchor":new Lo(tt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Po(tt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Po(tt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Po(tt.layout_symbol["text-rotation-alignment"]),"text-field":new Lo(tt.layout_symbol["text-field"]),"text-font":new Lo(tt.layout_symbol["text-font"]),"text-size":new Lo(tt.layout_symbol["text-size"]),"text-max-width":new Lo(tt.layout_symbol["text-max-width"]),"text-line-height":new Lo(tt.layout_symbol["text-line-height"]),"text-letter-spacing":new Lo(tt.layout_symbol["text-letter-spacing"]),"text-justify":new Lo(tt.layout_symbol["text-justify"]),"text-radial-offset":new Lo(tt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Po(tt.layout_symbol["text-variable-anchor"]),"text-anchor":new Lo(tt.layout_symbol["text-anchor"]),"text-max-angle":new Po(tt.layout_symbol["text-max-angle"]),"text-writing-mode":new Po(tt.layout_symbol["text-writing-mode"]),"text-rotate":new Lo(tt.layout_symbol["text-rotate"]),"text-padding":new Po(tt.layout_symbol["text-padding"]),"text-keep-upright":new Po(tt.layout_symbol["text-keep-upright"]),"text-transform":new Lo(tt.layout_symbol["text-transform"]),"text-offset":new Lo(tt.layout_symbol["text-offset"]),"text-allow-overlap":new Po(tt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Po(tt.layout_symbol["text-ignore-placement"]),"text-optional":new Po(tt.layout_symbol["text-optional"])});var cf={paint:new Ro({"icon-opacity":new Lo(tt.paint_symbol["icon-opacity"]),"icon-color":new Lo(tt.paint_symbol["icon-color"]),"icon-halo-color":new Lo(tt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Lo(tt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Lo(tt.paint_symbol["icon-halo-blur"]),"icon-translate":new Po(tt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Po(tt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Lo(tt.paint_symbol["text-opacity"]),"text-color":new Lo(tt.paint_symbol["text-color"],{runtimeType:pt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Lo(tt.paint_symbol["text-halo-color"]),"text-halo-width":new Lo(tt.paint_symbol["text-halo-width"]),"text-halo-blur":new Lo(tt.paint_symbol["text-halo-blur"]),"text-translate":new Po(tt.paint_symbol["text-translate"]),"text-translate-anchor":new Po(tt.paint_symbol["text-translate-anchor"])}),layout:lf};class uf{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:ct,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Yi(uf,"FormatSectionOverride",{omit:["defaultValue"]});class hf extends rs{constructor(e){super(e,cf)}recalculate(e,t){super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const e=[];for(const t of n)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r){const i=this.layout.get(e).evaluate(t,{},n,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Yr(o.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>n in e?String(e[n]):""))}(t.properties,i)}createBucket(e){return new sf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of cf.paint.overridableProperties){if(!hf.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),n=new uf(t),r=new Xr(n,t.property.specification);let i=null;i="constant"===t.value.kind||"source"===t.value.kind?new Jr("source",r):new Qr("composite",r,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Io(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&hf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const n=e.get("text-field"),r=cf.paint.properties[t];let i=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(i=!0)};if("constant"===n.value.kind&&n.value.value instanceof Rt)o(n.value.value.sections);else if("source"===n.value.kind){const e=t=>{i||(t instanceof Vt&&Nt(t.value)===_t?o(t.value.sections):t instanceof Wt?o(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}getProgramConfiguration(e){return new Xa(this,e)}}var df={paint:new Ro({"background-color":new Po(tt.paint_background["background-color"]),"background-pattern":new Po(tt.paint_background["background-pattern"]),"background-opacity":new Po(tt.paint_background["background-opacity"])})},pf={paint:new Ro({"raster-opacity":new Po(tt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Po(tt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Po(tt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Po(tt.paint_raster["raster-brightness-max"]),"raster-saturation":new Po(tt.paint_raster["raster-saturation"]),"raster-contrast":new Po(tt.paint_raster["raster-contrast"]),"raster-resampling":new Po(tt.paint_raster["raster-resampling"]),"raster-fade-duration":new Po(tt.paint_raster["raster-fade-duration"])})};class ff extends rs{constructor(e){super(e,{}),this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isLayerDraped(){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}var mf={paint:new Ro({"sky-type":new Po(tt.paint_sky["sky-type"]),"sky-atmosphere-sun":new Po(tt.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Po(tt.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Po(tt.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Po(tt.paint_sky["sky-gradient-radius"]),"sky-gradient":new Do(tt.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Po(tt.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Po(tt.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Po(tt.paint_sky["sky-opacity"])})};function gf(e,t,n){const r=[0,0,1],i=Ws([]);return Xs(i,i,n?-w(e)+Math.PI:w(e)),Hs(i,i,-w(t)),Fs(r,r,i),Ds(r,r)}const _f={circle:class extends rs{constructor(e){super(e,Cc)}createBucket(e){return new uc(e)}queryRadius(e){const t=e;return Ec("circle-radius",this,t)+Ec("circle-stroke-width",this,t)+Tc(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,n,r,i,o,a,s){const l=kc(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,n)+this.paint.get("circle-stroke-width").evaluate(t,n);return Ac(e,r,o,a,s,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getProgramConfiguration(e){return new Xa(this,e)}},heatmap:class extends rs{createBucket(e){return new Dc(e)}constructor(e){super(e,jc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Uc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return Ec("heatmap-radius",this,e)}queryIntersectsFeature(e,t,n,r,i,o,a,s){const l=this.paint.get("heatmap-radius").evaluate(t,n);return Ac(e,r,o,a,s,!0,!0,new v(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(e){return new Xa(this,e)}},hillshade:class extends rs{constructor(e){super(e,Vc)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends rs{constructor(e){super(e,Au)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),n=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(e){return new Xa(this,e)}recalculate(e,t){super.recalculate(e,t);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Mu(e)}queryRadius(){return Tc(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,n,r,i,o){return!e.queryGeometry.isAboveHorizon&&pc(Sc(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),r)}isTileClipped(){return!0}},"fill-extrusion":class extends rs{constructor(e){super(e,uh)}createBucket(e){return new eh(e)}queryRadius(){return Tc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(e){return new Xa(this,e)}queryIntersectsFeature(e,t,n,r,i,o,a,s,l){const c=kc(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(t,n),h=this.paint.get("fill-extrusion-base").evaluate(t,n),d=[0,0],p=s&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,m=e.tile.getBucket(this);if(p&&m instanceof eh){const e=m.centroidVertexArray,t=l+1;te.polygon)).flat());const g=p?s:null,[_,y]=function(e,t,n,r,i,o,a,s,l,c,u){return"globe"===e.projection.name?function(e,t,n,r,i,o,a,s,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],g=(e,t,n,r)=>{e[0]=t,e[1]=n,e[2]=r,e[3]=1},_=sh();n>0&&(n+=_),r+=_;for(const _ of t){const t=[],y=[];for(const h of _){const d=h.x+i.x,_=h.y+i.y,v=e.projection.projectTilePoint(d,_,u),x=e.projection.upVector(u,h.x,h.y);let b=n,w=r;if(a){const e=vh(d,_,n,r,a,s,l,c);b+=e.base,w+=e.top}0!==n?g(f,v.x+x[0]*p*b,v.y+x[1]*p*b,v.z+x[2]*p*b):g(f,v.x,v.y,v.z),g(m,v.x+x[0]*p*w,v.y+x[1]*p*w,v.z+x[2]*p*w),Bs(f,f,o),Bs(m,m,o),t.push(new gh(f[0],f[1],f[2])),y.push(new gh(m[0],m[1],m[2]))}h.push(t),d.push(y)}return[h,d]}(e,t,n,r,i,o,a,s,l,c,u):a?function(e,t,n,r,i,o,a,s,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+r.x,d=c.y+r.y,f=vh(u,d,t,n,o,a,s,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,Zs(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new gh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,Zs(h,h,i),h[3]=Math.max(h[3],1e-5);const g=new gh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),p.push(g)}c.push(e),u.push(p)}return[c,u]}(t,n,r,i,o,a,s,l,c):function(e,t,n,r,i){const o=[],a=[],s=i[8]*t,l=i[9]*t,c=i[10]*t,u=i[11]*t,h=i[8]*n,d=i[9]*n,p=i[10]*n,f=i[11]*n;for(const t of e){const e=[],n=[];for(const o of t){const t=o.x+r.x,a=o.y+r.y,m=i[0]*t+i[4]*a+i[12],g=i[1]*t+i[5]*a+i[13],_=i[2]*t+i[6]*a+i[14],y=i[3]*t+i[7]*a+i[15],v=m+s,x=g+l,b=_+c,w=Math.max(y+u,1e-5),E=m+h,T=g+d,S=_+p,k=Math.max(y+f,1e-5);e.push(new gh(v/w,x/w,b/w)),n.push(new gh(E/k,T/k,S/k))}o.push(e),a.push(n)}return[o,a]}(t,n,r,i,o)}(o,r,h,u,c,a,g,d,f,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return function(e,t,n){let r=1/0;pc(n,t)&&(r=yh(n,t[0]));for(let i=0;i=3)for(let t=0;t{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class xf{constructor(){this.tasks={},this.taskQueue=[],N(["process"],this),this.invoker=new vf(this.process),this.nextId=0}add(e,t){const n=this.nextId++,r=function({type:e,isSymbolTile:t,zoom:n}){return n=n||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-n:"maybePrepare"===e&&t?400-n:500:200-n:100-n}(t);if(0===r){H();try{e()}finally{}return{cancel:()=>{}}}return this.tasks[n]={fn:e,metadata:t,priority:r,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){H();try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let n=0;n>=1)>1;){const e=n+i>>1,l=r+o>>1;1&t?(i=n,o=r,n=a,r=s):(n=i,r=o,i=a,o=s),a=e,s=l}const l=4*e;kf[l+0]=n,kf[l+1]=r,kf[l+2]=i,kf[l+3]=o}const Mf=new Uint16Array(2178),Cf=new Uint8Array(1089),Af=new Uint16Array(1089);function If(e){return 0===e?-.03125:32===e?.03125:0}var zf=jo([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Pf={type:2,extent:ss,loadGeometry:()=>[[new v(0,0),new v(ss+1,0),new v(ss+1,ss+1),new v(0,ss+1),new v(0,0)]]};class Lf{constructor(e,t,n,r,i){this.tileID=e,this.uid=R(),this.uses=0,this.tileSize=t,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=i,this.expiredRequestCount=0,this.state="loading",r&&r.transform&&(this.projection=r.transform.projection)}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)n[t.id]=r}}return n}(e.buckets,t.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof sf){if(this.hasSymbolBuckets=!0,!n)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof sf&&t.hasRTLText){this.hasRTLText=!0,wo.isLoading()||wo.isLoaded()||"deferred"!==xo()||bo();break}}this.queryPadding=0;for(const e in this.buckets){const n=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new fa}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const n=this.buckets[t];n.uploadPending()&&n.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new yf(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new yf(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new yf(e,this.lineAtlas.image,t.ALPHA),this.lineAtlas.uploaded=!0)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,o,a,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:a,transform:o,params:i,tileTransform:this.tileTransform},e,t,n):{}}querySourceFeatures(e,t){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const r=n.loadVTLayers(),i=t?t.sourceLayer:"",o=r._geojsonTileLayer||r[i];if(!o)return;const a=di(t&&t.filter),{z:s,x:l,y:c}=this.tileID.canonical,u={z:s,x:l,y:c};for(let t=0;te)n=!1;else if(t)if(this.expirationTime=0;e--){const t=4*e,n=kf[t+0],r=kf[t+1],i=kf[t+2],o=kf[t+3],a=n+i>>1,s=r+o>>1,l=a+s-r,c=s+n-a,u=r*Sf+n,h=o*Sf+i,d=s*Sf+a,p=Math.hypot((Mf[2*u+0]+Mf[2*h+0])/2-Mf[2*d+0],(Mf[2*u+1]+Mf[2*h+1])/2-Mf[2*d+1])>=16;Cf[d]=Cf[d]||(p?1:0),e<1022&&(Cf[d]=Cf[d]||Cf[(r+c>>1)*Sf+(n+l>>1)]||Cf[(o+c>>1)*Sf+(i+l>>1)])}const i=new Go,o=new ia;let a=0;function s(e,t){const n=t*Sf+e;return 0===Af[n]&&(i.emplaceBack(Mf[2*n+0],Mf[2*n+1],e*ss/Tf,t*ss/Tf),Af[n]=++a),Af[n]-1}function l(e,t,n,r,i,a){const c=e+n>>1,u=t+r>>1;if(Math.abs(e-i)+Math.abs(t-a)>1&&Cf[u*Sf+c])l(i,a,e,t,c,u),l(n,r,i,a,c,u);else{const l=s(e,t),c=s(n,r),u=s(i,a);o.emplaceBack(l,c,u)}}return l(0,0,Tf,Tf,Tf,0),l(Tf,Tf,0,0,0,Tf),{vertices:i,indices:o}}(this.tileID.canonical,t);r=e.vertices,i=e.indices}else{r=new Go,i=new ia;for(const{x:e,y:t}of n)r.emplaceBack(e,t,0,0);const e=yu(r.int16,void 0,4);for(let t=0;t0&&(a=fs(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,r,t,i,a,o),this._makeGlobeTileDebugTextBuffer(e,r,t,i,a,o)}_globePoint(e,t,n,r,i,o,a){let s=Ml(e,t,n);if(o){const i=1<.5?h=-1:u<-.5&&(h=1);let d=(e/ss+n.x)/i+h,p=(t/ss+n.y)/i;d=(d-l)*r._pixelsPerMercatorPixel+l,p=(p-c)*r._pixelsPerMercatorPixel+c;const f=[d*r.worldSize,p*r.worldSize,0];Bs(f,f,o),s=vl(s,f,a)}return Bs(s,s,i)}_makeGlobeTileDebugBorderBuffer(e,t,n,r,i,o){const a=new Vo,s=new ha,l=new $o,c=(e,c,u,h,d)=>{const p=(u-e)/(d-1),f=(h-c)/(d-1),m=a.length;for(let u=0;uu*e+t;for(let e=0;et[a])return null}else{const s=1/r[a];let l=(e[a]-n[a])*s,c=(t[a]-n[a])*s;if(l>c){const e=l;l=c,c=e}if(l>i&&(i=l),co)return null}return i}function Bf(e,t,n,r,i,o,a,s,l,c,u){const h=r-e,d=i-t,p=o-n,f=a-e,m=s-t,g=l-n,_=u[1]*g-u[2]*m,y=u[2]*f-u[0]*g,v=u[0]*m-u[1]*f,x=h*_+d*y+p*v;if(Math.abs(x)<1e-15)return null;const b=1/x,w=c[0]-e,E=c[1]-t,T=c[2]-n,S=(w*_+E*y+T*v)*b;if(S<0||S>1)return null;const k=E*p-T*d,M=T*h-w*p,C=w*d-E*h,A=(u[0]*k+u[1]*M+u[2]*C)*b;return A<0||S+A>1?null:(f*k+m*M+g*C)*b}function Ff(e,t,n){return(e-t)/(n-t)}function Nf(e,t,n,r,i,o,a,s,l){const c=1<{const o=r?1:0,a=(e+1)*n-o,s=t*n,l=(t+1)*n-o;i[0]=e*n,i[1]=s,i[2]=a,i[3]=l};let a=new Rf(r);const s=[];for(let t=0;t=1;r/=2){const e=n[n.length-1];a=new Rf(r);for(let t=0;t0;){const{idx:s,t:p,nodex:f,nodey:m,depth:g}=d.pop();if(this.leaves[s]){Nf(f,m,g,e,t,n,r,u,h);const s=1<=e[2])return p}continue}let _=0;for(let d=0;d=l[c[n]]&&(c.splice(n,0,d),t=!0);t||(c[_]=d),_++}}for(let e=0;e<_;e++){const t=c[e];d.push({idx:this.childOffsets[s]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:g+1})}}return null}_addNode(e,t,n){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,n,r,i){if(1===e[r].isLeaf(t,n))return;this.childOffsets[i]||(this.childOffsets[i]=this.nodeCount);const o=r-1,a=e[o];let s=0,l=0;for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const n=[0,0,0,0],r=qf.getUnpackVector(t);let i=Math.floor((e+r[3])/r[2]);return n[2]=i%256,i=Math.floor(i/256),n[1]=i%256,i=Math.floor(i/256),n[0]=i,n}getPixels(){return new Nc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,i=t*this.dim+this.dim,o=n*this.dim,a=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-n*this.dim;for(let t=o;t{this.remove(e,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const n=e.wrapped().key,r=void 0===t?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const n in this.data)for(const r of this.data[n])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class Hf{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}}Hf.ReadOnly=!1,Hf.ReadWrite=!0,Hf.disabled=new Hf(519,Hf.ReadOnly,[0,1]);const Xf=7680;class Yf{constructor(e,t,n,r,i,o){this.test=e,this.ref=t,this.mask=n,this.fail=r,this.depthFail=i,this.pass=o}}Yf.disabled=new Yf({func:519,mask:0},0,0,Xf,Xf,Xf);class Kf{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}}Kf.Replace=[1,0],Kf.disabled=new Kf(Kf.Replace,Pt.transparent,[!1,!1,!1,!1]),Kf.unblended=new Kf(Kf.Replace,Pt.transparent,[!0,!0,!0,!0]),Kf.alphaBlended=new Kf([1,771],Pt.transparent,[!0,!0,!0,!0]);const Jf=1029,Qf=2305;class em{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}}em.disabled=new em(!1,Jf,Qf),em.backCCW=new em(!0,Jf,Qf),em.backCW=new em(!0,Jf,2304),em.frontCW=new em(!0,1028,2304),em.frontCCW=new em(!0,1028,Qf);class tm extends et{constructor(e,t,n){super(),this.id=e,this._onlySymbols=n,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new Wf(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new Df,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,(()=>{}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return P(this._tiles).map((e=>e.tileID)).sort(nm).map((e=>e.key))}getRenderableIds(e){const t=[];for(const n in this._tiles)this._isIdRenderable(+n,e)&&t.push(this._tiles[n]);return e?t.sort(((e,t)=>{const n=e.tileID,r=t.tileID,i=new v(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),o=new v(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-r.overscaledZ||o.y-i.y||o.x-i.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(nm).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const n=this._tiles[e];n&&("loading"!==n.state&&(n.state=t),this._loadTile(n,this._tileLoaded.bind(this,n,e,t)))}_tileLoaded(e,t,n,r){if(r)if(e.state="errored",404!==r.status)this._source.fire(new Qe(r,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform);else e.timeAdded=Xe.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new Je("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r1||(Math.abs(n)>1&&(1===Math.abs(n+i)?n+=i:1===Math.abs(n-i)&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,r){for(const i in this._tiles){let o=this._tiles[i];if(r[i]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>n)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(a=e)}let s=a;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){r[a.key]=a;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){const t=e.scaledTo(n),r=this._getLoadedTile(t);if(r)return r}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const n=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,i=Math.floor(n*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,i):i,a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(a)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const n in this._tiles){const r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(e,t,n){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!n)return;let r;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new fh(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];const i=this._updateRetainedTiles(r);if(rm(this._source.type)&&0!==r.length){const e={},t={},n=Object.keys(i);for(const r of n){const n=i[r],o=this._tiles[r];if(!o||o.fadeEndTime&&o.fadeEndTime<=Xe.now())continue;const a=this.findLoadedParent(n,Math.max(n.overscaledZ-tm.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),e[a.tileID.key]=a.tileID),t[r]=n}const o=r[r.length-1].overscaledZ;for(const e in this._tiles){const n=this._tiles[e];if(i[e]||!n.hasData())continue;let r=n.tileID;for(;r.overscaledZ>o;){r=r.scaledTo(r.overscaledZ-1);const o=this._tiles[r.key];if(o&&o.hasData()&&t[r.key]){i[e]=n.tileID;break}}}for(const t in e)i[t]||(this._coveredTiles[t]=!0,i[t]=e[t])}for(const e in i)this._tiles[e].clearFadeHold();const o=function(e,t){const n=[];for(const r in e)r in t||n.push(r);return n}(this._tiles,i);for(const e of o){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const n={},r=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),i=e[0].overscaledZ,o=Math.max(i-tm.maxOverzooming,this._source.minzoom),a=Math.max(i+tm.maxUnderzooming,this._source.minzoom),s={};for(const n of e){const e=this._addTile(n);t[n.key]=n,e.hasData()||r=this._source.maxzoom){const e=r.children(this._source.maxzoom)[0],n=this.getTile(e);if(n&&n.hasData()){t[e.key]=e;continue}}else{const e=r.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let i=e.wasRequested();for(let a=r.overscaledZ-1;a>=o;--a){const o=r.scaledTo(a);if(n[o.key])break;if(n[o.key]=!0,e=this.getTile(o),!e&&i&&(e=this._addTile(o)),e&&(t[o.key]=o,i=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let n,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;r=e}for(const e of t)this._loadedParentTiles[e]=n}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));const n=Boolean(t);if(!n){const n=this.map?this.map.painter:null;t=new Lf(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,n,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,n||this._source.fire(new Je("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),n))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,t,n){const r=[],i=this.transform;if(!i)return r;const o="globe"===i.projection.name,a=Gl(i.center.lng);for(const s in this._tiles){const l=this._tiles[s];if(n&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(o){const e=l.tileID.canonical;if(0===e.z){const t=[Math.abs(C(a,...im(e,-1))-a),Math.abs(C(a,...im(e,1))-a)];c=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(C(a,...im(e,-1))-a),Math.abs(C(a,...im(e,0))-a),Math.abs(C(a,...im(e,1))-a)];c=[t.indexOf(Math.min(...t))-1]}}else c=[0];for(const n of c){const o=e.containsTile(l,i,t,n);o&&r.push(o)}}return r}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(const e of t)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(rm(this._source.type))for(const e in this._tiles){const t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=Xe.now())return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e=e||"_geojsonTileLayer",t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,n)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,n){const r=this._tiles[e];r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(const n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(+n,"reloading");this._cache.filter((n=>!n.hasDependency(e,t)))}_preloadTiles(e,t){if(!this._sourceLoaded){const n=()=>{this._sourceLoaded&&(this._source.off("data",n),this._preloadTiles(e,t))};return void this._source.on("data",n)}const n=new Map,r=Array.isArray(e)?e:[e],i=this.map.painter.terrain,o=this.usedForTerrain&&i?i.getScaledDemTileSize():this._source.tileSize;for(const e of r){const t=e.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)n.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}z(Array.from(n.values()),((e,t)=>{const n=new Lf(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(n,(e=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),t(e,n)}))}),t)}}function nm(e,t){const n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function rm(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function im(e,t){const n=1<=0&&r[3]>=0&&s.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new qu(new gd(this.rawTileData)).layers,this.sourceLayerCoder=new bf(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,n,r){this.loadVTLayers();const i=e.params||{},o=di(i.filter),a=e.tileResult,s=e.transform,l=a.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((e,t,n,r)=>bc(a.bufferedTilespaceGeometry,e,t,n,r)));c.sort(lm);let u=null;s.elevation&&c.length>0&&(u=om.create(s.elevation,this.tileID));const h={};let d;for(let s=0;s(f||(f=ac(t,this.tileID.canonical,e.tileTransform)),n.queryIntersectsFeature(a,t,r,f,this.z,e.transform,e.pixelPosMatrix,u,i))))}return h}loadMatchingFeature(e,t,n,r,i,o,a,s,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:h,layoutVertexArrayOffset:d}=t,p=this.bucketLayerIDs[u];if(r&&!function(e,t){for(let n=0;n=0)return!0;return!1}(r,p))return;const f=this.sourceLayerCoder.decode(h),m=this.vtLayers[f].feature(c);if(n.needGeometry){const e=sc(m,!0);if(!n.filter(new Eo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new Eo(this.tileID.overscaledZ),m))return;const g=this.getId(m,f);for(let t=0;t{const a=t instanceof zo?t.get(o):null;return a&&a.evaluate?a.evaluate(n,r,i):a}))}function lm(e,t){return t-e}Yi(am,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class cm{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Fc({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const n=this.getKey(e,t);return this.positions[n]}trim(){const e=this.width,t=this.height=B(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,n){const r=[];let i=e.length%2==1?-e[e.length-1]*n:0,o=e[0]*n,a=!0;r.push({left:i,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let t=1;t1&&(a=e[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=t/n*(r+1);if(a.isDash){const e=r-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+d*d);this.image.data[i+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}const n=e[0],r=e[e.length-1];n.isDash===r.isDash&&(n.left=r.left-this.width,r.right=n.right+this.width);const i=this.width*this.nextRow;let o=0,a=e[o];for(let n=0;n1&&(a=e[++o]);const r=Math.abs(n-a.left),s=Math.abs(n-a.right),l=Math.min(r,s);this.image.data[i+n]=Math.max(0,Math.min(255,(a.isDash?l:-l)+t+128))}}addDash(e,t){const n=this.getKey(e,t);if(this.positions[n])return this.positions[n];const r="round"===t,i=r?7:0,o=2*i+1;if(this.nextRow+o>this.height)return Z("LineAtlas out of space"),null;0===e.length&&e.push(1);let a=0;for(let t=0;t=t.maxzoom||"none"!==t.visibility&&(pm(e,this.zoom,n),(s[t.id]=t.createBucket({index:a.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:n})).populate(d,c,this.tileID.canonical,this.tileTransform),a.bucketLayerIDs.push(e.map((e=>e.id))))}}let h,d,p,f;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},g=()=>{if(h)return i(h);if(d&&p&&f){const e=new hm(d),t=new Sd(p,f);for(const r in s){const i=s[r];i instanceof sf?(pm(i.layers,this.zoom,n),vp(i,d,e.positions,p,t.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection)):i.hasPattern&&(i instanceof kh||i instanceof Mu||i instanceof eh)&&(pm(i.layers,this.zoom,n),i.addFeatures(c,this.tileID.canonical,t.patternPositions,n,this.tileTransform))}this.status="done",i(null,{buckets:P(s).filter((e=>!e.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:l,imageAtlas:t,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}},_=U(c.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(_).length?r.send("getGlyphs",{uid:this.uid,stacks:_},((e,t)=>{h||(h=e,d=t,g())}),void 0,!1,m):d={};const y=Object.keys(c.iconDependencies);y.length?r.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{h||(h=e,p=t,g())}),void 0,!1,m):p={};const v=Object.keys(c.patternDependencies);v.length?r.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{h||(h=e,f=t,g())}),void 0,!1,m):f={},g()}}function pm(e,t,n){const r=new Eo(t);for(const t of e)t.recalculate(r,n)}class fm{constructor(e){this.entries={},this.scheduler=e}request(e,t,n,r){const i=this.entries[e]=this.entries[e]||{callbacks:[]};if(i.result){const[e,n]=i.result;return this.scheduler?this.scheduler.add((()=>{r(e,n)}),t):r(e,n),()=>{}}return i.callbacks.push(r),i.cancel||(i.cancel=n(((n,r)=>{i.result=[n,r];for(const e of i.callbacks)this.scheduler?this.scheduler.add((()=>{e(n,r)}),t):e(n,r);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{i.result||(i.callbacks=i.callbacks.filter((e=>e!==r)),i.callbacks.length||(i.cancel(),delete this.entries[e]))}}}function mm(e,t,n){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const r=pe(e.request,((e,r,i,o)=>{e?t(e):r&&t(null,{vectorTile:n?void 0:new qu(new gd(r)),rawData:r,cacheControl:i,expires:o})}));return()=>{r.cancel(),t()}}),t)}const gm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _m{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const i=gm[15&n];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new _m(a,o,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const i=gm.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ym(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,s=[0,i.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>=e&&s<=n&&c>=t&&c<=r&&l.push(i[a])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=n&&f>=t&&f<=r&&l.push(i[d]),(0===c?e<=p:t<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?n>=p:r>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return l}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:o}=this,a=[0,r.length-1,0],s=[],l=n*n;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let n=h;n<=u;n++)wm(i[2*n],i[2*n+1],e,t)<=l&&s.push(r[n]);continue}const d=h+u>>1,p=i[2*d],f=i[2*d+1];wm(p,f,e,t)<=l&&s.push(r[d]),(0===c?e-n<=p:t-n<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?e+n>=p:t+n>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return s}}function ym(e,t,n,r,i,o){if(i-r<=n)return;const a=r+i>>1;vm(e,t,a,r,i,o),ym(e,t,n,r,a-1,1-o),ym(e,t,n,a+1,i,1-o)}function vm(e,t,n,r,i,o){for(;i>r;){if(i-r>600){const a=i-r+1,s=n-r+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);vm(e,t,n,Math.max(r,Math.floor(n-s*c/a+u)),Math.min(i,Math.floor(n+(a-s)*c/a+u)),o)}const a=t[2*n+o];let s=r,l=i;for(xm(e,t,r,n),t[2*i+o]>a&&xm(e,t,r,i);sa;)l--}t[2*r+o]===a?xm(e,t,r,l):(l++,xm(e,t,l,i)),l<=n&&(r=l+1),n<=l&&(i=l-1)}}function xm(e,t,n,r){bm(e,n,r),bm(t,2*n,2*r),bm(t,2*n+1,2*r+1)}function bm(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function wm(e,t,n,r){const i=e-n,o=t-r;return i*i+o*o}e.ARRAY_TYPE=us,e.AUTH_ERR_MSG=ve,e.Aabb=il,e.Actor=class{constructor(e,n,r){this.target=e,this.parent=n,this.mapId=r,this.callbacks={},this.cancelCallbacks={},N(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=H()?e:t,this.scheduler=new xf}send(e,t,n,r,i=!1,o){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=o,this.callbacks[a]=n);const s=K(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:e,hasCallback:!!n,targetMapId:r,mustQueue:i,sourceMapId:this.mapId,data:Qi(t,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:r,sourceMapId:this.mapId})}}}receive(e){const t=e.data,n=t.id;if(n&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[n];delete this.cancelCallbacks[n],e&&e.cancel()}else if(t.mustQueue||H()){const e=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add((()=>this.processTask(n,t)),e&&e.metadata||{type:"message"})}else this.processTask(n,t)}processTask(e,t){if(""===t.type){const n=this.callbacks[e];delete this.callbacks[e],n&&(t.error?n(eo(t.error)):n(null,eo(t.data)))}else{const n=K(this.globalScope)?void 0:[],r=t.hasCallback?(t,r)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?Qi(t):null,data:Qi(r,n)},n)}:e=>{},i=eo(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,i,r);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],i.source)[e[1]](i,r)}else r(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.CanonicalTileID=dh,e.Color=Pt,e.ColorMode=Kf,e.CullFaceMode=em,e.DEMData=qf,e.DataConstantProperty=Po,e.DedupedRequest=fm,e.DepthMode=Hf,e.EXTENT=ss,e.Elevation=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const n=t.getSource().maxzoom,r=1<1)return t;const i=r.getSource().maxzoom,o=1<{const o=this.getAtTileOffset(e,i.x,i.y),a=r.upVector(e.canonical,i.x,i.y);return Ps(a,a,o*r.upVectorScale(e.canonical,t,n).metersToTile),a}}getForTilePoints(e,t,n,r){if(this.isUsingMockSource())return!1;const i=om.create(this,e,r);return!!i&&(t.forEach((e=>{e[2]=this.exaggeration()*i.getElevationAt(e[0],e[1],n)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const n=t.dem.tree,r=t.tileID,i=1<{let r=e===o-1?e-2:0===e?e:e-1;return r+=n?24575:0,[r,t]};for(let e=0;ethis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!xe(e))return e;const n=ke(e);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!xe(e))return e;const n=ke(e);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||t)}normalizeSourceURL(e,t,n,r){if(!xe(e))return e;const i=ke(e);return i.path=`/v4/${i.authority}.json`,i.params.push("secure"),n&&i.params.push(`language=${n}`),r&&i.params.push(`worldview=${r}`),this._makeAPIURL(i,this._customAccessToken||t)}normalizeSpriteURL(e,t,n,r){const i=ke(e);return xe(e)?(i.path=`/styles/v1${i.path}/sprite${t}${n}`,this._makeAPIURL(i,this._customAccessToken||r)):(i.path+=`${t}${n}`,Me(i))}normalizeTileURL(e,t,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!xe(e))return e;const r=ke(e);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t||n&&"raster"!==r.authority&&512===n?"@2x":""}${a.supported?".webp":"$1"}`),"raster"===r.authority?r.path=`/${o.RASTER_URL_PREFIX}${r.path}`:(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path=`/${o.TILE_URL_VERSION}${r.path}`);const i=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(r.params)||o.ACCESS_TOKEN;return o.REQUIRE_ACCESS_TOKEN&&i&&this._skuToken&&r.params.push(`sku=${this._skuToken}`),this._makeAPIURL(r,i)}canonicalizeTileURL(e,t){const n=ke(e);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return e;let r="mapbox://";n.path.match(/^\/raster\/v1\//)?r+=`raster/${n.path.replace(`/${o.RASTER_URL_PREFIX}/`,"")}`:r+=`tiles/${n.path.replace(`/${o.TILE_URL_VERSION}/`,"")}`;let i=n.params;return t&&(i=i.filter((e=>!e.match(/^access_token=/)))),i.length&&(r+=`?${i.join("&")}`),r}canonicalizeTileset(e,t){const n=!!t&&xe(t),r=[];for(const t of e.tiles||[])be(t)?r.push(this.canonicalizeTileURL(t,n)):r.push(t);return r}_makeAPIURL(e,t){const n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",r=ke(o.API_URL);if(e.protocol=r.protocol,e.authority=r.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==r.path&&(e.path=`${r.path}${e.path}`),!o.REQUIRE_ACCESS_TOKEN)return Me(e);if(t=t||o.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push(`access_token=${t||""}`),Me(e)}},e.ResourceType=ce,e.SegmentVector=as,e.SourceCache=tm,e.StencilMode=Yf,e.StructArrayLayout1ui2=ha,e.StructArrayLayout2f1f2i16=ta,e.StructArrayLayout2i4=Vo,e.StructArrayLayout2ui4=ua,e.StructArrayLayout3f12=ra,e.StructArrayLayout3ui6=ia,e.StructArrayLayout4i8=Go,e.StructArrayLayout5f20=la,e.Texture=yf,e.Tile=Lf,e.Transitionable=ko,e.Uniform1f=Ba,e.Uniform1i=class extends Oa{constructor(e){super(e),this.current=0}set(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},e.Uniform2f=class extends Oa{constructor(e){super(e),this.current=[0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}},e.Uniform3f=class extends Oa{constructor(e){super(e),this.current=[0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}},e.Uniform4f=Fa,e.UniformColor=Na,e.UniformMatrix2f=class extends Oa{constructor(e){super(e),this.current=Va}set(e,t,n){if(this.fetchUniformLocation(e,t))for(let e=0;e<4;e++)if(n[e]!==this.current[e]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}},e.UniformMatrix3f=class extends Oa{constructor(e){super(e),this.current=Ua}set(e,t,n){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(n[e]!==this.current[e]){this.current=n,this.gl.uniformMatrix3fv(this.location,!1,n);break}}},e.UniformMatrix4f=class extends Oa{constructor(e){super(e),this.current=ja}set(e,t,n){if(this.fetchUniformLocation(e,t)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let e=1;e<16;e++)if(n[e]!==this.current[e]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}},e.UnwrappedTileID=ph,e.ValidationError=ri,e.VectorTileFeature=Wu,e.VectorTileWorkerSource=class extends et{constructor(e,t,n,r,i){super(),this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=i||mm,this.loading={},this.loaded={},this.deduped=new fm(e.scheduler),this.isSpriteLoaded=r,this.scheduler=e.scheduler}loadTile(e,t){const n=e.uid,r=e&&e.request,i=r&&r.collectResourceTiming,o=this.loading[n]=new dm(e);o.abort=this.loadVectorData(e,((a,s)=>{const l=!this.loading[n];if(delete this.loading[n],l||a||!s)return o.status="done",l||(this.loaded[n]=o),t(a);const c=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl),o.vectorTile=s.vectorTile||new qu(new gd(c));const h=()=>{o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(e||!n)return t(e);const o={};if(i){const e=Ge(r);e.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(e)))}t(null,L({rawTileData:c.slice(0)},n,u,o))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[n]=o}))}reloadTile(e,t){const n=this.loaded,r=e.uid,i=this;if(n&&n[r]){const o=n[r];o.showCollisionBoxes=e.showCollisionBoxes,o.enableTerrain=!!e.enableTerrain,o.projection=e.projection,o.tileTransform=Ip(e.tileID.canonical,e.projection);const a=(e,n)=>{const r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,i.layerIndex,this.availableImages,i.actor,r)),t(e,n)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(e,t){const n=e.uid,r=this.loading[n];r&&(r.abort&&r.abort(),delete this.loading[n]),t()}removeTile(e,t){const n=this.loaded,r=e.uid;n&&n[r]&&delete n[r],t()}},e.WritingMode=kd,e.ZoomDependentExpression=Qr,e.add=Ms,e.addDynamicAttributes=nf,e.adjoint=function(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=a*u-s*c,e[1]=i*c-r*u,e[2]=r*s-i*a,e[3]=s*l-o*u,e[4]=n*u-i*l,e[5]=i*o-n*s,e[6]=o*c-a*l,e[7]=r*l-n*c,e[8]=n*a-r*o,e},e.asyncAll=z,e.bezier=k,e.bindAll=N,e.boundsAttributes=zf,e.bufferConvexPolygon=function(e,t){const n=[];for(let r=0;rie&&(e.getActor().send("enforceCacheSizeLimit",re),le=0)},e.calculateGlobeLabelMatrix=function(e,t){const{x:n,y:r}=e.point,i=Pl(n,r,e.worldSize/e._pixelsPerMercatorPixel,0,0);return ms(i,i,zl(yl(t)))},e.calculateGlobeMatrix=function(e){const{x:t,y:n}=e.point,{lng:r,lat:i}=e._center;return Pl(t,n,e.worldSize,r,i)},e.calculateGlobeMercatorMatrix=function(e){const t=e.pixelsPerMeter,n=t/ql(1,e.center.lat),r=ps(new Float64Array(16));return gs(r,r,[e.point.x,e.point.y,0]),_s(r,r,[n,n,t]),Float32Array.from(r)},e.circumferenceAtLatitude=$l,e.clamp=C,e.clearTileCache=function(e){if(!oe())return;const n=t.caches.delete(ee);e&&n.catch(e).then((()=>e()))},e.clipLine=Yd,e.clone=function(e){var t=new us(16);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},e.clone$1=$,e.collisionCircleLayout=Bh,e.config=o,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new us(16);return us!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=hs,e.createExpression=Kr,e.createLayout=jo,e.createStyleLayer=function(e){return"custom"===e.type?new ff(e):new _f[e.type](e)},e.cross=Os,e.degToRad=w,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e},e.dot=Rs,e.earthRadius=Nl,e.ease=M,e.easeCubicInOut=S,e.ecefToLatLng=function([e,t,n]){const r=Math.hypot(e,t,n),i=Math.atan2(e,n),o=.5*Math.PI-Math.acos(-t/r);return new Vl(E(i),E(o))},e.emitValidationErrors=Gi,e.endsWith=j,e.enforceCacheSizeLimit=function(e){ae(),te&&te.then((t=>{t.keys().then((n=>{for(let r=0;ro&&(r+=(e[i]-o)*(e[i]-o)),t[i]0){const e=180/r;ds(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/h,.5*e/d,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},e.getImage=ye,e.getJSON=function(e,t){return de(L(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){const t=Yl-5;e=C(e,-t,t)/t*90;const n=Math.pow(Math.abs(Math.sin(w(e))),3);return Math.round(n*(ul.length-1))},e.getMapSessionAPI=Fe,e.getPerformanceMeasurement=Ge,e.getProjection=Kp,e.getRTLTextPluginStatus=xo,e.getReferrer=he,e.getTilePoint=function(e,{x:t,y:n},r=0){return new v(((t-r)*e.scale-e.x)*ss,(n*e.scale-e.y)*ss)},e.getTileVec3=function(e,t,n=0){return ks(((t.x-n)*e.scale-e.x)*ss,(t.y*e.scale-e.y)*ss,Xl(t.z,t.y))},e.getVideo=function(e,n){const r=t.document.createElement("video");r.muted=!0,r.onloadstart=function(){n(null,r)};for(let n=0;n{}}},e.globeCenterToScreenPoint=function(e){const t=[0,0,0],n=ps(new Float64Array(16));return ms(n,e.pixelMatrix,e.globeMatrix),Bs(t,t,n),new v(t[0],t[1])},e.globeDenormalizeECEF=zl,e.globeECEFOrigin=function(e,t){const n=[0,0,0];return Bs(n,n,Il(yl(t.canonical))),Bs(n,n,e),n},e.globeMetersToEcef=fl,e.globeNormalizeECEF=Il,e.globePixelsToTileUnits=function(e,t){return ss/(512*Math.pow(2,e))*Cl(yl(t))},e.globePoleMatrixForTile=function(e,t,n){const r=ps(new Float64Array(16)),i=(t/(1<0;return 0===r&&!i&&!a&&o},e.identity=ps,e.identity$1=Ws,e.invert=fs,e.isFullscreen=function(){return!!t.document.fullscreenElement||!!t.document.webkitFullscreenElement},e.isLngLatBehindGlobe=Rl,e.isMapAuthenticated=function(e){return Ne.has(e)},e.isMapboxURL=xe,e.isSafariWithAntialiasingBug=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!K(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=Hl,e.latLngToECEF=kl,e.len=Vs,e.length=Ss,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=Wl,e.loadVectorTile=mm,e.makeRequest=de,e.mapValue=function(e,t,n,r,i){return C((e-t)/(n-t)*(i-r)+r,r,i)},e.mercatorScale=Kl,e.mercatorXfromLng=Gl,e.mercatorYfromLat=Zl,e.mercatorZfromAltitude=ql,e.mul=ws,e.mul$1=Us,e.multiply=ms,e.multiply$1=ds,e.multiply$2=As,e.nextPowerOfTwo=B,e.normalize=Ds,e.normalize$1=Ys,e.normalize$2=Gs,e.number=Ln,e.ortho=function(e,t,n,r,i,o,a){var s=1/(t-n),l=1/(r-i),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*l,e[14]=(a+o)*c,e[15]=1,e},e.pbf=Hh,e.perspective=function(e,t,n,r,i){var o,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(e[10]=(i+r)*(o=1/(r-i)),e[14]=2*i*r*o):(e[10]=-1,e[14]=-2*r),e},e.pick=function(e,t){const n={};for(let r=0;r0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Rl(e,new Vl(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!Rl(e,new Vl(e.center.lat,-90))]},e.polygonContainsPoint=xc,e.polygonIntersectsBox=bc,e.polygonIntersectsPolygon=hc,e.polygonizeBounds=function(e,t,n=0,r=!0){const i=new v(n,n),o=e.sub(i),a=t.add(i),s=[o,new v(a.x,o.y),a,new v(o.x,a.y)];return r&&s.push(o.clone()),s},e.posAttributes=el,e.postMapLoadEvent=De,e.postPerformanceEvent=Oe,e.postTurnstileEvent=Pe,e.potpack=wd,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=E,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:mo,pluginURL:go}),vo.on("pluginStateChange",e),e},e.removeAuthState=function(e){Ne.delete(e)},e.renderColorRamp=Uc,e.resample=ec,e.rotateX=ys,e.rotateX$1=Hs,e.rotateY=vs,e.rotateY$1=Xs,e.rotateZ=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(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[0]=o*i+c*r,e[1]=a*i+u*r,e[2]=s*i+h*r,e[3]=l*i+d*r,e[4]=c*i-o*r,e[5]=u*i-a*r,e[6]=h*i-s*r,e[7]=d*i-l*r,e},e.rotateZ$1=function(e,t,n){n*=.5;var r=t[0],i=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);return e[0]=r*l+i*s,e[1]=i*l-r*s,e[2]=o*l+a*s,e[3]=a*l-o*s,e},e.scale=_s,e.scale$1=$s,e.scale$2=Ps,e.scaleAndAdd=Ls,e.set=function(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e},e.setCacheLimits=function(e,t){re=e,ie=t},e.setColumn=function(e,t,n){e[4*t+0]=n[0],e[4*t+1]=n[1],e[4*t+2]=n[2],e[4*t+3]=n[3]},e.setRTLTextPlugin=function(e,t,n=!1){if(mo===uo||mo===ho||mo===po)throw new Error("setRTLTextPlugin cannot be called multiple times.");go=Xe.resolveURL(e),mo=uo,fo=t,yo(),n||bo()},e.smoothstep=A,e.spec=tt,e.squaredLength=function(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r},e.storeAuthState=function(e,t){t?Ne.add(e):Ne.delete(e)},e.sub=js,e.subtract=Cs,e.symbolSize=$h,e.tileAABB=function(e,t,n,r,i,o,a,s,l){if("globe"===l.name)return wl(e,t,new dh(n,r,i));const c=Ip({z:n,x:r,y:i},l);return new il([(o+c.x/c.scale)*t,t*(c.y/c.scale),a],[(o+c.x2/c.scale)*t,t*(c.y2/c.scale),s])},e.tileCornersToBounds=El,e.tileTransform=Ip,e.transformMat3=function(e,t,n){var r=t[0],i=t[1],o=t[2];return e[0]=r*n[0]+i*n[3]+o*n[6],e[1]=r*n[1]+i*n[4]+o*n[7],e[2]=r*n[2]+i*n[5]+o*n[8],e},e.transformMat4=Bs,e.transformMat4$1=Zs,e.transformQuat=Fs,e.transitionTileAABBinECEF=xl,e.translate=gs,e.transpose=function(e,t){if(e===t){var n=t[1],r=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},e.triggerPluginCompletionEvent=_o,e.uniqueId=R,e.updateGlobeVertexNormal=function(e,t,n,r,i){const o=5*t+2;e.float32[o+0]=n,e.float32[o+1]=r,e.float32[o+2]=i},e.validateCustomStyleLayer=function(e){const t=[],n=e.id;return void 0===n&&t.push({message:`layers.${n}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.validateFilter=e=>$i(Ti(e)),e.validateFog=e=>$i(Oi(e)),e.validateLayer=e=>$i(Ai(e)),e.validateLight=e=>$i(Di(e)),e.validateSource=e=>$i(Pi(e)),e.validateStyle=ji,e.validateTerrain=e=>$i(Ri(e)),e.values=P,e.vectorTile=Du,e.version=n,e.warnOnce=Z,e.window=t,e.wrap=I})),i(["./shared"],(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let n="[";for(const r of e)n+=`${t(r)},`;return`${n}]`}let n="{";for(const r of Object.keys(e).sort())n+=`${r}:${t(e[r])},`;return`${n}}`}function n(n){let r="";for(const i of e.refProperties)r+=`/${t(n[i])}`;return r}class r{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,r){for(const n of t)this._layerConfigs[n.id]=n,(this._layers[n.id]=e.createStyleLayer(n)).compileFilter(),this.keyCache[n.id]&&delete this.keyCache[n.id];for(const e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const i=function(e,t){const r={};for(let i=0;ithis._layers[e.id])),n=t[0];if("none"===n.visibility)continue;const r=n.source||"";let i=this.familiesBySource[r];i||(i=this.familiesBySource[r]={});const o=n.sourceLayer||"_geojsonTileLayer";let a=i[o];a||(a=i[o]=[]),a.push(t)}}}class i{loadTile(t,n){const{uid:r,encoding:i,rawImageData:o,padding:a,buildQuadTree:s}=t,l=e.window.ImageBitmap&&o instanceof e.window.ImageBitmap?this.getImageData(o,a):o;n(null,new e.DEMData(r,l,i,a<1,s))}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const n=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),n}}function o(e,t){if(0!==e.length){a(e[0],t);for(var n=1;n=Math.abs(s)?n-l+s:s-l+n,n=l}n+r>=0!=!!t&&e.reverse()}var s=e.getDefaultExportFromCjs((function e(t,n){var r,i=t&&t.type;if("FeatureCollection"===i)for(r=0;r>31}function E(e,t){for(var n=e.loadGeometry(),r=e.type,i=0,o=0,a=n.length,s=0;se},M=Math.fround||(C=new Float32Array(1),e=>(C[0]=+e,C[0]));var C;const A=3,I=5,z=6;class P{constructor(e){this.options=Object.assign(Object.create(k),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time("total time");const i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;const o=[];for(let t=0;t=n;e--){const n=+Date.now();a=this.trees[e]=this._createTree(this._cluster(a,e)),t&&console.log("z%d: %d clusters in %dms",e,a.numItems,+Date.now()-n)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let i=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){const e=this.getClusters([n,r,180,o],t),a=this.getClusters([-180,r,i,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(R(n),O(o),R(i),O(r)),l=a.data,c=[];for(const e of s){const t=this.stride*e;c.push(l[t+I]>1?L(l,t,this.clusterProps):this.points[l[t+A]])}return c}getChildren(e){const t=this._getOriginId(e),n=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(r);const o=i.data;if(t*this.stride>=o.length)throw new Error(r);const a=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=i.within(o[t*this.stride],o[t*this.stride+1],a),l=[];for(const t of s){const n=t*this.stride;o[n+4]===e&&l.push(o[n+I]>1?L(o,n,this.clusterProps):this.points[o[n+A]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,n){const r=[];return this._appendLeaves(r,e,t=t||10,n=n||0,0),r}getTile(e,t,n){const r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:o,radius:a}=this.options,s=a/o,l=(n-s)/i,c=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,l,(t+1+s)/i,c),r.data,t,n,i,u),0===t&&this._addTileFeatures(r.range(1-s/i,l,1,c),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,l,s/i,c),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const n=this.getChildren(e);if(t++,1!==n.length)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?i+o.point_count<=r?i+=o.point_count:i=this._appendLeaves(e,o.cluster_id,n,r,i):i1;let l,c,u;if(s)l=D(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const n=this.points[t[e+A]];l=n.properties;const[r,i]=n.geometry.coordinates;c=R(r),u=O(i)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:l};let d;d=s||this.options.generateId?t[e+A]:this.points[t[e+A]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:n,extent:r,reduce:i,minPoints:o}=this.options,a=n/(r*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let n=0;nt&&(p+=s[n+I])}if(p>d&&p>=o){let e,o=r*d,a=u*d,f=-1;const m=((n/c|0)<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(s[l+2]<=t)continue;s[l+2]=t;const u=s[l+I];o+=s[l]*u,a+=s[l+1]*u,s[l+4]=m,i&&(e||(e=this._map(s,n,!0),f=this.clusterProps.length,this.clusterProps.push(e)),i(e,this._map(s,l)))}s[n+4]=m,l.push(o/p,a/p,1/0,m,-1,p),i&&l.push(f)}else{for(let e=0;e1)for(const e of h){const n=e*c;if(!(s[n+2]<=t)){s[n+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+I]>1){const r=this.clusterProps[e[t+z]];return n?Object.assign({},r):r}const r=this.points[e[t+A]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function L(e,t,n){return{type:"Feature",id:e[t+A],properties:D(e,t,n),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),B(e[t+1])]}};var r}function D(e,t,n){const r=e[t+I],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+z],a=-1===o?{}:Object.assign({},n[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+A],point_count:r,point_count_abbreviated:i})}function R(e){return e/360+.5}function O(e){const t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function B(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function F(e,t,n,r){for(var i,o=r,a=n-t>>1,s=n-t,l=e[t],c=e[t+1],u=e[n],h=e[n+1],d=t+3;do)i=d,o=p;else if(p===o){var f=Math.abs(d-a);fr&&(i-t>3&&F(e,t,i,r),e[i+2]=o,n-i>3&&F(e,i,n,r))}function N(e,t,n,r,i,o){var a=i-n,s=o-r;if(0!==a||0!==s){var l=((e-n)*a+(t-r)*s)/(a*a+s*s);l>1?(n=i,r=o):l>0&&(n+=a*l,r+=s*l)}return(a=e-n)*a+(s=t-r)*s}function j(e,t,n,r){var i={id:void 0===e?null:e,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)U(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r0&&(a+=r?(i*c-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(c-o,2))),i=l,o=c}var u=t.length-3;t[2]=1,F(t,0,u,n),t[u+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function Z(e,t,n,r){for(var i=0;i1?1:n}function H(e,t,n,r,i,o,a,s){if(r/=t,o>=(n/=t)&&a=r)return null;for(var l=[],c=0;c=n&&f=r)){var m=[];if("Point"===d||"MultiPoint"===d)X(h,m,n,r,i);else if("LineString"===d)Y(h,m,n,r,i,!1,s.lineMetrics);else if("MultiLineString"===d)J(h,m,n,r,i,!1);else if("Polygon"===d)J(h,m,n,r,i,!0);else if("MultiPolygon"===d)for(var g=0;g=n&&a<=r&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function Y(e,t,n,r,i,o,a){for(var s,l,c=K(e),u=0===i?ee:te,h=e.start,d=0;dn&&(l=u(c,p,f,g,_,n),a&&(c.start=h+s*l)):y>r?v=n&&(l=u(c,p,f,g,_,n),x=!0),v>r&&y<=r&&(l=u(c,p,f,g,_,r),x=!0),!o&&x&&(a&&(c.end=h+s*l),t.push(c),c=K(e)),a&&(h+=s)}var b=e.length-3;p=e[b],f=e[b+1],m=e[b+2],(y=0===i?p:f)>=n&&y<=r&&Q(c,p,f,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&Q(c,c[0],c[1],c[2]),c.length&&t.push(c)}function K(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function J(e,t,n,r,i,o){for(var a=0;aa.maxX&&(a.maxX=u),h>a.maxY&&(a.maxY=h)}return a}function se(e,t,n,r){var i=t.geometry,o=t.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&t.size<(i?a:r))n.numPoints+=t.length/3;else{for(var s=[],l=0;la)&&(n.numSimplified++,s.push(t[l]),s.push(t[l+1])),n.numPoints++;i&&function(e,t){for(var n=0,r=0,i=e.length,o=i-2;r0===t)for(r=0,i=e.length;r24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var r=0;r1&&console.time("creation"),d=this.tiles[h]=ae(e,t,n,r,l),this.tileCoords.push({z:t,x:n,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(d.source=e,i){if(t===l.maxZoom||t===i)continue;var f=1<1&&console.time("clipping");var m,g,_,y,v,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,T=1+b;m=g=_=y=null,v=H(e,u,n-b,n+E,0,d.minX,d.maxX,l),x=H(e,u,n+w,n+T,0,d.minX,d.maxX,l),e=null,v&&(m=H(v,u,r-b,r+E,1,d.minY,d.maxY,l),g=H(v,u,r+w,r+T,1,d.minY,d.maxY,l),v=null),x&&(_=H(x,u,r-b,r+E,1,d.minY,d.maxY,l),y=H(x,u,r+w,r+T,1,d.minY,d.maxY,l),x=null),c>1&&console.timeEnd("clipping"),s.push(m||[],t+1,2*n,2*r),s.push(g||[],t+1,2*n,2*r+1),s.push(_||[],t+1,2*n+1,2*r),s.push(y||[],t+1,2*n+1,2*r+1)}}},ce.prototype.getTile=function(e,t,n){var r=this.options,i=r.extent,o=r.debug;if(e<0||e>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,c=e,u=t,h=n;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[ue(c,u,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,u,h),o>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,e,t,n),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ie(this.tiles[s],i):null):null};class de extends e.VectorTileWorkerSource{constructor(e,t,n,r,i){super(e,t,n,r,he),i&&(this.loadGeoJSON=i)}loadData(t,n){const r=t&&t.request,i=r&&r.collectResourceTiming;this.loadGeoJSON(t,((o,a)=>{if(o||!a)return n(o);if("object"!=typeof a)return n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{s(a,!0);try{if(t.filter){const n=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const r=a.features.filter((e=>n.value.evaluate({zoom:0},e)));a={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new P(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;const r={},i={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(n);for(const t of s){const[o,a]=n[t],s=e.createExpression(a),l=e.createExpression("string"==typeof o?[o,["accumulated"],["get",t]]:o);r[t]=s.value,i[t]=l.value}return t.map=e=>{a.properties=e;const t={};for(const e of s)t[e]=r[e].evaluate(o,a);return t},t.reduce=(e,t)=>{a.properties=t;for(const t of s)o.accumulated=e[t],e[t]=i[t].evaluate(o,a)},t}(t)).load(a.features):function(e,t){return new ce(e,t)}(a,t.geojsonVtOptions)}catch(o){return n(o)}this.loaded={};const l={};if(i){const n=e.getPerformanceMeasurement(r);n&&(l.resourceTiming={},l.resourceTiming[t.source]=JSON.parse(JSON.stringify(n)))}n(null,l)}}))}reloadTile(e,t){const n=this.loaded;return n&&n[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,n){if(t.request)e.getJSON(t.request,n);else{if("string"!=typeof t.data)return n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(t.data))}catch(e){return n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class pe{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:de},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,n){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],n()}checkIfReady(e,t,n){n()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,n){this.isSpriteLoaded[t]=n;for(const r in this.workerSources[t]){const i=this.workerSources[t][r];for(const t in i)i[t]instanceof e.VectorTileWorkerSource&&(i[t].isSpriteLoaded=n,i[t].fire(new e.Event("isSpriteLoaded")))}}setImages(e,t,n){this.availableImages[e]=t;for(const n in this.workerSources[e]){const r=this.workerSources[e][n];for(const e in r)r[e].availableImages=t}n()}enableTerrain(e,t,n){this.terrain=t,n()}setProjection(t,n){this.projections[t]=e.getProjection(n)}setLayers(e,t,n){this.getLayerIndex(e).replace(t),n()}updateLayers(e,t,n){this.getLayerIndex(e).update(t.layers,t.removedIds),n()}loadTile(t,n,r){const i=this.enableTerrain?e.extend({enableTerrain:this.terrain},n):n;i.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,n.type,n.source).loadTile(i,r)}loadDEMTile(t,n,r){const i=this.enableTerrain?e.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(t,n.source).loadTile(i,r)}reloadTile(t,n,r){const i=this.enableTerrain?e.extend({enableTerrain:this.terrain},n):n;i.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,n.type,n.source).reloadTile(i,r)}abortTile(e,t,n){this.getWorkerSource(e,t.type,t.source).abortTile(t,n)}removeTile(e,t,n){this.getWorkerSource(e,t.type,t.source).removeTile(t,n)}removeSource(e,t,n){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,n):n()}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,r){try{e.plugin.setState(n);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const n=e.plugin.isParsed();r(n?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),n)}}catch(e){r(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new r),t}getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){const r={send:(t,n,r,i,o,a)=>{this.actor.send(t,n,r,e,o,a)},scheduler:this.actor.scheduler};this.workerSources[e][t][n]=new this.workerSourceTypes[t](r,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])}return this.workerSources[e][t][n]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new i),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,n){e.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(e,t,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new pe(self)),pe})),i(["./shared"],(function(e){function t(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let r=0;r{e.window.removeEventListener("click",d,!0)}),0)}function f(e,t){const n=e.getBoundingClientRect();return _(e,n,t)}function m(e,t){const n=e.getBoundingClientRect(),r=[];for(let i=0;i=0?0:t.button}function _(t,n,r){const i=t.offsetWidth===n.width?1:t.offsetWidth/n.width;return new e.Point((r.clientX-n.left)*i,(r.clientY-n.top)*i)}function y(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],a=n*o-i*r;return a?(e[0]=o*(a=1/a),e[1]=-r*a,e[2]=-i*a,e[3]=n*a,e):null}function v(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class x extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}hasImage(e){return!!this.getImage(e)}getImage(e){return this.images[e]}addImage(e,t){this._validate(e,t)&&(this.images[e]=t)}_validate(t,n){let r=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(const r of e){if(r[0]{this.ready=!0}))}broadcast(t,n,r){e.asyncAll(this.actors,((e,r)=>{e.send(t,n,r)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}function I(t,n,r){return n*(e.EXTENT/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}A.Actor=e.Actor;class z{constructor(e,t,n,r){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,r)}static createFromScreenPoints(t,n){let r,i;if(t instanceof e.Point||"number"==typeof t[0]){const o=e.Point.convert(t);r=[o],i=n.isPointAboveHorizon(o)}else{const o=e.Point.convert(t[0]),a=e.Point.convert(t[1]);r=[o,a],i=e.polygonizeBounds(o,a).every((e=>n.isPointAboveHorizon(e)))}return new z(r,n.getCameraPoint(),i,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],i=e.polygonizeBounds(n,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=r.x?i[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(i[3]=this.cameraPoint)),e.bufferConvexPolygon(i,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],i=e.polygonizeBounds(n,r,t),o=this.cameraPoint.clone();switch(3*((o.y>n.y)+(o.y>r.y))+((o.x>n.x)+(o.x>r.x))){case 0:i[0]=o,i[4]=o.clone();break;case 1:i.splice(1,0,o);break;case 2:i[1]=o;break;case 3:i.splice(4,0,o);break;case 5:i.splice(2,0,o);break;case 6:i[3]=o;break;case 7:i.splice(3,0,o);break;case 8:i[2]=o}return i}containsTile(t,n,r,i=0){const o=t.queryPadding/n._pixelsPerMercatorPixel+1,a=r?this._bufferedCameraMercator(o,n):this._bufferedScreenMercator(o,n);let s=t.tileID.wrap+(a.unwrapped?i:0);const l=a.polygon.map((n=>e.getTilePoint(t.tileTransform,n,s)));if(!e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT))return;s=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?i:0);const c=this.screenGeometryMercator.polygon.map((n=>e.getTileVec3(t.tileTransform,n,s))),u=c.map((t=>new e.Point(t[0],t[1]))),h=n.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),d=e.getTileVec3(t.tileTransform,h,s),p=c.map((t=>{const n=e.sub(t,t,d);return e.normalize(n,n),new e.Ray(d,n)})),f=I(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.getBounds(l),m.min.x=e.clamp(m.min.x,0,e.EXTENT),m.min.y=e.clamp(m.min.y,0,e.EXTENT),m.max.x=e.clamp(m.max.x,0,e.EXTENT),m.max.y=e.clamp(m.max.y,0,e.EXTENT),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const n=D(e);if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[n]=r,r}}_bufferedCameraMercator(e,t){const n=D(e);if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[n]=r,r}}_projectAndResample(t,n){const r=function(t,n){const r=e.multiply([],n.pixelMatrix,n.globeMatrix),i=[0,-e.GLOBE_RADIUS,0,1],o=[0,e.GLOBE_RADIUS,0,1],a=[0,0,0,1];e.transformMat4$1(i,i,r),e.transformMat4$1(o,o,r),e.transformMat4$1(a,a,r);const s=new e.Point(i[0]/i[3],i[1]/i[3]),l=new e.Point(o[0]/o[3],o[1]/o[3]),c=e.polygonContainsPoint(t,s)&&i[3]1?P(t.slice(0,d),n):[],m=dnew e.Point(L(t.x),t.y))),m=m.map((t=>new e.Point(L(t.x),t.y)));const g=[...f];0===g.length&&g.push(m[m.length-1]);const _=e.number(g[g.length-1].y,(0===m.length?f[0]:m[0]).y,p);let y;return y=c?[new e.Point(0,_),new e.Point(0,0),new e.Point(1,0),new e.Point(1,_)]:[new e.Point(1,_),new e.Point(1,1),new e.Point(0,1),new e.Point(0,_)],g.push(...y),0===m.length?g.push(f[0]):g.push(...m),{polygon:g.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:!1}}(t,n);if(r)return r;const i=function(t,n){let r=!1,i=-1/0,o=0;for(let e=0;ei&&(i=t[e].x,o=e);for(let e=0;e.5&&(i.x{e.x-=1})),{polygon:t,unwrapped:r}}(P(t,n).map((t=>new e.Point(L(t.x),t.y))),n);return{polygon:i.polygon.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:i.unwrapped}}}function P(t,n){return e.resample(t,(e=>{const t=n.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function L(e){return e<0?1+e%1:e%1}function D(e){return 100*e|0}function R(t,n,r,i,o){const a=function(r,i){if(r)return o(r);if(i){t.url&&i.tiles&&t.tiles&&delete t.tiles;const r=e.pick(e.extend(i,t),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);i.vector_layers&&(r.vectorLayers=i.vector_layers,r.vectorLayerIds=r.vectorLayers.map((e=>e.id))),r.tiles=n.canonicalizeTileset(r,t.url),o(null,r)}};return t.url?e.getJSON(n.transformRequest(n.normalizeSourceURL(t.url,null,r,i),e.ResourceType.Source),a):e.exported.frame((()=>a(null,t)))}class O{constructor(t,n,r){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),r=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*n),i=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*n),o=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*n),a=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=r&&t.x=i&&t.y{this._tileJSONRequest=null,this._loaded=!0,i?(n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),r&&2!==r.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.ErrorEvent(i))):o&&(e.extend(this,o),o.bounds&&(this.tileBounds=new O(o.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>this.map.style._clearSource(this.id)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}loadTile(t,n){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),i={request:this.map._requestManager.transformRequest(r,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(i.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=n:t.request=t.actor.send("reloadTile",i,o.bind(this));else if(t.actor=this._tileWorkers[r]=this._tileWorkers[r]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",i,o.bind(this),void 0,!0);else{const n=e.loadVectorTile.call({deduped:this._deduped},i,((e,n)=>{e||!n?o.call(this,e):(i.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},t.actor&&t.actor.send("loadTile",i,o.bind(this),void 0,!0))}),!0);t.request={cancel:n}}function o(r,i){return delete t.request,t.aborted?n(null):r&&404!==r.status?n(r):(i&&i.resourceTiming&&(t.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&t.setExpiryData(i),t.loadVectorData(i,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id})}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ke extends e.Evented{constructor(t,n,r,i){super(),this.id=t,this.dispatcher=r,this.setEventedParent(i),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.extend({type:"raster"},n),e.extend(this,e.pick(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=R(this._options,this.map._requestManager,null,null,((n,r)=>{this._tileJSONRequest=null,this._loaded=!0,n?this.fire(new e.ErrorEvent(n)):r&&(e.extend(this,r),r.bounds&&(this.tileBounds=new O(r.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(r.tiles),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>this.map.style._clearSource(this.id)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,n){const r=e.exported.devicePixelRatio>=2,i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(i,e.ResourceType.Tile),((r,i,o,a)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):r?(t.state="errored",n(r)):i?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:a}),t.setTexture(i,this.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(this.dispatcher),void n(null)):n(null))))}static loadTileData(e,t,n){e.setTexture(t,n)}static unloadTileData(e,t){e.texture&&t.saveTileTexture(e.texture)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Me(t,n,r,i,o,a,s,l){const c=[t,r,o,n,i,a,1,1,1],u=[s,l,1],h=e.adjoint([],c),[d,p,f]=e.transformMat3(u,u,e.transpose(h,h));return e.multiply$1(c,[d,0,0,0,p,0,0,0,f],c)}class Ce extends e.Evented{constructor(e,t,n,r){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t,this._dirty=!1}load(t,n){this._loaded=n||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),((n,r)=>{if(this._imageRequest=null,this._loaded=!0,n)this.fire(new e.ErrorEvent(n));else if(r){const{HTMLImageElement:n}=e.window;this.image=r instanceof n?e.exported.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading()}}))}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(t){this.coordinates=t,this._boundsArray=void 0;const n=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){let n=1/0,r=1/0,i=-1/0,o=-1/0;for(const e of t)n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x),o=Math.max(o,e.y);const a=Math.max(i-n,o-r),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new e.CanonicalTileID(s,Math.floor((n+i)/2*l),Math.floor((r+o)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(t){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray)return;const n=e.tileTransform(this.tileID,this.map.transform.projection),[r,i,o,a]=this.coordinates.map((t=>{const r=n.projection.project(t[0],t[1]);return e.getTilePoint(n,r)._round()}));this.perspectiveTransform=function(t,n,r,i,o,a,s,l,c,u){const h=Me(0,0,t,0,0,n,t,n),d=Me(r,i,o,a,s,l,c,u);return e.multiply$1(d,e.adjoint(h,h),d),[d[6]/d[8]*t/e.EXTENT,d[7]/d[8]*n/e.EXTENT]}(this.width,this.height,r.x,r.y,i.x,i.y,a.x,a.y,o.x,o.y);const s=this._boundsArray=new e.StructArrayLayout4i8;s.emplaceBack(r.x,r.y,0,0),s.emplaceBack(i.x,i.y,e.EXTENT,0),s.emplaceBack(a.x,a.y,0,e.EXTENT),s.emplaceBack(o.x,o.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(s,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,n=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Ae={vector:Se,raster:ke,"raster-dem":class extends ke{constructor(t,n,r,i){super(t,n,r,i),this.type="raster-dem",this.maxzoom=22,this._options=e.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(t,n){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function i(e,r){e&&(t.state="errored",n(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",n(null))}t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),function(r,o,a,s){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(r)t.state="errored",n(r);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:a,expires:s});const n=e.window.ImageBitmap&&o instanceof e.window.ImageBitmap&&(null==ae&&(ae=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),ae),r=1-(o.width-e.prevPowerOfTwo(o.width))/2;r<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=n?o:e.exported.getImageData(o,r),c={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:r};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",c,i.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const n=t.canonical,r=Math.pow(2,n.z),i=(n.x-1+r)%r,o=0===n.x?t.wrap-1:t.wrap,a=(n.x+1+r)%r,s=n.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,o,n.z,i,n.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,a,n.y).key]={backfilled:!1},n.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,o,n.z,i,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,a,n.y-1).key]={backfilled:!1}),n.y+1{if(this._loaded=!0,this._pendingLoad=null,t)this.fire(new e.ErrorEvent(t));else{const t={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(t.resourceTiming=n.resourceTiming[this.id]),this.fire(new e.Event("data",t)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(t,n){const r=t.actor?"reloadTile":"loadTile";t.actor=this.actor,t.request=this.actor.send(r,{type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},((e,i)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):e?n(e):(t.loadVectorData(i,this.map.painter,"reloadTile"===r),n(null)))),void 0,"loadTile"===r)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Ce{constructor(e,t,n,r){super(e,t,n,r),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,e.ResourceType.Source).url);e.getVideo(this.urls,((t,n)=>{this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Ce,canvas:class extends Ce{constructor(t,n,r,i){super(t,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof e.window.HTMLCanvasElement||this.fire(new e.ErrorEvent(new e.ValidationError(`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.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let 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 n=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(n,this.canvas,n.gl.RGBA,{premultiply:!0}),this._prepareData(n)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.Evented{constructor(t,n,r,i){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=n,this.setEventedParent(i),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new O(this._implementation.bounds,this.minzoom,this.maxzoom)),n.update=this._update.bind(this),n.clearTiles=this._clearTiles.bind(this),n.coveringTiles=this._coveringTiles.bind(this),e.extend(this,e.pick(n,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this._map=t,this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:n,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:n,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,n){const{x:r,y:i,z:o}=t.tileID.canonical,a=new e.window.AbortController;t.request=Promise.resolve(this._implementation.loadTile({x:r,y:i,z:o},{signal:a.signal})).then(function(r){return delete t.request,t.aborted?(t.state="unloaded",n(null)):void 0===r?(t.state="errored",n(null)):null===r?(this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",n(null)):function(t){return t instanceof e.window.ImageData||t instanceof e.window.HTMLCanvasElement||t instanceof e.window.ImageBitmap||t instanceof e.window.HTMLImageElement}(r)?(this.loadTileData(t,r),t.state="loaded",void n(null)):(t.state="errored",n(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((e=>{20!==e.code&&(t.state="errored",n(e))})),t.request.cancel=()=>a.abort()}loadTileData(e,t){ke.loadTileData(e,t,this._map.painter)}unloadTileData(e){ke.unloadTileData(e,this._map.painter)}unloadTile(e,t){if(this.unloadTileData(e),this._implementation.unloadTile){const{x:t,y:n,z:r}=e.tileID.canonical;this._implementation.unloadTile({x:t,y:n,z:r})}t()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}}},Ie=function(t,n,r,i){const o=new Ae[n.type](t,n,r,i);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.bindAll(["load","abort","unload","serialize","prepare"],o),o};function ze(t,n){const r=e.identity([]);return e.scale(r,r,[.5*t.width,.5*-t.height,1]),e.translate(r,r,[1,-1,0]),e.multiply(r,r,t.calculateProjMatrix(n.toUnwrapped())),Float32Array.from(r)}function Pe(e,t,n,r,i,o,a,s=!1){const l=e.tilesIn(r,a,s);l.sort(De);const c=[];for(const r of l)c.push({wrappedTileID:r.tile.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e._state,r,i,o,ze(e.transform,r.tile.tileID),s)});const u=function(e){const t={},n={};for(const r of e){const e=r.queryResults,i=r.wrappedTileID,o=n[i]=n[i]||{};for(const n in e){const r=e[n],i=o[n]=o[n]||{},a=t[n]=t[n]||[];for(const e of r)i[e.featureIndex]||(i[e.featureIndex]=!0,a.push(e))}}return t}(c);for(const t in u)u[t].forEach((t=>{const n=t.feature,r=n.layer;r&&"background"!==r.type&&"sky"!==r.type&&(n.source=r.source,r["source-layer"]&&(n.sourceLayer=r["source-layer"]),n.state=void 0!==n.id?e.getFeatureState(r["source-layer"],n.id):{})}));return u}function Le(e,t){const n=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],i={};for(let e=0;e{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Oe]}numActive(){return Object.keys(this.active).length}}let Fe;function Ne(){return Fe||(Fe=new Be),Fe}function je(t,n){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);return e.refProperties.forEach((e=>{e in n&&(r[e]=n[e])})),r}function Ue(e){e=e.slice();const t=Object.create(null);for(let n=0;n0?(i-a)/s:0;return this.points[o].mult(1-l).add(this.points[n].mult(l))}}class Ke{constructor(e,t,n){const r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;ethis.width||r<0||t>this.height)return!i&&[];const a=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return!0;for(let e=0;e0:a}_queryCircle(e,t,n,r,i){const o=e-n,a=e+n,s=t-n,l=t+n;if(a<0||o>this.width||l<0||s>this.height)return!r&&[];const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),r?c.length>0:c}query(e,t,n,r,i){return this._query(e,t,n,r,!1,i)}hitTest(e,t,n,r,i){return this._query(e,t,n,r,!0,i)}hitTestCircle(e,t,n,r){return this._queryCircle(e,t,n,!0,r)}_queryCell(e,t,n,r,i,o,a,s){const l=a.seenUids,c=this.boxCells[i];if(null!==c){const i=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=i[c+2]&&t<=i[c+3]&&n>=i[c+0]&&r>=i[c+1]&&(!s||s(this.boxKeys[u]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:i[c],y1:i[c+1],x2:i[c+2],y2:i[c+3]})}}}const u=this.circleCells[i];if(null!==u){const i=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(i[u],i[u+1],i[u+2],e,t,n,r)&&(!s||s(this.circleKeys[c]))){if(a.hitTest)return o.push(!0),!0;{const e=i[u],t=i[u+1],n=i[u+2];o.push({key:this.circleKeys[c],x1:e-n,y1:t-n,x2:e+n,y2:t+n})}}}}}_queryCellCircle(e,t,n,r,i,o,a,s){const l=a.circle,c=a.seenUids,u=this.boxCells[i];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const n=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[i];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const n=3*t;if(this._circlesCollide(e[n],e[n+1],e[n+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,n,r,i,o,a,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),h=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(i.call(this,e,t,n,r,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,o){const a=r-e,s=i-t,l=n+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,n,r,i,o,a){const s=(o-r)/2,l=Math.abs(e-(r+s));if(l>s+n)return!1;const c=(a-i)/2,u=Math.abs(t-(i+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=n*n}}const Je={unknown:0,flipRequired:1,flipNotRequired:2},Qe=Math.tan(85*Math.PI/180);function et(t,n,r,i,o,a,s){const l=e.create();if(r)if("globe"===a.name){const t=e.calculateGlobeLabelMatrix(o,n);e.multiply(l,l,t)}else{const t=y([],s);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],i||e.rotateZ(l,l,o.angle)}else e.multiply(l,o.labelPlaneMatrix,t);return l}function tt(e,t,n,r,i,o,a){const s=et(e,t,n,r,i,o,a);return"globe"===o.name&&n||(s[2]=s[6]=s[10]=s[14]=0),s}function nt(t,n,r,i,o,a,s){if(r){if("globe"===a.name){const l=et(t,n,r,i,o,a,s);return e.invert(l,l),e.multiply(l,t,l),l}{const n=e.clone(t),r=e.identity([]);return r[0]=s[0],r[1]=s[1],r[4]=s[2],r[5]=s[3],e.multiply(n,n,r),i||e.rotateZ(n,n,-o.angle),n}}return o.glCoordMatrix}function rt(t,n,r,i){const o=[t,n,r,1];r?e.transformMat4$1(o,o,i):ft(o,o,i);const a=o[3];return o[0]/=a,o[1]/=a,o[2]/=a,o}function it(e,t){return Math.min(.5+e/t*.5,1.5)}function ot(e,t){const n=e[0]/e[3],r=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&r>=-t[1]&&r<=t[1]}function at(t,n,r,i,o,a,s,l,c,u){const h=r.transform,d=i?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,r.transform.zoom),f="globe"===h.projection.name,m=[256/r.width*2+1,256/r.height*2+1],g=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let _=null;f&&(_=i?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const y=t.lineVertexArray,v=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=r.transform.width/r.transform.height;let b,w=!1;for(let i=0;iMath.abs(r)?{useVertical:!0}:t===e.WritingMode.vertical?i>0?{needsFlipping:!0}:null:n!==Je.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Qe}(r,i)?n===Je.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function ct(t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v){const x=n/24,b=t.lineOffsetX*x,w=t.lineOffsetY*x,{lineStartIndex:E,glyphStartIndex:T,numGlyphs:S,segment:k,writingMode:M,flipState:C}=t,A=E+t.lineLength,I=t=>{if(h){const[n,r,i]=t.up,o=u.length;e.updateGlobeVertexNormal(h,o+0,n,r,i),e.updateGlobeVertexNormal(h,o+1,n,r,i),e.updateGlobeVertexNormal(h,o+2,n,r,i),e.updateGlobeVertexNormal(h,o+3,n,r,i)}const[n,r,i]=t.point;e.addDynamicAttributes(u,n,r,i,t.angle)};if(S>1){const e=st(x,l,b,w,r,d,p,t,c,a,f,g,!1,_,y,v);if(!e)return{notEnoughRoom:!0};if(i&&!r){let[n,r,i]=e.first.point,[o,a,l]=e.last.point;[n,r]=rt(n,r,i,s),[o,a]=rt(o,a,l,s);const c=lt(M,C,(o-n)*m,a-r);if(t.flipState=c&&c.needsFlipping?Je.flipRequired:Je.flipNotRequired,c)return c}I(e.first);for(let e=T+1;e0?a:ht(p,i,n,1,o,void 0,_,y.canonical),l=lt(M,C,(s[0]-n[0])*m,s[1]-n[1]);if(t.flipState=l&&l.needsFlipping?Je.flipRequired:Je.flipNotRequired,l)return l}const n=dt(x*l.getoffsetX(T),b,w,r,d,p,k,E,A,c,a,f,g,!1,!1,_,y,v);if(!n)return{notEnoughRoom:!0};I(n)}return{}}function ut(e,t,n,r,i){const{x:o,y:a,z:s}=r.projectTilePoint(e.x,e.y,t);if(!i)return rt(o,a,s,n);const[l,c,u]=i(e);return rt(o+l,a+c,s+u,n)}function ht(t,n,r,i,o,a,s,l){const c=ut(t.sub(n)._unit()._add(t),l,o,s,a);return e.sub(c,r,c),e.normalize(c,c),e.scaleAndAdd(c,r,c,i)}function dt(t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_,y){const v=i?t-n:t+n;let x=v>0?1:-1,b=0;i&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);let w=l+s+(x>0?0:1)|0,E=o,T=o,S=0,k=0;const M=Math.abs(v),C=[],A=[];let I=a,z=I;const P=()=>ht(z,I,T,M-S+1,h,p,g,_.canonical);for(;S+k<=M;){if(w+=x,w=c)return null;if(T=E,z=I,C.push(T),f&&A.push(z),I=new e.Point(u.getx(w),u.gety(w)),E=d[w],!E){const e=ut(I,_.canonical,h,g,p);E=e[3]>0?d[w]=e:P()}S+=k,k=e.distance(T,E)}m&&p&&(d[w]&&(E=P(),k=e.distance(T,E)),d[w]=E);const L=(M-S)/k,D=I.sub(z)._mult(L)._add(z),R=e.sub([],E,T),O=e.scaleAndAdd([],T,R,L);let B=[0,0,1],F=R[0],N=R[1];if(y&&(B=g.upVector(_.canonical,D.x,D.y),0!==B[0]||0!==B[1]||1!==B[2])){const t=[B[2],0,-B[0]],n=e.cross([],B,t);e.normalize(t,t),e.normalize(n,n),F=e.dot(R,t),N=e.dot(R,n)}if(r){const t=e.cross([],B,R);e.normalize(t,t),e.scaleAndAdd(O,O,t,r*x)}const j=b+Math.atan2(N,F);return C.push(O),f&&A.push(D),{point:O,angle:j,path:C,tilePath:A,up:B}}function pt(e,t){const n=t.length,r=n+4*e;t.resize(r),t.float32.fill(-1/0,4*n,4*r)}function ft(e,t,n){const r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}const mt=100;class gt{constructor(e,t,n=new Ke(e.width+200,e.height+200,25),r=new Ke(e.width+200,e.height+200,25)){this.transform=e,this.grid=n,this.ignoredGrid=r,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+mt,this.screenBottomBoundary=e.height+mt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t}placeCollisionBox(e,t,n,r,i,o,a,s){let l=n.projectedAnchorX,c=n.projectedAnchorY,u=n.projectedAnchorZ;const h=n.elevation,d=n.tileID,p=e.getProjection();if(h&&d){const[e,t,r]=p.upVector(d.canonical,n.tileAnchorX,n.tileAnchorY),i=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e*h*i,c+=t*h*i,u+=r*h*i}const f=this.projectAndGetPerspectiveRatio(a,l,c,u,n.tileID,"globe"===p.name||!!h||this.transform.pitch>0,p),m=o*f.perspectiveRatio,g=(n.x1*t+r.x-n.padding)*m+f.point.x,_=(n.y1*t+r.y-n.padding)*m+f.point.y,y=(n.x2*t+r.x+n.padding)*m+f.point.x,v=(n.y2*t+r.y+n.padding)*m+f.point.y,x=f.perspectiveRatio<=.55||f.occluded;return!this.isInsideGrid(g,_,y,v)||!i&&this.grid.hitTest(g,_,y,v,s)||x?{box:[],offscreen:!1,occluded:f.occluded}:{box:[g,_,y,v],offscreen:this.isOffscreen(g,_,y,v),occluded:!1}}placeCollisionCircles(t,n,r,i,o,a,s,l,c,u,h,d,p,f,m){const g=[],_=this.transform.elevation,y=t.getProjection(),v=_?_.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,y):null,x=new e.Point(r.tileAnchorX,r.tileAnchorY);let{x:b,y:w,z:E}=y.projectTilePoint(x.x,x.y,m.canonical);if(v){const[e,t,n]=v(x);b+=e,w+=t,E+=n}const T="globe"===y.name,S=this.projectAndGetPerspectiveRatio(s,b,w,E,m,T||!!_||this.transform.pitch>0,y),{perspectiveRatio:k}=S,M=(h?a/k:a*k)/e.ONE_EM,C=rt(b,w,E,l),A=S.signedDistanceFromCamera>0?st(M,o,r.lineOffsetX*M,r.lineOffsetY*M,!1,C,x,r,i,l,{},_&&!h?v:null,h&&!!_,y,m,h):null;let I=!1,z=!1,P=!0;if(A&&!S.occluded){const t=.5*p*k+f,r=new e.Point(-100,-100),i=new e.Point(this.screenRightBoundary,this.screenBottomBoundary),o=new Ye,{first:a,last:s}=A,l=a.path.length;let h=[];for(let e=l-1;e>=1;e--)h.push(a.path[e]);for(let e=1;e(v&&!T&&(n=v(re[3]<=0))&&(h=[]));let _=[];if(h.length>0){let t=1/0,n=-1/0,o=1/0,a=-1/0;for(const e of h)t=Math.min(t,e[0]),o=Math.min(o,e[1]),n=Math.max(n,e[0]),a=Math.max(a,e[1]);n>=r.x&&t<=i.x&&a>=r.y&&o<=i.y&&(_=[h.map((t=>new e.Point(t[0],t[1])))],(ti.x||oi.y)&&(_=e.clipLine(_,r.x,r.y,i.x,i.y)))}for(const e of _){o.reset(e,.25*t);let r=0;r=o.length<=.5*t?1:Math.ceil(o.paddedLength/m)+1;for(let e=0;e0){if(e.transformMat4$1(l,l,t),this.fogState&&o&&"globe"!==s.name){const t=function(t,n,r,i,o,a){const s=a.calculateFogTileMatrix(o),l=[n,r,i];return e.transformMat4(l,l,s),S(t,l,a.pitch,a._fov)}(this.fogState,n,r,i,o.toUnwrapped(),this.transform);c=t>.9}}else ft(l,l,t);const u=l[3];return{point:new e.Point((l[0]/u+1)/2*this.transform.width+mt,(-l[1]/u+1)/2*this.transform.height+mt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(s)/u*.5,1.5),signedDistanceFromCamera:u,occluded:a&&l[2]>u||c}}isOffscreen(e,t,n,r){return n=this.screenRightBoundary||rthis.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function kt(t,n,r,i,o){const{horizontalAlign:a,verticalAlign:s}=e.getAnchorAlignment(t),l=-(a-.5)*n,c=-(s-.5)*r,u=e.evaluateVariableOffset(t,i);return new e.Point(l+u[0]*o,c+u[1]*o)}function Mt(t,n,r,i,o){const a=new e.Point(t,n);return r&&a._rotate(i?o:-o),a}class Ct{constructor(e,t,n,r,i){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new gt(this.transform,i),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new St(n),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,r,i){const o=r.getBucket(n),a=r.latestFeatureIndex;if(!o||!a||n.id!==o.layerIds[0])return;const s=o.layers[0].layout,l=r.collisionBoxArray,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.EXTENT,h=r.tileID.toUnwrapped();this.transform.setProjection(o.projection);const d=(p=r.tileID,f=o.getProjection(),m=this.transform,f.name===this.projection?m.calculateProjMatrix(p.toUnwrapped()):_t(m,f,p));var p,f,m;const g="map"===s.get("text-pitch-alignment"),_="map"===s.get("text-rotation-alignment");n.compileFilter();const y=n.dynamicFilter(),v=n.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(r),b=tt(d,r.tileID.canonical,g,_,this.transform,o.getProjection(),x);let w=null;if(g){const t=nt(d,r.tileID.canonical,g,_,this.transform,o.getProjection(),x);w=e.multiply([],this.transform.labelPlaneMatrix,t)}let E=null;y&&r.latestFeatureIndex&&(E={unwrappedTileID:h,dynamicFilter:y,dynamicFilterNeedsFeature:v,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[o.bucketInstanceId]=new Tt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);const T={bucket:o,layout:s,posMatrix:d,textLabelPlaneMatrix:b,labelToScreenMatrix:w,clippingData:E,scale:c,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.evaluateSizeForZoom(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(const e of o.sortKeyRanges){const{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=e;t.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:T})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:T})}attemptAnchorPlacement(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g,_){const{textOffset0:y,textOffset1:v,crossTileID:x}=h,b=[y,v],w=kt(e,n,r,b,i),E=this.collisionIndex.placeCollisionBox(p,i,t,Mt(w.x,w.y,o,a,this.transform.angle),u,s,l,c.predicate);if(m){const e=p.getSymbolInstanceIconSize(_,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,m,Mt(w.x,w.y,o,a,this.transform.angle),u,s,l,c.predicate).box.length)return}if(E.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[x]&&this.prevPlacement.placements[x]&&this.prevPlacement.placements[x].text&&(t=this.prevPlacement.variableOffsets[x].anchor),this.variableOffsets[x]={textOffset:b,width:n,height:r,anchor:e,textScale:i,prevAnchor:t},this.markUsedJustification(p,e,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[x]=f),{shift:w,placedGlyphBoxes:E}}}placeLayerBucketPart(t,n,r,i){const{bucket:o,layout:a,posMatrix:s,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:u,textPixelRatio:h,holdingForFade:d,collisionBoxArray:p,partiallyEvaluatedTextSize:f,partiallyEvaluatedIconSize:m,collisionGroup:g}=t.parameters,_=a.get("text-optional"),y=a.get("icon-optional"),v=a.get("text-allow-overlap"),x=a.get("icon-allow-overlap"),b="map"===a.get("text-rotation-alignment"),w="map"===a.get("text-pitch-alignment"),E="none"!==a.get("icon-text-fit"),T="viewport-y"===a.get("symbol-z-order");this.transform.setProjection(o.projection);let S=v&&(x||!o.hasIconData()||y),k=x&&(v||!o.hasTextData()||_);!o.collisionArrays&&p&&o.deserializeCollisionBoxes(p),r&&i&&o.updateCollisionDebugBuffers(this.transform.zoom,p);const M=(t,i,p)=>{const{crossTileID:T,numVerticalGlyphVertices:M}=t;if(u){const r={zoom:this.transform.zoom,pitch:this.transform.pitch};let i=null;if(u.dynamicFilterNeedsFeature){const e=this.retainedQueryData[o.bucketInstanceId];i=u.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,u.dynamicFilter)(r,i,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.Point(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[T]=new wt(!1,!1,!1,!0),void n.add(T)}if(n.has(T))return;if(d)return void(this.placements[T]=new wt(!1,!1,!1));let C=!1,A=!1,I=!0,z=!1,P=!1,L=null,D={box:null,offscreen:null,occluded:null},R={box:null,offscreen:null,occluded:null},O=null,B=null,F=null,N=0,j=0,U=0;p.textFeatureIndex?N=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(N=t.featureIndex),p.verticalTextFeatureIndex&&(j=p.verticalTextFeatureIndex);const V=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID;const t=this.transform.elevation;(t||e.elevation)&&(e.elevation=t?t.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},$=p.textBox;if($){V($);const n=n=>{let r=e.WritingMode.horizontal;if(o.allowVerticalPlacement&&!n&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[T];e&&(this.placedOrientations[T]=e,r=e,this.markUsedOrientation(o,r,t))}return r},r=(t,n)=>{if(o.allowVerticalPlacement&&M>0&&p.verticalTextBox){for(const r of o.writingModes)if(r===e.WritingMode.vertical?(D=n(),R=D):D=t(),D&&D.box&&D.box.length)break}else D=t()};if(a.get("text-variable-anchor")){let l=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[T]){const e=this.prevPlacement.variableOffsets[T];l.indexOf(e.anchor)>0&&(l=l.filter((t=>t!==e.anchor)),l.unshift(e.anchor))}const c=(e,n,r)=>{const a=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,i),c=(e.x2-e.x1)*a+2*e.padding,u=(e.y2-e.y1)*a+2*e.padding,d=E&&!x?n:null;d&&V(d);let p={box:[],offscreen:!1,occluded:!1};const _=v?2*l.length:l.length;for(let n=0;n<_;++n){const _=this.attemptAnchorPlacement(l[n%l.length],e,c,u,a,b,w,h,s,g,n>=l.length,t,i,o,r,d,f,m);if(_&&(p=_.placedGlyphBoxes,p&&p.box&&p.box.length)){C=!0,L=_.shift;break}}return p};r((()=>c($,p.iconBox,e.WritingMode.horizontal)),(()=>{const t=p.verticalTextBox;return t&&V(t),o.allowVerticalPlacement&&!(D&&D.box&&D.box.length)&&M>0&&t?c(t,p.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),D&&(C=D.box,I=D.offscreen,z=D.occluded);const u=n(!(!D||!D.box));if(!C&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[T];e&&(this.variableOffsets[T]=e,this.markUsedJustification(o,e.anchor,t,u))}}else{const a=(n,r)=>{const a=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,i),l=this.collisionIndex.placeCollisionBox(o,a,n,new e.Point(0,0),v,h,s,g.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,r,t),this.placedOrientations[T]=r),l};r((()=>a($,e.WritingMode.horizontal)),(()=>{const t=p.verticalTextBox;return o.allowVerticalPlacement&&M>0&&t?(V(t),a(t,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),n(!!(D&&D.box&&D.box.length))}}if(O=D,C=O&&O.box&&O.box.length>0,I=O&&O.offscreen,z=O&&O.occluded,t.useRuntimeCollisionCircles){const n=o.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),i=e.evaluateSizeForFeature(o.textSizeData,f,n),u=a.get("text-padding");B=this.collisionIndex.placeCollisionCircles(o,v,n,o.lineVertexArray,o.glyphOffsetArray,i,s,l,c,r,w,g.predicate,t.collisionCircleDiameter*i/e.ONE_EM,u,this.retainedQueryData[o.bucketInstanceId].tileID),C=v||B.circles.length>0&&!B.collisionDetected,I=I&&B.offscreen,z=B.occluded}if(p.iconFeatureIndex&&(U=p.iconFeatureIndex),p.iconBox){const n=n=>{V(n);const r=E&&L?Mt(L.x,L.y,b,w,this.transform.angle):new e.Point(0,0),i=o.getSymbolInstanceIconSize(m,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,i,n,r,x,h,s,g.predicate)};R&&R.box&&R.box.length&&p.verticalIconBox?(F=n(p.verticalIconBox),A=F.box.length>0):(F=n(p.iconBox),A=F.box.length>0),I=I&&F.offscreen,P=F.occluded}const G=_||0===t.numHorizontalGlyphVertices&&0===M,Z=y||0===t.numIconVertices;if(G||Z?Z?G||(A=A&&C):C=A&&C:A=C=A&&C,C&&O&&O.box&&this.collisionIndex.insertCollisionBox(O.box,a.get("text-ignore-placement"),o.bucketInstanceId,R&&R.box&&j?j:N,g.ID),A&&F&&this.collisionIndex.insertCollisionBox(F.box,a.get("icon-ignore-placement"),o.bucketInstanceId,U,g.ID),B&&(C&&this.collisionIndex.insertCollisionCircles(B.circles,a.get("text-ignore-placement"),o.bucketInstanceId,N,g.ID),r)){const e=o.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Et);for(let e=0;e=0;--t){const n=e[t];M(o.symbolInstances.get(n),n,o.collisionArrays[n])}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:c)}markUsedOrientation(t,n,r){const i=n===e.WritingMode.horizontal||n===e.WritingMode.horizontalOnly?n:0,o=n===e.WritingMode.vertical?n:0,{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=r,u=t.text.placedSymbolArray;a>=0&&(u.get(a).placedOrientation=i),s>=0&&(u.get(s).placedOrientation=i),l>=0&&(u.get(l).placedOrientation=i),c>=0&&(u.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=i[e];o?(this.opacities[e]=new bt(o,r,t.text,t.icon,null,t.clipped),n=n||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new bt(null,r,t.text,t.icon,t.skipFade,t.clipped),n=n||t.text||t.icon)}for(const e in i){const t=i[e];if(!this.opacities[e]){const i=new bt(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n=n||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in a)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=a[e]);n?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const n=new Set;for(const r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n,r.collisionBoxArray)}}updateBucketOpacities(t,n,r){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const i=t.layers[0].layout,o=!!t.layers[0].dynamicFilter(),a=new bt(null,0,!1,!1,!0),s=i.get("text-allow-overlap"),l=i.get("icon-allow-overlap"),c=i.get("text-variable-anchor"),u="map"===i.get("text-rotation-alignment"),h="map"===i.get("text-pitch-alignment"),d="none"!==i.get("icon-text-fit"),p=new bt(null,0,s&&(l||!t.hasIconData()||i.get("icon-optional")),l&&(s||!t.hasTextData()||i.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);const f=(e,t,n)=>{for(let r=0;r0||l>0,b=_>0,w=this.placedOrientations[g],E=w===e.WritingMode.vertical,T=w===e.WritingMode.horizontal||w===e.WritingMode.horizontalOnly;if(!x&&!b||v.isHidden()||m++,x){const e=Bt(v.text);f(t.text,s,E?Ft:e),f(t.text,l,T?Ft:e);const n=v.text.isHidden(),{leftJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:c}=i,u=t.text.placedSymbolArray,h=n||E?1:0;r>=0&&(u.get(r).hidden=h),o>=0&&(u.get(o).hidden=h),a>=0&&(u.get(a).hidden=h),c>=0&&(u.get(c).hidden=n||T?1:0);const d=this.variableOffsets[g];d&&this.markUsedJustification(t,d.anchor,i,w);const p=this.placedOrientations[g];p&&(this.markUsedJustification(t,"left",i,p),this.markUsedOrientation(t,p,i))}if(b){const e=Bt(v.icon),{placedIconSymbolIndex:n,verticalPlacedIconSymbolIndex:r}=i,o=t.icon.placedSymbolArray,a=v.icon.isHidden()?1:0;n>=0&&(f(t.icon,_,E?Ft:e),o.get(n).hidden=a),r>=0&&(f(t.icon,i.numVerticalIconVertices,T?Ft:e),o.get(r).hidden=a)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const n=t.collisionArrays[r];if(n){let r=new e.Point(0,0),i=!0;if(n.textBox||n.verticalTextBox){if(c){const e=this.variableOffsets[g];e?(r=kt(e.anchor,e.width,e.height,e.textOffset,e.textScale),u&&r._rotate(h?this.transform.angle:-this.transform.angle)):i=!1}o&&(i=!v.clipped),n.textBox&&At(t.textCollisionBox.collisionVertexArray,v.text.placed,!i||E,r.x,r.y),n.verticalTextBox&&At(t.textCollisionBox.collisionVertexArray,v.text.placed,!i||T,r.x,r.y)}const a=i&&Boolean(!T&&n.verticalIconBox);n.iconBox&&At(t.iconCollisionBox.collisionVertexArray,v.icon.placed,a,d?r.x:0,d?r.y:0),n.verticalIconBox&&At(t.iconCollisionBox.collisionVertexArray,v.icon.placed,!a,d?r.x:0,d?r.y:0)}}}if(t.fullyClipped=0===m,t.sortFeatures(this.transform.angle),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.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function At(e,t,n,r,i){e.emplaceBack(t?1:0,n?1:0,r||0,i||0),e.emplaceBack(t?1:0,n?1:0,r||0,i||0),e.emplaceBack(t?1:0,n?1:0,r||0,i||0),e.emplaceBack(t?1:0,n?1:0,r||0,i||0)}const It=Math.pow(2,25),zt=Math.pow(2,24),Pt=Math.pow(2,17),Lt=Math.pow(2,16),Dt=Math.pow(2,9),Rt=Math.pow(2,8),Ot=Math.pow(2,1);function Bt(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,n=Math.floor(127*e.opacity);return n*It+t*zt+n*Pt+t*Lt+n*Dt+t*Rt+n*Ot+t}const Ft=0;class Nt{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,n,r,i){const o=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex{const t=e.exported.now()-i;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=n[t[this._currentPlacementIndex]],i=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=i)&&(!e.maxzoom||e.maxzoom>i)){if(this._inProgressLayer||(this._inProgressLayer=new Nt(e)),this._inProgressLayer.continuePlacement(r[e.source],this.placement,this._showCollisionBoxes,e,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ut=512/e.EXTENT/2;class Vt{constructor(t,n,r){this.tileID=t,this.bucketInstanceId=r,this.index=new e.KDBush(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const i=t.canonical.x*e.EXTENT,o=t.canonical.y*e.EXTENT;for(let e=0;ee.overscaledZ)for(const n in i){const o=i[n];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=i[e.scaledTo(Number(n)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const qt=(t,n)=>e.emitValidationErrors(t,n&&n.filter((e=>"source.canvas"!==e.identifier))),Wt=e.pick(Ve,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Ht=e.pick(Ve,["setCenter","setZoom","setBearing","setPitch"]),Xt={version:8,layers:[],sources:{}},Yt={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Kt extends e.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new A(Ne(),this),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new e.GlyphManager(t._requestManager,n.localFontFamily?e.LocalGlyphMode.all:n.localIdeographFontFamily?e.LocalGlyphMode.ideographs:e.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.crossTileSymbolIndex=new Zt,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",e.getReferrer());const r=this;this._rtlTextPluginCallback=Kt.registerForPluginStateChange((t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,n)=>{if(e.triggerPluginCompletionEvent(t),n&&n.every((e=>e)))for(const e in r._sourceCaches){const t=r._sourceCaches[e],n=t.getSource().type;"vector"!==n&&"geojson"!==n||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const n=this._layers[e];n.source===t.id&&this._validateLayer(n)}}))}loadURL(t,n={}){this.fire(new e.Event("dataloading",{dataType:"style"}));const r="boolean"==typeof n.validate?n.validate:!e.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,n.accessToken);const i=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(i,((t,n)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):n&&this._load(n,r)}))}loadJSON(t,n={}){this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame((()=>{this._request=null,this._load(t,!1!==n.validate)}))}loadEmpty(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(Xt,!1)}_updateLayerCount(e,t){const n=t?1:-1;e.is3D()&&(this._num3DLayers+=n),"circle"===e.type&&(this._numCircleLayers+=n),"symbol"===e.type&&(this._numSymbolLayers+=n)}_load(t,n){if(n&&qt(this,e.validateStyle(t)))return;this._loaded=!0,this.stylesheet=e.clone$1(t),this._updateMapProjection();for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);const r=Ue(this.stylesheet.layers);this._order=r.map((e=>e.id)),this._layers={},this._serializedLayers={};for(const t of r){const n=e.createStyleLayer(t);n.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=n,this._serializedLayers[n.id]=n.serialize(),this._updateLayerCount(n,!0)}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(t){this._spriteRequest=function(t,n,r){let i,o,a;const s=e.exported.devicePixelRatio>1?"@2x":"";let l=e.getJSON(n.transformRequest(n.normalizeSpriteURL(t,s,".json"),e.ResourceType.SpriteJSON),((e,t)=>{l=null,a||(a=e,i=t,u())})),c=e.getImage(n.transformRequest(n.normalizeSpriteURL(t,s,".png"),e.ResourceType.SpriteImage),((e,t)=>{c=null,a||(a=e,o=t,u())}));function u(){if(a)r(a);else if(i&&o){const t=e.exported.getImageData(o),n={};for(const r in i){const{width:o,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=i[r],f=new e.RGBAImage({width:o,height:a});e.RGBAImage.copy(t,f,{x:s,y:l},{x:0,y:0},{width:o,height:a}),n[r]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p}}r(null,n)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,n)=>{if(this._spriteRequest=null,t)this.fire(new e.ErrorEvent(t));else if(n)for(const e in n)this.imageManager.addImage(e,n[e]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new e.Event("data",{dataType:"style"}))}))}_validateLayer(t){const n=this.getSource(t.source);if(!n)return;const r=t.sourceLayer;r&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${r}" 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 e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){const t=[];for(const n of e){const e=this._layers[n];"custom"!==e.type&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(e){return!!this.terrain&&("function"==typeof e.isLayerDraped?e.isLayerDraped():Yt[e.type])}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(e.length||n.length)&&this._updateWorkerLayers(e,n);for(const e in this._updatedSources){const t=this._updatedSources[e];"reload"===t?this._reloadSource(e):"clear"===t&&this._clearSource(e)}this._updateTilesForChangedImages();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}const r={};for(const e in this._sourceCaches){const t=this._sourceCaches[e];r[e]=t.used,t.used=!1}for(const e of this._order){const n=this._layers[e];if(n.recalculate(t,this._availableImages),!n.isHidden(t.zoom)){const e=this._getLayerSourceCache(n);e&&(e.used=!0)}const r=this.map.painter;if(r){const e=n.getProgramIds();if(!e)continue;const i=n.getProgramConfiguration(t.zoom);for(const t of e)r.useProgram(t,i)}}for(const t in r){const n=this._sourceCaches[t];r[t]!==n.used&&n.getSource().fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:n.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new e.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(n){if(this._checkLoaded(),qt(this,e.validateStyle(n)))return!1;(n=e.clone$1(n)).layers=Ue(n.layers);const r=function(e,n){if(!e)return[{command:Ve.setStyle,args:[n]}];let r=[];try{if(!t(e.version,n.version))return[{command:Ve.setStyle,args:[n]}];t(e.center,n.center)||r.push({command:Ve.setCenter,args:[n.center]}),t(e.zoom,n.zoom)||r.push({command:Ve.setZoom,args:[n.zoom]}),t(e.bearing,n.bearing)||r.push({command:Ve.setBearing,args:[n.bearing]}),t(e.pitch,n.pitch)||r.push({command:Ve.setPitch,args:[n.pitch]}),t(e.sprite,n.sprite)||r.push({command:Ve.setSprite,args:[n.sprite]}),t(e.glyphs,n.glyphs)||r.push({command:Ve.setGlyphs,args:[n.glyphs]}),t(e.transition,n.transition)||r.push({command:Ve.setTransition,args:[n.transition]}),t(e.light,n.light)||r.push({command:Ve.setLight,args:[n.light]}),t(e.fog,n.fog)||r.push({command:Ve.setFog,args:[n.fog]}),t(e.projection,n.projection)||r.push({command:Ve.setProjection,args:[n.projection]});const i={},o=[];!function(e,n,r,i){let o;for(o in n=n||{},e=e||{})e.hasOwnProperty(o)&&(n.hasOwnProperty(o)||Ge(o,r,i));for(o in n){if(!n.hasOwnProperty(o))continue;const a=n[o];e.hasOwnProperty(o)?t(e[o],a)||("geojson"===e[o].type&&"geojson"===a.type&&qe(e,n,o)?r.push({command:Ve.setGeoJSONSourceData,args:[o,a.data]}):Ze(o,n,r,i)):$e(o,n,r)}}(e.sources,n.sources,o,i);const a=[];e.layers&&e.layers.forEach((e=>{e.source&&i[e.source]?r.push({command:Ve.removeLayer,args:[e.id]}):a.push(e)}));let s=e.terrain;s&&i[s.source]&&(r.push({command:Ve.setTerrain,args:[void 0]}),s=void 0),r=r.concat(o),t(s,n.terrain)||r.push({command:Ve.setTerrain,args:[n.terrain]}),function(e,n,r){n=n||[];const i=(e=e||[]).map(He),o=n.map(He),a=e.reduce(Xe,{}),s=n.reduce(Xe,{}),l=i.slice(),c=Object.create(null);let u,h,d,p,f,m,g;for(u=0,h=0;u!(e.command in Ht)));if(0===r.length)return!1;const i=r.filter((e=>!(e.command in Wt)));if(i.length>0)throw new Error(`Unimplemented: ${i.map((e=>e.command)).join(", ")}.`);return r.forEach((e=>{"setTransition"!==e.command&&"setProjection"!==e.command&&this[e.command].apply(this,e.args)})),this.stylesheet=n,this._updateMapProjection(),!0}addImage(t,n){return this.getImage(t)?this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,n),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(t,n,r={}){if(this._checkLoaded(),void 0!==this.getSource(t))throw new Error("There is already a source with this ID");if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(e.validateSource,`sources.${t}`,n,null,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const i=Ie(t,n,this.dispatcher,this);i.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(t),source:i.serialize(),sourceId:t})));const o=n=>{const r=(n?"symbol:":"other:")+t,o=this._sourceCaches[r]=new e.SourceCache(r,i,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[t]=o,o.style=this,o.onAdd(this.map)};o(!1),"vector"!==n.type&&"geojson"!==n.type||o(!0),i.onAdd&&i.onAdd(this.map),this._changed=!0}removeSource(t){this._checkLoaded();const n=this.getSource(t);if(!n)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&&this.terrain.get().source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const r=this._getSourceCaches(t);for(const t of r)delete this._sourceCaches[t.id],delete this._updatedSources[t.id],t.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles();return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getSource(e).setData(t),this._changed=!0}getSource(e){const t=this._getSourceCache(e);return t&&t.getSource()}_getSources(){const e=[];for(const t in this._otherSourceCaches){const n=this._getSourceCache(t);n&&e.push(n.getSource())}return e}addLayer(t,n,r={}){this._checkLoaded();const i=t.id;if(this.getLayer(i))return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" already exists on this map`)));let o;if("custom"===t.type){if(qt(this,e.validateCustomStyleLayer(t)))return;o=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(i,t.source),t=e.clone$1(t),t=e.extend(t,{source:i})),this._validate(e.validateLayer,`layers.${i}`,t,{arrayIndex:-1},r))return;o=e.createStyleLayer(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}const a=n?this._order.indexOf(n):this._order.length;if(n&&-1===a)return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o;const s=this._getLayerSourceCache(o);if(this._removedLayers[i]&&o.source&&s&&"custom"!==o.type){const e=this._removedLayers[i];delete this._removedLayers[i],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",s.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const r=this._order.indexOf(t);this._order.splice(r,1);const i=n?this._order.indexOf(n):this._order.length;n&&-1===i?this.fire(new e.ErrorEvent(new Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(i,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(t,n,r){this._checkLoaded();const i=this.getLayer(t);i?i.minzoom===n&&i.maxzoom===r||(null!=n&&(i.minzoom=n),null!=r&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(n,r,i={}){this._checkLoaded();const o=this.getLayer(n);if(o){if(!t(o.filter,r))return null==r?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(e.validateFilter,`layers.${o.id}.filter`,r,{layerType:o.type},i)||(o.filter=e.clone$1(r),this._updateLayer(o)))}else this.fire(new e.ErrorEvent(new Error(`The layer '${n}' does not exist in the map's style and cannot be filtered.`)))}getFilter(t){const n=this.getLayer(t);return n&&e.clone$1(n.filter)}setLayoutProperty(n,r,i,o={}){this._checkLoaded();const a=this.getLayer(n);a?t(a.getLayoutProperty(r),i)||(a.setLayoutProperty(r,i,o),this._updateLayer(a)):this.fire(new e.ErrorEvent(new Error(`The layer '${n}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(t,n){const r=this.getLayer(t);if(r)return r.getLayoutProperty(n);this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style.`)))}setPaintProperty(n,r,i,o={}){this._checkLoaded();const a=this.getLayer(n);a?t(a.getPaintProperty(r),i)||(a.setPaintProperty(r,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[n]=!0):this.fire(new e.ErrorEvent(new Error(`The layer '${n}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(e,t){const n=this.getLayer(e);return n&&n.getPaintProperty(t)}setFeatureState(t,n){this._checkLoaded();const r=t.source,i=t.sourceLayer,o=this.getSource(r);if(!o)return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const a=o.type;if("geojson"===a&&i)return void this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===a&&!i)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));const s=this._getSourceCaches(r);for(const e of s)e.setFeatureState(i,t.id,n)}removeFeatureState(t,n){this._checkLoaded();const r=t.source,i=this.getSource(r);if(!i)return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const o=i.type,a="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!a)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const s=this._getSourceCaches(r);for(const e of s)e.removeFeatureState(a,t.id,n)}getFeatureState(t){this._checkLoaded();const n=t.source,r=t.sourceLayer,i=this.getSource(n);if(i){if("vector"!==i.type||r)return void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(r,t.id);this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t={};for(const e in this._sourceCaches){const n=this._sourceCaches[e].getSource();t[n.id]||(t[n.id]=n.serialize())}return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0;const t=this._getLayerSourceCache(e);e.source&&!this._updatedSources[e.source]&&t&&"raster"!==t.getSource().type&&(this._updatedSources[e.source]="reload",t.pause()),this._changed=!0,e.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,n={},r=[];for(let i=this._order.length-1;i>=0;i--){const o=this._order[i];if(t(o)){n[o]=i;for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const i=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(t(a))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(n[t.layer.id]{const t=this.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),s=z.createFromScreenPoints(t,r);for(const e in this._sourceCaches){const t=this._sourceCaches[e].getSource().id;n.layers&&!i[t]||o.push(Pe(this._sourceCaches[e],this._layers,this._serializedLayers,s,n,r,a,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(e,t,n,r,i,o,a){const s={},l=o.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(a[e]);c.sort(De);for(const n of c){const r=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,i.filter,i.layers,i.availableImages,e);for(const e in r){const t=s[e]=s[e]||[],i=r[e];i.sort(((e,t)=>{const r=n.featureSortOrder;if(r){const n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex}));for(const e of i)t.push(e)}}for(const t in s)s[t].forEach((r=>{const i=r.feature,o=n(e[t]);if(!o)return;const a=o.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=a}));return s}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),s.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,n){n&&n.filter&&this._validate(e.validateFilter,"querySourceFeatures.filter",n.filter,null,n);const r=this._getSourceCaches(t);let i=[];for(const e of r)i=i.concat(Le(e,n));return i}addSourceType(e,t,n){return Kt.getSourceType(e)?n(new Error(`A source type called "${e}" already exists.`)):(Kt.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const r=this.light.getLight();let i=!1;for(const n in e)if(!t(e[n],r[n])){i=!0;break}if(!i)return;const o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,n),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(n,r=1){if(this._checkLoaded(),!n)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let i=n;if(1===r){if("object"==typeof i.source){const t="terrain-dem-src";this.addSource(t,i.source),i=e.clone$1(i),i=e.extend(i,{source:t})}if(this._validate(e.validateTerrain,"terrain",i))return}if(!this.terrain||this.terrain&&r!==this.terrain.drapeRenderMode){if(!i)return;this._createTerrain(i,r)}else{const n=this.terrain,r=n.get();for(const t of Object.keys(e.spec.terrain))!i.hasOwnProperty(t)&&e.spec.terrain[t].default&&(i[t]=e.spec.terrain[t].default);for(const e in i)if(!t(i[e],r[e])){n.set(i),this.stylesheet.terrain=i;const e=this._setTransitionParameters({duration:0});n.updateTransitions(e);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new C(e,this.map.transform);this.stylesheet.fog=e;const n=this._setTransitionParameters({duration:0});t.updateTransitions(n)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog,r=n.get();0===Object.keys(e).length&&n.set(e);for(const i in e)if(!t(e[i],r[i])){n.set(e),this.stylesheet.fog=e;const t=this._setTransitionParameters({duration:0});n.updateTransitions(t);break}}else this._createFog(e);this._markersNeedUpdate=!0}_setTransitionParameters(t){return{now:e.exported.now(),transition:e.extend(t,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const e=this._order.filter((e=>this.isLayerDraped(this._layers[e]))),t=this._order.filter((e=>!this.isLayerDraped(this._layers[e])));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const n=this.terrain=new T(e,t);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const r=this._setTransitionParameters({duration:0});n.updateTransitions(r)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,n,r,i,o={}){return(!o||!1!==o.validate)&&qt(this,t.call(e.validateStyle,e.extend({key:n,style:this.serialize(),value:r,styleSpec:e.spec},i)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles(),this._sourceCaches[e].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){const t=this._getSourceCaches(e);for(const e of t)e.clearTiles()}_reloadSource(e){const t=this._getSourceCaches(e);for(const e of t)e.resume(),e.reload()}_reloadSources(){for(const e of this._getSources())e.reload&&e.reload()}_updateSources(e){for(const t in this._sourceCaches)this._sourceCaches[t].update(e)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,n,r,i,o=!1){let a=!1,s=!1;const l={};for(const e of this._order){const n=this._layers[e];if("symbol"!==n.type)continue;if(!l[n.source]){const e=this._getLayerSourceCache(n);if(!e)continue;l[n.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(n,l[n.source],t.center.lng,t.projection);a=a||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o=o||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new e.Event("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new jt(t,this._order,o,n,r,i,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,n){this.imageManager.getImages(t.icons,n),this._updateTilesForChangedImages();const r=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons)};r(this._otherSourceCaches[t.source]),r(this._symbolSourceCaches[t.source])}getGlyphs(e,t,n){this.glyphManager.getGlyphs(t.stacks,n)}getResource(t,n,r){return e.makeRequest(n,r)}_getSourceCache(e){return this._otherSourceCaches[e]}_getLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}_getSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const n=this._getSourceCaches(t);return 0===n.length?(this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`))),!1):n.every((e=>e.loaded()))}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Kt.getSourceType=function(e){return Ae[e]},Kt.setSourceType=function(e,t){Ae[e]=t},Kt.registerForPluginStateChange=e.registerForPluginStateChange;var Jt="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",Qt="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",en="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",tn="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",nn="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";let rn={},on={};const an=[];hn(Jt,an),hn(en,an),hn(tn,an),hn(nn,an),rn=dn("",en),on=dn(nn,tn);const sn=dn("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const 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;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),ln=Jt,cn="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var un={background:dn("uniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nvarying vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform vec4 u_color;varying vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(u_color);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:dn("uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:dn("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:dn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:dn("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:dn("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:dn("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:dn("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:dn("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:dn("#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\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:dn("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:dn("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:dn("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:dn("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\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\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:dn("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:dn("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:dn("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\ngl_FragColor=apply_lighting(gl_FragColor);\n#endif\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:dn("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:dn("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\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\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:dn("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:dn("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_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;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:dn("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:dn("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:dn("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=wireframeOffset;\n#endif\nv_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:dn("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:dn("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Qt),skyboxGradient:dn("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Qt),skyboxCapture:dn("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:dn("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:dn("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function hn(e,t){const n=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of n)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const n=e.split(" ");for(const e of n)t.includes(e)||t.push(e)}}function dn(e,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),i={},o=[...an];return hn(e,o),hn(t,o),{fragmentSource:e=e.replace(n,((e,t,n,r,o)=>(i[o]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nvarying ${n} ${r} ${o};\n#else\nuniform ${n} ${r} u_${o};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${o}\n ${n} ${r} ${o} = u_${o};\n#endif\n`))),vertexSource:t=t.replace(n,((e,t,n,r,o)=>{const a="float"===r?"vec2":"vec4",s=o.match(/color/)?"color":a;return i[o]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${n} ${a} a_${o};\nvarying ${n} ${r} ${o};\n#else\nuniform ${n} ${r} u_${o};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = a_${o};\n#else\n ${n} ${r} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = unpack_mix_${s}(a_${o}, u_${o}_t);\n#else\n ${n} ${r} ${o} = u_${o};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${n} ${a} a_${o};\n#else\nuniform ${n} ${r} u_${o};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${o}\n ${n} ${r} ${o} = a_${o};\n#else\n ${n} ${r} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${n} ${r} ${o} = unpack_mix_${s}(a_${o}, u_${o}_t);\n#else\n ${n} ${r} ${o} = u_${o};\n#endif\n`})),staticAttributes:r,usedDefines:o}}class pn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,n,r,i,o,a){this.context=e;let s=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!s&&e{const i=n.paint.get("hillshade-shadow-color"),o=n.paint.get("hillshade-highlight-color"),a=n.paint.get("hillshade-accent-color");let s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);const l=!e.options.moving;return{u_matrix:r||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:fn(0,t.tileID),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:o,u_accent:a}})(t,r,i,t.terrain?n.projMatrix:null);t.prepareDrawProgram(l,h,n.toUnwrapped());const{tileBoundsBuffer:p,tileBoundsIndexBuffer:f,tileBoundsSegments:m}=t.getTileBoundsBuffers(r);h.draw(l,c.TRIANGLES,o,a,s,e.CullFaceMode.disabled,d,i.id,p,f,m)}function gn(t,n,r){if(!n.needsDEMTextureUpload)return;const i=t.context,o=i.gl;i.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(r.stride);const a=r.getPixels();n.demTexture?n.demTexture.update(a,{premultiply:!1}):n.demTexture=new e.Texture(i,a,o.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}function _n(t,n,r,i,o,a){const s=t.context,l=s.gl;if(!n.dem)return;const c=n.dem;if(s.activeTexture.set(l.TEXTURE1),gn(t,n,c),!n.demTexture)return;n.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const u=c.dim;s.activeTexture.set(l.TEXTURE0);let h=n.fbo;if(!h){const t=new e.Texture(s,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=n.fbo=s.createFramebuffer(u,u,!0),h.colorAttachment.set(t.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,u,u]);const{tileBoundsBuffer:d,tileBoundsIndexBuffer:p,tileBoundsSegments:f}=t.getMercatorTileBoundsBuffers();t.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,i,o,a,e.CullFaceMode.disabled,((t,n)=>{const r=n.stride,i=e.create();return e.ortho(i,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(i,i,[0,-e.EXTENT,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,c),r.id,d,p,f),n.needsHillshadePrepare=!1}const yn=t=>({u_matrix:new e.UniformMatrix4f(t),u_image0:new e.Uniform1i(t),u_skirt_height:new e.Uniform1f(t)}),vn=(e,t)=>({u_matrix:e,u_image0:0,u_skirt_height:t}),xn=(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:n,u_zoom_transition:i,u_merc_center:o,u_image0:0,u_frustum_tl:a,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:f?Float32Array.from(f):new Float32Array(9),u_skirt_height:p});function bn(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const wn=new class{constructor(){this.operations={}}newMorphing(e,t,n,r,i){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==n.tileID.key&&(t.queued=n)}else this.operations[e]={startTime:r,phase:0,duration:i,from:t,to:n,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const n=this.operations[t];for(n.phase=(e-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},En={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Tn(e){return 6*Math.pow(1.5,22-e)}function Sn(e,t){const n=1<({u_matrix:e});function Mn(t,n,r,i,o){if(o>0){const a=e.exported.now(),s=(a-t.timeAdded)/o,l=n?(a-n.timeAdded)/o:-1,c=r.getSource(),u=i.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!n||Math.abs(n.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=h&&t.refreshedUponExpiration?1:e.clamp(h?s:1-l,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),n?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Cn extends e.SourceCache{constructor(e){const t={type:"raster-dem",maxzoom:e.transform.maxZoom},n=new A(Ne(),null),r=Ie("mock-dem",t,n,e.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class An extends e.SourceCache{constructor(e){const t=Ie("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new A(Ne(),null),e.style);super("proxy",t,!1),t.setEventedParent(this),this.map=this.getSource().map=e,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,n,r){if(t.freezeTileCoverage)return;this.transform=t;const i=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((n,r)=>{if(n[r.key]="",!this._tiles[r.key]){const n=new e.Tile(r,this._source.tileSize*r.overscaleFactor(),t.tileZoom);n.state="loaded",this._tiles[r.key]=n}return n}),{});for(const e in this._tiles)e in i||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const n=Object.values(t);this.renderCachePool.push(...n),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class In extends e.OverscaledTileID{constructor(e,t,n){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=n}}class zn extends e.Elevation{constructor(t,n){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,i,o]=function(t){const n=new e.StructArrayLayout2i4,r=new e.StructArrayLayout3ui6,i=131;n.reserve(17161),r.reserve(33800);const o=e.EXTENT/128,a=e.EXTENT+o/2,s=a+o;for(let t=-o;ta||t<0||t>a?24575:0,o=e.clamp(Math.round(r),0,e.EXTENT),s=e.clamp(Math.round(t),0,e.EXTENT);n.emplaceBack(o+i,s)}const l=(e,t)=>{const n=t*i+e;r.emplaceBack(n+1,n,n+i),r.emplaceBack(n+i,n+i+1,n+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)l(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)l(t,e),l(e,t)})),[n,r,32768]}(),a=t.context;this.gridBuffer=a.createVertexBuffer(r,e.posAttributes.members),this.gridIndexBuffer=a.createIndexBuffer(i),this.gridSegments=e.SegmentVector.simpleSegment(0,0,r.length,i.length),this.gridNoSkirtSegments=e.SegmentVector.simpleSegment(0,0,r.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new An(n.map),this.orthoMatrix=e.create(),e.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.EXTENT,0,e.EXTENT,0,1);const s=a.gl;this._overlapStencilMode=new e.StencilMode({func:s.GEQUAL,mask:255},0,255,s.KEEP,s.KEEP,s.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Cn(n.map)}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,n,r){if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;const i=t.terrain.properties;this.sourceCache=0===t.terrain.drapeRenderMode?this._mockSourceCache:t._getSourceCache(i.get("source")),this._exaggeration=i.get("exaggeration");const o=()=>{this.sourceCache.used&&e.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(n,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),n.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==t.efficiency&&e.warnOnce(`Terrain render cache efficiency is not optimal (${t.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${t.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._sourceCaches)this._style._sourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,r=this.painter.transform;this._initializing&&(this._initializing=0===r._centerAltitude&&-1===this.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(r.center),-1),this._emptyDEMTextureDirty=!this._initializing);const i=this.proxyCoords=n.getIds().map((e=>{const t=n.getTileByID(e).tileID;return t.projMatrix=r.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,n){const r=n.transform.pointCoordinate(n.transform.getCameraPoint()),i=new e.Point(r.x,r.y);t.sort(((t,n)=>{if(n.overscaledZ-t.overscaledZ)return n.overscaledZ-t.overscaledZ;const r=new e.Point(t.canonical.x+(1<{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const a=this._style._sourceCaches;for(const e in a){const n=a[e];if(!n.used)continue;if(n!==this.sourceCache&&this.resetTileLookupCache(n.id),this._setupProxiedCoordsForOrtho(n,t[e],o),n.usedForTerrain)continue;const r=t[e];n.getSource().reparseOverscaled&&this._assignTerrainTiles(r)}this.proxiedCoords[n.id]=i.map((e=>new In(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(i),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=e.exported.now();const s={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const n=t.tileID.key;n in s||(this._visibleDemTiles.push(t),s[n]=n)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const n in this.terrainTileForTile){const r=this.terrainTileForTile[n],i=r.dem;!i||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),gn(this.painter,r,i))}}_prepareDemTileUniforms(e,t,n,r){if(!t||null==t.demTexture)return!1;const i=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-i.z),a=r||"";return n[`u_dem_tl${a}`]=[i.x*o%1,i.y*o%1],n[`u_dem_scale${a}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,n=t.gl;if(!this._emptyDepthBufferTexture){const r=new e.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.Texture(t,r,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let e=0;const t=this._visibleDemTiles.reduce(((t,n)=>{if(!n.dem)return t;const r=n.dem.tree.minimums[0];return r>0&&e++,t+r}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,n=t.gl;t.activeTexture.set(n.TEXTURE2);const r=this._getLoadedAreaMinimum(),i=new e.RGBAImage({width:1,height:1},new Uint8Array(e.DEMData.pack(r,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(i,{premultiply:!1}):o=this._emptyDEMTexture=new e.Texture(t,i,n.RGBA,{premultiply:!1}),o}setupElevationDraw(t,n,r){const i=this.painter.context,o=i.gl,a=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:e.DEMData.getUnpackVector(s),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var s;a.u_dem_size=this.sourceCache.getSource().tileSize,a.u_exaggeration=this.exaggeration();let l=null,c=null,u=1;if(r&&r.morphing&&this._useVertexMorphing){const e=r.morphing.srcDemTile,n=r.morphing.dstDemTile;u=r.morphing.phase,e&&n&&(this._prepareDemTileUniforms(t,e,a,"_prev")&&(c=e),this._prepareDemTileUniforms(t,n,a)&&(l=n))}if(c&&l?(i.activeTexture.set(o.TEXTURE2),l.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),i.activeTexture.set(o.TEXTURE4),c.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.u_dem_lerp=u):(l=this.terrainTileForTile[t.tileID.key],i.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(t,l,a)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE)),i.activeTexture.set(o.TEXTURE3),r&&r.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),this._depthFBO&&(a.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),a.u_depth_size_inv=[1,1]),r&&r.useMeterToDem&&l){const t=(1<{if(c===e)return;const r=[En[e],"PROJECTION_GLOBE_VIEW"];d&&r.push("CUSTOM_ANTIALIASING"),n&&r.push(En[u]),l=t.useProgram("globeRaster",null,r),c=e},f=t.colorModeForRenderPass(),m=new e.DepthMode(s.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);wn.update(o);const g=e.calculateGlobeMercatorMatrix(h),_=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],y=u?[!1,!0]:[!1],v=t.globeSharedBuffers,x=[h.width*e.exported.devicePixelRatio,h.height*e.exported.devicePixelRatio],b=Float32Array.from(h.globeMatrix),w={useDenormalizedUpVectorScale:!0};if(y.forEach((u=>{const h=t.transform,d=Tn(h.zoom)*n.exaggeration();c=-1;const y=u?s.LINES:s.TRIANGLES;for(const c of i){const i=r.getTile(c),E=e.StencilMode.disabled,T=n.prevTerrainTileForTile[c.key],S=n.terrainTileForTile[c.key];bn(T,S)&&wn.newMorphing(c.key,T,S,o,250),a.activeTexture.set(s.TEXTURE0),i.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE);const k=wn.getMorphValuesForProxy(c.key),M=k?1:0;k&&e.extend$1(w,{morphing:{srcDemTile:k.from,dstDemTile:k.to,phase:e.easeCubicInOut(k.phase)}});const C=e.tileCornersToBounds(c.canonical),A=e.getLatitudinalLod(C.getCenter().lat),I=e.getGridMatrix(c.canonical,C,A,h.worldSize/h._pixelsPerMercatorPixel),z=e.globeNormalizeECEF(e.globeTileBounds(c.canonical)),P=xn(h.projMatrix,b,g,z,e.globeToMercatorTransition(h.zoom),_,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,x,d,I);if(p(M,u),n.setupElevationDraw(i,l,w),t.prepareDrawProgram(a,l,c.toUnwrapped()),v){const[n,r,i]=u?v.getWirefameBuffers(t.context,A):v.getGridBuffers(A,0!==d);l.draw(a,y,m,E,f,e.CullFaceMode.backCCW,P,"globe_raster",n,r,i)}}})),v){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];d&&o.push("CUSTOM_ANTIALIASING"),l=t.useProgram("globeRaster",null,o);for(const o of i){const{x:i,y:c,z:u}=o.canonical,d=0===c,p=c===(1<t.draw(a,s.TRIANGLES,m,e.StencilMode.disabled,f,e.CullFaceMode.disabled,xn(h.projMatrix,v,v,T,0,_,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,x,0),"globe_pole_raster",n,b,E);n.setupElevationDraw(c,l,w),t.prepareDrawProgram(a,l,o.toUnwrapped()),d&&S(l,g),p&&(v=e.scale(e.create(),v,[1,-1,1]),S(l,y))}}}}(t,n,r,i,o);else{const a=t.context,s=a.gl;let l,c;const u=t.options.showTerrainWireframe?2:0,h=(e,n)=>{if(c===e)return;const r=[En[e]];n&&r.push(En[u]),l=t.useProgram("terrainRaster",null,r),c=e},d=t.colorModeForRenderPass(),p=new e.DepthMode(s.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);wn.update(o);const f=t.transform,m=Tn(f.zoom)*n.exaggeration();(u?[!1,!0]:[!1]).forEach((u=>{c=-1;const g=u?s.LINES:s.TRIANGLES,[_,y]=u?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments];for(const c of i){const i=r.getTile(c),v=e.StencilMode.disabled,x=n.prevTerrainTileForTile[c.key],b=n.terrainTileForTile[c.key];bn(x,b)&&wn.newMorphing(c.key,x,b,o,250),a.activeTexture.set(s.TEXTURE0),i.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST);const w=wn.getMorphValuesForProxy(c.key),E=w?1:0;let T;w&&(T={morphing:{srcDemTile:w.from,dstDemTile:w.to,phase:e.easeCubicInOut(w.phase)}});const S=vn(c.projMatrix,Sn(c.canonical,f.renderWorldCopies)?m/10:m);h(E,u),n.setupElevationDraw(i,l,T),t.prepareDrawProgram(a,l,c.toUnwrapped()),l.draw(a,g,p,v,d,e.CullFaceMode.backCCW,S,"terrain_raster",n.gridBuffer,_,y)}}))}}(n,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const n=this.painter,r=this.painter.context,i=this.proxySourceCache,o=this.proxiedCoords[i.id],a=this._drapedRenderBatches.shift(),s=[],l=n.style.order;let c=0;for(const u of o){const o=i.getTileByID(u.proxyTileKey),h=i.proxyCachedFBO[u.key]?i.proxyCachedFBO[u.key][t]:void 0,d=void 0!==h?i.renderCache[h]:this.pool[c++],p=void 0!==h;if(o.texture=d.tex,p&&!d.dirty){s.push(o.tileID);continue}let f;r.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(r.clear({color:e.Color.transparent,stencil:0}),d.dirty=!1);for(let e=a.start;e<=a.end;++e){const t=n.style._layers[l[e]];if(t.isHidden(n.transform.zoom))continue;const i=n.style._getLayerSourceCache(t),o=i?this.proxyToSource[u.key][i.id]:[u];if(!o)continue;const a=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(i?i.id:null)&&(this._setupStencil(d,o,t,i),f=i?i.id:null),n.renderLayer(n,i,t,a)}this.renderedToTile?(d.dirty=!0,s.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(s))}return this.renderToBackBuffer(s),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,n.width,n.height]),a.end+1}postRender(){}renderCacheEfficiency(e){const t=e.order.length;if(0===t)return{efficiency:100};let n,r=0,i=0,o=!1;for(let a=0;ae.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,n){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter((e=>e.dem)).map((r=>{const i=r.tileID,o=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const i of r){if(null==i.t)return null;const r=i.tile.dem.tree.raycast(i.minx,i.miny,i.maxx,i.maxy,e,t,n);if(null!=r)return r}return null}_createFBO(){const t=this.painter.context,n=t.gl,r=this.drapeBufferSize;t.activeTexture.set(n.TEXTURE0);const i=new e.Texture(t,{width:r[0],height:r[1],data:null},n.RGBA);i.bind(n.LINEAR,n.CLAMP_TO_EDGE);const o=t.createFramebuffer(r[0],r[1],!1);return o.colorAttachment.set(i.texture),o.depthAttachment=new we(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:i,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._layers[e],n=t.isHidden(this.painter.transform.zoom);return"custom"===t.type?!n&&t.shouldRedrape():!n&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style._getSources())if(e instanceof Se){t=!0;break}if(!t)return;const n={};for(let t=0;tt.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let n=0;n=0;i--){const o=n[i];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const n=e[o.key],i=this.proxyToSource[o.key];let a=0;for(const e in i){const t=i[e],o=n[e];if(!o||o.length!==t.length||t.some(((t,n)=>t!==o[n]||r[e]&&r[e].hasOwnProperty(t.key)))){a=-1;break}++a}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=a<0||a!==Object.values(n).length}}const i=[...this._drapedRenderBatches];i.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of i)for(const r of n){if(t.proxyCachedFBO[r.key])continue;let n=t.renderCachePool.pop();void 0===n&&t.renderCache.length<50&&(n=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==n&&(t.proxyCachedFBO[r.key]={},t.proxyCachedFBO[r.key][e.start]=n,t.renderCache[n].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,n,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const i=this.painter.context,o=i.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let a;if(n.isTileClipped())a=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);a=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+a>255&&(i.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=a,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.StencilMode.disabled}_renderTileClippingMasks(t,n){const r=this.painter,i=this.painter.context,o=i.gl;r._tileClippingMaskIDs={},i.setColorMode(e.ColorMode.disabled),i.setDepthMode(e.DepthMode.disabled);const a=r.useProgram("clippingMask");for(const s of t){const t=r._tileClippingMaskIDs[s.key]=--n;a.draw(i,o.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,kn(s.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const r=[t.x,t.y,1,1];e.transformMat4$1(r,r,n.pixelMatrixInverse),e.scale$1(r,r,1/r[3]),r[0]/=n.worldSize,r[1]/=n.worldSize;const i=n._camera.position,o=e.mercatorZfromAltitude(1,n.center.lat),a=[i[0],i[1],i[2]/o,0],s=e.subtract([],r.slice(0,3),a);e.normalize(s,s);const l=this.raycast(a,s,this._exaggeration);return null!==l&&l?(e.scaleAndAdd(a,a,s,l),a[3]=a[2],a[2]*=o,a):null}drawDepth(){const t=this.painter,n=t.context,r=this.proxySourceCache,i=Math.ceil(t.width),o=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===i&&this._depthFBO.height===o||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const t=n.gl,r=n.createFramebuffer(i,o,!0);n.activeTexture.set(t.TEXTURE0);const a=new e.Texture(n,{width:i,height:o,data:null},t.RGBA);a.bind(t.NEAREST,t.CLAMP_TO_EDGE),r.colorAttachment.set(a.texture);const s=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,i,o);r.depthAttachment.set(s),this._depthFBO=r,this._depthTexture=a}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,i,o]),function(t,n,r,i){if("globe"===t.transform.projection.name)return;const o=t.context,a=o.gl;o.clear({depth:1});const s=t.useProgram("terrainDepth"),l=new e.DepthMode(a.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D);for(const t of i){const i=r.getTile(t),c=vn(t.projMatrix,0);n.setupElevationDraw(i,s),s.draw(o,a.TRIANGLES,l,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,c,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(t,this,r,this.proxyCoords)}_setupProxiedCoordsForOrtho(e,t,n){if(e.getSource()instanceof Ce)return this._setupProxiedCoordsForImageSource(e,t,n);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};const r=this.proxiedCoords[e.id]=[],i=this.proxyCoords;for(let t=0;t(e.min.x=Math.min(e.min.x,t.x-s.x),e.min.y=Math.min(e.min.y,t.y-s.y),e.max.x=Math.max(e.max.x,t.x-s.x),e.max.y=Math.max(e.max.y,t.y-s.y),e)),{min:new e.Point(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.Point(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(t,n)=>{const r=t.wrap+t.canonical.x/(1<a+l.max.x||i+os+l.max.y};for(let e=0;ee.key===n.tileID.key));if(e)return e}if(n.tileID.key!==t.key){const r=t.canonical.z-n.tileID.canonical.z;let o,a,s;i=e.create();const l=n.tileID.wrap-t.wrap<0?(o=e.EXTENT>>r,a=o*((n.tileID.canonical.x<=i){const r=t.canonical.z-i;n.getSource().reparseOverscaled?(s=Math.max(t.canonical.z+2,n.transform.tileZoom),a=new e.OverscaledTileID(s,t.wrap,i,t.canonical.x>>r,t.canonical.y>>r)):0!==r&&(s=i,a=new e.OverscaledTileID(s,t.wrap,i,t.canonical.x>>r,t.canonical.y>>r))}a.key!==t.key&&(c.push(a.key),r=n.getTile(a))}const u=e=>{c.forEach((t=>{i[t]=e})),c.length=0};for(s-=1;s>=l&&(!r||!r.hasData());s--){r&&u(r.tileID.key);const e=a.calculateScaledKey(s);if(r=n.getTileByID(e),r&&r.hasData())break;const t=i[e];if(null===t)break;void 0===t?c.push(e):r=n.getTileByID(t)}return u(r?r.tileID.key:null),r&&r.hasData()?r:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let n=this._tilesDirty[e];n||(n=this._tilesDirty[e]={}),n[t.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const t=function(t){let n=0;const r=new e.StructArrayLayout2ui4,i=131;for(let e=1;e<129;e++){for(let t=1;t<129;t++)n=e*i+t,r.emplaceBack(n,n+1),r.emplaceBack(n,n+i),r.emplaceBack(n+1,n+i),128===e&&r.emplaceBack(n+i,n+i+1);r.emplaceBack(n+1,n+1+i)}return r}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=e.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class Pn{static cacheKey(e,t,n,r){let i=`${t}${r?r.cacheKey:""}`;for(const t of n)e.usedDefines.includes(t)&&(i+=`/${t}`);return i}constructor(t,n,r,i,o,a){const s=t.gl;this.program=s.createProgram();const l=function(e){const t=[];for(let n=0;n`#define ${e}`)));const d=t.isWebGL2?"#version 300 es\n":"",p=d+h.concat(t.extStandardDerivatives&&0===d.length?"#extension GL_OES_standard_derivatives : enable\n".concat(cn):cn,cn,ln,sn.fragmentSource,on.fragmentSource,r.fragmentSource).join("\n"),f=d+h.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",ln,sn.vertexSource,on.vertexSource,rn.vertexSource,r.vertexSource).join("\n"),m=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(m,p),s.compileShader(m),s.attachShader(this.program,m);const g=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())this.failedToCreate=!0;else{s.shaderSource(g,f),s.compileShader(g),s.attachShader(this.program,g),this.attributes={},this.numAttributes=u.length;for(let e=0;e({u_dem:new e.Uniform1i(t),u_dem_prev:new e.Uniform1i(t),u_dem_unpack:new e.Uniform4f(t),u_dem_tl:new e.Uniform2f(t),u_dem_scale:new e.Uniform1f(t),u_dem_tl_prev:new e.Uniform2f(t),u_dem_scale_prev:new e.Uniform1f(t),u_dem_size:new e.Uniform1f(t),u_dem_lerp:new e.Uniform1f(t),u_exaggeration:new e.Uniform1f(t),u_depth:new e.Uniform1i(t),u_depth_size_inv:new e.Uniform2f(t),u_meter_to_dem:new e.Uniform1f(t),u_label_plane_matrix_inv:new e.UniformMatrix4f(t)}))(t)),a.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.Uniform3f(t),u_tile_tr_up:new e.Uniform3f(t),u_tile_br_up:new e.Uniform3f(t),u_tile_bl_up:new e.Uniform3f(t),u_tile_up_scale:new e.Uniform1f(t)}))(t)),a.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.UniformMatrix4f(t),u_fog_range:new e.Uniform2f(t),u_fog_color:new e.Uniform4f(t),u_fog_horizon_blend:new e.Uniform1f(t),u_fog_temporal_offset:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_globe_transition:new e.Uniform1f(t),u_is_globe:new e.Uniform1i(t),u_viewport:new e.Uniform2f(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const n=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)n[e]&&n[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const n=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)n[e]&&n[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const n=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)n[e].set(this.program,e,t[e])}}draw(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f){const m=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(r),e.setColorMode(i),e.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,a[e]);p&&p.setUniforms(this.program,e,this.binderUniforms,h,{zoom:d});const g={[m.LINES]:2,[m.TRIANGLES]:3,[m.LINE_STRIP]:1}[t];for(const n of u.get()){const r=n.vaos||(n.vaos={});(r[s]||(r[s]=new pn)).bind(e,this,l,p?p.getPaintVertexBuffers():[],c,n.vertexOffset,f||[]),m.drawElements(t,n.primitiveLength*g,m.UNSIGNED_SHORT,n.primitiveOffset*g*2)}}}function Ln(e,t){const n=Math.pow(2,t.tileID.overscaledZ),r=t.tileSize*Math.pow(2,e.transform.tileZoom)/n,i=r*(t.tileID.canonical.x+t.tileID.wrap*n),o=r*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_tile_units_to_pixels:1/I(t,1,e.transform.tileZoom),u_pixel_coord_upper:[i>>16,o>>16],u_pixel_coord_lower:[65535&i,65535&o]}}const Dn=e.create(),Rn=(t,n,r,i,o,a,s,l,c,u,h)=>{const d=n.style.light,p=d.properties.get("position"),f=[p.x,p.y,p.z],m=e.create$1();"viewport"===d.properties.get("anchor")&&(e.fromRotation(m,-n.transform.angle),e.transformMat3(f,f,m));const g=d.properties.get("color"),_=n.transform,y={u_matrix:t,u_lightpos:f,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[g.r,g.g,g.b],u_vertical_gradient:+r,u_opacity:i,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Dn,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:a};return"globe"===_.projection.name&&(y.u_tile_id=[s.canonical.x,s.canonical.y,1<{const p=Rn(t,n,r,i,o,a,s,c,u,h,d),f={u_height_factor:-Math.pow(2,s.overscaledZ)/l.tileSize/8};return e.extend(p,Ln(n,l),f)},Bn=e=>({u_matrix:e}),Fn=(t,n,r)=>e.extend(Bn(t),Ln(n,r)),Nn=(e,t)=>({u_matrix:e,u_world:t}),jn=(t,n,r,i)=>e.extend(Fn(t,n,r),{u_world:i}),Un=e.create(),Vn=(t,n,r,i,o,a)=>{const s=t.transform,l="globe"===s.projection.name;let c;if("map"===a.paint.get("circle-pitch-alignment"))if(l){const t=e.globePixelsToTileUnits(s.zoom,n.canonical)*s._pixelsPerMercatorPixel;c=Float32Array.from([t,0,0,t])}else c=s.calculatePixelsToTileUnitsMatrix(r);else c=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:s.cameraToCenterDistance,u_matrix:t.translatePosMatrix(n.projMatrix,r,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_device_pixel_ratio:e.exported.devicePixelRatio,u_extrude_scale:c,u_inv_rot_matrix:Un,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(l){u.u_inv_rot_matrix=i,u.u_merc_center=o,u.u_tile_id=[n.canonical.x,n.canonical.y,1<{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t},Gn=(t,n,r,i)=>{const o=e.EXTENT/r.tileSize;return{u_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(i),u_extrude_scale:[n.pixelsToGLUnits[0]/o,n.pixelsToGLUnits[1]/o]}},Zn=(e,t,n=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:n}),qn=e.create(),Wn=(t,n,r,i,o,a,s)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.globePixelsToTileUnits(l.zoom,n.canonical)*l._pixelsPerMercatorPixel:I(r,1,a),h={u_matrix:n.projMatrix,u_extrude_scale:u,u_intensity:s,u_inv_rot_matrix:qn,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=i,h.u_merc_center=o,h.u_tile_id=[n.canonical.x,n.canonical.y,1<{const s=e.transform,l=s.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:Kn(e,t,n,r),u_pixels_to_tile_units:l,u_device_pixel_ratio:o,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:i,u_texsize:Jn(n)?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Yn(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:a}},Xn=(e,t,n,r,i)=>{const o=e.transform;return{u_matrix:Kn(e,t,n,r),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:o.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:i,u_image:0,u_tile_units_to_pixels:Yn(t,o),u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Yn(e,t){return 1/I(e,1,t.tileZoom)}function Kn(e,t,n,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function Jn(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}const Qn=(e,t,n,r,i,o)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:n,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:(s=i.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(a=i.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:er(i.paint.get("raster-hue-rotate")),u_perspective_transform:o};var a,s};function er(e){e*=Math.PI/180;const t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const tr=e.create(),nr=(t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g)=>{const _=o.transform,y={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:n?n.uSizeT:0,u_size:n?n.uSize:0,u_camera_to_center_distance:_.cameraToCenterDistance,u_rotate_symbol:+r,u_aspect_ratio:_.width/_.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+i,u_texsize:u,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:tr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:tr,u_up_vector:[0,-1,0]};return"globe"===g.name&&(y.u_tile_id=[h.canonical.x,h.canonical.y,1<e.extend(nr(t,n,r,i,o,a,s,l,c,u,d,p,f,m,g,_),{u_gamma_scale:i?o.transform.cameraToCenterDistance*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.exported.devicePixelRatio,u_is_halo:+h}),ir=(t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,g)=>e.extend(rr(t,n,r,i,o,a,s,l,!0,c,!0,h,d,p,f,m,g),{u_texsize_icon:u,u_texture_icon:1}),or=(e,t,n)=>({u_matrix:e,u_opacity:t,u_color:n}),ar=(t,n,r,i,o)=>e.extend(function(e,t,n){const r=t.imageManager.getPattern(e.toString()),{width:i,height:o}=t.imageManager.getPixelSize(),a=Math.pow(2,n.tileID.overscaledZ),s=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,l=s*(n.tileID.canonical.x+n.tileID.wrap*a),c=s*n.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[i,o],u_pattern_size:r.displaySize,u_tile_units_to_pixels:1/I(n,1,t.transform.tileZoom),u_pixel_coord_upper:[l>>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}(i,r,o),{u_matrix:t,u_opacity:n}),sr={fillExtrusion:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t)}),fillExtrusionPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_height_factor:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t)}),fill:t=>({u_matrix:new e.UniformMatrix4f(t)}),fillPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),fillOutline:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t)}),fillOutlinePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),circle:t=>({u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),collisionBox:t=>({u_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.Uniform2f(t)}),collisionCircle:t=>({u_matrix:new e.UniformMatrix4f(t),u_inv_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_viewport_size:new e.Uniform2f(t)}),debug:t=>({u_color:new e.UniformColor(t),u_matrix:new e.UniformMatrix4f(t),u_overlay:new e.Uniform1i(t),u_overlay_scale:new e.Uniform1f(t)}),clippingMask:t=>({u_matrix:new e.UniformMatrix4f(t)}),heatmap:t=>({u_extrude_scale:new e.Uniform1f(t),u_intensity:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),heatmapTexture:t=>({u_image:new e.Uniform1i(t),u_color_ramp:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t)}),hillshade:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_latrange:new e.Uniform2f(t),u_light:new e.Uniform2f(t),u_shadow:new e.UniformColor(t),u_highlight:new e.UniformColor(t),u_accent:new e.UniformColor(t)}),hillshadePrepare:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_dimension:new e.Uniform2f(t),u_zoom:new e.Uniform1f(t),u_unpack:new e.Uniform4f(t)}),line:t=>({u_matrix:new e.UniformMatrix4f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_units_to_pixels:new e.Uniform2f(t),u_dash_image:new e.Uniform1i(t),u_gradient_image:new e.Uniform1i(t),u_image_height:new e.Uniform1f(t),u_texsize:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t),u_trim_offset:new e.Uniform2f(t)}),linePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_texsize:new e.Uniform2f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_units_to_pixels:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t)}),raster:t=>({u_matrix:new e.UniformMatrix4f(t),u_tl_parent:new e.Uniform2f(t),u_scale_parent:new e.Uniform1f(t),u_fade_t:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_image0:new e.Uniform1i(t),u_image1:new e.Uniform1i(t),u_brightness_low:new e.Uniform1f(t),u_brightness_high:new e.Uniform1f(t),u_saturation_factor:new e.Uniform1f(t),u_contrast_factor:new e.Uniform1f(t),u_spin_weights:new e.Uniform3f(t),u_perspective_transform:new e.Uniform2f(t)}),symbolIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_texture:new e.Uniform1i(t)}),symbolSDF:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_is_halo:new e.Uniform1i(t)}),symbolTextAndIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texsize_icon:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_texture_icon:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_is_halo:new e.Uniform1i(t)}),background:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_color:new e.UniformColor(t)}),backgroundPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_pattern_tl:new e.Uniform2f(t),u_pattern_br:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_pattern_size:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),terrainRaster:yn,terrainDepth:yn,skybox:t=>({u_matrix:new e.UniformMatrix4f(t),u_sun_direction:new e.Uniform3f(t),u_cubemap:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxGradient:t=>({u_matrix:new e.UniformMatrix4f(t),u_color_ramp:new e.Uniform1i(t),u_center_direction:new e.Uniform3f(t),u_radius:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxCapture:t=>({u_matrix_3f:new e.UniformMatrix3f(t),u_sun_direction:new e.Uniform3f(t),u_sun_intensity:new e.Uniform1f(t),u_color_tint_r:new e.Uniform4f(t),u_color_tint_m:new e.Uniform4f(t),u_luminance:new e.Uniform1f(t)}),globeRaster:t=>({u_proj_matrix:new e.UniformMatrix4f(t),u_globe_matrix:new e.UniformMatrix4f(t),u_normalize_matrix:new e.UniformMatrix4f(t),u_merc_matrix:new e.UniformMatrix4f(t),u_zoom_transition:new e.Uniform1f(t),u_merc_center:new e.Uniform2f(t),u_image0:new e.Uniform1i(t),u_grid_matrix:new e.UniformMatrix3f(t),u_skirt_height:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_viewport:new e.Uniform2f(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_horizon:new e.Uniform1f(t),u_transition:new e.Uniform1f(t),u_fadeout_range:new e.Uniform1f(t),u_color:new e.Uniform4f(t),u_high_color:new e.Uniform4f(t),u_space_color:new e.Uniform4f(t),u_star_intensity:new e.Uniform1f(t),u_star_density:new e.Uniform1f(t),u_star_size:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t),u_horizon_angle:new e.Uniform1f(t),u_rotation_matrix:new e.UniformMatrix4f(t)})};let lr;function cr(t,n,r,i,o,a,s){const l=t.context,c=l.gl,u=t.transform,h=t.useProgram("collisionBox"),d=[];let p=0,f=0;for(let m=0;m0){const t=e.create(),n=x;e.mul(t,y.placementInvProjMatrix,u.glCoordMatrix),e.mul(t,t,y.placementViewportMatrix),d.push({circleArray:w,circleOffset:f,transform:n,invTransform:t,projection:y.getProjection()}),p+=w.length/4,f=p}b&&(t.terrain&&t.terrain.setupElevationDraw(_,h),h.draw(l,c.LINES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,Gn(x,u,_,y.getProjection()),r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,u.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}if(!s||!d.length)return;const m=t.useProgram("collisionCircle"),g=new e.StructArrayLayout2f1f2i16;g.resize(4*p),g._trim();let _=0;for(const e of d)for(let t=0;t=0&&(m[x.associatedIconIndex]={x:S,y:k,z:M,angle:P})}else pt(E,p)}if(h){f.clear();const n=t.icon.placedSymbolArray;for(let t=0;te.sortKey-t.sortKey));for(const e of k){const n=e.state;if(t.terrain&&t.terrain.setupElevationDraw(n.tile,n.program,{useDepthForOcclusion:!S,labelPlaneMatrixInv:n.labelPlaneMatrixInv}),p.activeTexture.set(f.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,f.CLAMP_TO_EDGE),n.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),n.isSDF){const i=n.uniformValues;n.hasHalo&&(i.u_is_halo=1,mr(n.buffers,e.segments,r,t,n.program,w,h,d,i)),i.u_is_halo=0}mr(n.buffers,e.segments,r,t,n.program,w,h,d,n.uniformValues)}}function mr(t,n,r,i,o,a,s,l,c){const u=i.context,h=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.globeExtVertexBuffer];o.draw(u,u.gl.TRIANGLES,a,s,l,e.CullFaceMode.disabled,c,r.id,t.layoutVertexBuffer,t.indexBuffer,n,r.paint,i.transform.zoom,t.programConfigurations.get(r.id),h)}function gr(t,n,r,i,o,a,s){const l=t.context.gl,c=r.paint.get("fill-pattern"),u=c&&c.constantOr(1);let h,d,p,f,m;s?(d=u&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=l.LINES):(d=u?"fillPattern":"fill",h=l.TRIANGLES);for(const g of i){const i=n.getTile(g);if(u&&!i.patternsLoaded())continue;const _=i.getBucket(r);if(!_)continue;t.prepareDrawTile();const y=_.programConfigurations.get(r.id),v=t.useProgram(d,y);u&&(t.context.activeTexture.set(l.TEXTURE0),i.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers());const x=c.constantOr(null);if(x&&i.imageAtlas){const e=i.imageAtlas.patternPositions[x.toString()];e&&y.setConstantPatternPositions(e)}const b=t.translatePosMatrix(g.projMatrix,i,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(s){f=_.indexBuffer2,m=_.segments2;const e=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];p="fillOutlinePattern"===d&&u?jn(b,t,i,e):Nn(b,e)}else f=_.indexBuffer,m=_.segments,p=u?Fn(b,t,i):Bn(b);t.prepareDrawProgram(t.context,v,g.toUnwrapped()),v.draw(t.context,h,o,t.stencilModeForClipping(g),a,e.CullFaceMode.disabled,p,r.id,_.layoutVertexBuffer,f,m,r.paint,t.transform.zoom,y)}}function _r(t,n,r,i,o,a,s){const l=t.context,c=l.gl,u=t.transform,h=r.paint.get("fill-extrusion-pattern"),d=h.constantOr(1),p=r.paint.get("fill-extrusion-opacity"),f=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),r.paint.get("fill-extrusion-ambient-occlusion-radius")],m=r.layout.get("fill-extrusion-edge-radius"),g=m>0&&!r.paint.get("fill-extrusion-rounded-roof"),_=g?0:m,y="globe"===u.projection.name?e.fillExtrusionHeightLift():0,v="globe"===u.projection.name,x=v?e.globeToMercatorTransition(u.zoom):0,b=[e.mercatorXfromLng(u.center.lng),e.mercatorYfromLat(u.center.lat)],w=[];v&&w.push("PROJECTION_GLOBE_VIEW"),f[0]>0&&w.push("FAUX_AO"),g&&w.push("ZERO_ROOF_RADIUS");for(const m of i){const i=n.getTile(m),g=i.getBucket(r);if(!g||g.projection.name!==u.projection.name)continue;const E=g.programConfigurations.get(r.id),T=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",E,w);if(t.terrain){const e=t.terrain;if(t.style.terrainSetForDrapingOnly())e.setupElevationDraw(i,T,{useMeterToDem:!0});else{if(!g.enableTerrain)continue;if(e.setupElevationDraw(i,T,{useMeterToDem:!0}),yr(l,n,m,g,r,e),!g.centroidVertexBuffer){const e=T.attributes.a_centroid_pos;void 0!==e&&c.vertexAttrib2f(e,0,0)}}}d&&(t.context.activeTexture.set(c.TEXTURE0),i.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),E.updatePaintBuffers());const S=h.constantOr(null);if(S&&i.imageAtlas){const e=i.imageAtlas.patternPositions[S.toString()];e&&E.setConstantPatternPositions(e)}const k=t.translatePosMatrix(m.projMatrix,i,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),M=u.projection.createInversionMatrix(u,m.canonical),C=r.paint.get("fill-extrusion-vertical-gradient"),A=d?On(k,t,C,p,f,_,m,i,y,x,b,M):Rn(k,t,C,p,f,_,m,y,x,b,M);t.prepareDrawProgram(l,T,m.toUnwrapped());const I=[];t.terrain&&I.push(g.centroidVertexBuffer),v&&I.push(g.layoutVertexExtBuffer),T.draw(l,l.gl.TRIANGLES,o,a,s,e.CullFaceMode.backCCW,A,r.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,r.paint,t.transform.zoom,E,I)}}function yr(t,n,r,i,o,a){const s=[t=>{let n=t.canonical.x-1,r=t.wrap;return n<0&&(n=(1<{let n=t.canonical.x+1,r=t.wrap;return n===1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<{const t=n.getSource().minzoom,r=e=>{const t=n.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},i=[0,-1,1];for(const n of i){if(e.overscaledZ+n(c[0]=Math.min(t.min.y,n.min.y),c[1]=Math.max(t.max.y,n.max.y),c[2]=e.EXTENT-n.min.x>t.max.x?n.min.x-e.EXTENT:t.max.x,c),h=(t,n)=>(c[0]=Math.min(t.min.x,n.min.x),c[1]=Math.max(t.max.x,n.max.x),c[2]=e.EXTENT-n.min.y>t.max.y?n.min.y-e.EXTENT:t.max.y,c),d=[(e,t)=>u(e,t),(e,t)=>u(t,e),(e,t)=>h(e,t),(e,t)=>h(t,e)],p=new e.Point(0,0);let f,m,g;const _=(t,n,i,o,s)=>{const l=[[o?i:t,o?t:i,0],[o?i:n,o?n:i,0]],c=s<0?e.EXTENT+s:s,u=[o?c:(t+n)/2,o?(t+n)/2:c,0];return 0===i&&s<0||0!==i&&s>0?a.getForTilePoints(g,[u],!0,m):l.push(u),a.getForTilePoints(r,l,!0,f),Math.max(l[0][2],l[1][2],u[2])/a.exaggeration()};for(let t=0;t<4;t++){const n=(t<2?1:5)-t,o=i.borders[t];if(0===o.length)continue;const c=g=s[t](r),u=l(c);if(!(u&&u instanceof e.FillExtrusionBucket&&u.enableTerrain))continue;if(i.borderDoneWithNeighborZ[t]===u.canonical.z&&u.borderDoneWithNeighborZ[n]===i.canonical.z)continue;if(m=a.findDEMTileFor(c),!m||!m.dem)continue;if(!f){const e=a.findDEMTileFor(r);if(!e||!e.dem)return;f=e}const h=u.borders[n];let y=0;const v=u.borderDoneWithNeighborZ[n]!==i.canonical.z;if(i.canonical.z===u.canonical.z){for(let r=0;rs[0]+3));)v&&u.encodeCentroid(void 0,l,!1),y++;if(l&&ys[1]-3)&&(o++,++y!==h.length);)l=u.featuresOnBorder[h[y]];if(l=u.featuresOnBorder[h[r]],a.intersectsCount()>1||l.intersectsCount()>1||1!==o){1!==o&&(y=r),i.encodeCentroid(void 0,a,!1),v&&u.encodeCentroid(void 0,l,!1);continue}const c=d[t](a,l),f=t%2?e.EXTENT-1:0;p.x=_(c[0],Math.min(e.EXTENT-1,c[1]),f,t<2,c[2]),p.y=0,i.encodeCentroid(p,a,!1),v&&u.encodeCentroid(p,l,!1)}else i.encodeCentroid(void 0,a,!1)}i.borderDoneWithNeighborZ[t]=u.canonical.z,i.needsCentroidUpdate=!0,v&&(u.borderDoneWithNeighborZ[n]=i.canonical.z,u.needsCentroidUpdate=!0)}else{for(const e of o)i.encodeCentroid(void 0,i.featuresOnBorder[e],!1);if(v){for(const e of h)u.encodeCentroid(void 0,u.featuresOnBorder[e],!1);u.borderDoneWithNeighborZ[n]=i.canonical.z,u.needsCentroidUpdate=!0}i.borderDoneWithNeighborZ[t]=u.canonical.z,i.needsCentroidUpdate=!0}}(i.needsCentroidUpdate||!i.centroidVertexBuffer&&0!==i.centroidVertexArray.length)&&i.uploadCentroid(t)}const vr=new e.Color(1,0,0,1),xr=new e.Color(0,1,0,1),br=new e.Color(0,0,1,1),wr=new e.Color(1,0,1,1),Er=new e.Color(0,1,1,1);function Tr(t,n,r){const i=t.context,o=t.transform,a=i.gl,s="globe"===o.projection.name,l=s?["PROJECTION_GLOBE_VIEW"]:null;let c=r.projMatrix;if(s&&e.globeToMercatorTransition(o.zoom)>0){const t=e.transitionTileAABBinECEF(r.canonical,o),n=e.globeDenormalizeECEF(t);c=e.multiply(new Float32Array(16),o.globeMatrix,n),e.multiply(c,o.projMatrix,c)}const u=t.useProgram("debug",null,l),h=n.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(h,u);const d=e.DepthMode.disabled,p=e.StencilMode.disabled,f=t.colorModeForRenderPass(),m="$debug";i.activeTexture.set(a.TEXTURE0),t.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s?h._makeGlobeTileDebugBuffers(t.context,o):h._makeDebugTileBoundsBuffers(t.context,o.projection);const g=h._tileDebugBuffer||t.debugBuffer,_=h._tileDebugIndexBuffer||t.debugIndexBuffer,y=h._tileDebugSegments||t.debugSegments;u.draw(i,a.LINE_STRIP,d,p,f,e.CullFaceMode.disabled,Zn(c,e.Color.red),m,g,_,y,null,null,null,[h._globeTileDebugBorderBuffer]);const v=h.latestRawTileData,x=Math.floor((v&&v.byteLength||0)/1024),b=n.getTile(r).tileSize,w=512/Math.min(b,512)*(r.overscaledZ/o.zoom)*.5;let E=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(E+=` => ${r.overscaledZ}`),E+=` ${x}kb`,function(e,t){e.initDebugOverlayCanvas();const n=e.debugOverlayCanvas,r=e.context.gl,i=e.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,n.width,n.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(t,5,5),i.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,E);const T=h._tileDebugTextBuffer||t.debugBuffer,S=h._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,k=h._tileDebugTextSegments||t.debugSegments;u.draw(i,a.TRIANGLES,d,p,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,Zn(c,e.Color.transparent,w),m,T,S,k,null,null,null,[h._globeTileDebugTextBuffer])}function Sr(e,t,n,r){Mr(e,0,t+n/2,e.transform.width,n,r)}function kr(e,t,n,r){Mr(e,t-n/2,0,n,e.transform.height,r)}function Mr(t,n,r,i,o,a){const s=t.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(n*e.exported.devicePixelRatio,r*e.exported.devicePixelRatio,i*e.exported.devicePixelRatio,o*e.exported.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}const Cr=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Ar}=Cr;function Ir(e,t,n,r){e.emplaceBack(t,n,r)}class zr{constructor(t){this.vertexArray=new e.StructArrayLayout3f12,this.indices=new e.StructArrayLayout3ui6,Ir(this.vertexArray,-1,-1,1),Ir(this.vertexArray,1,-1,1),Ir(this.vertexArray,-1,1,1),Ir(this.vertexArray,1,1,1),Ir(this.vertexArray,-1,-1,-1),Ir(this.vertexArray,1,-1,-1),Ir(this.vertexArray,-1,1,-1),Ir(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Ar),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.SegmentVector.simpleSegment(0,0,36,12)}}function Pr(t,n,r,i,o,a){const s=t.gl,l=n.paint.get("sky-atmosphere-color"),c=n.paint.get("sky-atmosphere-halo-color"),u=n.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,n,r,i)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:n,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[i.r,i.g,i.b,i.a],u_luminance:5e-5}))(e.fromMat4(e.create$1(),i),o,u,l,c);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,n.skyboxTexture,0),r.draw(t,s.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.frontCW,h,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const Lr=e.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Dr{constructor(t){const n=new e.StructArrayLayout5f20;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const r=new e.StructArrayLayout3ui6;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,Lr.members),this.indexBuffer=t.createIndexBuffer(r),this.segments=e.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Rr={symbol:function(t,n,r,i,o){if("translucent"!==t.renderPass)return;const a=e.StencilMode.disabled,s=t.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(t,n,r,i,o,a,s){const l=n.transform,c="map"===o,u="map"===a;for(const n of t){const t=i.getTile(n),o=t.getBucket(r);if(!o||!o.text||!o.text.segments.get().length)continue;const a=e.evaluateSizeForZoom(o.textSizeData,l.zoom),h=vt(n,o.getProjection(),l),d=l.calculatePixelsToTileUnitsMatrix(t),p=et(h,t.tileID.canonical,u,c,l,o.getProjection(),d),f="none"!==r.layout.get("icon-text-fit")&&o.hasIconData();if(a){const r=Math.pow(2,l.zoom-t.tileID.overscaledZ);dr(o,c,u,s,e.symbolSize,l,p,n,r,a,f)}}}(i,t,r,n,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&fr(t,n,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),a,s),0!==r.paint.get("text-opacity").constantOr(1)&&fr(t,n,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),a,s),n.map.showCollisionBoxes&&(cr(t,n,r,i,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),cr(t,n,r,i,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,n,r,i){if("translucent"!==t.renderPass)return;const o=r.paint.get("circle-opacity"),a=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1);if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const c=t.context,u=c.gl,h=t.transform,d=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),p=e.StencilMode.disabled,f=t.colorModeForRenderPass(),m="globe"===h.projection.name,g=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],_=[];for(let o=0;oe.sortKey-t.sortKey));const y={useDepthForOcclusion:!m};for(const n of _){const{programConfiguration:i,program:o,layoutVertexBuffer:a,globeExtVertexBuffer:s,indexBuffer:l,uniformValues:m,tile:g}=n.state,_=n.segments;t.terrain&&t.terrain.setupElevationDraw(g,o,y),t.prepareDrawProgram(c,o,g.tileID.toUnwrapped()),o.draw(c,u.TRIANGLES,d,p,f,e.CullFaceMode.disabled,m,r.id,a,l,_,r.paint,h.zoom,i,[s])}},heatmap:function(t,n,r,i){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,a=o.gl,s=e.StencilMode.disabled,l=new e.ColorMode([a.ONE,a.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,n,r){const i=e.gl,o=t.width*r,a=t.height*r;e.activeTexture.set(i.TEXTURE1),e.viewport.set([0,0,o,a]);let s=n.heatmapFbo;if(!s||s&&(s.width!==o||s.height!==a)){s&&s.destroy();const t=i.createTexture();i.bindTexture(i.TEXTURE_2D,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),s=n.heatmapFbo=e.createFramebuffer(o,a,!1),function(e,t,n,r,i,o){const a=e.gl;a.texImage2D(a.TEXTURE_2D,0,e.isWebGL2&&e.extRenderToTextureHalfFloat?a.RGBA16F:a.RGBA,i,o,0,a.RGBA,e.extRenderToTextureHalfFloat?e.isWebGL2?a.HALF_FLOAT:e.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),r.colorAttachment.set(n)}(e,0,t,s,o,a)}else i.bindTexture(i.TEXTURE_2D,s.colorAttachment.get()),e.bindFramebuffer.set(s.framebuffer)}(o,t,r,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.Color.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:null,d=u?e.CullFaceMode.frontCCW:e.CullFaceMode.disabled,p=[e.mercatorXfromLng(c.center.lng),e.mercatorYfromLat(c.center.lat)];for(let f=0;f({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,n),n.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,n.paint,t.transform.zoom)}(t,r))},line:function(t,n,r,i){if("translucent"!==t.renderPass)return;const o=r.paint.get("line-opacity"),a=r.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),c=t.terrain&&t.terrain.renderingToTexture?1:e.exported.devicePixelRatio,u=r.paint.get("line-dasharray"),h=u.constantOr(1),d=r.layout.get("line-cap"),p=r.paint.get("line-pattern"),f=p.constantOr(1),m=r.paint.get("line-gradient"),g=f?"linePattern":"line",_=t.context,y=_.gl,v=(e=>{const t=[];Jn(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const n=e.paint.get("line-trim-offset");0===n[0]&&0===n[1]||t.push("RENDER_LINE_TRIM_OFFSET");const r=e.paint.get("line-pattern").constantOr(1),i=1!==e.paint.get("line-opacity").constantOr(1);return!r&&i&&t.push("RENDER_LINE_ALPHA_DISCARD"),t})(r);let x=v.includes("RENDER_LINE_ALPHA_DISCARD");t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(x=!1);for(const o of i){const i=n.getTile(o);if(f&&!i.patternsLoaded())continue;const a=i.getBucket(r);if(!a)continue;t.prepareDrawTile();const b=a.programConfigurations.get(r.id),w=t.useProgram(g,b,v),E=p.constantOr(null);if(E&&i.imageAtlas){const e=i.imageAtlas.patternPositions[E.toString()];e&&b.setConstantPatternPositions(e)}const T=u.constantOr(null),S=d.constantOr(null);if(!f&&T&&S&&i.lineAtlas){const e=i.lineAtlas.getDash(T,S);e&&b.setConstantPatternPositions(e)}let[k,M]=r.paint.get("line-trim-offset");if("round"===S||"square"===S){const e=1;k!==M&&(0===k&&(k-=e),1===M&&(M+=e))}const C=t.terrain?o.projMatrix:null,A=f?Xn(t,i,r,C,c):Hn(t,i,r,C,a.lineClipsArray.length,c,[k,M]);if(m){const i=a.gradients[r.id];let s=i.texture;if(r.gradientVersion!==i.version){let l=256;if(r.stepInterpolant){const r=n.getSource().maxzoom,i=o.canonical.z===r?Math.ceil(1<{w.draw(_,y.TRIANGLES,s,n,l,e.CullFaceMode.disabled,A,r.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,r.paint,t.transform.zoom,b,[a.layoutVertexBuffer2])};if(x){const n=t.stencilModeForClipping(o).ref;0===n&&t.terrain&&_.clear({stencil:0});const r={func:y.EQUAL,mask:255};A.u_alpha_discard_threshold=.8,I(new e.StencilMode(r,n,255,y.KEEP,y.KEEP,y.INVERT)),A.u_alpha_discard_threshold=0,I(new e.StencilMode(r,n,255,y.KEEP,y.KEEP,y.KEEP))}else I(t.stencilModeForClipping(o))}x&&(t.resetStencilClippingMasks(),t.terrain&&_.clear({stencil:0}))},fill:function(t,n,r,i){const o=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0===a.constantOr(1))return;const s=t.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(e.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const o=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly);gr(t,n,r,i,o,s,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const o=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,e.DepthMode.ReadOnly);gr(t,n,r,i,o,s,!0)}},"fill-extrusion":function(t,n,r,i){const o=r.paint.get("fill-extrusion-opacity");if(0!==o&&"translucent"===t.renderPass){const a=new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))_r(t,n,r,i,a,e.StencilMode.disabled,e.ColorMode.disabled),_r(t,n,r,i,a,t.stencilModeFor3D(),t.colorModeForRenderPass()),t.resetStencilClippingMasks();else{const o=t.colorModeForRenderPass();_r(t,n,r,i,a,e.StencilMode.disabled,o)}}},hillshade:function(t,n,r,i){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const o=t.context,a=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),s=t.colorModeForRenderPass(),l=t.terrain&&t.terrain.renderingToTexture,[c,u]="translucent"!==t.renderPass||l?[{},i]:t.stencilConfigForOverlap(i);for(const i of u){const o=n.getTile(i);if(o.needsHillshadePrepare&&"offscreen"===t.renderPass)_n(t,o,r,a,e.StencilMode.disabled,s);else if("translucent"===t.renderPass){const e=l&&t.terrain?t.terrain.stencilModeForRTTOverlap(i):c[i.overscaledZ];mn(t,i,o,r,a,e,s)}}o.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()},raster:function(t,n,r,i,o,a){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!i.length)return;const s=t.context,l=s.gl,c=n.getSource(),u=t.useProgram("raster"),h=t.colorModeForRenderPass(),d=t.terrain&&t.terrain.renderingToTexture,[p,f]=c instanceof Ce||d?[{},i]:t.stencilConfigForOverlap(i),m=f[f.length-1].overscaledZ,g=!t.options.moving;for(const i of f){const o=d?e.DepthMode.disabled:t.depthModeForSublayer(i.overscaledZ-m,1===r.paint.get("raster-opacity")?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly,l.LESS),f=i.toUnwrapped(),_=n.getTile(i);if(d&&(!_||!_.hasData()))continue;const y=d?i.projMatrix:t.transform.calculateProjMatrix(f,g),v=t.terrain&&d?t.terrain.stencilModeForRTTOverlap(i):p[i.overscaledZ],x=a?0:r.paint.get("raster-fade-duration");_.registerFadeDuration(x);const b=n.findLoadedParent(i,0),w=Mn(_,b,n,t.transform,x);let E,T;t.terrain&&t.terrain.prepareDrawTile();const S="nearest"===r.paint.get("raster-resampling")?l.NEAREST:l.LINEAR;s.activeTexture.set(l.TEXTURE0),_.texture.bind(S,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),b?(b.texture.bind(S,l.CLAMP_TO_EDGE),E=Math.pow(2,b.tileID.overscaledZ-_.tileID.overscaledZ),T=[_.tileID.canonical.x*E%1,_.tileID.canonical.y*E%1]):_.texture.bind(S,l.CLAMP_TO_EDGE),_.texture.useMipmap&&s.extTextureFilterAnisotropic&&t.transform.pitch>20&&l.texParameterf(l.TEXTURE_2D,s.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,s.extTextureFilterAnisotropicMax);const k=Qn(y,T||[0,0],E||1,w,r,c instanceof Ce?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(s,u,f),c instanceof Ce)c.boundsBuffer&&c.boundsSegments&&u.draw(s,l.TRIANGLES,o,e.StencilMode.disabled,h,e.CullFaceMode.disabled,k,r.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{const{tileBoundsBuffer:n,tileBoundsIndexBuffer:i,tileBoundsSegments:a}=t.getTileBoundsBuffers(_);u.draw(s,l.TRIANGLES,o,v,h,e.CullFaceMode.disabled,k,r.id,n,i,a)}}t.resetStencilClippingMasks()},background:function(t,n,r,i){const o=r.paint.get("background-color"),a=r.paint.get("background-opacity");if(0===a)return;const s=t.context,l=s.gl,c=t.transform,u=c.tileSize,h=r.paint.get("background-pattern");if(t.isPatternMissing(h))return;const d=!h&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==d)return;const p=e.StencilMode.disabled,f=t.depthModeForSublayer(0,"opaque"===d?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),m=t.colorModeForRenderPass(),g=t.useProgram(h?"backgroundPattern":"background");let _,y=i;y||(_=t.getBackgroundTiles(),y=Object.values(_).map((e=>e.tileID))),h&&(s.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));for(const d of y){const y=d.toUnwrapped(),v=i?d.projMatrix:t.transform.calculateProjMatrix(y);t.prepareDrawTile();const x=n?n.getTile(d):_?_[d.key]:new e.Tile(d,u,c.zoom,t),b=h?ar(v,a,t,h,{tileID:d,tileSize:u}):or(v,a,o);t.prepareDrawProgram(s,g,y);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:E,tileBoundsSegments:T}=t.getTileBoundsBuffers(x);g.draw(s,l.TRIANGLES,f,p,m,e.CullFaceMode.disabled,b,r.id,w,E,T)}},sky:function(t,n,r){const i=t.transform,o="mercator"===i.projection.name||"globe"===i.projection.name?1:e.smoothstep(7,8,i.zoom),a=r.paint.get("sky-opacity")*o;if(0===a)return;const s=t.context,l=r.paint.get("sky-type"),c=new e.DepthMode(s.gl.LEQUAL,e.DepthMode.ReadOnly,[0,1]),u=t.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,n,r,i){const o=t.context,a=o.gl;let s=n.skyboxFbo;if(!s){s=n.skyboxFbo=o.createFramebuffer(32,32,!1),n.skyboxGeometry=new zr(o),n.skyboxTexture=o.gl.createTexture(),a.bindTexture(a.TEXTURE_CUBE_MAP,n.skyboxTexture),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR);for(let e=0;e<6;++e)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,a.RGBA,32,32,0,a.RGBA,a.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(s.framebuffer),o.viewport.set([0,0,32,32]);const l=n.getCenter(t,!0),c=t.useProgram("skyboxCapture"),u=new Float64Array(16);e.identity(u),e.rotateY(u,u,.5*-Math.PI),Pr(o,n,c,u,l,0),e.identity(u),e.rotateY(u,u,.5*Math.PI),Pr(o,n,c,u,l,1),e.identity(u),e.rotateX(u,u,.5*-Math.PI),Pr(o,n,c,u,l,2),e.identity(u),e.rotateX(u,u,.5*Math.PI),Pr(o,n,c,u,l,3),e.identity(u),Pr(o,n,c,u,l,4),e.identity(u),e.rotateY(u,u,Math.PI),Pr(o,n,c,u,l,5),o.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,n,r,i,o){const a=t.context,s=a.gl,l=t.transform,c=t.useProgram("skybox");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,n.skyboxTexture);const u=((e,t,n,r,i)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:i}))(l.skyboxMatrix,n.getCenter(t,!1),0,i,o);t.prepareDrawProgram(a,c),c.draw(a,s.TRIANGLES,r,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,u,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(t,r,c,a,u):"gradient"===l&&"sky"===t.renderPass&&function(t,n,r,i,o){const a=t.context,s=a.gl,l=t.transform,c=t.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new zr(a)),a.activeTexture.set(s.TEXTURE0);let u=n.colorRampTexture;u||(u=n.colorRampTexture=new e.Texture(a,n.colorRamp,s.RGBA)),u.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=((t,n,r,i,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:n,u_radius:e.degToRad(r),u_opacity:i,u_temporal_offset:o}))(l.skyboxMatrix,n.getCenter(t,!1),n.paint.get("sky-gradient-radius"),i,o);t.prepareDrawProgram(a,c),c.draw(a,s.TRIANGLES,r,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,h,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(t,r,c,a,u)},debug:function(e,t,n){for(let r=0;rr)return void(this.transform.fogCullDistSq=null);const i=n+.78*(r-n);this.transform.fogCullDistSq=i*i}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(t,n){if(this.width=t*e.exported.devicePixelRatio,this.height=n*e.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._layers[e].resize()}setup(){const t=this.context,n=new e.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(e.EXTENT,0),n.emplaceBack(0,e.EXTENT),n.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,e.posAttributes.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const r=new e.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(e.EXTENT,0),r.emplaceBack(0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(r,e.posAttributes.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const i=new e.StructArrayLayout2i4;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(-1,1),i.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(i,e.posAttributes.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);const o=new e.StructArrayLayout4i8;o.emplaceBack(0,0,0,0),o.emplaceBack(e.EXTENT,0,e.EXTENT,0),o.emplaceBack(0,e.EXTENT,0,e.EXTENT),o.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.boundsAttributes.members),this.mercatorBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);const a=new e.StructArrayLayout3ui6;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);const s=new e.StructArrayLayout1ui2;for(const e of[0,1,3,2,0])s.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(s),this.emptyTexture=new e.Texture(t,new e.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.create();const l=this.context.gl;this.stencilClearMode=new e.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(e.window.performance.now()),this.atmosphereBuffer=new Dr(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,n.TRIANGLES,e.DepthMode.disabled,this.stencilClearMode,e.ColorMode.disabled,e.CullFaceMode.disabled,kn(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,r){if(!n||this.currentStencilSource===n.id||!t.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of r)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=n.id;const i=this.context,o=i.gl;this.nextStencilID+r.length>256&&this.clearStencil(),i.setColorMode(e.ColorMode.disabled),i.setDepthMode(e.DepthMode.disabled);const a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of r){const r=n.getTile(t),s=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:c,tileBoundsSegments:u}=this.getTileBoundsBuffers(r);a.draw(i,o.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:o.ALWAYS,mask:0},s,255,o.KEEP,o.KEEP,o.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,kn(t.projMatrix),"$clipping",l,c,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new e.StencilMode({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const n=this.context.gl;return new e.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,r=t.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),i=r[r.length-1].overscaledZ,o=r[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const t={};for(let r=0;r=0;this.currentLayer--){const e=this.style._layers[r[this.currentLayer]],n=t._getLayerSourceCache(e);if(e.isSky())continue;const i=n?a[n.id]:void 0;this._renderTileClippingMasks(e,n,i),this.renderLayer(this,n,e,i)}if(this.style.fog&&this.transform.projection.supportsFog&&function(t,n){const r=t.context,i=r.gl,o=t.transform,a=new e.DepthMode(i.LEQUAL,e.DepthMode.ReadOnly,[0,1]),s=t.useProgram("globeAtmosphere",null,"globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=e.globeToMercatorTransition(o.zoom),c=n.properties.get("color").toArray01(),u=n.properties.get("high-color").toArray01(),h=n.properties.get("space-color").toArray01PremultipliedAlpha(),d=e.identity$1([]);e.rotateY$1(d,d,-e.degToRad(o._center.lng)),e.rotateX$1(d,d,e.degToRad(o._center.lat)),e.rotateZ$1(d,d,o.angle),e.rotateX$1(d,d,-o._pitch);const p=e.fromQuat(new Float32Array(16),d),f=e.mapValue(n.properties.get("star-intensity"),0,1,0,.25),m=5e-4,g=e.mapValue(n.properties.get("horizon-blend"),0,1,m,.25),_=e.globeUseCustomAntiAliasing(t,r,o)&&g===m?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,y=t.frameCounter/1e3%1,v=e.length(o.globeCenterInViewSpace),x=Math.sqrt(Math.pow(v,2)-Math.pow(_,2)),b=Math.acos(x/v),w=((t,n,r,i,o,a,s,l,c,u,h,d,p,f)=>({u_frustum_tl:t,u_frustum_tr:n,u_frustum_br:r,u_frustum_bl:i,u_horizon:o,u_transition:a,u_fadeout_range:s,u_color:l,u_high_color:c,u_space_color:u,u_star_intensity:h,u_star_size:5*e.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:d,u_horizon_angle:p,u_rotation_matrix:f}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,l,g,c,u,h,f,y,b,p);t.prepareDrawProgram(r,s);const E=t.atmosphereBuffer;E&&s.draw(r,i.TRIANGLES,a,e.StencilMode.disabled,e.ColorMode.alphaBlended,e.CullFaceMode.backCW,w,"skybox",E.vertexBuffer,E.indexBuffer,E.segments)}(this,this.style.fog),this.renderPass="sky",(e.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const r=t._getLayerSourceCache(e);r&&!e.isHidden(this.transform.zoom)&&(!n||n.getSource().maxzoom0?t.pop():null}isPatternMissing(e){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const e=this.terrain&&this.terrain.renderingToTexture,t=this.terrain&&0===this.terrain.exaggeration(),n=this.style&&this.style.fog,r=[];return this.terrainRenderModeElevated()&&r.push("TERRAIN"),"globe"===this.transform.projection.name&&r.push("GLOBE"),t&&r.push("ZERO_EXAGGERATION"),n&&!e&&0!==n.getOpacity(this.transform.pitch)&&r.push("FOG"),e&&r.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&r.push("OVERDRAW_INSPECTOR"),r}useProgram(e,t,n){this.cache=this.cache||{};const r=n||[],i=this.currentGlobalDefines().concat(r),o=Pn.cacheKey(un[e],e,i,t);return this.cache[o]||(this.cache[o]=new Pn(this.context,e,un[e],t,sr[e],i)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=e.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(t,n,r){if(this.terrain&&this.terrain.renderingToTexture)return;const i=this.style.fog;if(i){const o=i.getOpacity(this.transform.pitch),a=((t,n,r,i,o,a,s,l,c,u,h)=>{const d=t.transform,p=n.properties.get("color").toArray01();p[3]=i;const f=t.frameCounter/1e3%1;return{u_fog_matrix:r?d.calculateFogTileMatrix(r):t.identityMat,u_fog_range:n.getFovAdjustedRange(d._fov),u_fog_color:p,u_fog_horizon_blend:n.properties.get("horizon-blend"),u_fog_temporal_offset:f,u_frustum_tl:o,u_frustum_tr:a,u_frustum_br:s,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.globeToMercatorTransition(d.zoom),u_is_globe:+("globe"===d.projection.name)}})(this,i,r,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.exported.devicePixelRatio,this.transform.height*e.exported.devicePixelRatio]);n.setFogUniformValues(t,a)}}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const t=this._backgroundTiles,n=this._backgroundTiles={},r=this.transform.coveringTiles({tileSize:512});for(const i of r)n[i.key]=t[i.key]||new e.Tile(i,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class Br{constructor(e=0,t=0,n=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=n,this.right=r}interpolate(t,n,r){return null!=n.top&&null!=t.top&&(this.top=e.number(t.top,n.top,r)),null!=n.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,n.bottom,r)),null!=n.left&&null!=t.left&&(this.left=e.number(t.left,n.left,r)),null!=n.right&&null!=t.right&&(this.right=e.number(t.right,n.right,r)),this}getCenter(t,n){const r=e.clamp((this.left+t-this.right)/2,0,t),i=e.clamp((this.top+n-this.bottom)/2,0,n);return new e.Point(r,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Br(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Fr(t,n){const r=e.getColumn(t,3);e.fromQuat(t,n),e.setColumn(t,3,r)}function Nr(t,n){const r=e.identity$1([]);return e.rotateZ$1(r,r,-n),e.rotateX$1(r,r,-t),r}function jr(t,n){const r=[t[0],t[1],0],i=[n[0],n[1],0];if(e.length(r)>=1e-15){const t=e.normalize([],r);e.scale$2(i,t,e.dot(i,t)),n[0]=i[0],n[1]=i[1]}const o=e.cross([],n,t);if(e.len(o)<1e-15)return null;const a=Math.atan2(-o[1],o[0]);return Nr(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),a)}class Ur{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const n=t instanceof e.MercatorCoordinate?t:new e.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(n.x=e.wrap(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const r=this.position,i=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,o=e.MercatorCoordinate.fromLngLat(t,i),a=[o.x-r.x,o.y-r.y,o.z-r.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=jr(a,n)}setPitchBearing(t,n){this.orientation=Nr(e.degToRad(t),e.degToRad(-n))}}class Vr{constructor(t,n){this._transform=e.identity([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new e.MercatorCoordinate(t[0],t[1],t[2])}get position(){const t=e.getColumn(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&e.setColumn(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.identity$1([]),t&&Fr(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Nr(e,t),Fr(this._transform,this._orientation)}forward(){const t=e.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.getColumn(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const r=new Float64Array(16);return e.invert(r,this.getWorldToCamera(t,n)),r}getWorldToCameraPosition(t,n,r){const i=this.position;e.scale$2(i,i,-t);const o=new Float64Array(16);return e.fromScaling(o,[r,r,r]),e.translate(o,o,i),o[10]*=n,o}getWorldToCamera(t,n){const r=new Float64Array(16),i=new Float64Array(4),o=this.position;return e.conjugate(i,this._orientation),e.scale$2(o,o,-t),e.fromQuat(r,i),e.translate(r,r,o),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=n,r[9]*=n,r[10]*=n,r[11]*=n,r}getCameraToClipPerspective(t,n,r,i){const o=new Float64Array(16);return e.perspective(o,t,n,r,i),o}getDistanceToElevation(t,n=!1){const r=0===t?0:e.mercatorZfromAltitude(t,n?e.latFromMercatorY(this.position[1]):this.position[1]),i=this.forward();return(r-this.position[2])/i[2]}clone(){return new Vr([...this.position],[...this.orientation])}}function $r(t,n){const r=Zr(t.projection,t.zoom,t.width,t.height),i=function(t,n,r,i,o){const a=new e.LngLat(r.lng-180*qr,r.lat),s=new e.LngLat(r.lng+180*qr,r.lat),l=t.project(a.lng,a.lat),c=t.project(s.lng,s.lat),u=-Math.atan2(c.y-l.y,c.x-l.x),h=e.MercatorCoordinate.fromLngLat(r);h.y=e.clamp(h.y,-1+qr,1-qr);const d=h.toLngLat(),p=t.project(d.lng,d.lat),f=e.MercatorCoordinate.fromLngLat(d);f.x+=qr;const m=f.toLngLat(),g=t.project(m.lng,m.lat),_=Hr(g.x-p.x,g.y-p.y,u),y=e.MercatorCoordinate.fromLngLat(d);y.y+=qr;const v=y.toLngLat(),x=t.project(v.lng,v.lat),b=Hr(x.x-p.x,x.y-p.y,u),w=Math.abs(_.x)/Math.abs(b.y),E=e.identity([]);e.rotateZ(E,E,-u*(1-(o?0:i)));const T=e.identity([]);return e.scale(T,T,[1,1-(1-w)*i,1]),T[4]=-b.x/b.y*i,e.rotateZ(T,T,u),e.multiply(T,E,T),T}(t.projection,0,t.center,r,n),o=Gr(t);return e.scale(i,i,[o,o,1]),i}function Gr(t){const n=t.projection,r=Zr(t.projection,t.zoom,t.width,t.height),i=Wr(n,t.center),o=Wr(n,e.LngLat.convert(n.center));return Math.pow(2,i*r+(1-r)*o)}function Zr(t,n,r,i,o=1/0){const a=t.range;if(!a)return 0;const s=Math.min(o,Math.max(r,i)),l=Math.log(s/1024)/Math.LN2;return e.smoothstep(a[0]+l,a[1]+l,n)}const qr=1/4e4;function Wr(t,n){const r=e.clamp(n.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),i=new e.LngLat(n.lng-180*qr,r),o=new e.LngLat(n.lng+180*qr,r),a=t.project(i.lng,r),s=t.project(o.lng,r),l=e.MercatorCoordinate.fromLngLat(i),c=e.MercatorCoordinate.fromLngLat(o),u=s.x-a.x,h=s.y-a.y,d=c.x-l.x,p=c.y-l.y,f=Math.sqrt((d*d+p*p)/(u*u+h*h));return Math.log(f)/Math.LN2}function Hr(e,t,n){const r=Math.cos(n),i=Math.sin(n);return{x:e*r-t*i,y:e*i+t*r}}class Xr{constructor(t,n,r,i,o,a,s){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=null==r?0:r,this._maxPitch=null==i?60:i,this.setProjection(a),this.setMaxBounds(s),this.width=0,this.height=0,this._center=new e.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Br,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Vr,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const e=new Xr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(e,t=!1){const n=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||n)&&this._updateCameraOnTerrain(),(e||n)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return e.pick(this.projection,["name","center","parallels"])}setProjection(n){this.projectionOptions=n||{name:"mercator"};const r=this.projection?this.getProjection():void 0;this.projection=e.getProjection(this.projectionOptions);const i=!t(r,this.getProjection());return i&&this._calcMatrices(),this.mercatorFromTransition=!1,i}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.getProjection({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.Point(this.width,this.height)}get bearing(){return e.wrap(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;var r;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(r=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r),function(e,t,n){var r=t[0],i=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=r*l+o*s,e[1]=i*l+a*s,e[2]=r*-s+o*l,e[3]=i*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.degToRad(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const e=this._elevation;this._centerAltitude=e.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=e.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let i=0,o=0;for(let a=0;at.maxzoom&&(n=t.maxzoom);const a=this.locationCoordinate(this.center),s=this.center.lat,l=1<{const n=1/4e4,r=new e.MercatorCoordinate(t.x+n,t.y,t.z),i=new e.MercatorCoordinate(t.x,t.y+n,t.z),o=t.toLngLat(),a=r.toLngLat(),s=i.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(a),u=this.locationCoordinate(s),h=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*d)*b/n},E=t=>{const n=v,r=x;return{aabb:e.tileAABB(this,l,0,0,0,t,r,n,this.projection),zoom:0,x:0,y:0,minZ:r,maxZ:n,wrap:t,fullyVisible:!1}},T=[];let S=[];const k=n,M=t.reparseOverscaled?r:n,C=e=>e*e,A=C((m-this._centerAltitude)*f),I=e=>{if(!this._elevation||!e.tileID||!o)return;const t=this._elevation.getMinMaxForTile(e.tileID),n=e.aabb;t?(n.min[2]=t.min,n.max[2]=t.max,n.center[2]=(n.min[2]+n.max[2])/2):(e.shouldSplit=z(e),e.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},z=t=>{if(t.zoom=.9)return!0}else if(i&&(a=C(t.aabb.distanceZ(g)*f)),this.projection.isReprojectedInTileSpace&&r<=5){const n=Math.pow(2,t.zoom),r=w(new e.MercatorCoordinate((t.x+.5)/n,(t.y+.5)/n));l=r>.85?1:r}const c=n*n+o*o+a,h=C((1<{if(t*C(.707)0;){const r=T.pop(),a=r.x,s=r.y;let h=r.fullyVisible;if(!h){const e=r.aabb.intersects(d);if(0===e)continue;h=2===e}if(r.zoom!==k&&z(r))for(let t=0;t<4;t++){const n=(a<<1)+t%2,c=(s<<1)+(t>>1),d={aabb:o?r.aabb.quadrant(t):e.tileAABB(this,l,r.zoom+1,n,c,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:n,y:c,wrap:r.wrap,fullyVisible:h,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};i&&!u&&(d.tileID=new e.OverscaledTileID(r.zoom+1===k?M:r.zoom+1,r.wrap,r.zoom+1,n,c),I(d)),T.push(d)}else{const i=r.zoom===k?M:r.zoom;if(t.minzoom&&t.minzoom>i)continue;const o=c[0]-(.5+a+(r.wrap<{const o=[0,0,0,1],a=[e.EXTENT,e.EXTENT,0,1],s=this.calculateFogTileMatrix(i.tileID.toUnwrapped());e.transformMat4$1(o,o,s),e.transformMat4$1(a,a,s);const l=e.getAABBPointSquareDist(o,a);if(0===l)return!0;let c=!1;const u=this._elevation;if(u&&l>n&&0!==r){const n=this.calculateProjMatrix(i.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=u.getMinMaxForTile(i.tileID)),o||(o={min:x,max:v});const a=e.furthestTileCorner(this.rotation),s=[a[0]*e.EXTENT,a[1]*e.EXTENT,o.max];e.transformMat4(s,s,n),c=(1-s[1])*this.height*.5e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const n=e.clamp(t.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),r=this.projection.project(t.lng,n);return new e.Point(r.x*this.worldSize,r.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let r,i;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;r=(n.x-o.x)/e,i=(n.y-o.y)/e}else{const e=this.pointCoordinate(n),t=this.pointCoordinate(o);r=e.x-t.x,i=e.y-t.y}const a=this.locationCoordinate(t);this.setLocation(new e.MercatorCoordinate(a.x-r,a.y-i))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,n){const r=n?e.mercatorZfromAltitude(n,t.lat):void 0,i=this.projection.project(t.lng,t.lat);return new e.MercatorCoordinate(i.x,i.y,r)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,n){const r=null!=n?n:this._centerAltitude,i=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.transformMat4$1(i,i,this.pixelMatrixInverse),e.transformMat4$1(o,o,this.pixelMatrixInverse);const a=o[3];e.scale$1(i,i,1/i[3]),e.scale$1(o,o,1/a);const s=i[2],l=o[2];return{p0:i,p1:o,t:s===l?0:(r-s)/(l-s)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.transformMat4$1(n,n,this.pixelMatrixInverse),e.transformMat4$1(r,r,this.pixelMatrixInverse),e.scale$1(n,n,1/n[3]),e.scale$1(r,r,1/r[3]),n[2]=e.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,r[2]=e.mercatorZfromAltitude(r[2],this._center.lat)*this.worldSize,e.scale$1(n,n,1/this.worldSize),e.scale$1(r,r,1/this.worldSize),new e.Ray([n[0],n[1],n[2]],e.normalize([],e.sub([],r,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:r,t:i}=t,o=e.mercatorZfromAltitude(n[2],this._center.lat),a=e.mercatorZfromAltitude(r[2],this._center.lat);return new e.MercatorCoordinate(e.number(n[0],r[0],i)/this.worldSize,e.number(n[1],r[1],i)/this.worldSize,e.number(o,a,i))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let n=this.projection.pointCoordinate3D(this,t.x,t.y);if(n)return new e.MercatorCoordinate(n[0],n[1],n[2]);let r=0,i=this.horizonLineFromTop();if(t.y>i)return this.pointCoordinate(t);const o=.02*i,a=t.clone();for(let t=0;t<10&&i-r>o;t++){a.y=e.number(r,i,.66);const t=this.projection.pointCoordinate3D(this,a.x,a.y);t?(i=a.y,n=t):r=a.y}return n?new e.MercatorCoordinate(n[0],n[1],n[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const r=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,i=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.transformMat4$1(i,i,this.pixelMatrix),i[3]>0?new e.Point(i[0]/i[3],i[1]/i[3]):new e.Point(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,i=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.Point(n,t)),a=this.pointLocation3D(new e.Point(i,t)),s=this.pointLocation3D(new e.Point(i,r)),l=this.pointLocation3D(new e.Point(n,r));let c=Math.min(o.lng,a.lng,s.lng,l.lng),u=Math.max(o.lng,a.lng,s.lng,l.lng),h=Math.min(o.lat,a.lat,s.lat,l.lat),d=Math.max(o.lat,a.lat,s.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,m=(t,n,r,i,o)=>{const a=(t+r)/2,s=(n+i)/2,l=new e.Point(a,s),{lng:g,lat:_}=this.pointLocation3D(l),y=Math.max(0,c-g,h-_,g-u,_-d);c=Math.min(c,g),u=Math.max(u,g),h=Math.min(h,_),d=Math.max(d,_),(op)&&(m(t,n,a,s,o+1),m(a,s,r,i,o+1))};if(m(n,t,i,t,1),m(i,t,i,r,1),m(i,r,n,r,1),m(n,r,n,t,1),"globe"===this.projection.name){const[t,n]=e.polesInViewport(this);t?(d=90,u=180,c=-180):n&&(h=-90,u=180,c=-180)}return new e.LngLatBounds(new e.LngLat(c,h),new e.LngLat(u,d))}_getBoundsRectangular(t,n){const{top:r,left:i}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,a=this.width-this._edgeInsets.right,s=new e.Point(i,r),l=new e.Point(a,r),c=new e.Point(a,o),u=new e.Point(i,o);let h=this.pointCoordinate(s,t),d=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,n),f=this.pointCoordinate(u,n),m=(e,t)=>(t.y-e.y)/(t.x-e.x);return h.y>1&&d.y>=0?h=new e.MercatorCoordinate((1-f.y)/m(f,h)+f.x,1):h.y<0&&d.y<=1&&(h=new e.MercatorCoordinate(-f.y/m(f,h)+f.x,0)),d.y>1&&h.y>=0?d=new e.MercatorCoordinate((1-p.y)/m(p,d)+p.x,1):d.y<0&&h.y<=1&&(d=new e.MercatorCoordinate(-p.y/m(p,d)+p.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(p))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const n=t.dem.tree;e.min=Math.min(e.min,n.minimums[0]),e.max=Math.max(e.max,n.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.MAX_MERCATOR_LATITUDE,this.maxLat=e.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngh&&(s=h-c),h-ut&&(a=t-l),t-e.5?x-1:x,b>.5?b-1:b,0]),this.alignedProjMatrix=w,s=e.create(),e.scale(s,s,[this.width/2,-this.height/2,1]),e.translate(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=e.create(),e.scale(s,s,[1,-1,1]),e.translate(s,s,[-1,-1,0]),e.scale(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},s=e.invert(new Float64Array(16),this.pixelMatrix),!s)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=s,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(t,t,o),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=s;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,r=this._camera.position,i=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,n];e.scale$2(o,o,i),e.scale$2(r,r,-1),e.multiply$2(r,r,o);const a=e.create();e.translate(a,a,r),e.scale(a,a,o),this.mercatorFogMatrix=a,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,i)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),r=this.point,i=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-n[0]*i,r.y/this.worldSize-n[1]*i,e/this.worldSize*this._centerAltitude-n[2]*i]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],i=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),i>0&&(o=Math.min((n-r)/i,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:r,bearing:i}=this._camera.getPitchBearing(),o=e.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,a=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.degToRad(this._maxPitch)),s=Math.max((t[2]-o)/Math.cos(r),a),l=this._zoomFromMercatorZ(s);e.scaleAndAdd(t,t,n,s),this._pitch=e.clamp(r,e.degToRad(this.minPitch),e.degToRad(this.maxPitch)),this.angle=e.wrap(i,-Math.PI,Math.PI),this._setZoom(e.clamp(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,r=e.GLOBE_ZOOM_THRESHOLD_MAX,i=0,o=1/0;for(;r-n>1e-6&&r>n;){const e=n+.5*(r-n),a=this.tileSize*Math.pow(2,e),s=this.getCameraToCenterDistance(this.projection,e,a),l=this.scaleZoom(s/(t*this.tileSize)),c=Math.abs(e-l);cc||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.Point(0,0),new e.Point(this.width,this.height))}zoomDeltaToMovement(t,n){const r=e.length(e.sub([],this._camera.position,t)),i=this._zoomFromMercatorZ(r)+n;return r-this._mercatorZfromZoom(i)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,n,r],i){const o=[t,n,r,1];e.transformMat4$1(o,o,i);const a=o[3]=Math.max(o[3],1e-6);return o[0]/=a,o[1]/=a,o[2]/=a,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.Point(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.Point(0,t))}}getCameraToCenterDistance(e,t=this.zoom,n=this.worldSize){const r=Zr(e,t,this.width,this.height,1024),i=e.pixelSpaceConversion(this.center.lat,n,r);return.5/Math.tan(.5*this._fov)*this.height*i}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.multiply(t,t,this.globeMatrix),t}}function Yr(e,t){let n=!1,r=null;const i=()=>{r=null,n&&(e(),r=setTimeout(i,t),n=!1)};return()=>(n=!0,r||i(),r)}class Kr{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Yr(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,e.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),e.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const n=Jr(t);if(this._hashName){const t=this._hashName;let r=!1;const i=e.window.location.hash.slice(1).split("&").map((e=>{const i=e.split("=")[0];return i===t?(r=!0,`${i}=${n}`):e})).filter((e=>e));return r||i.push(`${t}=${n}`),`#${i.join("&")}`}return`#${n}`}_getCurrentHash(){const t=e.window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((e=>e.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const n=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=e.window.location.href.replace(/(#.+)?$/,this.getHashString());e.window.history.replaceState(e.window.history.state,null,t)}}function Jr(e,t){const n=e.getCenter(),r=Math.round(100*e.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(n.lng*o)/o,s=Math.round(n.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${a}/${s}/${r}`:`${r}/${s}/${a}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const Qr={linearity:.3,easing:e.bezier(0,0,.3,1)},ei=e.extend({deceleration:2500,maxSpeed:1400},Qr),ti=e.extend({deceleration:20,maxSpeed:1400},Qr),ni=e.extend({deceleration:1e3,maxSpeed:360},Qr),ri=e.extend({deceleration:1e3,maxSpeed:90},Qr);class ii{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=e.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new e.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,e.panDelta&&n.pan._add(e.panDelta),e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(n.pan.mag()){const o=ai(n.pan.mag(),r,e.extend({},ei,t||{}));i.offset=n.pan.mult(o.amount/n.pan.mag()),i.center=this._map.transform.center,oi(i,o)}if(n.zoom){const e=ai(n.zoom,r,ti);i.zoom=this._map.transform.zoom+e.amount,oi(i,e)}if(n.bearing){const t=ai(n.bearing,r,ni);i.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),oi(i,t)}if(n.pitch){const e=ai(n.pitch,r,ri);i.pitch=this._map.transform.pitch+e.amount,oi(i,e)}if(i.zoom||i.bearing){const e=void 0===n.pinchAround?n.around:n.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),i.noMoveStart=!0,i}}function oi(e,t){(!e.duration||e.durationn.unproject(e))),s=o.reduce(((e,t,n,r)=>e.add(t.div(r.length))),new e.Point(0,0));super(t,{points:o,point:s,lngLats:a,lngLat:n.unproject(s),originalEvent:r}),this._defaultPrevented=!1}}class ci extends e.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}}class ui{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new ci(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new si(e.type,this._map,e))}mouseup(e){this._map.fire(new si(e.type,this._map,e))}preclick(t){const n=e.extend({},t);n.type="preclick",this._map.fire(new si(n.type,this._map,n))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new si(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new si(e.type,this._map,e))}mouseover(e){this._map.fire(new si(e.type,this._map,e))}mouseout(e){this._map.fire(new si(e.type,this._map,e))}touchstart(e){return this._firePreventable(new li(e.type,this._map,e))}touchmove(e){this._map.fire(new li(e.type,this._map,e))}touchend(e){this._map.fire(new li(e.type,this._map,e))}touchcancel(e){this._map.fire(new li(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hi{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new si(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new si("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new si(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class di{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const n=t,r=this._startPos,i=this._lastPos;if(!r||!i||i.equals(n)||!this._box&&n.dist(r){this._box&&(this._box.style.transform=`translate(${a}px,${l}px)`,this._box.style.width=s-a+"px",this._box.style.height=c-l+"px")}))}mouseupWindow(t,n){if(!this._active)return;const r=this._startPos,i=n;if(r&&0===t.button){if(this.reset(),p(),r.x!==i.x||r.y!==i.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,i,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),h(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new e.Event(t,{originalEvent:n}))}}function pi(e,t){const n={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const n=new e.Point(0,0);for(const e of t)n._add(e);return n.div(t.length)}(n),this.touches=pi(r,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;const r=pi(n,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class mi{constructor(e){this.singleTap=new fi(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){const r=this.singleTap.touchend(e,t,n);if(r){const t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class gi{constructor(){this._zoomIn=new mi({numTouches:1,numTaps:2}),this._zoomOut=new mi({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){const r=this._zoomIn.touchend(e,t,n),i=this._zoomOut.touchend(e,t,n);return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):i?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(i)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const _i={0:1,2:2};class yi{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const n=g(e);this._correctButton(e,n)&&(this._lastPoint=t,this._eventButton=n)}mousemoveWindow(e,t){const n=this._lastPoint;if(n)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const n=_i[t];return void 0===e.buttons||(e.buttons&n)!==n}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(n)0&&(this._active=!0);const i=pi(r,n),o=new e.Point(0,0),a=new e.Point(0,0);let s=0;for(const e in i){const t=i[e],n=this._touches[e];n&&(o._add(t),a._add(t.sub(n)),s++,i[e]=t)}if(this._touches=i,s{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")}),500)}}class Ei{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,n){return{}}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){const r=this._firstTwoTouches;if(!r)return;e.preventDefault();const[i,o]=r,a=Ti(n,t,i),s=Ti(n,t,o);if(!a||!s)return;const l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;const[r,i]=this._firstTwoTouches,o=Ti(n,t,r),a=Ti(n,t,i);o&&a||(this._active&&p(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ti(e,t,n){for(let r=0;rMath.abs(e.x)}class Ii extends Ei{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,Ai(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,n,r){const i=this._lastPoints;if(!i)return;const o=t[0].sub(i[0]),a=t[1].sub(i[1]);return this._map._cooperativeGestures&&!e.isFullscreen()&&r.touches.length<3||(this._valid=this.gestureBeginsVertically(o,a,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5})}gestureBeginsVertically(e,t,n){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,i=t.mag()>=2;if(!r&&!i)return;if(!r||!i)return null==this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return Ai(e)&&Ai(t)&&o}}const zi={panStep:100,bearingStep:15,pitchStep:10};class Pi{constructor(){const e=zi;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,r=0,i=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),i=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),i=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:Li,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:a.getBearing()+n*this._bearingStep,pitch:a.getPitch()+r*this._pitchStep,offset:[-i*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Li(e){return e*(2-e)}const Di=4.000244140625;class Ri{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===e.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=e.exported.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==n&&n%Di==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(i*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=f(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Di?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);const i=n(),o=Math.pow(2,i),a="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(a*r))),"wheel"===this._type&&(this._startZoom=i,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"==typeof this._targetZoom?this._targetZoom:n(),i=this._startZoom,o=this._easing;let a,s=!1;if("wheel"===this._type&&i&&o){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),n=o(t);a=e.number(i,r,n),t<1?this._frameId||(this._frameId=!0):s=!0}else a=r,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:a-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=e.ease;if(this._prevEase){const t=this._prevEase,r=(e.exported.now()-t.start)/t.duration,i=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(i*i+1e-4)*.01,a=Math.sqrt(.0729-o*o);n=e.bezier(o,a,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=o("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(e.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")}),200)}}class Oi{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Bi{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(e.shiftKey?-1:1),around:n.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fi{constructor(){this._tap=new mi({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,n){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=t[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(e,t,n))}touchmove(e,t,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const r=t[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(e,t,n)}touchend(e,t,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(e,t,n)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ni{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ji{constructor(e,t,n){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ui{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Vi=e=>e.zoom||e.drag||e.pitch||e.rotate;class $i extends e.Event{}class Gi{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const r=e.sub([],n,t);this.radius=e.length(r[2]<0?e.div([],r,this.constants):[r[0],r[1],0])}projectRay(t){e.div(t,t,this.constants),e.normalize(t,t),e.mul$1(t,t,this.constants);const n=e.scale$2([],t,this.radius);if(n[2]>0){const t=e.scale$2([],[0,0,1],e.dot(n,[0,0,1])),r=e.scale$2([],e.normalize([],[n[0],n[1],0]),this.radius),i=e.add([],n,e.scale$2([],e.sub([],e.add([],r,t),n),2));n[0]=i[0],n[1]=i[1]}return n}}function Zi(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class qi{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ii(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Gi,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),e.bindAll(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[e.window.document,"mousemove",{capture:!0}],[e.window.document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[e.window,"blur",void 0]];for(const[t,n,r]of this._listeners)t.addEventListener(n,t===e.window.document?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(const[t,n,r]of this._listeners)t.removeEventListener(n,t===e.window.document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){const t=this._map,n=t.getCanvasContainer();this._add("mapEvent",new ui(t,e));const r=t.boxZoom=new di(t,e);this._add("boxZoom",r);const i=new gi,o=new Bi;t.doubleClickZoom=new Oi(o,i),this._add("tapZoom",i),this._add("clickZoom",o);const a=new Fi;this._add("tapDragZoom",a);const s=t.touchPitch=new Ii(t);this._add("touchPitch",s);const l=new xi(e),c=new bi(e);t.dragRotate=new ji(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new vi(e),h=new wi(t,e);t.dragPan=new Ni(n,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new Ci,p=new ki;t.touchZoomRotate=new Ui(n,p,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new hi(t));const f=t.scrollZoom=new Ri(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new Pi;this._add("keyboard",m);for(const n of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[n]&&t[n].enable(e[n])}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vi(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,n){for(const r in e)if(r!==n&&(!t||t.indexOf(r)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const n of e)this._el.contains(n.target)&&t.push(n);return t}handleEvent(e,t){this._updatingCamera=!0;const n="renderFrame"===e.type,r=n?void 0:e,i={needsRenderFrame:!1},o={},a={},s=e.touches?this._getMapTouches(e.touches):void 0,l=s?m(this._el,s):n?void 0:f(this._el,e);for(const{handlerName:n,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(a,u,n)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,s),this.mergeHandlerResult(i,o,h,n,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(a[n]=c)}const c={};for(const e in this._previousActiveHandlers)a[e]||(c[e]=r);this._previousActiveHandlers=a,(Object.keys(c).length||Zi(i))&&(this._changes.push([i,o,c]),this._triggerRenderFrame()),(Object.keys(a).length||Zi(i))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=i;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,n,r,i,o){if(!r)return;e.extend(t,r);const a={handlerName:i,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(n.zoom=a),void 0!==r.panDelta&&(n.drag=a),void 0!==r.pitchDelta&&(n.pitch=a),void 0!==r.bearingDelta&&(n.rotate=a)}_applyChanges(){const t={},n={},r={};for(const[i,o,a]of this._changes)i.panDelta&&(t.panDelta=(t.panDelta||new e.Point(0,0))._add(i.panDelta)),i.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+i.pitchDelta),void 0!==i.around&&(t.around=i.around),void 0!==i.aroundCoord&&(t.aroundCoord=i.aroundCoord),void 0!==i.pinchAround&&(t.pinchAround=i.pinchAround),i.noInertia&&(t.noInertia=i.noInertia),e.extend(n,o),e.extend(r,a);this._updateMapTransform(t,n,r),this._changes=[]}_updateMapTransform(t,n,r){const i=this._map,o=i.transform,a=e=>[e.x,e.y,e.z];if((e=>{const t=this._eventsInProgress.drag;return t&&!this._handlersById[t.handlerName].isActive()})()&&!Zi(t)){const e=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&i._stop(!0),!Zi(t))return void this._fireEvents(n,r,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==p&&(h=p),(l||(e=>n[e]&&!this._eventsInProgress[e])("drag"))&&h&&(this._dragOrigin=a(o.pointCoordinate3D(h)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",i._stop(!0),h=h||i.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(s)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(s)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){s=s.rotate(-o.angle);const n=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-s.x*e.mercatorScale(e.latFromMercatorY(t.y))*n,f[1]=-s.y*e.mercatorScale(o.center.lat)*n}else{const e=o.pointCoordinate(h.sub(s));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const m=o.zoom,g=[0,0,0];if(l){const t=a(d||o.pointCoordinate3D(h)),n={dir:e.normalize([],e.sub([],t,o._camera.position))};if(n.dir[2]<0){const r=o.zoomDeltaToMovement(t,l);e.scale$2(g,n.dir,r)}}const _=e.add(f,f,g);o._translateCameraConstrained(_),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,r,!0)}_fireEvents(t,n,r){const i=Vi(this._eventsInProgress),o=Vi(t),a={};for(const e in t){const{originalEvent:n}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=n),this._eventsInProgress[e]=t[e]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in a)this._fireEvent(e,a[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:n}=t[e];this._fireEvent(e,n)}const s={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=n[t]||r,s[`${e}end`]=l)}for(const e in s)this._fireEvent(e,s[e]);const c=Vi(this._eventsInProgress);if(r&&(i||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new $i("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Wi="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Hi extends e.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=!1!==n.respectPrefersReducedMotion,e.bindAll(["_renderFrameCallback"],this)}getCenter(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,n,r){return t=e.Point.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},n),r)}panTo(t,n,r){return this.easeTo(e.extend({center:t},n),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,n,r){return this.easeTo(e.extend({zoom:t},n),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,n,r){return this.easeTo(e.extend({bearing:t},n),r)}resetNorth(t,n){return this.rotateTo(0,e.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?n/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,n,r,i,o,a){const s=t.clone(),l=this._extendCameraOptions(a);s.bearing=i,s.pitch=o;const c=e.LngLat.convert(n),u=e.LngLat.convert(r),h=.5*(c.lat+u.lat),d=.5*(c.lng+u.lng),p=e.latLngToECEF(h,d),f=e.normalize([],p),m=e.normalize([],e.cross([],f,[0,1,0])),g=e.cross([],m,f),_=[m[0],m[1],m[2],0,g[0],g[1],g[2],0,f[0],f[1],f[2],0,0,0,0,1],y=[p,e.latLngToECEF(c.lat,c.lng),e.latLngToECEF(u.lat,c.lng),e.latLngToECEF(u.lat,u.lng),e.latLngToECEF(c.lat,u.lng),e.latLngToECEF(h,c.lng),e.latLngToECEF(h,u.lng),e.latLngToECEF(c.lat,d),e.latLngToECEF(u.lat,d)];let v=e.Aabb.fromPoints(y.map((t=>[e.dot(m,t),e.dot(g,t),e.dot(f,t)])));const x=e.transformMat4([],v.center,_);0===e.squaredLength(x)&&e.set(x,0,0,1),e.normalize(x,x),e.scale$2(x,x,e.GLOBE_RADIUS),s.center=e.ecefToLatLng(x);const b=s.getWorldToCameraMatrix(),w=e.invert(new Float64Array(16),b);v=e.Aabb.applyTransform(v,e.multiply([],b,_)),e.transformMat4(x,x,b);const E=.5*(v.max[2]-v.min[2]),T=this._minimumAABBFrustumDistance(s,v),S=e.scale$2([],[0,0,1],E),k=e.add(S,x,S),M=T+(0===s.pitch?0:e.distance(x,k)),C=s.globeCenterInViewSpace,A=e.sub([],x,[C[0],C[1],C[2]]);e.normalize(A,A),e.scale$2(A,A,M);const I=e.add([],x,A);e.transformMat4(I,I,w);const z=e.earthRadius/e.GLOBE_RADIUS,P=e.length(I),L=e.mercatorZfromAltitude(Math.max(P*z-e.earthRadius,Number.EPSILON),0),D=Math.min(s.zoomFromMercatorZAdjusted(L),l.maxZoom);return D>.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"mercator"}),s.zoom=D,this._cameraForBounds(s,n,r,i,o,a)):{center:s.center,zoom:D,bearing:i,pitch:o}}queryTerrainElevation(t,n){const r=this.transform.elevation;return r?(n=e.extend({},{exaggerated:!0},n),r.getAtPoint(e.MercatorCoordinate.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,r,i,o,a){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,n,r,i,o,a);const s=t.clone(),l=this._extendCameraOptions(a),c=s.padding;s.bearing=i,s.pitch=o;const u=e.LngLat.convert(n),h=e.LngLat.convert(r),d=new e.LngLat(u.lng,h.lat),p=new e.LngLat(h.lng,u.lat),f=s.project(u),m=s.project(h),g=this.queryTerrainElevation(u),_=this.queryTerrainElevation(h),y=this.queryTerrainElevation(d),v=this.queryTerrainElevation(p),x=[[f.x,f.y,Math.min(g||0,_||0,y||0,v||0)],[m.x,m.y,Math.max(g||0,_||0,y||0,v||0)]];let b=e.Aabb.fromPoints(x);const w=s.getWorldToCameraMatrix(),E=e.invert(new Float64Array(16),w);b=e.Aabb.applyTransform(b,w);const T=e.sub([],b.max,b.min),S=c.left||0,k=c.right||0,M=c.bottom||0,C=c.top||0,{left:A,right:I,top:z,bottom:P}=l.padding,L=.5*(S+k),D=.5*(C+M),R=Math.min(s.scaleZoom(s.scale*Math.min((s.width-(S+k+A+I))/T[0],(s.height-(M+C+P+z))/T[1])),l.maxZoom),O=s.scale/s.zoomScale(R);b=new e.Aabb([b.min[0]-(A+L)*O,b.min[1]-(P+D)*O,b.min[2]],[b.max[0]+(I+L)*O,b.max[1]+(z+D)*O,b.max[2]]);const B=.5*T[2],F=this._minimumAABBFrustumDistance(s,b),N=[0,0,1,0];e.transformMat4$1(N,N,w),e.normalize$2(N,N);const j=e.scale$2([],N,F+B),U=e.add([],b.center,j),V=("number"==typeof l.offset.x&&"number"==typeof l.offset.y?new e.Point(l.offset.x,l.offset.y):e.Point.convert(l.offset)).rotate(-e.degToRad(i));b.center[0]-=V.x*O,b.center[1]+=V.y*O,e.transformMat4(b.center,b.center,E),e.transformMat4(U,U,E);const $=[b.center[0],b.center[1],U[2]*s.pixelsPerMeter];e.scale$2($,$,1/s.worldSize);const G=e.lngFromMercatorX($[0]),Z=e.latFromMercatorY($[1]),q=Math.min(s._zoomFromMercatorZ($[2]),l.maxZoom),W=new e.LngLat(G,Z);return s.mercatorFromTransition&&q<.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"globe"}),s.zoom=q,this._cameraForBounds(s,n,r,i,o,a)):{center:W,zoom:q,bearing:i,pitch:o}}fitBounds(e,t,n){const r=this.cameraForBounds(e,t);return this._fitInternal(r,t,n)}fitScreenCoordinates(t,n,r,i,o){const a=e.Point.convert(t),s=e.Point.convert(n),l=new e.Point(Math.min(a.x,s.x),Math.min(a.y,s.y)),c=new e.Point(Math.max(a.x,s.x),Math.max(a.y,s.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(a,s))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.Point(l.x,c.y)),p=this.transform.pointLocation3D(new e.Point(c.x,l.y)),f=[Math.min(u.lng,h.lng,d.lng,p.lng),Math.min(u.lat,h.lat,d.lat,p.lat)],m=[Math.max(u.lng,h.lng,d.lng,p.lng),Math.max(u.lat,h.lat,d.lat,p.lat)],g=i&&i.pitch?i.pitch:this.getPitch(),_=this._cameraForBounds(this.transform,f,m,r,g,i);return this._fitInternal(_,i,o)}_fitInternal(t,n,r){return t?(delete(n=e.extend(t,n)).padding,n.linear?this.easeTo(n,r):this.flyTo(n,r)):this}jumpTo(t,n){this.stop();const r=t.preloadOnly?this.transform.clone():this.transform;let i=!1,o=!1,a=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(i=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.LngLat.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(o=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(a=!0,r.pitch=+t.pitch),null==t.padding||r.isPaddingEqual(t.padding)||(r.padding=t.padding),t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.Event("movestart",n)).fire(new e.Event("move",n)),i&&this.fire(new e.Event("zoomstart",n)).fire(new e.Event("zoom",n)).fire(new e.Event("zoomend",n)),o&&this.fire(new e.Event("rotatestart",n)).fire(new e.Event("rotate",n)).fire(new e.Event("rotateend",n)),a&&this.fire(new e.Event("pitchstart",n)).fire(new e.Event("pitch",n)).fire(new e.Event("pitchend",n)),this.fire(new e.Event("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.warnOnce(Wi),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const r=this.transform;if(!r.projection.supportsFreeCamera)return e.warnOnce(Wi),this;this.stop();const i=r.zoom,o=r.pitch,a=r.bearing;r.setFreeCameraOptions(t);const s=i!==r.zoom,l=o!==r.pitch,c=a!==r.bearing;return this.fire(new e.Event("movestart",n)).fire(new e.Event("move",n)),s&&this.fire(new e.Event("zoomstart",n)).fire(new e.Event("zoom",n)).fire(new e.Event("zoomend",n)),c&&this.fire(new e.Event("rotatestart",n)).fire(new e.Event("rotate",n)).fire(new e.Event("rotateend",n)),l&&this.fire(new e.Event("pitchstart",n)).fire(new e.Event("pitch",n)).fire(new e.Event("pitchend",n)),this.fire(new e.Event("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const r=this.transform,i=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in t?+t.zoom:i,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:a,h="padding"in t?t.padding:r.padding,d=e.Point.convert(t.offset);let p,f,m;if("globe"===r.projection.name){const n=e.MercatorCoordinate.fromLngLat(r.center),i=d.rotate(-r.angle);n.x+=i.x/r.worldSize,n.y+=i.y/r.worldSize;const o=n.toLngLat(),a=e.LngLat.convert(t.center||o);this._normalizeCenter(a),p=r.centerPoint.add(i),f=new e.Point(n.x,n.y).mult(r.worldSize),m=new e.Point(e.mercatorXfromLng(a.lng),e.mercatorYfromLat(a.lat)).mult(r.worldSize).sub(f)}else{p=r.centerPoint.add(d);const n=r.pointLocation(p),i=e.LngLat.convert(t.center||n);this._normalizeCenter(i),f=r.project(n),m=r.project(i).sub(f)}const g=r.zoomScale(l-i);let _,y;t.around&&(_=e.LngLat.convert(t.around),y=r.locationPoint(_));const v=this._zooming||l!==i,x=this._rotating||o!==c,b=this._pitching||u!==a,w=!r.isPaddingEqual(h),E=r=>E=>{if(v&&(r.zoom=e.number(i,l,E)),x&&(r.bearing=e.number(o,c,E)),b&&(r.pitch=e.number(a,u,E)),w&&(r.interpolatePadding(s,h,E),p=r.centerPoint.add(d)),_)r.setLocationAtPoint(_,y);else{const e=r.zoomScale(r.zoom-i),t=l>i?Math.min(2,g):Math.max(.5,g),n=Math.pow(t,1-E),o=r.unproject(f.add(m.mult(E*n)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(n),r};if(t.preloadOnly){const e=this._emulate(E,t.duration,r);return this._preloadTiles(e),this}const T={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=x,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,T),this._ease(E(r),(e=>{r.recenterOnTerrain(),this._afterEase(n,e)}),t),this}_prepareEase(t,n,r={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||r.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,i=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.Event("zoomend",t)),i&&this.fire(new e.Event("rotateend",t)),o&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const r=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,n)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const r=this.transform,i=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,r.minZoom,r.maxZoom):i,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:a,h="padding"in t?t.padding:r.padding,d=r.zoomScale(l-i),p=e.Point.convert(t.offset);let f=r.centerPoint.add(p);const m=r.pointLocation(f),g=e.LngLat.convert(t.center||m);this._normalizeCenter(g);const _=r.project(m),y=r.project(g).sub(_);let v=t.curve;const x=Math.max(r.width,r.height),b=x/d,w=y.mag();if("minZoom"in t){const n=e.clamp(Math.min(t.minZoom,i,l),r.minZoom,r.maxZoom),o=x/r.zoomScale(n-i);v=Math.sqrt(o/w*2)}const E=v*v;function T(e){const t=(b*b-x*x+(e?-1:1)*E*E*w*w)/(2*(e?b:x)*E*w);return Math.log(Math.sqrt(t*t+1)-t)}function S(e){return(Math.exp(e)-Math.exp(-e))/2}function k(e){return(Math.exp(e)+Math.exp(-e))/2}const M=T(0);let C=function(e){return k(M)/k(M+v*e)},A=function(e){return x*((k(M)*(S(t=M+v*e)/k(t))-S(M))/E)/w;var t},I=(T(1)-M)/v;if(Math.abs(w)<1e-6||!isFinite(I)){if(Math.abs(x-b)<1e-6)return this.easeTo(t,n);const e=bt.maxDuration&&(t.duration=0);const z=o!==c,P=u!==a,L=!r.isPaddingEqual(h),D=r=>d=>{const m=d*I,v=1/C(m);r.zoom=1===d?l:i+r.scaleZoom(v),z&&(r.bearing=e.number(o,c,d)),P&&(r.pitch=e.number(a,u,d)),L&&(r.interpolatePadding(s,h,d),f=r.centerPoint.add(p));const x=1===d?g:r.unproject(_.add(y.mult(A(m))).mult(v));return r.setLocationAtPoint(r.renderWorldCopies?x.wrap():x,f),r._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),r};if(t.preloadOnly){const e=this._emulate(D,t.duration,r);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=z,this._pitching=P,this._padding=L,this._prepareEase(n,!1),this._ease(D(r),(()=>this._afterEase(n)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,n,r){!1===r.animate||0===r.duration?(t(1),n()):(this._easeStart=e.exported.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=e.wrap(t,-180,180);const r=Math.abs(t-n);return Math.abs(t-360-n)180?-360:n<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.exported.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,n){const r=Math.ceil(15*t/1e3),i=[],o=e(n.clone());for(let e=0;e<=r;e++){const t=o(e/r);i.push(t.clone())}return i}}class Xi{constructor(t={}){this.options=t,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact;return this._map=e,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o("button","mapboxgl-ctrl-attrib-button",this._container),o("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(e,t){const n=this._map._getUIString(`AttributionControl.${t}`);e.setAttribute("aria-label",n),e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.config.ACCESS_TOKEN}];if(t){const r=n.reduce(((e,t,r)=>(t.value&&(e+=`${t.key}=${t.value}${re.length-t.length)),e=e.filter(((t,n)=>{for(let r=n+1;r=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const n=e.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Yi{constructor(){e.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=o("div","mapboxgl-ctrl");const t=o("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const n=e[t].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class Ki{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(const t of n)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Ji(t,n,r){if(t=new e.LngLat(t.lng,t.lat),n){const i=new e.LngLat(t.lng-360,t.lat),o=new e.LngLat(t.lng+360,t.lat),a=360*Math.ceil(Math.abs(t.lng-r.center.lng)/360),s=r.locationPoint(t).distSqr(n),l=n.x<0||n.y<0||n.x>r.width||n.y>r.height;r.locationPoint(i).distSqr(n)180;){const e=r.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}const Qi={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class eo extends e.Evented{constructor(t,n){if(super(),(t instanceof e.window.HTMLElement||n)&&(t=e.extend({element:t},n)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=o("div");const n=41,r=27,i=a("svg",{display:"block",height:n*this._scale+"px",width:r*this._scale+"px",viewBox:`0 0 ${r} ${n}`},this._element),s=a("radialGradient",{id:"shadowGradient"},a("defs",{},i));a("stop",{offset:"10%","stop-opacity":.4},s),a("stop",{offset:"100%","stop-opacity":.05},s),a("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},i),a("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},i),a("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},i),a("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},i),this._offset=e.Point.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const r=this._element.classList;for(const e in Qi)r.remove(`mapboxgl-marker-anchor-${e}`);r.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,n=13.5,r=Math.sqrt(Math.pow(n,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[r,-1*(t-n+r)],"bottom-right":[-r,-1*(t-n+r)],left:[n,-1*(t-n)],right:[-n,-1*(t-n)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,n=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==n&&13!==n||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const n=e.unproject(t),r=e.getFreeCameraOptions();if(!r.position)return!1;const i=r.position.toLngLat();return i.distanceTo(n)<.9*i.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const n=this._pos;if(!n||n.x<0||n.x>t.transform.width||n.y<0||n.y>t.transform.height)return void this._clearFadeTimer();const r=t.unproject(n);let i;t._showingGlobe()&&e.isLngLatBehindGlobe(t.transform,this._lngLat)?i=0:(i=1-t._queryFogOpacity(r),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(i*=this._occludedOpacity)),this._element.style.opacity=`${i}`,this._element.style.pointerEvents=i>0?"auto":"none",this._popup&&this._popup._setOpacity(i),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${Qi[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,n=this._map,r=this.getPitchAlignment();if(!n||!t||"map"!==r)return"";if(!n._showingGlobe()){const e=n.getPitch();return e?`rotateX(${e}deg)`:""}const i=e.radToDeg(e.globeTiltAtLngLat(n.transform,this._lngLat)),o=t.sub(e.globeCenterToScreenPoint(n.transform)),a=Math.abs(o.x)+Math.abs(o.y);if(0===a)return"";const s=i/a;return`rotateX(${-o.y*s}deg) rotateY(${o.x*s}deg)`}_calculateZTransform(){const t=this._pos,n=this._map;if(!n||!t)return"";let r=0;const i=this.getRotationAlignment();if("map"===i)if(n._showingGlobe()){const t=n.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),i=n.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);r=e.radToDeg(Math.atan2(i.y,i.x))-90}else r=-n.getBearing();else if("horizon"===i){const i=e.smoothstep(4,6,n.getZoom()),o=e.globeCenterToScreenPoint(n.transform);o.y+=i*n.transform.height;const a=t.sub(o),s=e.radToDeg(Math.atan2(a.y,a.x));r=(s>90?s-270:s+90)*(1-i)}return r+=this._rotation,r?`rotateZ(${r}deg)`:""}_update(t){e.window.cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=Ji(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat),!0===t?this._updateFrameId=e.window.requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),n._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.Point.convert(t),this._update(),this}_onMove(t){const n=this._map;if(!n)return;const r=this._pointerdownPos,i=this._positionDelta;if(r&&i){if(!this._isDragging){const e=this._clickTolerance||n._clickTolerance;if(t.point.dist(r)=this._endTime)return this._end;const n=e.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,n){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+n}}const oo={"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":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},ao={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0},so={showCompass:!0,showZoom:!0,visualizePitch:!1};class lo{constructor(t,n,r=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new xi({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new bi({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),u()}move(e,t){const n=this.map,r=this.mouseRotate.mousemoveWindow(e,t),i=r&&r.bearingDelta;if(i&&n.setBearing(n.getBearing()+i),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t),i=r&&r.pitchDelta;i&&n.setPitch(n.getPitch()+i)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){h(),e.window.removeEventListener("mousemove",this.mousemove),e.window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),f(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,f(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=m(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=m(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.isSafariWithAntialiasingBug(e.window)&&(t.antialias=!1,e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Xr(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._useWebGL2=t.useWebGL2,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._optimizeForTerrain=t.optimizeForTerrain,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Ki,this._domRenderTaskQueue=new Ki,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.uniqueId(),this._locale=e.extend({},oo,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new io(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,"string"==typeof t.container){if(this._container=e.window.document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof e.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),void 0!==e.window&&(e.window.addEventListener("online",this._onWindowOnline,!1),e.window.addEventListener("resize",this._onWindowResize,!1),e.window.addEventListener("orientationchange",this._onWindowResize,!1),e.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),e.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new qi(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&this.setStyle(t.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this._hash=t.hash&&new Kr("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),this.resize(),t.attributionControl&&this.addControl(new Xi({customAttribution:t.customAttribution})),this._logoControl=new Yi,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.Event(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.Event(`${t.dataType}dataloading`,t))}))}_getMapId(){return this._mapId}addControl(t,n){if(void 0===n&&(n=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const i=this._controlPositions[n];return-1!==n.indexOf("bottom")?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(t);return n>-1&&this._controls.splice(n,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const n=!this._moving;return n&&this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),this.fire(new e.Event("resize",t)),n&&this.fire(new e.Event("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),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)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(t){return"auto"===t?e.window.navigator.language:Array.isArray(t)?0===t.length?void 0:t.map((t=>"auto"===t?e.window.navigator.language:t)):t}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style._reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,n=t.projection.name;let r;"globe"===n&&t.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?(t.setMercatorFromTransition(),r=!0):"mercator"===n&&t.zoom=e.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),n){this.painter.clearBackgroundTiles();for(const e in this.style._sourceCaches)this.style._sourceCaches[e].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(t){return this.transform.locationPoint3D(e.LngLat.convert(t))}unproject(t){return this.transform.pointLocation3D(e.Point.convert(t))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,n){if("mouseenter"===e||"mouseover"===e){let r=!1;const i=i=>{const o=t.filter((e=>this.getLayer(e))),a=o.length?this.queryRenderedFeatures(i.point,{layers:o}):[];a.length?r||(r=!0,n.call(this,new si(e,this,i.originalEvent,{features:a}))):r=!1},o=()=>{r=!1};return{layers:new Set(t),listener:n,delegates:{mousemove:i,mouseout:o}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const i=i=>{const o=t.filter((e=>this.getLayer(e)));(o.length?this.queryRenderedFeatures(i.point,{layers:o}):[]).length?r=!0:r&&(r=!1,n.call(this,new si(e,this,i.originalEvent)))},o=t=>{r&&(r=!1,n.call(this,new si(e,this,t.originalEvent)))};return{layers:new Set(t),listener:n,delegates:{mousemove:i,mouseout:o}}}{const r=e=>{const r=t.filter((e=>this.getLayer(e))),i=r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];i.length&&(e.features=i,n.call(this,e),delete e.features)};return{layers:new Set(t),listener:n,delegates:{[e]:r}}}}on(e,t,n){if(void 0===n)return super.on(e,t);Array.isArray(t)||(t=[t]);const r=this._createDelegatedListener(e,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,n){if(void 0===n)return super.once(e,t);Array.isArray(t)||(t=[t]);const r=this._createDelegatedListener(e,t,n);for(const e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,n){if(void 0===n)return super.off(e,t);t=new Set(Array.isArray(t)?t:[t]);const r=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0},i=this._delegatedListeners?this._delegatedListeners[e]:void 0;return i&&(e=>{for(let i=0;i{t?this.fire(new e.ErrorEvent(t)):r&&this._updateDiff(r,n)}))}else"object"==typeof t&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t)&&this._update(!0)}catch(r){e.warnOnce(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(t,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.warnOnce("There is no style added to the map."),!1)}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){return!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){const e=this.style&&this.style._sourceCaches;for(const t in e){const n=e[t]._tiles;for(const e in n){const t=n[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,n){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,n)}removeSource(e){return this.style.removeSource(e),this._updateTerrain(),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,n,{pixelRatio:r=1,sdf:i=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),n instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&n instanceof e.window.ImageBitmap){const{width:l,height:c,data:u}=e.exported.getImageData(n);this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},u),pixelRatio:r,stretchX:o,stretchY:a,content:s,sdf:i,version:0})}else if(void 0===n.width||void 0===n.height)this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:c}=n,u=n;this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},new Uint8Array(u.data)),pixelRatio:r,stretchX:o,stretchY:a,content:s,sdf:i,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,n){const r=this.style.getImage(t);if(!r)return void this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const i=n instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&n instanceof e.window.ImageBitmap?e.exported.getImageData(n):n,{width:o,height:a}=i;void 0!==o&&void 0!==a?o===r.data.width&&a===r.data.height?(r.data.replace(i.data,!(n instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&n instanceof e.window.ImageBitmap)),this.style.updateImage(t,r)):this.fire(new e.ErrorEvent(new Error(`The width and height of the updated image (${o}, ${a})\n must be that same as the previous version of the image\n (${r.data.width}, ${r.data.height})`))):this.fire(new e.ErrorEvent(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`")))}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,n){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),((t,r)=>{n(t,r instanceof e.window.HTMLImageElement?e.exported.getImageData(r):r)}))}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,r={}){return this.style.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t),this.transform):0}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const t=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300;let r,i,o,a=this._container;for(;a&&(!i||!o);){const t=e.window.getComputedStyle(a).transform;t&&"none"!==t&&(r=t.match(/matrix.*\((.+)\)/)[1].split(", "),r[0]&&"0"!==r[0]&&"1"!==r[0]&&(i=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(o=r[3])),a=a.parentElement}this._containerWidth=i?Math.abs(t/i):t,this._containerHeight=o?Math.abs(n/o):n}_detectMissingCSS(){"rgb(250, 128, 114)"!==e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=o("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=o("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=o("canvas","mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const n=this._controlContainer=o("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{r[e]=o("div",`mapboxgl-ctrl-${e}`,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,n){const r=e.exported.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(n),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${n}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.extend({},n.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._useWebGL2&&this._canvas.getContext("webgl2",t),i=r||this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);i?(this._useWebGL2&&!r&&e.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),e.storeAuthState(i,!0),this.painter=new Or(i,this.transform,!!r),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(i)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let n;const r=this.painter.context.extTimerQuery,i=e.exported.now();if(this.listens("gpu-timing-frame")&&(n=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],e.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],e.window.performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const o=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,n=this.transform.pitch,r=e.exported.now(),i=new e.EvaluationParameters(t,{now:r,fadeDuration:o,pitch:n,transition:this.style.getTransition()});this.style.update(i)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let a=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),a=this._updateAverageElevation(i),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):a=this._updateAverageElevation(i),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){const t=e.exported.now()-i;r.endQueryEXT(r.TIME_ELAPSED_EXT,n),setTimeout((()=>{const o=r.getQueryObjectEXT(n,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:o})),e.window.performance.mark("frame-gpu",{startTime:i,detail:{gpuTime:o}})}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const n=this.painter.queryGpuTimers(t);this.fire(new e.Event("gpu-timing-layer",{layerTimes:n}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const n=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:n}))}),50)}const s=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(s||this._repaint)this.triggerRepaint();else{const t=!this.isMoving()&&this.loaded();if(t&&(a=this._updateAverageElevation(i,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,e.LivePerformanceUtils.mark(e.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&e.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const n=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let r=this.transform.sampleAverageElevation(),i=!1;this.transform.elevation&&(i=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(r)?r=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-r);if(o>1){if(this._isInitialLoad||i)return this._averageElevation.jumpTo(r),n(r);this._averageElevation.easeTo(r,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(r),n(r)}return!!this._averageElevation.isEasing(e)&&n(this._averageElevation.getValue(e))}_authenticate(){e.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===e.AUTH_ERR_MSG||401===t.status)){const t=this.painter.context.gl;e.storeAuthState(t,!1),this._logoControl instanceof Yi&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),e.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,r=n.createFramebuffer();function i(e){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0);const t=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,t),t}return n.bindFramebuffer(n.FRAMEBUFFER,r),this._canvasPixelComparison(i(e),t.canvasCopies.map(i),t.timeStamps)}_canvasPixelComparison(e,t,n){let r=n[1]-n[0];const i=e.length/4;for(let o=0;o{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const n=this.style?Object.values(this.style._sourceCaches):[];return e.asyncAll(n,((e,n)=>e._preloadTiles(t,n)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===e.window.document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}_setCacheLimits(t,n){e.setCacheLimits(t,n)}get version(){return e.version}},NavigationControl:class{constructor(t){this.options=e.extend({},so,t),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),o("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),o("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=o("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),n=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new lo(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const n=o("button",e,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(e,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",n),e.firstElementChild&&e.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends e.Evented{constructor(t){super(),this.options=e.extend({geolocation:e.window.navigator.geolocation},co,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Yr(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(t){const n=(e=!!this.options.geolocation)=>{this._supportsGeolocation=e,t(e)};void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((e=>n("denied"!==e.state))).catch((()=>n())):n()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),n=e.coords;return!!t&&(n.longitudet.getEast()||n.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("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("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}_updateCamera(t){const n=new e.LngLat(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,i=this._map.getBearing(),o=e.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(r),o,{geolocateSource:!0})}_updateMarker(t){if(t){const n=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,n=e.mercatorZfromAltitude(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*n);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=o("button","mapboxgl-ctrl-geolocate",this._container),o("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o("div","mapboxgl-user-location"),this._dotElement.appendChild(o("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(o("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new eo({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=o("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new eo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.Event("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.warnOnce("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.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const t=()=>{e.window.addEventListener("ondeviceorientationabsolute"in e.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==e.window.DeviceMotionEvent&&"function"==typeof e.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"===e&&t()})).catch(console.error):t()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),e.window.removeEventListener("deviceorientation",this._onDeviceOrientation),e.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Xi,ScaleControl:class{constructor(t){this.options=e.extend({},uo,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,r=t._containerWidth/2-e/2,i=t.unproject([r,n]),o=t.unproject([r+e,n]),a=i.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*a;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,a/1852,"nautical-mile"):a>=1e3?this._setScale(e,a/1e3,"kilometer"):this._setScale(e,a,"meter")}_setScale(e,t,n){this._map._requestDomTask((()=>{const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(n),t*n}(t),i=r/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==n?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(r):`${r} ${ho[n]}`,this._container.style.width=e*i+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof e.window.HTMLElement?this._container=t.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in e.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in e.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,e.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!e.window.document.fullscreenEnabled&&!e.window.document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=o("button","mapboxgl-ctrl-fullscreen",this._controlContainer);o("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),e.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(e.window.document.fullscreenElement||e.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?e.window.document.exitFullscreen?e.window.document.exitFullscreen():e.window.document.webkitCancelFullScreen&&e.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.Evented{constructor(t){super(),this.options=e.extend(Object.create(to),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update();const n=this._map;return n&&(n.on("move",this._update),n.off("mousemove",this._onMouseEvent),n._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(e.window.document.createTextNode(t))}setHTML(t){const n=e.window.document.createDocumentFragment(),r=e.window.document.createElement("body");let i;for(r.innerHTML=t;i=r.firstChild,i;)n.appendChild(i);return this.setDOMContent(n)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=o("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=o("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,n=this._container,r=this._pos;if(!t||!n||!r)return"bottom";const i=n.offsetWidth,o=n.offsetHeight,a=r.xt.transform.width-i/2;if(r.y+et.transform.height-o){if(a)return"bottom-left";if(s)return"bottom-right"}return a?"left":s?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const n=this._map,r=this._content;if(!n||!this._lngLat&&!this._trackPointer||!r)return;let i=this._container;if(i||(i=this._container=o("div","mapboxgl-popup",n.getContainer()),this._tip=o("div","mapboxgl-popup-tip",i),i.appendChild(r)),this.options.maxWidth&&i.style.maxWidth!==this.options.maxWidth&&(i.style.maxWidth=this.options.maxWidth),n.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ji(this._lngLat,this._pos,n.transform)),!this._trackPointer||t){const e=this._pos=this._trackPointer&&t?t:n.project(this._lngLat),r=ro(this.options.offset),i=this._anchor=this._getAnchor(r.y),o=ro(this.options.offset,i),a=e.add(o).round();n._requestDomTask((()=>{this._container&&i&&(this._container.style.transform=`${Qi[i]} translate(${a.x}px,${a.y}px)`)}))}if(!this._marker&&n._showingGlobe()){const t=e.isLngLatBehindGlobe(n.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(no);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:eo,Style:Kt,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.Point,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:Ur,Evented:e.Evented,config:e.config,prewarm:function(){Ne().acquire(Oe)},clearPrewarmedResources:function(){const e=Fe;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Oe),Fe=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()"))},get accessToken(){return e.config.ACCESS_TOKEN},set accessToken(t){e.config.ACCESS_TOKEN=t},get baseApiUrl(){return e.config.API_URL},set baseApiUrl(t){e.config.API_URL=t},get workerCount(){return Be.workerCount},set workerCount(e){Be.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.clearTileCache(t)},workerUrl:"",workerClass:null,setNow:e.exported.setNow,restoreNow:e.exported.restoreNow};return po})),n}()},606:e=>{var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],c=!1,u=-1;function h(){c&&s&&(c=!1,s.length?l=s.concat(l):u=-1,l.length&&d())}function d(){if(!c){var e=a(h);c=!0;for(var t=l.length;t;){for(s=l,l=[];++u1)for(var n=1;n{"use strict";var r=n(925);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},556:(e,t,n)=>{e.exports=n(694)()},925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},551:(e,t,n)=>{"use strict";var r=n(540),i=n(982);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n