vendor: 4,189 bytes, lines 1-15
1import{g as Zg}from"./DyfadX0W.js";var qg=Object.defineProperty,Jr=(pe,se)=>qg(pe,"name",{value:se,configurable:!0});function Xi(pe,se){let Oe="script";return pe==="name"?Oe="script":pe==="name2"?Oe="script2":pe==="name3"&&(Oe="script3"),[["coalesce",["get",`pgf:${pe}`],["get",pe]],{"text-font":["case",["==",["get",Oe],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[se||"Noto Sans Regular"]]]}]}Jr(Xi,"get_name_block");function Kr(pe,se,Oe){let De="name";return Oe==="name"?De="":Oe==="name2"?De="2":Oe==="name3"&&(De="3"),se==="Latin"?["has",`script${De}`]:pe==="ja"?["all",["!=",["get",`script${De}`],"Han"],["!=",["get",`script${De}`],"Hiragana"],["!=",["get",`script${De}`],"Katakana"],["!=",["get",`script${De}`],"Mixed-Japanese"]]:["!=",["get",`script${De}`],se]}Jr(Kr,"is_not_in_target_script");function Er(pe){return pe==="Devanagari"?{"text-font":["literal",["Noto Sans Devanagari Regular v1"]]}:{}}Jr(Er,"get_font_formatting");function bd(pe){let se=Wg.find(Oe=>Oe.lang===pe);return se===void 0?"Latin":se.script}Jr(bd,"get_default_script");function qf(pe,se){let Oe=se||bd(pe),De;return Oe==="Devanagari"?De="pgf:":De="",["format",["coalesce",["get",`${De}name:${pe}`],["get","name:en"]],Er(Oe)]}Jr(qf,"get_country_name");function Mr(pe,se,Oe){let De=se||bd(pe),vi;return De==="Devanagari"?vi="pgf:":vi="",["case",["all",["any",["has","name"],["has","pgf:name"]],["!",["any",["has","name2"],["has","pgf:name2"]]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",Kr(pe,De,"name"),["case",["any",["is-supported-script",["get","name"]],["has","pgf:name"]],["format",["coalesce",["get",`${vi}name:${pe}`],["get","name:en"]],Er(De),` 2`,{},["case",["all",["!",["has",`${vi}name:${pe}`]],["has","name:en"],["!",["has","script"]]],"",["coalesce",["get","pgf:name"],["get","name"]]],{"text-font":["case",["==",["get","script"],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[Oe||"Noto Sans Regular"]]]}],["get","name:en"]],["format",["coalesce",["get",`${vi}name:${pe}`],["get","pgf:name"],["get","name"]],Er(De)]],["all",["any",["has","name"],["has","pgf:name"]],["any",["has","name2"],["has","pgf:name2"]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",["all",Kr(pe,De,"name"),Kr(pe,De,"name2")],["format",["get",`${vi}name:${pe}`],Er(De),` 3`,{},...Xi("name",Oe),` 4`,{},...Xi("name2",Oe)],["case",Kr(pe,De,"name2"),["format",["coalesce",["get",`${vi}name:${pe}`],["get","pgf:name"],["get","name"]],Er(De),` 5`,{},...Xi("name2",Oe)],["format",["coalesce",["get",`${vi}name:${pe}`],["get","pgf:name2"],["get","name2"]],Er(De),` 6`,{},...Xi("name",Oe)]]],["case",["all",Kr(pe,De,"name"),Kr(pe,De,"name2"),Kr(pe,De,"name3")],["format",["get",`${vi}name:${pe}`],Er(De),` 7`,{},...Xi("name",Oe),` 8`,{},...Xi("name2",Oe),` 9`,{},...Xi("name3",Oe)],["case",["!",Kr(pe,De,"name")],["format",["coalesce",["get",`${vi}name:${pe}`],["get","pgf:name"],["get","name"]],Er(De),` 10`,{},...Xi("name2",Oe),` 11`,{},...Xi("name3",Oe)],["!",Kr(pe,De,"name2")],["format",["coalesce",["get",`${vi}name:${pe}`],["get","pgf:name2"],["get","name2"]],Er(De),` 12`,{},...Xi("name",Oe),` 13`,{},...Xi("name3",Oe)],["format",["coalesce",["get",`${vi}name:${pe}`],["get","pgf:name3"],["get","name3"]],Er(De),` 14`,{},...Xi("name",Oe),` 15`,{},...Xi("name2",Oe)]]]]}Jr(Mr,"get_multiline_name");var Wg=[{lang:"ar",full_name:"Arabic",script:"Arabic"},{lang:"cs",full_name:"Czech",script:"Latin"},{lang:"bg",full_name:"Bulgarian",script:"Cyrillic"},{lang:"da",full_name:"Danish",script:"Latin"},{lang:"de",full_name:"German",script:"Latin"},{lang:"el",full_name:"Greek",script:"Greek"},{lang:"en",full_name:"English",script:"Latin"},{lang:"es",full_name:"Spanish",script:"Latin"},{lang:"et",full_name:"Estonian",script:"Latin"},{lang:"fa",full_name:"Persian",script:"Arabic"},{lang:"fi",full_name:"Finnish",script:"Latin"},{lang:"fr",full_name:"French",script:"Latin"},{lang:"ga",full_name:"Irish",script:"Latin"},{lang:"he",full_name:"Hebrew",script:"Hebrew"},{lang:"hi",full_name:"Hindi",script:"Devanagari"},{lang:"hr",full_name:"Croatian",script:"Latin"},{lang:"hu",full_name:"Hungarian",script:"Latin"},{lang:"id",full_name:"Indonesian",script:"Latin"}
vendor: 4,596 bytes, line 15
15,{lang:"it",full_name:"Italian",script:"Latin"},{lang:"ja",full_name:"Japanese",script:""},{lang:"ko",full_name:"Korean",script:"Hangul"},{lang:"lt",full_name:"Lithuanian",script:"Latin"},{lang:"lv",full_name:"Latvian",script:"Latin"},{lang:"ne",full_name:"Nepali",script:"Devanagari"},{lang:"nl",full_name:"Dutch",script:"Latin"},{lang:"no",full_name:"Norwegian",script:"Latin"},{lang:"mr",full_name:"Marathi",script:"Devanagari"},{lang:"mt",full_name:"Maltese",script:"Latin"},{lang:"pl",full_name:"Polish",script:"Latin"},{lang:"pt",full_name:"Portuguese",script:"Latin"},{lang:"ro",full_name:"Romanian",script:"Latin"},{lang:"ru",full_name:"Russian",script:"Cyrillic"},{lang:"sk",full_name:"Slovak",script:"Latin"},{lang:"sl",full_name:"Slovenian",script:"Latin"},{lang:"sv",full_name:"Swedish",script:"Latin"},{lang:"tr",full_name:"Turkish",script:"Latin"},{lang:"uk",full_name:"Ukrainian",script:"Cyrillic"},{lang:"ur",full_name:"Urdu",script:"Arabic"},{lang:"vi",full_name:"Vietnamese",script:"Latin"},{lang:"zh-Hans",full_name:"Chinese (Simplified)",script:"Han"},{lang:"zh-Hant",full_name:"Chinese (Traditional)",script:"Han"}];function Wf(pe,se){return[{id:"background",type:"background",paint:{"background-color":se.background}},{id:"earth",type:"fill",filter:["==","$type","Polygon"],source:pe,"source-layer":"earth",paint:{"fill-color":se.earth}},...se.landcover?[{id:"landcover",type:"fill",source:pe,"source-layer":"landcover",paint:{"fill-color":["match",["get","kind"],"grassland",se.landcover.grassland,"barren",se.landcover.barren,"urban_area",se.landcover.urban_area,"farmland",se.landcover.farmland,"glacier",se.landcover.glacier,"scrub",se.landcover.scrub,se.landcover.forest],"fill-opacity":["interpolate",["linear"],["zoom"],5,1,7,0]}}]:[],{id:"landuse_park",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course","wood","scrub","grassland","grass","glacier","sand","military","naval_base","airfield"],paint:{"fill-opacity":["interpolate",["linear"],["zoom"],6,0,11,1],"fill-color":["case",["in",["get","kind"],["literal",["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"]]],se.park_b,["==",["get","kind"],"wood"],se.wood_b,["in",["get","kind"],["literal",["scrub","grassland","grass"]]],se.scrub_b,["==",["get","kind"],"glacier"],se.glacier,["==",["get","kind"],"sand"],se.sand,["in",["get","kind"],["literal",["military","naval_base","airfield"]]],se.zoo,se.earth]}},{id:"landuse_urban_green",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","allotments","village_green","playground"],paint:{"fill-color":se.park_b,"fill-opacity":.7}},{id:"landuse_hospital",type:"fill",source:pe,"source-layer":"landuse",filter:["==","kind","hospital"],paint:{"fill-color":se.hospital}},{id:"landuse_industrial",type:"fill",source:pe,"source-layer":"landuse",filter:["==","kind","industrial"],paint:{"fill-color":se.industrial}},{id:"landuse_school",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","school","university","college"],paint:{"fill-color":se.school}},{id:"landuse_beach",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","beach"],paint:{"fill-color":se.beach}},{id:"landuse_zoo",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","zoo"],paint:{"fill-color":se.zoo}},{id:"landuse_aerodrome",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","aerodrome"],paint:{"fill-color":se.aerodrome}},{id:"roads_runway",type:"line",source:pe,"source-layer":"roads",filter:["==","kind_detail","runway"],paint:{"line-color":se.runway,"line-width":["interpolate",["exponential",1.6],["zoom"],10,0,12,4,18,30]}},{id:"roads_taxiway",type:"line",source:pe,"source-layer":"roads",minzoom:13,filter:["==","kind_detail","taxiway"],paint:{"line-color":se.runway,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,15,6]}},{id:"landuse_runway",type:"fill",source:pe,"source-layer":"landuse",filter:["any",["in","kind","runway","taxiway"]],paint:{"fill-color":se.runway}},{id:"water",type:"fill",filter:["==","$type","Polygon"],source:pe,"source-layer":"water",paint:{"fill-color":se.water}},{id:"water_stream",type:"line",source:pe,"source-layer":"water",minzoom:14,filter:["in","kind","stream"],paint:{"line-color":se.water,"line-width":.5}},{id:"water_river",type:"line",source:pe,"source-layer":"water",minzoom:9,filter:["in","kind","river"],paint:{"line-color":se.water,"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1,18,12]}}
vendor: 4,082 bytes, line 15
15,{id:"landuse_pedestrian",type:"fill",source:pe,"source-layer":"landuse",filter:["in","kind","pedestrian","dam"],paint:{"fill-color":se.pedestrian}},{id:"landuse_pier",type:"fill",source:pe,"source-layer":"landuse",filter:["==","kind","pier"],paint:{"fill-color":se.pier}},{id:"roads_tunnels_other_casing",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["in","kind","other","path"]],paint:{"line-color":se.tunnel_other_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_tunnels_minor_casing",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","minor_road"]],paint:{"line-color":se.tunnel_minor_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_tunnels_link_casing",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["has","is_link"]],paint:{"line-color":se.tunnel_link_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_tunnels_major_casing",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":se.tunnel_major_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_tunnels_highway_casing",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":se.tunnel_highway_casing,"line-dasharray":[6,.5],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_tunnels_other",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["in","kind","other","path"]],paint:{"line-color":se.tunnel_other,"line-dasharray":[4.5,.5],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_tunnels_minor",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","minor_road"]],paint:{"line-color":se.tunnel_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_tunnels_link",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["has","is_link"]],paint:{"line-color":se.tunnel_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_tunnels_major",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","major_road"]],paint:{"line-color":se.tunnel_major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_tunnels_highway",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==",["get","kind"],"highway"],["!",["has","is_link"]]],paint:{"line-color":se.tunnel_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}},{id:"buildings",type:"fill",source:pe,"source-layer":"buildings",filter:["in","kind","building","building_part"],paint:{"fill-color":se.buildings,"fill-opacity":.5}},{id:"roads_pier",type:"line",source:pe,"source-layer":"roads",filter:["==","kind_detail","pier"],paint:{"line-color":se.pier,"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,.5,20,16]}},{id:"roads_minor_service_casing",type:"line",source:pe,"source-layer":"roads",minzoom:13,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["==","kind_detail","service"]],paint:{"line-color":se.minor_service_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,18,8],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,.8]}}
vendor: 11,534 bytes, line 15
15,{id:"roads_minor_casing",type:"line",source:pe,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["!=","kind_detail","service"]],paint:{"line-color":se.minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_link_casing",type:"line",source:pe,"source-layer":"roads",minzoom:13,filter:["has","is_link"],paint:{"line-color":se.minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1.5]}},{id:"roads_major_casing_late",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":se.major_casing_late,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_highway_casing_late",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":se.highway_casing_late,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_other",type:"line",source:pe,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["in","kind","other","path"],["!=","kind_detail","pier"]],paint:{"line-color":se.other,"line-width":["interpolate",["exponential",1.6],["zoom"],14,.5,20,12]}},{id:"roads_link",type:"line",source:pe,"source-layer":"roads",filter:["has","is_link"],paint:{"line-color":se.link,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_minor_service",type:"line",source:pe,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["==","kind_detail","service"]],paint:{"line-color":se.minor_service,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,18,8]}},{id:"roads_minor",type:"line",source:pe,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["!=","kind_detail","service"]],paint:{"line-color":["interpolate",["exponential",1.6],["zoom"],11,se.minor_a,16,se.minor_b],"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_major_casing_early",type:"line",source:pe,"source-layer":"roads",maxzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":se.major_casing_early,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_major",type:"line",source:pe,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":se.major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_highway_casing_early",type:"line",source:pe,"source-layer":"roads",maxzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":se.highway_casing_early,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1]}},{id:"roads_highway",type:"line",source:pe,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":se.highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}},{id:"roads_rail",type:"line",source:pe,"source-layer":"roads",filter:["==","kind","rail"],paint:{"line-dasharray":[.3,.75],"line-opacity":.5,"line-color":se.railway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,.15,18,9]}},{id:"boundaries_country",type:"line",source:pe,"source-layer":"boundaries",filter:["<=","kind_detail",2],paint:{"line-color":se.boundaries,"line-width":.7,"line-dasharray":["step",["zoom"],["literal",[2,0]],4,["literal",[2,1]]]}},{id:"boundaries",type:"line",source:pe,"source-layer":"boundaries",filter:[">","kind_detail",2],paint:{"line-color":se.boundaries,"line-width":.4,"line-dasharray":["step",["zoom"],["literal",[2,0]],4,["literal",[2,1]]]}},{id:"roads_bridges_other_casing",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["in","kind","other","path"]],paint:{"line-color":se.bridges_other_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_bridges_link_casing",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["has","is_link"]],paint:{"line-color":se.bridges_minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1.5]}},{id:"roads_bridges_minor_casing",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","minor_road"]],paint:{"line-color":se.bridges_minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,.8]}},{id:"roads_bridges_major_casing",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":se.bridges_major_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,10],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1.5]}},{id:"roads_bridges_other",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["in","kind","other","path"]],paint:{"line-color":se.bridges_other,"line-dasharray":[2,1],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_bridges_minor",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","minor_road"]],paint:{"line-color":se.bridges_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_bridges_link",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["has","is_link"]],paint:{"line-color":se.bridges_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_bridges_major",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":se.bridges_major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_bridges_highway_casing",type:"line",source:pe,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":se.bridges_highway_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_bridges_highway",type:"line",source:pe,"source-layer":"roads",filter:["all",["has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":se.bridges_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}}]}Jr(Wf,"nolabels_layers");function Hf(pe,se,Oe,De){return[{id:"address_label",type:"symbol",source:pe,"source-layer":"buildings",minzoom:18,filter:["==","kind","address"],layout:{"symbol-placement":"point","text-font":[se.italic||"Noto Sans Italic"],"text-field":["get","addr_housenumber"],"text-size":12},paint:{"text-color":se.address_label,"text-halo-color":se.address_label_halo,"text-halo-width":1}},{id:"water_waterway_label",type:"symbol",source:pe,"source-layer":"water",minzoom:13,filter:["in","kind","river","stream"],layout:{"symbol-placement":"line","text-font":[se.italic||"Noto Sans Italic"],"text-field":Mr(Oe,De,se.regular),"text-size":12,"text-letter-spacing":.2},paint:{"text-color":se.ocean_label,"text-halo-color":se.water,"text-halo-width":1}},{id:"roads_oneway",type:"symbol",source:pe,"source-layer":"roads",minzoom:16,filter:["==",["get","oneway"],"yes"],layout:{"symbol-placement":"line","icon-image":"arrow","icon-rotate":90,"symbol-spacing":100}},{id:"roads_labels_minor",type:"symbol",source:pe,"source-layer":"roads",minzoom:15,filter:["in","kind","minor_road","other","path"],layout:{"symbol-sort-key":["get","min_zoom"],"symbol-placement":"line","text-font":[se.regular||"Noto Sans Regular"],"text-field":Mr(Oe,De,se.regular),"text-size":12},paint:{"text-color":se.roads_label_minor,"text-halo-color":se.roads_label_minor_halo,"text-halo-width":1}},{id:"water_label_ocean",type:"symbol",source:pe,"source-layer":"water",filter:["in","kind","sea","ocean","bay","strait","fjord"],layout:{"text-font":[se.italic||"Noto Sans Italic"],"text-field":Mr(Oe,De,se.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,10,12],"text-letter-spacing":.1,"text-max-width":9,"text-transform":"uppercase"},paint:{"text-color":se.ocean_label,"text-halo-width":1,"text-halo-color":se.water}},{id:"earth_label_islands",type:"symbol",source:pe,"source-layer":"earth",filter:["in","kind","island"],layout:{"text-font":[se.italic||"Noto Sans Italic"],"text-field":Mr(Oe,De,se.regular),"text-size":10,"text-letter-spacing":.1,"text-max-width":8},paint:{"text-color":se.subplace_label,"text-halo-color":se.subplace_label_halo,"text-halo-width":1}},{id:"water_label_lakes",type:"symbol",source:pe,"source-layer":"water",filter:["in","kind","lake","water"],layout:{"text-font":[se.italic||"Noto Sans Italic"],"text-field":Mr(Oe,De,se.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,6,12,10,12],"text-letter-spacing":.1,"text-max-width":9},paint:{"text-color":se.ocean_label,"text-halo-color":se.water,"text-halo-width":1}},{id:"roads_shields",type:"symbol",source:pe,"source-layer":"roads",filter:["all",["in",["get","kind"],["literal",["highway","major_road"]]],["has","shield_text"],["<=",["length",["get","shield_text"]],5]],layout:{"icon-image":["match",["get","network"],"US:I",["concat","US:I-",["length",["get","shield_text"]],"char"],"NL:S-road",["concat","NL:S-road-",["length",["get","shield_text"]],"char"],["concat","generic_shield-",["length",["get","shield_text"]],"char"]],"text-field":["get","shield_text"],"text-font":[se.bold||"Noto Sans Medium"],"text-size":8,"icon-size":.8,"symbol-placement":"line","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport"},paint:{"text-color":se.roads_label_major}},{id:"roads_labels_major",type:"symbol",source:pe,"source-layer":"roads",minzoom:11,filter:["in","kind","highway","major_road"],layout:{"symbol-sort-key":["get","min_zoom"],"symbol-placement":"line","text-font":[se.regular||"Noto Sans Regular"],"text-field":Mr(Oe,De,se.regular),"text-size":12},paint:{"text-color":se.roads_label_major,"text-halo-color":se.roads_label_major_halo,"text-halo-width":1}},...se.pois?[{id:"pois",type:"symbol",source:pe,"source-layer":"pois",filter:["all",["in",["get","kind"],["literal",["beach","forest","marina","park","peak","zoo","garden","bench","aerodrome","station","bus_stop","ferry_terminal","stadium","university","library","school","animal","toilets","drinking_water","post_office","building","town
15hall","restaurant","fast_food","cafe","bar","supermarket","convenience","books","beauty","electronics","clothes","attraction","museum","theatre","artwork"]]],[">=",["zoom"],["+",["get","min_zoom"],0]]],layout:{"icon-image":["match",["get","kind"],"station","train_station",["get","kind"]],"text-font":[se.regular||"Noto Sans Regular"],"text-justify":"auto","text-field":Mr(Oe,De,se.regular),"text-size":["interpolate",["linear"],["zoom"],17,10,19,16],"text-max-width":8,"text-offset":[1.1,0],"text-variable-anchor":["left","right"]},paint:{"text-color":["case",["in",["get","kind"],["literal",["beach","forest","marina","park","peak","zoo","garden","bench"]]],se.pois.green,["in",["get","kind"],["literal",["aerodrome","station","bus_stop","ferry_terminal"]]],se.pois.lapis,["in",["get","kind"],["literal",["stadium","university","library","school","animal","toilets","drinking_water","post_office","building","townhall"]]],se.pois.slategray,["in",["get","kind"],["literal",["supermarket","convenience","books","beauty","electronics","clothes"]]],se.pois.blue,["in",["get","kind"],["literal",["restaurant","fast_food","cafe","bar"]]],se.pois.tangerine,["in",["get","kind"],["literal",["attraction","museum","theatre","artwork"]]],se.pois.pink,se.earth],"text-halo-color":se.earth,"text-halo-width":1}}]:[],{id:"places_subplace",type:"symbol",source:pe,"source-layer":"places",filter:["in","kind","neighbourhood","macrohood"],layout:{"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-field":Mr(Oe,De,se.regular),"text-font":[se.regular||"Noto Sans Regular"],"text-max-width":7,"text-letter-spacing":.1,"text-padding":["interpolate",["linear"],["zoom"],5,2,8,4,12,18,15,20],"text-size":["interpolate",["exponential",1.2],["zoom"],11,8,14,14,18,24],"text-transform":"uppercase"},paint:{"text-color":se.subplace_label,"text-halo-color":se.subplace_label_halo,"text-halo-width":1}},{id:"places_region",type:"symbol",source:pe,"source-layer":"places",filter:["==","kind","region"],layout:{"symbol-sort-key":["get","sort_key"],"text-field":["step",["zoom"],["coalesce",["get","ref:en"],["get","ref"]],6,Mr(Oe,De,se.regular)],"text-font":[se.regular||"Noto Sans Regular"],"text-size":["interpolate",["linear"],["zoom"],3,11,7,16],"text-radial-offset":.2,"text-anchor":"center","text-transform":"uppercase"},paint:{"text-color":se.state_label,"text-halo-color":se.state_label_halo,"text-halo-width":1}},{id:"places_locality",type:"symbol",source:pe,"source-layer":"places",filter:["==","kind","locality"],layout:{"icon-image":["step",["zoom"],["case",["==",["get","capital"],"yes"],"capital","townspot"],8,""],"icon-size":.7,"text-field":Mr(Oe,De,se.regular),"text-font":["case",["<=",["get","min_zoom"],5],["literal",[se.bold||"Noto Sans Medium"]],["literal",[se.regular||"Noto Sans Regular"]]],"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-padding":["interpolate",["linear"],["zoom"],5,3,8,7,12,11],"text-size":["interpolate",["linear"],["zoom"],2,["case",["<",["get","population_rank"],13],8,[">=",["get","population_rank"],13],13,0],4,["case",["<",["get","population_rank"],13],10,[">=",["get","population_rank"],13],15,0],6,["case",["<",["get","population_rank"],12],11,[">=",["get","population_rank"],12],17,0],8,["case",["<",["get","population_rank"],11],11,[">=",["get","population_rank"],11],18,0],10,["case",["<",["get","population_rank"],9],12,[">=",["get","population_rank"],9],20,0],15,["case",["<",["get","population_rank"],8],12,[">=",["get","population_rank"],8],22,0]],"icon-padding":["interpolate",["linear"],["zoom"],0,0,8,4,10,8,12,6,22,2],"text-justify":"auto","text-variable-anchor":["step",["zoom"],["literal",["bottom","left","right","top"]],8,["literal",["center"]]],"text-radial-offset":.3},paint:{"text-color":se.city_label,"text-halo-color":se.city_label_halo,"text-halo-width":1}},{id:"places_country",type:"symbol",source:pe,"source-layer":"places",filter:["==","kind","country"],layout:{"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-field":qf(Oe,De),"text-font":[se.bold||"Noto Sans Medium"],"text-size":["interpolate",["linear"],["zoom"],2,["case",["<",["get","population_rank"],10],8,[">=",["get","population_rank"],10],12,0],6,["case",["<",["get","population_rank"],8],10,[">=",["get","population_rank"],8],18,0],8,["case",["<",["get","population_rank"],7],11,[">=",["get","population_rank"],7],20,0]],"icon-padding":["interpolate",["linear"],["zoom"],0,2,14,2,16,20,17,2,22,2],"text-transform":"uppercase"},paint:{"text-color":se.country_label,"text-halo-color":se.earth,"text-halo-width":1}}]}Jr(Hf,"labels_layers");var Hg={background:"#cccccc",earth:"#e2dfda",park_a:"#cfddd5",park_b:"#9cd3b4",hospital:"#e4dad9",industrial:"#d1dde1",school:"#e4ded7",wood_a:"#d0ded0",wood_b:"#a0d9a0",pedestrian:"#e3e0d4",scrub_a:"#cedcd7",scrub_b:"#99d2bb",glacier:"#e7e7e7",sand:"#e2e0d7",beach:"#e8e4d0",aerodrome:"#dadbdf",runway:"#e9e9ed",water:"#80deea",zoo:"#c6dcdc",military:"#dcdcdc",tunnel_other_casing:"#e0e0e0",tunnel_minor_casing:"#e0e0e0",tunnel_link_casing:"#e0e0e0",tunnel_major_casing:"#e0e0e0",tunnel_highway_casing:"#e0e0e0",tunnel_other:"#d5d5d5",tunnel_minor:"#d5d5d5",tunnel_link:"#d5d5d5",tunnel_major:"#d5d5d5",tunnel_highway:"#d5d5d5",pier:"#e0e0e0",buildings:"#cccccc",minor_service_casing:"#e0e0e0",minor_c
15asing:"#e0e0e0",link_casing:"#e0e0e0",major_casing_late:"#e0e0e0",highway_casing_late:"#e0e0e0",other:"#ebebeb",minor_service:"#ebebeb",minor_a:"#ebebeb",minor_b:"#ffffff",link:"#ffffff",major_casing_early:"#e0e0e0",major:"#ffffff",highway_casing_early:"#e0e0e0",highway:"#ffffff",railway:"#a7b1b3",boundaries:"#adadad",bridges_other_casing:"#e0e0e0",bridges_minor_casing:"#e0e0e0",bridges_link_casing:"#e0e0e0",bridges_major_casing:"#e0e0e0",bridges_highway_casing:"#e0e0e0",bridges_other:"#ebebeb",bridges_minor:"#ffffff",bridges_link:"#ffffff",bridges_major:"#f5f5f5",bridges_highway:"#ffffff",roads_label_minor:"#91888b",roads_label_minor_halo:"#ffffff",roads_label_major:"#938a8d",roads_label_major_halo:"#ffffff",ocean_label:"#728dd4",subplace_label:"#8f8f8f",subplace_label_halo:"#e0e0e0",city_label:"#5c5c5c",city_label_halo:"#e0e0e0",state_label:"#b3b3b3",state_label_halo:"#e0e0e0",country_label:"#a3a3a3",address_label:"#91888b",address_label_halo:"#ffffff",pois:{blue:"#1A8CBD",green:"#20834D",lapis:"#315BCF",pink:"#EF56BA",red:"#F2567A",slategray:"#6A5B8F",tangerine:"#CB6704",turquoise:"#00C3D4"},landcover:{grassland:"rgba(210, 239, 207, 1)",barren:"rgba(255, 243, 215, 1)",urban_area:"rgba(230, 230, 230, 1)",farmland:"rgba(216, 239, 210, 1)",glacier:"rgba(255, 255, 255, 1)",scrub:"rgba(234, 239, 210, 1)",forest:"rgba(196, 231, 210, 1)"}},Xg={background:"#34373d",earth:"#1f1f1f",park_a:"#1c2421",park_b:"#192a24",hospital:"#252424",industrial:"#222222",school:"#262323",wood_a:"#202121",wood_b:"#202121",pedestrian:"#1e1e1e",scrub_a:"#222323",scrub_b:"#222323",glacier:"#1c1c1c",sand:"#212123",beach:"#28282a",aerodrome:"#1e1e1e",runway:"#333333",water:"#31353f",zoo:"#222323",military:"#242323",tunnel_other_casing:"#141414",tunnel_minor_casing:"#141414",tunnel_link_casing:"#141414",tunnel_major_casing:"#141414",tunnel_highway_casing:"#141414",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",pier:"#333333",buildings:"#111111",minor_service_casing:"#1f1f1f",minor_casing:"#1f1f1f",link_casing:"#1f1f1f",major_casing_late:"#1f1f1f",highway_casing_late:"#1f1f1f",other:"#333333",minor_service:"#333333",minor_a:"#3d3d3d",minor_b:"#333333",link:"#3d3d3d",major_casing_early:"#1f1f1f",major:"#3d3d3d",highway_casing_early:"#1f1f1f",highway:"#474747",railway:"#000000",boundaries:"#5b6374",bridges_other_casing:"#2b2b2b",bridges_minor_casing:"#1f1f1f",bridges_link_casing:"#1f1f1f",bridges_major_casing:"#1f1f1f",bridges_highway_casing:"#1f1f1f",bridges_other:"#333333",bridges_minor:"#333333",bridges_link:"#3d3d3d",bridges_major:"#3d3d3d",bridges_highway:"#474747",roads_label_minor:"#525252",roads_label_minor_halo:"#1f1f1f",roads_label_major:"#666666",roads_label_major_halo:"#1f1f1f",ocean_label:"#717784",subplace_label:"#525252",subplace_label_halo:"#1f1f1f",city_label:"#7a7a7a",city_label_halo:"#212121",state_label:"#3d3d3d",state_label_halo:"#1f1f1f",country_label:"#5c5c5c",address_label:"#525252",address_label_halo:"#1f1f1f",pois:{blue:"#4299BB",green:"#30C573",lapis:"#2B5CEA",pink:"#EF56BA",red:"#F2567A",slategray:"#93939F",tangerine:"#F19B6E",turquoise:"#00C3D4"},landcover:{grassland:"rgba(30, 41, 31, 1)",barren:"rgba(38, 38, 36, 1)",urban_area:"rgba(28, 28, 28, 1)",farmland:"rgba(31, 36, 32, 1)",glacier:"rgba(43, 43, 43, 1)",scrub:"rgba(34, 36, 30, 1)",forest:"rgba(28, 41, 37, 1)"}},Yg={background:"#ffffff",earth:"#ffffff",park_a:"#fcfcfc",park_b:"#fcfcfc",hospital:"#f8f8f8",industrial:"#fcfcfc",school:"#f8f8f8",wood_a:"#fafafa",wood_b:"#fafafa",pedestrian:"#fdfdfd",scrub_a:"#fafafa",scrub_b:"#fafafa",glacier:"#fcfcfc",sand:"#fafafa",beach:"#f6f6f6",aerodrome:"#fdfdfd",runway:"#efefef",water:"#dcdcdc",zoo:"#f7f7f7",military:"#fcfcfc",tunnel_other_casing:"#d6d6d6",tunnel_minor_casing:"#fcfcfc",tunnel_link_casing:"#fcfcfc",tunnel_major_casing:"#fcfcfc",tunnel_highway_casing:"#fcfcfc",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",pier:"#efefef",buildings:"#efefef",minor_service_casing:"#ffffff",minor_casing:"#ffffff",link_casing:"#ffffff",major_casing_late:"#ffffff",highway_casing_late:"#ffffff",other:"#f5f5f5",minor_service:"#f5f5f5",minor_a:"#ebebeb",minor_b:"#f5f5f5",link:"#ebebeb",major_casing_early:"#ffffff",major:"#ebebeb",highway_casing_early:"#ffffff",highway:"#ebebeb",railway:"#d6d6d6",boun
15daries:"#adadad",bridges_other_casing:"#ffffff",bridges_minor_casing:"#ffffff",bridges_link_casing:"#ffffff",bridges_major_casing:"#ffffff",bridges_highway_casing:"#ffffff",bridges_other:"#f5f5f5",bridges_minor:"#f5f5f5",bridges_link:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#adadad",roads_label_minor_halo:"#ffffff",roads_label_major:"#999999",roads_label_major_halo:"#ffffff",ocean_label:"#adadad",subplace_label:"#8f8f8f",subplace_label_halo:"#ffffff",city_label:"#5c5c5c",city_label_halo:"#ffffff",state_label:"#b3b3b3",state_label_halo:"#ffffff",country_label:"#b8b8b8",address_label:"#adadad",address_label_halo:"#ffffff"},Kg={background:"#a3a3a3",earth:"#cccccc",park_a:"#c2c2c2",park_b:"#c2c2c2",hospital:"#d0d0d0",industrial:"#c6c6c6",school:"#d0d0d0",wood_a:"#c2c2c2",wood_b:"#c2c2c2",pedestrian:"#c4c4c4",scrub_a:"#c2c2c2",scrub_b:"#c2c2c2",glacier:"#d2d2d2",sand:"#d2d2d2",beach:"#d2d2d2",aerodrome:"#c9c9c9",runway:"#f5f5f5",water:"#a3a3a3",zoo:"#c7c7c7",military:"#bfbfbf",tunnel_other_casing:"#b8b8b8",tunnel_minor_casing:"#b8b8b8",tunnel_link_casing:"#b8b8b8",tunnel_major_casing:"#b8b8b8",tunnel_highway_casing:"#b8b8b8",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",pier:"#b8b8b8",buildings:"#e0e0e0",minor_service_casing:"#cccccc",minor_casing:"#cccccc",link_casing:"#cccccc",major_casing_late:"#cccccc",highway_casing_late:"#cccccc",other:"#e0e0e0",minor_service:"#e0e0e0",minor_a:"#ebebeb",minor_b:"#e0e0e0",link:"#ebebeb",major_casing_early:"#cccccc",major:"#ebebeb",highway_casing_early:"#cccccc",highway:"#ebebeb",railway:"#f5f5f5",boundaries:"#5c5c5c",bridges_other_casing:"#cccccc",bridges_minor_casing:"#cccccc",bridges_link_casing:"#cccccc",bridges_major_casing:"#cccccc",bridges_highway_casing:"#cccccc",bridges_other:"#e0e0e0",bridges_minor:"#e0e0e0",bridges_link:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#999999",roads_label_minor_halo:"#e0e0e0",roads_label_major:"#8f8f8f",roads_label_major_halo:"#ebebeb",ocean_label:"#7a7a7a",subplace_label:"#7a7a7a",subplace_label_halo:"#cccccc",city_label:"#474747",city_label_halo:"#cccccc",state_label:"#999999",state_label_halo:"#cccccc",country_label:"#858585",address_label:"#999999",address_label_halo:"#e0e0e0"},Jg={background:"#2b2b2b",earth:"#141414",park_a:"#181818",park_b:"#181818",hospital:"#1d1d1d",industrial:"#101010",school:"#111111",wood_a:"#1a1a1a",wood_b:"#1a1a1a",pedestrian:"#191919",scrub_a:"#1c1c1c",scrub_b:"#1c1c1c",glacier:"#191919",sand:"#161616",beach:"#1f1f1f",aerodrome:"#191919",runway:"#323232",water:"#333333",zoo:"#191919",military:"#121212",tunnel_other_casing:"#101010",tunnel_minor_casing:"#101010",tunnel_link_casing:"#101010",tunnel_major_casing:"#101010",tunnel_highway_casing:"#101010",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",pier:"#0a0a0a",buildings:"#0a0a0a",minor_service_casing:"#141414",minor_casing:"#141414",link_casing:"#141414",major_casing_late:"#141414",highway_casing_late:"#141414",other:"#1f1f1f",minor_service:"#1f1f1f",minor_a:"#292929",minor_b:"#1f1f1f",link:"#1f1f1f",major_casing_early:"#141414",major:"#292929",highway_casing_early:"#141414",highway:"#292929",railway:"#292929",boundaries:"#707070",bridges_other_casing:"#141414",bridges_minor_casing:"#141414",bridges_link_casing:"#141414",bridges_major_casing:"#141414",bridges_highway_casing:"#141414",bridges_other:"#1f1f1f",bridges_minor:"#1f1f1f",bridges_link:"#292929",bridges_major:"#292929",bridges_highway:"#292929",roads_label_minor:"#525252",roads_label_minor_halo:"#141414",roads_label_major:"#5c5c5c",roads_label_major_halo:"#141414",ocean_label:"#707070",subplace_label:"#5c5c5c",subplace_label_halo:"#141414",city_label:"#999999",city_label_halo:"#141414",state_label:"#3d3d3d",state_label_halo:"#141414",country_label:"#707070",address_label:"#525252",address_label_halo:"#141414"};function Qg(pe){switch(pe){case"light":return Hg;case"dark":return Xg;case"white":return Yg;case"grayscale":return Kg;case"black":return Jg}throw new Error("Flavor not found")}Jr(Qg,"namedFlavor");function ey(pe,se,Oe){let De=[];return Oe!=null&&Oe.labelsOnly||(De=Wf(pe,se)),Oe!=null&&Oe.lang&&(De=De.concat(Hf(pe,se,Oe.lang))),De}Jr(ey,"layers");var Ou={exports:{}};var ty=Ou.exports,Zf;function iy(){return Zf||(Zf=1,(function(pe,se){(function(Oe,De){pe.exports=De()})(ty,(function(){var Oe={},De={};function vi(R,p,Pe){if(De[R]=Pe,R==="index"){var Cr="var sharedModule = {}; ("+De.shared+")(sharedModule); ("+De.worker+")(sharedModule);",Mi={};return De.shared(Mi),De.index(Oe,Mi),typeof window<"u"&&Oe.setWorkerUrl(window.URL.createObjectURL(new Blob([Cr],{type:"text/javascript"}))),Oe}}vi("shared",["exports"],(function(R){function p(r,e,i,a){return new(i||(i=Prom
vendor: 8,834 bytes, line 15
15ise))((function(s,l){function u(m){try{_(a.next(m))}catch(v){l(v)}}function d(m){try{_(a.throw(m))}catch(v){l(v)}}function _(m){var v;m.done?s(m.value):(v=m.value,v instanceof i?v:new i((function(g){g(v)}))).then(u,d)}_((a=a.apply(r,e||[])).next())}))}function Pe(r,e){this.x=r,this.y=e}function Cr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mi,Qr;typeof SuppressedError=="function"&&SuppressedError,Pe.prototype={clone(){return new Pe(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),a=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=a,this},_rotateAround(r,e){const i=Math.cos(r),a=Math.sin(r),s=e.y+a*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-a*(this.y-e.y),this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Pe},Pe.convert=function(r){if(r instanceof Pe)return r;if(Array.isArray(r))return new Pe(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Pe(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Fn=(function(){if(Qr)return Mi;function r(e,i,a,s){this.cx=3*e,this.bx=3*(a-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(s-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=a,this.p2y=s}return Qr=1,Mi=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var a=e,s=0;s<8;s++){var l=this.sampleCurveX(a)-e;if(Math.abs(l)<i)return a;var u=this.sampleCurveDerivativeX(a);if(Math.abs(u)<1e-6)break;a-=l/u}var d=0,_=1;for(a=e,s=0;s<20&&(l=this.sampleCurveX(a),!(Math.abs(l-e)<i));s++)e>l?d=a:_=a,a=.5*(_-d)+d;return a},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Mi})(),Wt=Cr(Fn);let Ar,Je;function en(){return Ar!=null||(Ar=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ar}function Ei(){if(Je==null&&(Je=!1,en())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let a=0;a<25;a++){const s=4*a;e.fillStyle=`rgb(${s},${s+1},${s+2})`,e.fillRect(a%5,Math.floor(a/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let a=0;a<100;a++)if(a%4!=3&&i[a]!==a){Je=!0;break}}}return Je||!1}var me=1e-6,Ft=typeof Float32Array<"u"?Float32Array:Array;function tn(){var r=new Ft(9);return Ft!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Bn(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ba(){var r=new Ft(3);return Ft!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function wa(r){var e=r[0],i=r[1],a=r[2];return Math.sqrt(e*e+i*i+a*a)}function Ye(r,e,i){var a=new Ft(3);return a[0]=r,a[1]=e,a[2]=i,a}function W(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function K(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function ee(r,e,i){var a=e[0],s=e[1],l=e[2],u=i[0],d=i[1],_=i[2];return r[0]=s*_-l*d,r[1]=l*u-a*_,r[2]=a*d-s*u,r}var ye,Ce=wa;function He(r,e,i){var a=e[0],s=e[1],l=e[2],u=e[3];return r[0]=i[0]*a+i[4]*s+i[8]*l+i[12]*u,r[1]=i[1]*a+i[5]*s+i[9]*l+i[13]*u,r[2]=i[2]*a+i[6]*s+i[10]*l+i[14]*u,r[3]=i[3]*a+i[7]*s+i[11]*l+i[15]*u,r}function Le(){var r=new Ft(4);return Ft!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function We(r,e,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;e*=l,a*=l,i*=l;var u=Math.sin(e),d=Math.cos(e),_=Math.sin(i),m=Math.cos(i),v=Math.sin(a),g=Math.cos(a);switch(s){case"xyz":r[0]=u*m*g+d*_*v,r[1]=d*_*g-u*m*v,r[2]=d*m*v+u*_*g,r[3]=d*m*g-u*_*v;break;case"xzy":r[0]=u*m*g-d*_*v,r[1]=d*_*g-u*m*v,r[2]=d*m*v+u*_*g,r[3]=d*m*g+u*_*v;break;case"yxz":r[0]=u*m*g+d*_*v,r[1]=d*_*g-u*m*v,r[2]=d*m*v-u*_*g,r[3]=d*m*g+u*_*v;break;case"yzx":r[0]=u*m*g+d*_*v,r[1]=d*_*g+u*m*v,r[2]=d*m*v-u*_*g,r[3]=d*m*g-u*_*v;break;case"zxy":r[0]=u*m*g-d*_*v,r[1]=d*_*g+u*m*v,r[2]=d*m*v+u*_*g,r[3]=d*m*g-u*_*v;break;case"zyx":r[0]=u*m*g-d*_*v,r[1]=d*_*g+u*m*v,r[2]=d*m*v-u*_*g,r[3]=d*m*g+u*_*v;break;default:throw new Error("Unknown angle order "+s)}return r}function Ve(){var r=new Ft(2);return Ft!=Float32Array&&(r[0]=0,r[1]=0),r}function et(r,e){var i=new Ft(2);return i[0]=r,i[1]=e,i}ba(),ye=new Ft(4),Ft!=Float32Array&&(ye[0]=0,ye[1]=0,ye[2]=0,ye[3]=0),ba(),Ye(1,0,0),Ye(0,1,0),Le(),Le(),tn(),Ve();const Re=8192;function bt(r,e,i){return e*(Re/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function wt(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function Yi(r,e){return(r%e+e)%e}function ji(r,e,i){return r*(1-i)+e*i}function zr(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function rn(r,e,i,a){const s=new Wt(r,e,i,a);return l=>s.solve(l)}const Ta=rn(.25,.1,.25,1);function ci(r,e,i){return Math.min(i,Math.max(e,r))}function On(r,e,i){const a=i-e,s=((r-e)%a+a)%a+e;return s===e?i:s}function Vi(r,...e){for(const i of e)for(const a in i)r[a]=i[a];return r}let Sa=1;function Dr(r,e,i){const a={};for(const s in r)a[s]=e.call(this,r[s],s,r);return a}function nn(r,e,i){const a={};for(const s in r)e.call(this,r[s],s,r)&&(a[s]=r[s]);return a}function Fe(r){return Array.isArray(r)?r.map(Fe):typeof r=="object"&&r?Dr(r,Fe):r}const jt={};function Ht(r){jt[r]||(typeof console<"u"&&console.warn(r),jt[r]=!0)}function Ci(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Xt(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let xi=null;function an(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Bo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Oo(r,e,i,a,s){return p(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const u=l?.format;if(!u||!u.startsWith("BGR")&&!u.startsWith("RGB"))throw new Error(`Unrecognized format ${u}`);const d=u.startsWith("BGR"),_=new Uint8ClampedArray(a*s*4);if(yield l.copyTo(_,(function(m,v,g,T,b){const I=4*Math.max(-v,0),M=(Math.max(0,g)-g)*T*4+I,A=4*T,z=Math.max(0,v),L=Math.max(0,g);return{rect:{x:z,y:L,width:Math.min(m.width,v+T)-z,height:Math.min(m.height,g+b)-L},layout:[{offset:M,stride:A}]}})(r,e,i,a,s)),d)for(let m=0;m<_.length;m+=4){const v=_[m];_[m]=_[m+2],_[m+2]=v}return _}finally{l.close()}}))}let kr,jn;function _s(r,e,i,a){return r.addEventListener(e,i,a),{unsubscribe:()=>{r.removeEventListener(e,i,a)}}}function Rr(r){return r*Math.PI/180}function sn(r){return r/Math.PI*180}const jo={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Vo={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},gs="AbortError";class Pa extends Error{constructor(e=gs){super(e instanceof Error?e.message:e),this.name=gs,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function lc(r){return r instanceof Error&&r.name===gs}function ys(r){if(r.aborted)throw new Pa(r.reason)}const Lr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};
15function dr(r){return Lr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Ni="global-dispatcher";class Vn extends Error{constructor(e,i,a,s){super(`AJAXError: ${i} (${e}): ${a}`),this.status=e,this.statusText=i,this.url=a,this.body=s}}const No=()=>{var r;return Xt(self)?(r=self.worker)===null||r===void 0?void 0:r.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},on=function(r,e){return p(this,void 0,void 0,(function*(){var i,a;if(r.url.includes("://")&&!/^https?:|^file:/.test(r.url)){const s=dr(r.url);if(s){const l=yield s(r,e);return l.data||r.type!=="arrayBuffer"?l:Vi(l,{data:new ArrayBuffer(0)})}if(Xt(self)&&(!((i=self.worker)===null||i===void 0)&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Ni},e)}if(!(s=>{var l;return s.startsWith("file:")||((l=No())===null||l===void 0?void 0:l.startsWith("file:"))&&!/^\w+:/.test(s)})(r.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return(function(s,l){return p(this,void 0,void 0,(function*(){const u=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:No(),referrerPolicy:s.referrerPolicy,signal:l.signal});let d,_;s.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");try{d=yield fetch(u)}catch(v){throw lc(v)?v:new Vn(0,wt(v).message,s.url,new Blob)}if(!d.ok){const v=yield d.blob();throw new Vn(d.status,d.statusText,s.url,v)}_=s.type==="arrayBuffer"||s.type==="image"?d.arrayBuffer():s.type==="json"?d.json():d.text();const m=yield _;return ys(l.signal),{data:m,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires"),etag:d.headers.get("ETag")}}))})(r,e);if(Xt(self)&&(!((a=self.worker)===null||a===void 0)&&a.actor))return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Ni},e)}return(function(s,l){return new Promise(((u,d)=>{var _;const m=new XMLHttpRequest;m.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(m.responseType="arraybuffer");for(const v in s.headers)m.setRequestHeader(v,s.headers[v]);s.type==="json"&&(m.responseType="text",!((_=s.headers)===null||_===void 0)&&_.Accept||m.setRequestHeader("Accept","application/json")),m.withCredentials=s.credentials==="include",m.onerror=()=>{d(new Error(m.statusText))},m.onload=()=>{if(!l.signal.aborted)if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let v=m.response;if(s.type==="json")try{v=JSON.parse(m.response)}catch(g){return void d(g)}u({data:v,cacheControl:m.getResponseHeader("Cache-Control"),expires:m.getResponseHeader("Expires"),etag:m.getResponseHeader("ETag")})}else{const v=new Blob([m.response],{type:m.getResponseHeader("Content-Type")});d(new Vn(m.status,m.statusText,s.url,v))}},l.signal.addEventListener("abort",(()=>{m.abort(),d(new Pa(l.signal.reason))})),m.send(s.body)}))})(r,e)}))};function Ki(r){if(!r||r.indexOf("://")<=0||r.startsWith("data:image/")||r.startsWith("blob:"))return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Nn(r,e,i){var a;!((a=i[r])===null||a===void 0)&&a.includes(e)||(i[r]||(i[r]=[]),i[r].push(e))}function ln(r,e,i){if(i?.[r]){const a=i[r].indexOf(e);a!==-1&&i[r].splice(a,1)}}class Ia{constructor(e,i={}){Vi(this,i),this.type=e}}class Un extends Ia{constructor(e,i={}){super("error",Vi({error:e},i))}}class vs{on(e,i){return this._listeners||(this._listeners={}),Nn(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return ln(e,i,this._listeners),ln(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners||(this._oneTimeListeners={}),Nn(e,i,this._oneTimeListeners),this):new Promise((a=>this.once(e,a)))}fire(e,i){var a,s;typeof e=="string"&&(e=new Ia(e,i||{}));const l=e.type;if(this.listens(l)){e.target=this;const u=!((a=this._listeners)===null||a===void 0)&&a[l]?this._listeners[l].slice():[];for(const m of u)m.call(this,e);const d=!((s=this._oneTimeListeners)===null||s===void 0)&&s[l]?this._oneTimeListeners[l].slice():[];for(const m of d)ln(l,m,this._oneTimeListeners),m.call(this,e);const _=this._eventedParent;_&&(Vi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),_.fire(e))}else e instanceof Un&&console.error(e.error);return this}listens(e){var i,a,s,l,u;return((a=(i=this._listeners)===null||i===void 0?void 0:i[e])===null||a===void 0?void 0:a.length)>0||((l=(s=this._oneTimeListeners)===null||s===void 0?void 0:s[e])===null||l===void 0?void 0:l.length)>0||((u=this._eventedParent)===null||u===void 0?void 0:u.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var ue={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 21,023 bytes, line 15
15,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven
vendor: 12,722 bytes, line 15
15"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}}
15;const Uo=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $o(r,e){const i={};for(const a in r)a!=="ref"&&(i[a]=r[a]);
vendor: 31,615 bytes, line 15
15return Uo.forEach((a=>{a in e&&(i[a]=e[a])})),i}function nt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!nt(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!nt(r[i],e[i]))return!1;return!0}return r===e}function bi(r,e){r.push(e)}function cn(r,e,i){bi(i,{command:"addSource",args:[r,e[r]]})}function cc(r,e,i){bi(e,{command:"removeSource",args:[r]}),i[r]=!0}function uc(r,e,i,a){cc(r,i,a),cn(r,e,i)}function ju(r,e,i){let a;for(a in r[i])if(Object.prototype.hasOwnProperty.call(r[i],a)&&a!=="data"&&!nt(r[i][a],e[i][a]))return!1;for(a in e[i])if(Object.prototype.hasOwnProperty.call(e[i],a)&&a!=="data"&&!nt(r[i][a],e[i][a]))return!1;return!0}function xs(r,e,i,a,s,l){r=r||{},e=e||{};for(const u in r)Object.prototype.hasOwnProperty.call(r,u)&&(nt(r[u],e[u])||i.push({command:l,args:[a,u,e[u],s]}));for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&!Object.prototype.hasOwnProperty.call(r,u)&&(nt(r[u],e[u])||i.push({command:l,args:[a,u,e[u],s]}))}function Go(r){return r.id}function hc(r,e){return r[e.id]=e,r}class ve{constructor(e,i,a,s){this.message=(e?`${e}: `:"")+a,s&&(this.identifier=s),i!=null&&i.__line__&&(this.line=i.__line__)}}function un(r,...e){for(const i of e)for(const a in i)r[a]=i[a];return r}class Yt extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Zo{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[a,s]of i)this.bindings[a]=s}concat(e){return new Zo(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)}}const Fr={kind:"null"},Te={kind:"number"},je={kind:"string"},Ge={kind:"boolean"},Ai={kind:"color"},bs={kind:"projectionDefinition"},pr={kind:"object"},Ne={kind:"value"},Ma={kind:"collator"},Ea={kind:"formatted"},ws={kind:"padding"},$n={kind:"colorArray"},Ca={kind:"numberArray"},Gn={kind:"resolvedImage"},Aa={kind:"variableAnchorOffsetCollection"};function Kt(r,e){return{kind:"array",itemType:r,N:e}}function at(r){if(r.kind==="array"){const e=at(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Ts=[Fr,Te,je,Ge,Ai,bs,Ea,pr,Kt(Ne),ws,Ca,$n,Gn,Aa];function Zn(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Zn(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Ts)if(!Zn(i,e))return null}}return`Expected ${at(r)} but found ${at(e)} instead.`}function za(r,e){return e.some((i=>i.kind===r.kind))}function hn(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function Ji(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const dc=.96422,dn=.82521,Ss=4/29,Tt=6/29,pc=3*Tt*Tt,fc=Tt*Tt*Tt,Da=Math.PI/180,mc=180/Math.PI;function _c(r){return(r%=360)<0&&(r+=360),r}function gc([r,e,i,a]){let s,l;const u=qo((.2225045*(r=Ps(r))+.7168786*(e=Ps(e))+.0606169*(i=Ps(i)))/1);r===e&&e===i?s=l=u:(s=qo((.4360747*r+.3850649*e+.1430804*i)/dc),l=qo((.0139322*r+.0971045*e+.7141733*i)/dn));const d=116*u-16;return[d<0?0:d,500*(s-u),200*(u-l),a]}function Ps(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function qo(r){return r>fc?Math.pow(r,1/3):r/pc+Ss}function Wo([r,e,i,a]){let s=(r+16)/116,l=isNaN(e)?s:s+e/500,u=isNaN(i)?s:s-i/200;return s=1*Xo(s),l=dc*Xo(l),u=dn*Xo(u),[Ho(3.1338561*l-1.6168667*s-.4906146*u),Ho(-.9787684*l+1.9161415*s+.033454*u),Ho(.0719453*l-.2289914*s+1.4052427*u),a]}function Ho(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Xo(r){return r>Tt?r*r*r:pc*(r-Ss)}const Vu=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function ka(r,e){return Vu(r,e)?r[e]:void 0}function Is(r){return parseInt(r.padEnd(2,r),16)/255}function yc(r,e){return qn(e?r/100:r,0,1)}function qn(r,e,i){return Math.min(Math.max(e,r),i)}function Yo(r){return!r.some(Number.isNaN)}const Ra={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Br(r,e,i){return r+i*(e-r)}function Wn(r,e,i){return r.map(((a,s)=>Br(a,e[s],i)))}class $e{constructor(e,i,a,s=1,l=!0){this.r=e,this.g=i,this.b=a,this.a=s,l||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,i,a,s]))}static parse(e){if(e instanceof $e)return e;if(typeof e!="string")return;const i=(function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const s=ka(Ra,a);if(s){const[u,d,_]=s;return[u/255,d/255,_/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const u=a.length<6?1:2;let d=1;return[Is(a.slice(d,d+=u)),Is(a.slice(d,d+=u)),Is(a.slice(d,d+=u)),Is(a.slice(d,d+u)||"ff")]}if(a.startsWith("rgb")){const u=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,_,m,v,g,T,b,I,M,A,z,L]=u,k=[v||" ",b||" ",A].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const F=[m,T,M].join(""),O=F==="%%%"?100:F===""?255:0;if(O){const V=[qn(+_/O,0,1),qn(+g/O,0,1),qn(+I/O,0,1),z?yc(+z,L):1];if(Yo(V))return V}}return}}const l=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[u,d,_,m,v,g,T,b,I]=l,M=[_||" ",v||" ",T].join("");if(M===" "||M===" /"||M===",,"||M===",,,"){const A=[+d,qn(+m,0,100),qn(+g,0,100),b?yc(+b,I):1];if(Yo(A))return(function([z,L,k,F]){function O(V){const Y=(V+z/30)%12,J=L*Math.min(k,1-k);return k-J*Math.max(-1,Math.min(Y-3,9-Y,1))}return z=_c(z),L/=100,k/=100,[O(0),O(8),O(4),F]})(A)}}})(e);return i?new $e(...i,!1):void 0}get rgb(){const{r:e,g:i,b:a,a:s}=this,l=s||1/0;return this.overwriteGetter("rgb",[e/l,i/l,a/l,s])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,a,s,l]=gc(e),u=Math.sqrt(a*a+s*s);return[Math.round(1e4*u)?_c(Math.atan2(s,a)*mc):NaN,u,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",gc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,a,s]=this.rgb;return`rgba(${[e,i,a].map((l=>Math.round(255*l))).join(",")},${s})`}static interpolate(e,i,a,s="rgb"){switch(s){case"rgb":{const[l,u,d,_]=Wn(e.rgb,i.rgb,a);return new $e(l,u,d,_,!1)}case"hcl":{const[l,u,d,_]=e.hcl,[m,v,g,T]=i.hcl;let b,I;if(isNaN(l)||isNaN(m))isNaN(l)?isNaN(m)?b=NaN:(b=m,d!==1&&d!==0||(I=v)):(b=l,g!==1&&g!==0||(I=u));else{let k=m-l;m>l&&k>180?k-=360:m<l&&l-m>180&&(k+=360),b=l+a*k}const[M,A,z,L]=(function([k,F,O,V]){return k=isNaN(k)?0:k*Da,Wo([O,Math.cos(k)*F,Math.sin(k)*F,V])})([b,I??Br(u,v,a),Br(d,g,a),Br(_,T,a)]);return new $e(M,A,z,L,!1)}case"lab":{const[l,u,d,_]=Wo(Wn(e.lab,i.lab,a));return new $e(l,u,d,_,!1)}}}}$e.black=new $e(0,0,0,1),$e.white=new $e(1,1,1,1),$e.transparent=new $e(0,0,0,0),$e.red=new $e(1,0,0,1);class Ko{constructor(e,i,a){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Nu=["bottom","center","top"];class Jo{constructor(e,i,a,s,l,u){this.text=e,this.image=i,this.scale=a,this.fontStack=s,this.textColor=l,this.verticalAlign=u}}class wi{constructor(e){this.sections=e}static fromString(e){return new wi([new Jo(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof wi?e:wi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ti)return e;if(typeof e=="number")return new ti([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a){return new ti(Wn(e.values,i.values,a))}}class _t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof _t)return e;if(typeof e=="number")return new _t([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new _t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a){return new _t(Wn(e.values,i.values,a))}}class Be{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Be)return e;if(typeof e=="string"){const a=$e.parse(e);return a?new Be([a]):void 0}if(!Array.isArray(e))return;const i=[];for(const a of e){if(typeof a!="string")return;const s=$e.parse(a);if(!s)return;i.push(s)}return new Be(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a,s="rgb"){const l=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let u=0;u<e.values.length;u++)l.push($e.interpolate(e.values[u],i.values[u],a,s));return new Be(l)}}class ct extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Or=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ui{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ui)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const a=e[i],s=e[i+1];if(typeof a!="string"||!Or.has(a)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new ui(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a){const s=e.values,l=i.values;if(s.length!==l.length)throw new ct(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const u=[];for(let d=0;d<s.length;d+=2){if(s[d]!==l[d])throw new ct(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${s[d]}, to[${d}]: ${l[d]}`);u.push(s[d]);const[_,m]=s[d+1],[v,g]=l[d+1];u.push([Br(_,v,a),Br(m,g,a)])}return new ui(u)}}class zi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new zi({name:e,available:!1}):null}}class hi{constructor(e,i,a){this.from=e,this.to=i,this.transition=a}static interpolate(e,i,a){return new hi(e,i,a)}static parse(e){return e instanceof hi?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new hi(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new hi(e.from,e.to,e.transition):typeof e=="string"?new hi(e,e,1):void 0}}function Hn(r,e,i,a){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[r,e,i,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[r,e,i,a]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jr(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof hi||r instanceof $e||r instanceof Ko||r instanceof wi||r instanceof ti||r instanceof _t||r instanceof Be||r instanceof ui||r instanceof zi)return!0;if(Array.isArray(r)){for(const e of r)if(!jr(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!jr(r[e]))return!1;return!0}return!1}function Mt(r){if(r===null)return Fr;if(typeof r=="string")return je;if(typeof r=="boolean")return Ge;if(typeof r=="number")return Te;if(r instanceof $e)return Ai;if(r instanceof hi)return bs;if(r instanceof Ko)return Ma;if(r instanceof wi)return Ea;if(r instanceof ti)return ws;if(r instanceof _t)return Ca;if(r instanceof Be)return $n;if(r instanceof ui)return Aa;if(r instanceof zi)return Gn;if(Array.isArray(r)){const e=r.length;let i;for(const a of r){const s=Mt(a);if(i){if(i===s)continue;i=Ne;break}i=s}return Kt(i||Ne,e)}return pr}function pn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof $e||r instanceof hi||r instanceof wi||r instanceof ti||r instanceof _t||r instanceof Be||r instanceof ui||r instanceof zi?r.toString():JSON.stringify(r)}class ar{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!jr(e[1]))return i.error("invalid value");const a=e[1];let s=Mt(a);const l=i.expectedType;return s.kind!=="array"||s.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(s=l),new ar(s,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ms={string:je,number:Te,boolean:Ge,object:pr};class Ti{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let a,s=1;const l=e[0];if(l==="array"){let d,_;if(e.length>2){const m=e[1];if(typeof m!="string"||!(m in Ms)||m==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=Ms[m],s++}else d=Ne;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],s++}a=Kt(d,_)}else{if(!Ms[l])throw new Error(`Types doesn't contain name = ${l}`);a=Ms[l]}const u=[];for(;s<e.length;s++){const d=i.parse(e[s],s,Ne);if(!d)return null;u.push(d)}return new Ti(a,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const a=this.args[i].evaluate(e);if(!Zn(this.type,Mt(a)))return a;if(i===this.args.length-1)throw new ct(`Expected value to be of type ${at(this.type)}, but found ${at(Mt(a))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const fn={"to-boolean":Ge,"to-color":Ai,"to-number":Te,"to-string":je};class fr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const a=e[0];if(!fn[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&e.length!==2)return i.error("Expected one argument.");const s=fn[a],l=[];for(let u=1;u<e.length;u++){const d=i.parse(e[u],u,Ne);if(!d)return null;l.push(d)}return new fr(s,l)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,a;for(const s of this.args){if(i=s.evaluate(e),a=null,i instanceof $e)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(a=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Hn(i[0],i[1],i[2],i[3]),!a))return new $e(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new ct(a||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const a of this.args){i=a.evaluate(e);const s=ti.parse(i);if(s)return s}throw new ct(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const a of this.args){i=a.evaluate(e);const s=_t.parse(i);if(s)return s}throw new ct(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const a of this.args){i=a.evaluate(e);const s=Be.parse(i);if(s)return s}throw new ct(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const a of this.args){i=a.evaluate(e);const s=ui.parse(i);if(s)return s}throw new ct(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const a of this.args){if(i=a.evaluate(e),i===null)return 0;const s=Number(i);if(!isNaN(s))return s}throw new ct(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return wi.fromString(pn(this.args[0].evaluate(e)));case"resolvedImage":return zi.fromString(pn(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return pn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const vc=["Unknown","Point","LineString","Polygon"];class Qo{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?vc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let i=this._parseColorCache.get(e);return i||(i=$e.parse(e),this._parseColorCache.set(e,i)),i}}class mn{constructor(e,i,a=[],s,l=new Zo,u=[]){this.registry=e,this.path=a,this.key=a.map((d=>`[${d}]`)).join(""),this.scope=l,this.errors=u,this.expectedType=s,this._isConstant=i}parse(e,i,a,s,l={}){return i?this.concat(i,a,s)._parse(e,l):this._parse(e,l)}_parse(e,i){function a(s,l,u){return u==="assert"?new Ti(l,[s]):u==="coerce"?new fr(l,[s]):s}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[s];if(l){let u=l.parse(e,this);if(!u)return null;if(this.expectedType){const d=this.expectedType,_=u.type;if(d.kind!=="string"&&d.kind!=="number"&&d.kind!=="boolean"&&d.kind!=="object"&&d.kind!=="array"||_.kind!=="value"){if(d.kind==="projectionDefinition"&&["string","array"].includes(_.kind)||["color","formatted","resolvedImage"].includes(d.kind)&&["value","string"].includes(_.kind)||["padding","numberArray"].includes(d.kind)&&["value","number","array"].includes(_.kind)||d.kind==="colorArray"&&["value","string","array"].includes(_.kind)||d.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(_.kind))u=a(u,d,i.typeAnnotation||"coerce");else if(this.checkSubtype(d,_))return null}else u=a(u,d,i.typeAnnotation||"assert")}if(!(u instanceof ar)&&u.type.kind!=="resolvedImage"&&this._isConstant(u)){const d=new Qo;try{u=new ar(u.type,u.evaluate(d))}catch(_){return this.error(_.message),null}}return u}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,a){const s=typeof e=="number"?this.path.concat(e):this.path,l=a?this.scope.concat(a):this.scope;return new mn(this.registry,this._isConstant,s,i||null,l,this.errors)}error(e,...i){const a=`${this.key}${i.map((s=>`[${s}]`)).join("")}`;this.errors.push(new Yt(a,e))}checkSubtype(e,i){const a=Zn(e,i);return a&&this.error(a),a}}class ut{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let l=1;l<e.length-1;l+=2){const u=e[l];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,l);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const d=i.parse(e[l+1],l+1);if(!d)return null;a.push([u,d])}const s=i.parse(e[e.length-1],e.length-1,i.expectedType,a);return s?new ut(a,s):null}outputDefined(){return this.result.outputDefined()}}class Xn{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const a=e[1];return i.scope.has(a)?new Xn(a,i.scope.get(a)):i.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Xe{constructor(e,i,a){this.type=e,this.index=i,this.input=a}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,Te),s=i.parse(e[2],2,Kt(i.expectedType||Ne));return a&&s?new Xe(s.type.itemType,a,s):null}evaluate(e){const i=this.index.evaluate(e),a=this.input.evaluate(e);if(i<0)throw new ct(`Array index out of bounds: ${i} < 0.`);if(i>=a.length)throw new ct(`Array index out of bounds: ${i} > ${a.length-1}.`);if(i!==Math.floor(i))throw new ct(`Array index must be an integer, but found ${i} instead.`);return a[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ue{constructor(e,i){this.type=Ge,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,Ne),s=i.parse(e[2],2,Ne);return a&&s?za(a.type,[Ge,je,Te,Fr,Ne])?new Ue(a,s):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${at(a.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!hn(i,["boolean","string","number","null"]))throw new ct(`Expected first argument to be of type boolean, string, number or null, but found ${at(Mt(i))} instead.`);if(!hn(a,["string","array"]))throw new ct(`Expected second argument to be of type array or string, but found ${at(Mt(a))} instead.`);return a.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Yn{constructor(e,i,a){this.type=Te,this.needle=e,this.haystack=i,this.fromIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,Ne),s=i.parse(e[2],2,Ne);if(!a||!s)return null;if(!za(a.type,[Ge,je,Te,Fr,Ne]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${at(a.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,Te);return l?new Yn(a,s,l):null}return new Yn(a,s)}evaluate(e){const i=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!hn(i,["boolean","string","number","null"]))throw new ct(`Expected first argument to be of type boolean, string, number or null, but found ${at(Mt(i))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),hn(a,["string"])){const l=a.indexOf(i,s);return l===-1?-1:[...a.slice(0,l)].length}if(hn(a,["array"]))return a.indexOf(i,s);throw new ct(`Expected second argument to be of type array or string, but found ${at(Mt(a))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ke{constructor(e,i,a,s,l,u){this.inputType=e,this.type=i,this.input=a,this.cases=s,this.outputs=l,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let a,s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const l={},u=[];for(let m=2;m<e.length-1;m+=2){let v=e[m];const g=e[m+1];Array.isArray(v)||(v=[v]);const T=i.concat(m);if(v.length===0)return T.error("Expected at least one branch label.");for(const I of v){if(typeof I!="number"&&typeof I!="string")return T.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return T.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return T.error("Numeric branch labels must be integer values.");if(a){if(T.checkSubtype(a,Mt(I)))return null}else a=Mt(I);if(l[String(I)]!==void 0)return T.error("Branch labels must be unique.");l[String(I)]=u.length}const b=i.parse(g,m,s);if(!b)return null;s=s||b.type,u.push(b)}const d=i.parse(e[1],1,Ne);if(!d)return null;const _=i.parse(e[e.length-1],e.length-1,s);return _?d.type.kind!=="value"&&i.concat(1).checkSubtype(a,d.type)?null:new Ke(a,s,d,l,u,_):null}evaluate(e){const i=this.input.evaluate(e);return(Mt(i)===this.inputType&&this.outputs[this.cases[i]]||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()}}class Qi{constructor(e,i,a){this.type=e,this.branches=i,this.otherwise=a}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const s=[];for(let u=1;u<e.length-1;u+=2){const d=i.parse(e[u],u,Ge);if(!d)return null;const _=i.parse(e[u+1],u+1,a);if(!_)return null;s.push([d,_]),a=a||_.type}const l=i.parse(e[e.length-1],e.length-1,a);if(!l)return null;if(!a)throw new Error("Can't infer output type");return new Qi(a,s,l)}evaluate(e){for(const[i,a]of this.branches)if(i.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,a]of this.branches)e(i),e(a);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class Kn{constructor(e,i,a,s){this.type=e,this.input=i,this.beginIndex=a,this.endIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,Ne),s=i.parse(e[2],2,Te);if(!a||!s)return null;if(!za(a.type,[Kt(Ne),je,Ne]))return i.error(`Expected first argument to be of type array or string, but found ${at(a.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,Te);return l?new Kn(a.type,a,s,l):null}return new Kn(a.type,a,s)}evaluate(e){const i=this.input.evaluate(e),a=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),hn(i,["string"]))return[...i].slice(a,s).join("");if(hn(i,["array"]))return i.slice(a,s);throw new ct(`Expected first argument to be of type array or string, but found ${at(Mt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function _n(r,e){const i=r.length-1;let a,s,l=0,u=i,d=0;for(;l<=u;)if(d=Math.floor((l+u)/2),a=r[d],s=r[d+1],a<=e){if(d===i||e<s)return d;l=d+1}else{if(!(a>e))throw new ct("Input is not a number.");u=d-1}return 0}class Jn{constructor(e,i,a){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[s,l]of a)this.labels.push(s),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const a=i.parse(e[1],1,Te);if(!a)return null;const s=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<e.length;u+=2){const d=u===1?-1/0:e[u],_=e[u+1],m=u,v=u+1;if(typeof d!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
15omputed expressions) for the input values.',m);if(s.length&&s[s.length-1][0]>=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',m);const g=i.parse(_,v,l);if(!g)return null;l=l||g.type,s.push([d,g])}return new Jn(l,a,s)}evaluate(e){const i=this.labels,a=this.outputs;if(i.length===1)return a[0].evaluate(e);const s=this.input.evaluate(e);if(s<=i[0])return a[0].evaluate(e);const l=i.length;return s>=i[l-1]?a[l-1].evaluate(e):a[_n(i,s)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function el(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Es,xc,bc=(function(){if(xc)return Es;function r(e,i,a,s){this.cx=3*e,this.bx=3*(a-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(s-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=a,this.p2y=s}return xc=1,Es=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var a=e,s=0;s<8;s++){var l=this.sampleCurveX(a)-e;if(Math.abs(l)<i)return a;var u=this.sampleCurveDerivativeX(a);if(Math.abs(u)<1e-6)break;a-=l/u}var d=0,_=1;for(a=e,s=0;s<20&&(l=this.sampleCurveX(a),!(Math.abs(l-e)<i));s++)e>l?d=a:_=a,a=.5*(_-d)+d;return a},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Es})(),wc=el(bc);class At{constructor(e,i,a,s,l){this.type=e,this.operator=i,this.interpolation=a,this.input=s,this.labels=[],this.outputs=[];for(const[u,d]of l)this.labels.push(u),this.outputs.push(d)}static interpolationFactor(e,i,a,s){let l=0;if(e.name==="exponential")l=Vt(i,e.base,a,s);else if(e.name==="linear")l=Vt(i,1,a,s);else if(e.name==="cubic-bezier"){const u=e.controlPoints;l=new wc(u[0],u[1],u[2],u[3]).solve(Vt(i,1,a,s))}return l}static parse(e,i){let[a,s,l,...u]=e;if(!Array.isArray(s)||s.length===0)return i.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const m=s[1];if(typeof m!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:m}}else{if(s[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(s[0])}`,1,0);{const m=s.slice(1);if(m.length!==4||m.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:m}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,Te),!l)return null;const d=[];let _=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||i.expectedType==$n?i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType):_=Ai;for(let m=0;m<u.length;m+=2){const v=u[m],g=u[m+1],T=m+3,b=m+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(d.length&&d[d.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(g,b,_);if(!I)return null;_=_||I.type,d.push([v,I])}return Ji(_,Te)||Ji(_,bs)||Ji(_,Ai)||Ji(_,ws)||Ji(_,Ca)||Ji(_,$n)||Ji(_,Aa)||Ji(_,Kt(Te))?new At(_,a,s,l,d):i.error(`Type ${at(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,a=this.outputs;if(i.length===1)return a[0].evaluate(e);const s=this.input.evaluate(e);if(s<=i[0])return a[0].evaluate(e);const l=i.length;if(s>=i[l-1])return a[l-1].evaluate(e);const u=_n(i,s),d=At.interpolationFactor(this.interpolation,s,i[u],i[u+1]),_=a[u].evaluate(e),m=a[u+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Br(_,m,d);case"color":return $e.interpolate(_,m,d);case"padding":return ti.interpolate(_,m,d);case"colorArray":return Be.interpolate(_,m,d);case"numberArray":return _t.interpolate(_,m,d);case"variableAnchorOffsetCollection":return ui.interpolate(_,m,d);case"array":return Wn(_,m,d);case"projectionDefinition":return hi.interpolate(_,m,d)}case"interpolate-hcl":switch(this.type.kind){case"color":return $e.interpolate(_,m,d,"hcl");case"colorArray":return Be.interpolate(_,m,d,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return $e.interpolate(_,m,d,"lab");case"colorArray":return Be.interpolate(_,m,d,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Vt(r,e,i,a){const s=a-i,l=r-i;return s===0?0:e===1?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1)}const Di={color:$e.interpolate,number:Br,padding:ti.interpolate,numberArray:_t.interpolate,colorArray:Be.interpolate,variableAnchorOffsetCollection:ui.interpolate,array:Wn};class La{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let a=null;const s=i.expectedType;s&&s.kind!=="value"&&(a=s);const l=[];for(const d of e.slice(1)){const _=i.parse(d,1+l.length,a,void 0,{typeAnnotation:"omit"});if(!_)return null;a=a||_.type,l.push(_)}if(!a)throw new Error("No output type");const u=s&&l.some((d=>Zn(s,d.type)));
vendor: 58,001 bytes, lines 15-16
15return new La(u?Ne:a,l)}evaluate(e){let i,a=null,s=0;for(const l of this.args)if(s++,a=l.evaluate(e),a&&a instanceof zi&&!a.available&&(i||(i=a.name),a=null,s===this.args.length&&(a=i)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Fa(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Bt(r,e,i,a){return a.compare(e,i)===0}function gn(r,e,i){const a=r!=="=="&&r!=="!=";return class Xf{constructor(l,u,d){this.type=Ge,this.lhs=l,this.rhs=u,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||u.type.kind==="value"}static parse(l,u){if(l.length!==3&&l.length!==4)return u.error("Expected two or three arguments.");const d=l[0];let _=u.parse(l[1],1,Ne);if(!_)return null;if(!Fa(d,_.type))return u.concat(1).error(`"${d}" comparisons are not supported for type '${at(_.type)}'.`);let m=u.parse(l[2],2,Ne);if(!m)return null;if(!Fa(d,m.type))return u.concat(2).error(`"${d}" comparisons are not supported for type '${at(m.type)}'.`);if(_.type.kind!==m.type.kind&&_.type.kind!=="value"&&m.type.kind!=="value")return u.error(`Cannot compare types '${at(_.type)}' and '${at(m.type)}'.`);a&&(_.type.kind==="value"&&m.type.kind!=="value"?_=new Ti(m.type,[_]):_.type.kind!=="value"&&m.type.kind==="value"&&(m=new Ti(_.type,[m])));let v=null;if(l.length===4){if(_.type.kind!=="string"&&m.type.kind!=="string"&&_.type.kind!=="value"&&m.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(l[3],3,Ma),!v)return null}return new Xf(_,m,v)}evaluate(l){const u=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(a&&this.hasUntypedArgument){const _=Mt(u),m=Mt(d);if(_.kind!==m.kind||_.kind!=="string"&&_.kind!=="number")throw new ct(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${m.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const _=Mt(u),m=Mt(d);if(_.kind!=="string"||m.kind!=="string")return e(l,u,d)}return this.collator?i(l,u,d,this.collator.evaluate(l)):e(l,u,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const tl=gn("==",(function(r,e,i){return e===i}),Bt),Tc=gn("!=",(function(r,e,i){return e!==i}),(function(r,e,i,a){return!Bt(0,e,i,a)})),Uu=gn("<",(function(r,e,i){return e<i}),(function(r,e,i,a){return a.compare(e,i)<0})),Qn=gn(">",(function(r,e,i){return e>i}),(function(r,e,i,a){return a.compare(e,i)>0})),Cs=gn("<=",(function(r,e,i){return e<=i}),(function(r,e,i,a){return a.compare(e,i)<=0})),il=gn(">=",(function(r,e,i){return e>=i}),(function(r,e,i,a){return a.compare(e,i)>=0}));class As{constructor(e,i,a){this.type=Ma,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return i.error("Collator options argument must be an object.");const s=i.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,Ge);if(!s)return null;const l=i.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,Ge);if(!l)return null;let u=null;return a.locale&&(u=i.parse(a.locale,1,je),!u)?null:new As(s,l,u)}evaluate(e){return new Ko(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class zs{constructor(e,i,a,s,l,u){this.type=je,this.number=e,this.locale=i,this.currency=a,this.unit=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const a=i.parse(e[1],1,Te);if(!a)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return i.error("NumberFormat options argument must be an object.");let l=null;if(s.locale&&(l=i.parse(s.locale,1,je),!l))return null;let u=null;if(s.currency&&(u=i.parse(s.currency,1,je),!u))return null;let d=null;if(s.unit&&(d=i.parse(s.unit,1,je),!d))return null;if(u&&d)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let _=null;if(s["min-fraction-digits"]&&(_=i.parse(s["min-fraction-digits"],1,Te),!_))return null;let m=null;return s["max-fraction-digits"]&&(m=i.parse(s["max-fraction-digits"],1,Te),!m)?null:new zs(a,l,u,d,_,m)}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}}class yn{constructor(e){this.type=Ea,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return i.error("First argument must be an image or text section.");const s=[];let l=!1;for(let u=1;u<=e.length-1;++u){const d=e[u];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let _=null;if(d["font-scale"]&&(_=i.parse(d["font-scale"],1,Te),!_))return null;let m=null;if(d["text-font"]&&(m=i.parse(d["text-font"],1,Kt(je)),!m))return null;let v=null;if(d["text-color"]&&(v=i.parse(d["text-color"],1,Ai),!v))return null;let g=null;if(d["vertical-align"]){if(typeof d["vertical-align"]=="string"&&!Nu.includes(d["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${d["vertical-align"]}' instead.`);if(g=i.parse(d["vertical-align"],1,je),!g)return null}const T=s[s.length-1];T.scale=_,T.font=m,T.textColor=v,T.verticalAlign=g}else{const _=i.parse(e[u],1,Ne);if(!_)return null;const m=_.type.kind;if(m!=="string"&&m!=="value"&&m!=="null"&&m!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,s.push({content:_,scale:null,font:null,textColor:null,verticalAlign:null})}}return new yn(s)}evaluate(e){return new wi(this.sections.map((i=>{const a=i.content.evaluate(e);return Mt(a)===Gn?new Jo("",a,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Jo(pn(a),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class ea{constructor(e){this.type=Gn,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const a=i.parse(e[1],1,je);return a?new ea(a):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),a=zi.fromString(i);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(i)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class ki{constructor(e){this.type=Te,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=i.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${at(a.type)} instead.`):new ki(a):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new ct(`Expected value to be of type string or array, but found ${at(Mt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const er=8192;function Ds(r,e){const i=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(i*s*er),Math.round(a*s*er)]}function rl(r,e){const i=Math.pow(2,e.z);return[(s=(r[0]/er+e.x)/i,360*s-180),(a=(r[1]/er+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,s}function vn(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Ba(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function $u(r,e,i){const a=r[0]-e[0],s=r[1]-e[1],l=r[0]-i[0],u=r[1]-i[1];return a*u-l*s==0&&a*l<=0&&s*u<=0}function ks(r,e,i,a){return(s=[a[0]-i[0],a[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-s[1]*l[0]!=0&&!(!Pc(r,e,i,a)||!Pc(i,a,r,e));var s,l}function Gu(r,e,i){for(const a of i)for(let s=0;s<a.length-1;++s)if(ks(r,e,a[s],a[s+1]))return!0;return!1}function mr(r,e,i=!1){let a=!1;for(const d of e)for(let _=0;_<d.length-1;_++){if($u(r,d[_],d[_+1]))return i;(l=d[_])[1]>(s=r)[1]!=(u=d[_+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(a=!a)}var s,l,u;return a}function Zu(r,e){for(const i of e)if(mr(r,i))return!0;return!1}function nl(r,e){for(const i of r)if(!mr(i,e))return!1;for(let i=0;i<r.length-1;++i)if(Gu(r[i],r[i+1],e))return!1;return!0}function Sc(r,e){for(const i of e)if(nl(r,i))return!0;return!1}function Pc(r,e,i,a){const s=a[0]-i[0],l=a[1]-i[1],u=(r[0]-i[0])*l-s*(r[1]-i[1]),d=(e[0]-i[0])*l-s*(e[1]-i[1]);return u>0&&d<0||u<0&&d>0}function Rs(r,e,i){const a=[];for(let s=0;s<r.length;s++){const l=[];for(let u=0;u<r[s].length;u++){const d=Ds(r[s][u],i);vn(e,d),l.push(d)}a.push(l)}return a}function Ic(r,e,i){const a=[];for(let s=0;s<r.length;s++){const l=Rs(r[s],e,i);a.push(l)}return a}function Mc(r,e,i,a){if(r[0]<i[0]||r[0]>i[2]){const s=.5*a;let l=r[0]-i[0]>s?-a:i[0]-r[0]>s?a:0;l===0&&(l=r[0]-i[2]>s?-a:i[2]-r[0]>s?a:0),r[0]+=l}vn(e,r)}function Ec(r,e,i,a){const s=Math.pow(2,a.z)*er,l=[a.x*er,a.y*er],u=[];for(const d of r)for(const _ of d){const m=[_.x+l[0],_.y+l[1]];Mc(m,e,i,s),u.push(m)}return u}function Cc(r,e,i,a){const s=Math.pow(2,a.z)*er,l=[a.x*er,a.y*er],u=[];for(const _ of r){const m=[];for(const v of _){const g=[v.x+l[0],v.y+l[1]];vn(e,g),m.push(g)}u.push(m)}if(e[2]-e[0]<=s/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const _ of u)for(const m of _)Mc(m,e,i,s)}var d;return u}class xn{constructor(e,i){this.type=Ge,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(jr(e[1])){const a=e[1];if(a.type==="FeatureCollection"){const s=[];for(const l of a.features){const{type:u,coordinates:d}=l.geometry;u==="Polygon"&&s.push(d),u==="MultiPolygon"&&s.push(...d)}if(s.length)return new xn(a,{type:"MultiPolygon",coordinates:s})}else if(a.type==="Feature"){const s=a.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new xn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new xn(a,a)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,a){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(a.type==="Polygon"){const d=Rs(a.coordinates,l,u),_=Ec(i.geometry(),s,l,u);if(!Ba(s,l))return!1;for(const m of _)if(!mr(m,d))return!1}if(a.type==="MultiPolygon"){const d=Ic(a.coordinates,l,u),_=Ec(i.geometry(),s,l,u);if(!Ba(s,l))return!1;for(const m of _)if(!Zu(m,d))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,a){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(a.type==="Polygon"){const d=Rs(a.coordinates,l,u),_=Cc(i.geometry(),s,l,u);if(!Ba(s,l))return!1;for(const m of _)if(!nl(m,d))return!1}if(a.type==="MultiPolygon"){const d=Ic(a.coordinates,l,u),_=Cc(i.geometry(),s,l,u);if(!Ba(s,l))return!1;for(const m of _)if(!Sc(m,d))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let al=class{constructor(r=[],e=(i,a)=>i<a?-1:i>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,a=e[r];for(;r>0;){const s=r-1>>1,l=e[s];if(i(a,l)>=0)break;e[r]=l,r=s}e[r]=a}_down(r){const{data:e,compare:i}=this,a=this.length>>1,s=e[r];for(;r<a;){let l=1+(r<<1);const u=l+1;if(u<this.length&&i(e[u],e[l])<0&&(l=u),i(e[l],s)>=0)break;e[r]=e[l],r=l}e[r]=s}};function sl(r,e,i=0,a=r.length-1,s=qu){for(;a>i;){if(a-i>600){const _=a-i+1,m=e-i+1,v=Math.log(_),g=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*g*(_-g)/_)*(m-_/2<0?-1:1);sl(r,e,Math.max(i,Math.floor(e-m*g/_+T)),Math.min(a,Math.floor(e+(_-m)*g/_+T)),s)}const l=r[e];let u=i,d=a;for(ta(r,i,e),s(r[a],l)>0&&ta(r,i,a);u<d;){for(ta(r,u,d),u++,d--;s(r[u],l)<0;)u++;for(;s(r[d],l)>0;)d--}s(r[i],l)===0?ta(r,i,d):(d++,ta(r,d,a)),d<=e&&(i=d+1),e<=d&&(a=d-1)}}function ta(r,e,i){const a=r[e];r[e]=r[i],r[i]=a}function qu(r,e){return r<e?-1:r>e?1:0}function Ls(r,e){if(r.length<=1)return[r];const i=[];let a,s;for(const l of r){const u=Hu(l);u!==0&&(l.area=Math.abs(u),s===void 0&&(s=u<0),s===u<0?(a&&i.push(a),a=[l]):a.push(l))}if(a&&i.push(a),e>1)for(let l=0;l<i.length;l++)i[l].length<=e||(sl(i[l],e,1,i[l].length-1,Wu),i[l]=i[l].slice(0,e));return i}function Wu(r,e){return e.area-r.area}function Hu(r){let e=0;for(let i,a,s=0,l=r.length,u=l-1;s<l;u=s++)i=r[s],a=r[u],e+=(a.x-i.x)*(i.y+a.y);return e}const Oa=1/298.257223563,Ac=Oa*(2-Oa),zc=Math.PI/180;class ol{constructor(e){const i=6378.137*zc*1e3,a=Math.cos(e*zc),s=1/(1-Ac*(1-a*a)),l=Math.sqrt(s);this.kx=i*l*a,this.ky=i*l*s*(1-Ac)}distance(e,i){const a=this.wrap(e[0]-i[0])*this.kx,s=(e[1]-i[1])*this.ky;return Math.sqrt(a*a+s*s)}pointOnLine(e,i){let a,s,l,u,d=1/0;for(let _=0;_<e.length-1;_++){let m=e[_][0],v=e[_][1],g=this.wrap(e[_+1][0]-m)*this.kx,T=(e[_+1][1]-v)*this.ky,b=0;g===0&&T===0||(b=(this.wrap(i[0]-m)*this.kx*g+(i[1]-v)*this.ky*T)/(g*g+T*T),b>1?(m=e[_+1][0],v=e[_+1][1]):b>0&&(m+=g/this.kx*b,v+=T/this.ky*b)),g=this.wrap(i[0]-m)*this.kx,T=(i[1]-v)*this.ky;const I=g*g+T*T;I<d&&(d=I,a=m,s=v,l=_,u=b)}return{point:[a,s],index:l,t:Math.max(0,Math.min(1,u))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Dc(r,e){return e[0]-r[0]}function ia(r){return r[1]-r[0]+1}function sr(r,e){return r[1]>=r[0]&&r[1]<e}function ll(r,e){if(r[0]>r[1])return[null,null];const i=ia(r);if(e){if(i===2)return[r,null];const s=Math.floor(i/2);return[[r[0],r[0]+s],[r[0]+s,r[1]]]}if(i===1)return[r,null];const a=Math.floor(i/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function cl(r,e){if(!sr(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let a=e[0];a<=e[1];++a)vn(i,r[a]);return i}function Fs(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const a of i)vn(e,a);return e}function ul(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function hl(r,e,i){if(!ul(r)||!ul(e))return NaN;let a=0,s=0;return r[2]<e[0]&&(a=e[0]-r[2]),r[0]>e[2]&&(a=r[0]-e[2]),r[1]>e[3]&&(s=r[1]-e[3]),r[3]<e[1]&&(s=e[1]-r[3]),i.distance([0,0],[a,s])}function bn(r,e,i){const a=i.pointOnLine(e,r);return i.distance(r,a.point)}function dl(r,e,i,a,s){const l=Math.min(bn(r,[i,a],s),bn(e,[i,a],s)),u=Math.min(bn(i,[r,e],s),bn(a,[r,e],s));return Math.min(l,u)}function kc(r,e,i,a,s){if(!sr(e,r.length)||!sr(a,i.length))return 1/0;let l=1/0;for(let u=e[0];u<e[1];++u){const d=r[u],_=r[u+1];for(let m=a[0];m<a[1];++m){const v=i[m],g=i[m+1];if(ks(d,_,v,g))return 0;l=Math.min(l,dl(d,_,v,g,s))}}return l}function Xu(r,e,i,a,s){if(!sr(e,r.length)||!sr(a,i.length))return NaN;let l=1/0;for(let u=e[0];u<=e[1];++u)for(let d=a[0];d<=a[1];++d)if(l=Math.min(l,s.distance(r[u],i[d])),l===0)return l;return l}function Yu(r,e,i){if(mr(r,e,!0))return 0;let a=1/0;for(const s of e){const l=s[0],u=s[s.length-1];if(l!==u&&(a=Math.min(a,bn(r,[u,l],i)),a===0))return a;const d=i.pointOnLine(s,r);if(a=Math.min(a,i.distance(r,d.point)),a===0)return a}return a}function Ku(r,e,i,a){if(!sr(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(mr(r[l],i,!0))return 0;let s=1/0;for(let l=e[0];l<e[1];++l){const u=r[l],d=r[l+1];for(const _ of i)for(let m=0,v=_.length,g=v-1;m<v;g=m++){const T=_[g],b=_[m];if(ks(u,d,T,b))return 0;s=Math.min(s,dl(u,d,T,b,a))}}return s}function Rc(r,e){for(const i of r)for(const a of i)if(mr(a,e,!0))return!0;return!1}function it(r,e,i,a=1/0){const s=Fs(r),l=Fs(e);if(a!==1/0&&hl(s,l,i)>=a)return a;if(Ba(s,l)){if(Rc(r,e))return 0}else if(Rc(e,r))return 0;let u=1/0;for(const d of r)for(let _=0,m=d.length,v=m-1;_<m;v=_++){const g=d[v],T=d[_];for(const b of e)for(let I=0,M=b.length,A=M-1;I<M;A=I++){const z=b[A],L=b[I];if(ks(g,T,z,L))return 0;u=Math.min(u,dl(g,T,z,L,i))}}return u}function Lc(r,e,i,a,s,l){if(!l)return;const u=hl(cl(a,l),s,i);u<e&&r.push([u,l,[0,0]])}function Bs(r,e,i,a,s,l,u){if(!l||!u)return;const d=hl(cl(a,l),cl(s,u),i);d<e&&r.push([d,l,u])}function Os(r,e,i,a,s=1/0){let l=Math.min(a.distance(r[0],i[0][0]),s);if(l===0)return l;const u=new al([[0,[0,r.length-1],[0,0]]],Dc),d=Fs(i);for(;u.length>0;){const _=u.pop();if(_[0]>=l)continue;const m=_[1],v=e?50:100;if(ia(m)<=v){if(!sr(m,r.length))return NaN;if(e){const g=Ku(r,m,i,a);if(isNaN(g)||g===0)return g;l=Math.min(l,g)}else for(let g=m[0];g<=m[1];++g){const T=Yu(r[g],i,a);if(l=Math.min(l,T),l===0)return 0}}else{const g=ll(m,e);Lc(u,l,a,r,d,g[0]),Lc(u,l,a,r,d,g[1])}}return l}function js(r,e,i,a,s,l=1/0){let u=Math.min(l,s.distance(r[0],i[0]));if(u===0)return u;const d=new al([[0,[0,r.length-1],[0,i.length-1]]],Dc);for(;d.length>0;){const _=d.pop();if(_[0]>=u)continue;const m=_[1],v=_[2],g=e?50:100,T=a?50:100;if(ia(m)<=g&&ia(v)<=T){if(!sr(m,r.length)&&sr(v,i.length))return NaN;let b;if(e&&a)b=kc(r,m,i,v,s),u=Math.min(u,b);else if(e&&!a){const I=r.slice(m[0],m[1]+1);for(let M=v[0];M<=v[1];++M)if(b=bn(i[M],I,s),u=Math.min(u,b),u===0)return u}else if(!e&&a){const I=i.slice(v[0],v[1]+1);for(let M=m[0];M<=m[1];++M)if(b=bn(r[M],I,s),u=Math.min(u,b),u===0)return u}else b=Xu(r,m,i,v,s),u=Math.min(u,b)}else{const b=ll(m,e),I=ll(v,a);Bs(d,u,s,r,i,b[0],I[0]),Bs(d,u,s,r,i,b[0],I[1]),Bs(d,u,s,r,i,b[1],I[0]),Bs(d,u,s,r,i,b[1],I[1])}}return u}function pl(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class wn{constructor(e,i){this.type=Te,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(jr(e[1])){const a=e[1];if(a.type==="FeatureCollection")return new wn(a,a.features.map((s=>pl(s.geometry))).flat());if(a.type==="Feature")return new wn(a,pl(a.geometry));if("type"in a&&"coordinates"in a)return new wn(a,pl(a))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,a){const s=i.geometry(),l=s.flat().map((_=>rl([_.x,_.y],i.canonical)));if(s.length===0)return NaN;const u=new ol(l[0][1]);let d=1/0;for(const _ of a){switch(_.type){case"Point":d=Math.min(d,js(l,!1,[_.coordinates],!1,u,d));break;case"LineString":d=Math.min(d,js(l,!1,_.coordinates,!0,u,d));break;case"Polygon":d=Math.min(d,Os(l,!1,_.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,a){const s=i.geometry(),l=s.flat().map((_=>rl([_.x,_.y],i.canonical)));if(s.length===0)return NaN;const u=new ol(l[0][1]);let d=1/0;for(const _ of a){switch(_.type){case"Point":d=Math.min(d,js(l,!0,[_.coordinates],!1,u,d));break;case"LineString":d=Math.min(d,js(l,!0,_.coordinates,!0,u,d));break;case"Polygon":d=Math.min(d,Os(l,!0,_.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,a){const s=i.geometry();if(s.length===0||s[0].length===0)return NaN;const l=Ls(s,0).map((_=>_.map((m=>m.map((v=>rl([v.x,v.y],i.canonical))))))),u=new ol(l[0][0][0][1]);let d=1/0;for(const _ of a)for(const m of l){switch(_.type){case"Point":d=Math.min(d,Os([_.coordinates],!1,m,u,d));break;case"LineString":d=Math.min(d,Os(_.coordinates,!0,m,u,d));break;case"Polygon":d=Math.min(d,it(m,_.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class ja{constructor(e){this.type=Ne,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=e[1];return a==null?i.error("Global state property must be defined."):typeof a!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new ja(a)}evaluate(e){var i;const a=(i=e.globals)===null||i===void 0?void 0:i.globalState;return a&&Object.keys(a).length!==0?ka(a,this.key):null}eachChild(){}outputDefined(){return!1}}const ra={"==":tl,"!=":Tc,">":Qn,"<":Uu,">=":il,"<=":Cs,array:Ti,at:Xe,boolean:Ti,case:Qi,coalesce:La,collator:As,format:yn,image:ea,in:Ue,"index-of":Yn,interpolate:At,"interpolate-hcl":At,"interpolate-lab":At,length:ki,let:ut,literal:ar,match:Ke,number:Ti,"number-format":zs,object:Ti,slice:Kn,step:Jn,string:Ti,"to-boolean":fr,"to-color":fr,"to-number":fr,"to-string":fr,var:Xn,within:xn,distance:wn,"global-state":ja};class Ui{constructor(e,i,a,s){this.name=e,this.type=i,this._evaluate=a,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const a=e[0],s=Ui.definitions[a];if(!s)return i.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(s)?s[0]:s.type,u=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,d=u.filter((([m])=>!Array.isArray(m)||m.length===e.length-1));let _=null;for(const[m,v]of d){_=new mn(i.registry,Vs,i.path,null,i.scope);const g=[];let T=!1;for(let b=1;b<e.length;b++){const I=e[b],M=Array.isArray(m)?m[b-1]:m.type,A=_.parse(I,1+g.length,M);if(!A){T=!0;break}g.push(A)}if(!T)if(Array.isArray(m)&&m.length!==g.length)_.error(`Expected ${m.length} arguments, but found ${g.length} instead.`);else{for(let b=0;b<g.length;b++){const I=Array.isArray(m)?m[b]:m.type,M=g[b];_.concat(b+1).checkSubtype(I,M.type)}if(_.errors.length===0)return new Ui(a,l,v,g)}}if(d.length===1)i.errors.push(..._.errors);else{const m=(d.length?d:u).map((([g])=>{return T=g,Array.isArray(T)?`(${T.map(at).join(", ")})`:`(${at(T.type)}...)`;var T})).join(" | "),v=[];for(let g=1;g<e.length;g++){const T=i.parse(e[g],1+v.length);if(!T)return null;v.push(at(T.type))}i.error(`Expected arguments of type ${m}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Ui.definitions=i;for(const a in i)e[a]=Ui}}function Fc(r,[e,i,a,s]){e=e.evaluate(r),i=i.evaluate(r),a=a.evaluate(r);const l=s?s.evaluate(r):1,u=Hn(e,i,a,l);if(u)throw new ct(u);return new $e(e/255,i/255,a/255,l,!1)}function Bc(r,e){return r in e}function fl(r,e){const i=e[r];return i===void 0?null:i}function Tn(r){return{type:r}}function Vs(r){if(r instanceof Xn)return Vs(r.boundExpression);if(r instanceof Ui&&r.name==="error"||r instanceof As||r instanceof xn||r instanceof wn||r instanceof ja)return!1;const e=r instanceof fr||r instanceof Ti;let i=!0;return r.eachChild((a=>{i=e?i&&Vs(a):i&&a instanceof ar})),!!i&&Ns(r)&&Us(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Ns(r){if(r instanceof Ui&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof xn||r instanceof wn)return!1;let e=!0;return r.eachChild((i=>{e&&!Ns(i)&&(e=!1)})),e}function Va(r){if(r instanceof Ui&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!Va(i)&&(e=!1)})),e}function Us(r,e){if(r instanceof Ui&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((a=>{i&&!Us(a,e)&&(i=!1)})),i}function Oc(r){return{result:"success",value:r}}function na(r){return{result:"error",value:r}}function aa(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function jc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function ml(r){return!!r.expression&&r.expression.interpolated}function Ze(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function $s(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Mt(r)===pr}function Ju(r){return r}function Vc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",a=i||!(i||r.property!==void 0),s=r.type||(ml(e)?"exponential":"interval"),l=(function(v){switch(v.type){case"color":return $e.parse;case"padding":return ti.parse;case"numberArray":return _t.parse;case"colorArray":return Be.parse;default:return null}})(e);if(l&&((r=un({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],l(v[1])]))),r.default=l(r.default?r.default:e.default)),r.colorSpace&&(u=r.colorSpace)!=="rgb"&&u!=="hcl"&&u!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var u;const d=(function(v){switch(v){case"exponential":return Nc;case"interval":return eh;case"categorical":return Qu;case"identity":return th;default:throw new Error(`Unknown function type "${v}"`)}})(s);let _,m;if(s==="categorical"){_=Object.create(null);for(const v of r.stops)_[v[0]]=v[1];m=typeof r.stops[0][0]}if(i){const v={},g=[];for(let I=0;I<r.stops.length;I++){const M=r.stops[I],A=M[0].zoom;v[A]===void 0&&(v[A]={zoom:A,type:r.type,property:r.property,default:r.default,stops:[]},g.push(A)),v[A].stops.push([M[0].value,M[1]])}const T=[];for(const I of g)T.push([v[I].zoom,Vc(v[I],e)]);const b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:At.interpolationFactor.bind(void 0,b),zoomStops:T.map((I=>I[0])),evaluate:({zoom:I},M)=>Nc({stops:T,base:r.base},e,I).evaluate(I,M)}}if(a){const v=s==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:At.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((g=>g[0])),evaluate:({zoom:g})=>d(r,e,g,_,m)}}return{kind:"source",evaluate(v,g){const T=g&&g.properties?g.properties[r.property]:void 0;return T===void 0?Na(r.default,e.default):d(r,e,T,_,m)}}}function Na(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Qu(r,e,i,a,s){return Na(typeof i===s?a[i]:void 0,r.default,e.default)}function eh(r,e,i){if(Ze(i)!=="number")return Na(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const s=_n(r.stops.map((l=>l[0])),i);return r.stops[s][1]}function Nc(r,e,i){const a=r.base!==void 0?r.base:1;if(Ze(i)!=="number")return Na(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const l=_n(r.stops.map((v=>v[0])),i),u=(function(v,g,T,b){const I=b-T,M=v-T;return I===0?0:g===1?M/I:(Math.pow(g,M)-1)/(Math.pow(g,I)-1)})(i,a,r.stops[l][0],r.stops[l+1][0]),d=r.stops[l][1],_=r.stops[l+1][1],m=Di[e.type]||Ju;return typeof d.evaluate=="function"?{evaluate(...v){const g=d.evaluate.apply(void 0,v),T=_.evaluate.apply(void 0,v);if(g!==void 0&&T!==void 0)return m(g,T,u,r.colorSpace)}}:m(d,_,u,r.colorSpace)}function th(r,e,i){switch(e.type){case"color":i=$e.parse(i);break;case"formatted":i=wi.fromString(i.toString());break;case"resolvedImage":i=zi.fromString(i.toString());break;case"padding":i=ti.parse(i);break;case"colorArray":i=Be.parse(i);break;case"numberArray":i=_t.parse(i);break;default:Ze(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Na(i,r.default,e.default)}Ui.register(ra,{error:[{kind:"error"},[je],(r,[e])=>{throw new ct(e.evaluate(r))}],typeof:[je,[Ne],(r,[e])=>at(Mt(e.evaluate(r)))],"to-rgba":[Kt(Te,4),[Ai],(r,[e])=>{const[i,a,s,l]=e.evaluate(r).rgb;return[255*i,255*a,255*s,l]}],rgb:[Ai,[Te,Te,Te],Fc],rgba:[Ai,[Te,Te,Te,Te],Fc],has:{type:Ge,overloads:[[[je],(r,[e])=>Bc(e.evaluate(r),r.properties())],[[je,pr],(r,[e,i])=>Bc(e.evaluate(r),i.evaluate(r))]]},get:{type:Ne,overloads:[[[je],(r,[e])=>fl(e.evaluate(r),r.properties())],[[je,pr],(r,[e,i])=>fl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Ne,[je],(r,[e])=>fl(e.evaluate(r),r.featureState||{})],properties:[pr,[],r=>r.properties()],"geometry-type":[je,[],r=>r.geometryType()],id:[Ne,[],r=>r.id()],zoom:[Te,[],r=>r.globals.zoom],"heatmap-density":[Te,[],r=>r.globals.heatmapDensity||0],elevation:[Te,[],r=>r.globals.elevation||0],"line-progress":[Te,[],r=>r.globals.lineProgress||0],accumulated:[Ne,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Te,Tn(Te),(r,e)=>{let i=0;for(const a of e)i+=a.evaluate(r);return i}],"*":[Te,Tn(Te),(r,e)=>{let i=1;for(const a of e)i*=a.evaluate(r);return i}],"-":{type:Te,overloads:[[[Te,Te],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[Te],(r,[e])=>-e.evaluate(r)]]},"/":[Te,[Te,Te],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[Te,[Te,Te],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[Te,[],()=>Math.LN2],pi:[Te,[],()=>Math.PI],e:[Te,[],()=>Math.E],"^":[Te,[Te,Te],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[Te,[Te],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[Te,[Te],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[Te,[Te],(r,[e])=>Math.log(e.evaluate(r))],log2:[Te,[Te],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[Te,[Te],(r,[e])=>Math.sin(e.evaluate(r))],cos:[Te,[Te],(r,[e])=>Math.cos(e.evaluate(r))],tan:[Te,[Te],(r,[e])=>Math.tan(e.evaluate(r))],asin:[Te,[Te],(r,[e])=>Math.asin(e.evaluate(r))],acos:[Te,[Te],(r,[e])=>Math.acos(e.evaluate(r))],atan:[Te,[Te],(r,[e])=>Math.atan(e.evaluate(r))],min:[Te,Tn(Te),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[Te,Tn(Te),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[Te,[Te],(r,[e])=>Math.abs(e.evaluate(r))],round:[Te,[Te],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[Te,[Te],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[Te,[Te],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Ge,[je,Ne],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Ge,[Ne],(r,[e])=>r.id()===e.value],"filter-type-==":[Ge,[je],(r,[e])=>r.geometryType()===e.value],"filter-<":[Ge,[je,Ne],(r,[e,i])=>{const a=r.properties()[e.value],s=i.value;return typeof a==typeof s&&a<s}],"filter-id-<":[Ge,[Ne],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i<a}],"filter->":[Ge,[je,Ne],(r,[e,i])=>{const a=r.properties()[e.value],s=i.value;return typeof a==typeof s&&a>s}],"filter-id->":[Ge,[Ne],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i>a}],"filter-<=":[Ge,[je,Ne],(r,[e,i])=>{const a=r.properties()[e.value],s=i.value;return typeof a==typeof s&&a<=s}],"filter-id-<=":[Ge,[Ne],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i<=a}],"filter->=":[Ge,[je,Ne],(r,[e,i])=>{const a=r.properties()[e.value],s=i.value;return typeof a==typeof s&&a>=s}],"filter-id->=":[Ge,[Ne],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i>=a}],"filter-has":[Ge,[Ne],(r,[e])=>e.value in r.properties()],"filter-has-id":[Ge,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Ge,[Kt(je)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[Ge,[Kt(Ne)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[Ge,[je,Kt(Ne)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[Ge,[je,Kt(Ne)],(r,[e,i])=>(function(a,s,l,u){for(;l<=u;){const d=l+u>>1;if(s[d]===a)return!0;s[d]>a?u=d-1:l=d+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Ge,overloads:[[[Ge,Ge],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Tn(Ge),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Ge,overloads:[[[Ge,Ge],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Tn(Ge),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Ge,[Ge],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Ge,[je],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[je,[je],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[je,[je],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[je,Tn(Ne),(r,e)=>e.map((i=>pn(i.evaluate(r)))).join("")],split:[Kt(je),[je,je],(r,[e,i])=>e.evaluate(r).split(i.evaluate(r))],join:[je,[Kt(je),je],(r,[e,i])=>e.evaluate(r).join(i.evaluate(r))],"resolved-locale":[je,[Ma],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Ua{constructor(e,i,a){this.expression=e,this._warningHistory={},this._evaluator=new Qo,this._defaultValue=i?(function(s){if(s.type==="color"&&$s(s.default))return new $e(0,0,0,0);switch(s.type){case"color":return $e.parse(s.default)||null;case"padding":return ti.parse(s.default)||null;case"numberArray":return _t.parse(s.default)||null;case"colorArray":return Be.parse(s.default)||null;case"variableAnchorOffsetCollection":return ui.parse(s.default)||null;case"projectionDefinition":return hi.parse(s.default)||null;default:return s.default===void 0?null:s.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=a}evaluateWithoutErrorHandling(e,i,a,s,l,u){return this._globalState&&(e=oa(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=a,this._evaluator.canonical=s,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(e,i,a,s,l,u){this._globalState&&(e=oa(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=a||null,this._evaluator.canonical=s,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null;try{const d=this.expression.evaluate(this._evaluator);if(d==null||typeof d=="number"&&d!=d)return this._defaultValue;if(this._enumValues&&!(d in this._enumValues))throw new ct(`Expected value to be one of ${Object.keys(this._enumValues).map((_=>JSON.stringify(_))).join(", ")}, but found ${JSON.stringify(d)} instead.`);return d}catch(d){return this._warningHistory[d.message]||(this._warningHistory[d.message]=!0,typeof console<"u"&&console.warn(d.message)),this._defaultValue}}}function Gs(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ra}function $a(r,e,i){const a=new mn(ra,Vs,[],e?(function(l){const u={color:Ai,string:je,number:Te,enum:je,boolean:Ge,formatted:Ea,padding:ws,numberArray:Ca,colorArray:$n,projectionDefinition:bs,resolvedImage:Gn,variableAnchorOffsetCollection:Aa};return l.type==="array"?Kt(u[l.value]||Ne,l.length):u[l.type]})(e):void 0),s=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Oc(new Ua(s,e,i)):na(a.errors)}class Zs{constructor(e,i,a){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!Va(i.expression),this.globalStateRefs=sa(i.expression),this._globalState=a}evaluateWithoutErrorHandling(e,i,a,s,l,u){return this._globalState&&(e=oa(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,a,s,l,u)}evaluate(e,i,a,s,l,u){return this._globalState&&(e=oa(e,this._globalState)),this._styleExpression.evaluate(e,i,a,s,l,u)}}class qs{constructor(e,i,a,s,l){this.kind=e,this.zoomStops=a,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Va(i.expression),this.globalStateRefs=sa(i.expression),this.interpolationType=s,this._globalState=l}evaluateWithoutErrorHandling(e,i,a,s,l,u){return this._globalState&&(e=oa(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,a,s,l,u)}evaluate(e,i,a,s,l,u){return this._globalState&&(e=oa(e,this._globalState)),this._styleExpression.evaluate(e,i,a,s,l,u)}interpolationFactor(e,i,a){return this.interpolationType?At.interpolationFactor(this.interpolationType,e,i,a):0}}function Uc(r,e,i){const a=$a(r,e,i);if(a.result==="error")return a;const s=a.value.expression,l=Ns(s);if(!l&&!aa(e))return na([new Yt("","data expressions not supported")]);const u=Us(s,["zoom"]);if(!u&&!jc(e))return na([new Yt("","zoom expressions not supported")]);const d=Sn(s);return d||u?d instanceof Yt?na([d]):d instanceof At&&!ml(e)?na([new Yt("",'"interpolate" expressions cannot be used with this property')]):Oc(d?new qs(l?"camera":"composite",a.value,d.labels,d instanceof At?d.interpolation:void 0,i):new Zs(l?"constant":"source",a.value,i)):na([new Yt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ws{constructor(e,i){this._parameters=e,this._specification=i,un(this,Vc(this._parameters,this._specification))}static deserialize(e){return new Ws(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Sn(r){let e=null;if(r instanceof ut)e=Sn(r.result);else if(r instanceof La){for(const i of r.args)if(e=Sn(i),e)break}else(r instanceof Jn||r instanceof At)&&r.input instanceof Ui&&r.input.name==="zoom"&&(e=r);return e instanceof Yt||r.eachChild((i=>{const a=Sn(i);a instanceof Yt?e=a:!e&&a?e=new Yt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new Yt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function sa(r,e=new Set){return r instanceof ja&&e.add(r.key),r.eachChild((i=>{sa(i,e)})),e}function oa(r,e){const{zoom:i,heatmapDensity:a,elevation:s,lineProgress:l,isSupportedScript:u,accumulated:d}=r??{};return{zoom:i,heatmapDensity:a,elevation:s,lineProgress:l,isSupportedScript:u,accumulated:d,globalState:e}}function _l(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!_l(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ih={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ga(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};_l(r)||(r=Za(r));const i=$a(r,ih,e);if(i.result==="error")throw new Error(i.value.map((a=>`${a.key}: ${a.message}`)).join(", "));return{filter:(a,s,l)=>i.value.evaluate(a,s,{},l),needGeometry:gl(r),getGlobalStateRefs:()=>sa(i.value.expression)}}function rh(r,e){return r<e?-1:r>e?1:0}function gl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(gl(r[e]))return!0;return!1}function Za(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?yl(r[1],r[2],"=="):e==="!="?qa(yl(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?yl(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Za))):e==="all"?["all"].concat(r.slice(1).map(Za)):e==="none"?["all"].concat(r.slice(1).map(Za).map(qa)):e==="in"?$c(r[1],r.slice(2)):e==="!in"?qa($c(r[1],r.slice(2))):e==="has"?vl(r[1]):e!=="!has"||qa(vl(r[1]));var i}function yl(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function $c(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(rh)]]:["filter-in-small",r,["literal",e]]}}function vl(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function qa(r){return["!",r]}function Hs(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let s="[";for(const l of r)s+=`${Hs(l)},`;return`${s}]`}const i=Object.keys(r).sort();let a="{";for(let s=0;s<i.length;s++)a+=`${JSON.stringify(i[s])}:${Hs(r[i[s]])},`;return`${a}}`}function nh(r){let e="";for(const i of Uo)e+=`/${Hs(r[i])}`;return e}function Gc(r){const e=r.value;return e?[new ve(r.key,e,"constants have been deprecated as of v8")]:[]}function Et(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Pn(r){if(Array.isArray(r))return r.map(Pn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Pn(r[i]);return e}return Et(r)}function Si(r){const e=r.key,i=r.value,a=r.valueSpec||{},s=r.objectElementValidators||{},l=r.style,u=r.styleSpec,d=r.validateSpec;let _=[];const m=Ze(i);if(m!=="object")return[new ve(e,i,`object expected, ${m} found`)];for(const v in i){const g=v.split(".")[0],T=ka(a,g)||a["*"];let b;if(ka(s,g))b=s[g];else if(ka(a,g)){if(i[v]===void 0)continue;b=d}else if(s["*"])b=s["*"];else{if(!a["*"]){_.push(new ve(e,i[v],`unknown property "${v}"`));continue}b=d}_=_.concat(b({key:(e&&`${e}.`)+v,value:i[v],valueSpec:T,style:l,styleSpec:u,object:i,objectKey:v,validateSpec:d},i))}for(const v in a)s[v]||a[v].required&&a[v].default===void 0&&i[v]===void 0&&_.push(new ve(e,i,`missing required property "${v}"`));return _}function Xs(r){const e=r.value,i=r.valueSpec,a=r.style,s=r.styleSpec,l=r.key,u=r.arrayElementValidator||r.validateSpec;if(Ze(e)!=="array")return[new ve(l,e,`array expected, ${Ze(e)} found`)];if(i.length&&e.length!==i.length)return[new ve(l,e,`array length ${i.length} expected, length ${e.length} found`)];let d={type:i.value,values:i.values};s.$version<7&&(d.function=i.function),Ze(i.value)==="object"&&(d=i.value);let _=[];for(let m=0;m<e.length;m++)_=_.concat(u({array:e,arrayIndex:m,value:e[m],valueSpec:d,validateSpec:r.validateSpec,style:a,styleSpec:s,key:`${l}[${m}]`}));return _}function la(r){const e=r.key,i=r.value,a=r.valueSpec;let s=Ze(i);return s==="number"&&i!=i&&(s="NaN"),s!=="number"?[new ve(e,i,`number expected, ${s} found`)]:"minimum"in a&&i<a.minimum?[new ve(e,i,`${i} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&i>a.maximum?[new ve(e,i,`${i} is greater than the maximum value ${a.maximum}`)]:[]}function Ys(r){const e=r.valueSpec,i=Et(r.value.type);let a,s,l,u={};const d=i!=="categorical"&&r.value.property===void 0,_=!d,m=Ze(r.value.stops)==="array"&&Ze(r.value.stops[0])==="array"&&Ze(r.value.stops[0][0])==="object",v=Si({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(b){if(i==="identity")return[new ve(b.key,b.value,'identity function may not have a "stops" property')];let I=[];const M=b.value;return I=I.concat(Xs({key:b.key,value:M,valueSpec:b.valueSpec,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,arrayElementValidator:g})),Ze(M)==="array"&&M.length===0&&I.push(new ve(b.key,M,"array must have at least one stop")),I},default:function(b){return b.validateSpec({key:b.key,value:b.value,valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec})}}});return i==="identity"&&d&&v.push(new ve(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new ve(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!ml(r.valueSpec)&&v.push(new ve(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(_&&!aa(r.valueSpec)?v.push(new ve(r.key,r.value,"property functions not supported")):d&&!jc(r.valueSpec)&&v.push(new ve(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!m||r.value.property!==void 0||v.push(new ve(r.key,r.value,'"property" property is required')),v;function g(b){let I=[];const M=b.value,A=b.key;if(Ze(M)!=="array")return[new ve(A,M,`array expected, ${Ze(M)} found`)];if(M.length!==2)return[new ve(A,M,`array length 2 expected, length ${M.length} found`)];if(m){if(Ze(M[0])!=="object")return[new ve(A,M,`object expected, ${Ze(M[0])} found`)];if(M[0].zoom===void 0)return[new ve(A,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new ve(A,M,"object stop key must have value")];if(l&&l>Et(M[0].zoom))return[new ve(A,M[0].zoom,"stop zoom values must appear in ascending order")];Et(M[0].zoom)!==l&&(l=Et(M[0].zoom),s=void 0,u={}),I=I.concat(Si({key:`${A}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{zoom:la,value:T}}))}else I=I.concat(T({key:`${A}[0]`,value:M[0],validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec},M));return Gs(Pn(M[1]))?I.concat([new ve(`${A}[1]`,M[1],"expressions are not allowed in function stops.")]):I.concat(b.validateSpec({key:`${A}[1]`,value:M[1],valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec}))}function T(b,I){const M=Ze(b.value),A=Et(b.value),z=b.value!==null?b.value:I;if(a){if(M!==a)return[new ve(b.key,z,`${M} stop domain type must match previous stop domain type ${a}`)]}else a=M;if(M!=="number"&&M!=="string"&&M!=="boolean")return[new ve(b.key,z,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&i!=="categorical"){let L=`number expected, ${M} found`;return aa(e)&&i===void 0&&(L+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ve(b.key,z,L)]}return i!=="categorical"||M!=="number"||isFinite(A)&&Math.floor(A)===A?i!=="categorical"&&M==="number"&&s!==void 0&&A<s?[new ve(b.key,z,"stop domain values must appear in ascending order")]:(s=A,i==="categorical"&&A in u?[new ve(b.key,z,"stop domain values must be unique")]:(u[A]=!0,[])):[new ve(b.key,z,`integer expected, found ${A}`)]}}function Vr(r){const e=(r.expressionContext==="property"?Uc:$a)(Pn(r.value),r.valueSpec);if(e.result==="error")return e.value.map((a=>new ve(`${r.key}${a.key}`,r.value,a.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new ve(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Va(i))return[new ve(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Va(i))return[new ve(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Us(i,["zoom","feature-state"]))return[new ve(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Ns(i))return[new ve(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Wa(r){const e=r.key,i=r.value,a=Ze(i);return a!=="string"?[new ve(e,i,`color expected, ${a} found`)]:$e.parse(String(i))?[]:[new ve(e,i,`color expected, "${i}" found`)]}function In(r){const e=r.key,i=r.value,a=r.valueSpec,s=[];return Array.isArray(a.values)?a.values.indexOf(Et(i))===-1&&s.push(new ve(e,i,`expected one of [${a.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(a.values).indexOf(Et(i))===-1&&s.push(new ve(e,i,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(i)} found`)),s}function ca(r){return _l(Pn(r.value))?Vr(un({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zc(r)}function Zc(r){const e=r.value,i=r.key;if(Ze(e)!=="array")return[new ve(i,e,`array expected, ${Ze(e)} found`)];const a=r.styleSpec;let s,l=[];if(e.length<1)return[new ve(i,e,"filter array must have at least 1 element")];switch(l=l.concat(In({key:`${i}[0]`,value:e[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),Et(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Et(e[1])==="$type"&&l.push(new ve(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&l.push(new ve(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(s=Ze(e[1]),s!=="string"&&l.push(new ve(`${i}[1]`,e[1],`string expected, ${s} found`)));for(let u=2;u<e.length;u++)s=Ze(e[u]),Et(e[1])==="$type"?l=l.concat(In({key:`${i}[${u}]`,value:e[u],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):s!=="string"&&s!=="number"&&s!=="boolean"&&l.push(new ve(`${i}[${u}]`,e[u],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let u=1;u<e.length;u++)l=l.concat(Zc({key:`${i}[${u}]`,value:e[u],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":s=Ze(e[1]),e.length!==2?l.push(new ve(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):s!=="string"&&l.push(new ve(`${i}[1]`,e[1],`string expected, ${s} found`))}return l}function qc(r,e){const i=r.key,a=r.validateSpec,s=r.style,l=r.styleSpec,u=r.value,d=r.objectKey,_=l[`${e}_${r.layerType}`];if(!_)return[];const m=d.match(/^(.*)-transition$/);if(e==="paint"&&m&&_[m[1]]&&_[m[1]].transition)return a({key:i,value:u,valueSpec:l.transition,style:s,styleSpec:l});const v=r.valueSpec||_[d];if(!v)return[new ve(i,u,`unknown property "${d}"`)];let g;if(Ze(u)==="string"&&aa(v)&&!v.tokens&&(g=/^{([^}]+)}$/.exec(u)))return[new ve(i,u,`"${d}" does not support interpolation syntax 16Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(g[1])} }\`.`)];const T=[];return r.layerType==="symbol"&&d==="text-font"&&$s(Pn(u))&&Et(u.type)==="identity"&&T.push(new ve(i,u,'"text-font" does not support identity functions')),T.concat(a({key:r.key,value:u,valueSpec:v,style:s,styleSpec:l,expressionContext:"property",propertyType:e,propertyKey:d}))}function Wc(r){return qc(r,"paint")}function Hc(r){return qc(r,"layout")}function Xc(r){var e,i;let a=[];const s=r.value,l=r.key,u=r.style,d=r.styleSpec;if(Ze(s)!=="object")return[new ve(l,s,`object expected, ${Ze(s)} found`)];s.type||s.ref||a.push(new ve(l,s,'either "type" or "ref" is required'));let _=Et(s.type);const m=Et(s.ref);if(s.id){const v=Et(s.id);for(let g=0;g<r.arrayIndex;g++){const T=u.layers[g];Et(T.id)===v&&a.push(new ve(l,s.id,`duplicate layer id "${s.id}", previously used at line ${T.id.__line__}`))}}if("ref"in s){let v;["type","source","source-layer","filter","layout"].forEach((g=>{g in s&&a.push(new ve(l,s[g],`"${g}" is prohibited for ref layers`))})),u.layers.forEach((g=>{Et(g.id)===m&&(v=g)})),v?v.ref?a.push(new ve(l,s.ref,"ref cannot reference another ref layer")):_=Et(v.type):a.push(new ve(l,s.ref,`ref layer "${m}" not found`))}else if(_!=="background")if(s.source){const v=u.sources&&u.sources[s.source],g=v&&Et(v.type);v?g==="vector"&&_==="raster"?a.push(new ve(l,s.source,`layer "${s.id}" requires a raster source`)):g!=="raster-dem"&&_==="hillshade"||g!=="raster-dem"&&_==="color-relief"?a.push(new ve(l,s.source,`layer "${s.id}" requires a raster-dem source`)):g==="raster"&&_!=="raster"?a.push(new ve(l,s.source,`layer "${s.id}" requires a vector source`)):g!=="vector"||s["source-layer"]?g==="raster-dem"&&_!=="hillshade"&&_!=="color-relief"?a.push(new ve(l,s.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):_!=="line"||!s.paint||!s.paint["line-gradient"]||g==="geojson"&&v.lineMetrics||a.push(new ve(l,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):a.push(new ve(l,s,`layer "${s.id}" must specify a "source-layer"`)):a.push(new ve(l,s.source,`source "${s.source}" not found`))}else a.push(new ve(l,s,'missing required property "source"'));return _==="raster"&&(!((e=s.paint)===null||e===void 0)&&e.resampling)&&(!((i=s.paint)===null||i===void 0)&&i["raster-resampling"])&&a.push(new ve(l,s.paint,`layer "${s.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),a=a.concat(Si({key:l,value:s,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:s.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:s,objectKey:"type"}),filter:ca,layout:v=>Si({layer:s,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":g=>Hc(un({layerType:_},g))}}),paint:v=>Si({layer:s,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":g=>Wc(un({layerType:_},g))}})}})),a}function Nr(r){const e=r.value,i=r.key,a=Ze(e);return a!=="string"?[new ve(i,e,`string expected, ${a} found`)]:[]}const xl={promoteId:function({key:r,value:e}){if(Ze(e)==="string")return Nr({key:r,value:e});{const i=[];for(const a in e)i.push(...Nr({key:`${r}.${a}`,value:e[a]}));return i}}};function bl(r){const e=r.value,i=r.key,a=r.styleSpec,s=r.style,l=r.validateSpec;if(!e.type)return[new ve(i,e,'"type" is required')];const u=Et(e.type);let d;switch(u){case"vector":case"raster":return d=Si({key:i,value:e,valueSpec:a[`source_${u.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:xl,validateSpec:l}),d;case"raster-dem":return d=(function(_){var m;const v=(m=_.sourceName)!==null&&m!==void 0?m:"",g=_.value,T=_.styleSpec,b=T.source_raster_dem,I=_.style;let M=[];const A=Ze(g);if(g===void 0)return M;if(A!=="object")return M.push(new ve("source_raster_dem",g,`object expected, ${A} found`)),M;const z=Et(g.encoding)==="custom",L=["redFactor","greenFactor","blueFactor","baseShift"],k=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const F in g)!z&&L.includes(F)?M.push(new ve(F,g[F],`In "${v}": "${F}" is only valid when "encoding" is set to "custom". ${k} encoding found`)):b[F]?M=M.concat(_.validateSpec({key:F,value:g[F],valueSpec:b[F],validateSpec:_.validateSpec,style:I,styleSpec:T})):M.push(new ve(F,g[F],`unknown property "${F}"`));return M})({sourceName:i,value:e,style:r.style,styleSpec:a,validateSpec:l}),d;case"geojson":if(d=Si({key:i,value:e,valueSpec:a.source_geojson,style:s,styleSpec:a,validateSpec:l,objectElementValidators:xl}),e.cluster)for(const _ in e.clusterProperties){const[m,v]=e.clusterProperties[_],g=typeof m=="string"?[m,["accumulated"],["get",_]]:m;d.push(...Vr({key:`${i}.${_}.map`,value:v,expressionContext:"cluster-map"})),d.push(...Vr({key:`${i}.${_}.reduce`,value:g,expressionContext:"cluster-reduce"}))}return d;case"video":return Si({key:i,value:e,valueSpec:a.source_video,style:s,validateSpec:l,styleSpec:a});case"image":return Si({key:i,value:e,valueSpec:a.source_image,style:s,validateSpec:l,styleSpec:a});case"canvas":return[new ve(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return In({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Ha(r){const e=r.value,i=r.styleSpec,a=i.light,s=r.style;let l=[];const u=Ze(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new ve("light",e,`object expected, ${u} found`)]),l;for(const d in e){const _=d.match(/^(.*)-transition$/);l=l.concat(_&&a[_[1]]&&a[_[1]].transition?r.validateSpec({key:d,value:e[d],valueSpec:i.transition,validateSpec:r.validateSpec,style:s,styleSpec:i}):a[d]?r.validateSpec({key:d,value:e[d],valueSpec:a[d],validateSpec:r.validateSpec,style:s,styleSpec:i}):[new ve(d,e[d],`unknown property "${d}"`)])}return l}function Yc(r){const e=r.value,i=r.styleSpec,a=i.sky,s=r.style,l=Ze(e);if(e===void 0)return[];if(l!=="object")return[new ve("sky",e,`object expected, ${l} found`)];let u=[];for(const d in e)u=u.concat(a[d]?r.validateSpec({key:d,value:e[d],valueSpec:a[d],style:s,styleSpec:i}):[new ve(d,e[d],`unknown property "${d}"`)]);return u}function wl(r){const e=r.value,i=r.styleSpec,a=i.terrain,s=r.style;let l=[];const u=Ze(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new ve("terrain",e,`object expected, ${u} found`)]),l;for(const d in e)l=l.concat(a[d]?r.validateSpec({key:d,value:e[d],valueSpec:a[d],validateSpec:r.validateSpec,style:s,styleSpec:i}):[new ve(d,e[d],`unknown property "${d}"`)]);return l}function Tl(r){let e=[];const i=r.value,a=r.key;if(Array.isArray(i)){const s=[],l=[];for(const u in i)i[u].id&&s.includes(i[u].id)&&e.push(new ve(a,i,`all the sprites' ids must be unique, but ${i[u].id} is duplicated`)),s.push(i[u].id),i[u].url&&l.includes(i[u].url)&&e.push(new ve(a,i,`all the sprites' URLs must be unique, but ${i[u].url} is duplicated`)),l.push(i[u].url),e=e.concat(Si({key:`${a}[${u}]`,value:i[u],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return Nr({key:a,value:i})}function Kc(r){return!!r&&r.constructor===Object}function Xa(r){return Kc(r.value)?[]:[new ve(r.key,r.value,`object expected, ${Ze(r.value)} found`)]}const Sl={"*":()=>[],array:Xs,boolean:function(r){const e=r.value,i=r.key,a=Ze(e);return a!=="boolean"?[new ve(i,e,`boolean expected, ${a} found`)]:[]},number:la,color:Wa,constants:Gc,enum:In,filter:ca,function:Ys,layer:Xc,object:Si,source:bl,light:Ha,sky:Yc,terrain:wl,projection:function(r){const e=r.value,i=r.styleSpec,a=i.projection,s=r.style,l=Ze(e);if(e===void 0)return[];if(l!=="object")return[new ve("projection",e,`object expected, ${l}
16 found`)];let u=[];for(const d in e)u=u.concat(a[d]?r.validateSpec({key:d,value:e[d],valueSpec:a[d],style:s,styleSpec:i}):[new ve(d,e[d],`unknown property "${d}"`)]);return u},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const a=Ze(i);return a!=="array"||(function(s){return Array.isArray(s)&&s.length===3&&typeof s[0]=="string"&&typeof s[1]=="string"&&typeof s[2]=="number"})(i)||(function(s){return!!["interpolate","step","literal"].includes(s[0])})(i)?["array","string"].includes(a)?[]:[new ve(e,i,`projection expected, invalid type "${a}" found`)]:[new ve(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Nr,formatted:function(r){return Nr(r).length===0?[]:Vr(r)},resolvedImage:function(r){return Nr(r).length===0?[]:Vr(r)},padding:function(r){const e=r.key,i=r.value;if(Ze(i)==="array"){if(i.length<1||i.length>4)return[new ve(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const a={type:"number"};let s=[];for(let l=0;l<i.length;l++)s=s.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:a}));return s}return la({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(Ze(i)==="array"){const a={type:"number"};if(i.length<1)return[new ve(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let l=0;l<i.length;l++)s=s.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:a}));return s}return la({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(Ze(i)==="array"){if(i.length<1)return[new ve(e,i,"array length at least 1 expected, length 0 found")];let a=[];for(let s=0;s<i.length;s++)a=a.concat(Wa({key:`${e}[${s}]`,value:i[s]}));return a}return Wa({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,a=Ze(i),s=r.styleSpec;if(a!=="array"||i.length<1||i.length%2!=0)return[new ve(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let l=[];for(let u=0;u<i.length;u+=2)l=l.concat(In({key:`${e}[${u}]`,value:i[u],valueSpec:s.layout_symbol["text-anchor"]})),l=l.concat(Xs({key:`${e}[${u+1}]`,value:i[u+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:s}));return l},sprite:Tl,state:Xa,fontFaces:function(r){const e=r.key,i=r.value,a=r.validateSpec,s=r.styleSpec,l=r.style;if(!Kc(i))return[new ve(e,i,`object expected, ${Ze(i)} found`)];const u=[];for(const d in i){const _=i[d],m=Ze(_);if(m==="string")u.push(...Nr({key:`${e}.${d}`,value:_}));else if(m==="array"){const v={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[g,T]of _.entries())u.push(...Si({key:`${e}.${d}[${g}]`,value:T,valueSpec:v,styleSpec:s,style:l,validateSpec:a}))}else u.push(new ve(`${e}.${d}`,_,`string or array expected, ${m} found`))}return u}};function Ya(r){const e=r.value,i=r.valueSpec,a=r.styleSpec;return r.validateSpec=Ya,i.expression&&$s(Et(e))?Ys(r):i.expression&&Gs(Pn(e))?Vr(r):i.type&&Sl[i.type]?Sl[i.type](r):Si(un({},r,{valueSpec:i.type?a[i.type]:i}))}function ua(r){const e=r.value,i=r.key,a=Nr(r);return a.length||(e.indexOf("{fontstack}")===-1&&a.push(new ve(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new ve(i,e,'"glyphs" url must include a "{range}" token'))),a}function $i(r,e=ue){let i=[];return i=i.concat(Ya({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Ya,objectElementValidators:{glyphs:ua,"*":()=>[]}})),r.constants&&(i=i.concat(Gc({key:"constants",value:r.constants}))),Jc(i)}function tr(r){return function(e){return r(Object.assign({},e,{validateSpec:Ya}))}}function Jc(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function ir(r){return function(...e){return Jc(r.apply(this,e))}}$i.source=ir(tr(bl)),$i.sprite=ir(tr(Tl)),$i.glyphs=ir(tr(ua)),$i.light=ir(tr(Ha)),$i.sky=ir(tr(Yc)),$i.terrain=ir(tr(wl)),$i.state=ir(tr(Xa)),$i.layer=ir(tr(Xc)),$i.filter=ir(tr(ca)),$i.paintProperty=ir(tr(Wc)),$i.layoutProperty=ir(tr(Hc));const ah={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class sh{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const i=$a(e,ah,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((a=>`${a.key}: ${a.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=sa(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const Ka=ue,or=$i,Ri=or.light,Ja=or.sky,Qc=or.paintProperty,oh=or.layoutProperty;function eu(r,e){let i=!1;if(e?.length)for(const a of e)r.fire(new Un(new Error(a.message))),i=!0;return i}class _r{constructor(e,i,a){const s=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const u=new Int32Array(this.arrayBuffer);e=u[0],this.d=(i=u[1])+2*(a=u[2]);for(let _=0;_<this.d*this.d;_++){const m=u[3+_],v=u[3+_+1];s.push(m===v?null:u.subarray(m,v))}const d=u[3+s.length+1];this.keys=u.subarray(u[3+s.length],d),this.bboxes=u.subarray(d),this.insert=this._insertReadonly}else{this.d=i+2*a;for(let u=0;u<this.d*this.d;u++)s.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=a,this.scale=i/e,this.uid=0;const l=a/i*e;this.min=-l,this.max=e+l}
vendor: 15,188 bytes, line 16
16insert(e,i,a,s,l){this._forEachCell(i,a,s,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(a),this.bboxes.push(s),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,a,s,l,u){this.cells[l].push(u)}query(e,i,a,s,l){const u=this.min,d=this.max;if(e<=u&&i<=u&&d<=a&&d<=s&&!l)return[...this.keys];{const _=[];return this._forEachCell(e,i,a,s,this._queryCell,_,{},l),_}}_queryCell(e,i,a,s,l,u,d,_){const m=this.cells[l];if(m!==null){const v=this.keys,g=this.bboxes;for(const T of m)if(d[T]===void 0){const b=4*T;(_?_(g[b+0],g[b+1],g[b+2],g[b+3]):e<=g[b+2]&&i<=g[b+3]&&a>=g[b+0]&&s>=g[b+1])?(d[T]=!0,u.push(v[T])):d[T]=!1}}}_forEachCell(e,i,a,s,l,u,d,_){const m=this._convertToCellCoord(e),v=this._convertToCellCoord(i),g=this._convertToCellCoord(a),T=this._convertToCellCoord(s);for(let b=m;b<=g;b++)for(let I=v;I<=T;I++){const M=this.d*I+b;if((!_||_(this._convertFromCellCoord(b),this._convertFromCellCoord(I),this._convertFromCellCoord(b+1),this._convertFromCellCoord(I+1)))&&l.call(this,e,i,a,s,M,u,d,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,i=3+this.cells.length+1+1;let a=0;for(const u of this.cells)a+=u.length;const s=new Int32Array(i+a+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;let l=i;for(let u=0;u<e.length;u++){const d=e[u];s[3+u]=l,s.set(d,l),l+=d.length}return s[3+e.length]=l,s.set(this.keys,l),l+=this.keys.length,s[3+e.length+1]=l,s.set(this.bboxes,l),l+=this.bboxes.length,s.buffer}static serialize(e,i){const a=e.toArrayBuffer();return i&&i.push(a),{buffer:a}}static deserialize(e){return new _r(e.buffer)}}const lr={};function Ie(r,e,i={}){if(lr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),lr[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Ie("Object",Object),Ie("Set",Set),Ie("TransferableGridIndex",_r),Ie("Color",$e),Ie("Error",Error),Ie("AJAXError",Vn),Ie("ResolvedImage",zi),Ie("StylePropertyFunction",Ws),Ie("StyleExpression",Ua,{omit:["_evaluator"]}),Ie("ZoomDependentExpression",qs),Ie("ZoomConstantExpression",Zs),Ie("CompoundExpression",Ui,{omit:["_evaluate"]});for(const r in ra)ra[r]._classRegistryKey||Ie(`Expression_${r}`,ra[r]);function tu(r){var e;return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||((e=r.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function Qa(r){return r.$name||r.constructor._classRegistryKey}function iu(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=Qa(e);return i&&i!=="Object"})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||tu(r)||an(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function gr(r,e){if(iu(r))return(tu(r)||an(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const l=[];for(const u of r)l.push(gr(u,e));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=Qa(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!lr[i])throw new Error(`${i} is not registered.`);const{klass:a}=lr[i],s=a.serialize?a.serialize(r,e):{};if(a.serialize){if(s===e?.[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const l in r){if(!r.hasOwnProperty(l)||lr[i].omit.includes(l))continue;const u=r[l];s[l]=lr[i].shallow.includes(l)?u:gr(u,e)}r instanceof Error&&(s.message=r.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(s.$name=i),s}function es(r){if(iu(r))return r;if(Array.isArray(r))return r.map(es);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=Qa(r)||"Object";if(!lr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=lr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const a=Object.create(i.prototype);for(const s of Object.keys(r)){if(s==="$name")continue;const l=r[s];a[s]=lr[e].shallow.includes(s)?l:es(l)}return a}class Pl{constructor(){this.first=!0}update(e,i){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=a,!0))}}function lh(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Mn(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function ru(r){return/\s/u.test(String.fromCodePoint(r))}function Il(r){for(const e of r)if(Mn(e.codePointAt(0)))return!0;return!1}function Ks(r){for(const e of r)if(!Js(e.codePointAt(0)))return!1;return!0}function nu(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const Ml=nu(["Arab","Dupl","Mong","Ougr","Syrc"]);function Js(r){return!Ml.test(String.fromCodePoint(r))}function El(r){return!(Mn(r)||(e=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const au=nu(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Cl(r){return au.test(String.fromCodePoint(r))}function su(r,e){return!(!e&&Cl(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Al(r){for(const e of r)if(Cl(e.codePointAt(0)))return!0;return!1}const yr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(yr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return p(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,a=new Promise((l=>{this.loadScriptResolve=l}));e(i);const s=new Promise((l=>setTimeout((()=>l()),this.TIMEOUT)));if(yield Promise.race([a,s]),this.isParsed()){const l={pluginStatus:"loaded",pluginURL:i};return this.setState(l),l}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class ht{constructor(e,i){this.isSupportedScript=ou,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new Pl,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Pl,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*i}}}function ou(r){return(function(e,i){for(const a of e)if(!su(a.codePointAt(0),i))return!1;return!0})(r,yr.getRTLTextPluginStatus()==="loaded")}const Qs="-transition";class ts{constructor(e,i,a){this.property=e,this.value=i,this.expression=(function(s,l,u){if($s(s))return new Ws(s,l);if(Gs(s)){const d=Uc(s,l,u);if(d.result==="error")throw new Error(d.value.map((_=>`${_.key}: ${_.message}`)).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=$e.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type!=="numberArray"||typeof s!="number"&&!Array.isArray(s)?l.type!=="colorArray"||typeof s!="string"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)?d=ui.parse(s):l.type==="projectionDefinition"&&typeof s=="string"&&(d=hi.parse(s)):d=Be.parse(s):d=_t.parse(s):d=ti.parse(s),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>d}}})(i===void 0?e.specification.default:i,e.specification,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,a){return this.property.possiblyEvaluate(this,e,i,a)}}class zl{constructor(e,i){this.property=e,this.value=new ts(e,void 0,i)}transitioned(e,i){return new kl(this.property,this.value,i,Vi({},e.transition,this.transition),e.now)}untransitioned(){return new kl(this.property,this.value,null,{},0)}}class Dl{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return Fe(this._values[e].value.value)}setValue(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new zl(this._values[e].property,this._globalState)),this._values[e].value=new ts(this._values[e].property,i===null?void 0:Fe(i),this._globalState)}getTransition(e){return Fe(this._values[e].transition)}setTransition(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new zl(this._values[e].property,this._globalState)),this._values[e].transition=Fe(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const a=this.getValue(i);a!==void 0&&(e[i]=a);const s=this.getTransition(i);s!==void 0&&(e[`${i}${Qs}`]=s)}return e}transitioned(e,i){const a=new lu(this._properties);for(const s of Object.keys(this._values))a._values[s]=this._values[s].transitioned(e,i._values[s]);return a}untransitioned(){const e=new lu(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class kl{constructor(e,i,a,s,l){this.property=e,this.value=i,this.begin=l+s.delay||0,this.end=this.begin+s.duration||0,e.specification.transition&&(s.delay||s.duration)&&(this.prior=a)}possiblyEvaluate(e,i,a){const s=e.now||0,l=this.value.possiblyEvaluate(e,i,a),u=this.prior;if(u){if(s>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(s<this.begin)return u.possiblyEvaluate(e,i,a);{const d=(s-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,a),l,zr(d))}}return l}}class lu{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,a){const s=new is(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].possiblyEvaluate(e,i,a);return s}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ch{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return Fe(this._values[e].value)}setValue(e,i){this._values[e]=new ts(this._values[e].property,i===null?void 0:Fe(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const a=this.getValue(i);a!==void 0&&(e[i]=a)}return e}possiblyEvaluate(e,i,a){const s=new is(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].possiblyEvaluate(e,i,a);return s}}class rr{constructor(e,i,a){this.property=e,this.value=i,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,a,s){return this.property.evaluate(this.value,this.parameters,e,i,a,s)}}class is{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ee{constructor(e){this.specification=e}
16possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,a){const s=Di[this.specification.type];return s?s(e,i,a):e}}class ze{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,a,s){return new rr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},a,s)}:e.expression,i)}interpolate(e,i,a){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new rr(this,{kind:"constant",value:void 0},e.parameters);const s=Di[this.specification.type];if(s){const l=s(e.value.value,i.value.value,a);return new rr(this,{kind:"constant",value:l},e.parameters)}return e}evaluate(e,i,a,s,l,u){return e.kind==="constant"?e.value:e.evaluate(i,a,s,l,u)}}class Ur extends ze{possiblyEvaluate(e,i,a,s){if(e.value===void 0)return new rr(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},a,s),u=e.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,d=this._calculate(u,u,u,i);return new rr(this,{kind:"constant",value:d},i)}if(e.expression.kind==="camera"){const l=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new rr(this,{kind:"constant",value:l},i)}return new rr(this,e.expression,i)}evaluate(e,i,a,s,l,u){if(e.kind==="source"){const d=e.evaluate(i,a,s,l,u);return this._calculate(d,d,d,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},a,s),e.evaluate({zoom:Math.floor(i.zoom)},a,s),e.evaluate({zoom:Math.floor(i.zoom)+1},a,s),i):e.value}_calculate(e,i,a,s){return s.zoom>s.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:a,to:i}}interpolate(e){return e}}class cu{constructor(e){this.specification=e}possiblyEvaluate(e,i,a,s){if(e.value!==void 0){if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},a,s);return this._calculate(l,l,l,i)}return this._calculate(e.expression.evaluate(new ht(Math.floor(i.zoom-1),i)),e.expression.evaluate(new ht(Math.floor(i.zoom),i)),e.expression.evaluate(new ht(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,a,s){return s.zoom>s.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:a,to:i}}interpolate(e){return e}}class ha{constructor(e){this.specification=e}possiblyEvaluate(e,i,a,s){return!!e.expression.evaluate(i,null,{},a,s)}interpolate(){return!1}}class di{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const a=e[i];a.specification.overridable&&this.overridableProperties.push(i);const s=this.defaultPropertyValues[i]=new ts(a,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new zl(a,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=s.possiblyEvaluate({})}}}Ie("DataDrivenProperty",ze),Ie("DataConstantProperty",Ee),Ie("CrossFadedDataDrivenProperty",Ur),Ie("CrossFadedProperty",cu),Ie("ColorRampProperty",ha);const uu=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",eo=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Gi extends vs{constructor(e,i,a){if(super(),this.id=e.id,this.type=e.type,this._globalState=a,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(s,l){return new sh(s,l)})(this.visibility,a),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ga(e.filter,a)),i.layout&&(this._unevaluatedLayout=new ch(i.layout,a)),i.paint)){this._transitionablePaint=new Dl(i.paint,a);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new is(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ga(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var i;if(e==="visibility")return this.visibility;if(!((i=this._transitionablePaint)===null||i===void 0)&&i.hasProperty(e))throw new Error(e+uu);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const a=this._unevaluatedLayout._values[i];for(const s of a.getGlobalStateRefs())e.add(s)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const a in this._transitionablePaint._values){const s=this._transitionablePaint._values[a].value;for(const l of s.getGlobalStateRefs()){const u=(e=i.get(l))!==null&&e!==void 0?e:[];u.push({name:a,value:s.value}),i.set(l,u)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,a={}){var s;if(e==="visibility")return this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility();!((s=this._transitionablePaint)===null||s===void 0)&&s.hasProperty(e)?this.fire(new Un(new Error(e+uu))):i!=null&&this._val
16idate(oh,`layers.${this.id}.layout.${e}`,e,i,a)||this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){var i,a;if(e.endsWith(Qs)){const s=e.slice(0,-11);if(s==="visibility"||!((i=this._unevaluatedLayout)===null||i===void 0)&&i.hasProperty(s))throw new Error(e+eo);return this._transitionablePaint.getTransition(s)}if(e==="visibility"||!((a=this._unevaluatedLayout)===null||a===void 0)&&a.hasProperty(e))throw new Error(e+eo);return this._transitionablePaint.getValue(e)}setPaintProperty(e,i,a={}){var s;if(e==="visibility"||!((s=this._unevaluatedLayout)===null||s===void 0)&&s.hasProperty(e))return this.fire(new Un(new Error(e+eo))),!1;if(i!=null&&this._validate(Qc,`layers.${this.id}.paint.${e}`,e,i,a))return!1;if(e.endsWith(Qs))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),_=l.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const m=this._transitionablePaint._values[e].value;return m.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,_,m)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,a){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){var e,i;
vendor: 13,206 bytes, line 16
16const a={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:(e=this._unevaluatedLayout)===null||e===void 0?void 0:e.serialize(),paint:(i=this._transitionablePaint)===null||i===void 0?void 0:i.serialize()};return this.visibility&&(a.layout||(a.layout={}),a.layout.visibility=this.visibility),nn(a,((s,l)=>!(s===void 0||l==="layout"&&!Object.keys(s).length||l==="paint"&&!Object.keys(s).length)))}_validate(e,i,a,s,l={}){return l?.validate!==!1&&eu(this,e.call(or,{key:i,layerType:this.type,objectKey:a,value:s,styleSpec:ue,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof rr&&aa(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let Rl;var uh={get paint(){return Rl=Rl||new di({"raster-opacity":new Ee(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ee(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ee(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ee(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new Ee(ue.paint_raster["raster-saturation"]),"raster-contrast":new Ee(ue.paint_raster["raster-contrast"]),resampling:new Ee(ue.paint_raster.resampling),"raster-resampling":new Ee(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new Ee(ue.paint_raster["raster-fade-duration"])})}};class hh extends Gi{constructor(e,i){super(e,uh,i)}}const dh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class rs{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class gt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function dt(r,e=1){let i=0,a=0;return{members:r.map((s=>{const l=dh[s.type].BYTES_PER_ELEMENT,u=i=hu(i,Math.max(e,l)),d=s.components||1;return a=Math.max(a,l),i+=l*d,{name:s.name,type:s.type,components:d,offset:u}})),size:hu(i,Math.max(a,e)),alignment:e}}function hu(r,e){return Math.ceil(r/e)*e}class ns extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const a=this.length;return this.resize(a+1),this.emplace(a,e,i)}emplace(e,i,a){const s=2*e;return this.int16[s+0]=i,this.int16[s+1]=a,e}}ns.prototype.bytesPerElement=4,Ie("StructArrayLayout2i4",ns);class to extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,a)}emplace(e,i,a,s){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=a,this.int16[l+2]=s,e}}to.prototype.bytesPerElement=6,Ie("StructArrayLayout3i6",to);class io extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,a,s)}emplace(e,i,a,s,l){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=a,this.int16[u+2]=s,this.int16[u+3]=l,e}}io.prototype.bytesPerElement=8,Ie("StructArrayLayout4i8",io);class ro extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,a,s,l,u)}emplace(e,i,a,s,l,u,d){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=a,this.int16[_+2]=s,this.int16[_+3]=l,this.int16[_+4]=u,this.int16[_+5]=d,e}}ro.prototype.bytesPerElement=12,Ie("StructArrayLayout2i4i12",ro);class Ll extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,a,s,l,u)}emplace(e,i,a,s,l,u,d){const _=4*e,m=8*e;return this.int16[_+0]=i,this.int16[_+1]=a,this.uint8[m+4]=s,this.uint8[m+5]=l,this.uint8[m+6]=u,this.uint8[m+7]=d,e}}Ll.prototype.bytesPerElement=8,Ie("StructArrayLayout2i4ub8",Ll);class as extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const a=this.length;return this.resize(a+1),this.emplace(a,e,i)}emplace(e,i,a){const s=2*e;return this.float32[s+0]=i,this.float32[s+1]=a,e}}as.prototype.bytesPerElement=8,Ie("StructArrayLayout2f8",as);class vr extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u,d,_,m,v){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,a,s,l,u,d,_,m,v)}emplace(e,i,a,s,l,u,d,_,m,v,g){const T=10*e;return this.uint16[T+0]=i,this.uint16[T+1]=a,this.uint16[T+2]=s,this.uint16[T+3]=l,this.uint16[T+4]=u,this.uint16[T+5]=d,this.uint16[T+6]=_,this.uint16[T+7]=m,this.uint16[T+8]=v,this.uint16[T+9]=g,e}}vr.prototype.bytesPerElement=20,Ie("StructArrayLayout10ui20",vr);class no extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u,d,_){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,a,s,l,u,d,_)}emplace(e,i,a,s,l,u,d,_,m){const v=8*e;return this.uint16[v+0]=i,this.uint16[v+1]=a,this.uint16[v+2]=s,this.uint16[v+3]=l,this.uint16[v+4]=u,this.uint16[v+5]=d,this.uint16[v+6]=_,this.uint16[v+7]=m,e}}no.prototype.bytesPerElement=16,Ie("StructArrayLayout8ui16",no);class ss extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u,d,_,m,v,g,T){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,a,s,l,u,d,_,m,v,g,T)}emplace(e,i,a,s,l,u,d,_,m,v,g,T,b){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=a,this.int16[I+2]=s,this.int16[I+3]=l,this.uint16[I+4]=u,this.uint16[I+5]=d,this.uint16[I+6]=_,this.uint16[I+7]=m,this.int16[I+8]=v,this.int16[I+9]=g,this.int16[I+10]=T,this.int16[I+11]=b,e}}ss.prototype.bytesPerElement=24,Ie("StructArrayLayout4i4ui4i24",ss);class ao extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,a)}emplace(e,i,a,s){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=a,this.float32[l+2]=s,e}}ao.prototype.bytesPerElement=12,Ie("StructArrayLayout3f12",ao);class os extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}os.prototype.bytesPerElement=4,Ie("StructArrayLayout1ul4",os);class Fl extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u,d,_,m){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,a,s,l,u,d,_,m)}emplace(e,i,a,s,l,u,d,_,m,v){const g=10*e,T=5*e;return this.int16[g+0]=i,this.int16[g+1]=a,this.int16[g+2]=s,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=d,this.uint32[T+3]=_,this.uint16[g+8]=m,this.uint16[g+9]=v,e}}Fl.prototype.bytesPerElement=20,Ie("StructArrayLayout6i1ul2ui20",Fl);class da extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,a,s,l,u)}emplace(e,i,a,s,l,u,d){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=a,this.int16[_+2]=s,this.int16[_+3]=l,this.int16[_+4]=u,this.int16[_+5]=d,e}}da.prototype.bytesPerElement=12,Ie("StructArrayLayout2i2i2i12",da);class En extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,a,s,l)}emplace(e,i,a,s,l,u){const d=4*e,_=8*e;return this.float32[d+0]=i,this.float32[d+1]=a,this.float32[d+2]=s,this.int16[_+6]=l,this.int16[_+7]=u,e}}En.prototype.bytesPerElement=16,Ie("StructArrayLayout2f1f2i16",En);class Bl extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,a,s,l,u)}emplace(e,i,a,s,l,u,d){const _=16*e,m=4*e,v=8*e;return this.uint8[_+0]=i,this.uint8[_+1]=a,this.float32[m+1]=s,this.float32[m+2]=l,this.int16[v+6]=u,this.int16[v+7]=d,e}}Bl.prototype.bytesPerElement=16,Ie("StructArrayLayout2ub2f2i16",Bl);class ls extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,a)}emplace(e,i,a,s){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=a,this.uint16[l+2]=s,e}}ls.prototype.bytesPerElement=6,Ie("StructArrayLayout3ui6",ls);class Cn extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z){const L=this.length;return this.resize(L+1),this.emplace(L,e,i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z)}emplace(e,i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z,L){const k=24*e,F=12*e,O=48*e;return this.int16[k+0]=i,this.int16[k+1]=a,this.uint16[k+2]=s,this.uint16[k+3]=l,this.uint32[F+2]=u,this.uint32[F+3]=d,this.uint32[F+4]=_,this.uint16[k+10]=m,this.uint16[k+11]=v,this.uint16[k+12]=g,this.float32[F+7]=T,this.float32[F+8]=b,this.uint8[O+36]=I,this.uint8[O+37]=M,this.uint8[O+38]=A,this.uint32[F+10]=z,this.int16[k+22]=L,e}}Cn.prototype.bytesPerElement=48,Ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Cn);class Ol extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z,L,k,F,O,V,Y,J,re,te,le,ce){const ne=this.length;return this.resize(ne+1),this.emplace(ne,e,i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z,L,k,F,O,V,Y,J,re,te,le,ce)}emplace(e,i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z,L,k,F,O,V,Y,J,re,te,le,ce,ne){const ie=32*e,_e=16*e;return this.int16[ie+0]=i,this.int16[ie+1]=a,this.int16[ie+2]=s,this.int16[ie+3]=l,this.int16[ie+4]=u,this.int16[ie+5]=d,this.int16[ie+6]=_,this.int16[ie+7]=m,this.uint16[ie+8]=v,this.uint16[ie+9]=g,this.uint16[ie+10]=T,this.uint16[ie+11]=b,this.uint16[ie+12]=I,this.uint16[ie+13]=M,this.uint16[ie+14]=A,this.uint16[ie+15]=z,this.uint16[ie+16]=L,this.uint16[ie+17]=k,this.uint16[ie+18]=F,this.uint16[ie+19]=O,this.uint16[ie+20]=V,this.uint16[ie+21]=Y,this.uint16[ie+22]=J,this.uint32[_e+12]=re,this.float32[_e+13]=te,this.float32[_e+14]=le,this.uint16[ie+30]=ce,this.uint16[ie+31]=ne,e}}Ol.prototype.bytesPerElement=64,Ie("StructArrayLayout8i15ui1ul2f2ui64",Ol);class so extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}so.prototype.bytesPerElement=4,Ie("StructArrayLayout1f4",so);class oo extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,a)}emplace(e,i,a,s){const l=3*e;return this.uint16[6*e+0]=i,this.float32[l+1]=a,this.float32[l+2]=s,e}}oo.prototype.bytesPerElement=12,Ie("StructArrayLayout1ui2f12",oo);
vendor: 4,321 bytes, line 16
16class jl extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,a)}emplace(e,i,a,s){const l=4*e;return this.uint32[2*e+0]=i,this.uint16[l+2]=a,this.uint16[l+3]=s,e}}jl.prototype.bytesPerElement=8,Ie("StructArrayLayout1ul2ui8",jl);class h extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const a=this.length;return this.resize(a+1),this.emplace(a,e,i)}emplace(e,i,a){const s=2*e;return this.uint16[s+0]=i,this.uint16[s+1]=a,e}}h.prototype.bytesPerElement=4,Ie("StructArrayLayout2ui4",h);class t extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}t.prototype.bytesPerElement=2,Ie("StructArrayLayout1ui2",t);class n extends gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,a,s)}emplace(e,i,a,s,l){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=a,this.float32[u+2]=s,this.float32[u+3]=l,e}}n.prototype.bytesPerElement=16,Ie("StructArrayLayout4f16",n);class o extends rs{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Pe(this.anchorPointX,this.anchorPointY)}}o.prototype.size=20;class c extends Fl{get(e){return new o(this,e)}}Ie("CollisionBoxArray",c);class f extends rs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}f.prototype.size=48;class y extends Cn{get(e){return new f(this,e)}}Ie("PlacedSymbolArray",y);class x extends rs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}
vendor: 27,679 bytes, line 16
16get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}x.prototype.size=64;class w extends Ol{get(e){return new x(this,e)}}Ie("SymbolInstanceArray",w);class S extends so{getoffsetX(e){return this.float32[1*e+0]}}Ie("GlyphOffsetArray",S);class P extends to{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ie("SymbolLineVertexArray",P);class E extends rs{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}E.prototype.size=12;class C extends oo{get(e){return new E(this,e)}}Ie("TextAnchorOffsetArray",C);class D extends rs{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]}}D.prototype.size=8;class B extends jl{get(e){return new D(this,e)}}Ie("FeatureIndexArray",B);class j extends ns{}class $ extends ns{}class N extends ns{}class G extends ro{}class X extends Ll{}class Z extends as{}class U extends vr{}class H extends no{}class q extends ss{}class Q extends ao{}class ae extends os{}class oe extends da{}class fe extends Bl{}class de extends ls{}class Me extends h{}const be=dt([{name:"a_pos",components:2,type:"Int16"}],4),{members:he}=be;class Se{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,a,s){const l=this.segments[this.segments.length-1];return e>Se.MAX_VERTEX_ARRAY_LENGTH&&Ht(`Max vertices per segment is ${Se.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Se.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+e>Se.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==s?this.createNewSegment(i,a,s):l}createNewSegment(e,i,a){const s={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(s.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(s),s}getOrCreateLatestSegment(e,i,a){return this.prepareSegment(0,e,i,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,a,s){return new Se([{vertexOffset:e,primitiveOffset:i,vertexLength:a,primitiveLength:s,vaos:{},sortKey:0}])}}function Ae(r,e){return 256*(r=ci(Math.floor(r),0,255))+ci(Math.floor(e),0,255)}Se.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ie("SegmentVector",Se);const rt=dt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),Ct=dt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var ot,zt,kt,ii={exports:{}},St={exports:{}},pi={exports:{}},Jt=(function(){if(kt)return ii.exports;kt=1;var r=(ot||(ot=1,St.exports=function(i,a){var s,l,u,d,_,m,v,g;for(l=i.length-(s=3&i.length),u=a,_=3432918353,m=461845907,g=0;g<l;)v=255&i.charCodeAt(g)|(255&i.charCodeAt(++g))<<8|(255&i.charCodeAt(++g))<<16|(255&i.charCodeAt(++g))<<24,++g,u=27492+(65535&(d=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(v=0,s){case 3:v^=(255&i.charCodeAt(g+2))<<16;case 2:v^=(255&i.charCodeAt(g+1))<<8;case 1:u^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(g)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),St.exports),e=(zt||(zt=1,pi.exports=function(i,a){for(var s,l=i.length,u=a^l,d=0;l>=4;)s=1540483477*(65535&(s=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<24))+((1540483477*(s>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),l-=4,++d;switch(l){case 3:u^=(255&i.charCodeAt(d+2))<<16;case 2:u^=(255&i.charCodeAt(d+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(d)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),pi.exports);return ii.exports=r,ii.exports.murmur3=r,ii.exports.murmur2=e,ii.exports})(),Nt=Cr(Jt);class ri{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,a,s){this.ids.push($r(e)),this.positions.push(i,a,s)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=$r(e);let a=0,s=this.ids.length-1;for(;a<s;){const u=a+s>>1;this.ids[u]>=i?s=u:a=u+1}const l=[];for(;this.ids[a]===i;)l.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return l}static serialize(e,i){const a=new Float64Array(e.ids),s=new Uint32Array(e.positions);return Gr(a,s,0,a.length-1),i&&i.push(a.buffer,s.buffer),{ids:a,positions:s}}static deserialize(e){const i=new ri;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function $r(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Nt(String(r))}function Gr(r,e,i,a){for(;i<a;){const s=r[i+a>>1];let l=i-1,u=a+1;for(;;){do l++;while(r[l]<s);do u--;while(r[u]>s);if(l>=u)break;Zr(r,l,u),Zr(e,3*l,3*u),Zr(e,3*l+1,3*u+1),Zr(e,3*l+2,3*u+2)}u-i<a-u?(Gr(r,e,i,u),i=u+1):(Gr(r,e,u+1,a),a=u)}}function Zr(r,e,i){const a=r[e];r[e]=r[i],r[i]=a}Ie("FeaturePositionMap",ri);class ni{constructor(e,i){this.gl=e.gl,this.location=i}}class xr extends ni{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class qr extends ni{constructor(e,i){super(e,i),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class lo extends ni{constructor(e,i){super(e,i),this.current=$e.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const cr=new Float32Array(16);function ur(r){return[Ae(255*r.r,255*r.g),Ae(255*r.b,255*r.a)]}class Li{constructor(e,i,a){this.value=e,this.uniformNames=i.map((s=>`u_${s}`)),this.type=a}setUniform(e,i,a){e.set(a.constantOr(this.value))}getBinding(e,i,a){return this.type==="color"?new lo(e,i):new xr(e,i)}}class Zi{constructor(e,i){this.uniformNames=i.map((a=>`u_${a}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,a,s){let l=null;s==="u_pattern_to"?l=this.patternTo:s==="u_pattern_from"?l=this.patternFrom:s==="u_dasharray_to"?l=this.dashTo:s==="u_dasharray_from"?l=this.dashFrom:s==="u_pixel_ratio_to"?l=this.pixelRatioTo:s==="u_pixel_ratio_from"&&(l=this.pixelRatioFrom),l!==null&&e.set(l)}getBinding(e,i,a){return a.startsWith("u_pattern")||a.startsWith("u_dasharray_")?new qr(e,i):new xr(e,i)}}class yt{constructor(e,i,a,s){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=i.map((l=>({name:`a_${l}`,type:"Float32",components:a==="color"?2:1,offset:0}))),this.paintVertexArray=new s}populatePaintArray(e,i,a){const s=this.paintVertexArray.length,l=this.expression.evaluate(new ht(0,a),i,{},a.canonical,[],a.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(s,e,l)}updatePaintArray(e,i,a,s,l){const u=this.expression.evaluate(new ht(0,l),a,s);this._setPaintValue(e,i,u)}_setPaintValue(e,i,a){if(this.type==="color"){const s=ur(a);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,s[0],s[1])}else{for(let s=e;s<i;s++)this.paintVertexArray.emplace(s,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(e){var i,a;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((a=this.paintVertexBuffer)===null||a===void 0)&&a.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class pt{constructor(e,i,a,s,l,u){this.expression=e,this.uniformNames=i.map((d=>`u_${d}_t`)),this.type=a,this.useIntegerZoom=s,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map((d=>({name:`a_${d}`,type:"Float32",components:a==="color"?4:2,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,i,a){const s=this.expression.evaluate(new ht(this.zoom,a),i,{},a.canonical,[],a.formattedSection),l=this.expression.evaluate(new ht(this.zoom+1,a),i,{},a.canonical,[],a.formattedSection),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,s,l)}updatePaintArray(e,i,a,s,l){const u=this.expression.evaluate(new ht(this.zoom,l),a,s),d=this.expression.evaluate(new ht(this.zoom+1,l),a,s);this._setPaintValue(e,i,u,d)}_setPaintValue(e,i,a,s){if(this.type==="color"){const l=ur(a),u=ur(s);for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,l[0],l[1],u[0],u[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,a,s);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(s))}}upload(e){var i,a;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((a=this.paintVertexBuffer)===null||a===void 0)&&a.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i){const a=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,s=ci(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);e.set(s)}getBinding(e,i,a){return new xr(e,i)}}class Rt{constructor(e,i,a,s,l,u){this.expression=e,this.type=i,this.useIntegerZoom=a,this.zoom=s,this.layerId=u,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(e,i,a){const s=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(s,e,this.getPositionIds(i),a)}updatePaintArray(e,i,a,s,l){this._setPaintValues(e,i,this.getPositionIds(a),l)}_setPaintValues(e,i,a,s){const l=this.getPositions(s);if(!l||!a)return;const u=l[a.min],d=l[a.mid],_=l[a.max];if(u&&d&&_)for(let m=e;m<i;m++)this.emplace(this.zoomInPaintVertexArray,m,d,u),this.emplace(this.zoomOutPaintVertexArray,m,d,_)}upload(e){var i,a;if(!((i=this.zoomInPaintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((a=this.zoomOutPaintVertexArray)===null||a===void 0)&&a.arrayBuffer.byteLength)){const s=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,s,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,s,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class vt extends Rt{getPositions(e){return e.imagePositions}getPositionIds(e){var i;return(i=e.patterns)===null||i===void 0?void 0:i[this.layerId]}getVertexAttributes(){return rt.members}emplace(e,i,a,s){e.emplace(i,a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],a.pixelRatio,s.pixelRatio)}}class An extends Rt{getPositions(e){return e.dashPositions}getPositionIds(e){var i;return(i=e.dashes)===null||i===void 0?void 0:i[this.layerId]}getVertexAttributes(){return Ct.members}emplace(e,i,a,s){e.emplace(i,0,a.y,a.height,a.width,0,s.y,s.height,s.width)}}class co{constructor(e,i,a){this.binders={},this._buffers=[];const s=[];for(const l in e.paint._values){if(!a(l))continue;const u=e.paint.get(l);if(!(u instanceof rr&&aa(u.property.specification)))continue;const d=Vl(l,e.type),_=u.value,m=u.property.specification.type,v=u.property.useIntegerZoom,g=u.property.specification["property-type"],T=g==="cross-faded"||g==="cross-faded-data-driven";if(_.kind==="constant")this.binders[l]=T?new Zi(_.value,d):new Li(_.value,d,m),s.push(`/u_${l}`);else if(_.kind==="source"||T){const b=du(l,m,"source");this.binders[l]=T?l==="line-dasharray"?new An(_,m,v,i,b,e.id):new vt(_,m,v,i,b,e.id):new yt(_,d,m,b),s.push(`/a_${l}`)}else{const b=du(l,m,"composite");this.binders[l]=new pt(_,d,m,v,i,b),s.push(`/z_${l}`)}}this.cacheKey=s.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof yt||i instanceof pt?i.maxValue:0}populatePaintArrays(e,i,a){for(const s in this.binders){const l=this.binders[s];(l instanceof yt||l instanceof pt||l instanceof Rt)&&l.populatePaintArray(e,i,a)}}setConstantPatternPositions(e,i){for(const a in this.binders){const s=this.binders[a];s instanceof Zi&&s.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const a in this.binders){const s=this.binders[a];s instanceof Zi&&s.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,a,s,l){let u=!1;for(const d in e){const _=i.getPositions(d);for(const m of _){const v=a.feature(m.index);for(const g in this.binders){const T=this.binders[g];if((T instanceof yt||T instanceof pt||T instanceof Rt)&&T.expression.isStateDependent===!0){const b=s.paint.get(g);T.expression=b.value,T.updatePaintArray(m.start,m.end,v,e[d],l),u=!0}}}}return u}defines(){const e=[];for(const i in this.binders){const a=this.binders[i];(a instanceof Li||a instanceof Zi)&&e.push(...a.uniformNames.map((s=>`#define HAS_UNIFORM_${s}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const a=this.binders[i];if(a instanceof yt||a instanceof pt)for(const s of a.paintVertexAttributes)e.push(s.name);else if(a instanceof Rt){const s=a.getVertexAttributes();for(const l of s)e.push(l.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const a=this.binders[i];if(a instanceof Li||a instanceof Zi||a instanceof pt)for(const s of a.uniformNames)e.push(s)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const a=[];for(const s in this.binders){const l=this.binders[s];if(l instanceof Li||l instanceof Zi||l instanceof pt){for(const u of l.uniformNames)if(i[u]){const d=l.getBinding(e,i[u],u);a.push({name:u,property:s,binding:d})}}}return a}setUniforms(e,i,a,s){for(const{name:l,property:u,binding:d}of i)this.binders[u].setUniform(d,s,a.get(u),l)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const a=this.binders[i];if(e&&a instanceof Rt){const s=e.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;s&&this._buffers.push(s)}else(a instanceof yt||a instanceof pt)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(e){for(const i in this.binders){const a=this.binders[i];(a instanceof yt||a instanceof pt||a instanceof Rt)&&a.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof yt||i instanceof pt||i instanceof Rt)&&i.destroy()}}}class br{constructor(e,i,a=()=>!0){this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new co(s,i,a);this.needsUpload=!1,this._featureMap=new ri,this._bufferOffset=0}populatePaintArrays(e,i,a,s){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(e,i,s);i.id!==void 0&&this._featureMap.add(i.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,a,s){for(const l of a)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,i,l,s)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Vl(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function du(r,e,i){const a={color:{source:as,composite:n},number:{source:so,composite:as}},s=(function(l){return{"line-pattern":{source:U,composite:U},"fill-pattern":{source:U,composite:U},"fill-extrusion-pattern":{source:U,composite:U},"line-dasharray":{source:H,composite:H}}[l]})(r);return s?.[i]||a[e][i]}Ie("ConstantBinder",Li),Ie("CrossFadedConstantBinder",Zi),Ie("SourceExpressionBinder",yt),Ie("CrossFadedPatternBinder",vt),Ie("CrossFadedDasharrayBinder",An),Ie("CompositeExpressionBinder",pt),Ie("ProgramConfiguration",co,{omit:["_buffers"]}),Ie("ProgramConfigurationSet",br);const Nl=Math.pow(2,14)-1,Wr=-Nl-1;function Hr(r){const e=Re/r.extent,i=r.loadGeometry();for(const a of i)for(const s of a){const l=Math.round(s.x*e),u=Math.round(s.y*e);s.x=ci(l,Wr,Nl),s.y=ci(u,Wr,Nl),(l<s.x||l>s.x+1||u<s.y||u>s.y+1)&&Ht("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function Xr(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Hr(r):[]}}const Ul=-32768;function $l(r,e,i,a,s){r.emplaceBack(Ul+8*e+a,Ul+8*i+s)}class uo{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new $,this.indexArray=new de,this.segments=new Se,this.programConfigurations=new br(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){const s=this.layers[0],l=[];let u=null,d=!1,_=s.type==="heatmap";if(s.type==="circle"){const v=s;u=v.layout.get("circle-sort-key"),d=!u.isConstant(),_||(_=v.paint.get("circle-pitch-alignment")==="map")}const m=_?i.subdivisionGranularity.circle:1;for(const{feature:v,id:g,index:T,sourceLayerIndex:b}of e){const I=this.layers[0]._featureFilter.needGeometry,M=Xr(v,I);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),M,a))continue;const A=d?u.evaluate(M,{},a):void 0,z={id:g,properties:v.properties,type:v.type,sourceLayerIndex:b,index:T,geometry:I?M.geometry:Hr(v),patterns:{},sortKey:A};l.push(z)}d&&l.sort(((v,g)=>v.sortKey-g.sortKey));for(const v of l){const{geometry:g,index:T,sourceLayerIndex:b}=v,I=e[T].feature;this.addFeature(v,g,T,a,m),i.featureIndex.insert(I,g,T,b,this.index)}}update(e,i,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,he),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,a,s,l=1){let u;switch(l){case 1:u=[0,7];break;case 3:u=[0,2,5,7];break;case 5:u=[0,1,3,4,6,7];break;case 7:u=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${l}; valid values are 1, 3, 5, 7.`)}const d=u.length;for(const _ of i)for(const m of _){const v=m.x,g=m.y;if(v<0||v>=Re||g<0||g>=Re)continue;const T=this.segments.prepareSegment(d*d,this.layoutVertexArray,this.indexArray,e.sortKey),b=T.vertexLength;for(let I=0;I<d;I++)for(let M=0;M<d;M++)$l(this.layoutVertexArray,v,g,u[M],u[I]);for(let I=0;I<d-1;I++)for(let M=0;M<d-1;M++){const A=b+I*d+M,z=b+(I+1)*d+M;this.indexArray.emplaceBack(A,z+1,A+1),this.indexArray.emplaceBack(A,z,z+1)}T.vertexLength+=d*d,T.primitiveLength+=(d-1)*(d-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:{},canonical:s})}}function ho(r,e){for(const i of r)if(po(e,i))return!0;for(const i of e)if(po(r,i))return!0;return ph(r,e)}function pu(r,e,i){return!!po(r,e)||fh(e,r,i)}function wd(r,e){if(r.length===1)return Sd(e,r[0]);for(const i of e)for(const a of i)if(po(r,a))return!0;for(const i of r)if(Sd(e,i))return!0;for(const i of e)if(ph(r,i))return!0;return!1}function Kf(r,e,i){if(r.length>1){if(ph(r,e))return!0;for(const a of e)if(fh(a,r,i))return!0}for(const a of r)if(fh(a,e,i))return!0;return!1}function ph(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const a=r[i],s=r[i+1];for(let l=0;l<e.length-1;l++)if(Jf(a,s,e[l],e[l+1]))return!0}return!1}function Jf(r,e,i,a){return Ci(r,i,a)!==Ci(e,i,a)&&Ci(r,e,i)!==Ci(r,e,a)}function fh(r,e,i){const a=i*i;if(e.length===1)return r.distSqr(e[0])<a;for(let s=1;s<e.length;s++)if(Td(r,e[s-1],e[s])<a)return!0;return!1}function Td(r,e,i){const a=e.distSqr(i);if(a===0)return r.distSqr(e);const s=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/a;return r.distSqr(s<0?e:s>1?i:i.sub(e)._mult(s)._add(e))}function Sd(r,e){let i,a,s,l=!1;for(const u of r){i=u;for(let d=0,_=i.length-1;d<i.length;_=d++)a=i[d],s=i[_],a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(l=!l)}return l}function po(r,e){let i=!1;for(let a=0,s=r.length-1;a<r.length;s=a++){const l=r[a],u=r[s];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i)}return i}function Qf(r,e,i){const a=i[0],s=i[2];if(r.x<a.x&&e.x<a.x||r.x>s.x&&e.x>s.x||r.y<a.y&&e.y<a.y||r.y>s.y&&e.y>s.y)return!1;const l=Ci(r,e,i[0]);return l!==Ci(r,e,i[1])||l!==Ci(r,e,i[2])||l!==Ci(r,e,i[3])}function fo(r,e,i){const a=e.paint.get(r).value;return a.kind==="constant"?a.value:i.programConfigurations.get(e.id).getMaxValue(r)}function fu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function mu(r,e,i,a,s){if(!e[0]&&!e[1])return r;const l=Pe.convert(e)._mult(s);i==="viewport"&&l._rotate(-a);const u=[];for(const d of r)u.push(d.sub(l));return u}function em(r){const e=[];for(let i=0;i<r.length;i++){const a=r[i],s=e.at(-1);(i===0||s&&!a.equals(s))&&e.push(a)}return e}function tm({queryGeometry:r,size:e},i){return pu(r,i,e)}function im({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:s},l){return pu(r,l,e*(i.projectTileCoordinates(l.x,l.y,a,s).signedDistanceFromCamera/i.cameraToCenterDistance))}function rm({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:s},l){const u=i.projectTileCoordinates(l.x,l.y,a,s).signedDistanceFromCamera,d=e*(i.cameraToCenterDistance/u);return pu(r,mh(l,i,a,s),d)}function nm({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:s},l){return pu(r,mh(l,i,a,s),e)}function Pd({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:s,pitchAlignment:l="map",pitchScale:u="map"},d){const _=l==="map"?u==="map"?tm:im:u==="map"?rm:nm,m={queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:s};for(const v of d)for(const g of v)if(_(m,g))return!0;return!1}function mh(r,e,i,a){const s=e.projectTileCoordinates(r.x,r.y,i,a).point;return new Pe((.5*s.x+.5)*e.width,(.5*-s.y+.5)*e.height)}let Id,Md;Ie("CircleBucket",uo,{omit:["layers"]});var am={get paint(){return Md=Md||new di({"circle-radius":new ze(ue.paint_circle["circle-radius"]),"circle-color":new ze(ue.paint_circle["circle-color"]),"circle-blur":new ze(ue.paint_circle["circle-blur"]),"circle-opacity":new ze(ue.paint_circle["circle-opacity"]),"circle-translate":new Ee(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new Ee(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ee(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ee(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ze(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ze(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ze(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return Id=Id||new di({"circle-sort-key":new ze(ue.layout_circle["circle-sort-key"])})}};class sm extends Gi{constructor(e,i){super(e,am,i)}createBucket(e){return new uo(e)}queryRadius(e){const i=e;return fo("circle-radius",this,i)+fo("circle-stroke-width",this,i)+fu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:s,transform:l,pixelsToTileUnits:u,unwrappedTileID:d,getElevation:_}){const m=mu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,u),v=this.paint.get("circle-radius").evaluate(i,a)+this.paint.get("circle-stroke-width").evaluate(i,a),g=this.paint.get("circle-pitch-scale"),T=this.paint.get("circle-pitch-alignment");let b,I;return T==="map"?(b=m,I=v*u):(b=(function(M,A,z,L){return M.map((k=>mh(k,A,z,L)))})(m,l,d,_),I=v),Pd({queryGeometry:b,size:I,transform:l,unwrappedTileID:d,getElevation:_,pitchAlignment:T,pitchScale:g},s)}}class Ed extends uo{}let Cd;Ie("HeatmapBucket",Ed,{omit:["layers"]});var om={get paint(){return Cd=Cd||new di({"heatmap-radius":new ze(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ze(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ee(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ha(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ee(ue.paint_heatmap["heatmap-opacity"])})}};function _h(r,{width:e,height:i}
16,a,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*i*a)throw new RangeError(`mismatched image size. expected: ${s.length} but got: ${e*i*a}`)}else s=new Uint8Array(e*i*a);return r.width=e,r.height=i,r.data=s,r}function Ad(r,{width:e,height:i},a){if(e===r.width&&i===r.height)return;const s=_h({},{width:e,height:i},a);gh(r,s,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},a),r.width=e,r.height=i,r.data=s.data}function gh(r,e,i,a,s,l){if(s.width===0||s.height===0)return e;if(s.width>r.width||s.height>r.height||i.x>r.width-s.width||i.y>r.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||a.x>e.width-s.width||a.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const u=r.data,d=e.data;if(u===d)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_<s.height;_++){const m=((i.y+_)*r.width+i.x)*l,v=((a.y+_)*e.width+a.x)*l;for(let g=0;g<s.width*l;g++)d[v+g]=u[m+g]}return e}class Gl{constructor(e,i){_h(this,e,1,i)}resize(e){Ad(this,e,1)}clone(){return new Gl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,a,s,l){gh(e,i,a,s,l,1)}}class Fi{constructor(e,i){_h(this,e,4,i)}resize(e){Ad(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Fi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,a,s,l){gh(e,i,a,s,l,4)}setPixel(e,i,a){const s=4*(e*this.width+i);this.data[s+0]=Math.round(255*a.r/a.a),this.data[s+1]=Math.round(255*a.g/a.a),this.data[s+2]=Math.round(255*a.b/a.a),this.data[s+3]=Math.round(255*a.a)}}function zd(r){const e=new Uint8Array(r.length);for(let i=0;i<r.length;i+=4){const a=r[i+3];e[i+0]=Math.round(r[i+0]*a/255),e[i+1]=Math.round(r[i+1]*a/255),e[i+2]=Math.round(r[i+2]*a/255),e[i+3]=a}return e}function Dd(r){const e={},i=r.resolution||256,a=r.clips?r.clips.length:1,s=r.image||new Fi({width:i,height:a});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const l=(u,d,_)=>{e[r.evaluationKey]=_;const m=r.expression.evaluate(e);s.setPixel(u/4/i,d/4,m)};if(r.clips)for(let u=0,d=0;u<a;++u,d+=4*i)for(let _=0,m=0;_<i;_++,m+=4){const v=_/(i-1),{start:g,end:T}=r.clips[u];l(d,m,g*(1-v)+T*v)}else for(let u=0,d=0;u<i;u++,d+=4)l(0,d,u/(i-1));return s}Ie("AlphaImage",Gl),Ie("RGBAImage",Fi);const yh="big-fb";class lm extends Gi{createBucket(e){return new Ed(e)}constructor(e,i){super(e,om,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Dd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(yh)&&this.heatmapFbos.delete(yh)}queryRadius(e){return fo("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:s,transform:l,pixelsToTileUnits:u,unwrappedTileID:d,getElevation:_}){return Pd({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,a)*u,transform:l,unwrappedTileID:d,getElevation:_},s)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let kd;var cm={get paint(){return kd=kd||new di({"hillshade-illumination-direction":new Ee(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ee(ue.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ee(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ee(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ee(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ee(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ee(ue.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ee(ue.paint_hillshade["hillshade-method"]),resampling:new Ee(ue.paint_hillshade.resampling)})}};class um extends Gi{constructor(e,i){super(e,cm,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,a=this.paint.get("hillshade-highlight-color").values,s=this.paint.get("hillshade-shadow-color").values;const l=Math.max(e.length,i.length,a.length,s.length);e=e.concat(Array(l-e.length).fill(e.at(-1))),i=i.concat(Array(l-i.length).fill(i.at(-1))),a=a.concat(Array(l-a.length).fill(a.at(-1))),s=s.concat(Array(l-s.length).fill(s.at(-1)));const u=i.map(Rr);return{directionRadians:e.map(Rr),altitudeRadians:u,shadowColor:s,highlightColor:a}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Rd;var hm={get paint(){return Rd=Rd||new di({"color-relief-opacity":new Ee(ue["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ha(ue["paint_color-relief"]["color-relief-color"]),resampling:new Ee(ue["paint_color-relief"].resampling)})}};function Ld(r){return"data"in r}class vh{constructor(e,i,a,s){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,s)}update(e,i,a){var s;const{width:l,height:u}=e,d=(((s=this.size)===null||s===void 0?void 0:s[0])!==l||this.size[1]!==u)&&!a,{context:_}=this,{gl:m}=_;this.useMipmap=!!i?.useMipmap,m.bindTexture(m.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1);const v=this.format===m.RGBA&&i?.premultiply!==!1;if(d)this.size=[l,u],Ld(e)?(_.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,v,l,u,m)):(_.pixelStoreUnpackPremultiplyAlpha.set(v),this._uploadDomImage(e,m));else{const{x:g,y:T}=a||{x:0,y:0};Ld(e)?(_.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,v,g,T,l,u,m)):(_.pixelStoreUnpackPremultiplyAlpha.set(v),this._updateDomImage(e,g,T,m))}this.useMipmap&&this.isSizePowerOfTwo()&&m.generateMipmap(m.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,e)}_uploadRawData(e,i,a,s,l){let{data:u}=e;i&&u&&(u=zd(u)),l.texImage2D(l.TEXTURE_2D,0,this.format,a,s,0,this.format,l.UNSIGNED_BYTE,u)}_updateDomImage(e,i,a,s){s.texSubImage2D(s.TEXTURE_2D,0,i,a,s.RGBA,s.UNSIGNED_BYTE,e)}_updateRawData(e,i,a,s,l,u,d){let{data:_}=e;i&&_&&(_=zd(_)),d.texSubImage2D(d.TEXTURE_2D,0,a,s,l,u,d.RGBA,d.UNSIGNED_BYTE,_)}bind(e,i,a){const{context:s}=this,{gl:l}=s;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),l.bindTexture(l.TEXTURE_2D,this.texture),a!==l.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=l.LINEAR),e!==this.filter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,a||e),this.filter=e),i!==this.wrap&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Fd{constructor(e,i,a,s=1,l=1,u=1,d=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Ht(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const _=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
vendor: 34,630 bytes, line 16
16case"custom":this.redFactor=s,this.greenFactor=l,this.blueFactor=u,this.baseShift=d;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let m=0;m<_;m++)this.data[this._idx(-1,m)]=this.data[this._idx(0,m)],this.data[this._idx(_,m)]=this.data[this._idx(_-1,m)],this.data[this._idx(m,-1)]=this.data[this._idx(m,0)],this.data[this._idx(m,_)]=this.data[this._idx(m,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let m=0;m<_;m++)for(let v=0;v<_;v++){const g=this.get(m,v);g>this.max&&(this.max=g),g<this.min&&(this.min=g)}}get(e,i){const a=new Uint8Array(this.data.buffer),s=4*this._idx(e,i);return this.unpack(a[s],a[s+1],a[s+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,a){return e*this.redFactor+i*this.greenFactor+a*this.blueFactor-this.baseShift}pack(e){return Bd(e,this.getUnpackVector())}getPixels(){return new Fi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=i*this.dim,l=i*this.dim+this.dim,u=a*this.dim,d=a*this.dim+this.dim;switch(i){case-1:s=l-1;break;case 1:l=s+1}switch(a){case-1:u=d-1;break;case 1:d=u+1}const _=-i*this.dim,m=-a*this.dim;for(let v=u;v<d;v++)for(let g=s;g<l;g++)this.data[this._idx(g,v)]=e.data[this._idx(g+_,v+m)]}}function Bd(r,e){const i=e[0],a=e[1],s=e[2],l=e[3],u=Math.min(i,a,s),d=Math.round((r+l)/u);return{r:Math.floor(d*u/i)%256,g:Math.floor(d*u/a)%256,b:Math.floor(d*u/s)%256}}Ie("DEMData",Fd);class dm extends Gi{constructor(e,i){super(e,hm,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},a=this._transitionablePaint._values["color-relief-color"].value.expression;if(a instanceof Zs&&a._styleExpression.expression instanceof At){this.colorRampExpression=a;const u=a._styleExpression.expression;i.elevationStops=u.labels,i.colorStops=[];for(const d of i.elevationStops)i.colorStops.push(u.evaluate({globals:{elevation:d}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[$e.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const s={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(e-1);for(let u=0;u<i.elevationStops.length-.5;u+=l)s.elevationStops.push(i.elevationStops[Math.round(u)]),s.colorStops.push(i.colorStops[Math.round(u)]);return Ht(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),s}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,a){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const s=this._createColorRamp(i),l=new Fi({width:s.colorStops.length,height:1}),u=new Fi({width:s.colorStops.length,height:1});for(let d=0;d<s.elevationStops.length;d++){const _=Bd(s.elevationStops[d],a);u.setPixel(0,d,new $e(_.r/255,_.g/255,_.b/255,1)),l.setPixel(0,d,s.colorStops[d])}return this.colorRampTextures={elevationTexture:new vh(e,u,e.gl.RGBA),colorTexture:new vh(e,l,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const pm=dt([{name:"a_pos",components:2,type:"Int16"}],4),{members:fm}=pm;function _u(r,e,i){const a=i.patternDependencies;let s=!1;for(const l of e){const u=l.paint.get(`${r}-pattern`);u.isConstant()||(s=!0);const d=u.constantOr(null);d&&(s=!0,a[d.to]=!0,a[d.from]=!0)}return s}function xh(r,e,i,a,s){const{zoom:l}=a,u=s.patternDependencies;for(const d of e){const _=d.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let m=_.evaluate({zoom:l-1},i,{},s.availableImages),v=_.evaluate({zoom:l},i,{},s.availableImages),g=_.evaluate({zoom:l+1},i,{},s.availableImages);m=m?.name?m.name:m,v=v?.name?v.name:v,g=g?.name?g.name:g,u[m]=!0,u[v]=!0,u[g]=!0,i.patterns[d.id]={min:m,mid:v,max:g}}}return i}function Od(r,e,i,a,s){let l;if(s===(function(u,d,_,m){let v=0;for(let g=d,T=_-m;g<_;g+=m)v+=(u[T]-u[g])*(u[g+1]+u[T+1]),T=g;return v})(r,e,i,a)>0)for(let u=e;u<i;u+=a)l=Ud(u/a|0,r[u],r[u+1],l);else for(let u=i-a;u>=e;u-=a)l=Ud(u/a|0,r[u],r[u+1],l);return l&&mo(l,l.next)&&(Hl(l),l=l.next),l}function cs(r,e){if(!r)return r;e||(e=r);let i,a=r;do if(i=!1,a.steiner||!mo(a,a.next)&&Dt(a.prev,a,a.next)!==0)a=a.next;else{if(Hl(a),a=e=a.prev,a===a.next)break;i=!0}while(i||a!==e);return e}function Zl(r,e,i,a,s,l,u){if(!r)return;!u&&l&&(function(_,m,v,g){let T=_;do T.z===0&&(T.z=bh(T.x,T.y,m,v,g)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==_);T.prevZ.nextZ=null,T.prevZ=null,(function(b){let I,M=1;do{let A,z=b;b=null;let L=null;for(I=0;z;){I++;let k=z,F=0;for(let V=0;V<M&&(F++,k=k.nextZ,k);V++);let O=M;for(;F>0||O>0&&k;)F!==0&&(O===0||!k||z.z<=k.z)?(A=z,z=z.nextZ,F--):(A=k,k=k.nextZ,O--),L?L.nextZ=A:b=A,A.prevZ=L,L=A;z=k}L.nextZ=null,M*=2}while(I>1)})(T)})(r,a,s,l);let d=r;for(;r.prev!==r.next;){const _=r.prev,m=r.next;if(l?_m(r,a,s,l):mm(r))e.push(_.i,r.i,m.i),Hl(r),r=m.next,d=m.next;else if((r=m)===d){u?u===1?Zl(r=gm(cs(r),e),e,i,a,s,l,2):u===2&&ym(r,e,i,a,s,l):Zl(cs(r),e,i,a,s,l,1);break}}}function mm(r){const e=r.prev,i=r,a=r.next;if(Dt(e,i,a)>=0)return!1;const s=e.x,l=i.x,u=a.x,d=e.y,_=i.y,m=a.y,v=Math.min(s,l,u),g=Math.min(d,_,m),T=Math.max(s,l,u),b=Math.max(d,_,m);let I=a.next;for(;I!==e;){if(I.x>=v&&I.x<=T&&I.y>=g&&I.y<=b&&ql(s,d,l,_,u,m,I.x,I.y)&&Dt(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function _m(r,e,i,a){const s=r.prev,l=r,u=r.next;if(Dt(s,l,u)>=0)return!1;const d=s.x,_=l.x,m=u.x,v=s.y,g=l.y,T=u.y,b=Math.min(d,_,m),I=Math.min(v,g,T),M=Math.max(d,_,m),A=Math.max(v,g,T),z=bh(b,I,e,i,a),L=bh(M,A,e,i,a);let k=r.prevZ,F=r.nextZ;for(;k&&k.z>=z&&F&&F.z<=L;){if(k.x>=b&&k.x<=M&&k.y>=I&&k.y<=A&&k!==s&&k!==u&&ql(d,v,_,g,m,T,k.x,k.y)&&Dt(k.prev,k,k.next)>=0||(k=k.prevZ,F.x>=b&&F.x<=M&&F.y>=I&&F.y<=A&&F!==s&&F!==u&&ql(d,v,_,g,m,T,F.x,F.y)&&Dt(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;k&&k.z>=z;){if(k.x>=b&&k.x<=M&&k.y>=I&&k.y<=A&&k!==s&&k!==u&&ql(d,v,_,g,m,T,k.x,k.y)&&Dt(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;F&&F.z<=L;){if(F.x>=b&&F.x<=M&&F.y>=I&&F.y<=A&&F!==s&&F!==u&&ql(d,v,_,g,m,T,F.x,F.y)&&Dt(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function gm(r,e){let i=r;do{const a=i.prev,s=i.next.next;!mo(a,s)&&Vd(a,i,i.next,s)&&Wl(a,s)&&Wl(s,a)&&(e.push(a.i,i.i,s.i),Hl(i),Hl(i.next),i=r=s),i=i.next}while(i!==r);return cs(i)}function ym(r,e,i,a,s,l){let u=r;do{let d=u.next.next;for(;d!==u.prev;){if(u.i!==d.i&&Tm(u,d)){let _=Nd(u,d);return u=cs(u,u.next),_=cs(_,_.next),Zl(u,e,i,a,s,l,0),void Zl(_,e,i,a,s,l,0)}d=d.next}u=u.next}while(u!==r)}function vm(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function xm(r,e){const i=(function(s,l){let u=l;const d=s.x,_=s.y;let m,v=-1/0;if(mo(s,u))return u;do{if(mo(s,u.next))return u.next;if(_<=u.y&&_>=u.next.y&&u.next.y!==u.y){const M=u.x+(_-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(M<=d&&M>v&&(v=M,m=u.x<u.next.x?u:u.next,M===d))return m}u=u.next}while(u!==l);if(!m)return null;const g=m,T=m.x,b=m.y;let I=1/0;u=m;do{if(d>=u.x&&u.x>=T&&d!==u.x&&jd(_<b?d:v,_,T,b,_<b?v:d,_,u.x,u.y)){const M=Math.abs(_-u.y)/(d-u.x);Wl(u,s)&&(M<I||M===I&&(u.x>m.x||u.x===m.x&&bm(m,u)))&&(m=u,I=M)}u=u.next}while(u!==g);return m})(r,e);if(!i)return e;const a=Nd(i,r);return cs(a,a.next),cs(i,i.next)}function bm(r,e){return Dt(r.prev,r,e.prev)<0&&Dt(e.next,r,r.next)<0}function bh(r,e,i,a,s){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*s|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-a)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wm(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function jd(r,e,i,a,s,l,u,d){return(s-u)*(e-d)>=(r-u)*(l-d)&&(r-u)*(a-d)>=(i-u)*(e-d)&&(i-u)*(l-d)>=(s-u)*(a-d)}function ql(r,e,i,a,s,l,u,d){return!(r===u&&e===d)&&jd(r,e,i,a,s,l,u,d)}function Tm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,a){let s=i;do{if(s.i!==i.i&&s.next.i!==i.i&&s.i!==a.i&&s.next.i!==a.i&&Vd(s,s.next,i,a))return!0;s=s.next}while(s!==i);return!1})(r,e)&&(Wl(r,e)&&Wl(e,r)&&(function(i,a){let s=i,l=!1;const u=(i.x+a.x)/2,d=(i.y+a.y)/2;do s.y>d!=s.next.y>d&&s.next.y!==s.y&&u<(s.next.x-s.x)*(d-s.y)/(s.next.y-s.y)+s.x&&(l=!l),s=s.next;while(s!==i);return l})(r,e)&&(Dt(r.prev,r,e.prev)||Dt(r,e.prev,e))||mo(r,e)&&Dt(r.prev,r,r.next)>0&&Dt(e.prev,e,e.next)>0)}function Dt(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function mo(r,e){return r.x===e.x&&r.y===e.y}function Vd(r,e,i,a){const s=yu(Dt(r,e,i)),l=yu(Dt(r,e,a)),u=yu(Dt(i,a,r)),d=yu(Dt(i,a,e));return s!==l&&u!==d||!(s!==0||!gu(r,i,e))||!(l!==0||!gu(r,a,e))||!(u!==0||!gu(i,r,a))||!(d!==0||!gu(i,e,a))}function gu(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function yu(r){return r>0?1:r<0?-1:0}function Wl(r,e){return Dt(r.prev,r,r.next)<0?Dt(r,e,r.next)>=0&&Dt(r,r.prev,e)>=0:Dt(r,e,r.prev)<0||Dt(r,r.next,e)<0}function Nd(r,e){const i=wh(r.i,r.x,r.y),a=wh(e.i,e.x,e.y),s=r.next,l=e.prev;return r.next=e,e.prev=r,i.next=s,s.prev=i,a.next=i,i.prev=a,l.next=a,a.prev=l,a}function Ud(r,e,i,a){const s=wh(r,e,i);return a?(s.next=a.next,s.prev=a,a.next.prev=s,a.next=s):(s.prev=s,s.next=s),s}function Hl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function wh(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class _o{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class vu{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}vu.noSubdivision=new vu({fill:new _o(0,0),line:new _o(0,0),tile:new _o(0,0),stencil:new _o(0,0),circle:1}),Ie("SubdivisionGranularityExpression",_o),Ie("SubdivisionGranularitySetting",vu);const go=-32768,Xl=32767;class Sm{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Re/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(e),s=0|Math.round(i),l=this._getKey(a,s);if(this._vertexDictionary.has(l))return this._vertexDictionary.get(l);const u=this._vertexBuffer.length/2;return this._vertexDictionary.set(l,u),this._vertexBuffer.push(a,s),u}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(s,l){const u=[];for(let d=0;d<l.length;d+=3){const _=l[d],m=l[d+1],v=l[d+2],g=s[2*_],T=s[2*_+1];(s[2*m]-g)*(s[2*v+1]-T)-(s[2*m+1]-T)*(s[2*v]-g)>0?(u.push(_),u.push(v),u.push(m)):(u.push(_),u.push(m),u.push(v))}return u})(this._vertexBuffer,e);const i=[],a=e.length;for(let s=0;s<a;s+=3){const l=[e[s+0],e[s+1],e[s+2]],u=[this._vertexBuffer[2*e[s+0]+0],this._vertexBuffer[2*e[s+0]+1],this._vertexBuffer[2*e[s+1]+0],this._vertexBuffer[2*e[s+1]+1],this._vertexBuffer[2*e[s+2]+0],this._vertexBuffer[2*e[s+2]+1]];let d=1/0,_=1/0,m=-1/0,v=-1/0;for(let M=0;M<3;M++){const A=u[2*M],z=u[2*M+1];d=Math.min(d,A),m=Math.max(m,A),_=Math.min(_,z),v=Math.max(v,z)}if(d===m||_===v)continue;const g=Math.floor(d/this._granularityCellSize),T=Math.ceil(m/this._granularityCellSize),b=Math.floor(_/this._granularityCellSize),I=Math.ceil(v/this._granularityCellSize);if(g!==T||b!==I)for(let M=b;M<I;M++){const A=this._scanlineGenerateVertexRingForCellRow(M,u,l);Pm(this._vertexBuffer,A,i)}else i.push(...l)}return i}_scanlineGenerateVertexRingForCellRow(e,i,a){const s=e*this._granularityCellSize,l=s+this._granularityCellSize,u=[];for(let d=0;d<3;d++){const _=i[2*d],m=i[2*d+1],v=i[2*(d+1)%6],g=i[(2*(d+1)+1)%6],T=i[2*(d+2)%6],b=i[(2*(d+2)+1)%6],I=v-_,M=g-m,A=I===0,z=M===0,L=(s-m)/M,k=(l-m)/M,F=Math.min(L,k),O=Math.max(L,k);if(!z&&(F>=1||O<=0)||z&&(m<s||m>l)){g>=s&&g<=l&&u.push(a[(d+1)%3]);continue}!z&&F>0&&u.push(this._vertexToIndex(_+I*F,m+M*F));const V=_+I*Math.max(F,0),Y=_+I*Math.min(O,1);A||this._generateIntraEdgeVertices(u,_,m,v,g,V,Y),!z&&O<1&&u.push(this._vertexToIndex(_+I*O,m+M*O)),(z||g>=s&&g<=l)&&u.push(a[(d+1)%3]),!z&&(g<=s||g>=l)&&this._generateInterEdgeVertices(u,_,m,v,g,T,b,Y,s,l)}return u}_generateIntraEdgeVertices(e,i,a,s,l,u,d){const _=s-i,m=l-a,v=m===0,g=v?Math.min(i,s):Math.min(u,d),T=v?Math.max(i,s):Math.max(u,d),b=Math.floor(g/this._granularityCellSize)+1,I=Math.ceil(T/this._granularityCellSize)-1;if(v?i<s:u<d)for(let M=b;M<=I;M++){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,a+m*(A-i)/_))}else for(let M=I;M>=b;M--){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,a+m*(A-i)/_))}}_generateInterEdgeVertices(e,i,a,s,l,u,d,_,m,v){const g=l-a,T=u-s,b=d-l,I=(m-l)/b,M=(v-l)/b,A=Math.min(I,M),z=Math.max(I,M),L=s+T*A;let k=Math.floor(Math.min(L,_)/this._granularityCellSize)+1,F=Math.ceil(Math.max(L,_)/this._granularityCellSize)-1,O=_<L;const V=b===0;if(V&&(d===m||d===v))return;if(V||A>=1||z<=0){const J=a-d,re=u+(i-u)*Math.min((m-d)/J,(v-d)/J);k=Math.floor(Math.min(re,_)/this._granularityCellSize)+1,F=Math.ceil(Math.max(re,_)/this._granularityCellSize)-1,O=_<re}const Y=g>0?v:m;if(O)for(let J=k;J<=F;J++)e.push(this._vertexToIndex(J*this._granularityCellSize,Y));else for(let J=F;J>=k;J--)e.push(this._vertexToIndex(J*this._granularityCellSize,Y))}_generateOutline(e){const i=[];for(const a of e){const s=us(a,this._granularity,!0),l=this._pointArrayToIndices(s),u=[];for(let d=1;d<l.length;d++)u.push(l[d-1]),u.push(l[d]);i.push(u)}return i}_handlePoles(e){let i=!1,a=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(i||a)&&this._fillPoles(e,i,a)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const a=e[i+1];a===go&&(e[i+1]=-32767),a===Xl&&(e[i+1]=32766)}}_generatePoleQuad(e,i,a,s,l,u){s>l!=(u===go)?(e.push(i),e.push(a),e.push(this._vertexToIndex(s,u)),e.push(a),e.push(this._vertexToIndex(l,u)),e.push(this._vertexToIndex(s,u))):(e.push(a),e.push(i),e.push(this._vertexToIndex(s,u)),e.push(this._vertexToIndex(l,u)),e.push(a),e.push(this._vertexToIndex(s,u)))}_fillPoles(e,i,a){const s=this._vertexBuffer,l=Re,u=e.length;for(let d=2;d<u;d+=3){const _=e[d-2],m=e[d-1],v=e[d],g=s[2*_],T=s[2*_+1],b=s[2*m],I=s[2*m+1],M=s[2*v],A=s[2*v+1];i&&(T===0&&I===0&&this._generatePoleQuad(e,_,m,g,b,go),I===0&&A===0&&this._generatePoleQuad(e,m,v,b,M,go),A===0&&T===0&&this._generatePoleQuad(e,v,_,M,g,go)),a&&(T===l&&I===l&&this._generatePoleQuad(e,_,m,g,b,Xl),I===l&&A===l&&this._generatePoleQuad(e,m,v,b,M,Xl),A===l&&T===l&&this._generatePoleQuad(e,v,_,M,g,Xl))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:s}=(function(d){const _=[],m=[];for(const v of d)if(v.length!==0){v!==d[0]&&_.push(m.length/2);for(const g of v)m.push(g.x),m.push(g.y)}return{flattened:m,holeIndices:_}})(e);let l;this._initializeVertices(a);try{const d=(function(m,v,g=2){const T=v&&v.length,b=T?v[0]*g:m.length;let I=Od(m,0,b,g,!0);const M=[];if(!I||I.next===I.prev)return M;let A,z,L;if(T&&(I=(function(k,F,O,V){const Y=[];for(let J=0,re=F.length;J<re;J++){const te=Od(k,F[J]*V,J<re-1?F[J+1]*V:k.length,V,!1);te===te.next&&(te.steiner=!0),Y.push(wm(te))}Y.sort(vm);for(let J=0;J<Y.length;J++)O=xm(Y[J],O);return O})(m,v,I,g)),m.length>80*g){A=m[0],z=m[1];let k=A,F=z;for(let O=g;O<b;O+=g){const V=m[O],Y=m[O+1];V<A&&(A=V),Y<z&&(z=Y),V>k&&(k=V),Y>F&&(F=Y)}L=Math.max(k-A,F-z),L=L!==0?32767/L:0}return Zl(I,M,g,A,z,L,0),M})(a,s),_=this._convertIndices(a,d);l=this._subdivideTrianglesScanline(_)}catch(d){console.error(d)}let u=[];return i&&(u=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(l),{verticesFlattened:this._vertexBuffer,indicesTriangles:l,indicesLineList:u}}_convertIndices(e,i){const a=[];for(const s of i)a.push(this._vertexToIndex(e[2*s],e[2*s+1]));return a}_pointArrayToIndices(e){const i=[];for(const a of e)i.push(this._vertexToIndex(a.x,a.y));return i}}function $d(r,e,i,a=!0){return new Sm(i,e).subdividePolygonInternal(r,a)}function us(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],s=r[r.length-1],l=i&&(a.x!==s.x||a.y!==s.y);if(e<2)return l?[...r,r[0]]:[...r];const u=Math.floor(Re/e),d=[];d.push(new Pe(r[0].x,r[0].y));const _=r.length,m=l?_:_-1;for(let v=0;v<m;v++){const g=r[v],T=v<_-1?r[v+1]:r[0],b=g.x,I=g.y,M=T.x,A=T.y,z=b!==M,L=I!==A;if(!z&&!L)continue;const k=M-b,F=A-I,O=Math.abs(k),V=Math.abs(F);let Y=b,J=I;for(;;){const te=k>0?(Math.floor(Y/u)+1)*u:(Math.ceil(Y/u)-1)*u,le=F>0?(Math.floor(J/u)+1)*u:(Math.ceil(J/u)-1)*u,ce=Math.abs(Y-te),ne=Math.abs(J-le),ie=Math.abs(Y-M),_e=Math.abs(J-A),we=z?ce/O:Number.POSITIVE_INFINITY,xe=L?ne/V:Number.POSITIVE_INFINITY;if((ie<=ce||!z)&&(_e<=ne||!L))break;if(we<xe&&z||!L){Y=te,J+=F*we;const ge=new Pe(Y,Math.round(J));d[d.length-1].x===ge.x&&d[d.length-1].y===ge.y||d.push(ge)}else{Y+=k*xe,J=le;const ge=new Pe(Math.round(Y),J);d[d.length-1].x===ge.x&&d[d.length-1].y===ge.y||d.push(ge)}}const re=new Pe(M,A);d[d.length-1].x===re.x&&d[d.length-1].y===re.y||d.push(re)}return d}function Pm(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,s=r[2*e[0]];for(let _=1;_<e.length;_++){const m=r[2*e[_]];m<s&&(s=m,a=_)}const l=e.length;let u=a,d=(u+1)%l;for(;;){const _=u-1>=0?u-1:l-1,m=(d+1)%l,v=r[2*e[_]],g=r[2*e[m]],T=r[2*e[u]],b=r[2*e[u]+1],I=r[2*e[d]+1];let M=!1;if(v<g)M=!0;else if(v>g)M=!1;else{const A=I-b,z=-(r[2*e[d]]-T),L=b<I?1:-1;((v-T)*A+(r[2*e[_]+1]-b)*z)*L>((g-T)*A+(r[2*e[m]+1]-b)*z)*L&&(M=!0)}if(M){const A=e[_],z=e[u],L=e[d];A!==z&&A!==L&&z!==L&&i.push(L,z,A),u--,u<0&&(u=l-1)}else{const A=e[m],z=e[u],L=e[d];A!==z&&A!==L&&z!==L&&i.push(L,z,A),d++,d>=l&&(d=0)}if(_===m)break}}function Gd(r,e,i,a,s,l,u,d,_){const m=s.length/2,v=u&&d&&_;if(m<Se.MAX_VERTEX_ARRAY_LENGTH){const g=e.prepareSegment(m,i,a),T=g.vertexLength;for(let M=0;M<l.length;M+=3)a.emplaceBack(T+l[M],T+l[M+1],T+l[M+2]);let b,I;g.vertexLength+=m,g.primitiveLength+=l.length/3,v&&(I=u.prepareSegment(m,i,d),b=I.vertexLength,I.vertexLength+=m);for(let M=0;M<s.length;M+=2)r(s[M],s[M+1]);if(v)for(const M of _){for(let A=1;A<M.length;A+=2)d.emplaceBack(b+M[A-1],b+M[A]);I.primitiveLength+=M.length/2}}else(function(g,T,b,I,M,A){const z=[];for(let V=0;V<I.length/2;V++)z.push(-1);const L={count:0};let k=0,F=g.getOrCreateLatestSegment(T,b),O=F.vertexLength;for(let V=2;V<M.length;V+=3){const Y=M[V-2],J=M[V-1],re=M[V];let te=z[Y]<k,le=z[J]<k,ce=z[re]<k;F.vertexLength+((te?1:0)+(le?1:0)+(ce?1:0))>Se.MAX_VERTEX_ARRAY_LENGTH&&(F=g.createNewSegment(T,b),k=L.count,te=!0,le=!0,ce=!0,O=0);const ne=Yl(z,I,A,L,Y,te,F),ie=Yl(z,I,A,L,J,le,F),_e=Yl(z,I,A,L,re,ce,F);b.emplaceBack(O+ne-k,O+ie-k,O+_e-k),F.primitiveLength++}})(e,i,a,s,l,r),v&&(function(g,T,b,I,M,A){const z=[];for(let V=0;V<I.length/2;V++)z.push(-1);const L={count:0};let k=0,F=g.getOrCreateLatestSegment(T,b),O=F.vertexLength;for(const V of M)for(let Y=1;Y<V.length;Y+=2){const J=V[Y-1],re=V[Y];let te=z[J]<k,le=z[re]<k;F.vertexLength+((te?1:0)+(le?1:0))>Se.MAX_VERTEX_ARRAY_LENGTH&&(F=g.createNewSegment(T,b),k=L.count,te=!0,le=!0,O=0);const ce=Yl(z,I,A,L,J,te,F),ne=Yl(z,I,A,L,re,le,F);b.emplaceBack(O+ce-k,O+ne-k),F.primitiveLength++}})(u,i,d,s,_,r),e.forceNewSegmentOnNextPrepare(),u?.forceNewSegmentOnNextPrepare()}function Yl(r,e,i,a,s,l,u){if(l){const d=a.count;return i(e[2*s],e[2*s+1]),r[s]=a.count,a.count++,u.vertexLength++,d}return r[s]}class Th{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new N,this.indexArray=new de,this.indexArray2=new Me,this.programConfigurations=new br(e.layers,e.zoom),this.segments=new Se,this.segments2=new Se,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){this.hasDependencies=_u("fill",this.layers,i);const s=this.layers[0].layout.get("fill-sort-key"),l=!s.isConstant(),u=[];for(const{feature:d,id:_,index:m,sourceLayerIndex:v}of e){const g=this.layers[0]._featureFilter.needGeometry,T=Xr(d,g);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),T,a))continue;const b=l?s.evaluate(T,{},a,i.availableImages):void 0,I={id:_,properties:d.properties,type:d.type,sourceLayerIndex:v,index:m,geometry:g?T.geometry:Hr(d),patterns:{},sortKey:b};u.push(I)}l&&u.sort(((d,_)=>d.sortKey-_.sortKey));for(const d of u){const{geometry:_,index:m,sourceLayerIndex:v}=d;if(this.hasDependencies){const g=xh("fill",this.layers,d,{zoom:this.zoom},i);this.patternFeatures.push(g)}else this.addFeature(d,_,m,a,{},i.subdivisionGranularity);i.featureIndex.insert(e[m].feature,_,m,v,this.index)}}update(e,i,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a})}addFeatures(e,i,a){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,i,a,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fm),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,i,a,s,l,u){for(const d of Ls(i,500)){const _=$d(d,s,u.fill.getGranularityForZoomLevel(s.z)),m=this.layoutVertexArray;Gd(((v,g)=>{m.emplaceBack(v,g)}),this.segments,this.layoutVertexArray,this.indexArray,_.verticesFlattened,_.indicesTriangles,this.segments2,this.indexArray2,_.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:l,canonical:s})}}let Zd,qd;Ie("FillBucket",Th,{omit:["layers","patternFeatures"]});var Im={get paint(){return qd=qd||new di({"fill-antialias":new Ee(ue.paint_fill["fill-antialias"]),"fill-opacity":new ze(ue.paint_fill["fill-opacity"]),"fill-color":new ze(ue.paint_fill["fill-color"]),"fill-outline-color":new ze(ue.paint_fill["fill-outline-color"]),"fill-translate":new Ee(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new Ee(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ur(ue.paint_fill["fill-pattern"])})},get layout(){return Zd=Zd||new di({"fill-sort-key":new ze(ue.layout_fill["fill-sort-key"])})}};class Mm extends Gi{constructor(e,i){super(e,Im,i)}recalculate(e,i){super.recalculate(e,i);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Th(e)}queryRadius(){return fu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:a,pixelsToTileUnits:s}){return wd(mu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,s),i)}isTileClipped(){return!0}}const Em=dt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Cm=dt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Am}=Em;class Kl{constructor(e,i,a,s,l){this.properties={},this.extent=a,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=l,e.readFields(zm,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,a=[];let s,l=1,u=0,d=0,_=0;for(;e.pos<i;){if(u<=0){const m=e.readVarint();l=7&m,u=m>>3}if(u--,l===1||l===2)d+=e.readSVarint(),_+=e.readSVarint(),l===1&&(s&&a.push(s),s=[]),s&&s.push(new Pe(d,_));else{if(l!==7)throw new Error(`unknown command ${l}`);s&&s.push(s[0].clone())}}return s&&a.push(s),a}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let a=1,s=0,l=0,u=0,d=1/0,_=-1/0,m=1/0,v=-1/0;for(;e.pos<i;){if(s<=0){const g=e.readVarint();a=7&g,s=g>>3}if(s--,a===1||a===2)l+=e.readSVarint(),u+=e.readSVarint(),l<d&&(d=l),l>_&&(_=l),u<m&&(m=u),u>v&&(v=u);else if(a!==7)throw new Error(`unknown command ${a}`)}return[d,m,_,v]}toGeoJSON(e,i,a){const s=this.extent*Math.pow(2,a),l=this.extent*e,u=this.extent*i,d=this.loadGeometry();function _(T){return[360*(T.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+u)/s)*Math.PI))-90]}function m(T){return T.map(_)}let v;if(this.type===1){const T=[];for(const I of d)T.push(I[0]);const b=m(T);v=T.length===1?{type:"Point",coordinates:b[0]}:{type:"MultiPoint",coordinates:b}}else if(this.type===2){const T=d.map(m);v=T.length===1?{type:"LineString",coordinates:T[0]}:{type:"MultiLineString",coordinates:T}}else{if(this.type!==3)throw new Error("unknown feature type");{const T=Wd(d),b=[];for(const I of T)b.push(I.map(m));v=b.length===1?{type:"Polygon",coordinates:b[0]}:{type:"MultiPolygon",coordinates:b}}}const g={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(g.id=this.id),g}}function zm(r,e,i){r===1?e.id=i.readVarint():r===2?(function(a,s){const l=a.readVarint()+a.pos;for(;a.pos<l;){const u=s._keys[a.readVarint()],d=s._values[a.readVarint()];s.properties[u]=d}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Wd(r){const e=r.length;if(e<=1)return[r];const i=[];let a,s;for(let l=0;l<e;l++){const u=Dm(r[l]);u!==0&&(s===void 0&&(s=u<0),s===u<0?(a&&i.push(a),a=[r[l]]):a&&a.push(r[l]))}return a&&i.push(a),i}function Dm(r){let e=0;for(let i,a,s=0,l=r.length,u=l-1;s<l;u=s++)i=r[s],a=r[u],e+=(a.x-i.x)*(i.y+a.y);return e}Kl.types=["Unknown","Point","LineString","Polygon"];class km{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Rm,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new Kl(this._pbf,i,this.extent,this._keys,this._values)}}function Rm(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(a){let s=null;const l=a.readVarint()+a.pos;for(;a.pos<l;){const u=a.readVarint()>>3;s=u===1?a.readString():u===2?a.readFloat():u===3?a.readDouble():u===4?a.readVarint64():u===5?a.readVarint():u===6?a.readSVarint():u===7?a.readBoolean():null}if(s==null)throw new Error("unknown feature value");return s})(i))}class Hd{constructor(e,i){this.layers=e.readFields(Lm,{},i)}}function Lm(r,e,i){if(r===3){const a=new km(i,i.readVarint()+i.pos);a.length&&(e[a.name]=a)}}const Sh=Math.pow(2,13);function Jl(r,e,i,a,s,l,u,d){r.emplaceBack(e,i,2*Math.floor(a*Sh)+u,s*Sh*2,l*Sh*2,Math.round(d))}class Ph{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new G,this.centroidVertexArray=new j,this.indexArray=new de,this.programConfigurations=new br(e.layers,e.zoom),this.segments=new Se,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){this.features=[],this.hasDependencies=_u("fill-extrusion",this.layers,i);for(const{feature:s,id:l,index:u,sourceLayerIndex:d}of e){const _=this.layers[0]._featureFilter.needGeometry,m=Xr(s,_);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),m,a))continue;const v={id:l,sourceLayerIndex:d,index:u,geometry:_?m.geometry:Hr(s),properties:s.properties,type:s.type,patterns:{}};this.hasDependencies?this.features.push(xh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,u,a,{},i.subdivisionGranularity),i.featureIndex.insert(s,v.geometry,u,d,this.index,!0)}}addFeatures(e,i,a){for(const s of this.features){const{geometry:l}=s;this.addFeature(s,l,s.index,i,a,e.subdivisionGranularity)}}update(e,i,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Am),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Cm.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,i,a,s,l,u){for(const d of Ls(i,500)){const _={x:0,y:0,sampleCount:0},m=this.layoutVertexArray.length;this.processPolygon(_,s,e,d,u);const v=this.layoutVertexArray.length-m,g=Math.floor(_.x/_.sampleCount),T=Math.floor(_.y/_.sampleCount);for(let b=0;b<v;b++)this.centroidVertexArray.emplaceBack(g,T)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:l,canonical:s})}processPolygon(e,i,a,s,l){if(s.length<1||Xd(s[0]))return;for(const g of s)g.length!==0&&Fm(e,g);const u={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},d=l.fill.getGranularityForZoomLevel(i.z),_=Kl.types[a.type]==="Polygon";for(const g of s){if(g.length===0||Xd(g))continue;const T=us(g,d,_);this._generateSideFaces(T,u)}if(!_)return;const m=$d(s,i,d,!1),v=this.layoutVertexArray;Gd(((g,T)=>{Jl(v,g,T,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,m.verticesFlattened,m.indicesTriangles)}_generateSideFaces(e,i){let a=0;for(let s=1;s<e.length;s++){const l=e[s],u=e[s-1];if(Bm(l,u))continue;i.segment.vertexLength+4>Se.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const d=l.sub(u)._perp()._unit(),_=u.dist(l);a+_>32768&&(a=0),Jl(this.layoutVertexArray,l.x,l.y,d.x,d.y,0,0,a),Jl(this.layoutVertexArray,l.x,l.y,d.x,d.y,0,1,a),a+=_,Jl(this.layoutVertexArray,u.x,u.y,d.x,d.y,0,0,a),Jl(this.layoutVertexArray,u.x,u.y,d.x,d.y,0,1,a);const m=i.segment.vertexLength;this.indexArray.emplaceBack(m,m+2,m+1),this.indexArray.emplaceBack(m+1,m+2,m+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function Fm(r,e){for(let i=0;i<e.length;i++){const a=e[i];i===e.length-1&&e[0].x===a.x&&e[0].y===a.y||(r.x+=a.x,r.y+=a.y,r.sampleCount++)}}function Bm(r,e){return r.x===e.x&&(r.x<0||r.x>Re)||r.y===e.y&&(r.y<0||r.y>Re)}function Xd(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Re))||r.every((e=>e.y<0))||r.every((e=>e.y>Re))}let Yd;Ie("FillExtrusionBucket",Ph,{omit:["layers","features"]});var Om={get paint(){return Yd=Yd||new di({"fill-extrusion-opacity":new Ee(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ze(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ee(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ee(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ur(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ze(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ze(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ee(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class jm extends Gi{constructor(e,i){super(e,Om,i)}createBucket(e){return new Ph(e)}queryRadius(){return fu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:s,transform:l,pixelsToTileUnits:u,pixelPosMatrix:d}){const _=mu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-l.bearingInRadians,u),m=this.paint.get("fill-extrusion-height").evaluate(i,a),v=this.paint.get("fill-extrusion-base").evaluate(i,a),g=(function(b,I){const M=[];for(const A of b){const z=[A.x,A.y,0,1];He(z,z,I),M.push(new Pe(z[0]/z[3],z[1]/z[3]))}return M})(_,d),T=(function(b,I,M,A){const z=[],L=[],k=A[8]*I,F=A[9]*I,O=A[10]*I,V=A[11]*I,Y=A[8]*M,J=A[9]*M,re=A[10]*M,te=A[11]*M;for(const le of b){const ce=[],ne=[];for(const ie of le){const _e=ie.x,we=ie.y,xe=A[0]*_e+A[4]*we+A[12],ge=A[1]*_e+A[5]*we+A[13],ke=A[2]*_e+A[6]*we+A[14],Qe=A[3]*_e+A[7]*we+A[15],tt=ke+O,st=Qe+V,oi=xe+Y,Pt=ge+J,Ot=ke+re,Gt=Qe+te,mt=new Pe((xe+k)/st,(ge+F)/st);mt.z=tt/st,ce.push(mt);const ei=new Pe(oi/Gt,Pt/Gt);ei.z=Ot/Gt,ne.push(ei)}z.push(ce),L.push(ne)}return[z,L]})(s,v,m,d);return(function(b,I,M){let A=1/0;wd(M,I)&&(A=Kd(M,I[0]));for(let z=0;z<I.length;z++){const L=I[z],k=b[z];for(let F=0;F<L.length-1;F++){const O=L[F],V=[O,L[F+1],k[F+1],k[F],O];ho(M,V)&&(A=Math.min(A,Kd(M,V)))}}return A!==1/0&&A})(T[0],T[1],g)}}function Ql(r,e){return r.x*e.x+r.y*e.y}function Kd(r,e){if(r.length===1){let i=0;const a=e[i++];let s;for(;!s||a.equals(s);)if(s=e[i++],!s)return 1/0;for(;i<e.length;i++){const l=e[i],u=r[0],d=s.sub(a),_=l.sub(a),m=u.sub(a),v=Ql(d,d),g=Ql(d,_),T=Ql(_,_),b=Ql(m,d),I=Ql(m,_),M=v*T-g*g,A=(T*b-g*I)/M,z=(v*I-g*b)/M,L=a.z*(1-A-z)+s.z*A+l.z*z;if(isFinite(L))return L}return 1/0}{let i=1/0;for(const a of e)i=Math.min(i,a.z);return i}}const Jd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
16];class xu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,a]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=a>>4;if(s!==1)throw new Error(`Got v${s} data when expected v1.`);const l=Jd[15&a];if(!l)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new xu(d,u,l,e)}constructor(e,i=64,a=Float64Array,s){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=a,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=Jd.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-d%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${a}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+d+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=e,this.coords[this._pos++]=i,a}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Ih(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,a,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,_=[0,l.length-1,0],m=[];for(;_.length;){const v=_.pop()||0,g=_.pop()||0,T=_.pop()||0;if(g-T<=d){for(let A=T;A<=g;A++){const z=u[2*A],L=u[2*A+1];z>=e&&z<=a&&L>=i&&L<=s&&m.push(l[A])}continue}const b=T+g>>1,I=u[2*b],M=u[2*b+1];I>=e&&I<=a&&M>=i&&M<=s&&m.push(l[b]),(v===0?e<=I:i<=M)&&(_.push(T),_.push(b-1),_.push(1-v)),(v===0?a>=I:s>=M)&&(_.push(b+1),_.push(g),_.push(1-v))}return m}within(e,i,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:l,nodeSize:u}=this,d=[0,s.length-1,0],_=[],m=a*a;for(;d.length;){const v=d.pop()||0,g=d.pop()||0,T=d.pop()||0;if(g-T<=u){for(let A=T;A<=g;A++)ep(l[2*A],l[2*A+1],e,i)<=m&&_.push(s[A]);continue}const b=T+g>>1,I=l[2*b],M=l[2*b+1];ep(I,M,e,i)<=m&&_.push(s[b]),(v===0?e-a<=I:i-a<=M)&&(d.push(T),d.push(b-1),d.push(1-v)),(v===0?e+a>=I:i+a>=M)&&(d.push(b+1),d.push(g),d.push(1-v))}return _}}function Ih(r,e,i,a,s,l){if(s-a<=i)return;const u=a+s>>1;Qd(r,e,u,a,s,l),Ih(r,e,i,a,u-1,1-l),Ih(r,e,i,u+1,s,1-l)}function Qd(r,e,i,a,s,l){for(;s>a;){if(s-a>600){const m=s-a+1,v=i-a+1,g=Math.log(m),T=.5*Math.exp(2*g/3),b=.5*Math.sqrt(g*T*(m-T)/m)*(v-m/2<0?-1:1);Qd(r,e,i,Math.max(a,Math.floor(i-v*T/m+b)),Math.min(s,Math.floor(i+(m-v)*T/m+b)),l)}const u=e[2*i+l];let d=a,_=s;for(ec(r,e,a,i),e[2*s+l]>u&&ec(r,e,a,s);d<_;){for(ec(r,e,d,_),d++,_--;e[2*d+l]<u;)d++;for(;e[2*_+l]>u;)_--}e[2*a+l]===u?ec(r,e,a,_):(_++,ec(r,e,_,s)),_<=i&&(a=_+1),i<=_&&(s=_-1)}}function ec(r,e,i,a){Mh(r,i,a),Mh(e,2*i,2*a),Mh(e,2*i+1,2*a+1)}function Mh(r,e,i){const a=r[e];r[e]=r[i],r[i]=a}function ep(r,e,i,a){const s=r-i,l=e-a;return s*s+l*l}function Eh(r,e,i,a){let s=a;const l=e+(i-e>>1);let u,d=i-e;const _=r[e],m=r[e+1],v=r[i],g=r[i+1];for(let T=e+3;T<i;T+=3){const b=Vm(r[T],r[T+1],_,m,v,g);if(b>s)u=T,s=b;else if(b===s){const I=Math.abs(T-l);I<d&&(u=T,d=I)}}s>a&&(u-e>3&&Eh(r,e,u,a),r[u+2]=s,i-u>3&&Eh(r,u,i,a))}function Vm(r,e,i,a,s,l){let u=s-i,d=l-a;if(u!==0||d!==0){const _=((r-i)*u+(e-a)*d)/(u*u+d*d);_>1?(i=s,a=l):_>0&&(i+=u*_,a+=d*_)}return u=r-i,d=e-a,u*u+d*d}function Qt(r,e,i,a){const s={type:e,geom:i},l={id:r??null,type:s.type,geometry:s.geom,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(s.type){case"Point":case"MultiPoint":tc(l,s.geom);break;case"LineString":tc(l,s.geom.points);break;case"Polygon":tc(l,s.geom[0].points);break;case"MultiLineString":for(const u of s.geom)tc(l,u.points);break;case"MultiPolygon":for(const u of s.geom)tc(l,u[0].points)}return l}function Ch(r){r.points.length>64&&(r.points=new Float64Array(r.points))}function tc(r,e){for(let i=0;i<e.length;i+=3)r.minX=Math.min(r.minX,e[i]),r.minY=Math.min(r.minY,e[i+1]),r.maxX=Math.max(r.maxX,e[i]),r.maxY=Math.max(r.maxY,e[i+1])}function Ah(r,e){const i=[];switch(r.type){case"FeatureCollection":for(let a=0;a<r.features.length;a++)bu(i,r.features[a],e,a);break;case"Feature":bu(i,r,e);break;default:bu(i,{geometry:r,properties:void 0},e)}return i}function bu(r,e,i,a){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(d,_,m,v,g){for(const T of m.geometries)bu(d,{id:_.id,geometry:T,properties:_.properties},v,g)})(r,e,e.geometry,i,a);if(!e.geometry.coordinates?.length)return;const l=(function(d,_,m){return _.promoteId?d.properties?.[_.promoteId]:_.generateId?m||0:d.id}
vendor: 12,076 bytes, line 16
16)(e,i,a),u=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(e.geometry.type){case"Point":return void(function(d,_,m,v){const g=[];g.push(yo(m.coordinates[0]),vo(m.coordinates[1]),0),d.push(Qt(_,"Point",g,v))})(r,l,e.geometry,e.properties);case"MultiPoint":return void(function(d,_,m,v){const g=[];for(const T of m.coordinates)g.push(yo(T[0]),vo(T[1]),0);d.push(Qt(_,"MultiPoint",g,v))})(r,l,e.geometry,e.properties);case"LineString":return void(function(d,_,m,v,g){const T={points:[]};zh(m.coordinates,T,v,!1),d.push(Qt(_,"LineString",T,g))})(r,l,e.geometry,u,e.properties);case"MultiLineString":return void(function(d,_,m,v,g,T){if(g.lineMetrics)for(const b of m.coordinates){const I={points:[]};zh(b,I,v,!1),d.push(Qt(_,"LineString",I,T))}else{const b=[];Dh(m.coordinates,b,v,!1),d.push(Qt(_,"MultiLineString",b,T))}})(r,l,e.geometry,u,i,e.properties);case"Polygon":return void(function(d,_,m,v,g){const T=[];Dh(m.coordinates,T,v,!0),d.push(Qt(_,"Polygon",T,g))})(r,l,e.geometry,u,e.properties);case"MultiPolygon":return void(function(d,_,m,v,g){const T=[];for(const b of m.coordinates){const I=[];Dh(b,I,v,!0),T.push(I)}d.push(Qt(_,"MultiPolygon",T,g))})(r,l,e.geometry,u,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function zh(r,e,i,a){let s,l,u=0;for(let _=0;_<r.length;_++){const m=yo(r[_][0]),v=vo(r[_][1]);e.points.push(m,v,0),_>0&&(u+=a?(s*v-m*l)/2:Math.sqrt(Math.pow(m-s,2)+Math.pow(v-l,2))),s=m,l=v}const d=e.points.length-3;e.points[2]=1,i>0&&Eh(e.points,0,d,i),e.points[d+2]=1,Ch(e),e.size=Math.abs(u),e.start=0,e.end=e.size}function Dh(r,e,i,a){for(let s=0;s<r.length;s++){const l={points:[]};zh(r[s],l,i,a),e.push(l)}}function yo(r){return r/360+.5}function vo(r){const e=Math.sin(r*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function wu(r){const e={type:"Feature",geometry:Nm(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function Nm(r){const{type:e,geometry:i}=r;switch(e){case"Point":return{type:e,coordinates:tp(i[0],i[1])};case"MultiPoint":return{type:e,coordinates:Tu(i)};case"LineString":return{type:e,coordinates:Tu(i.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:i.map((a=>Tu(a.points)))};case"MultiPolygon":return{type:e,coordinates:i.map((a=>a.map((s=>Tu(s.points)))))}}}function Tu(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(tp(r[i],r[i+1]));return e}function tp(r,e){return[ip(r),rp(e)]}function ip(r){return 360*(r-.5)}function rp(r){const e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var fi;function zn(r,e,i,a,s,l,u,d){if(a/=e,l>=(i/=e)&&u<a)return r;if(u<i||l>=a)return null;const _=[];for(const m of r){const v=s===fi.X?m.minX:m.minY,g=s===fi.X?m.maxX:m.maxY;if(v>=i&&g<a)_.push(m);else if(!(g<i||v>=a))switch(m.type){case"Point":case"MultiPoint":Um(m,_,i,a,s);continue;case"LineString":$m(m,_,i,a,s,d);continue;case"MultiLineString":Gm(m,_,i,a,s);continue;case"Polygon":Zm(m,_,i,a,s);continue;case"MultiPolygon":qm(m,_,i,a,s);continue}}return _.length?_:null}function Um(r,e,i,a,s){const l=[];(function(u,d,_,m,v){for(let g=0;g<u.length;g+=3){const T=u[g+v];T>=_&&T<=m&&xo(d,u[g],u[g+1],u[g+2])}})(r.geometry,l,i,a,s),l.length&&e.push(Qt(r.id,l.length===3?"Point":"MultiPoint",l,r.tags))}function $m(r,e,i,a,s,l){const u=[];if(np(r.geometry,u,i,a,s,!1,l.lineMetrics),u.length)if(l.lineMetrics)for(const d of u)e.push(Qt(r.id,"LineString",d,r.tags));else e.push(u.length>1?Qt(r.id,"MultiLineString",u,r.tags):Qt(r.id,"LineString",u[0],r.tags))}function Gm(r,e,i,a,s){const l=[];kh(r.geometry,l,i,a,s,!1),l.length&&e.push(l.length!==1?Qt(r.id,"MultiLineString",l,r.tags):Qt(r.id,"LineString",l[0],r.tags))}function Zm(r,e,i,a,s){const l=[];kh(r.geometry,l,i,a,s,!0),l.length&&e.push(Qt(r.id,"Polygon",l,r.tags))}function qm(r,e,i,a,s){const l=[];for(const u of r.geometry){const d=[];kh(u,d,i,a,s,!0),d.length&&l.push(d)}l.length&&e.push(Qt(r.id,"MultiPolygon",l,r.tags))}function np(r,e,i,a,s,l,u){let d=ap(r);const _=s===fi.X?Wm:Hm;let m,v,g=r.start;for(let A=0;A<r.points.length-3;A+=3){const z=r.points[A],L=r.points[A+1],k=r.points[A+2],F=r.points[A+3],O=r.points[A+4],V=s===fi.X?z:L,Y=s===fi.X?F:O;let J=!1;u&&(m=Math.sqrt(Math.pow(z-F,2)+Math.pow(L-O,2))),V<i?Y>i&&(v=_(d,z,L,F,O,i),u&&(d.start=g+m*v)):V>a?Y<a&&(v=_(d,z,L,F,O,a),u&&(d.start=g+m*v)):xo(d.points,z,L,k),Y<i&&V>=i&&(v=_(d,z,L,F,O,i),J=!0),Y>a&&V<=a&&(v=_(d,z,L,F,O,a),J=!0),!l&&J&&(u&&(d.end=g+m*v),e.push(d),d=ap(r)),u&&(g+=m)}let T=r.points.length-3;const b=r.points[T],I=r.points[T+1],M=s===fi.X?b:I;M>=i&&M<=a&&xo(d.points,b,I,r.points[T+2]),T=d.points.length-3,l&&T>=3&&(d.points[T]!==d.points[0]||d.points[T+1]!==d.points[1])&&xo(d.points,d.points[0],d.points[1],d.points[2]),d.points.length&&(Ch(d),e.push(d))}function ap(r){return{points:[],size:r.size,start:r.start,end:r.end}}function kh(r,e,i,a,s,l){for(const u of r)np(u,e,i,a,s,l,!1)}function xo(r,e,i,a){r.push(e,i,a)}function Wm(r,e,i,a,s,l){const u=(l-e)/(a-e);return xo(r.points,l,i+(s-i)*u,1),u}function Hm(r,e,i,a,s,l){const u=(l-i)/(s-i);return xo(r.points,e+(a-e)*u,l,1),u}function Rh(r,e){const i=e.buffer/e.extent;let a=r;const s=zn(r,1,-1-i,i,fi.X,-1,2,e),l=zn(r,1,1-i,2+i,fi.X,-1,2,e);return(s||l)&&(a=zn(r,1,-i,1+i,fi.X,-1,2,e)||[],s&&(a=sp(s,1).concat(a)),l&&(a=a.concat(sp(l,-1)))),a}function sp(r,e){const i=[];for(const a of r)switch(a.type){case"Point":case"MultiPoint":{const s=Xm(a.geometry,e);i.push(Qt(a.id,a.type,s,a.tags));continue}case"LineString":{const s=Lh(a.geometry,e);i.push(Qt(a.id,a.type,s,a.tags));continue}case"MultiLineString":case"Polygon":{const s=[];for(const l of a.geometry)s.push(Lh(l,e));i.push(Qt(a.id,a.type,s,a.tags));continue}case"MultiPolygon":{const s=[];for(const l of a.geometry){const u=[];for(const d of l)u.push(Lh(d,e));s.push(u)}i.push(Qt(a.id,a.type,s,a.tags));continue}}return i}function Xm(r,e){const i=[];for(let a=0;a<r.length;a+=3)i.push(r[a]+e,r[a+1],r[a+2]);return i}function Lh(r,e){const i={points:[],size:r.size};r.start!==void 0&&(i.start=r.start,i.end=r.end);for(let a=0;a<r.points.length;a+=3)i.points.push(r.points[a]+e,r.points[a+1],r.points[a+2]);return Ch(i),i}function Ym(r,e,i){const a=!!e.newGeometry,s=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(a){const l=r[0];let u=Ah({type:"FeatureCollection",features:[{type:"Feature",id:l.id,geometry:e.newGeometry,properties:s?op(l.tags,e):l.tags}]},i);return u=Rh(u,i),u}if(s){const l=[];for(const u of r){const d={...u};d.tags=op(d.tags,e),l.push(d)}return l}return r}function op(r,e){if(e.removeAllProperties)return{};const i={...r||{}};if(e.removeProperties)for(const a of e.removeProperties)delete i[a];if(e.addOrUpdateProperties)for(const{key:a,value:s}of e.addOrUpdateProperties)i[a]=s;return i}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(fi||(fi={}));const Fh={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class Km{constructor(e){this.options=Object.assign(Object.create(Fh),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const i=[];for(const a of e){if(!a.geometry)continue;const[s,l]=a.geometry.coordinates,[u,d]=[yo(s),vo(l)];i.push({id:a.id,type:"Point",geometry:[u,d],tags:a.properties})}this.createIndex(i)}initialize(e){const i=[];for(const a of e)a.type==="Point"&&i.push(a);this.createIndex(i)}updateIndex(e,i,a){this.options=Object.assign(Object.create(Fh),a.clusterOptions),this.initialize(e)}createIndex(e){const{log:i,minZoom:a,maxZoom:s}=this.options;i&&console.time("total time");const l=`prepare ${e.length} points`;i&&console.time(l),this.points=e;const u=[];for(let _=0;_<e.length;_++){const m=e[_];if(!m?.geometry)continue;let[v,g]=m.geometry;v=Math.fround(v),g=Math.fround(g),u.push(v,g,1/0,_,-1,1),this.options.reduce&&u.push(0)}let d=this.trees[s+1]=this.createTree(u);i&&console.timeEnd(l);for(let _=s;_>=a;_--){const m=Date.now();d=this.trees[_]=this.createTree(this.cluster(d,_)),i&&console.log("z%d: %d clusters in %dms",_,d.numItems,Date.now()-m)}i&&console.timeEnd("total time")}getClusters(e,i){return this.getClustersInternal(e,i).map((a=>wu(a)))}getClustersInternal(e,i){let a=((e[0]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[1]));let l=e[2]===180?180:((e[2]+180)%360+360)%360-180;const u=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)a=-180,l=180;else if(a>l){const g=this.getClustersInternal([a,s,180,u],i),T=this.getClustersInternal([-180,s,l,u],i);return g.concat(T)}const d=this.trees[this.limitZoom(i)],_=d.range(yo(a),vo(u),yo(l),vo(s)),m=d.flatData,v=[];for(const g of _){const T=this.stride*g;v.push(m[T+5]>1?Jm(m,T,this.clusterProps):this.points[m[T+3]])}return v}getChildren(e){const i=this.getOriginId(e),a=this.getOriginZoom(e),s=new Error("No cluster with the specified id: "+e),l=this.trees[a];if(!l)throw s;const u=l.flatData;if(i*this.stride>=u.length)throw s;const d=this.options.radius/(this.options.extent*Math.pow(2,a-1)),_=l.within(u[i*this.stride],u[i*this.stride+1],d),m=[];for(const v of _){const g=v*this.stride;u[g+4]===e&&m.push(u[g+5]>1?Qm(u,g,this.clusterProps):wu(this.points[u[g+3]]))}if(m.length===0)throw s;return m}getLeaves(e,i,a){const s=[];return this.appendLeaves(s,e,i=i||10,a=a||0,0),s}getTile(e,i,a){const s=this.trees[this.limitZoom(e)];if(!s)return null;const l=Math.pow(2,e),{extent:u,radius:d}=this.options,_=d/u,m=(a-_)/l,v=(a+1+_)/l,g={transformed:!0,features:[],source:null,x:i,y:a,z:e};return this.addTileFeatures(s.range((i-_)/l,m,(i+1+_)/l,v),s.flatData,i,a,l,g),i===0&&this.addTileFeatures(s.range(1-_/l,m,1,v),s.flatData,l,a,l,g),i===l-1&&this.addTileFeatures(s.range(0,m,_/l,v),s.flatData,-1,a,l,g),g}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,i,a,s,l){const u=this.getChildren(i);for(const d of u){const _=d.properties;if(_?.cluster?l+_.point_count<=s?l+=_.point_count:l=this.appendLeaves(e,_.cluster_id,a,s,l):l<s?l++:e.push(d),e.length===a)break}return l}createTree(e){const i=new xu(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let a=0;a<e.length;a+=this.stride)i.add(e[a],e[a+1]);return i.finish(),i.flatData=e,i.data=null,i}addTileFeatures(e,i,a,s,l,u){for(const d of e){const _=d*this.stride,m=i[_+5]>1;let v,g,T;if(m)v=Bh(i,_,this.clusterProps),g=i[_],T=i[_+1];else{const M=this.points[i[_+3]];v=M.tags,[g,T]=M.geometry}const b={type:1,geometry:[[Math.round(this.options.extent*(g*l-a)),Math.round(this.options.extent*(T*l-s))]],tags:v};let I;I=m||this.options.generateId?i[_+3]:this.points[i[_+3]].id,I!==void 0&&(b.id=I),u.features.push(b)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,i){const{radius:a,extent:s,reduce:l,minPoints:u}=this.options,d=a/(s*Math.pow(2,i)),_=e.flatData,m=[],v=this.stride;for(let g=0;g<_.length;g+=v){if(_[g+2]<=i)continue;_[g+2]=i;const T=_[g],b=_[g+1],I=e.within(_[g],_[g+1],d),M=_[g+5];let A=M;for(const z of I){const L=z*v;_[L+2]>i&&(A+=_[L+5])}if(A>M&&A>=u){let z,L=T*M,k=b*M,F=-1;const O=(g/v<<5)+(i+1)+this.points.length;for(const V of I){const Y=V*v;if(_[Y+2]<=i)continue;_[Y+2]=i;const J=_[Y+5];L+=_[Y]*J,k+=_[Y+1]*J,_[Y+4]=O,l&&(z||(z=this.map(_,g,!0),F=this.clusterProps.length,this.clusterProps.push(z)),l(z,this.map(_,Y)))}_[g+4]=O,m.push(L/A,k/A,1/0,O,-1,A),l&&m.push(F)}else{for(let z=0;z<v;z++)m.push(_[g+z]);if(A>1)for(const z of I){const L=z*v;if(!(_[L+2]<=i)){_[L+2]=i;for(let k=0;k<v;k++)m.push(_[L+k])}}}}return m}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,i,a){if(e[i+5]>1){const u=this.clusterProps[e[i+6]];return a?Object.assign({},u):u}const s=this.points[e[i+3]].tags,l=this.options.map(s);return a&&l===s?Object.assign({},l):l}}function Jm(r,e,i){return{id:r[e+3],type:"Point",tags:Bh(r,e,i),geometry:[r[e],r[e+1]]}}function Qm(r,e,i){return{type:"Feature",id:r[e+3],properties:Bh(r,e,i),geometry:{type:"Point",coordinates:[ip(r[e]),rp(r[e+1])]}}}function Bh(r,e,i){const a=r[e+5],s=a>=1e4?`${Math.round(a/1e3)}
16k`:a>=1e3?Math.round(a/100)/10+"k":a,l=r[e+6],u=l===-1?{}:Object.assign({},i[l]);return Object.assign(u,{cluster:!0,cluster_id:r[e+3],point_count:a,point_count_abbreviated:s})}const Oh="geojsonvt_clip_start",jh="geojsonvt_clip_end";function lp(r,e,i,a,s){const l=e===s.maxZoom?0:s.tolerance/((1<<e)*s.extent),u={transformed:!1,features:[],source:null,x:i,y:a,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:r.length};for(const d of r)e_(u,d,l,s);return u}function e_(r,e,i,a){switch(r.minX=Math.min(r.minX,e.minX),r.minY=Math.min(r.minY,e.minY),r.maxX=Math.max(r.maxX,e.maxX),r.maxY=Math.max(r.maxY,e.maxY),e.type){case"Point":case"MultiPoint":return void(function(s,l){const u=[];for(let _=0;_<l.geometry.length;_+=3)u.push(l.geometry[_],l.geometry[_+1]),s.numPoints++,s.numSimplified++;if(!u.length)return;const d={type:1,tags:l.tags||null,geometry:u};l.id!==null&&(d.id=l.id),s.features.push(d)})(r,e);case"LineString":return void(function(s,l,u,d){const _=[];if(Vh(_,l.geometry,s,u,!1,!1),!_.length)return;let m=l.tags||null;if(d.lineMetrics){m={};for(const g in l.tags)m[g]=l.tags[g];m[Oh]=l.geometry.start/l.geometry.size,m[jh]=l.geometry.end/l.geometry.size}const v={type:2,tags:m,geometry:_};l.id!==null&&(v.id=l.id),s.features.push(v)})(r,e,i,a);case"MultiLineString":case"Polygon":return void(function(s,l,u){const d=[];for(let m=0;m<l.geometry.length;m++)Vh(d,l.geometry[m],s,u,l.type==="Polygon",m===0);if(!d.length)return;const _={type:l.type==="Polygon"?3:2,tags:l.tags||null,geometry:d};l.id!==null&&(_.id=l.id),s.features.push(_)})(r,e,i);case"MultiPolygon":return void(function(s,l,u){const d=[];for(let m=0;m<l.geometry.length;m++){const v=l.geometry[m];for(let g=0;g<v.length;g++)Vh(d,v[g],s,u,!0,g===0)}if(!d.length)return;const _={type:3,tags:l.tags||null,geometry:d};l.id!==null&&(_.id=l.id),s.features.push(_)})(r,e,i)}}function Vh(r,e,i,a,s,l){const u=a*a;if(a>0&&e.size<(s?u:a))return void(i.numPoints+=e.points.length/3);const d=[];for(let _=0;_<e.points.length;_+=3)(a===0||e.points[_+2]>u)&&(i.numSimplified++,d.push(e.points[_],e.points[_+1])),i.numPoints++;s&&(function(_,m){let v=0;for(let g=0,T=_.length,b=T-2;g<T;b=g,g+=2)v+=(_[g]-_[b])*(_[g+1]+_[b+1]);if(v>0===m)for(let g=0,T=_.length;g<T/2;g+=2){const b=_[g],I=_[g+1];_[g]=_[T-2-g],_[g+1]=_[T-1-g],_[T-2-g]=b,_[T-1-g]=I}})(d,l),r.push(d)}function cp(r,e){if(r.transformed)return r;const i=1<<r.z,a=r.x,s=r.y;for(const l of r.features)l.type===1?t_(l,e,i,a,s):i_(l,e,i,a,s);return r.transformed=!0,r}function t_(r,e,i,a,s){const l=r,u=r.geometry,d=[];for(let _=0;_<u.length;_+=2)d.push(up(u[_],u[_+1],e,i,a,s));return l.geometry=d,l}function i_(r,e,i,a,s){const l=r,u=r.geometry,d=[];for(const _ of u){const m=[];for(let v=0;v<_.length;v+=2)m.push(up(_[v],_[v+1],e,i,a,s));d.push(m)}return l.geometry=d,l}function up(r,e,i,a,s,l){return[Math.round(i*(r*a-s)),Math.round(i*(e*a-l))]}class r_{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,i,a){a.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),a.debug>1&&console.timeEnd("invalidating");const[s,l,u]=[0,0,0],d=lp(e,s,l,u,a);d.source=e;const _=Su(s,l,u);if(this.tiles[_]=d,this.tileCoords.push({z:s,x:l,y:u,id:_}),a.debug){const m=`z${s}`;this.stats[m]=(this.stats[m]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,i,a){return null}getTile(e,i,a){const{extent:s,debug:l}=this.options,u=1<<e,d=Su(e,i=i+u&u-1,a);if(this.tiles[d])return cp(this.tiles[d],s);l>1&&console.log("drilling down to z%d-%d-%d",e,i,a);let _,m=e,v=i,g=a;for(;!_&&m>0;)m--,v>>=1,g>>=1,_=this.tiles[Su(m,v,g)];return _?.source?(l>1&&(console.log("found parent tile z%d-%d-%d",m,v,g),console.time("drilling down")),this.splitTile(_.source,m,v,g,e,i,a),l>1&&console.timeEnd("drilling down"),this.tiles[d]?cp(this.tiles[d],s):null):null}splitTile(e,i,a,s,l,u,d){const _=[e,i,a,s],m=this.options,v=m.debug;for(;_.length;){s=_.pop(),a=_.pop(),i=_.pop(),e=_.pop();const g=1<<i,T=Su(i,a,s);let b=this.tiles[T];if(!b&&(v>1&&console.time("creation"),b=this.tiles[T]=lp(e,i,a,s,m),this.tileCoords.push({z:i,x:a,y:s,id:T}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,a,s,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));const J=`z${i}`;this.stats[J]=(this.stats[J]||0)+1,this.total++}
16if(b.source=e,l==null){if(i===m.indexMaxZoom||b.numPoints<=m.indexMaxPoints)continue}else{if(i===m.maxZoom||i===l)continue;if(l!=null){const J=l-i;if(a!==u>>J||s!==d>>J)continue}}if(b.source=null,!e.length)continue;v>1&&console.time("clipping");const I=.5*m.buffer/m.extent,M=.5-I,A=.5+I,z=1+I;let L=null,k=null,F=null,O=null;const V=zn(e,g,a-I,a+A,fi.X,b.minX,b.maxX,m),Y=zn(e,g,a+M,a+z,fi.X,b.minX,b.maxX,m);V&&(L=zn(V,g,s-I,s+A,fi.Y,b.minY,b.maxY,m),k=zn(V,g,s+M,s+z,fi.Y,b.minY,b.maxY,m)),Y&&(F=zn(Y,g,s-I,s+A,fi.Y,b.minY,b.maxY,m),O=zn(Y,g,s+M,s+z,fi.Y,b.minY,b.maxY,m)),v>1&&console.timeEnd("clipping"),_.push(L||[],i+1,2*a,2*s),_.push(k||[],i+1,2*a,2*s+1),_.push(F||[],i+1,2*a+1,2*s),_.push(O||[],i+1,2*a+1,2*s+1)}}invalidateTiles(e){if(!e.length)return;const i=this.options,{debug:a}=i;let s=1/0,l=-1/0,u=1/0,d=-1/0;for(const v of e)s=Math.min(s,v.minX),l=Math.max(l,v.maxX),u=Math.min(u,v.minY),d=Math.max(d,v.maxY);const _=i.buffer/i.extent,m=new Set;for(const v in this.tiles){const g=this.tiles[v],T=1<<g.z,b=(g.x-_)/T,I=(g.x+1+_)/T,M=(g.y-_)/T,A=(g.y+1+_)/T;if(l<b||s>=I||d<M||u>=A)continue;let z=!1;for(const L of e)if(L.maxX>=b&&L.minX<I&&L.maxY>=M&&L.minY<A){z=!0;break}if(z){if(a){a>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",g.z,g.x,g.y,g.numFeatures,g.numPoints,g.numSimplified);const L=`z${g.z}`;this.stats[L]=(this.stats[L]||0)-1,this.total--}delete this.tiles[v],m.add(v)}}m.size&&(this.tileCoords=this.tileCoords.filter((v=>!m.has(v.id))))}}function Su(r,e,i){return 32*((1<<r)*i+e)+r}const n_={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Fh,debug:0},a_=dt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:s_}=a_,o_=dt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:l_}=o_,c_=Math.cos(Math.PI/180*37.5),hp=Math.pow(2,14)/.5;class Nh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(const i of this.layers)this.gradients[i.id]={};this.layoutVertexArray=new X,this.layoutVertexArray2=new Z,this.indexArray=new de,this.programConfigurations=new br(e.layers,e.zoom),this.segments=new Se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){this.hasDependencies=_u("line",this.layers,i)||this.hasLineDasharray(this.layers);const s=this.layers[0].layout.get("line-sort-key"),l=!s.isConstant(),u=[];for(const{feature:d,id:_,index:m,sourceLayerIndex:v}of e){const g=this.layers[0]._featureFilter.needGeometry,T=Xr(d,g);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),T,a))continue;const b=l?s.evaluate(T,{},a):void 0,I={id:_,properties:d.properties,type:d.type,sourceLayerIndex:v,index:m,geometry:g?T.geometry:Hr(d),patterns:{},dashes:{},sortKey:b};u.push(I)}l&&u.sort(((d,_)=>d.sortKey-_.sortKey));for(const d of u){const{geometry:_,index:m,sourceLayerIndex:v}=d;this.hasDependencies?(_u("line",this.layers,i)?xh("line",this.layers,d,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,d,this.zoom,i),this.patternFeatures.push(d)):this.addFeature(d,_,m,a,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[m].feature,_,m,v,this.index)}}update(e,i,a,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a,dashPositions:s})}addFeatures(e,i,a,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,a,s,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,l_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,s_),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,Oh)&&Object.hasOwn(e.properties,jh)
vendor: 12,975 bytes, line 16
16)return{start:+e.properties[Oh],end:+e.properties[jh]}}addFeature(e,i,a,s,l,u,d){const _=this.layers[0].layout,m=_.get("line-join").evaluate(e,{}),v=_.get("line-cap").evaluate(e,{}),g=_.get("line-miter-limit").evaluate(e,{}),T=_.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(const b of i)this.addLine(b,e,m,v,g,T,s,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:l,dashPositions:u,canonical:s})}addLine(e,i,a,s,l,u,d,_){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=us(e,d?_.line.getGranularityForZoomLevel(d.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let k=0;k<e.length-1;k++)this.totalDistance+=e[k].dist(e[k+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Kl.types[i.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let g=0;for(;g<v-1&&e[g].equals(e[g+1]);)g++;if(v<(m?3:2))return;a==="bevel"&&(l=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,b=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let I,M,A,z,L;this.e1=this.e2=-1,m&&(I=e[v-2],L=e[g].sub(I)._unit()._perp());for(let k=g;k<v;k++){if(A=k===v-1?m?e[g+1]:void 0:e[k+1],A&&e[k].equals(A))continue;L&&(z=L),I&&(M=I),I=e[k],L=A?A.sub(I)._unit()._perp():z,z||(z=L);let F=z.add(L);F.x===0&&F.y===0||F._unit();const O=z.x*L.x+z.y*L.y,V=F.x*L.x+F.y*L.y,Y=V!==0?1/V:1/0,J=2*Math.sqrt(2-2*V),re=V<c_&&M&&A,te=z.x*L.y-z.y*L.x>0;if(re&&k>g){const ne=I.dist(M);if(ne>2*T){const ie=I.sub(I.sub(M)._mult(T/ne)._round());this.updateDistance(M,ie),this.addCurrentVertex(ie,z,0,0,b),M=ie}}const le=M&&A;let ce=le?a:m?"butt":s;if(le&&ce==="round"&&(Y<u?ce="miter":Y<=2&&(ce="fakeround")),ce==="miter"&&Y>l&&(ce="bevel"),ce==="bevel"&&(Y>2&&(ce="flipbevel"),Y<l&&(ce="miter")),M&&this.updateDistance(M,I),ce==="miter")F._mult(Y),this.addCurrentVertex(I,F,0,0,b);else if(ce==="flipbevel"){if(Y>100)F=L.mult(-1);else{const ne=Y*z.add(L).mag()/z.sub(L).mag();F._perp()._mult(ne*(te?-1:1))}this.addCurrentVertex(I,F,0,0,b),this.addCurrentVertex(I,F.mult(-1),0,0,b)}else if(ce==="bevel"||ce==="fakeround"){const ne=-Math.sqrt(Y*Y-1),ie=te?ne:0,_e=te?0:ne;if(M&&this.addCurrentVertex(I,z,ie,_e,b),ce==="fakeround"){const we=Math.round(180*J/Math.PI/20);for(let xe=1;xe<we;xe++){let ge=xe/we;if(ge!==.5){const Qe=ge-.5;ge+=ge*Qe*(ge-1)*((1.0904+O*(O*(3.55645-1.43519*O)-3.2452))*Qe*Qe+(.848013+O*(.215638*O-1.06021)))}const ke=L.sub(z)._mult(ge)._add(z)._unit()._mult(te?-1:1);this.addHalfVertex(I,ke.x,ke.y,!1,te,0,b)}}A&&this.addCurrentVertex(I,L,-ie,-_e,b)}else if(ce==="butt")this.addCurrentVertex(I,F,0,0,b);else if(ce==="square"){const ne=M?1:-1;this.addCurrentVertex(I,F,ne,ne,b)}else ce==="round"&&(M&&(this.addCurrentVertex(I,z,0,0,b),this.addCurrentVertex(I,z,1,1,b,!0)),A&&(this.addCurrentVertex(I,L,-1,-1,b,!0),this.addCurrentVertex(I,L,0,0,b)));if(re&&k<v-1){const ne=I.dist(A);if(ne>2*T){const ie=I.add(A.sub(I)._mult(T/ne)._round());this.updateDistance(I,ie),this.addCurrentVertex(ie,L,0,0,b),I=ie}}}}addCurrentVertex(e,i,a,s,l,u=!1){const d=i.y*s-i.x,_=-i.y-i.x*s;this.addHalfVertex(e,i.x+i.y*a,i.y-i.x*a,u,!1,a,l),this.addHalfVertex(e,d,_,u,!0,-s,l),this.distance>hp/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,a,s,l,u))}addHalfVertex({x:e,y:i},a,s,l,u,d,_){const m=.5*(this.lineClips?this.scaledDistance*(hp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(u?1:0),Math.round(63*a)+128,Math.round(63*s)+128,1+(d===0?0:d<0?-1:1)|(63&m)<<2,m>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),_.primitiveLength++),u?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const a=i.paint.get("line-dasharray");if(a&&!a.isConstant())return!0}return!1}addLineDashDependencies(e,i,a,s){for(const l of e){const u=l.paint.get("line-dasharray");if(!u||u.value.kind==="constant")continue;const d=l.layout.get("line-cap").evaluate(i,{})==="round",_={dasharray:u.value.evaluate({zoom:a-1},i,{}),round:d},m={dasharray:u.value.evaluate({zoom:a},i,{}),round:d},v={dasharray:u.value.evaluate({zoom:a+1},i,{}),round:d},g=`${_.dasharray.join(",")},${_.round}`,T=`${m.dasharray.join(",")},${m.round}`,b=`${v.dasharray.join(",")},${v.round}`;s.dashDependencies[g]=_,s.dashDependencies[T]=m,s.dashDependencies[b]=v,i.dashes[l.id]={min:g,mid:T,max:b}}}}let dp,pp;Ie("LineBucket",Nh,{omit:["layers","patternFeatures"]});var fp={get paint(){return pp=pp||new di({"line-opacity":new ze(ue.paint_line["line-opacity"]),"line-color":new ze(ue.paint_line["line-color"]),"line-translate":new Ee(ue.paint_line["line-translate"]),"line-translate-anchor":new Ee(ue.paint_line["line-translate-anchor"]),"line-width":new ze(ue.paint_line["line-width"]),"line-gap-width":new ze(ue.paint_line["line-gap-width"]),"line-offset":new ze(ue.paint_line["line-offset"]),"line-blur":new ze(ue.paint_line["line-blur"]),"line-dasharray":new Ur(ue.paint_line["line-dasharray"]),"line-pattern":new Ur(ue.paint_line["line-pattern"]),"line-gradient":new ha(ue.paint_line["line-gradient"])})},get layout(){return dp=dp||new di({"line-cap":new ze(ue.layout_line["line-cap"]),"line-join":new ze(ue.layout_line["line-join"]),"line-miter-limit":new ze(ue.layout_line["line-miter-limit"]),"line-round-limit":new ze(ue.layout_line["line-round-limit"]),"line-sort-key":new ze(ue.layout_line["line-sort-key"])})}};class u_ extends ze{possiblyEvaluate(e,i){return i=new ht(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,a,s){return i=Vi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,a,s)}}let Pu;class h_ extends Gi{constructor(e,i){super(e,fp,i),this.gradientVersion=0,Pu||(Pu=new u_(fp.paint.properties["line-width"].specification),Pu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(a){return a._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof Jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=Pu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Nh(e)}queryRadius(e){const i=e,a=mp(fo("line-width",this,i),fo("line-gap-width",this,i)),s=fo("line-offset",this,i);return a/2+Math.abs(s)+fu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:s,transform:l,pixelsToTileUnits:u}){const d=mu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,u),_=u/2*mp(this.paint.get("line-width").evaluate(i,a),this.paint.get("line-gap-width").evaluate(i,a)),m=this.paint.get("line-offset").evaluate(i,a);return m&&(s=(function(v,g){const T=[];for(const b of v){const I=em(b),M=[];for(let A=0;A<I.length;A++){const z=I[A],L=I[A-1],k=I[A+1],F=A===0?new Pe(0,0):z.sub(L)._unit()._perp(),O=A===I.length-1?new Pe(0,0):k.sub(z)._unit()._perp(),V=F._add(O)._unit(),Y=V.x*O.x+V.y*O.y;Y!==0&&V._mult(1/Y),M.push(V._mult(g)._add(z))}T.push(M)}return T})(s,m*u)),(function(v,g,T){for(const b of g){if(v.length>=3){for(const I of b)if(po(v,I))return!0}if(Kf(v,b,T))return!0}return!1})(d,s,_)}isTileClipped(){return!0}}function mp(r,e){return e>0?e+2*r:r}const d_=dt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),p_=dt([{name:"a_projected_pos",components:3,type:"Float32"}],4);dt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const f_=dt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);dt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const _p=dt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),m_=dt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function __(r,e,i){const a=e.layout.get("text-transform").evaluate(i,{});return a==="uppercase"?r=r.toLocaleUpperCase():a==="lowercase"&&(r=r.toLocaleLowerCase()),yr.applyArabicShaping&&(r=yr.applyArabicShaping(r)),r}function g_(r,e,i){for(const a of r.sections)a.text=__(a.text,e,i);return r}dt([{name:"triangle",components:3,type:"Uint16"}]),dt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),dt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),dt([{type:"Float32",name:"offsetX"}]),dt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),dt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Ut=24;const ic={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â¯":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},y_={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},v_={40:!0};function gp(r,e,i,a,s,l){if("fontStack"in e){const u=i[e.fontStack],d=u?.[r];return d?d.metrics.advance*e.scale+s:0}{const u=a[e.imageName];return u?u.displaySize[0]*e.scale*Ut/l+s:0}}function yp(r,e,i,a){const s=Math.pow(r-e,2);return a?r<e?s/2:2*s:s+Math.abs(i)*i}function x_(r,e,i){let a=0;return r===10&&(a-=1e4),i&&(a+=150),r!==40&&r!==65288||(a+=50),e!==41&&e!==65289||(a+=50),a}function vp(r,e,i,a,s,l){let u=null,d=yp(e,i,s,l);for(const _ of a){const m=yp(e-_.x,i,s,l)+_.badness;
16m<=d&&(u=_,d=m)}return{index:r,x:e,priorBreak:u,badness:d}}function xp(r){return r?xp(r.priorBreak).concat(r.index):[]}class bo{constructor(e="",i=[],a=[]){this.text=e,this.sections=i,this.sectionIndex=a,this.imageSectionID=null}static fromFeature(e,i){const a=new bo;for(const s of e.sections)s.image?a.addImageSection(s):a.addTextSection(s,i);return a}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let i="",a={premature:!0,value:void 0};const s=e[Symbol.iterator]();let l=s.next();const u=e[Symbol.iterator]();u.next();let d=u.next();for(;!l.done;)i+=!d.done&&El(d.value.codePointAt(0))&&!ic[d.value]||!a.premature&&El(a.value.codePointAt(0))&&!ic[a.value]||!ic[l.value]?l.value:ic[l.value],a={value:l.value,premature:!1},l=s.next(),d=u.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("â")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,a=this.text.match(/\S\s*$/),s=a?a[0].length-1:0;this.text=this.text.substring(i,this.text.length-s),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-s)}substring(e,i){const a=[...this.text].slice(e,i).join(""),s=this.sectionIndex.slice(e,i);return new bo(a,this.sections,s)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,a=0;for(let s=0;s<this.length();s++){const l=this.getSection(s);if("imageName"in l){const u=e[l.imageName];if(!u)continue;const d=u.displaySize;i=Math.max(i,d[0]),a=Math.max(a,d[1])}}return{maxImageWidth:i,maxImageHeight:a}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const a=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>a)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void Ht("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):Ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,a,s,l){const u=[],d=this.determineAverageLineWidth(e,i,a,s,l),_=this.hasZeroWidthSpaces();let m=0,v=0;const g=this.text[Symbol.iterator]();let T=g.next();const b=this.text[Symbol.iterator]();b.next();let I=b.next();const M=this.text[Symbol.iterator]();M.next(),M.next();let A=M.next();for(;!T.done;){const z=this.getSection(v),L=T.value.codePointAt(0);if(ru(L)||(m+=gp(L,z,a,s,e,l)),!I.done){const k=lh(L),F=I.value.codePointAt(0);(y_[L]||k||"imageName"in z||!A.done&&v_[F])&&u.push(vp(v+1,m,d,u,x_(L,F,k&&_),!1))}v++,T=g.next(),I=b.next(),A=M.next()}return xp(vp(this.length(),m,d,u,0,!0))}determineAverageLineWidth(e,i,a,s,l){let u=0,d=0;for(const _ of this.text){const m=this.getSection(d);u+=gp(_.codePointAt(0),m,a,s,e,l),d++}return u/Math.max(1,Math.ceil(u/i))}}const Uh=4294967296,bp=1/Uh,wp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class Iu{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,i,a=this.length){for(;this.pos<a;){const s=this.readVarint(),l=s>>3,u=this.pos;this.type=7&s,e(l,i,this),this.pos===u&&this.skip(s)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Uh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Uh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let a,s;return s=i[this.pos++],a=127&s,s<128?a:(s=i[this.pos++],a|=(127&s)<<7,s<128?a:(s=i[this.pos++],a|=(127&s)<<14,s<128?a:(s=i[this.pos++],a|=(127&s)<<21,s<128?a:(s=i[this.pos],a|=(15&s)<<28,(function(l,u,d){const _=d.buf;let m,v;if(v=_[d.pos++],m=(112&v)>>4,v<128||(v=_[d.pos++],m|=(127&v)<<3,v<128)||(v=_[d.pos++],m|=(127&v)<<10,v<128)||(v=_[d.pos++],m|=(127&v)<<17,v<128)||(v=_[d.pos++],m|=(127&v)<<24,v<128)||(v=_[d.pos++],m|=(1&v)<<31,v<128))return wo(l,m,u);throw new Error("Expected varint not more than 10 bytes")})(a,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&wp?wp.decode(this.buf.subarray(i,e)):(function(a,s,l){let u="",d=s;for(;d<l;){const _=a[d];let m,v,g,T=null,b=_>239?4:_>223?3:_>191?2:1;if(d+b>l)break;b===1?_<128&&(T=_):b===2?(m=a[d+1],(192&m)==128&&(T=(31&_)<<6|63&m,T<=127&&(T=null))):b===3?(m=a[d+1],v=a[d+2],(192&m)==128&&(192&v)==128&&(T=(15&_)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):b===4&&(m=a[d+1],v=a[d+2],g=a[d+3],(192&m)==128&&(192&v)==128&&(192&g)==128&&(T=(15&_)<<18|(63&m)<<12|(63&v)<<6|63&g,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,b=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),d+=b}return u})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const a=this.readPackedEnd();for(;this.pos<a;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const a=new Uint8Array(i);a.set(this.buf),this.buf=a,this.dataView=new DataView(a.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}
vendor: 4,424 bytes, line 16
16writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*bp),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*bp),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,a){let s,l;if(i>=0?(s=i%4294967296|0,l=i/4294967296|0):(s=~(-i%4294967296),l=~(-i/4294967296),4294967295^s?s=s+1|0:(s=0,l=l+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),(function(u,d,_){_.buf[_.pos++]=127&u|128,u>>>=7,_.buf[_.pos++]=127&u|128,u>>>=7,_.buf[_.pos++]=127&u|128,u>>>=7,_.buf[_.pos++]=127&u|128,_.buf[_.pos]=127&(u>>>=7)})(s,0,a),(function(u,d){const _=(7&u)<<4;d.buf[d.pos++]|=_|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))})(l,a)})(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(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const i=this.pos;this.pos=(function(s,l,u){for(let d,_,m=0;m<l.length;m++){if(d=l.charCodeAt(m),d>55295&&d<57344){if(!_){d>56319||m+1===l.length?(s[u++]=239,s[u++]=191,s[u++]=189):_=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,_=d;continue}d=_-55296<<10|d-56320|65536,_=null}else _&&(s[u++]=239,s[u++]=191,s[u++]=189,_=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u})(this.buf,e,this.pos);const a=this.pos-i;a>=128&&Tp(i,a,this),this.pos=i-1,this.writeVarint(a),this.pos+=a}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const i=e.length;this.writeVarint(i),this.realloc(i);for(let a=0;a<i;a++)this.buf[this.pos++]=e[a]}writeRawMessage(e,i){this.pos++;const a=this.pos;e(i,this);const s=this.pos-a;s>=128&&Tp(a,s,this),this.pos=a-1,this.writeVarint(s),this.pos+=s}writeMessage(e,i,a){this.writeTag(e,2),this.writeRawMessage(i,a)}writePackedVarint(e,i){i.length&&this.writeMessage(e,b_,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,w_,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,P_,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,T_,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,S_,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,I_,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,M_,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,E_,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,C_,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function wo(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Tp(r,e,i){const a=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(a);for(let s=i.pos-1;s>=r;s--)i.buf[s+a]=i.buf[s]}function b_(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function w_(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function T_(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function S_(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function P_(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function I_(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function M_(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function E_(r,e){for(let i=0;i<r.length;
16i++)e.writeFixed64(r[i])}function C_(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function A_(r,e,i){r===1&&i.readMessage(z_,e)}function z_(r,e,i){if(r===3){const{id:a,bitmap:s,width:l,height:u,left:d,top:_,advance:m}=i.readMessage(D_,{});e.push({id:a,bitmap:new Gl({width:l+6,height:u+6},s),metrics:{width:l,height:u,left:d,top:_,advance:m}})}}function D_(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function Sp(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort(((u,d)=>d.h-u.h));const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let s=0,l=0;for(const u of r)for(let d=a.length-1;d>=0;d--){const _=a[d];if(!(u.w>_.w||u.h>_.h)){if(u.x=_.x,u.y=_.y,l=Math.max(l,u.y+u.h),s=Math.max(s,u.x+u.w),u.w===_.w&&u.h===_.h){const m=a.pop();m&&d<a.length&&(a[d]=m)}else u.h===_.h?(_.x+=u.w,_.w-=u.w):u.w===_.w?(_.y+=u.h,_.h-=u.h):(a.push({x:_.x+u.w,y:_.y,w:_.w-u.w,h:u.h}),_.y+=u.h,_.h-=u.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}class $h{constructor(e,{pixelRatio:i,version:a,stretchX:s,stretchY:l,content:u,textFitWidth:d,textFitHeight:_}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=s,this.stretchY=l,this.content=u,this.version=a,this.textFitWidth=d,this.textFitHeight=_}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Pp{constructor(e,i){const a={},s={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,a,l),this.addImages(i,s,l);const{w:u,h:d}=Sp(l),_=new Fi({width:u||1,height:d||1});for(const m in e){const v=e[m],g=a[m].paddedRect;Fi.copy(v.data,_,{x:0,y:0},{x:g.x+1,y:g.y+1},v.data)}for(const m in i){const v=i[m],g=s[m].paddedRect,T=g.x+1,b=g.y+1,I=v.data.width,M=v.data.height;Fi.copy(v.data,_,{x:0,y:0},{x:T,y:b},v.data),Fi.copy(v.data,_,{x:0,y:M-1},{x:T,y:b-1},{width:I,height:1}),Fi.copy(v.data,_,{x:0,y:0},{x:T,y:b+M},{width:I,height:1}),Fi.copy(v.data,_,{x:I-1,y:0},{x:T-1,y:b},{width:1,height:M}),Fi.copy(v.data,_,{x:0,y:0},{x:T+I,y:b},{width:1,height:M})}this.image=_,this.iconPositions=a,this.patternPositions=s}addImages(e,i,a){for(const s in e){const l=e[s],u={x:0,y:0,w:l.data.width+2,h:l.data.height+2};a.push(u),i[s]=new $h(u,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(s)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in e.updatedImages)this.patchUpdatedImage(this.iconPositions[a],e.getImage(a),i),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a),i)}patchUpdatedImage(e,i,a){if(!e||!i||e.version===i.version)return;e.version=i.version;const[s,l]=e.tl;a.update(i.data,void 0,{x:s,y:l})}}var pa;function Mu(r,e,i,a,s,l,u,d,_,m,v,g,T,b,I){const M=bo.fromFeature(r,s);let A;g===R.ax.vertical&&M.verticalizePunctuation();let z=M.determineLineBreaks(m,l,e,a,b);const{processBidirectionalText:L,processStyledBidirectionalText:k}=yr;if(L&&M.sections.length===1){A=[],z=z.map((Y=>M.toCodeUnitIndex(Y)));const V=L(M.toString(),z);for(const Y of V){const J=[...Y].map((()=>0));A.push(new bo(Y,M.sections,J))}}else if(k){A=[],z=z.map((re=>M.toCodeUnitIndex(re)));let V=0;const Y=[];for(const re of M.text)Y.push(...Array(re.length).fill(M.sectionIndex[V])),V++;const J=k(M.text,Y,z);for(const re of J){const te=[];let le="";for(const ce of re[0])te.push(re[1][le.length]),le+=ce;A.push(new bo(re[0],M.sections,te))}}else A=(function(V,Y){const J=[];let re=0;for(const te of Y)J.push(V.substring(re,te)),re=te;return re<V.length()&&J.push(V.substring(re,V.length())),J})(M,z);const F=[],O={positionedLines:F,text:M.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:g,iconsInText:!1,verticalizable:!1};return(function(V,Y,J,re,te,le,ce,ne,ie,_e,we,xe){let ge=0,ke=0,Qe=0,tt=0;const st=ne==="right"?1:ne==="left"?0:.5,oi=Ut/xe;let Pt=0;for(const mt of te){mt.trim();const ei=mt.getMaxScale(),_i={positionedGlyphs:[],lineOffset:0};V.positionedLines[Pt]=_i;const gi=_i.positionedGlyphs;let Bi=0;if(!mt.length()){ke+=le,++Pt;continue}const li=k_(re,mt,oi);let Oi=0;for(const Zt of mt.text){const xt=mt.getSection(Oi),Lt=Zt.codePointAt(0),It=R_(ie,we,Lt),qt={glyph:Lt,imageName:null,x:ge,y:ke+-17,vertical:It,scale:1,fontStack:"",sectionIndex:mt.getSectionIndex(Oi),metrics:null,rect:null};let Rn;if("fontStack"in xt){if(Rn=L_(xt,Lt,It,li,Y,J),!Rn)continue;qt.fontStack=xt.fontStack}else{if(V.iconsInText=!0,xt.scale*=oi,Rn=F_(xt,It,ei,li,re),!Rn)continue;Bi=Math.max(Bi,Rn.imageOffset),qt.imageName=xt.imageName}const{rect:Sr,metrics:oc,baselineOffset:xa}=Rn;qt.y+=xa,qt.scale=xt.scale,qt.metrics=oc,qt.rect=Sr,gi.push(qt),It?(V.verticalizable=!0,ge+=("imageName"in xt?oc.advance:Ut)*xt.scale+_e):ge+=oc.advance*xt.scale+_e,Oi++}gi.length!==0&&(Qe=Math.max(ge-_e,Qe),B_(gi,0,gi.length-1,st)),ge=0,_i.lineOffset=Math.max(Bi,(ei-1)*Ut);const hr=le*ei+Bi;ke+=hr,tt=Math.max(hr,tt),++Pt}const{horizontalAlign:Ot,verticalAlign:Gt}=Gh(ce);(function(mt,ei,_i,gi,Bi,li,Oi,hr,Zt){const xt=(ei-_i)*Bi;let Lt=0;
vendor: 29,975 bytes, line 16
16Lt=li!==Oi?-hr*gi- -17:-gi*Zt*Oi+.5*Oi;for(const It of mt)for(const qt of It.positionedGlyphs)qt.x+=xt,qt.y+=Lt})(V.positionedLines,st,Ot,Gt,Qe,tt,le,ke,te.length),V.top+=-Gt*ke,V.bottom=V.top+ke,V.left+=-Ot*Qe,V.right=V.left+Qe})(O,e,i,a,A,u,d,_,g,m,T,I),!(function(V){for(const Y of V)if(Y.positionedGlyphs.length!==0)return!1;return!0})(F)&&O}function Gh(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function k_(r,e,i){const a=e.getMaxScale()*Ut,{maxImageWidth:s,maxImageHeight:l}=e.getMaxImageSize(r),u=Math.max(a,l*i);return{verticalLineContentWidth:Math.max(a,s*i),horizontalLineContentHeight:u}}function Ip(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function R_(r,e,i){return!(r===R.ax.horizontal||!e&&!Mn(i)||e&&(ru(i)||(a=i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function L_(r,e,i,a,s,l){const u=l[r.fontStack],d=(function(m,v,g,T){if(m?.rect)return m;const b=v[g.fontStack],I=b?.[T];return I?{rect:null,metrics:I.metrics}:null})(u?.[e],s,r,e);if(d===null)return null;let _;if(i)_=a.verticalLineContentWidth-r.scale*Ut;else{const m=Ip(r.verticalAlign);_=(a.horizontalLineContentHeight-r.scale*Ut)*m}return{rect:d.rect,metrics:d.metrics,baselineOffset:_}}function F_(r,e,i,a,s){const l=s[r.imageName];if(!l)return null;const u=l.paddedRect,d=l.displaySize,_={width:d[0],height:d[1],left:1,top:-3,advance:e?d[1]:d[0]};let m;if(e)m=a.verticalLineContentWidth-d[1]*r.scale;else{const v=Ip(r.verticalAlign);m=(a.horizontalLineContentHeight-d[1]*r.scale)*v}return{rect:u,metrics:_,baselineOffset:m,imageOffset:(e?d[0]:d[1])*r.scale-Ut*i}}function B_(r,e,i,a){if(a===0)return;const s=r[i],l=(r[i].x+s.metrics.advance*s.scale)*a;for(let u=e;u<=i;u++)r[u].x-=l}function O_(r,e,i){const{horizontalAlign:a,verticalAlign:s}=Gh(i),l=e[0]-r.displaySize[0]*a,u=e[1]-r.displaySize[1]*s;return{image:r,top:u,bottom:u+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function Mp(r){var e,i;let a=r.left,s=r.top,l=r.right-a,u=r.bottom-s;const d=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",_=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",m=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(_==="proportional"){if(d==="stretchOnly"&&l/u<m||d==="proportional"){const v=Math.ceil(u*m);a*=v/l,l=v}}else if(d==="proportional"&&_==="stretchOnly"&&m!==0&&l/u>m){const v=Math.ceil(l/m);s*=v/u,u=v}return{x1:a,y1:s,x2:a+l,y2:s+u}}function Ep(r,e,i,a,s,l){const u=r.image;let d;if(u.content){const A=u.content,z=u.pixelRatio||1;d=[A[0]/z,A[1]/z,u.displaySize[0]-A[2]/z,u.displaySize[1]-A[3]/z]}const _=e.left*l,m=e.right*l;let v,g,T,b;i==="width"||i==="both"?(b=s[0]+_-a[3],g=s[0]+m+a[1]):(b=s[0]+(_+m-u.displaySize[0])/2,g=b+u.displaySize[0]);const I=e.top*l,M=e.bottom*l;return i==="height"||i==="both"?(v=s[1]+I-a[0],T=s[1]+M+a[2]):(v=s[1]+(I+M-u.displaySize[1])/2,T=v+u.displaySize[1]),{image:u,top:v,right:g,bottom:T,left:b,collisionPadding:d}}Ie("ImagePosition",$h),Ie("ImageAtlas",Pp),R.ax=void 0,(pa=R.ax||(R.ax={}))[pa.none=0]="none",pa[pa.horizontal=1]="horizontal",pa[pa.vertical=2]="vertical",pa[pa.horizontalOnly=3]="horizontalOnly";const Dn=128,fa=32640;function Cp(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new ht(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:s}=i;let l=0;for(;l<a.length&&a[l]<=r;)l++;l=Math.max(0,l-1);let u=l;for(;u<a.length&&a[u]<r+1;)u++;u=Math.min(a.length-1,u);const d=a[l],_=a[u];return i.kind==="composite"?{kind:"composite",minZoom:d,maxZoom:_,interpolationType:s}:{kind:"camera",minZoom:d,maxZoom:_,minSize:i.evaluate(new ht(d)),maxSize:i.evaluate(new ht(_)),interpolationType:s}}}function Zh(r,e,i){let a="never";const s=r.get(e);return s?a=s:r.get(i)&&(a="always"),a}const j_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Eu(r,e,i,a,s,l,u,d,_,m,v,g,T){const b=d?Math.min(fa,Math.round(d[0])):0,I=d?Math.min(fa,Math.round(d[1])):0;r.emplaceBack(e,i,Math.round(32*a),Math.round(32*s),l,u,(b<<1)+(_?1:0),I,16*m,16*v,256*g,256*T)}function qh(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function V_(r){for(const e of r.sections)if(Al(e.text))return!0;return!1}class Wh{constructor(e){this.layoutVertexArray=new q,this.indexArray=new de,this.programConfigurations=e,this.segments=new Se,this.dynamicLayoutVertexArray=new Q,this.opacityVertexArray=new ae,this.hasVisibleVertices=!1,this.placedSymbolArray=new y}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,a,s){this.isEmpty()||(a&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,d_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,p_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,j_,!0),this.opacityVertexBuffer.itemSize=1),(a||s)&&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())}}Ie("SymbolBuffers",Wh);class Hh{constructor(e,i,a){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new a,this.segments=new Se,this.collisionVertexArray=new fe}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,f_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ie("CollisionBuffers",Hh);class To{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cp(this.zoom,i["text-size"]),this.iconSizeData=Cp(this.zoom,i["icon-size"]);const a=this.layers[0].layout,s=a.get("symbol-sort-key"),l=a.get("symbol-z-order");this.canOverlap=Zh(a,"text-overlap","text-allow-overlap")!=="never"||Zh(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!s.isConstant(),this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map((u=>R.ax[u]))),this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Wh(new br(this.layers,this.zoom,(e=>e.startsWith("text")))),this.icon=new Wh(new br(this.layers,this.zoom,(e=>e.startsWith("icon")))),this.glyphOffsetArray=new S,this.lineVertexArray=new P,this.symbolInstances=new w,this.textAnchorOffsets=new C}calculateGlyphDependencies(e,i,a,s,l){for(const u of e)if(i[u.codePointAt(0)]=!0,(a||s)&&l){const d=ic[u];d&&(i[d.codePointAt(0)]=!0)}}populate(e,i,a){var s;const l=this.layers[0],u=l.layout,d=u.get("text-font"),_=u.get("text-field"),m=u.get("icon-image"),v=(_.value.kind!=="constant"||_.value.value instanceof wi&&!_.value.value.isEmpty()||_.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),g=m.value.kind!=="constant"||!!m.value.value||Object.keys(m.parameters).length>0,T=u.get("symbol-sort-key");if(this.features=[],!v&&!g)return;const b=i.iconDependencies,I=i.glyphDependencies,M=i.availableImages,A=new ht(this.zoom);for(const{feature:z,id:L,index:k,sourceLayerIndex:F}of e){const O=l._featureFilter.needGeometry,V=Xr(z,O);if(!l._featureFilter.filter(A,V,a))continue;let Y,J;if(O||(V.geometry=Hr(z)),v){const te=l.getValueAndResolveTokens("text-field",V,a,M),le=wi.factory(te);this.hasRTLText||(this.hasRTLText=V_(le)),(!this.hasRTLText||yr.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&yr.isParsed())&&(Y=g_(le,l,V))}if(g){const te=l.getValueAndResolveTokens("icon-image",V,a,M);J=te instanceof zi?te:zi.fromString(te)}if(!Y&&!J)continue;const re=this.sortFeaturesByKey?T.evaluate(V,{},a):void 0;if(this.features.push({id:L,text:Y,icon:J,index:k,sourceLayerIndex:F,geometry:V.geometry,properties:z.properties,type:Kl.types[z.type],sortKey:re}),J&&(b[J.name]=!0),Y){const te=d.evaluate(V,{},a).join(","),le=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=(s=this.writingModes)===null||s===void 0?void 0:s.includes(R.ax.vertical);for(const ce of Y.sections)if(ce.image)b[ce.image.name]=!0;else{const ne=Il(Y.toString()),ie=ce.fontStack||te;I[ie]||(I[ie]={}),this.calculateGlyphDependencies(ce.text,I[ie],le,this.allowVerticalPlacement,ne)}}}u.get("symbol-placement")==="line"&&(this.features=(function(z){const L={},k={},F=[];let O=0;function V(te){F.push(z[te]),O++}function Y(te,le,ce){const ne=k[te];return delete k[te],k[le]=ne,F[ne].geometry[0].pop(),F[ne].geometry[0]=F[ne].geometry[0].concat(ce[0]),ne}function J(te,le,ce){const ne=L[le];return delete L[le],L[te]=ne,F[ne].geometry[0].shift(),F[ne].geometry[0]=ce[0].concat(F[ne].geometry[0]),ne}function re(te,le,ce){const ne=ce?le[0][le[0].length-1]:le[0][0];return`${te}:${ne.x}:${ne.y}`}for(let te=0;te<z.length;te++){const le=z[te],ce=le.geometry,ne=le.text?le.text.toString():null;if(!ne){V(te);continue}const ie=re(ne,ce),_e=re(ne,ce,!0);if(ie in k&&_e in L&&k[ie]!==L[_e]){const we=J(ie,_e,ce),xe=Y(ie,_e,F[we].geometry);delete L[ie],delete k[_e],k[re(ne,F[xe].geometry,!0)]=xe,F[we].geometry=null}else ie in k?Y(ie,_e,ce):_e in L?J(ie,_e,ce):(V(te),L[ie]=O-1,k[_e]=O-1)}return F.filter((te=>te.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((z,L)=>z.sortKey-L.sortKey))}update(e,i,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:a}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:a}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const a=this.lineVertexArray.length;if(e.segment!==void 0){let s=e.dist(i[e.segment+1]),l=e.dist(i[e.segment]);const u={};for(let d=e.segment+1;d<i.length;d++)u[d]={x:i[d].x,y:i[d].y,tileUnitDistanceFromAnchor:s},d<i.length-1&&(s+=i[d+1].dist(i[d]));for(let d=e.segment||0;d>=0;d--)u[d]={x:i[d].x,y:i[d].y,tileUnitDistanceFromAnchor:l},d>0&&(l+=i[d-1].dist(i[d]));for(let d=0;d<i.length;d++){const _=u[d];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(e,i,a,s,l,u,d,_,m,v,g,T){const b=e.indexArray,I=e.layoutVertexArray,M=e.segments.prepareSegment(4*i.length,I,b,this.canOverlap?u.sortKey:void 0),A=this.glyphOffsetArray.length,z=M.vertexLength,L=this.allowVerticalPlacement&&d===R.ax.vertical?Math.PI/2:0,k=u.text&&u.text.sections;for(let F=0;F<i.length;F++){const{tl:O,tr:V,bl:Y,br:J,tex:re,pixelOffsetTL:te,pixelOffsetBR:le,minFontScaleX:ce,minFontScaleY:ne,glyphOffset:ie,isSDF:_e,sectionIndex:we}=i[F],xe=M.vertexLength,ge=ie[1];Eu(I,_.x,_.y,O.x,ge+O.y,re.x,re.y,a,_e,te.x,te.y,ce,ne),Eu(I,_.x,_.y,V.x,ge+V.y,re.x+re.w,re.y,a,_e,le.x,te.y,ce,ne),Eu(I,_.x,_.y,Y.x,ge+Y.y,re.x,re.y+re.h,a,_e,te.x,le.y,ce,ne),Eu(I,_.x,_.y,J.x,ge+J.y,re.x+re.w,re.y+re.h,a,_e,le.x,le.y,ce,ne),qh(e.dynamicLayoutVertexArray,_,L),b.emplaceBack(xe,xe+2,xe+1),b.emplaceBack(xe+1,xe+2,xe+3),M.vertexLength+=4,M.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ie[0]),F!==i.length-1&&we===i[F+1].sectionIndex||e.programConfigurations.populatePaintArrays(I.length,u,u.index,{imagePositions:{},canonical:T,formattedSection:k?.[we]})}e.placedSymbolArray.emplaceBack(_.x,_.y,A,this.glyphOffsetArray.length-A,z,m,v,_.segment,a?a[0]:0,a?a[1]:0,s[0],s[1],d,0,!1,0,g)}_addCollisionDebugVertex(e,i,a,s,l,u){return i.emplaceBack(0,0),e.emplaceBack(a.x,a.y,s,l,Math.round(u.x),Math.round(u.y))}addCollisionDebugVertices(e,i,a,s,l,u,d){const _=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),m=_.vertexLength,v=l.layoutVertexArray,g=l.collisionVertexArray,T=d.anchorX,b=d.anchorY;this._addCollisionDebugVertex(v,g,u,T,b,new Pe(e,i)),this._addCollisionDebugVertex(v,g,u,T,b,new Pe(a,i)),this._addCollisionDebugVertex(v,g,u,T,b,new Pe(a,s)),this._addCollisionDebugVertex(v,g,u,T,b,new Pe(e,s)),_.vertexLength+=4;const I=l.indexArray;I.emplaceBack(m,m+1),I.emplaceBack(m+1,m+2),I.emplaceBack(m+2,m+3),I.emplaceBack(m+3,m),_.primitiveLength+=4}addDebugCollisionBoxes(e,i,a,s){for(let l=e;l<i;l++){const u=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(u.x1,u.y1,u.x2,u.y2,s?this.textCollisionBox:this.iconCollisionBox,u.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hh(oe,_p.members,Me),this.iconCollisionBox=new Hh(oe,_p.members,Me);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,a,s,l,u,d,_,m){const v={};for(let g=i;g<a;g++){const T=e.get(g);v.textBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.textFeatureIndex=T.featureIndex;break}for(let g=s;g<l;g++){const T=e.get(g);v.verticalTextBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalTextFeatureIndex=T.featureIndex;break}for(let g=u;g<d;g++){const T=e.get(g);v.iconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.iconFeatureIndex=T.featureIndex;break}for(let g=_;g<m;g++){const T=e.get(g);v.verticalIconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalIconFeatureIndex=T.featureIndex;break}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const a=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,i){const a=e.placedSymbolArray.get(i),s=a.vertexStartIndex+4*a.numGlyphs;for(let l=a.vertexStartIndex;l<s;l+=4)e.indexArray.emplaceBack(l,l+2,l+1),e.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),a=Math.cos(e),s=[],l=[],u=[];for(let d=0;d<this.symbolInstances.length;++d){u.push(d);const _=this.symbolInstances.get(d);s.push(0|Math.round(i*_.anchorX+a*_.anchorY)),l.push(_.featureIndex)}return u.sort(((d,_)=>s[d]-s[_]||l[_]-l[d])),u}addToSortKeyRanges(e,i){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a?.sortKey===i?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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 i of this.symbolInstanceIndexes){const a=this.symbolInstances.get(i);this.featureSortOrder.push(a.featureIndex);const s=[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex];for(let l=0;l<s.length;l++){const u=s[l];u>=0&&s.indexOf(u)===l&&this.addIndicesForPlacedSymbol(this.text,u)}a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ap,zp;Ie("SymbolBucket",To,{omit:["layers","collisionBoxArray","features","compareText"]}),To.MAX_GLYPHS=65535,To.addDynamicAttributes=qh;var Xh={get paint(){return zp=zp||new di({"icon-opacity":new ze(ue.paint_symbol["icon-opacity"]),"icon-color":new ze(ue.paint_symbol["icon-color"]),"icon-halo-color":new ze(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new ze(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ze(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new Ee(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ee(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new ze(ue.paint_symbol["text-opacity"]),"text-color":new ze(ue.paint_symbol["text-color"],{runtimeType:Ai,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new ze(ue.paint_symbol["text-halo-color"]),"text-halo-width":new ze(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new ze(ue.paint_symbol["text-halo-blur"]),"text-translate":new Ee(ue.paint_symbol["text-translate"]),"text-translate-anchor":new Ee(ue.paint_symbol["text-translate-anchor"])})},get layout(){return Ap=Ap||new di({"symbol-placement":new Ee(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new Ee(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ee(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ze(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ee(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ee(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ee(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ee(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ee(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ee(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new ze(ue.layout_symbol["icon-size"]),"icon-text-fit":new Ee(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ee(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new ze(ue.layout_symbol["icon-image"]),"icon-rotate":new ze(ue.layout_symbol["icon-rotate"]),"icon-padding":new ze(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new Ee(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new ze(ue.layout_symbol["icon-offset"]),"icon-anchor":new ze(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ee(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ee(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ee(ue.layout_symbol["text-rotation-alignment"]),"text-field":new ze(ue.layout_symbol["text-field"]),"text-font":new ze(ue.layout_symbol["text-font"]),"text-size":new ze(ue.layout_symbol["text-size"]),"text-max-width":new ze(ue.layout_symbol["text-max-width"]),"text-line-height":new Ee(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new ze(ue.layout_symbol["text-letter-spacing"]),"text-justify":new ze(ue.layout_symbol["text-justify"]),"text-radial-offset":new ze(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ee(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ze(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ze(ue.layout_symbol["text-anchor"]),"text-max-angle":new Ee(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new Ee(ue.layout_symbol["text-writing-mode"]),"text-rotate":new ze(ue.layout_symbol["text-rotate"]),"text-padding":new Ee(ue.layout_symbol["text-padding"]),"text-keep-upright":new Ee(ue.layout_symbol["text-keep-upright"]),"text-transform":new ze(ue.layout_symbol["text-transform"]),"text-offset":new ze(ue.layout_symbol["text-offset"]),"text-allow-overlap":new Ee(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new Ee(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new Ee(ue.layout_symbol["text-ignore-placement"]),"text-optional":new Ee(ue.layout_symbol["text-optional"])})}};class Dp{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Fr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i?.hasOverride(e.formattedSection))return i.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}}Ie("FormatSectionOverride",Dp,{omit:["defaultValue"]});class Cu extends Gi{constructor(e,i){super(e,Xh,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const s=[];for(const l of a)s.includes(l)||s.push(l);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,a,s){const l=this.layout.get(e).evaluate(i,{},a,s),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||Gs(u.value)||!l?l:(function(d,_){return _.replace(/{([^{}]+)}/g,((m,v)=>d&&v in d?String(d[v]):""))})(i.properties,l)}createBucket(e){return new To(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Xh.paint.overridableProperties){if(!Cu.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),a=new Dp(i),s=new Ua(a,i.property.specification);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new Zs("source",s):new qs("composite",s,i.value.zoomStops),this.paint._values[e]=new rr(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,a){return!(!this.layout||i.isDataDriven()||a.isDataDriven())&&Cu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const a=e.get("text-field"),s=Xh.paint.properties[i];let l=!1;const u=d=>{var _;for(const m of d)if(!((_=s.overrides)===null||_===void 0)&&_.hasOverride(m))return void(l=!0)};if(a.value.kind==="constant"&&a.value.value instanceof wi)u(a.value.value.sections);else if(a.value.kind==="source"||a.value.kind==="composite"){const d=m=>{l||(m instanceof ar&&Mt(m.value)===Ea?u(m.value.sections):m instanceof yn?u(m.sections):m.eachChild(d))},_=a.value;_._styleExpression&&d(_._styleExpression.expression)}return l}}let kp;var N_={get paint(){return kp=kp||new di({"background-color":new Ee(ue.paint_background["background-color"]),"background-pattern":new cu(ue.paint_background["background-pattern"]),"background-opacity":new Ee(ue.paint_background["background-opacity"])})}};class U_ extends Gi{constructor(e,i){super(e,N_,i)}}class $_ extends Gi{constructor(e,i){super(e,{},i),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class G_{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)===null||e===void 0||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Z_={once:!0},Yh=63710088e-1;class ma{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ma(On(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,a=this.lat*i,s=e.lat*i,l=Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos((e.lng-this.lng)*i);return Yh*Math.acos(Math.min(l,1))}static convert(e){if(e instanceof ma)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new ma(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new ma(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Rp=2*Math.PI*Yh;function Lp(r){return Rp*Math.cos(r*Math.PI/180)}function Fp(r){return(180+r)/360}function Bp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Op(r,e){return r/Lp(e)}function jp(r){return 360*r-180}function Au(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Vp(r,e){return r*Lp(Au(e))}class rc{constructor(e,i,a=0){this.x=+e,this.y=+i,this.z=+a}static fromLngLat(e,i=0){const a=ma.convert(e);return new rc(Fp(a.lng),Bp(a.lat),Op(i,a.lat))}toLngLat(){return new ma(jp(this.x),Au(this.y))}toAltitude(){return Vp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Rp*(e=Au(this.y),1/Math.cos(e*Math.PI/180));var e}}function Np(r,e,i){var a=2*Math.PI*6378137/256/Math.pow(2,i);return[r*a-2*Math.PI*6378137/2,e*a-2*Math.PI*6378137/2]}class Kh{constructor(e,i,a){if(!(function(s,l,u){return!(s<0||s>25||u<0||u>=Math.pow(2,s)||l<0||l>=Math.pow(2,s))})(e,i,a))throw new Error(`x=${i}, y=${a}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=a,this.key=So(0,e,e,i,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,a){const s=(u=this.y,d=this.z,_=Np(256*(l=this.x),256*(u=Math.pow(2,d)-u-1),d),m=Np(256*(l+1),256*(u+1),d),_[0]+","+_[1]+","+m[0]+","+m[1]);var l,u,d,_,m;const v=(function(g,T,b){let I="";for(let M=g;M>0;M--){const A=1<<M-1;I+=(T&A?1:0)+(b&A?2:0)}return I})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,s)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new Pe((e.x*i-this.x)*Re,(e.y*i-this.y)*Re)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Up{constructor(e,i){this.wrap=e,this.canonical=i,this.key=So(e,i.z,i.z,i.x,i.y)}}class qi{constructor(e,i,a,s,l){if(this.terrainRttPosMatrix32f=null,e<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${a}`);this.overscaledZ=e,this.wrap=i,this.canonical=new Kh(a,+s,+l),this.key=So(i,e,a,s,l)}clone(){return new qi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>
16this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new qi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qi(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?So(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):So(this.wrap*+i,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new qi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,a=2*this.canonical.x,s=2*this.canonical.y;return[new qi(i,this.wrap,i,a,s),new qi(i,this.wrap,i,a+1,s),new qi(i,this.wrap,i,a,s+1),new qi(i,this.wrap,i,a+1,s+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new qi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new qi(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Up(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new rc(e.x-this.wrap,e.y))}normalizeCoordinates(e,i,a=8192){if(e>=0&&e<a&&i>=0&&i<a)return{tileID:this,x:e,y:i};const s=Math.floor(e/a),l=Math.floor(i/a),u=e-s*a,d=i-l*a,_=this.canonical.z,m=1<<_,v=this.canonical.y+l;if(v<0||v>=m)return null;let g=this.canonical.x+s,T=this.wrap;return g<0?(T-=Math.ceil(-g/m),g=(g%m+m)%m):g>=m&&(T+=Math.floor(g/m),g%=m),{tileID:new qi(this.overscaledZ,T,_,g,v),x:u,y:d}}}function So(r,e,i,a,s){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*s+a).toString(36)+i.toString(36)+e.toString(36)}Ie("CanonicalTileID",Kh),Ie("OverscaledTileID",qi,{omit:["terrainRttPosMatrix32f"]});class hs{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const i=new hs;return i.extend(e(new Pe(this.minX,this.minY))),i.extend(e(new Pe(this.maxX,this.minY))),i.extend(e(new Pe(this.minX,this.maxY))),i.extend(e(new Pe(this.maxX,this.maxY))),i}static fromPoints(e){const i=new hs;for(const a of e)i.extend(a);return i}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class $p{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const a=e[i];this._stringToNumber[a]=i,this._numberToString[i]=a}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Gp{constructor(e,i,a,s,l){this.type="Feature",this._vectorTileFeature=e,this._x=a,this._y=s,this._z=i,this.properties=e.properties,this.id=l}projectPoint(e,i,a,s){return[360*(e.x+i)/s-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+a)/s)*Math.PI))-90]}projectLine(e,i,a,s){return e.map((l=>this.projectPoint(l,i,a,s)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),a=e.extent*this._x,s=e.extent*this._y,l=e.loadGeometry();switch(e.type){case 1:{const u=[];for(const _ of l)u.push(_[0]);const d=this.projectLine(u,a,s,i);this._geometry=u.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d};break}case 2:{const u=l.map((d=>this.projectLine(d,a,s,i)));this._geometry=u.length===1?{type:"LineString",coordinates:u[0]}:{type:"MultiLineString",coordinates:u};break}case 3:{const u=Wd(l),d=[];for(const _ of u)d.push(_.map((m=>this.projectLine(m,a,s,i))));this._geometry=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class Po{constructor(e,i,a){this._name=e,this.dataBuffer=i,typeof a=="number"?this._size=a:(this.nullabilityBuffer=a,this._size=a.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class zu extends Po{}class Jh extends zu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Qh extends zu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Zp extends Po{constructor(e,i,a,s){super(e,i,s),this.delta=a}}class ed extends Zp{constructor(e,i,a,s){super(e,Int32Array.of(i),a,s)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class td extends Po{constructor(e,i,a,s){super(e,s?Int32Array.of(i):Uint32Array.of(i),a)}getValueFromBuffer(e){return this.dataBuffer[0]}}class q_{constructor(e,i,a,s,l=4096){this._name=e,this._geometryVector=i,this._idVector=a,this._propertyVectors=s,this._extent=l}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let a=0;a<this.numFeatures;a++){let s;if(this.idVector){const d=this.idVector.getValue(a);s=this.containsMaxSafeIntegerValues(this.idVector)&&d!==null?Number(d):d}const l={coordinates:i[a],type:this.geometryVector.geometryType(a)},u={};
16for(const d of this.propertyVectors){if(!d)continue;const _=d.name,m=d.getValue(a);m!==null&&(u[_]=m)}e.push({id:s,geometry:l,properties:u})}return e}containsMaxSafeIntegerValues(e){return e instanceof Jh||e instanceof td||e instanceof ed||e instanceof Qh}}class qp{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var qe,_a;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(qe||(qe={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(_a||(_a={}));const id=new Uint32Array(33);id[0]=0;for(let r=1;r<=32;r++)id[r]=r===32?4294967295:4294967295>>>32-r;const rd=id,kn=256;function nd(r,e){return r-r%e}function W_(r){const e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const ad=(function(){if(!Number.isFinite(65536))return 65536;const r=nd(Math.floor(65536),kn);return r===0?kn:r})(),H_=3*ad/kn+ad|0;function Wp(){const r=new Uint8Array(H_);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:r,byteContainerI32:new Int32Array(r.buffer,r.byteOffset,r.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function X_(r,e,i,a,s){switch(s){case 1:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0;d[m++]=T>>>0&1,d[m++]=T>>>1&1,d[m++]=T>>>2&1,d[m++]=T>>>3&1,d[m++]=T>>>4&1,d[m++]=T>>>5&1,d[m++]=T>>>6&1,d[m++]=T>>>7&1,d[m++]=T>>>8&1,d[m++]=T>>>9&1,d[m++]=T>>>10&1,d[m++]=T>>>11&1,d[m++]=T>>>12&1,d[m++]=T>>>13&1,d[m++]=T>>>14&1,d[m++]=T>>>15&1,d[m++]=T>>>16&1,d[m++]=T>>>17&1,d[m++]=T>>>18&1,d[m++]=T>>>19&1,d[m++]=T>>>20&1,d[m++]=T>>>21&1,d[m++]=T>>>22&1,d[m++]=T>>>23&1,d[m++]=T>>>24&1,d[m++]=T>>>25&1,d[m++]=T>>>26&1,d[m++]=T>>>27&1,d[m++]=T>>>28&1,d[m++]=T>>>29&1,d[m++]=T>>>30&1,d[m++]=T>>>31&1}})(r,e,i,a);break;case 2:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0;d[m++]=T>>>0&3,d[m++]=T>>>2&3,d[m++]=T>>>4&3,d[m++]=T>>>6&3,d[m++]=T>>>8&3,d[m++]=T>>>10&3,d[m++]=T>>>12&3,d[m++]=T>>>14&3,d[m++]=T>>>16&3,d[m++]=T>>>18&3,d[m++]=T>>>20&3,d[m++]=T>>>22&3,d[m++]=T>>>24&3,d[m++]=T>>>26&3,d[m++]=T>>>28&3,d[m++]=T>>>30&3,d[m++]=b>>>0&3,d[m++]=b>>>2&3,d[m++]=b>>>4&3,d[m++]=b>>>6&3,d[m++]=b>>>8&3,d[m++]=b>>>10&3,d[m++]=b>>>12&3,d[m++]=b>>>14&3,d[m++]=b>>>16&3,d[m++]=b>>>18&3,d[m++]=b>>>20&3,d[m++]=b>>>22&3,d[m++]=b>>>24&3,d[m++]=b>>>26&3,d[m++]=b>>>28&3,d[m++]=b>>>30&3}})(r,e,i,a);break;case 3:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0;d[m++]=T>>>0&7,d[m++]=T>>>3&7,d[m++]=T>>>6&7,d[m++]=T>>>9&7,d[m++]=T>>>12&7,d[m++]=T>>>15&7,d[m++]=T>>>18&7,d[m++]=T>>>21&7,d[m++]=T>>>24&7,d[m++]=T>>>27&7,d[m++]=7&(T>>>30|(1&b)<<2),d[m++]=b>>>1&7,d[m++]=b>>>4&7,d[m++]=b>>>7&7,d[m++]=b>>>10&7,d[m++]=b>>>13&7,d[m++]=b>>>16&7,d[m++]=b>>>19&7,d[m++]=b>>>22&7,d[m++]=b>>>25&7,d[m++]=b>>>28&7,d[m++]=7&(b>>>31|(3&I)<<1),d[m++]=I>>>2&7,d[m++]=I>>>5&7,d[m++]=I>>>8&7,d[m++]=I>>>11&7,d[m++]=I>>>14&7,d[m++]=I>>>17&7,d[m++]=I>>>20&7,d[m++]=I>>>23&7,d[m++]=I>>>26&7,d[m++]=I>>>29&7}})(r,e,i,a);break;case 4:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0;d[m++]=T>>>0&15,d[m++]=T>>>4&15,d[m++]=T>>>8&15,d[m++]=T>>>12&15,d[m++]=T>>>16&15,d[m++]=T>>>20&15,d[m++]=T>>>24&15,d[m++]=T>>>28&15,d[m++]=b>>>0&15,d[m++]=b>>>4&15,d[m++]=b>>>8&15,d[m++]=b>>>12&15,d[m++]=b>>>16&15,d[m++]=b>>>20&15,d[m++]=b>>>24&15,d[m++]=b>>>28&15,d[m++]=I>>>0&15,d[m++]=I>>>4&15,d[m++]=I>>>8&15,d[m++]=I>>>12&15,d[m++]=I>>>16&15,d[m++]=I>>>20&15,d[m++]=I>>>24&15,d[m++]=I>>>28&15,d[m++]=M>>>0&15,d[m++]=M>>>4&15,d[m++]=M>>>8&15,d[m++]=M>>>12&15,d[m++]=M>>>16&15,d[m++]=M>>>20&15,d[m++]=M>>>24&15,d[m++]=M>>>28&15}})(r,e,i,a);break;case 5:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0;d[m++]=T>>>0&31,d[m++]=T>>>5&31,d[m++]=T>>>10&31,d[m++]=T>>>15&31,d[m++]=T>>>20&31,d[m++]=T>>>25&31,d[m++]=31&(T>>>30|(7&b)<<2),d[m++]=b>>>3&31,d[m++]=b>>>8&31,d[m++]=b>>>13&31,d[m++]=b>>>18&31,d[m++]=b>>>23&31,d[m++]=31&(b>>>28|(1&I)<<4),d[m++]=I>>>1&31,d[m++]=I>>>6&31,d[m++]=I>>>11&31,d[m++]=I>>>16&31,d[m++]=I>>>21&31,d[m++]=I>>>26&31,d[m++]=31&(I>>>31|(15&M)<<1),d[m++]=M>>>4&31,d[m++]=M>>>9&31,d[m++]=M>>>14&31,d[m++]=M>>>19&31,d[m++]=M>>>24&31,d[m++]=31&(M>>>29|(3&A)<<3),d[m++]=A>>>2&31,d[m++]=A>>>7&31,d[m++]=A>>>12&31,d[m++]=A>>>17&31,d[m++]=A>>>22&31,d[m++]=A>>>27&31}})(r,e,i,a);break;case 6:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,z=l[v++]>>>0;d[m++]=T>>>0&63,d[m++]=T>>>6&63,d[m++]=T>>>12&63,d[m++]=T>>>18&63,d[m++]=T>>>24&63,d[m++]=63&(T>>>30|(15&b)<<2),d[m++]=b>>>4&63,d[m++]=b>>>10&63,d[m++]=b>>>16&63,d[m++]=b>>>22&63,d[m++]=63&(b>>>28|(3&I)<<4),d[m++]=I>>>2&63,d[m++]=I>>>8&63,d[m++]=I>>>14&63,d[m++]=I>>>20&63,d[m++]=I>>>26&63,d[m++]=M>>>0&63,d[m++]=M>>>6&63,d[m++]=M>>>12&63,d[m++]=M>>>18&63,d[m++]=M>>>24&63,d[m++]=63&(M>>>30|(15&A)<<2),d[m++]=A>>>4&63,d[m++]=A>>>10&63,d[m++]=A>>>16&63,d[m++]=A>>>22&63,d[m++]=63&(A>>>28|(3&z)<<4),d[m++]=z>>>2&63,d[m++]=z>>>8&63,d[m++]=z>>>14&63,d[m++]=z>>>20&63,d[m++]=z>>>26&63}})(r,e,i,a);break;case 7:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,z=l[v++]>>>0,L=l[v++]>>>0;d[m++]=T>>>0&127,d[m++]=T>>>7&127,d[m++]=T>>>14&127,d[m++]=T>>>21&127,d[m++]=127&(T>>>28|(7&b)<<4),d[m++]=b>>>3&127,d[m++]=b>>>10&127,d[m++]=b>>>17&127,d[m++]=b>>>24&127,d[m++]=127&(b>>>31|(63&I)<<1),d[m++]=I>>>6&127,d[m++]=I>>>13&127,d[m++]=I>>>20&127,d[m++]=127&(I>>>27|(3&M)<<5),d[m++]=M>>>2&127,d[m++]=M>>>9&127,d[m++]=M>>>16&127,d[m++]=M>>>23&127,d[m++]=127&(M>>>30|(31&A)<<2),d[m++]=A>>>5&127,d[m++]=A>>>12&127,d[m++]=A>>>19&127,d[m++]=127&(A>>>26|(1&z)<<6),d[m++]=z>>>1&127,d[m++]=z>>>8&127,d[m++]=z>>>15&127,d[m++]=z>>>22&127,d[m++]=127&(z>>>29|(15&L)<<3),d[m++]=L>>>4&127,d[m++]=L>>>11&127,d[m++]=L>>>18&127,d[m++]=L>>>25&127}})(r,e,i,a);break;case 8:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<8;g++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,z=l[v++]>>>0,L=l[v++]>>>0,k=l[v++]>>>0;d[m++]=T>>>0&255,d[m++]=T>>>8&255,d[m++]=T>>>16&255,d[m++]=T>>>24&255,d[m++]=b>>>0&255,d[m++]=b>>>8&255,d[m++]=b>>>16&255,d[m++]=b>>>24&255,d[m++]=I>>>0&255,d[m++]=I>>>8&255,d[m++]=I>>>16&255,d[m++]=I>>>24&255,d[m++]=M>>>0&255,d[m++]=M>>>8&255,d[m++]=M>>>16&255,d[m++]=M>>>24&255,d[m++]=A>>>0&255,d[m++]=A>>>8&255,d[m++]=A>>>16&255,d[m++]=A>>>24&255,d[m++]=z>>>0&255,d[m++]=z>>>8&255,d[m++]=z>>>16&255,d[m++]=z>>>24&255,d[m++]=L>>>0&255,d[m++]=L>>>8&255,d[m++]=L>>>16&255,d[m++]=L>>>24&255,d[m++]=k>>>0&255,d[m++]=k>>>8&255,d[m++]=k>>>16&255,d[m++]=k>>>24&255}})(r,e,i,a);break;case 16:(function(l,u,d,_){let m=_,v=u;for(let g=0;g<128;g++){const T=l[v++]>>>0;d[m++]=65535&T,d[m++]=T>>>16&65535}})(r,e,i,a);break;default:(function(l,u,d,_,m){const v=rd[m]>>>0;let g=u,T=0,b=l[g]>>>0,I=_;for(let M=0;M<8;M++){for(let A=0;A<32;A++)if(T+m<=32)d[I+A]=b>>>T&v,T+=m,T===32&&(T=0,g++,A!==31&&(b=l[g]>>>0));else{const z=32-T,L=b>>>T;g++,b=l[g]>>>0;const k=m-z;d[I+A]=(L|(b&-1>>>32-k>>>0)<<z)&v,T=k}I+=32,T=0,M<7&&(b=l[g]>>>0)}})(r,e,i,a,s)}return e+(s<<3)|0}function Y_(r,e,i,a){if(i+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${a} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);const s=r[i++],l=r[i++];if(s>32)throw new Error(`FastPFOR decode: invalid bitWidth=${s} at block=${a} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:s,exceptionCount:l,bytePosIn:i}}function K_(r,e,i,a,s,l,u,d,_){const{maxBits:m,exceptionBitWidth:v,bytePosIn:g}=(function(A,z,L,k,F,O){if(L+1>z)throw new Error(`FastPFOR decode: exception header underflow at block=${O} (need 1 byte for maxBits, bytePos=${L}, byteSize=${z})`);const V=A[L++];if(V<k||V>32)throw new Error(`FastPFOR decode: invalid maxBits=${V} at block=${O} (bitWidth=${k}, expected ${k}..32)`);const Y=V-k|0;if(Y<1||Y>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${Y} at block=${O} (bitWidth=${k}, maxBits=${V})`);
16if(L+F>z)throw new Error(`FastPFOR decode: exception positions underflow at block=${O} (need=${F}, have=${z-L})`);return{maxBits:V,exceptionBitWidth:Y,bytePosIn:L}})(s,l,u,i,a,_);if(u=g,v===1){const A=1<<i;for(let z=0;z<a;z=z+1|0)r[s[u++]+e|0]|=A;return u}const T=d.dataToBePacked[v];if(!T)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${v} (bitWidth=${i}, maxBits=${m}) at block ${_}`);const b=d.dataPointers;let I=0|b[v];const M=0|d.exceptionSizes[v];if(I+a>M)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${v} (ptr=${I}, need ${a}, size=${M}) at block ${_}`);for(let A=0;A<a;A=A+1|0){const z=s[u++],L=0|T[I++];r[z+e|0]|=L<<i}return b[v]=I,u}function J_(r,e,i,a,s,l){const u=0|i,d=0|r[u];if(d<=0||u+d>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${d} at pageStart=${u} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);const _=u+1|0,m=u+d|0,v=r[m]>>>0,g=v+3>>>2,T=m+1,b=T+g;if(b>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${v} (metaInts=${g}, pageStart=${u}, packedEnd=${m}, byteContainerStart=${T}) causes bitmapPos=${b} out of bounds (encoded.length=${r.length})`);const I=(function(z,L,k,F){F.byteContainer.length<k&&(F.byteContainer=new Uint8Array(2*k),F.byteContainerI32=void 0);const O=F.byteContainer,V=k>>>2;if(3&O.byteOffset)for(let J=0;J<V;J=J+1|0){const re=0|z[L+J|0],te=J<<2;O[te]=255&re,O[te+1|0]=re>>>8&255,O[te+2|0]=re>>>16&255,O[te+3|0]=re>>>24&255}else{let J=F.byteContainerI32;(!J||J.buffer!==O.buffer||J.byteOffset!==O.byteOffset||J.length<V)&&(J=F.byteContainerI32=new Int32Array(O.buffer,O.byteOffset,O.byteLength>>>2)),J.set(z.subarray(L,L+V))}const Y=3&k;if(Y>0){const J=0|z[L+V|0],re=V<<2;for(let te=0;te<Y;te=te+1|0)O[re+te|0]=J>>>(te<<3)&255}return O})(r,T,v,l),M=v,A=(function(z,L,k){const F=0|z[L++],O=k.dataToBePacked;for(let V=2;V<=32;V=V+1|0){if(!(F>>>V-1&1))continue;if(L>=z.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${V}, streamWordIndex=${L}, needWords=1, availableWords=${z.length-L}, encodedWords=${z.length})`);const Y=z[L++]>>>0,J=nd(Y+31,32),re=Y*V+31>>>5;if(L+re>z.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${V}, size=${Y}, streamWordIndex=${L}, needWords=${re}, availableWords=${z.length-L}, encodedWords=${z.length})`);let te=O[V];(!te||te.length<J)&&(te=O[V]=new Uint32Array(J));let le=0;for(;le<Y;le=le+32|0)Q_(z,L,te,le,V),L=L+V|0;L=L-((le-Y|0)*V>>>5)|0,k.exceptionSizes[V]=Y}return L})(r,b,l);return l.dataPointers.fill(0),(function(z,L,k,F,O,V,Y,J,re,te){let le=0|k,ce=0;for(let ne=0;ne<Y;ne=ne+1|0){const ie=Y_(J,re,ce,ne);ce=ie.bytePosIn;const _e=ie.bitWidth,we=ie.exceptionCount,xe=V+ne*kn|0;switch(_e){case 0:O.fill(0,xe,xe+kn);break;case 32:for(let ge=0;ge<kn;ge=ge+1|0)O[xe+ge|0]=0|z[le+ge|0];le=le+kn|0;break;default:le=X_(z,le,O,xe,_e)}we>0&&(ce=K_(O,xe,_e,we,J,re,ce,te,ne))}if(le!==F)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${L}, packedStart=${k}, consumedPackedEnd=${le}, expectedPackedEnd=${F}, packedWords=${F-k}, encoded.length=${z.length})`)})(r,u,_,m,e,0|a,s/kn|0,I,M,l),A}function Q_(r,e,i,a,s){switch(s){case 2:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0;g[b++]=I>>>0&3,g[b++]=I>>>2&3,g[b++]=I>>>4&3,g[b++]=I>>>6&3,g[b++]=I>>>8&3,g[b++]=I>>>10&3,g[b++]=I>>>12&3,g[b++]=I>>>14&3,g[b++]=I>>>16&3,g[b++]=I>>>18&3,g[b++]=I>>>20&3,g[b++]=I>>>22&3,g[b++]=I>>>24&3,g[b++]=I>>>26&3,g[b++]=I>>>28&3,g[b++]=I>>>30&3,g[b++]=M>>>0&3,g[b++]=M>>>2&3,g[b++]=M>>>4&3,g[b++]=M>>>6&3,g[b++]=M>>>8&3,g[b++]=M>>>10&3,g[b++]=M>>>12&3,g[b++]=M>>>14&3,g[b++]=M>>>16&3,g[b++]=M>>>18&3,g[b++]=M>>>20&3,g[b++]=M>>>22&3,g[b++]=M>>>24&3,g[b++]=M>>>26&3,g[b++]=M>>>28&3,g[b]=M>>>30&3})(r,e,i,a);case 3:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0;g[b++]=I>>>0&7,g[b++]=I>>>3&7,g[b++]=I>>>6&7,g[b++]=I>>>9&7,g[b++]=I>>>12&7,g[b++]=I>>>15&7,g[b++]=I>>>18&7,g[b++]=I>>>21&7,g[b++]=I>>>24&7,g[b++]=I>>>27&7,g[b++]=7&(I>>>30|(1&M)<<2),g[b++]=M>>>1&7,g[b++]=M>>>4&7,g[b++]=M>>>7&7,g[b++]=M>>>10&7,g[b++]=M>>>13&7,g[b++]=M>>>16&7,g[b++]=M>>>19&7,g[b++]=M>>>22&7,g[b++]=M>>>25&7,g[b++]=M>>>28&7,g[b++]=7&(M>>>31|(3&A)<<1),g[b++]=A>>>2&7,g[b++]=A>>>5&7,g[b++]=A>>>8&7,g[b++]=A>>>11&7,g[b++]=A>>>14&7,g[b++]=A>>>17&7,g[b++]=A>>>20&7,g[b++]=A>>>23&7,g[b++]=A>>>26&7,g[b]=A>>>29&7})(r,e,i,a);case 4:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0;g[b++]=I>>>0&15,g[b++]=I>>>4&15,g[b++]=I>>>8&15,g[b++]=I>>>12&15,g[b++]=I>>>16&15,g[b++]=I>>>20&15,g[b++]=I>>>24&15,g[b++]=I>>>28&15,g[b++]=M>>>0&15,g[b++]=M>>>4&15,g[b++]=M>>>8&15,g[b++]=M>>>12&15,g[b++]=M>>>16&15,g[b++]=M>>>20&15,g[b++]=M>>>24&15,g[b++]=M>>>28&15,g[b++]=A>>>0&15,g[b++]=A>>>4&15,g[b++]=A>>>8&15,g[b++]=A>>>12&15,g[b++]=A>>>16&15,g[b++]=A>>>20&15,g[b++]=A>>>
1624&15,g[b++]=A>>>28&15,g[b++]=z>>>0&15,g[b++]=z>>>4&15,g[b++]=z>>>8&15,g[b++]=z>>>12&15,g[b++]=z>>>16&15,g[b++]=z>>>20&15,g[b++]=z>>>24&15,g[b]=z>>>28&15})(r,e,i,a);case 5:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0;g[b++]=I>>>0&31,g[b++]=I>>>5&31,g[b++]=I>>>10&31,g[b++]=I>>>15&31,g[b++]=I>>>20&31,g[b++]=I>>>25&31,g[b++]=31&(I>>>30|(7&M)<<2),g[b++]=M>>>3&31,g[b++]=M>>>8&31,g[b++]=M>>>13&31,g[b++]=M>>>18&31,g[b++]=M>>>23&31,g[b++]=31&(M>>>28|(1&A)<<4),g[b++]=A>>>1&31,g[b++]=A>>>6&31,g[b++]=A>>>11&31,g[b++]=A>>>16&31,g[b++]=A>>>21&31,g[b++]=A>>>26&31,g[b++]=31&(A>>>31|(15&z)<<1),g[b++]=z>>>4&31,g[b++]=z>>>9&31,g[b++]=z>>>14&31,g[b++]=z>>>19&31,g[b++]=z>>>24&31,g[b++]=31&(z>>>29|(3&L)<<3),g[b++]=L>>>2&31,g[b++]=L>>>7&31,g[b++]=L>>>12&31,g[b++]=L>>>17&31,g[b++]=L>>>22&31,g[b]=L>>>27&31})(r,e,i,a);case 6:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0;g[b++]=I>>>0&63,g[b++]=I>>>6&63,g[b++]=I>>>12&63,g[b++]=I>>>18&63,g[b++]=I>>>24&63,g[b++]=63&(I>>>30|(15&M)<<2),g[b++]=M>>>4&63,g[b++]=M>>>10&63,g[b++]=M>>>16&63,g[b++]=M>>>22&63,g[b++]=63&(M>>>28|(3&A)<<4),g[b++]=A>>>2&63,g[b++]=A>>>8&63,g[b++]=A>>>14&63,g[b++]=A>>>20&63,g[b++]=A>>>26&63,g[b++]=z>>>0&63,g[b++]=z>>>6&63,g[b++]=z>>>12&63,g[b++]=z>>>18&63,g[b++]=z>>>24&63,g[b++]=63&(z>>>30|(15&L)<<2),g[b++]=L>>>4&63,g[b++]=L>>>10&63,g[b++]=L>>>16&63,g[b++]=L>>>22&63,g[b++]=63&(L>>>28|(3&k)<<4),g[b++]=k>>>2&63,g[b++]=k>>>8&63,g[b++]=k>>>14&63,g[b++]=k>>>20&63,g[b]=k>>>26&63})(r,e,i,a);case 7:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0;g[b++]=I>>>0&127,g[b++]=I>>>7&127,g[b++]=I>>>14&127,g[b++]=I>>>21&127,g[b++]=127&(I>>>28|(7&M)<<4),g[b++]=M>>>3&127,g[b++]=M>>>10&127,g[b++]=M>>>17&127,g[b++]=M>>>24&127,g[b++]=127&(M>>>31|(63&A)<<1),g[b++]=A>>>6&127,g[b++]=A>>>13&127,g[b++]=A>>>20&127,g[b++]=127&(A>>>27|(3&z)<<5),g[b++]=z>>>2&127,g[b++]=z>>>9&127,g[b++]=z>>>16&127,g[b++]=z>>>23&127,g[b++]=127&(z>>>30|(31&L)<<2),g[b++]=L>>>5&127,g[b++]=L>>>12&127,g[b++]=L>>>19&127,g[b++]=127&(L>>>26|(1&k)<<6),g[b++]=k>>>1&127,g[b++]=k>>>8&127,g[b++]=k>>>15&127,g[b++]=k>>>22&127,g[b++]=127&(k>>>29|(15&F)<<3),g[b++]=F>>>4&127,g[b++]=F>>>11&127,g[b++]=F>>>18&127,g[b]=F>>>25&127})(r,e,i,a);case 8:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0,O=m[v+7]>>>0;g[b++]=I>>>0&255,g[b++]=I>>>8&255,g[b++]=I>>>16&255,g[b++]=I>>>24&255,g[b++]=M>>>0&255,g[b++]=M>>>8&255,g[b++]=M>>>16&255,g[b++]=M>>>24&255,g[b++]=A>>>0&255,g[b++]=A>>>8&255,g[b++]=A>>>16&255,g[b++]=A>>>24&255,g[b++]=z>>>0&255,g[b++]=z>>>8&255,g[b++]=z>>>16&255,g[b++]=z>>>24&255,g[b++]=L>>>0&255,g[b++]=L>>>8&255,g[b++]=L>>>16&255,g[b++]=L>>>24&255,g[b++]=k>>>0&255,g[b++]=k>>>8&255,g[b++]=k>>>16&255,g[b++]=k>>>24&255,g[b++]=F>>>0&255,g[b++]=F>>>8&255,g[b++]=F>>>16&255,g[b++]=F>>>24&255,g[b++]=O>>>0&255,g[b++]=O>>>8&255,g[b++]=O>>>16&255,g[b]=O>>>24&255})(r,e,i,a);case 9:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0,O=m[v+7]>>>0,V=m[v+8]>>>0;g[b++]=I>>>0&511,g[b++]=I>>>9&511,g[b++]=I>>>18&511,g[b++]=511&(I>>>27|(15&M)<<5),g[b++]=M>>>4&511,g[b++]=M>>>13&511,g[b++]=M>>>22&511,g[b++]=511&(M>>>31|(255&A)<<1),g[b++]=A>>>8&511,g[b++]=A>>>17&511,g[b++]=511&(A>>>26|(7&z)<<6),g[b++]=z>>>3&511,g[b++]=z>>>12&511,g[b++]=z>>>21&511,g[b++]=511&(z>>>30|(127&L)<<2),g[b++]=L>>>7&511,g[b++]=L>>>16&511,g[b++]=511&(L>>>25|(3&k)<<7),g[b++]=k>>>2&511,g[b++]=k>>>11&511,g[b++]=k>>>20&511,g[b++]=511&(k>>>29|(63&F)<<3),g[b++]=F>>>6&511,g[b++]=F>>>15&511,g[b++]=511&(F>>>24|(1&O)<<8),g[b++]=O>>>1&511,g[b++]=O>>>10&511,g[b++]=O>>>19&511,g[b++]=511&(O>>>28|(31&V)<<4),g[b++]=V>>>5&511,g[b++]=V>>>14&511,g[b]=V>>>23&511})(r,e,i,a);case 10:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0,O=m[v+7]>>>0,V=m[v+8]>>>0,Y=m[v+9]>>>0;g[b++]=I>>>0&1023,g[b++]=I>>>10&1023,g[b++]=I>>>20&1023,g[b++]=1023&(I>>>30|(255&M)<<2),g[b++]=M>>>8&1023,g[b++]=M>>>18&1023,g[b++]=1023&(M>>>28|(63&A)<<4),g[b++]=A>>>6&1023,g[b++]=A>>>16&1023,g[b++]=1023&(A>>>26|(15&z)<<6),g[b++]=z>>>4&1023,g[b++]=z>>>14&1023,g[b++]=1023&(z>>>24|(3&L)<<8),g[b++]=L>>>2&1023,g[b++]=L>>>12&1023,g[b++]=L>>>22&1023,g[b++]=k>>>0&1023,g[b++]=k>>>10&1023,g[b++]=k>>>20&1023,g[b++]=1023&(k>>>30|(255&F)<<2),g[b++]=F>>>8&1023,g[b++]=F>>>18&1023,g[b++]=1023&(F>>>28|(63&O)<<4),g[b++]=O>>>6&1023,g[b++]=O>>>16&1023,g[b++]=1023&(O>>>26|(15&V)<<6),g[b++]=V>>>4&1023,g[b++]=V>>>14&1023,g[b++]=1023&(V>>>24|(3&Y)<<8),g[b++]=Y>>>2&1023,g[b++]=Y>>>12&1023,g[b]=Y>>>22&1023})(r,e,i,a);case 11:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0,O=m[v+7]>>>0,V=m[v+8]>>>0,Y=m[v+9]>>>0,J=m[v+10]>>>0;g[b++]=I>>>0&2047,g[b++]=I>>>11&2047,g[b++]=2047&(I>>>22|(1&M)<<10),g[b++]=M>>>1&2047,g[b++]=M>>>12&2047,g[b++]=2047&(M>>>23|(3&A)<<9),g[b++]=A>>>2&2047,g[b++]=A>>>13&2047,g[b++]=2047&(A>>>24|(7&z)<<8),g[b++]=z>>>3&2047,g[b++]=z>>>14&2047,g[b++]=2047&(z>>>25|(15&L)<<7),g[b++]=L>>>4&2047,g[b++]=L>>>15&2047,g[b++]=2047&(L>>>26|(31&k)<<6),g[b++]=k>>>5&2047,g[b++]=k>>>16&2047,g[b++]=2047&(k>>>27|(63&F)<<5),g[b++]=F>>>6&2047,g[b++]=F>>>17&2047,g[b++]=2047&(F>>>28|(127&O)<<4),g[b++]=O>>>7&2047,g[b++]=O>>>18&2047,g[b++]=2047&(O>>>29|(255&V)<<3),g[b++]=V>>>8&2047,g[b++]=V>>>19&2047,g[b++]=2047&(V>>>30|(511&Y)<<2),g[b++]=Y>>>9&2047,g[b++]=Y>>>20&2047,g[b++]=2047&(Y>>>31|(1023&J)<<1),g[b++]=J>>>10&2047,g[b]=J>>>21&2047})(r,e,i,a);case 12:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0,O=m[v+7]>>>0,V=m[v+8]>>>0,Y=m[v+9]>>>0,J=m[v+10]>>>0,re=m[v+11]>>>0;g[b++]=I>>>0&4095,g[b++]=I>>>12&4095,g[b++]=4095&(I>>>24|(15&M)<<8),g[b++]=M>>>4&4095,g[b++]=M>>>16&4095,g[b++]=4095&(M>>>28|(255&A)<<4),g[b++]=A>>>8&4095,g[b++]=A>>>20&4095,g[b++]=z>>>0&4095,g[b++]=z>>>12&4095,g[b++]=4095&(z>>>24|(15&L)<<8),g[b++]=L>>>4&4095,g[b++]=L>>>16&4095,g[b++]=4095&(L>>>28|(255&k)<<4),g[b++]=k>>>8&4095,g[b++]=k>>>20&4095,g[b++]=F>>>0&4095,g[b++]=F>>>12&4095,g[b++]=4095&(F>>>24|(15&O)<<8),g[b++]=O>>>4&4095,g[b++]=O>>>16&4095,g[b++]=4095&(O>>>28|(255&V)<<4),g[b++]=V>>>8&4095,g[b++]=V>>>20&4095,g[b++]=Y>>>0&4095,g[b++]=Y>>>12&4095,g[b++]=4095&(Y>>>24|(15&J)<<8),g[b++]=J>>>4&4095,g[b++]=J>>>16&4095,g[b++]=4095&(J>>>28|(255&re)<<4),g[b++]=re>>>8&4095,g[b]=re>>>20&4095})(r,e,i,a);case 16:return void(function(m,v,g,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,z=m[v+3]>>>0,L=m[v+4]>>>0,k=m[v+5]>>>0,F=m[v+6]>>>0,O=m[v+7]>>>0,V=m[v+8]>>>0,Y=m[v+9]>>>0,J=m[v+10]>>>0,re=m[v+11]>>>0,te=m[v+12]>>>0,le=m[v+13]>>>0,ce=m[v+14]>>>0,ne=m[v+15]>>>0;g[b++]=I>>>0&65535,g[b++]=I>>>16&65535,g[b++]=M>>>0&65535,g[b++]=M>>>16&65535,g[b++]=A>>>0&65535,g[b++]=A>>>16&65535,g[b++]=z>>>0&65535,g[b++]=z>>>16&65535,g[b++]=L>>>0&65535,g[b++]=L>>>16&65535,g[b++]=k>>>0&65535,g[b++]=k>>>16&65535,g[b++]=F>>>0&65535,g[b++]=F>>>16&65535,g[b++]=O>>>0&65535,g[b++]=O>>>16&65535,g[b++]=V>>>0&65535,g[b++]=V>>>16&65535,g[b++]=Y>>>0&65535,g[b++]=Y>>>16&65535,g[b++]=J>>>0&65535,g[b++]=J>>>16&65535,g[b++]=re>>>0&65535,g[b++]=re>>>16&65535,g[b++]=te>>>0&65535,g[b++]=te>>>16&65535,g[b++]=le>>>0&65535,g[b++]=le>>>16&65535,g[b++]=ce>>>0&65535,g[b++]=ce>>>16&65535,g[b++]=ne>>>0&65535,g[b]=ne>>>16&65535})(r,e,i,a);case 32:for(let m=0;m<32;m=m+1|0)i[a+m|0]=0|r[e+m|0];return}const l=rd[s]>>>0;let u=e,d=0,_=r[u]>>>0;for(let m=0;m<32;m++)if(d+s<=32)i[a+m]=_>>>d&l,d+=s,d===32&&(d=0,u++,m!==31&&(_=r[u]>>>0));else{const v=32-d,g=_>>>d;u++,_=r[u]>>>0,i[a+m]=(g|(_&rd[s-v]>>>0)<<v)&l,d=s-v}}function mi(r,e,i){const a=new Uint32Array(i);let s=0,l=e.get();for(let u=0;u<a.length;u++){let d=r[l++],_=127&d;d<128||(d=r[l++],_|=(127&d)<<7,d<128||(d=r[l++],_|=(127&d)<<14,d<128||(d=r[l++],_|=(127&d)<<21,d<128||(d=r[l++],_|=(15&d)<<28)))),a[s++]=_}return e.set(l),a}function Io(r,e,i){const a=new BigUint64Array(i);for(let s=0;s<a.length;s++)a[s]=eg(r,e);return a}function eg(r,e){let i=0n,a=0,s=e.get();for(;s<r.length;){const l=r[s++];if(i|=BigInt(127&l)<<BigInt(a),!(128&l))break;if(a+=7,a>=64)throw new Error("Varint too long")}return e.set(s),i}function tg(r,e){let i,a;return a=r[e.get()],e.increment(),i=127&a,a<128?i:(a=r[e.get()],e.increment(),i|=(127&a)<<7,a<128?i:(a=r[e.get()],e.increment(),i|=(127&a)<<14,a<128?i:(a=r[e.get()],e.increment(),i|=(127&a)<<21,a<128?i:(a=r[e.get()],i|=(15&a)<<28,(function(s,l,u){let d,_;if(_=l[u.get()],u.increment(),d=(112&_)>>4,_<128||(_=l[u.get()],u.increment(),d|=(127&_)<<3,_<128)||(_=l[u.get()],u.increment(),d|=(127&_)<<10,_<128)||(_=l[u.get()],u.increment(),d|=(127&_)<<17,_<128)||(_=l[u.get()],u.increment(),d|=(127&_)<<24,_<128)||(_=l[u.get()],u.increment(),d|=(1&_)<<31,_<128))return 4294967296*d+(s>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function lt(r){return r>>>1^-(1&r)}function Pi(r){return r>>1n^-(1n&r)}function Mo(r){return r%2==1?(r+1)/-2:r/2}function sd(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=r[l]}const a=new Uint32Array(i);let s=0;for(let l=0;l<e;l++){const u=r[l];a.fill(r[l+e],s,s+u),s+=u}return a}function od(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=Number(r[l])}const a=new BigUint64Array(i);let s=0;for(let l=0;l<e;l++){const u=Number(r[l]);a.fill(r[l+e],s,s+u),s+=u}return a}function Hp(r,e,i){const a=new Float64Array(i);let s=0;for(let l=0;l<e;l++){const u=r[l];a.fill(r[l+e],s,s+u),s+=u}return a}function Xp(r){const e=new Int32Array(r.length);e[0]=lt(r[0]);const i=r.length/4*4;let a=1;if(i>=4)for(;a<i-4;a+=4){const s=r[a+1],l=r[a+2],u=r[a+3];e[a]=lt(r[a])+e[a-1],e[a+1]=lt(s)+e[a],e[a+2]=lt(l)+e[a+1],e[a+3]=lt(u)+e[a+2]}for(;a!==r.length;++a)e[a]=lt(r[a])+e[a-1];return e}function Yp(r){const e=new BigInt64Array(r.length);e[0]=Pi(r[0]);const i=r.length/4*4;let a=1;if(i>=4)for(;a<i-4;a+=4){const s=r[a+1],l=r[a+2],u=r[a+3];e[a]=Pi(r[a])+e[a-1],e[a+1]=Pi(s)+e[a],e[a+2]=Pi(l)+e[a+1],e[a+3]=Pi(u)+e[a+2]}for(;a!==e.length;++a)e[a]=Pi(r[a])+e[a-1];return e}function ld(r){const e=r.length/4*4;let i=1;if(e>=4)for(let a=r[0];i<e-4;i+=4)a=r[i]+=a,a=r[i+1]+=a,a=r[i+2]+=a,a=r[i+3]+=a;for(;i!==r.length;)r[i]+=r[i-1],++i}var ai,wr,ds,Wi,ft,$t,Kp,ga;function Ii(r,e){const i=(function(a,s){const l=a[s.get()],u=Object.values(ai)[l>>4];let d=null;switch(u){case ai.DATA:d={dictionaryType:Object.values(wr)[15&l]};break;case ai.OFFSET:d={offsetType:Object.values(ds)[15&l]};break;case ai.LENGTH:d={lengthType:Object.values(Wi)[15&l]}}s.increment();const _=a[s.get()],m=Object.values(qe)[_>>5],v=Object.values(qe)[_>>2&7],g=Object.values(_a)[3&_];
16s.increment();const T=mi(a,s,2),b=T[0];return{physicalStreamType:u,logicalStreamType:d,logicalLevelTechnique1:m,logicalLevelTechnique2:v,physicalLevelTechnique:g,numValues:b,byteLength:T[1],decompressedCount:b}})(r,e);return i.logicalLevelTechnique1===qe.MORTON?(function(a,s,l){const u=mi(s,l,2);return{physicalStreamType:a.physicalStreamType,logicalStreamType:a.logicalStreamType,logicalLevelTechnique1:a.logicalLevelTechnique1,logicalLevelTechnique2:a.logicalLevelTechnique2,physicalLevelTechnique:a.physicalLevelTechnique,numValues:a.numValues,byteLength:a.byteLength,decompressedCount:a.decompressedCount,numBits:u[0],coordinateShift:u[1]}})(i,r,e):qe.RLE!==i.logicalLevelTechnique1&&qe.RLE!==i.logicalLevelTechnique2||_a.NONE===i.physicalLevelTechnique?i:(function(a,s,l){const u=mi(s,l,2);return{physicalStreamType:a.physicalStreamType,logicalStreamType:a.logicalStreamType,logicalLevelTechnique1:a.logicalLevelTechnique1,logicalLevelTechnique2:a.logicalLevelTechnique2,physicalLevelTechnique:a.physicalLevelTechnique,numValues:a.numValues,byteLength:a.byteLength,decompressedCount:u[1],runs:u[0],numRleValues:u[1]}})(i,r,e)}(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(ai||(ai={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(wr||(wr={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(ds||(ds={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(Wi||(Wi={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ft||(ft={}));class Tr{constructor(e,i){this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const a=Math.floor(e/8);this.values[a]=this.values[a]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Eo(r,e,i){if(!e)return r;const a=e.size(),s=new r.constructor(a);let l=0;for(let u=0;u<a;u++)s[u]=e.get(u)?r[l++]:i;return s}function cd(r,e,i,a,s){return(function(l,u,d,_){let m;switch(u.logicalLevelTechnique1){case qe.DELTA:if(u.logicalLevelTechnique2===qe.RLE){const v=u;if(!_)return(function(g,T,b){const I=new Int32Array(b);let M=0,A=0;for(let z=0;z<T;z++){const L=g[z],k=lt(g[z+T]);for(let F=0;F<L;F++)A+=k,I[M++]=A}return I})(l,v.runs,v.numRleValues);m=Xp(l=sd(l,v.runs,v.numRleValues))}else m=Xp(l);break;case qe.RLE:m=(function(v,g,T){if(T===void 0){T=0;for(let M=0;M<g;M++)T+=v[M]}const b=new Int32Array(T);let I=0;for(let M=0;M<g;M++){const A=v[M];let z=v[M+g];z=lt(z),b.fill(z,I,I+A),I+=A}return b})(l,u.runs,u.numRleValues);break;case qe.MORTON:ld(l),m=new Int32Array(l);break;case qe.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Int32Array(v);const g=new Int32Array(v.length);g[0]=lt(v[0]),g[1]=lt(v[1]);const T=v.length/4*4;let b=2;if(T>=4)for(;b<T-4;b+=4){const I=v[b+1],M=v[b+2],A=v[b+3];g[b]=lt(v[b])+g[b-2],g[b+1]=lt(I)+g[b-1],g[b+2]=lt(M)+g[b],g[b+3]=lt(A)+g[b+1]}for(;b!==v.length;b+=2)g[b]=lt(v[b])+g[b-2],g[b+1]=lt(v[b+1])+g[b-1];return g})(l);break;case qe.NONE:m=(function(v){const g=new Int32Array(v.length);for(let T=0;T<v.length;T++)g[T]=lt(v[T]);return g})(l);break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return _?Eo(m,_,0):m})(Co(r,e,i),i,0,s)}function Hi(r,e,i,a,s){return(function(l,u,d,_){let m;switch(u.logicalLevelTechnique1){case qe.DELTA:m=(function(v){const g=new Uint32Array(v.length);g[0]=lt(v[0])>>>0;for(let T=1;T<v.length;T++)g[T]=g[T-1]+lt(v[T])>>>0;return g})(u.logicalLevelTechnique2===qe.RLE?sd(l,u.runs,u.numRleValues):l);break;case qe.RLE:m=sd(l,u.runs,u.numRleValues);break;case qe.MORTON:ld(l),m=l;break;case qe.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Uint32Array(v);const g=new Uint32Array(v.length);g[0]=lt(v[0])>>>0,g[1]=lt(v[1])>>>0;for(let T=2;T<v.length;T+=2)g[T]=g[T-2]+lt(v[T])>>>0,g[T+1]=g[T-1]+lt(v[T+1])>>>0;return g})(l);break;case qe.NONE:m=l;break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return _?Eo(m,_,0):m})(Co(r,e,i),i,0,s)}function ya(r,e,i){return(function(a,s){if(s.logicalLevelTechnique1===qe.DELTA&&s.logicalLevelTechnique2===qe.NONE)return(function(l){const u=new Int32Array(l.length+1);u[0]=0,u[1]=lt(l[0]);let d=u[1];for(let _=2;_!==u.length;++_)d+=lt(l[_-1]),u[_]=u[_-1]+d;return new Uint32Array(u)})(a);if(s.logicalLevelTechnique1===qe.RLE&&s.logicalLevelTechnique2===qe.NONE)return(function(l,u,d){const _=new Uint32Array(d+1);_[0]=0;let m=1,v=_[0];for(let g=0;g<u;g++){const T=l[g],b=l[g+u];for(let I=m;I<m+T;I++)_[I]=b+v,v=_[I];m+=T}return _})(a,s.runs,s.numRleValues);if(s.logicalLevelTechnique1===qe.NONE&&s.logicalLevelTechnique2===qe.NONE){(function(u){let d=0;for(let _=0;_<u.length;_++)u[_]+=d,d=u[_]})(a);const l=new Uint32Array(s.numValues+1);return l[0]=0,l.set(a,1),l}if(s.logicalLevelTechnique1===qe.DELTA&&s.logicalLevelTechnique2===qe.RLE){const l=(function(u,d,_){const m=new Int32Array(_+1);m[0]=0;let v=1,g=m[0];for(let T=0;T<d;T++){const b=u[T];let I=u[T+d];I=lt(I);for(let M=v;M<v+b;M++)m[M]=I+g,g=m[M];v+=b}return m})(a,s.runs,s.numRleValues);return ld(l),new Uint32Array(l)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(Co(r,e,i),i)}function Co(r,e,i){const a=i.physicalLevelTechnique;switch(a){case _a.FAST_PFOR:return(function(s,l,u,d){return(function(_,m,v,g,T){const b=g.get();
16if(3&v)throw new Error(`FastPFOR: invalid encodedByteLength=${v} at offset=${b} (encodedBytes.length=${_.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const I=v>>>2,M=(function(z,L){if(L<=z.encodedWords.length)return z.encodedWords;const k=new Uint32Array(Math.max(16,2*L));return z.encodedWords=k,k})(T,I);(function(z,L,k,F){if(L<0||k<0||L+k>z.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${L}, byteLength=${k}, bytes.length=${z.length})`);const O=Math.floor(k/4),V=k%4!=0,Y=V?O+1:O;if(F.length<Y)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${F.length} < ${Y}`);if(O>0){const J=z.byteOffset+L;if(3&J)for(let re=0;re<O;re++){const te=L+4*re;F[re]=z[te]<<24|z[te+1]<<16|z[te+2]<<8|z[te+3]}else{const re=new Uint32Array(z.buffer,J,O);for(let te=0;te<O;te++)F[te]=0|W_(re[te])}}if(V){const J=L+4*O,re=k-4*O;let te=0;for(let le=0;le<re;le++)te|=z[J+le]<<24-8*le;F[O]=0|te}})(_,b,v,M);const A=(function(z,L,k){let F=0,O=0;const V=new Uint32Array(L),Y=k??Wp();if(z.length>0){const J=0|z[F];if(F=F+1|0,255&J)throw new Error(`FastPFOR decode: invalid alignedLength=${J} (expected multiple of 256)`);if(O+J>V.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${O}, alignedLength=${J}, out.length=${V.length})`);F=(function(re,te,le,ce,ne,ie){const _e=ce+nd(ne,kn);let we=ce,xe=le;for(;we!==_e;){const ge=Math.min(ad,_e-we);xe=J_(re,te,xe,we,ge,ie),we=we+ge|0}return xe})(z,V,F,O,J,Y),O=O+J|0}return(function(J,re,te,le,ce,ne){if(ne===0)return re;let ie=0,_e=re;const we=re+te,xe=ce;let ge=ce;const ke=ce+ne;let Qe=0,tt=0;for(;_e<we&&ge<ke;){const st=J[_e]>>>ie&255;if(ie+=8,_e+=ie>>>5,ie&=31,Qe|=(127&st)<<tt,128&st)le[ge++]=0|Qe,Qe=0,tt=0;else if(tt+=7,tt>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${tt}, partial=${Qe}, decoded=${ge-xe}/${ne}, inPos=${_e}, inEnd=${we})`)}if(ge!==ke)throw new Error(`FastPFOR VByte: truncated stream (decoded=${ge-xe}, expected=${ne}, consumedWords=${_e-re}/${te}, vbyteStart=${re}, vbyteEnd=${we})`)})(z,F,z.length-F|0,V,O,L-O|0),V})(M.subarray(0,I),m,T.decoderWorkspace);return g.add(v),A})(s,l,u,d,(function(_=16){if(_<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${_}`);const m=Math.max(16,0|_);return{encodedWords:new Uint32Array(m),decoderWorkspace:Wp()}})(u>>>2))})(r,i.numValues,i.byteLength,e);case _a.VARINT:return mi(r,e,i.numValues);case _a.NONE:{const s=e.get();e.add(i.byteLength);const l=r.subarray(s,e.get());return new Uint32Array(l)}default:throw new Error(`Specified physicalLevelTechnique ${a} is not supported (yet).`)}}function ud(r,e,i){const a=Co(r,e,i);return a.length===1?a[0]:(function(s){return s[1]})(a)}function Jp(r,e,i){return(function(a){if(a.length===2){const s=lt(a[1]);return[s,s]}return[lt(a[2]),lt(a[3])]})(Co(r,e,i))}function Qp(r,e,i){return(function(a){if(a.length===2){const s=Pi(a[1]);return[s,s]}return[Pi(a[2]),Pi(a[3])]})(Io(r,e,i.numValues))}function ef(r,e,i,a){return(function(s,l,u){let d;switch(l.logicalLevelTechnique1){case qe.DELTA:d=(function(_){const m=new BigUint64Array(_.length);m[0]=BigInt.asUintN(64,Pi(_[0]));for(let v=1;v<_.length;v++)m[v]=BigInt.asUintN(64,m[v-1]+Pi(_[v]));return m})(l.logicalLevelTechnique2===qe.RLE?od(s,l.runs,l.numRleValues):s);break;case qe.RLE:d=od(s,l.runs,l.numRleValues);break;case qe.NONE:d=s;break;default:throw new Error(`The specified Logical level technique is not supported: ${l.logicalLevelTechnique1}`)}return u?Eo(d,u,0n):d})(Io(r,e,i.numValues),i,a)}function tf(r,e,i){const a=Io(r,e,i.numValues);return a.length===1?a[0]:(function(s){return s[1]})(a)}
16function Du(r,e,i,a,s="int32"){const l=r.logicalLevelTechnique1;if(l===qe.RLE)return r.runs===1?ft.CONST:ft.FLAT;if(l!==qe.DELTA||r.logicalLevelTechnique2!==qe.RLE)return r.numValues===1?ft.CONST:ft.FLAT;const u=e instanceof Tr?e.size():e;if(r.numRleValues!==u)return ft.FLAT;if(r.runs===1)return ft.SEQUENCE;if(r.runs!==2)return r.numValues===1?ft.CONST:ft.FLAT;const d=a.get();if(r.physicalLevelTechnique===_a.VARINT)return(function(v,g,T){const b=new qp(g.get());if(T==="int64"){const M=Io(v,b,4);return M[2]===2n&&M[3]===2n}const I=mi(v,b,4);return I[2]===2&&I[3]===2})(i,a,s)?ft.SEQUENCE:r.numValues===1?ft.CONST:ft.FLAT;const _=a.get(),m=new Int32Array(i.buffer,i.byteOffset+_,4);return a.set(d),m[2]===2&&m[3]===2?ft.SEQUENCE:r.numValues===1?ft.CONST:ft.FLAT}class rf extends zu{getValueFromBuffer(e){return this.dataBuffer[e]}}class nf extends Zp{constructor(e,i,a,s){super(e,BigInt64Array.of(i),a,s)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function hd(r,e,i){return{x:af(r,e)-i,y:af(r>>1,e)-i}}function af(r,e){let i=0;for(let a=0;a<e;a++)i|=(r&1<<2*a)>>a;return i}function Ao(r,e,i,a,s,l,u){return r===ga.MORTON?(function(d,_,m,v,g,T){const b=new Array(g?v+1:v);for(let I=0;I<v;I++){const M=hd(d[_[m+I]],T.numBits,T.coordinateShift);b[I]=new Pe(M.x,M.y)}return g&&(b[b.length-1]=b[0]),b})(e,i,a,s,l,u):(function(d,_,m,v,g){const T=new Array(g?v+1:v);for(let b=0;b<2*v;b+=2){const I=2*_[m+b/2];T[b/2]=new Pe(d[I],d[I+1])}return g&&(T[T.length-1]=T[0]),T})(e,i,a,s,l)}function zo(r,e,i,a){const s=new Array(a?i+1:i);for(let l=0;l<2*i;l+=2)s[l/2]=new Pe(r[e+l],r[e+l+1]);return a&&(s[s.length-1]=s[0]),s}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})($t||($t={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(Kp||(Kp={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(ga||(ga={}));class sf{constructor(e,i,a,s,l){this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=a,this._vertexBuffer=s,this._mortonSettings=l}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const a=hd(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return(function(e){const i=new Array(e.numGeometries);let a=1,s=1,l=1,u=0,d=0,_=0;const m=e.mortonSettings,v=e.topologyVector,g=v.geometryOffsets,T=v.partOffsets,b=v.ringOffsets,I=e.vertexOffsets,M=!I||I.length===0,A=e.containsPolygonGeometry(),z=e.vertexBuffer;for(let L=0;L<e.numGeometries;L++)switch(e.geometryType(L)){case $t.POINT:{let k,F;if(M)k=z[d++],F=z[d++];else if(e.vertexBufferType===ga.MORTON){const O=hd(z[I[_++]],m.numBits,m.coordinateShift);k=O.x,F=O.y}else{const O=2*I[_++];k=z[O],F=z[O+1]}i[u++]=[[new Pe(k,F)]],g&&l++,T&&a++,b&&s++}break;case $t.MULTIPOINT:{const k=g[l]-g[l-1];l++;const F=new Array(k);if(M)for(let O=0;O<k;O++){const V=z[d++],Y=z[d++];F[O]=new Pe(V,Y)}else for(let O=0;O<k;O++){const V=2*I[_++];F[O]=new Pe(z[V],z[V+1])}i[u++]=F.map((O=>[O])),a+=k,s+=k}break;case $t.LINESTRING:{let k,F;A?(k=b[s]-b[s-1],s++):k=T[a]-T[a-1],a++,M?(F=zo(z,d,k,!1),d+=2*k):(F=Ao(e.vertexBufferType,z,I,_,k,!1,m),_+=k),i[u++]=[F],g&&l++}break;case $t.POLYGON:{const k=T[a]-T[a-1];a++;const F=new Array(k-1);let O,V=b[s]-b[s-1];if(s++,M){O=zo(z,d,V,!0),d+=2*V;for(let Y=0;Y<F.length;Y++)V=b[s]-b[s-1],s++,F[Y]=zo(z,d,V,!0),d+=2*V}else{O=Ao(e.vertexBufferType,z,I,_,V,!0,m),_+=V;for(let Y=0;Y<F.length;Y++)V=b[s]-b[s-1],s++,F[Y]=Ao(e.vertexBufferType,z,I,_,V,!0,m),_+=V}i[u++]=[O].concat(F),g&&l++}break;case $t.MULTILINESTRING:{const k=g[l]-g[l-1];l++;const F=new Array(k);for(let O=0;O<k;O++){let V;if(A?(V=b[s]-b[s-1],s++):V=T[a]-T[a-1],a++,M)F[O]=zo(z,d,V,!1),d+=2*V;else{const Y=Ao(e.vertexBufferType,z,I,_,V,!1,m);F[O]=Y,_+=V}}i[u++]=F}break;case $t.MULTIPOLYGON:{const k=g[l]-g[l-1];l++;const F=new Array(k);for(let O=0;O<k;O++){const V=T[a]-T[a-1];let Y;a++;const J=new Array(V-1),re=b[s]-b[s-1];s++,M?(Y=zo(z,d,re,!0),d+=2*re):(Y=Ao(e.vertexBufferType,z,I,_,re,!0,m),_+=re);for(let te=0;te<J.length;te++){const le=b[s]-b[s-1];s++,M?(J[te]=zo(z,d,le,!0),d+=2*le):(J[te]=Ao(e.vertexBufferType,z,I,_,le,!0,m),_+=le)}F[O]=[Y].concat(J)}i[u++]=F.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return i})(this)}get mortonSettings(){return this._mortonSettings}}class of extends sf{constructor(e,i,a,s,l,u,d){super(a,s,l,u,d),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===$t.POLYGON||this._geometryType===$t.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class lf extends sf{constructor(e,i,a,s,l,u){super(e,a,s,l,u),this._geometryTypes=i}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===$t.POLYGON||this.geometryType(e)===$t.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class cf{constructor(e,i,a,s){this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=a,this._topologyVector=s}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),i=this._topologyVector,a=i.partOffsets,s=i.ringOffsets,l=i.geometryOffsets;let u=0,d=1,_=1,m=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case $t.POLYGON:{const g=a[d]-a[d-1];d++;const T=[];for(let b=0;b<g;b++){const I=s[_]-s[_-1];_++;const M=[];for(let A=0;A<I;A++){const z=this._vertexBuffer[u++],L=this._vertexBuffer[u++];
16M.push(new Pe(z,L))}M.length>0&&M.push(M[0]),T.push(M)}e[v]=T,l&&m++}break;case $t.MULTIPOLYGON:{const g=l[m]-l[m-1];m++;const T=[];for(let b=0;b<g;b++){const I=a[d]-a[d-1];d++;for(let M=0;M<I;M++){const A=s[_]-s[_-1];_++;const z=[];for(let L=0;L<A;L++){const k=this._vertexBuffer[u++],F=this._vertexBuffer[u++];z.push(new Pe(k,F))}z.length>0&&z.push(z[0]),T.push(z)}}e[v]=T}}return e}[Symbol.iterator](){return null}}function uf(r,e,i,a,s,l){return new ig(r,e,i,a,s,l)}class ig extends cf{constructor(e,i,a,s,l,u){super(a,s,l,u),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function hf(r,e,i,a,s){return new rg(r,e,i,a,s)}class rg extends cf{constructor(e,i,a,s,l){super(i,a,s,l),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function ng(r,e,i,a,s){const l=Ii(r,i);let u,d,_,m;if(Du(l,a,r,i)===ft.CONST){const L=ud(r,i,l);let k,F,O,V;for(let Y=0;Y<e-1;Y++){const J=Ii(r,i);switch(J.physicalStreamType){case ai.LENGTH:switch(J.logicalStreamType.lengthType){case Wi.GEOMETRIES:k=ya(r,i,J);break;case Wi.PARTS:F=ya(r,i,J);break;case Wi.RINGS:O=ya(r,i,J);break;case Wi.TRIANGLES:V=ya(r,i,J)}break;case ai.OFFSET:switch(J.logicalStreamType.offsetType){case ds.VERTEX:u=Hi(r,i,J);break;case ds.INDEX:m=Hi(r,i,J)}break;case ai.DATA:wr.VERTEX===J.logicalStreamType.dictionaryType?d=cd(r,i,J):(_={numBits:J.numBits,coordinateShift:J.coordinateShift},d=Hi(r,i,J))}}return m?k!==void 0||F!==void 0?uf(a,L,V,m,d,{geometryOffsets:k,partOffsets:F,ringOffsets:O}):uf(a,L,V,m,d):_===void 0?(function(Y,J,re,te,le){return new of(Y,J,ga.VEC_2,re,te,le)})(a,L,{geometryOffsets:k,partOffsets:F,ringOffsets:O},u,d):(function(Y,J,re,te,le,ce){return new of(Y,J,ga.MORTON,re,te,le,ce)})(a,L,{geometryOffsets:k,partOffsets:F,ringOffsets:O},u,d,_)}const v=Hi(r,i,l);let g,T,b,I,M,A,z;for(let L=0;L<e-1;L++){const k=Ii(r,i);switch(k.physicalStreamType){case ai.LENGTH:switch(k.logicalStreamType.lengthType){case Wi.GEOMETRIES:g=Hi(r,i,k);break;case Wi.PARTS:T=Hi(r,i,k);break;case Wi.RINGS:b=Hi(r,i,k);break;case Wi.TRIANGLES:I=ya(r,i,k)}break;case ai.OFFSET:switch(k.logicalStreamType.offsetType){case ds.VERTEX:u=Hi(r,i,k);break;case ds.INDEX:m=Hi(r,i,k)}break;case ai.DATA:wr.VERTEX===k.logicalStreamType.dictionaryType?d=cd(r,i,k):(_={numBits:k.numBits,coordinateShift:k.coordinateShift},d=Hi(r,i,k))}}return g?(M=dd(v,g,2),T&&b?(A=df(v,M,T,!1),z=(function(L,k,F,O){const V=new Uint32Array(F[F.length-1]+1);let Y=0;V[0]=Y;let J=1,re=1,te=0;for(let le=0;le<L.length;le++){const ce=L[le],ne=k[le+1]-k[le];if(ce!==0&&ce!==3)for(let ie=0;ie<ne;ie++){const _e=F[J]-F[J-1];J++;for(let we=0;we<_e;we++)Y=V[re++]=Y+O[te++]}else for(let ie=0;ie<ne;ie++)V[re++]=++Y,J++}return V})(v,M,A,b)):T&&(A=(function(L,k,F){const O=new Uint32Array(k[k.length-1]+1);let V=0;O[0]=V;let Y=1,J=0;for(let re=0;re<L.length;re++){const te=L[re],le=k[re+1]-k[re];if(te===4||te===1)for(let ce=0;ce<le;ce++)V=O[Y++]=V+F[J++];else for(let ce=0;ce<le;ce++)O[Y++]=++V}return O})(v,M,T))):T&&b?(A=dd(v,T,1),z=df(v,A,b,!0)):T&&(A=dd(v,T,0)),m&&!A?hf(v,I,m,d):m?hf(v,I,m,d,{geometryOffsets:M,partOffsets:A,ringOffsets:z}):_===void 0?(function(L,k,F,O){return new lf(ga.VEC_2,L,k,F,O)})(v,{geometryOffsets:M,partOffsets:A,ringOffsets:z},u,d):(function(L,k,F,O,V){return new lf(ga.MORTON,L,k,F,O,V)})(v,{geometryOffsets:M,partOffsets:A,ringOffsets:z},u,d,_)}function dd(r,e,i){const a=new Uint32Array(r.length+1);let s=0;a[0]=s;let l=0;for(let u=0;u<r.length;u++)s=a[u+1]=s+(r[u]>i?e[l++]:1);return a}function df(r,e,i,a){const s=new Uint32Array(e[e.length-1]+1);let l=0;s[0]=l;let u=1,d=0;for(let _=0;_<r.length;_++){const m=r[_],v=e[_+1]-e[_];
16if(m===5||m===2||a&&(m===4||m===1))for(let g=0;g<v;g++)l=s[u++]=l+i[d++];else for(let g=0;g<v;g++)s[u++]=++l}return s}class ag extends Po{constructor(e,i,a){super(e,i.getBuffer(),a),this.dataVector=i}getValueFromBuffer(e){return this.dataVector.get(e)}}class sg extends zu{getValueFromBuffer(e){return this.dataBuffer[e]}}class pf extends Po{constructor(e,i,a,s){super(e,s?BigInt64Array.of(i):BigUint64Array.of(i),a)}getValueFromBuffer(e){return this.dataBuffer[0]}}function nc(r,e,i,a,s){const l=(function(u,d,_,m){const v=new Uint8Array(d);let g=0;const T=m.get()+_;for(;g<d&&!(m.get()>=T);){const b=u[m.increment()];if(b<=127){const I=b+3,M=u[m.increment()],A=Math.min(g+I,d);v.fill(M,g,A),g=A}else{const I=256-b;for(let M=0;M<I&&g<d;M++)v[g++]=u[m.increment()]}}return m.set(T),v})(r,Math.ceil(e/8),i,a);return s?(function(u,d,_){if(!_)return u;const m=_.size(),v=new Tr(u,d),g=new Tr(new Uint8Array(Math.ceil(m/8)),m);let T=0;for(let b=0;b<m;b++){const I=!!_.get(b)&&v.get(T++);g.set(b,I)}return g.getBuffer()})(l,e,s):l}const og=new TextDecoder;function pd(r,e,i){return i-e>=12?og.decode(r.subarray(e,i)):(function(a,s,l){let u="",d=s;for(;d<l;){const _=a[d];let m,v,g,T=null,b=_>239?4:_>223?3:_>191?2:1;if(d+b>l)break;b===1?_<128&&(T=_):b===2?(m=a[d+1],(192&m)==128&&(T=(31&_)<<6|63&m,T<=127&&(T=null))):b===3?(m=a[d+1],v=a[d+2],(192&m)==128&&(192&v)==128&&(T=(15&_)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):b===4&&(m=a[d+1],v=a[d+2],g=a[d+3],(192&m)==128&&(192&v)==128&&(192&g)==128&&(T=(15&_)<<18|(63&m)<<12|(63&v)<<6|63&g,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,b=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),d+=b}return u})(r,e,i)}class fd extends Po{constructor(e,i,a,s){super(e,a,s),this.offsetBuffer=i}}class ff extends fd{constructor(e,i,a,s){super(e,i,a,s??i.length-1)}getValueFromBuffer(e){return pd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Do extends fd{constructor(e,i,a,s,l){super(e,a,s,l??i.length),this.indexBuffer=i,this.indexBuffer=i}getValueFromBuffer(e){const i=this.indexBuffer[e];return pd(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class mf extends fd{constructor(e,i,a,s,l,u,d){super(e,a,s,d),this.indexBuffer=i,this.symbolOffsetBuffer=l,this.symbolTableBuffer=u}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=(function(a,s,l){const u=[],d=new Array(s.length).fill(0);for(let _=1;_<s.length;_++)d[_]=d[_-1]+s[_-1];for(let _=0;_<l.length;_++)if(l[_]===255)u.push(l[++_]);else{const m=s[l[_]],v=d[l[_]];for(let g=0;g<m;g++)u.push(a[v+g])}return new Uint8Array(u)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[e];return pd(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(e){const i=new Uint32Array(e.length-1);let a=e[0];for(let s=1;s<e.length;s++){const l=e[s];i[s-1]=l-a,a=l}return i}}function lg(r,e,i,a,s,l){return i.type==="scalarType"?(function(u,d,_,m,v,g){let T=null;if(u===0)return null;if(g.nullable){const I=Ii(d,_),M=I.numValues,A=_.get(),z=nc(d,M,I.byteLength,_);_.set(A+I.byteLength),T=new Tr(z,I.numValues)}const b=T??m;switch(v.physicalType){case 4:case 3:return(function(I,M,A,z,L){const k=Ii(I,M),F=Du(k,L,I,M),O=z.physicalType===3;if(F===ft.FLAT){const Y=ac(L)?L:void 0,J=O?cd(I,M,k,0,Y):Hi(I,M,k,0,Y);return new Jh(A.name,J,L)}if(F===ft.SEQUENCE){const Y=Jp(I,M,k);return new ed(A.name,Y[0],Y[1],k.numRleValues)}const V=O?(function(Y,J,re){const te=Co(Y,J,re);return te.length===1?lt(te[0]):(function(le){return lt(le[1])})(te)})(I,M,k):ud(I,M,k);return new td(A.name,V,L,O)})(d,_,g,v,b);case 9:return(function(I,M,A,z,L){let k=null,F=null,O=null,V=null,Y=null,J=L??null,re=null,te=null;for(let le=0;le<z;le++){const ce=Ii(M,A);switch(ce.physicalStreamType){case ai.PRESENT:{const ne=nc(M,ce.numValues,ce.byteLength,A),ie=new Tr(ne,ce.numValues);J=L??ie;break}case ai.OFFSET:F=Hi(M,A,ce,0,J);break;case ai.LENGTH:{const ne=ya(M,A,ce);Wi.DICTIONARY===ce.logicalStreamType.lengthType?k=ne:Wi.SYMBOL===ce.logicalStreamType.lengthType?V=ne:re=ne;break}case ai.DATA:{const ne=M.subarray(A.get(),A.get()+ce.byteLength);A.add(ce.byteLength);const ie=ce.logicalStreamType.dictionaryType;wr.FSST===ie?Y=ne:wr.SINGLE===ie||wr.SHARED===ie?O=ne:wr.NONE===ie&&(te=ne);break}}}return(function(le,ce,ne,ie,_e,we,xe){return ce?new mf(le,ne,ie,_e,we,ce,xe):null})(I,Y,F,k,O,V,J)??(function(le,ce,ne,ie,_e){return ce?_e?new Do(le,ne,ie,ce,_e):new Do(le,ne,ie,ce):null})(I,O,F,k,J)??(function(le,ce,ne,ie,_e){if(!ce||!ne)return null;if(ie)return _e?new Do(le,ie,ce,ne,_e):new Do(le,ie,ce,ne);if(_e&&_e.size()!==ce.length-1){const we=new Uint32Array(_e.size());let xe=0;for(let ge=0;ge<_e.size();ge++)we[ge]=_e.get(ge)?xe++:0;return new Do(le,we,ce,ne,_e)}return _e?new ff(le,ce,ne,_e):new ff(le,ce,ne)}
16)(I,re,te,F,J)})(g.name,d,_,g.nullable?u-1:u,T);case 0:return(function(I,M,A,z,L){const k=Ii(I,M),F=k.numValues,O=M.get(),V=ac(L)?L:void 0,Y=nc(I,F,k.byteLength,M,V);M.set(O+k.byteLength);const J=new Tr(Y,F);return new ag(A.name,J,L)})(d,_,g,0,b);case 6:case 5:return(function(I,M,A,z,L){const k=Ii(I,M),F=Du(k,z,I,M,"int64"),O=L.physicalType===5;if(F===ft.FLAT){const Y=ac(z)?z:void 0,J=O?(function(re,te,le,ce){return(function(ne,ie,_e){let we;switch(ie.logicalLevelTechnique1){case qe.DELTA:if(ie.logicalLevelTechnique2===qe.RLE){const xe=ie;if(!_e)return(function(ge,ke,Qe){const tt=new BigInt64Array(Qe);let st=0,oi=0n;for(let Pt=0;Pt<ke;Pt++){const Ot=Number(ge[Pt]),Gt=Pi(ge[Pt+ke]);for(let mt=0;mt<Ot;mt++)oi+=Gt,tt[st++]=oi}return tt})(ne,xe.runs,xe.numRleValues);we=Yp(ne=od(ne,xe.runs,xe.numRleValues))}else we=Yp(ne);break;case qe.RLE:we=(function(xe,ge,ke){if(ke===void 0){ke=0;for(let st=0;st<ge;st++)ke+=Number(xe[st])}const Qe=new BigInt64Array(ke);let tt=0;for(let st=0;st<ge;st++){const oi=Number(xe[st]);let Pt=xe[st+ge];Pt=Pi(Pt),Qe.fill(Pt,tt,tt+oi),tt+=oi}return Qe})(ne,ie.runs,ie.numRleValues);break;case qe.NONE:we=(function(xe){const ge=new BigInt64Array(xe.length);for(let ke=0;ke<xe.length;ke++)ge[ke]=Pi(xe[ke]);return ge})(ne);break;default:throw new Error(`The specified Logical level technique is not supported: ${ie.logicalLevelTechnique1}`)}return _e?Eo(we,_e,0n):we})(Io(re,te,le.numValues),le,ce)})(I,M,k,Y):ef(I,M,k,Y);return new rf(A.name,J,z)}if(F===ft.SEQUENCE){const Y=Qp(I,M,k);return new nf(A.name,Y[0],Y[1],k.numRleValues)}const V=O?(function(Y,J,re){const te=Io(Y,J,re.numValues);return te.length===1?Pi(te[0]):(function(le){return Pi(le[1])})(te)})(I,M,k):tf(I,M,k);return new pf(A.name,V,z,O)})(d,_,g,b,v);case 7:return(function(I,M,A,z){const L=Ii(I,M),k=ac(z)?z:void 0,F=(function(O,V,Y,J){const re=V.get(),te=re+Y*Float32Array.BYTES_PER_ELEMENT,le=new Uint8Array(O.subarray(re,te)).buffer,ce=new Float32Array(le);return V.set(te),J?Eo(ce,J,0):ce})(I,M,L.numValues,k);return new sg(A.name,F,z)})(d,_,g,b);case 8:return(function(I,M,A,z){const L=Ii(I,M),k=ac(z)?z:void 0,F=(function(O,V,Y,J){const re=V.get(),te=re+Y*Float64Array.BYTES_PER_ELEMENT,le=new Uint8Array(O.subarray(re,te)).buffer,ce=new Float64Array(le);return V.set(te),J?Eo(ce,J,0):ce})(I,M,L.numValues,k);return new Qh(A.name,F,z)})(d,_,g,b);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}})(a,r,e,s,i.scalarType,i):a===0?null:(function(u,d,_,m){let v=null,g=null,T=null,b=null,I=!1;for(;!I;){const L=Ii(u,d);switch(L.physicalStreamType){case ai.LENGTH:Wi.DICTIONARY===L.logicalStreamType.lengthType?v=ya(u,d,L):T=ya(u,d,L);break;case ai.DATA:wr.SINGLE===L.logicalStreamType.dictionaryType||wr.SHARED===L.logicalStreamType.dictionaryType?(g=u.subarray(d.get(),d.get()+L.byteLength),I=!0):b=u.subarray(d.get(),d.get()+L.byteLength),d.add(L.byteLength)}}const M=_.complexType.children,A=[];let z=0;for(const L of M){const k=mi(u,d,1)[0];if(k===0)continue;const F=L.name?`${_.name}${L.name}`:_.name;if(k!==2||L.type!=="scalarField"||L.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const O=Ii(u,d),V=nc(u,O.numValues,O.byteLength,d),Y=Ii(u,d),J=Hi(u,d,Y,0,Y.decompressedCount!==m?new Tr(V,O.numValues):void 0);A[z++]=b?new mf(F,J,v,g,T,b,new Tr(V,O.numValues)):new Do(F,J,v,g,new Tr(V,O.numValues))}return A})(r,e,i,s)}function ac(r){return r instanceof Tr}function _f(r){switch(r){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&r),e.columnScope=0;const i={type:"logicalType",logicalType:0};return i.longID=!!(2&r),e.scalarType=i,e.type="scalarType",e}case 4:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=i,e}case 30:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=i,e}default:return(function(e){let i;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const a={};a.nullable=!!(1&e),a.columnScope=0;const s={type:"physicalType"};
16return s.physicalType=i,a.type="scalarType",a.scalarType=s,a})(r)}}function gf(r){return r>=10}function yf(r){return r===30}function cg(r){if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}function ug(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}const hg=new TextDecoder;function md(r,e){const i=mi(r,e,1)[0];if(i===0)return"";const a=e.get(),s=r.subarray(a,a+i);return e.add(i),hg.decode(s)}function vf(r,e){const i=mi(r,e,1)[0]>>>0;if(i<10||i>30)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);const a=_f(i);if(gf(i)&&(a.name=md(r,e)),yf(i)){const s=mi(r,e,1)[0]>>>0;a.complexType.children=new Array(s);for(let l=0;l<s;l++)a.complexType.children[l]=vf(r,e)}return(function(s){return{name:s.name,nullable:s.nullable,scalarField:s.scalarType,complexField:s.complexType,type:s.type==="scalarType"?"scalarField":"complexField"}})(a)}function dg(r,e){const i=mi(r,e,1)[0]>>>0,a=_f(i);if(!a)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(gf(i)?a.name=md(r,e):i>=0&&i<=3?a.name="id":i===4&&(a.name="geometry"),yf(i)){const s=mi(r,e,1)[0]>>>0,l=a.complexType;l.children=new Array(s);for(let u=0;u<s;u++)l.children[u]=vf(r,e)}return a}function pg(r,e){const i={featureTables:[]},a={};a.name=md(r,e);const s=mi(r,e,1)[0]>>>0,l=mi(r,e,1)[0]>>>0;a.columns=new Array(l);for(let u=0;u<l;u++)a.columns[u]=dg(r,e);return i.featureTables.push(a),[i,s]}function fg(r,e,i,a,s,l,u=!1){const d=e.scalarType;if(!d||d.type!=="logicalType"||d.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${a}`);const _=d.longID?6:4,m=typeof l=="number"?void 0:l,v=Du(s,l,r,i,_===6?"int64":"int32");if(_===4)switch(v){case ft.FLAT:{const g=Hi(r,i,s,0,m);return new Jh(a,g,l)}case ft.SEQUENCE:{const g=Jp(r,i,s);return new ed(a,g[0],g[1],s.numRleValues)}case ft.CONST:{const g=ud(r,i,s);return new td(a,g,l,!1)}}switch(v){case ft.FLAT:{if(u){const T=(function(b,I,M){const A=(function(z,L,k){const F=new Float64Array(k);for(let O=0;O<k;O++)F[O]=tg(z,L);return F})(b,I,M.numValues);return(function(z,L){switch(L.logicalLevelTechnique1){case qe.DELTA:return L.logicalLevelTechnique2===qe.RLE&&(z=Hp(z,L.runs,L.numRleValues)),(function(k){k[0]=Mo(k[0]);const F=k.length/4*4;let O=1;if(F>=4)for(;O<F-4;O+=4){const V=k[O+1],Y=k[O+2],J=k[O+3];k[O]=Mo(k[O])+k[O-1],k[O+1]=Mo(V)+k[O],k[O+2]=Mo(Y)+k[O+1],k[O+3]=Mo(J)+k[O+2]}for(;O!==k.length;++O)k[O]=Mo(k[O])+k[O-1]})(z),z;case qe.RLE:return(function(k,F){return Hp(k,F.runs,F.numRleValues)})(z,L);case qe.NONE:return z;default:throw new Error(`The specified Logical level technique is not supported: ${L.logicalLevelTechnique1}`)}})(A,M)})(r,i,s);return new Qh(a,T,l)}const g=ef(r,i,s,m);return new rf(a,g,l)}case ft.SEQUENCE:{const g=Qp(r,i,s);return new nf(a,g[0],g[1],s.numRleValues)}case ft.CONST:{const g=tf(r,i,s);return new pf(a,g,l,!1)}}throw new Error("Vector type not supported for id column.")}class mg{constructor(e,i){var a;switch(this._featureData=e,this.properties=this._featureData.properties||{},(a=this._featureData.geometry)===null||a===void 0?void 0:a.type){case $t.POINT:case $t.MULTIPOINT:this.type=1;break;case $t.LINESTRING:case $t.MULTILINESTRING:this.type=2;break;case $t.POLYGON:case $t.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const a=[];for(const s of i)a.push(new Pe(s.x,s.y));e.push(a)}return e}}class _g{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new mg(this.features[e],this.extent)}}class xf{constructor(e){this.layers={};const i=(function(a,s,l=!0){const u=new qp(0),d=[];for(;u.get()<a.length;){const m=mi(a,u,1)[0]>>>0,v=u.get()+m;if(v>a.length)throw new Error(`Block overruns tile: ${v} > ${a.length}`);if(mi(a,u,1)[0]>>>0!=1){u.set(v);continue}const[g,T]=pg(a,u),b=g.featureTables[0];let I=null,M=null;const A=[];let z=0;for(const k of b.columns){const F=k.name;if((_=k).type==="scalarType"&&_.scalarType?.type==="logicalType"&&_.scalarType.logicalType===0){let O=null;if(k.nullable){const Y=Ii(a,u),J=u.get(),re=nc(a,Y.numValues,Y.byteLength,u);u.set(J+Y.byteLength),O=new Tr(re,Y.numValues)}const V=Ii(a,u);z=O?O.size():V.decompressedCount,I=fg(a,k,u,F,V,O??z,l)}else if(ug(k)){const O=mi(a,u,1)[0];if(z===0){const V=u.get();z=Ii(a,u).decompressedCount,u.set(V)}M=ng(a,O,u,z)}else{const O=cg(k)?mi(a,u,1)[0]:1;if(O===0)continue;const V=lg(a,u,k,O,z);if(V)if(Array.isArray(V))for(const Y of V)A.push(Y);else A.push(V)}}const L=new q_(b.name,M,I,A,T);d.push(L),u.set(v)}var _;return d})(new Uint8Array(e));this.layers=i.reduce(((a,s)=>Object.assign(Object.assign({},a),{[s.name]:new _g(s)})),{})}}class gg{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{}
16,this.extent=i,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const a of i){const s=[];for(const l of a)s.push(new Pe(l[0],l[1]));e.push(s)}return e}}const sc="_geojsonTileLayer";function yg(r,e,i=""){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const a={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let u=0;u<r.length;u++)a.feature=r.feature(u),e.writeMessage(2,vg,a);const s=a.keys;for(const u of s)e.writeStringField(3,u);const l=a.values;for(const u of l)e.writeMessage(4,wg,u)}function vg(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,xg,r),e.writeVarintField(3,i.type),e.writeMessage(4,bg,i)}function xg(r,e){for(const i in r.feature?.properties){let a=r.feature.properties[i],s=r.keycache[i];if(a==null)continue;s===void 0&&(r.keys.push(i),s=r.keys.length-1,r.keycache[i]=s),e.writeVarint(s),typeof a!="string"&&typeof a!="boolean"&&typeof a!="number"&&(a=r.jsonPrefix+JSON.stringify(a));const l=typeof a+":"+a;let u=r.valuecache[l];u===void 0&&(r.values.push(a),u=r.values.length-1,r.valuecache[l]=u),e.writeVarint(u)}}function _d(r,e){return(e<<3)+(7&r)}function bf(r){return r<<1^r>>31}function bg(r,e){const i=r.loadGeometry(),a=r.type;let s=0,l=0;for(const u of i){let d=1;a===1&&(d=u.length),e.writeVarint(_d(1,d));const _=a===3?u.length-1:u.length;for(let m=0;m<_;m++){m===1&&a!==1&&e.writeVarint(_d(2,_-1));const v=u[m].x-s,g=u[m].y-l;e.writeVarint(bf(v)),e.writeVarint(bf(g)),s+=v,l+=g}r.type===3&&e.writeVarint(_d(7,1))}}function wg(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class wf{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new _r(Re,16,0),this.grid3D=new _r(Re,16,0),this.featureIndexArray=new B,this.promoteId=i}insert(e,i,a,s,l,u){const d=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,s,l);const _=u?this.grid3D:this.grid;for(const m of i){const v=[1/0,1/0,-1/0,-1/0];for(const g of m)v[0]=Math.min(v[0],g.x),v[1]=Math.min(v[1],g.y),v[2]=Math.max(v[2],g.x),v[3]=Math.max(v[3],g.y);v[0]<Re&&v[1]<Re&&v[2]>=0&&v[3]>=0&&_.insert(d,v[0],v[1],v[2],v[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Hd(new Iu(this.rawTileData)).layers:new xf(this.rawTileData).layers,this.sourceLayerCoder=new $p(this.vtLayers?Object.keys(this.vtLayers).sort():[sc])),this.vtLayers}query(e,i,a,s){this.loadVTLayers();const l=e.params,u=Re/e.tileSize/e.scale,d=Ga(l.filter,l.globalState),_=e.queryGeometry,m=e.queryPadding*u,v=hs.fromPoints(_),g=this.grid.query(v.minX-m,v.minY-m,v.maxX+m,v.maxY+m),T=hs.fromPoints(e.cameraQueryGeometry).expandBy(m),b=this.grid3D.query(T.minX,T.minY,T.maxX,T.maxY,((A,z,L,k)=>(function(F,O,V,Y,J){for(const te of F)if(O<=te.x&&V<=te.y&&Y>=te.x&&J>=te.y)return!0;const re=[new Pe(O,V),new Pe(O,J),new Pe(Y,J),new Pe(Y,V)];if(F.length>2){for(const te of re)if(po(F,te))return!0}for(let te=0;te<F.length-1;te++)if(Qf(F[te],F[te+1],re))return!0;return!1})(e.cameraQueryGeometry,A-m,z-m,L+m,k+m)));for(const A of b)g.push(A);g.sort(Tg);const I={};let M;for(const A of g){if(A===M)continue;M=A;const z=this.featureIndexArray.get(A);let L=null;this.loadMatchingFeature(I,z.bucketIndex,z.sourceLayerIndex,z.featureIndex,d,l.layers,l.availableImages,i,a,s,((k,F,O)=>(L||(L=Hr(k)),F.queryIntersectsFeature({queryGeometry:_,feature:k,featureState:O,geometry:L,zoom:this.z,transform:e.transform,pixelsToTileUnits:u,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return I}loadMatchingFeature(e,i,a,s,l,u,d,_,m,v,g){const T=this.bucketLayerIDs[i];if(u&&!T.some((A=>u.has(A))))return;const b=this.sourceLayerCoder.decode(a),I=this.vtLayers[b].feature(s);if(l.needGeometry){const A=Xr(I,!0);
vendor: 43,040 bytes, line 16
16if(!l.filter(new ht(this.tileID.overscaledZ),A,this.tileID.canonical))return}else if(!l.filter(new ht(this.tileID.overscaledZ),I))return;const M=this.getId(I,b);for(const A of T){if(u&&!u.has(A))continue;const z=_[A];if(!z)continue;let L={};M&&v&&(L=v.getState(z.sourceLayer||sc,M));const k=Vi({},m[A]);k.paint=Tf(k.paint,z.paint,I,L,d),k.layout=Tf(k.layout,z.layout,I,L,d);const F=!g||g(I,z,L);if(!F)continue;const O=new Gp(I,this.z,this.x,this.y,M);O.layer=k;let V=e[A];V===void 0&&(V=e[A]=[]),V.push({featureIndex:s,feature:O,intersectionZ:F})}}lookupSymbolFeatures(e,i,a,s,l,u,d,_){const m={};this.loadVTLayers();const v=Ga(l.filterSpec,l.globalState);for(const g of e)this.loadMatchingFeature(m,a,s,g,v,u,d,_,i);return m}hasLayer(e){for(const i of this.bucketLayerIDs)for(const a of i)if(e===a)return!0;return!1}getId(e,i){var a;let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof s=="boolean"&&(s=Number(s)),s===void 0&&(!((a=e.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(s=Number(e.properties.cluster_id))),s}}function Tf(r,e,i,a,s){return Dr(r,((l,u)=>{const d=e instanceof is?e.get(u):null;return d?.evaluate?d.evaluate(i,a,s):d}))}function Tg(r,e){return e-r}function Sf(r,e,i,a,s){const l=[];for(const u of r){let d;for(let _=0;_<u.length-1;_++){let m=u[_],v=u[_+1];m.x<e&&v.x<e||(m.x<e?m=new Pe(e,m.y+(e-m.x)/(v.x-m.x)*(v.y-m.y))._round():v.x<e&&(v=new Pe(e,m.y+(e-m.x)/(v.x-m.x)*(v.y-m.y))._round()),m.y<i&&v.y<i||(m.y<i?m=new Pe(m.x+(i-m.y)/(v.y-m.y)*(v.x-m.x),i)._round():v.y<i&&(v=new Pe(m.x+(i-m.y)/(v.y-m.y)*(v.x-m.x),i)._round()),m.x>=a&&v.x>=a||(m.x>=a?m=new Pe(a,m.y+(a-m.x)/(v.x-m.x)*(v.y-m.y))._round():v.x>=a&&(v=new Pe(a,m.y+(a-m.x)/(v.x-m.x)*(v.y-m.y))._round()),m.y>=s&&v.y>=s||(m.y>=s?m=new Pe(m.x+(s-m.y)/(v.y-m.y)*(v.x-m.x),s)._round():v.y>=s&&(v=new Pe(m.x+(s-m.y)/(v.y-m.y)*(v.x-m.x),s)._round()),d&&m.equals(d[d.length-1])||(d=[m],l.push(d)),d.push(v)))))}}return l}function Pf(r,e,i,a,s){switch(e){case 1:return(function(l,u,d,_){const m=[];for(const v of l)for(const g of v){const T=_===0?g.x:g.y;T>=u&&T<=d&&m.push([g])}return m})(r,i,a,s);case 2:return If(r,i,a,s,!1);case 3:return If(r,i,a,s,!0)}return[]}function Sg(r,e,i,a,s){const l=a===0?Pg:Ig;let u=[];const d=[];for(let v=0;v<r.length-1;v++){const g=r[v],T=r[v+1],b=a===0?g.x:g.y,I=a===0?T.x:T.y;let M=!1;b<e?I>e&&u.push(l(g,T,e)):b>i?I<i&&u.push(l(g,T,i)):u.push(g),I<e&&b>=e&&(u.push(l(g,T,e)),M=!0),I>i&&b<=i&&(u.push(l(g,T,i)),M=!0),!s&&M&&(d.push(u),u=[])}const _=r.length-1,m=a===0?r[_].x:r[_].y;return m>=e&&m<=i&&u.push(r[_]),s&&u.length>0&&!u[0].equals(u[u.length-1])&&u.push(new Pe(u[0].x,u[0].y)),u.length>0&&d.push(u),d}function If(r,e,i,a,s){const l=[];for(const u of r){const d=Sg(u,e,i,a,s);d.length>0&&l.push(...d)}return l}function Pg(r,e,i){return new Pe(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function Ig(r,e,i){return new Pe(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Ie("FeatureIndex",wf,{omit:["rawTileData","sourceLayerCoder"]});class va extends Pe{constructor(e,i,a,s){super(e,i),this.angle=a,s!==void 0&&(this.segment=s)}clone(){return new va(this.x,this.y,this.angle,this.segment)}}function Mf(r,e,i,a,s){if(e.segment===void 0||i===0)return!0;let l=e,u=e.segment+1,d=0;for(;d>-i/2;){if(u--,u<0)return!1;d-=r[u].dist(l),l=r[u]}d+=r[u].dist(r[u+1]),u++;const _=[];let m=0;for(;d<i/2;){const v=r[u],g=r[u+1];if(!g)return!1;let T=r[u-1].angleTo(v)-v.angleTo(g);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:d,angleDelta:T}),m+=T;d-_[0].distance>a;)m-=_.shift().angleDelta;if(m>s)return!1;u++,d+=v.dist(g)}return!0}function Ef(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Cf(r,e,i){return r?.6*e*i:0}function Af(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function Mg(r,e,i,a,s,l){const u=Cf(i,s,l),d=Af(i,a)*l;let _=0;const m=Ef(r)/2;for(let v=0;v<r.length-1;v++){const g=r[v],T=r[v+1],b=g.dist(T);if(_+b>m){const I=(m-_)/b,M=Di.number(g.x,T.x,I),A=Di.number(g.y,T.y,I),z=new va(M,A,T.angleTo(g),v);return z._round(),!u||Mf(r,z,d,u,e)?z:void 0}_+=b}}function Eg(r,e,i,a,s,l,u,d,_){const m=Cf(a,l,u),v=Af(a,s),g=v*u,T=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-g<e/4&&(e=g+e/4),zf(r,T?e/2*d%e:(v/2+2*l)*u*d%e,e,m,i,g,T,!1,_)}function zf(r,e,i,a,s,l,u,d,_){const m=l/2,v=Ef(r);let g=0,T=e-i,b=[];for(let I=0;I<r.length-1;I++){const M=r[I],A=r[I+1],z=M.dist(A),L=A.angleTo(M);for(;T+i<g+z;){T+=i;const k=(T-g)/z,F=Di.number(M.x,A.x,k),O=Di.number(M.y,A.y,k);if(F>=0&&F<_&&O>=0&&O<_&&T-m>=0&&T+m<=v){const V=new va(F,O,L,I);V._round(),a&&!Mf(r,V,l,a,s)||b.push(V)}}g+=z}return d||b.length||u||(b=zf(r,g/2,i,a,s,l,u,!0,_)),b}function Df(r,e,i,a){const s=[],l=r.image,u=l.pixelRatio,d=l.paddedRect.w-2,_=l.paddedRect.h-2;let m={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=l.stretchX||[[0,d]],g=l.stretchY||[[0,_]],T=(ie,_e)=>ie+_e[1]-_e[0],b=v.reduce(T,0),I=g.reduce(T,0),M=d-b,A=_-I;let z=0,L=b,k=0,F=I,O=0,V=M,Y=0,J=A;if(l.content&&a){const ie=l.content,_e=ie[2]-ie[0],we=ie[3]-ie[1];(l.textFitWidth||l.textFitHeight)&&(m=Mp(r)),z=ku(v,0,ie[0]),k=ku(g,0,ie[1]),L=ku(v,ie[0],ie[2]),F=ku(g,ie[1],ie[3]),O=ie[0]-z,Y=ie[1]-k,V=_e-L,J=we-F}const re=m.x1,te=m.y1,le=m.x2-re,ce=m.y2-te,ne=(ie,_e,we,xe)=>{const ge=Ru(ie.stretch-z,L,le,re),ke=Lu(ie.fixed-O,V,ie.stretch,b),Qe=Ru(_e.stretch-k,F,ce,te),tt=Lu(_e.fixed-Y,J,_e.stretch,I),st=Ru(we.stretch-z,L,le,re),oi=Lu(we.fixed-O,V,we.stretch,b),Pt=Ru(xe.stretch-k,F,ce,te),Ot=Lu(xe.fixed-Y,J,xe.stretch,I),Gt=new Pe(ge,Qe),mt=new Pe(st,Qe),ei=new Pe(st,Pt),_i=new Pe(ge,Pt),gi=new Pe(ke/u,tt/u),Bi=new Pe(oi/u,Ot/u),li=e*Math.PI/180;if(li){const Zt=Math.sin(li),xt=Math.cos(li),Lt=[xt,-Zt,Zt,xt];Gt._matMult(Lt),mt._matMult(Lt),_i._matMult(Lt),ei._matMult(Lt)}const Oi=ie.stretch+ie.fixed,hr=_e.stretch+_e.fixed;return{tl:Gt,tr:mt,bl:_i,br:ei,tex:{x:l.paddedRect.x+1+Oi,y:l.paddedRect.y+1+hr,w:we.stretch+we.fixed-Oi,h:xe.stretch+xe.fixed-hr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:gi,pixelOffsetBR:Bi,minFontScaleX:V/u/le,minFontScaleY:J/u/ce,isSDF:i}};if(a&&(l.stretchX||l.stretchY)){const ie=kf(v,M,b),_e=kf(g,A,I);for(let we=0;we<ie.length-1;we++){const xe=ie[we],ge=ie[we+1];for(let ke=0;ke<_e.length-1;ke++)s.push(ne(xe,_e[ke],ge,_e[ke+1]))}}else s.push(ne({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:d+1},{fixed:0,stretch:_+1}));return s}function ku(r,e,i){let a=0;for(const s of r)a+=Math.max(e,Math.min(i,s[1]))-Math.max(e,Math.min(i,s[0]));return a}function kf(r,e,i){const a=[{fixed:-1,stretch:0}];for(const[s,l]of r){const u=a[a.length-1];a.push({fixed:s-u.stretch,stretch:u.stretch}),a.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}return a.push({fixed:e+1,stretch:i}),a}function Ru(r,e,i,a){return r/e*i+a}function Lu(r,e,i,a){return r-e*i/a}Ie("Anchor",va);class Fu{constructor(e,i,a,s,l,u,d,_,m,v){var g;if(this.boxStartIndex=e.length,m){let T=u.top,b=u.bottom;const I=u.collisionPadding;I&&(T-=I[1],b+=I[3]);let M=b-T;M>0&&(M=Math.max(10,M),this.circleDiameter=M)}else{const T=!((g=u.image)===null||g===void 0)&&g.content&&(u.image.textFitWidth||u.image.textFitHeight)?Mp(u):{x1:u.left,y1:u.top,x2:u.right,y2:u.bottom};T.y1=T.y1*d-_[0],T.y2=T.y2*d+_[2],T.x1=T.x1*d-_[3],T.x2=T.x2*d+_[1];const b=u.collisionPadding;if(b&&(T.x1-=b[0]*d,T.y1-=b[1]*d,T.x2+=b[2]*d,T.y2+=b[3]*d),v){const I=new Pe(T.x1,T.y1),M=new Pe(T.x2,T.y1),A=new Pe(T.x1,T.y2),z=new Pe(T.x2,T.y2),L=v*Math.PI/180;I._rotate(L),M._rotate(L),A._rotate(L),z._rotate(L),T.x1=Math.min(I.x,M.x,A.x,z.x),T.x2=Math.max(I.x,M.x,A.x,z.x),T.y1=Math.min(I.y,M.y,A.y,z.y),T.y2=Math.max(I.y,M.y,A.y,z.y)}e.emplaceBack(i.x,i.y,T.x1,T.y1,T.x2,T.y2,a,s,l)}this.boxEndIndex=e.length}}class Cg{constructor(e=[],i=(a,s)=>a<s?-1:a>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:a}=this,s=i[e];for(;e>0;){const l=e-1>>1,u=i[l];if(a(s,u)>=0)break;i[e]=u,e=l}i[e]=s}_down(e){const{data:i,compare:a}=this,s=this.length>>1,l=i[e];for(;e<s;){let u=1+(e<<1);const d=u+1;if(d<this.length&&a(i[d],i[u])<0&&(u=d),a(i[u],l)>=0)break;i[e]=i[u],e=u}i[e]=l}}function Ag(r,e=1){const i=hs.fromPoints(r[0]),a=Math.min(i.width(),i.height());let s=a/2;const l=new Cg([],zg),{minX:u,minY:d,maxX:_,maxY:m}=i;if(a===0)return new Pe(u,d);for(let T=u;T<_;T+=a)for(let b=d;b<m;b+=a)l.push(new ko(T+s,b+s,s,r));const v=(function(T){let b=0,I=0,M=0;const A=T[0];for(let z=0,L=A.length,k=L-1;z<L;k=z++){const F=A[z],O=A[k],V=F.x*O.y-O.x*F.y;I+=(F.x+O.x)*V,M+=(F.y+O.y)*V,b+=3*V}return new ko(I/b,M/b,0,T)})(r);let g=v;for(;l.length;){const T=l.pop();(T.d>g.d||!g.d)&&(g=T),T.max-g.d<=e||(s=T.h/2,l.push(new ko(T.p.x-s,T.p.y-s,s,r)),l.push(new ko(T.p.x+s,T.p.y-s,s,r)),l.push(new ko(T.p.x-s,T.p.y+s,s,r)),l.push(new ko(T.p.x+s,T.p.y+s,s,r)))}return v.d>0&&g.d-v.d<=e?v.p:g.p}function zg(r,e){return e.max-r.max}class ko{constructor(e,i,a,s){this.p=new Pe(e,i),this.h=a,this.d=(function(l,u){let d=!1,_=1/0;for(const m of u)for(let v=0,g=m.length,T=g-1;v<g;T=v++){const b=m[v],I=m[T];b.y>l.y!=I.y>l.y&&l.x<(I.x-b.x)*(l.y-b.y)/(I.y-b.y)+b.x&&(d=!d),_=Math.min(_,Td(l,b,I))}return(d?1:-1)*Math.sqrt(_)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}}var si;R.aM=void 0,(si=R.aM||(R.aM={}))[si.center=1]="center",si[si.left=2]="left",si[si.right=3]="right",si[si.top=4]="top",si[si.bottom=5]="bottom",si[si["top-left"]=6]="top-left",si[si["top-right"]=7]="top-right",si[si["bottom-left"]=8]="bottom-left",si[si["bottom-right"]=9]="bottom-right";const gd=Number.POSITIVE_INFINITY;function Rf(r,e){return e[1]!==gd?(function(i,a,s){let l=0,u=0;switch(a=Math.abs(a),s=Math.abs(s),i){case"top-right":case"top-left":case"top":u=s-7;break;case"bottom-right":case"bottom-left":case"bottom":u=7-s}switch(i){case"top-right":case"bottom-right":case"right":l=-a;break;case"top-left":case"bottom-left":case"left":l=a}return[l,u]})(r,e[0],e[1]):(function(i,a){let s=0,l=0;a<0&&(a=0);const u=a/Math.SQRT2;switch(i){case"top-right":case"top-left":l=u-7;break;case"bottom-right":case"bottom-left":l=7-u;break;case"bottom":l=7-a;break;case"top":l=a-7}switch(i){case"top-right":case"bottom-right":s=-u;break;case"top-left":case"bottom-left":s=u;break;case"left":s=a;break;case"right":s=-a}return[s,l]})(r,e[0])}function Lf(r,e,i){var a;const s=r.layout,l=(a=s.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(e,{},i);if(l){const d=l.values,_=[];for(let m=0;m<d.length;m+=2){const v=_[m]=d[m],g=d[m+1].map((T=>T*Ut));v.startsWith("top")?g[1]-=7:v.startsWith("bottom")&&(g[1]+=7),_[m+1]=g}return new ui(_)}const u=s.get("text-variable-anchor");if(u){let d;d=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[s.get("text-radial-offset").evaluate(e,{},i)*Ut,gd]:s.get("text-offset").evaluate(e,{},i).map((m=>m*Ut));const _=[];for(const m of u)_.push(m,Rf(m,d));return new ui(_)}return null}function yd(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Dg(r,e,i,a,s,l,u,d,_,m,v,g){let T=l.textMaxSize.evaluate(e,{});T===void 0&&(T=u);const b=r.layers[0].layout,I=b.get("icon-offset").evaluate(e,{},v),M=Bf(i.horizontal),A=u/24,z=r.tilePixelRatio*A,L=r.tilePixelRatio*T/24,k=r.tilePixelRatio*d,F=r.tilePixelRatio*b.get("symbol-spacing"),O=b.get("text-padding")*r.tilePixelRatio,V=(function(we,xe,ge,ke=1){const Qe=we.get("icon-padding").evaluate(xe,{},ge),tt=Qe?.values;return[tt[0]*ke,tt[1]*ke,tt[2]*ke,tt[3]*ke]})(b,e,v,r.tilePixelRatio),Y=b.get("text-max-angle")/180*Math.PI,J=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point",re=b.get("icon-rotation-alignment")==="map"&&b.get("symbol-placement")!=="point",te=b.get("symbol-placement"),le=F/2,ce=b.get("icon-text-fit");let ne;a&&ce!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(ne=Ep(a,i.vertical,ce,b.get("icon-text-fit-padding"),I,A)),M&&(a=Ep(a,M,ce,b.get("icon-text-fit-padding"),I,A)));const ie=v?g.line.getGranularityForZoomLevel(v.z):1,_e=(we,xe)=>{xe.x<0||xe.x>=Re||xe.y<0||xe.y>=Re||(function(ge,ke,Qe,tt,st,oi,Pt,Ot,Gt,mt,ei,_i,gi,Bi,li,Oi,hr,Zt,xt,Lt,It,qt,Rn,Sr,oc){const xa=ge.addToLineVertexArray(ke,Qe);let ps,Ro,Lo,Fo,Of=0,jf=0,Vf=0,Nf=0,vd=-1,xd=-1;const Ln={};let Uf=Nt("");if(ge.allowVerticalPlacement&&tt.vertical){const yi=Ot.layout.get("text-rotate").evaluate(It,{},Sr)+90;Lo=new Fu(Gt,ke,mt,ei,_i,tt.vertical,gi,Bi,li,yi),Pt&&(Fo=new Fu(Gt,ke,mt,ei,_i,Pt,hr,Zt,li,yi))}if(st){const yi=Ot.layout.get("icon-rotate").evaluate(It,{}),nr=Ot.layout.get("icon-text-fit")!=="none",fs=Df(st,yi,Rn,nr),Ir=Pt?Df(Pt,yi,Rn,nr):void 0;Ro=new Fu(Gt,ke,mt,ei,_i,st,hr,Zt,!1,yi),Of=4*fs.length;const ms=ge.iconSizeData;let Yr=null;ms.kind==="source"?(Yr=[Dn*Ot.layout.get("icon-size").evaluate(It,{})],Yr[0]>fa&&Ht(`${ge.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):ms.kind==="composite"&&(Yr=[Dn*qt.compositeIconSizes[0].evaluate(It,{},Sr),Dn*qt.compositeIconSizes[1].evaluate(It,{},Sr)],(Yr[0]>fa||Yr[1]>fa)&&Ht(`${ge.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),ge.addSymbols(ge.icon,fs,Yr,Lt,xt,It,R.ax.none,ke,xa.lineStartIndex,xa.lineLength,-1,Sr),vd=ge.icon.placedSymbolArray.length-1,Ir&&(jf=4*Ir.length,ge.addSymbols(ge.icon,Ir,Yr,Lt,xt,It,R.ax.vertical,ke,xa.lineStartIndex,xa.lineLength,-1,Sr),xd=ge.icon.placedSymbolArray.length-1)}const $f=Object.keys(tt.horizontal);for(const yi of $f){const nr=tt.horizontal[yi];if(!ps){Uf=Nt(nr.text);const Ir=Ot.layout.get("text-rotate").evaluate(It,{},Sr);ps=new Fu(Gt,ke,mt,ei,_i,nr,gi,Bi,li,Ir)}const fs=nr.positionedLines.length===1;if(Vf+=Ff(ge,ke,nr,oi,Ot,li,It,Oi,xa,tt.vertical?R.ax.horizontal:R.ax.horizontalOnly,fs?$f:[yi],Ln,vd,qt,Sr),fs)break}tt.vertical&&(Nf+=Ff(ge,ke,tt.vertical,oi,Ot,li,It,Oi,xa,R.ax.vertical,["vertical"],Ln,xd,qt,Sr));const Rg=ps?ps.boxStartIndex:ge.collisionBoxArray.length,Lg=ps?ps.boxEndIndex:ge.collisionBoxArray.length,Fg=Lo?Lo.boxStartIndex:ge.collisionBoxArray.length,Bg=Lo?Lo.boxEndIndex:ge.collisionBoxArray.length,Og=Ro?Ro.boxStartIndex:ge.collisionBoxArray.length,jg=Ro?Ro.boxEndIndex:ge.collisionBoxArray.length,Vg=Fo?Fo.boxStartIndex:ge.collisionBoxArray.length,Ng=Fo?Fo.boxEndIndex:ge.collisionBoxArray.length;let Pr=-1;const Bu=(yi,nr)=>yi?.circleDiameter?Math.max(yi.circleDiameter,nr):nr;Pr=Bu(ps,Pr),Pr=Bu(Lo,Pr),Pr=Bu(Ro,Pr),Pr=Bu(Fo,Pr);const Gf=Pr>-1?1:0;Gf&&(Pr*=oc/Ut),ge.glyphOffsetArray.length>=To.MAX_GLYPHS&&Ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),It.sortKey!==void 0&&ge.addToSortKeyRanges(ge.symbolInstances.length,It.sortKey);const Ug=Lf(Ot,It,Sr),[$g,Gg]=(function(yi,nr){const fs=yi.length,Ir=nr?.values;if(Ir?.length>0)for(let ms=0;ms<Ir.length;ms+=2){const Yr=Ir[ms+1];yi.emplaceBack(R.aM[Ir[ms]],Yr[0],Yr[1])}return[fs,yi.length]})(ge.textAnchorOffsets,Ug);ge.symbolInstances.emplaceBack(ke.x,ke.y,Ln.right>=0?Ln.right:-1,Ln.center>=0?Ln.center:-1,Ln.left>=0?Ln.left:-1,Ln.vertical||-1,vd,xd,Uf,Rg,Lg,Fg,Bg,Og,jg,Vg,Ng,mt,Vf,Nf,Of,jf,Gf,0,gi,Pr,$g,Gg)})(r,xe,we,i,a,s,ne,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,z,[O,O,O,O],J,_,k,V,re,I,e,l,m,v,u)};if(te==="line")for(const we of Sf(e.geometry,0,0,Re,Re)){const xe=us(we,ie),ge=Eg(xe,F,Y,i.vertical||M,a,24,L,r.overscaling,Re);for(const ke of ge)M&&kg(r,M.text,le,ke)||_e(xe,ke)}else if(te==="line-center"){for(const we of e.geometry)if(we.length>1){const xe=us(we,ie),ge=Mg(xe,Y,i.vertical||M,a,24,L);ge&&_e(xe,ge)}}else if(e.type==="Polygon")for(const we of Ls(e.geometry,0)){const xe=Ag(we,16);_e(us(we[0],ie,!0),new va(xe.x,xe.y,0))}else if(e.type==="LineString")for(const we of e.geometry){const xe=us(we,ie);_e(xe,new va(xe[0].x,xe[0].y,0))}else if(e.type==="Point")for(const we of e.geometry)for(const xe of we)_e([xe],new va(xe.x,xe.y,0))}function Ff(r,e,i,a,s,l,u,d,_,m,v,g,T,b,I){const M=(function(L,k,F,O,V,Y,J,re){const te=O.layout.get("text-rotate").evaluate(Y,{})*Math.PI/180,le=[];for(const ce of k.positionedLines)for(const ne of ce.positionedGlyphs){if(!ne.rect)continue;const ie=ne.rect||{};let _e=4,we=!0,xe=1,ge=0;const ke=(V||re)&&ne.vertical,Qe=ne.metrics.advance*ne.scale/2;if(re&&k.verticalizable&&(ge=ce.lineOffset/2-(ne.imageName?-(Ut-ne.metrics.width*ne.scale)/2:(ne.scale-1)*Ut)),ne.imageName){const Zt=J[ne.imageName];we=Zt.sdf,xe=Zt.pixelRatio,_e=1/xe}const tt=V?[ne.x+Qe,ne.y]:[0,0];let st=V?[0,0]:[ne.x+Qe+F[0],ne.y+F[1]-ge],oi=[0,0];ke&&(oi=st,st=[0,0]);const Pt=ne.metrics.isDoubleResolution?2:1,Ot=(ne.metrics.left-_e)*ne.scale-Qe+st[0],Gt=(-ne.metrics.top-_e)*ne.scale+st[1],mt=Ot+ie.w/Pt*ne.scale/xe,ei=Gt+ie.h/Pt*ne.scale/xe,_i=new Pe(Ot,Gt),gi=new Pe(mt,Gt),Bi=new Pe(Ot,ei),li=new Pe(mt,ei);if(ke){const Zt=new Pe(-Qe,Qe- -17),xt=-Math.PI/2,Lt=12-Qe,It=new Pe(22-Lt,-(ne.imageName?Lt:0)),qt=new Pe(...oi);_i._rotateAround(xt,Zt)._add(It)._add(qt),gi._rotateAround(xt,Zt)._add(It)._add(qt),Bi._rotateAround(xt,Zt)._add(It)._add(qt),li._rotateAround(xt,Zt)._add(It)._add(qt)}if(te){const Zt=Math.sin(te),xt=Math.cos(te),Lt=[xt,-Zt,Zt,xt];_i._matMult(Lt),gi._matMult(Lt),Bi._matMult(Lt),li._matMult(Lt)}const Oi=new Pe(0,0),hr=new Pe(0,0);le.push({tl:_i,tr:gi,bl:Bi,br:li,tex:ie,writingMode:k.writingMode,glyphOffset:tt,sectionIndex:ne.sectionIndex,isSDF:we,pixelOffsetTL:Oi,pixelOffsetBR:hr,minFontScaleX:0,minFontScaleY:0})}return le})(0,i,d,s,l,u,a,r.allowVerticalPlacement),A=r.textSizeData;let z=null;A.kind==="source"?(z=[Dn*s.layout.get("text-size").evaluate(u,{})],z[0]>fa&&Ht(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):A.kind==="composite"&&(z=[Dn*b.compositeTextSizes[0].evaluate(u,{},I),Dn*b.compositeTextSizes[1].evaluate(u,{},I)],(z[0]>fa||z[1]>fa)&&Ht(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,M,z,d,l,u,m,e,_.lineStartIndex,_.lineLength,T,I);for(const L of v)g[L]=r.text.placedSymbolArray.length-1;return 4*M.length}function Bf(r){for(const e in r)return r[e];return null}function kg(r,e,i,a){const s=r.compareText;if(e in s){const l=s[e];for(let u=l.length-1;u>=0;u--)if(a.dist(l[u])<i)return!0}else s[e]=[];return s[e].push(a),!1}R.$=lc,R.A=Ft,R.B=Qs,R.C=eu,R.D=Ee,R.E=vs,R.F=or,R.G=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},R.H=Di,R.I=$h,R.J=ht,R.K=Ja,R.L=function(r){if(xi==null){const e=r.navigator?r.navigator.userAgent:null;xi=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return xi},R.M=Ni,R.N=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new G_((()=>this.process())),this.subscription=_s(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=Xt(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,a)=>{const s=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=e?_s(e.signal,"abort",(()=>{l?.unsubscribe(),delete this.resolveRejects[s];const _={id:s,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(_)}),Z_):null;this.resolveRejects[s]={resolve:_=>{l?.unsubscribe(),i(_)},reject:_=>{l?.unsubscribe(),a(_)}};const u=[],d=Object.assign(Object.assign({},r),{id:s,sourceMapId:this.mapId,origin:location.origin,data:gr(r.data,u)});this.target.postMessage(d,{transfer:u})}))}receive(r){const e=r.data,i=e.id,a=["file://","resource://android","null"],s=[e.origin,location.origin],l=e.origin===location.origin,u=s.some((d=>a.includes(d)));if((l||u)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const d=this.abortControllers[i];return delete this.abortControllers[i],void(d&&d.abort())}if(Xt(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return p(this,void 0,void 0,(function*(){if(e.type==="<response>"){const s=this.resolveRejects[r];return delete this.resolveRejects[r],s?void(e.error?s.reject(wt(es(e.error))):s.resolve(es(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=es(e.data),a=new AbortController;this.abortControllers[r]=a;try{const s=yield this.messageHandlers[e.type](e.sourceMapId,i,a);this.completeTask(r,null,s)}catch(s){this.completeTask(r,wt(s))}}))}completeTask(r,e,i){const a=[];delete this.abortControllers[r];const s={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?gr(e):null,data:gr(i,a)};this.target.postMessage(s,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},R.O=function(){var r=new Ft(16);return Ft!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},R.P=Pe,R.Q=function(r,e,i){var a,s,l,u,d,_,m,v,g,T,b,I,M=i[0],A=i[1],z=i[2];return e===r?(r[12]=e[0]*M+e[4]*A+e[8]*z+e[12],r[13]=e[1]*M+e[5]*A+e[9]*z+e[13],r[14]=e[2]*M+e[6]*A+e[10]*z+e[14],r[15]=e[3]*M+e[7]*A+e[11]*z+e[15]):(s=e[1],l=e[2],u=e[3],d=e[4],_=e[5],m=e[6],v=e[7],g=e[8],T=e[9],b=e[10],I=e[11],r[0]=a=e[0],r[1]=s,r[2]=l,r[3]=u,r[4]=d,r[5]=_,r[6]=m,r[7]=v,r[8]=g,r[9]=T,r[10]=b,r[11]=I,r[12]=a*M+d*A+g*z+e[12],r[13]=s*M+_*A+T*z+e[13],r[14]=l*M+m*A+b*z+e[14],r[15]=u*M+v*A+I*z+e[15]),r},R.R=Fi,R.S=function(r,e,i){var a=i[0],s=i[1],l=i[2];return r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r[3]=e[3]*a,r[4]=e[4]*s,r[5]=e[5]*s,r[6]=e[6]*s,r[7]=e[7]*s,r[8]=e[8]*l,r[9]=e[9]*l,r[10]=e[10]*l,r[11]=e[11]*l,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},R.T=vh,R.U=function(r,e,i){var a=e[0],s=e[1],l=e[2],u=e[3],d=e[4],_=e[5],m=e[6],v=e[7],g=e[8],T=e[9],b=e[10],I=e[11],M=e[12],A=e[13],z=e[14],L=e[15],k=i[0],F=i[1],O=i[2],V=i[3];return r[0]=k*a+F*d+O*g+V*M,r[1]=k*s+F*_+O*T+V*A,r[2]=k*l+F*m+O*b+V*z,r[3]=k*u+F*v+O*I+V*L,r[4]=(k=i[4])*a+(F=i[5])*d+(O=i[6])*g+(V=i[7])*M,r[5]=k*s+F*_+O*T+V*A,r[6]=k*l+F*m+O*b+V*z,r[7]=k*u+F*v+O*I+V*L,r[8]=(k=i[8])*a+(F=i[9])*d+(O=i[10])*g+(V=i[11])*M,r[9]=k*s+F*_+O*T+V*A,r[10]=k*l+F*m+O*b+V*z,r[11]=k*u+F*v+O*I+V*L,r[12]=(k=i[12])*a+(F=i[13])*d+(O=i[14])*g+(V=i[15])*M,r[13]=k*s+F*_+O*T+V*A,r[14]=k*l+F*m+O*b+V*z,r[15]=k*u+F*v+O*I+V*L,r},R.V=function(r,e){const i={};for(const a of e)a in r&&(i[a]=r[a]);return i},R.W=ma,R.X=On,R.Y=Bp,R.Z=Fp,R._=p,R.a=Pa,R.a$=function(r){var e=new Ft(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},R.a0=en,R.a1=Ei,R.a2=Oo,R.a3=qi,R.a4=jp,R.a5=Au,R.a6=Re,R.a7=rc,R.a8=hs,R.a9=25,R.aA=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},R.aB=function(r){return r[0]=0,r[1]=0,r},R.aC=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},R.aD=qh,R.aE=He,R.aF=function(r,e,i,a){const s=e.y-r.y,l=e.x-r.x,u=a.y-i.y,d=a.x-i.x,_=u*l-d*s;if(_===0)return null;const m=(d*(r.y-i.y)-u*(r.x-i.x))/_;return new Pe(r.x+m*l,r.y+m*s)},R.aG=Sf,R.aH=ho,R.aI=function(r){let e=1/0,i=1/0,a=-1/0,s=-1/0;for(const l of r)e=Math.min(e,l.x),i=Math.min(i,l.y),a=Math.max(a,l.x),s=Math.max(s,l.y);return[e,i,a,s]},R.aJ=Ut,R.aK=bt,R.aL=function(r,e,i,a,s=!1){if(!i[0]&&!i[1])return[0,0];const l=s?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(l){const u=Math.sin(l),d=Math.cos(l);i=[i[0]*d-i[1]*u,i[0]*u+i[1]*d]}return[s?i[0]:bt(e,i[0],r.zoom),s?i[1]:bt(e,i[1],r.zoom)]},R.aN=Zh,R.aO=yd,R.aP=Gh,R.aQ=r=>r.type==="symbol",R.aR=xu,R.aS=dt,R.aT=vu,R.aU=j,R.aV=Se,R.aW=de,R.aX=sn,R.aY=Vp,R.aZ=K,R.a_=W,R.aa=Kh,R.ab=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const a of r){const s=window.document.createElement("source");Ki(a)||(e.crossOrigin="Anonymous"),s.src=a,e.appendChild(s)}}))},R.ac=ve,R.ad=function(){return Sa++},R.ae=c,R.af=To,R.ag=sc,R.ah=Ga,R.ai=Xr,R.aj=Gp,R.ak=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,a,s,l)=>{const u=s||l;return e[a]=!u||u.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},R.al=ci,R.am=85.051129,R.an=Rr,R.ao=function(r){return Math.pow(2,r)},R.ap=Bn,R.aq=Op,R.ar=function(r){return Math.log(r)/Math.LN2},R.as=function(r){var e=r[0],i=r[1];return e*e+i*i},R.at=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((_=>_.canonical.z)));let i=1/0,a=-1/0,s=1/0,l=-1/0;const u=[];for(const _ of r){const{x:m,y:v,z:g}=_.canonical,T=Math.pow(2,e-g),b=m*T,I=v*T;u.push({id:_,x:b,y:I}),b<i&&(i=b),b>a&&(a=b),I<s&&(s=I),I>l&&(l=I)}const d=new Set;for(const _ of u)_.x!==i&&_.x!==a&&_.y!==s&&_.y!==l||d.add(_.id);return d},R.au=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||a-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},R.av=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const a=r.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const s={value:e,timeout:void 0};if(i!==void 0&&(s.timeout=setTimeout((()=>{this.remove(r,s)}),i)),this.data[a].push(s),this.order.push(a),this.order.length>this.max){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,a=e===void 0?0:this.data[i].indexOf(e),s=this.data[i][a];return this.data[i].splice(a,1),s.timeout&&clearTimeout(s.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(s.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const a of this.data[i])r(a.value)||e.push(a);for(const i of e)this.remove(i.value.tileID,i)}},R.aw=function(r,e){let i=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:s,minZoom:l,maxZoom:u}=r,d=s?ci(At.interpolationFactor(s,e,l,u),0,1):0;r.kind==="camera"?a=Di.number(r.minSize,r.maxSize,d):i=d}return{uSizeT:i,uSize:a}},R.ay=function(r,{uSize:e,uSizeT:i},{lowerSize:a,upperSize:s}){return r.kind==="source"?a/Dn:r.kind==="composite"?Di.number(a/Dn,s/Dn,i):e},R.az=Ve,R.b=an,R.b$=lo,R.b0=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},R.b1=function(r,e){var i=e[0],a=e[1],s=e[2],l=i*i+a*a+s*s;return l>0&&(l=1/Math.sqrt(l)),r[0]=e[0]*l,r[1]=e[1]*l,r[2]=e[2]*l,r},R.b2=ee,R.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},R.b4=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},R.b5=wa,R.b6=function(r,e,i){const a=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return a===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/a},R.b7=Ce,R.b8=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},R.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},R.bA=We,R.bB=function(r,e,i){var a=i[0],s=i[1],l=i[2],u=i[3],d=e[0],_=e[1],m=e[2],v=s*m-l*_,g=l*d-a*m,T=a*_-s*d;return r[0]=d+u*(v+=v)+s*(T+=T)-l*(g+=g),r[1]=_+u*g+l*v-a*T,r[2]=m+u*T+a*g-s*v,r},R.bC=function(r,e,i){const a=(s=[r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((v=s[8])*(u=s[4])-(d=s[5])*(m=s[7]))+s[1]*(-v*(l=s[3])+d*(_=s[6]))+s[2]*(m*l-u*_);var s,l,u,d,_,m,v;if(a===0)return null;const g=ee([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),T=ee([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),b=ee([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),I=K([],g,-r[3]);return W(I,I,K([],T,-e[3])),W(I,I,K([],b,-i[3])),K(I,I,1/a),I},R.bD=Yh,R.bE=function(){return new Float64Array(4)},R.bF=function(r,e,i,a){var s=[],l=[];return s[0]=e[0]-i[0],s[1]=e[1]-i[1],s[2]=e[2]-i[2],l[0]=s[0]*Math.cos(a)-s[1]*Math.sin(a),l[1]=s[0]*Math.sin(a)+s[1]*Math.cos(a),l[2]=s[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bG=function(r,e,i,a){var s=[],l=[];return s[0]=e[0]-i[0],s[1]=e[1]-i[1],s[2]=e[2]-i[2],l[0]=s[0],l[1]=s[1]*Math.cos(a)-s[2]*Math.sin(a),l[2]=s[1]*Math.sin(a)+s[2]*Math.cos(a),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bH=function(r,e,i,a){var s=[],l=[];return s[0]=e[0]-i[0],s[1]=e[1]-i[1],s[2]=e[2]-i[2],l[0]=s[2]*Math.sin(a)+s[0]*Math.cos(a),l[1]=s[1],l[2]=s[2]*Math.cos(a)-s[0]*Math.sin(a),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bI=function(r,e,i){var a=Math.sin(i),s=Math.cos(i),l=e[0],u=e[1],d=e[2],_=e[3],m=e[8],v=e[9],g=e[10],T=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*s-m*a,r[1]=u*s-v*a,r[2]=d*s-g*a,r[3]=_*s-T*a,r[8]=l*a+m*s,r[9]=u*a+v*s,r[10]=d*a+g*s,r[11]=_*a+T*s,r},R.bJ=function(r,e){const i=Yi(r,360),a=Yi(e,360),s=a-i,l=a>i?s-360:s+360;return Math.abs(s)<Math.abs(l)?s:l},R.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},R.bL=function(r,e,i,a){const s=Math.sqrt(r*r+e*e),l=Math.sqrt(i*i+a*a);r/=s,e/=s,i/=l,a/=l;const u=Math.acos(r*i+e*a);return-e*i+r*a>0?u:-u},R.bM=function(r,e){const i=Yi(r,2*Math.PI),a=Yi(e,2*Math.PI);return Math.min(Math.abs(i-a),Math.abs(i-a+2*Math.PI),Math.abs(i-a-2*Math.PI))},R.bN=function(){const r={},e=ue.$version;for(const i in ue.$root){const a=ue.$root[i];if(a.required){let s=null;s=i==="version"?e:a.type==="array"?[]:{},s!=null&&(r[i]=s)}}return r},R.bO=No,R.bP=Pl,R.bQ=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let a=0;a<e.length;a++)if(!r(e[a],i[a]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const a in e)if(!r(e[a],i[a]))return!1;return!0}return e===i},R.bR=ys,R.bS=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=$o(r[i],e[r[i].ref]));return r},R.bT=function(r,e){if(r.type==="custom")return new $_(r,e);switch(r.type){case"background":return new U_(r,e);case"circle":return new sm(r,e);case"color-relief":return new dm(r,e);case"fill":return new Mm(r,e);case"fill-extrusion":return new jm(r,e);case"heatmap":return new lm(r,e);case"hillshade":return new um(r,e);case"line":return new h_(r,e);case"raster":return new hh(r,e);case"symbol":return new Cu(r,e)}},R.bU=r=>r.type==="raster",R.bV=Fe,R.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!nt(r.version,e.version))return[{command:"setStyle",args:[e]}];nt(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),nt(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),nt(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),nt(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),nt(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),nt(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),nt(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),nt(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),nt(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),nt(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),nt(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),nt(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),nt(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),nt(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const a={},s=[];(function(u,d,_,m){let v;for(v in d=d||{},u=u||{})Object.prototype.hasOwnProperty.call(u,v)&&(Object.prototype.hasOwnProperty.call(d,v)||cc(v,_,m));for(v in d)Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(u,v)?nt(u[v],d[v])||(u[v].type==="geojson"&&d[v].type==="geojson"&&ju(u,d,v)?bi(_,{command:"setGeoJSONSourceData",args:[v,d[v].data]}):uc(v,d,_,m)):cn(v,d,_))})(r.sources,e.sources,s,a);const l=[];r.layers&&r.layers.forEach((u=>{"source"in u&&a[u.source]?i.push({command:"removeLayer",args:[u.id]}):l.push(u)})),i=i.concat(s),(function(u,d,_){d=d||[];const m=(u=u||[]).map(Go),v=d.map(Go),g=u.reduce(hc,{}),T=d.reduce(hc,{}),b=m.slice(),I=Object.create(null);let M,A,z,L,k;for(let F=0,O=0;F<m.length;F++)M=m[F],Object.prototype.hasOwnProperty.call(T,M)?O++:(bi(_,{command:"removeLayer",args:[M]}),b.splice(b.indexOf(M,O),1));for(let F=0,O=0;F<v.length;F++)M=v[v.length-1-F],b[b.length-1-F]!==M&&(Object.prototype.hasOwnProperty.call(g,M)?(bi(_,{command:"removeLayer",args:[M]}),b.splice(b.lastIndexOf(M,b.length-O),1)):O++,L=b[b.length-F],bi(_,{command:"addLayer",args:[T[M],L]}),b.splice(b.length-F,0,M),I[M]=!0);for(let F=0;F<v.length;F++)if(M=v[F],A=g[M],z=T[M],!I[M]&&!nt(A,z))if(nt(A.source,z.source)&&nt(A["source-layer"],z["source-layer"])&&nt(A.type,z.type)){for(k in xs(A.layout,z.layout,_,M,null,"setLayoutProperty"),xs(A.paint,z.paint,_,M,null,"setPaintProperty"),nt(A.filter,z.filter)||bi(_,{command:"setFilter",args:[M,z.filter]}),nt(A.minzoom,z.minzoom)&&nt(A.maxzoom,z.maxzoom)||bi(_,{command:"setLayerZoomRange",args:[M,z.minzoom,z.maxzoom]}),A)Object.prototype.hasOwnProperty.call(A,k)&&k!=="layout"&&k!=="paint"&&k!=="filter"&&k!=="metadata"&&k!=="minzoom"&&k!=="maxzoom"&&(k.indexOf("paint.")===0?xs(A[k],z[k],_,M,k.slice(6),"setPaintProperty"):nt(A[k],z[k])||bi(_,{command:"setLayerProperty",args:[M,k,z[k]]}));for(k in z)Object.prototype.hasOwnProperty.call(z,k)&&!Object.prototype.hasOwnProperty.call(A,k)&&k!=="layout"&&k!=="paint"&&k!=="filter"&&k!=="metadata"&&k!=="minzoom"&&k!=="maxzoom"&&(k.indexOf("paint.")===0?xs(A[k],z[k],_,M,k.slice(6),"setPaintProperty"):nt(A[k],z[k])||bi(_,{command:"setLayerProperty",args:[M,k,z[k]]}))}else bi(_,{command:"removeLayer",args:[M]}),L=b[b.lastIndexOf(M)+1],bi(_,{command:"addLayer",args:[z,L]})})(l,e.layers,i)}catch(a){console.warn("Unable to compute style diff:",a),i=[{command:"setStyle",args:[e]}]}return i},R.bX=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},R.bY=Dr,R.bZ=nn,R.b_=class extends ni{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},R.ba=Up,R.bb=So,R.bc=function(r,e,i,a,s){var l=1/Math.tan(e/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,s!=null&&s!==1/0){var u=1/(a-s);r[10]=(s+a)*u,r[14]=2*s*a*u}else r[10]=-1,r[14]=-2*a;return r},R.bd=function(r){var e=new Ft(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},R.be=function(r,e,i){var a=Math.sin(i),s=Math.cos(i),l=e[0],u=e[1],d=e[2],_=e[3],m=e[4],v=e[5],g=e[6],T=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*s+m*a,r[1]=u*s+v*a,r[2]=d*s+g*a,r[3]=_*s+T*a,r[4]=m*s-l*a,r[5]=v*s-u*a,r[6]=g*s-d*a,r[7]=T*s-_*a,r},R.bf=function(r,e,i){var a=Math.sin(i),s=Math.cos(i),l=e[4],u=e[5],d=e[6],_=e[7],m=e[8],v=e[9],g=e[10],T=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=l*s+m*a,r[5]=u*s+v*a,r[6]=d*s+g*a,r[7]=_*s+T*a,r[8]=m*s-l*a,r[9]=v*s-u*a,r[10]=g*s-d*a,r[11]=T*s-_*a,r},R.bg=function(r,e){var i=e[0],a=e[1],s=e[2],l=e[3],u=e[4],d=e[5],_=e[6],m=e[7],v=e[8],g=e[9],T=e[10],b=e[11],I=e[12],M=e[13],A=e[14],z=e[15],L=i*d-a*u,k=i*_-s*u,F=i*m-l*u,O=a*_-s*d,V=a*m-l*d,Y=s*m-l*_,J=v*M-g*I,re=v*A-T*I,te=v*z-b*I,le=g*A-T*M,ce=g*z-b*M,ne=T*z-b*A,ie=L*ne-k*ce+F*le+O*te-V*re+Y*J;return ie?(r[0]=(d*ne-_*ce+m*le)*(ie=1/ie),r[1]=(s*ce-a*ne-l*le)*ie,r[2]=(M*Y-A*V+z*O)*ie,r[3]=(T*V-g*Y-b*O)*ie,r[4]=(_*te-u*ne-m*re)*ie,r[5]=(i*ne-s*te+l*re)*ie,r[6]=(A*F-I*Y-z*k)*ie,r[7]=(v*Y-T*F+b*k)*ie,r[8]=(u*ce-d*te+m*J)*ie,r[9]=(a*te-i*ce-l*J)*ie,r[10]=(I*V-M*F+z*L)*ie,r[11]=(g*F-v*V-b*L)*ie,r[12]=(d*re-u*le-_*J)*ie,r[13]=(i*le-a*re+s*J)*ie,r[14]=(M*k-I*O-A*L)*ie,r[15]=(v*O-g*k+T*L)*ie,r):null},R.bh=function(){const r=new Float32Array(16);return Bn(r),r},R.bi=function(){const r=new Float64Array(16);return Bn(r),r},R.bj=function(){return new Float64Array(16)},R.bk=function(r,e,i){const a=new Float64Array(4);return We(a,r,e-90,i),a},R.bl=function(r,e,i,a){var s,l,u,d,_,m=e[0],v=e[1],g=e[2],T=e[3],b=i[0],I=i[1],M=i[2],A=i[3];return(l=m*b+v*I+g*M+T*A)<0&&(l=-l,b=-b,I=-I,M=-M,A=-A),1-l>me?(s=Math.acos(l),u=Math.sin(s),d=Math.sin((1-a)*s)/u,_=Math.sin(a*s)/u):(d=1-a,_=a),r[0]=d*m+_*b,r[1]=d*v+_*I,r[2]=d*g+_*M,r[3]=d*T+_*A,r},R.bm=function(r){const e=new Float64Array(9);var i,a,s,l,u,d,_,m,v,g,T,b,I,M,A,z,L,k;g=(s=(a=r)[0])*(_=s+s),T=(l=a[1])*_,I=(u=a[2])*_,M=u*(m=l+l),z=(d=a[3])*_,L=d*m,k=d*(v=u+u),(i=e)[0]=1-(b=l*m)-(A=u*v),i[3]=T-k,i[6]=I+L,i[1]=T+k,i[4]=1-g-A,i[7]=M-z,i[2]=I-L,i[5]=M+z,i[8]=1-g-b;const F=sn(-Math.asin(ci(e[2],-1,1)));let O,V;return Math.hypot(e[5],e[8])<.001?(O=0,V=-sn(Math.atan2(e[3],e[4]))):(O=sn(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),V=sn(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:O,pitch:F+90,bearing:V}},R.bn=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},R.bo=$e,R.bp=xr,R.bq=go,R.br=Xl,R.bs=_o,R.bt=ji,R.bu=zr,R.bv=hi,R.bw=function(r,e,i,a,s){return ji(a,s,ci((r-e)/(i-e),0,1))},R.bx=function(r,e,i,a){return r[0]=e[0]+i[0]*a,r[1]=e[1]+i[1]*a,r[2]=e[2]+i[2]*a,r},R.by=Yi,R.bz=function(){return new Float64Array(3)},R.c=Lr,R.c$=$a,R.c0=class extends ni{constructor(r,e){super(r,e),this.current=cr}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},R.c1=qr,R.c2=class extends ni{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},R.c3=class extends ni{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},R.c4=tn,R.c5=function(r,e){var i=Math.sin(e),a=Math.cos(e);return r[0]=a,r[1]=i,r[2]=0,r[3]=-i,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},R.c6=function(r,e,i){var a=e[0],s=e[1],l=e[2];return r[0]=a*i[0]+s*i[3]+l*i[6],r[1]=a*i[1]+s*i[4]+l*i[7],r[2]=a*i[2]+s*i[5]+l*i[8],r},R.c7=function(r,e,i,a,s,l,u){var d=1/(e-i),_=1/(a-s),m=1/(l-u);return r[0]=-2*d,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*m,r[11]=0,r[12]=(e+i)*d,r[13]=(s+a)*_,r[14]=(u+l)*m,r[15]=1,r},R.c8=class extends ni{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},R.c9=class extends ni{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},R.cA=function(r,e){return jo[e]&&"touches"in r},R.cB=function(r){return jo[r]||Vo[r]},R.cC=function(r,e,i){var a=e[0],s=e[1];return r[0]=i[0]*a+i[4]*s+i[12],r[1]=i[1]*a+i[5]*s+i[13],r},R.cD=function(r,e){const{x:i,y:a}=rc.fromLngLat(e);return!(r<0||r>25||a<0||a>=1||i<0||i>=1)},R.cE=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},R.cF=class extends to{},R.cG=Vn,R.cH=function(r,e){Lr.REGISTERED_PROTOCOLS[r]=e},R.cI=function(r){delete Lr.REGISTERED_PROTOCOLS[r]},R.cJ=function(r,e){const i={};for(let s=0;s<r.length;s++){const l=e&&e[r[s].id]||nh(r[s]);e&&(e[r[s].id]=l);let u=i[l];u||(u=i[l]=[]),u.push(r[s])}const a=[];for(const s in i)a.push(i[s]);return a},R.cK=Ie,R.cL=$p,R.cM=wf,R.cN=Pp,R.cO=function(r){var e,i;r.bucket.createArrays(),r.bucket.tilePixelRatio=Re/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const a=r.bucket.layers[0],s=a.layout,l=a._unevaluatedLayout._values,u={layoutIconSize:l["icon-size"].possiblyEvaluate(new ht(r.bucket.zoom+1),r.canonical),layoutTextSize:l["text-size"].possiblyEvaluate(new ht(r.bucket.zoom+1),r.canonical),textMaxSize:l["text-size"].possiblyEvaluate(new ht(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:T}=r.bucket.textSizeData;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new ht(g),r.canonical),l["text-size"].possiblyEvaluate(new ht(T),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:T}=r.bucket.iconSizeData;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new ht(g),r.canonical),l["icon-size"].possiblyEvaluate(new ht(T),r.canonical)]}const d=s.get("text-line-height")*Ut,_=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",m=s.get("text-keep-upright"),v=s.get("text-size");for(const g of r.bucket.features){const T=s.get("text-font").evaluate(g,{},r.canonical).join(","),b=v.evaluate(g,{},r.canonical),I=u.layoutTextSize.evaluate(g,{},r.canonical),M=u.layoutIconSize.evaluate(g,{},r.canonical),A={horizontal:{},vertical:void 0},z=g.text;let L,k=[0,0];if(z){const V=z.toString(),Y=s.get("text-letter-spacing").evaluate(g,{},r.canonical)*Ut,J=Ks(V)?Y:0,re=s.get("text-anchor").evaluate(g,{},r.canonical),te=Lf(a,g,r.canonical);if(!te){const ie=s.get("text-radial-offset").evaluate(g,{},r.canonical);k=ie?Rf(re,[ie*Ut,gd]):s.get("text-offset").evaluate(g,{},r.canonical).map((_e=>_e*Ut))}
16let le=_?"center":s.get("text-justify").evaluate(g,{},r.canonical);const ce=s.get("symbol-placement")==="point"?s.get("text-max-width").evaluate(g,{},r.canonical)*Ut:1/0,ne=()=>{r.bucket.allowVerticalPlacement&&Il(V)&&(A.vertical=Mu(z,r.glyphMap,r.glyphPositions,r.imagePositions,T,ce,d,re,"left",J,k,R.ax.vertical,!0,I,b))};if(!_&&te){const ie=new Set;if(le==="auto")for(let we=0;we<te.values.length;we+=2)ie.add(yd(te.values[we]));else ie.add(le);let _e=!1;for(const we of ie)if(!A.horizontal[we])if(_e)A.horizontal[we]=A.horizontal[0];else{const xe=Mu(z,r.glyphMap,r.glyphPositions,r.imagePositions,T,ce,d,"center",we,J,k,R.ax.horizontal,!1,I,b);xe&&(A.horizontal[we]=xe,_e=xe.positionedLines.length===1)}ne()}else{le==="auto"&&(le=yd(re));const ie=Mu(z,r.glyphMap,r.glyphPositions,r.imagePositions,T,ce,d,re,le,J,k,R.ax.horizontal,!1,I,b);ie&&(A.horizontal[le]=ie),ne(),Il(V)&&_&&m&&(A.vertical=Mu(z,r.glyphMap,r.glyphPositions,r.imagePositions,T,ce,d,re,le,J,k,R.ax.vertical,!1,I,b))}}let F=!1;if(!((e=g.icon)===null||e===void 0)&&e.name){const V=r.imageMap[g.icon.name];V&&(L=O_(r.imagePositions[g.icon.name],s.get("icon-offset").evaluate(g,{},r.canonical),s.get("icon-anchor").evaluate(g,{},r.canonical)),F=!!V.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=F:r.bucket.sdfIcons!==F&&Ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(V.pixelRatio!==r.bucket.pixelRatio||s.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const O=Bf(A.horizontal)||A.vertical;(i=r.bucket).iconsInText||(i.iconsInText=!!O&&O.iconsInText),(O||L)&&Dg(r.bucket,g,A,L,r.imageMap,u,I,M,k,F,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},R.cP=Th,R.cQ=Ph,R.cR=Nh,R.cS=function(r,e=""){const i=new Iu;return(function(a,s,l=""){for(const u in a.layers)s.writeMessage(3,((d,_)=>yg(d,_,l)),a.layers[u])})(r,i,e),i.finish()},R.cT=function(r,e,i,a,s,l){let u=Pf(r,e,i,s,0);return u=Pf(u,e,a,l,1),u},R.cU=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},R.cV=Hd,R.cW=Iu,R.cX=xf,R.cY=function(r,e,i,a,s){return p(this,void 0,void 0,(function*(){if(Ei())try{return yield Oo(r,e,i,a,s)}catch{}return(function(l,u,d,_,m){const v=l.width,g=l.height;kr&&jn||(kr=new OffscreenCanvas(v,g),jn=kr.getContext("2d",{willReadFrequently:!0})),kr.width=v,kr.height=g,jn.drawImage(l,0,0,v,g);const T=jn.getImageData(u,d,_,m);return jn.clearRect(0,0,v,g),T.data})(r,e,i,a,s)}))},R.cZ=Fd,R.c_=class{constructor(r,e){this.layers={[sc]:this},this.name=sc,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new gg(this.features[r],this.extent)}},R.ca=class extends En{},R.cb=m_,R.cc=class extends ls{},R.cd=yh,R.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},R.cf=Dd,R.cg=function(r,e,i){var a=e[0],s=e[1],l=e[2],u=i[3]*a+i[7]*s+i[11]*l+i[15];return r[0]=(i[0]*a+i[4]*s+i[8]*l+i[12])/(u=u||1),r[1]=(i[1]*a+i[5]*s+i[9]*l+i[13])/u,r[2]=(i[2]*a+i[6]*s+i[10]*l+i[14])/u,r},R.ch=class extends io{},R.ci=class extends t{},R.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},R.ck=function(r,e){var i=r[0],a=r[1],s=r[2],l=r[3],u=r[4],d=r[5],_=r[6],m=r[7],v=r[8],g=r[9],T=r[10],b=r[11],I=r[12],M=r[13],A=r[14],z=r[15],L=e[0],k=e[1],F=e[2],O=e[3],V=e[4],Y=e[5],J=e[6],re=e[7],te=e[8],le=e[9],ce=e[10],ne=e[11],ie=e[12],_e=e[13],we=e[14],xe=e[15];return Math.abs(i-L)<=me*Math.max(1,Math.abs(i),Math.abs(L))&&Math.abs(a-k)<=me*Math.max(1,Math.abs(a),Math.abs(k))&&Math.abs(s-F)<=me*Math.max(1,Math.abs(s),Math.abs(F))&&Math.abs(l-O)<=me*Math.max(1,Math.abs(l),Math.abs(O))&&Math.abs(u-V)<=me*Math.max(1,Math.abs(u),Math.abs(V))&&Math.abs(d-Y)<=me*Math.max(1,Math.abs(d),Math.abs(Y))&&Math.abs(_-J)<=me*Math.max(1,Math.abs(_),Math.abs(J))&&Math.abs(m-re)<=me*Math.max(1,Math.abs(m),Math.abs(re))&&Math.abs(v-te)<=me*Math.max(1,Math.abs(v),Math.abs(te))&&Math.abs(g-le)<=me*Math.max(1,Math.abs(g),Math.abs(le))&&Math.abs(T-ce)<=me*Math.max(1,Math.abs(T),Math.abs(ce))&&Math.abs(b-ne)<=me*Math.max(1,Math.abs(b),Math.abs(ne))&&Math.abs(I-ie)<=me*Math.max(1,Math.abs(I),Math.abs(ie))&&Math.abs(M-_e)<=me*Math.max(1,Math.abs(M),Math.abs(_e))&&Math.abs(A-we)<=me*Math.max(1,Math.abs(A),Math.abs(we))&&Math.abs(z-xe)<=me*Math.max(1,Math.abs(z),Math.abs(xe))},R.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},R.cm=r=>r.type==="circle",R.cn=r=>r.type==="heatmap",R.co=r=>r.type==="line",R.cp=r=>r.type==="fill",R.cq=r=>r.type==="fill-extrusion",R.cr=r=>r.type==="hillshade",R.cs=r=>r.type==="color-relief",R.ct=r=>r.type==="background",R.cu=r=>r.type==="custom",R.cv=rn,R.cw=function(r,e,i){if(e<=0)return r;const a=1/e;return i===void 0||Math.abs(i)<1e-10?Math.round(r*a)/a:(i>0?Math.ceil(r*a-1e-9):Math.floor(r*a+1e-10))/a},R.cx=function(r,e,i){const a=et(e.x-i.x,e.y-i.y),s=et(r.x-i.x,r.y-i.y);var l,u;
16return sn(Math.atan2(a[0]*s[1]-a[1]*s[0],(l=a)[0]*(u=s)[0]+l[1]*u[1]))},R.cy=Ta,R.cz=function(r,e){var i;if(!Vo[e])return!1;const a=r?.target,s=((i=a?.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return r instanceof s.MouseEvent||r instanceof s.WheelEvent},R.d=wt,R.d0=class{constructor(r,e){const i=(e=this.options=Object.assign({},n_,e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let a=Ah(r,e);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),a=Rh(a,e),e.updateable&&(this.source=a),this.initializeIndex(a,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new Km(e.clusterOptions):new r_(e),r.length&&this.tileIndex.initialize(r)}getTile(r,e,i){return e=+e,i=+i,(r=+r)<0||r>24?null:this.tileIndex.getTile(r,e,i)}updateData(r,e){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:a,source:s}=(function(l,u,d){const _=(function(v,g){return v?{removeAll:v.removeAll,remove:new Set(v.remove||[]),add:new Map(v.add?.map((T=>[g.promoteId?T.properties[g.promoteId]:T.id,T]))),update:new Map(v.update?.map((T=>[T.id,T])))}:{remove:new Set,add:new Map,update:new Map}})(u,d);let m=[];if(_.removeAll&&(m=l,l=[]),_.remove.size||_.add.size){const v=[];for(const g of l)(_.remove.has(g.id)||_.add.has(g.id))&&v.push(g);
16if(v.length){m.push(...v);const g=new Set(v.map((T=>T.id)));l=l.filter((T=>!g.has(T.id)))}if(_.add.size){let g=Ah({type:"FeatureCollection",features:Array.from(_.add.values())},d);g=Rh(g,d),m.push(...g),l.push(...g)}}if(_.update.size){const v=new Map,g=[];for(const T of l)_.update.has(T.id)?v.set(T.id,[...v.get(T.id)||[],T]):g.push(T);for(const[T,b]of _.update){const I=v.get(T);if(!I||I.length===0)continue;const M=Ym(I,b,d);m.push(...I,...M),g.push(...M)}l=g}return{affected:m,source:l}})(this.source,r,i);e&&({affected:a,source:s}=this.filterUpdate(s,a,e)),a.length&&(this.source=s,this.tileIndex.updateIndex(s,a,i))}filterUpdate(r,e,i){const a=new Set;for(const s of r)s.id!=null&&(i(wu(s))||(e.push(s),a.add(s.id)));return{affected:e,source:r=r.filter((s=>!a.has(s.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((r=>wu(r)))}}updateClusterOptions(r,e){const i=this.options.cluster;this.options.cluster=r,this.options.clusterOptions=e,i!=r?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(r){return this.tileIndex.getClusterExpansionZoom(r)}getClusterChildren(r){return this.tileIndex.getChildren(r)}getClusterLeaves(r,e,i){return this.tileIndex.getLeaves(r,e,i)}},R.d1=yr,R.e=Vi,R.f=Ki,R.g=dr,R.h=r=>p(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${wt(i).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),R.i=Xt,R.j=r=>new Promise(((e,i)=>{const a=new Image;a.onload=()=>{e(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame((()=>a.src=Bo))},a.onerror=()=>i(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 s=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(s):Bo})),R.k=(r,e)=>on(Vi(r,{type:"json"}),e),R.l=Un,R.m=on,R.n=Ia,R.o=(r,e)=>on(Vi(r,{type:"arrayBuffer"}),e),R.p=Sp,R.q=function(r){return new Iu(r).readFields(A_,[])},R.r=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},R.s=_s,R.t=Gl,R.u=di,R.v=Ka,R.w=Ht,R.x=ue,R.y=Dl,R.z=Ri})),vi("worker",["./shared"],(function(R){class p{constructor(W,K){this.keyCache={},W&&this.replace(W,K)}replace(W,K){this._layerConfigs={},this._layers={},this.update(W,[],K)}update(W,K,ee){for(const Ce of W){this._layerConfigs[Ce.id]=Ce;const He=this._layers[Ce.id]=R.bT(Ce,ee);He._featureFilter=R.ah(He.filter,ee),this.keyCache[Ce.id]&&delete this.keyCache[Ce.id]}for(const Ce of K)delete this.keyCache[Ce],delete this._layerConfigs[Ce],delete this._layers[Ce];this.familiesBySource={};const ye=R.cJ(Object.values(this._layerConfigs),this.keyCache);for(const Ce of ye){const He=Ce.map((bt=>this._layers[bt.id])),Le=He[0];if(Le.isHidden())continue;const We=Le.source||"";let Ve=this.familiesBySource[We];Ve||(Ve=this.familiesBySource[We]={});const et=Le.sourceLayer||R.ag;let Re=Ve[et];Re||(Re=Ve[et]=[]),Re.push(He)}}}class Pe{constructor(W){const K={},ee=[];for(const Le in W){const We=W[Le],Ve=K[Le]={};for(const et in We){const Re=We[+et];if(!Re||Re.bitmap.width===0||Re.bitmap.height===0)continue;const bt={x:0,y:0,w:Re.bitmap.width+2,h:Re.bitmap.height+2};ee.push(bt),Ve[et]={rect:bt,metrics:Re.metrics}}}const{w:ye,h:Ce}=R.p(ee),He=new R.t({width:ye||1,height:Ce||1});for(const Le in W){const We=W[Le];for(const Ve in We){const et=We[+Ve];if(!et||et.bitmap.width===0||et.bitmap.height===0)continue;const Re=K[Le][Ve].rect;
16R.t.copy(et.bitmap,He,{x:0,y:0},{x:Re.x+1,y:Re.y+1},et.bitmap)}}this.image=He,this.positions=K}}R.cK("GlyphAtlas",Pe);class Cr{constructor(W){this.tileID=new R.a3(W.tileID.overscaledZ,W.tileID.wrap,W.tileID.canonical.z,W.tileID.canonical.x,W.tileID.canonical.y),this.uid=W.uid,this.zoom=W.zoom,this.pixelRatio=W.pixelRatio,this.tileSize=W.tileSize,this.source=W.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=W.showCollisionBoxes,this.collectResourceTiming=!!W.collectResourceTiming,this.returnDependencies=!!W.returnDependencies,this.promoteId=W.promoteId,this.inFlightDependencies=[]}parse(W,K,ee,ye,Ce){return R._(this,void 0,void 0,(function*(){this.status="parsing",this.data=W,this.collisionBoxArray=new R.ae;const He=new R.cL(Object.keys(W.layers).sort()),Le=new R.cM(this.tileID,this.promoteId);Le.bucketLayerIDs=[];const We={},Ve={featureIndex:Le,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:ee,subdivisionGranularity:Ce},et=K.familiesBySource[this.source];for(const Fe in et){const jt=W.layers[Fe];if(!jt)continue;jt.version===1&&R.w(`Vector tile source "${this.source}" layer "${Fe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ht=He.encode(Fe),Ci=[];for(let Xt=0;Xt<jt.length;Xt++){const xi=jt.feature(Xt),an=Le.getId(xi,Fe);Ci.push({feature:xi,id:an,index:Xt,sourceLayerIndex:Ht})}for(const Xt of et[Fe]){const xi=Xt[0];xi.source!==this.source&&R.w(`layer.source = ${xi.source} does not equal this.source = ${this.source}`),xi.isHidden(this.zoom,!0)||(Mi(Xt,this.zoom,ee),(We[xi.id]=xi.createBucket({index:Le.bucketLayerIDs.length,layers:Xt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ht,sourceID:this.source})).populate(Ci,Ve,this.tileID.canonical),Le.bucketLayerIDs.push(Xt.map((an=>an.id))))}}const Re=R.bY(Ve.glyphDependencies,(Fe=>Object.keys(Fe).map(Number)));for(const Fe of this.inFlightDependencies)Fe?.abort();this.inFlightDependencies=[];let bt=Promise.resolve({});if(Object.keys(Re).length){const Fe=new AbortController;this.inFlightDependencies.push(Fe),bt=ye.sendAsync({type:"GG",data:{stacks:Re,source:this.source,tileID:this.tileID,type:"glyphs"}},Fe)}const wt=Object.keys(Ve.iconDependencies);let Yi=Promise.resolve({});if(wt.length){const Fe=new AbortController;this.inFlightDependencies.push(Fe),Yi=ye.sendAsync({type:"GI",data:{icons:wt,source:this.source,tileID:this.tileID,type:"icons"}},Fe)}const ji=Object.keys(Ve.patternDependencies);let zr=Promise.resolve({});if(ji.length){const Fe=new AbortController;this.inFlightDependencies.push(Fe),zr=ye.sendAsync({type:"GI",data:{icons:ji,source:this.source,tileID:this.tileID,type:"patterns"}},Fe)}const rn=Ve.dashDependencies;let Ta=Promise.resolve({});if(Object.keys(rn).length){const Fe=new AbortController;this.inFlightDependencies.push(Fe),Ta=ye.sendAsync({type:"GDA",data:{dashes:rn}},Fe)}const[ci,On,Vi,Sa]=yield Promise.all([bt,Yi,zr,Ta]),Dr=new Pe(ci),nn=new R.cN(On,Vi);for(const Fe in We){const jt=We[Fe];jt instanceof R.af?(Mi(jt.layers,this.zoom,ee),R.cO({bucket:jt,glyphMap:ci,glyphPositions:Dr.positions,imageMap:On,imagePositions:nn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ve.subdivisionGranularity})):jt.hasDependencies&&(jt instanceof R.cP||jt instanceof R.cQ||jt instanceof R.cR)&&(Mi(jt.layers,this.zoom,ee),jt.addFeatures(Ve,this.tileID.canonical,nn.patternPositions,Sa))}return this.status="done",{buckets:Object.values(We).filter((Fe=>!Fe.isEmpty())),featureIndex:Le,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Dr.image,imageAtlas:nn,dashPositions:Sa,glyphMap:this.returnDependencies?ci:null,iconMap:this.returnDependencies?On:null,glyphPositions:this.returnDependencies?Dr.positions:null}}))}}function Mi(Ye,W,K){const ee=new R.J(W);for(const ye of Ye)ye.recalculate(ee,K)}class Qr{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(W,K){this.loading[W]=K}finishLoading(W){delete this.loading[W]}abort(W){const K=this.loading[W];K?.abort&&(K.abort.abort(),delete this.loading[W])}setParsing(W,K){this.parsing[W]=K}consumeParsing(W){const K=this.parsing[W];if(K)return delete this.parsing[W],K}clearParsing(W){delete this.parsing[W]}markLoaded(W,K){this.loaded[W]=K}getLoaded(W){const K=this.loaded[W];if(K)return K}removeLoaded(W){delete this.loaded[W]}clearLoaded(){this.loaded={}}}class Fn{constructor(W){this.start=`${W}#start`,this.end=`${W}#end`,this.measure=W,performance.mark(this.start)}finish(){performance.mark(this.end);let W=performance.getEntriesByName(this.measure);return W.length===0&&(performance.measure(this.measure,this.start,this.end),W=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),W}}class Wt{constructor(W,K,ee,ye,Ce){this.type=W,this.properties=ee||{},this.extent=Ce,this.pointsArray=K,this.id=ye}loadGeometry(){return this.pointsArray.map((W=>W.map((K=>new R.P(K.x,K.y)))))}}class Ar{constructor(W,K,ee){this.version=2,this._myFeatures=W,this.name=K,this.length=W.length,this.extent=ee}feature(W){return this._myFeatures[W]}}class Je{constructor(){this.layers={}}addLayer(W){this.layers[W.name]=W}}function en(Ye){let W=R.cS(Ye);return W.byteOffset===0&&W.byteLength===W.buffer.byteLength||(W=new Uint8Array(W)),{vectorTile:Ye,rawData:W.buffer}}function Ei(Ye,W,K){const{extent:ee}=Ye,ye=Math.pow(2,K.z-W.z),Ce=(K.x-W.x*ye)*ee,He=(K.y-W.y*ye)*ee,Le=[];for(let We=0;We<Ye.length;We++){const Ve=Ye.feature(We);let et=Ve.loadGeometry();for(const bt of et)for(const wt of bt)wt.x=wt.x*ye-Ce,wt.y=wt.y*ye-He;const Re=128;et=R.cT(et,Ve.type,-Re,-Re,ee+Re,ee+Re),et.length!==0&&Le.push(new Wt(Ve.type,et,Ve.properties,Ve.id,ee))}return new Ar(Le,Ye.name,ee)}class me{constructor(W,K,ee){this.actor=W,this.layerIndex=K,this.availableImages=ee,this.tileState=new Qr,this.overzoomedTileResultCache=new R.cU(1e3)}loadVectorTile(W,K){try{return{vectorTile:W.encoding!=="mlt"?new R.cV(new R.cW(K)):new R.cX(K),rawData:K}}catch(ee){const ye=new Uint8Array(K);let Ce=`Unable to parse the tile at ${W.request.url}, `;throw Ce+=ye[0]===31&&ye[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${R.d(ee).message}`,new Error(Ce)}}loadTile(W){return R._(this,void 0,void 0,(function*(){const{uid:K,overzoomParameters:ee}=W;ee&&(W.request=ee.overzoomRequest);const ye=this._startRequestTiming(W),Ce=new Cr(W);this.tileState.startLoading(K,Ce);const He=new AbortController;Ce.abort=He;try{const Le=yield R.o(W.request,He);if(W.etag&&W.etag===Le.etag)return this.tileState.finishLoading(K),this._getEtagUnmodifiedResult(Le,ye);const We=this.loadVectorTile(W,Le.data);if(this.tileState.finishLoading(K),!We)return null;let{vectorTile:Ve,rawData:et}=We;ee&&({vectorTile:Ve,rawData:et}=this._getOverzoomTile(W,Ve));const Re=this._getExpiryData(Le),bt=this._finishRequestTiming(ye);Ce.vectorTile=Ve,this.tileState.markLoaded(K,Ce);const wt={rawData:et,cacheControl:Re,resourceTiming:bt};this.tileState.setParsing(K,wt);try{return yield this._parseWorkerTile(Ce,W,wt)}finally{this.tileState.clearParsing(K)}}catch(Le){throw this.tileState.finishLoading(K),Ce.status="done",this.tileState.markLoaded(K,Ce),Le}}))}_getEtagUnmodifiedResult(W,K){const ee=this._getExpiryData(W),ye=this._finishRequestTiming(K);return R.e({etagUnmodified:!0},ee,ye)}_parseWorkerTile(W,K,ee){return R._(this,void 0,void 0,(function*(){let ye=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,K.subdivisionGranularity);if(ee){const{rawData:Ce,cacheControl:He,resourceTiming:Le}=ee;ye=R.e({rawTileData:Ce.slice(0),encoding:K.encoding},ye,He,Le)}return ye}))}_getExpiryData({expires:W,cacheControl:K,etag:ee}){const ye={};return W&&(ye.expires=W),K&&(ye.cacheControl=K),ee&&(ye.etag=ee),ye}_startRequestTiming(W){var K;if(!((K=W.request)===null||K===void 0)&&K.collectResourceTiming)return new Fn(W.request.url)}_finishRequestTiming(W){const K=W?.finish();return K?{resourceTiming:JSON.parse(JSON.stringify(K))}:{}}_getOverzoomTile(W,K){var ee;const{tileID:ye,source:Ce,overzoomParameters:He}=W,{maxZoomTileID:Le}=He,We=`${Le.key}_${ye.key}_${(ee=W.request)===null||ee===void 0?void 0:ee.url}`,Ve=this.overzoomedTileResultCache.get(We);if(Ve)return Ve;const et=new Je,Re=this.layerIndex.familiesBySource[Ce];for(const wt in Re){const Yi=K.layers[wt];
16if(!Yi)continue;const ji=Ei(Yi,Le,ye.canonical);ji.length>0&&et.addLayer(ji)}const bt=en(et);return this.overzoomedTileResultCache.set(We,bt),bt}reloadTile(W){return R._(this,void 0,void 0,(function*(){const K=W.uid,ee=this.tileState.getLoaded(K);if(!ee)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ee.showCollisionBoxes=W.showCollisionBoxes,ee.status==="parsing"){const ye=this.tileState.consumeParsing(K);return yield this._parseWorkerTile(ee,W,ye)}if(ee.status==="done"&&ee.vectorTile)return yield this._parseWorkerTile(ee,W)}))}abortTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.abort(W.uid)}))}removeTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(W.uid)}))}}class Ft{constructor(){this.loaded={}}loadTile(W){return R._(this,void 0,void 0,(function*(){const{uid:K,encoding:ee,rawImageData:ye,redFactor:Ce,greenFactor:He,blueFactor:Le,baseShift:We}=W,Ve=ye.width+2,et=ye.height+2,Re=R.b(ye)?new R.R({width:Ve,height:et},yield R.cY(ye,-1,-1,Ve,et)):ye,bt=new R.cZ(K,Re,ee,Ce,He,Le,We);return this.loaded||(this.loaded={}),this.loaded[K]=bt,bt}))}removeTile(W){const K=this.loaded,ee=W.uid;K?.[ee]&&delete K[ee]}}class tn{constructor(W,K,ee,ye=Bn){this.actor=W,this.layerIndex=K,this.availableImages=ee,this.tileState=new Qr,this._createGeoJSONIndex=ye}loadVectorTile(W){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:K,x:ee,y:ye}=W.tileID.canonical,Ce=this._geoJSONIndex.getTile(K,ee,ye);return Ce?en(new R.c_(Ce.features,{version:2,extent:R.a6})):null}loadTile(W){return R._(this,void 0,void 0,(function*(){const{uid:K}=W,ee=new Cr(W);ee.abort=new AbortController;try{const ye=this.loadVectorTile(W);if(!ye)return null;const{vectorTile:Ce,rawData:He}=ye;ee.vectorTile=Ce,this.tileState.markLoaded(K,ee);const Le={rawData:He};this.tileState.setParsing(K,Le);try{return yield this._parseWorkerTile(ee,W,Le)}finally{this.tileState.clearParsing(K)}}catch(ye){throw ee.status="done",this.tileState.markLoaded(K,ee),ye}}))}_reloadLoadedTile(W){return R._(this,void 0,void 0,(function*(){const K=W.uid,ee=this.tileState.getLoaded(K);if(!ee)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ee.showCollisionBoxes=W.showCollisionBoxes,ee.status==="parsing"){const ye=this.tileState.consumeParsing(K);return yield this._parseWorkerTile(ee,W,ye)}if(ee.status==="done"&&ee.vectorTile)return yield this._parseWorkerTile(ee,W)}))}_parseWorkerTile(W,K,ee){return R._(this,void 0,void 0,(function*(){let ye=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,K.subdivisionGranularity);if(ee){const{rawData:Ce}=ee;ye=R.e({rawTileData:Ce.slice(0),encoding:"mvt"},ye)}return ye}))}abortTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.abort(W.uid)}))}removeTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(W.uid)}))}loadData(W){return R._(this,void 0,void 0,(function*(){var K;(K=this._pendingRequest)===null||K===void 0||K.abort();const ee=this._startRequestTiming(W);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(W,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const ye={};return W.request&&(ye.data=W.data),this._finishRequestTiming(ee,W,ye),ye}catch(ye){if(delete this._pendingRequest,!R.$(ye))throw ye;return{abandoned:!0}}}))}_startRequestTiming(W){var K;if(!((K=W.request)===null||K===void 0)&&K.collectResourceTiming)return new Fn(W.request.url)}_finishRequestTiming(W,K,ee){const ye=W?.finish();ye&&(ee.resourceTiming={[K.source]:JSON.parse(JSON.stringify(ye))})}reloadTile(W){return this.tileState.getLoaded(W.uid)?this._reloadLoadedTile(W):this.loadTile(W)}loadAndProcessGeoJSON(W,K){return R._(this,void 0,void 0,(function*(){var ee;if(W.request&&(W.data=(yield R.k(W.request,K)).data),W.data)return W.data=this._filterGeoJSON(W.data,W.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(W.data,W));if(W.dataDiff)return(ee=this._geoJSONIndex)!==null&&ee!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},W)),void this._geoJSONIndex.updateData(W.dataDiff,this._getFilterPredicate(W.filter));if(W.updateCluster&&this._geoJSONIndex.updateClusterOptions(W.geojsonVtOptions.cluster,ba(W)),this._geoJSONIndex==null)throw new Error(`Input data given to '${W.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(W,K){if(W.type!=="FeatureCollection")return W;const ee=this._getFilterPredicate(K);return ee?{type:"FeatureCollection",features:W.features.filter((ye=>ee(ye)))}:W}_getFilterPredicate(W){if(typeof W!="boolean"&&!W?.length)return;const K=R.c$(W,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(K.result==="error")throw new Error(K.value.map((ee=>`${ee.key}: ${ee.message}`)).join(", "));return ee=>K.value.evaluate({zoom:0},ee)}removeSource(W){return R._(this,void 0,void 0,(function*(){var K;
16(K=this._pendingRequest)===null||K===void 0||K.abort()}))}getClusterExpansionZoom(W){return this._geoJSONIndex.getClusterExpansionZoom(W.clusterId)}getClusterChildren(W){return this._geoJSONIndex.getClusterChildren(W.clusterId)}getClusterLeaves(W){return this._geoJSONIndex.getClusterLeaves(W.clusterId,W.limit,W.offset)}}function Bn(Ye,W){const K=R.e(W.geojsonVtOptions||{},{updateable:!0,clusterOptions:ba(W)});return new R.d0(Ye,K)}function ba({geojsonVtOptions:Ye,clusterProperties:W}){if(!W||!Ye.clusterOptions)return Ye.clusterOptions;const K={},ee={},ye={accumulated:null,zoom:0},Ce={properties:null},He=Object.keys(W);for(const Le of He){const[We,Ve]=W[Le],et=R.c$(Ve),Re=R.c$(typeof We=="string"?[We,["accumulated"],["get",Le]]:We);K[Le]=et.value,ee[Le]=Re.value}return Ye.clusterOptions.map=Le=>{Ce.properties=Le;const We={};for(const Ve of He)We[Ve]=K[Ve].evaluate(ye,Ce);return We},Ye.clusterOptions.reduce=(Le,We)=>{Ce.properties=We;for(const Ve of He)ye.accumulated=Le[Ve],Le[Ve]=ee[Ve].evaluate(ye,Ce)},Ye.clusterOptions}class wa{constructor(W){this.self=W,this.actor=new R.N(W),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(K,ee)=>{if(this.externalWorkerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.externalWorkerSourceTypes[K]=ee},this.self.addProtocol=R.cH,this.self.removeProtocol=R.cI,this.self.registerRTLTextPlugin=K=>{R.d1.setMethods(K)},this.self.makeRequest=R.m,this.actor.registerMessageHandler("LDT",((K,ee)=>this._getDEMWorkerSource(K,ee.source).loadTile(ee))),this.actor.registerMessageHandler("RDT",((K,ee)=>R._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(K,ee.source).removeTile(ee)})))),this.actor.registerMessageHandler("GCEZ",((K,ee)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,ee.type,ee.source).getClusterExpansionZoom(ee)})))),this.actor.registerMessageHandler("GCC",((K,ee)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,ee.type,ee.source).getClusterChildren(ee)})))),this.actor.registerMessageHandler("GCL",((K,ee)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,ee.type,ee.source).getClusterLeaves(ee)})))),this.actor.registerMessageHandler("LD",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).loadData(ee))),this.actor.registerMessageHandler("LT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).loadTile(ee))),this.actor.registerMessageHandler("RT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).reloadTile(ee))),this.actor.registerMessageHandler("AT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).abortTile(ee))),this.actor.registerMessageHandler("RMT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).removeTile(ee))),this.actor.registerMessageHandler("RS",((K,ee)=>R._(this,void 0,void 0,(function*(){var ye,Ce;if(!(!((Ce=(ye=this.workerSources[K])===null||ye===void 0?void 0:ye[ee.type])===null||Ce===void 0)&&Ce[ee.source]))return;const He=this.workerSources[K][ee.type][ee.source];delete this.workerSources[K][ee.type][ee.source],He.removeSource!==void 0&&He.removeSource(ee)})))),this.actor.registerMessageHandler("RM",(K=>R._(this,void 0,void 0,(function*(){delete this.layerIndexes[K],delete this.availableImages[K],delete this.workerSources[K],delete this.demWorkerSources[K],this.globalStates.delete(K)})))),this.actor.registerMessageHandler("SR",((K,ee)=>R._(this,void 0,void 0,(function*(){this.referrer=ee})))),this.actor.registerMessageHandler("SRPS",((K,ee)=>this._syncRTLPluginState(K,ee))),this.actor.registerMessageHandler("IS",((K,ee)=>R._(this,void 0,void 0,(function*(){this.self.importScripts(ee)})))),this.actor.registerMessageHandler("SI",((K,ee)=>this._setImages(K,ee))),this.actor.registerMessageHandler("UL",((K,ee)=>R._(this,void 0,void 0,(function*(){this._getLayerIndex(K).update(ee.layers,ee.removedIds,this._getGlobalState(K))})))),this.actor.registerMessageHandler("UGS",((K,ee)=>R._(this,void 0,void 0,(function*(){const ye=this._getGlobalState(K);for(const Ce in ee)ye[Ce]=ee[Ce]})))),this.actor.registerMessageHandler("SL",((K,ee)=>R._(this,void 0,void 0,(function*(){this._getLayerIndex(K).replace(ee,this._getGlobalState(K))}))))}_getGlobalState(W){let K=this.globalStates.get(W);return K||(K={},this.globalStates.set(W,K)),K}_setImages(W,K){return R._(this,void 0,void 0,(function*(){this.availableImages[W]=K;for(const ee in this.workerSources[W]){const ye=this.workerSources[W][ee];for(const Ce in ye)ye[Ce].availableImages=K}}))}_syncRTLPluginState(W,K){return R._(this,void 0,void 0,(function*(){return yield R.d1.syncState(K,this.self.importScripts)}))}_getAvailableImages(W){let K=this.availableImages[W];return K||(K=[]),K}_getLayerIndex(W){let K=this.layerIndexes[W];return K||(K=this.layerIndexes[W]=new p),K}_getWorkerSource(W,K,ee){var ye,Ce;if((ye=this.workerSources)[W]||(ye[W]={}),(Ce=this.workerSources[W])[K]||(Ce[K]={}),!this.workerSources[W][K][ee]){const He={sendAsync:(Le,We)=>(Le.targetMapId=W,this.actor.sendAsync(Le,We))};switch(K){case"vector":this.workerSources[W][K][ee]=new me(He,this._getLayerIndex(W),this._getAvailableImages(W));break;case"geojson":this.workerSources[W][K][ee]=new tn(He,this._getLayerIndex(W),this._getAvailableImages(W));break;default:this.workerSources[W][K][ee]=new this.externalWorkerSourceTypes[K](He,this._getLayerIndex(W),this._getAvailableImages(W))}}return this.workerSources[W][K][ee]}_getDEMWorkerSource(W,K){var ee,ye;return(ee=this.demWorkerSources)[W]||(ee[W]={}),(ye=this.demWorkerSources[W])[K]||(ye[K]=new Ft),this.demWorkerSources[W][K]}}return R.i(self)&&(self.worker=new wa(self)),wa})),vi("index",["exports","./shared"],(function(R,p){var Pe="5.24.0";function Cr(){var h=new p.A(4);return p.A!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}let Mi,Qr,Fn;const Wt={frame(h,t,n,o){const c=o||window,f=c.requestAnimationFrame((x=>{y(),t(x)})),{unsubscribe:y}=p.s(h.signal,"abort",(()=>{y(),c.cancelAnimationFrame(f),n(new p.a(h.signal.reason))}),!1)},frameAsync(h,t){return new Promise(((n,o)=>{this.frame(h,n,o,t)}))},getImageData(h,t=0){return this.getImageCanvasContext(h).getImageData(-t,-t,h.width+2*t,h.height+2*t)},getImageCanvasContext(h){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=h.width,t.height=h.height,n.drawImage(h,0,0,h.width,h.height),n},resolveURL:h=>(Mi||(Mi=document.createElement("a")),Mi.href=h,Mi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Fn!==void 0?Fn:!!matchMedia&&(Qr!=null||(Qr=matchMedia("(prefers-reduced-motion: reduce)")),Qr.matches)},set prefersReducedMotion(h){Fn=h}},Ar=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(h){this._frozenAt=h}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function Je(){return Ar.getCurrentTime()}var en,Ei;class me{static create(t,n,o){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),o&&o.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){me.docStyle&&me.selectProp&&(me.userSelect=me.docStyle[me.selectProp],me.docStyle[me.selectProp]="none")}static enableDrag(){me.docStyle&&me.selectProp&&(me.docStyle[me.selectProp]=me.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",me.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",me.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",me.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,o){const c=n.boundingClientRect;return new p.P((o.clientX-c.left)/n.x-t.clientLeft,(o.clientY-c.top)/n.y-t.clientTop)}static mousePos(t,n){const o=me.getScale(t);return me.getPoint(t,o,n)}static touchPos(t,n){const o=[],c=me.getScale(t);for(const f of n)o.push(me.getPoint(t,c,f));return o}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),o=n.querySelectorAll("script");for(const c of o)c.remove();return me.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const o=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!o.includes("javascript:")&&!o.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const o of n)me.removeAttributes(o),me.clean(o)}static removeAttributes(t){for(const{name:n,value:o}of t.attributes)me.isPossiblyDangerous(n,o)&&t.removeAttribute(n)}}me.docStyle=typeof window<"u"&&((en=window.document)===null||en===void 0?void 0:en.documentElement.style),me.selectProp=!me.docStyle||"userSelect"in me.docStyle?"userSelect":"webkitUserSelect",(function(h){let t,n,o,c;h.resetRequestQueue=()=>{t=[],n=0,o=0,c={}},h.addThrottleControl=w=>{const S=o++;return c[S]=w,S},h.removeThrottleControl=w=>{delete c[w],y()},h.getImage=(w,S,P=!0)=>new Promise(((E,C)=>{w.headers||(w.headers={}),w.headers.accept="image/webp,*/*",p.e(w,{type:"image"}),t.push({abortController:S,requestParameters:w,supportImageRefresh:P,state:"queued",onError:D=>{C(D)},onSuccess:D=>{E(D)}}),y()}));const f=w=>p._(this,void 0,void 0,(function*(){w.state="running";const{requestParameters:S,supportImageRefresh:P,onError:E,onSuccess:C,abortController:D}=w,B=P===!1&&!p.i(self)&&!p.g(S.url)&&(!S.headers||Object.keys(S.headers).reduce(((N,G)=>N&&G==="accept"),!0));n++;const j=B?x(S,D):p.m(S,D);try{const N=yield j;delete w.abortController,w.state="completed",N.data instanceof HTMLImageElement||p.b(N.data)?C(N):N.data&&C({data:yield($=N.data,t
16ypeof createImageBitmap=="function"?p.h($):p.j($)),cacheControl:N.cacheControl,expires:N.expires})}catch(N){delete w.abortController,E(p.d(N))}finally{n--,y()}var $})),y=()=>{const w=(()=>{for(const S of Object.keys(c))if(c[S]())return!0;return!1})()?p.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=n;S<w&&t.length>0;S++){const P=t.shift();P.abortController.signal.aborted?S--:f(P)}},x=(w,S)=>new Promise(((P,E)=>{const C=new Image,D=w.url,B=w.credentials;B&&B==="include"?C.crossOrigin="use-credentials":(B&&B==="same-origin"||!p.f(D))&&(C.crossOrigin="anonymous"),S.signal.addEventListener("abort",(()=>{C.src="",E(new p.a(S.signal.reason))})),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,P({data:C})},C.onerror=()=>{C.onerror=C.onload=null,S.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},C.src=D}))})(Ei||(Ei={})),Ei.resetRequestQueue();class Ft{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function tn(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:o,url:c}of h){const f=`${o}${c}`;n.includes(f)||(n.push(f),t.push({id:o,url:c}))}}return t}function Bn(h,t,n){try{const o=new URL(h);return o.pathname+=`${t}${n}`,o.toString()}catch{throw new Error(`Invalid sprite URL "${h}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function ba(h){const{userImage:t}=h;return!(!t?.render||!t.render()||(h.data.replace(new Uint8Array(t.data.buffer)),0))}class wa extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new p.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let o=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c?.width)||(this.fire(new p.l(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,c?.height)||(this.fire(new p.l(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new p.l(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,n){if(!t)return!0;let o=0;for(const c of t){if(c[0]<o||c[1]<c[0]||n<c[1])return!1;o=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const o=n.spriteData,c=o?.width||n.data.width,f=o?.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||f<t[1]||t[2]<0||c<t[2]||t[3]<0||f<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,n,o=!0){const c=this.getImage(t);if(o&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){var n;const o=this.images[t];delete this.images[t],delete this.patterns[t],!((n=o.userImage)===null||n===void 0)&&n.onRemove&&o.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,o)=>{let c=!0;if(!this.isLoaded())for(const f of t)this.images[f]||(c=!1);this.isLoaded()||c?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}
16))}_getImagesForIds(t){var n;const o={};for(const c of t){let f=this.getImage(c);f||(this.fire(new p.n("styleimagemissing",{id:c})),f=this.getImage(c)),f?o[c]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,textFitWidth:f.textFitWidth,textFitHeight:f.textFitHeight,hasRenderCallback:!!(!((n=f.userImage)===null||n===void 0)&&n.render)}:p.w(`Image "${c}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return o}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],o=this.getImage(t);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const c={w:o.data.width+2,h:o.data.height+2,x:0,y:0},f=new p.I(c,o);this.patterns[t]={bin:c,position:f}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new p.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const f in this.patterns)t.push(this.patterns[f].bin);const{w:n,h:o}=p.p(t),c=this.atlasImage;c.resize({width:n||1,height:o||1});for(const f in this.patterns){const{bin:y}=this.patterns[f],x=y.x+1,w=y.y+1,S=this.getImage(f).data,P=S.width,E=S.height;p.R.copy(S,c,{x:0,y:0},{x,y:w},{width:P,height:E}),p.R.copy(S,c,{x:0,y:E-1},{x,y:w-1},{width:P,height:1}),p.R.copy(S,c,{x:0,y:0},{x,y:w+E},{width:P,height:1}),p.R.copy(S,c,{x:P-1,y:0},{x:x-1,y:w},{width:1,height:E}),p.R.copy(S,c,{x:0,y:0},{x:x+P,y:w},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||p.w(`Image with ID: "${n}" was not found`),ba(o)&&this.updateImage(n,o)}}cloneImages(){const t={};for(const n in this.images){const o=this.images[n];t[n]=Object.assign(Object.assign({},o),{data:o.data?o.data.clone():null})}return t}}const Ye=1e20,W=new Float64Array(256);for(let h=0;h<256;h++){const t=.5-Math.pow(h/255,.45454545454545453);W[h]=t*Math.abs(t)}function K(h,t,n,o,c,f,y,x,w){for(let S=t;S<t+o;S++)ee(h,n*f+S,f,c,y,x,w);for(let S=n;S<n+c;S++)ee(h,S*f+t,1,o,y,x,w)}function ee(h,t,n,o,c,f,y){f[0]=0,y[0]=-Ye,y[1]=Ye,c[0]=h[t];for(let x=1,w=0,S=0;x<o;
16x++){c[x]=h[t+x*n];const P=x*x;do{const E=f[w];S=(c[x]-c[E]+P-E*E)/(x-E)/2}while(S<=y[w]&&--w>-1);w++,f[w]=x,y[w]=S,y[w+1]=Ye}for(let x=0,w=0;x<o;x++){for(;y[w+1]<x;)w++;const S=f[w],P=x-S;h[t+x*n]=c[S]+P*P}}W[255]=-Ye;const ye=p.v.layout_symbol["text-font"].default.join(",");class Ce{constructor(t,n,o){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=o}setURL(t){this.url=t}getGlyphs(t){return p._(this,void 0,void 0,(function*(){const n=[];for(const f in t)for(const y of t[f])n.push(this._getAndCacheGlyphsPromise(f,y));const o=yield Promise.all(n),c={};for(const{stack:f,id:y,glyph:x}of o)c[f]||(c[f]={}),c[f][y]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics};return c}))}_getAndCacheGlyphsPromise(t,n){return p._(this,void 0,void 0,(function*(){var o,c;(o=(c=this.entries)[t])!==null&&o!==void 0||(c[t]={glyphs:{},requests:{},ranges:{}});const f=this.entries[t];let y=f.glyphs[n];return y!==void 0?{stack:t,id:n,glyph:y}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(y=f.glyphs[n]=this._drawGlyph(f,t,n),{stack:t,id:n,glyph:y}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return p._(this,void 0,void 0,(function*(){var o;const c=this.entries[t],f=Math.floor(n/256);if(c.ranges[f])return{stack:t,id:n,glyph:null};(o=c.requests)[f]||(o[f]=Ce.loadGlyphRange(t,f,this.url,this.requestManager));try{const y=yield c.requests[f];for(const x in y)c.glyphs[+x]=y[+x];return c.ranges[f]=!0,{stack:t,id:n,glyph:y[n]||null}}catch(y){const x=c.glyphs[n]=this._drawGlyph(c,t,n);return this._warnOnMissingGlyphRange(x,f,n,p.d(y)),{stack:t,id:n,glyph:x}}}))}_warnOnMissingGlyphRange(t,n,o,c){const f=256*n,y=f+255,x=o.toString(16).padStart(4,"0").toUpperCase();p.w(`Unable to load glyph range ${n}, ${f}-${y}. Rendering codepoint U+${x} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&p.r(t)}_drawGlyph(t,n,o){const c=n===ye&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(o),f=c?"ideographTinySDF":"tinySDF";t[f]||(t[f]=this._createTinySDF(c?this.localIdeographFontFamily:n));const y=t[f].draw(String.fromCodePoint(o)),x=new RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(o));return{id:o,bitmap:new p.t({width:y.width||60,height:y.height||60},y.data),metrics:{width:x?0:y.glyphWidth/2||24,height:y.glyphHeight/2||24,left:y.glyphLeft/2+.5||0,top:y.glyphTop/2-27.5||-8,advance:x?0:y.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const o=n.map((c=>/[-\w]+/.test(c)?c:`'${CSS.escape(c)}'`)).join(",");return new Ce.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let o;for(const[c,f]of Object.entries(n))new RegExp(`\\b${c}\\b`,"i").test(t)&&(o=`${f}`);return o}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF=null,n.ideographTinySDF=null,n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}Ce.loadGlyphRange=function(h,t,n,o){return p._(this,void 0,void 0,(function*(){const c=256*t,f=c+255,y=yield o.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${c}-${f}`),"Glyphs"),x=yield p.o(y,new AbortController);if(!x?.data)throw new Error(`Could not load glyph range. range: ${t}, ${c}-${f}`);const w={};for(const S of p.q(x.data))w[S.id]=S;return w}))},Ce.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:o=.25,fontFamily:c="sans-serif",fontWeight:f="normal",fontStyle:y="normal",lang:x=null}={}){this.buffer=t,this.radius=n,this.cutoff=o,this.lang=x;const w=this.size=h+4*t,S=this._createCanvas(w),P=this.ctx=S.getContext("2d",{willReadFrequently:!0});P.font=`${y} ${f} ${h}px ${c}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(h){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(h,h);const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:c,actualBoundingBoxRight:f}=this.ctx.measureText(h),y=Math.ceil(n),x=Math.floor(c),w=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(f)-x)),S=Math.max(0,Math.min(this.size-this.buffer,y+Math.ceil(o))),P=w+2*this.buffer,E=S+2*this.buffer,C=Math.max(P*E,0),D=new Uint8ClampedArray(C),B={data:D,width:P,height:E,glyphWidth:w,glyphHeight:S,glyphTop:y,glyphLeft:x,glyphAdvance:t};if(w===0||S===0)return B;const{ctx:j,buffer:$,gridInner:N,gridOuter:G}=this;this.lang&&(j.lang=this.lang),j.clearRect($,$,w,S),j.fillText(h,$-x,$+y);const X=j.getImageData($,$,w,S);G.fill(Ye,0,C),N.fill(0,0,C);let Z=3;for(let q=0;q<S;q++){let Q=(q+$)*P+$;for(let ae=0;ae<w;ae++,Z+=4,Q++){const oe=X.data[Z];if(oe===0)continue;const fe=W[oe];G[Q]=Math.max(0,fe),N[Q]=Math.max(0,-fe)}}K(G,0,0,P,E,P,this.f,this.v,this.z),K(N,$,$,w,S,P,this.f,this.v,this.z);const U=255/this.radius,H=255*(1-this.cutoff);for(let q=0;q<C;q++){const Q=Math.sqrt(G[q])-Math.sqrt(N[q]);D[q]=Math.round(H-U*Q)}return B}};class He{constructor(){this.specification=p.x.light.position}possiblyEvaluate(t,n){return p.G(t.expression.evaluate(n))}interpolate(t,n,o){return{x:p.H.number(t.x,n.x,o),y:p.H.number(t.y,n.y,o),z:p.H.number(t.z,n.z,o)}}}let Le;class We extends p.E{constructor(t){super(),Le||(Le=new p.u({anchor:new p.D(p.x.light.anchor),position:new He,color:new p.D(p.x.light.color),intensity:new p.D(p.x.light.intensity)})),this._transitionable=new p.y(Le,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}
vendor: 4,043 bytes, line 16
16){if(!this._validate(p.z,t,n))for(const o in t){const c=t[o];o.endsWith(p.B)?this._transitionable.setTransition(o.slice(0,-p.B.length),c):this._transitionable.setValue(o,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,o){return o?.validate!==!1&&p.C(this,t.call(p.F,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.x}))}}const Ve=new p.u({"sky-color":new p.D(p.x.sky["sky-color"]),"horizon-color":new p.D(p.x.sky["horizon-color"]),"fog-color":new p.D(p.x.sky["fog-color"]),"fog-ground-blend":new p.D(p.x.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.x.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.x.sky["atmosphere-blend"])});class et extends p.E{constructor(t){super(),this._transitionable=new p.y(Ve,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.J(0))}setSky(t,n={}){if(!this._validate(p.K,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const o in t){const c=t[o];o.endsWith(p.B)?this._transitionable.setTransition(o.slice(0,-p.B.length),c):this._transitionable.setValue(o,c)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,o={}){return o?.validate!==!1&&p.C(this,t.call(p.F,p.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.x})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Re{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){var o;const c=t.join(",")+String(n);return(o=this.dashEntry)[c]||(o[c]=this.addDash(t,n)),this.dashEntry[c]}getDashRanges(t,n,o){const c=[];let f=t.length%2==1?-t[t.length-1]*o:0,y=t[0]*o,x=!0;c.push({left:f,right:y,isDash:x,zeroLength:t[0]===0});let w=t[0];for(let S=1;S<t.length;S++){x=!x;const P=t[S];f=w*o,w+=P,y=w*o,c.push({left:f,right:y,isDash:x,zeroLength:P===0})}return c}addRoundDash(t,n,o){const c=n/2;for(let f=-o;f<=o;f++){const y=this.width*(this.nextRow+o+f);let x=0,w=t[x];for(let S=0;S<this.width;S++){S/w.right>1&&(w=t[++x]);const P=Math.abs(S-w.left),E=Math.abs(S-w.right),C=Math.min(P,E);let D;const B=f/o*(c+1);if(w.isDash){const j=c-Math.abs(B);D=Math.sqrt(C*C+j*j)}else D=c-Math.sqrt(C*C+B*B);this.data[y+S]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(t){for(let x=t.length-1;x>=0;--x){const w=t[x],S=t[x+1];w.zeroLength?t.splice(x,1):S&&S.isDash===w.isDash&&(S.left=w.left,t.splice(x,1))}const n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const c=this.width*this.nextRow;let f=0,y=t[f];for(let x=0;x<this.width;x++){x/y.right>1&&(y=t[++f]);const w=Math.abs(x-y.left),S=Math.abs(x-y.right),P=Math.min(w,S);this.data[c+x]=Math.max(0,Math.min(255,(y.isDash?P:-P)+128))}}addDash(t,n){const o=n?7:0,c=2*o+1;if(this.nextRow+c>this.height)return p.w("LineAtlas out of space"),null;let f=0;for(const x of t)f+=x;if(f!==0){const x=this.width/f,w=this.getDashRanges(t,this.width,x);n?this.addRoundDash(w,x,o):this.addRegularDash(w)}const y={y:this.nextRow+o,height:2*o,width:f};return this.nextRow+=c,this.dirty=!0,y}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
16INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const bt="maplibre_preloaded_worker_pool";class wt{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<wt.workerCount;)this.workers.push(new Worker(p.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(const n of this.workers)n.terminate();this.workers=null}}isPreloaded(){return!!this.active[bt]}numActive(){return Object.keys(this.active).length}}const Yi=Math.floor(Wt.hardwareConcurrency/2);let ji,zr;function rn(){return ji||(ji=new wt),ji}wt.workerCount=p.L(globalThis)?Math.max(Math.min(Yi,3),1):1;class Ta{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let c=0;c<o.length;c++){const f=new p.N(o[c],n);f.name=`Worker ${c}`,this.actors.push(f)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const o=[];for(const c of this.actors)o.push(c.sendAsync({type:t,data:n}));return Promise.all(o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(const n of this.actors)n.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const o of this.actors)o.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function ci(){return zr||(zr=new Ta(rn(),p.M),zr.registerMessageHandler("GR",((h,t,n)=>p.m(t,n)))),zr}function On(h,t){const n=p.O();return p.Q(n,n,[1,1,0]),p.S(n,n,[.5*h.width,.5*h.height,1]),h.calculatePosMatrix?p.U(n,n,h.calculatePosMatrix(t.toUnwrapped())):n}function Vi(h,t,n,o,c,f,y){var x;const w=(function(C,D,B){if(C)for(const j of C){const $=D[j];if($?.source===B&&$.type==="fill-extrusion")return!0}else for(const j in D){const $=D[j];if($.source===B&&$.type==="fill-extrusion")return!0}return!1})((x=c?.layers)!==null&&x!==void 0?x:null,t,h.id),S=f.maxPitchScaleFactor(),P=h.tilesIn(o,S,w);P.sort(Sa);const E=[];for(const C of P)E.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(t,n,h.getState(),C.queryGeometry,C.cameraQueryGeometry,C.scale,c,f,S,On(f,C.tileID),y?(D,B)=>y(C.tileID,D,B):void 0)});return(function(C,D){for(const B in C)for(const j of C[B])Dr(j,D);return C})((function(C){const D={},B={};for(const{queryResults:j,wrappedTileID:$}of C){B[$]||(B[$]={});const N=B[$];for(const G in j){const X=j[G];N[G]||(N[G]={});const Z=N[G];D[G]||(D[G]=[]);for(const U of X)Z[U.featureIndex]||(Z[U.featureIndex]=!0,D[G].push(U))}}return D})(E),h)}function Sa(h,t){const n=h.tileID,o=t.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function Dr(h,t){const n=h.feature,o=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}function nn(h,t,n,o){return p._(this,void 0,void 0,(function*(){let c=h;if(h.url?c=(yield p.k(yield t.transformRequest(h.url,"Source"),n)).data:yield Wt.frameAsync(n,o),!c)return null;const f=p.V(p.e(c,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in c&&c.vector_layers&&(f.vectorLayerIds=c.vector_layers.map((y=>y.id))),f}))}class Fe{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof p.W?new p.W(t.lng,t.lat):p.W.convert(t),this}setSouthWest(t){return this._sw=t instanceof p.W?new p.W(t.lng,t.lat):p.W.convert(t),this}extend(t){const n=this._sw,o=this._ne;let c,f;if(t instanceof p.W)c=t,f=t;else{if(!(t instanceof Fe))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Fe.convert(t)):this.extend(p.W.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(p.W.convert(t)):this;if(c=t._sw,f=t._ne,!c||!f)return this}return n||o?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),o.lng=Math.max(f.lng,o.lng),o.lat=Math.max(f.lat,o.lat)):(this._sw=new p.W(c.lng,c.lat),this._ne=new p.W(f.lng,f.lat)),this}getCenter(){return new p.W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
16getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p.W(this.getWest(),this.getNorth())}getSouthEast(){return new p.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:o}=p.W.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}intersects(t){if(!((t=Fe.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),o=Math.abs(t.getEast()-t.getWest());if(n>=360||o>=360)return!0;const c=p.X(this.getWest(),-180,180),f=p.X(this.getEast(),-180,180),y=p.X(t.getWest(),-180,180),x=p.X(t.getEast(),-180,180),w=c>f,S=y>x;return!(!w||!S)||(w?x>=c||y<=f:S?f>=y||c<=x:y<=f&&x>=c)}static convert(t){return t instanceof Fe?t:t&&new Fe(t)}static fromLngLat(t,n=0){const o=360*n/40075017,c=o/Math.cos(Math.PI/180*t.lat);return new Fe(new p.W(t.lng-c,t.lat-o),new p.W(t.lng+c,t.lat+o))}adjustAntiMeridian(){const t=new p.W(this._sw.lng,this._sw.lat),n=new p.W(this._ne.lng,this._ne.lat);return new Fe(t,t.lng>n.lng?new p.W(n.lng+360,n.lat):n)}}class jt{constructor(t,n,o){this.bounds=Fe.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||24}
vendor: 2,398 bytes, line 16
16validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),o=Math.floor(p.Z(this.bounds.getWest())*n),c=Math.floor(p.Y(this.bounds.getNorth())*n),f=Math.ceil(p.Z(this.bounds.getEast())*n),y=Math.ceil(p.Y(this.bounds.getSouth())*n);return t.x>=o&&t.x<f&&t.y>=c&&t.y<y}}class Ht extends p.E{constructor(t,n,o,c){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.V(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=p.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){return p._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new p.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield nn(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(p.e(this,n),n.bounds&&(this.tileBounds=new jt(n.bounds,this.minzoom,this.maxzoom)),this.fire(new p.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,p.$(n)||this.fire(new p.l(p.d(n)))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:yield this.map._requestManager.transformRequest(n,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
16ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};o.request.collectResourceTiming=this._collectResourceTiming;let c="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((f,y)=>{t.reloadPromise={resolve:f,reject:y}}))}else t.actor=this.dispatcher.getActor(),c="LT";t.abortController=new AbortController;try{const f=yield t.actor.sendAsync({type:c,data:o},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,f);const y={};return f?.etagUnmodified&&(y.unmodified=!0),y}catch(f){if(delete t.abortController,t.aborted)return;if(f&&f.status!==404)throw f;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){return p._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,o=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:yield this.map._requestManager.transformRequest(o,"Tile")}}))}_afterTileLoadWorkerResponse(t,n){if(n?.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.etag=n?.etag,t.loadVectorData(n,this.map.painter),t.reloadPromise){const o=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(o.resolve).catch(o.reject)}}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
vendor: 4,211 bytes, line 16
16ype,source:this.id}}))}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Ci extends p.E{constructor(t,n,o,c){super(),this.id=t,this.dispatcher=o,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.V(n,["url","scheme","tileSize"]))}load(){return p._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new p.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield nn(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(p.e(this,n),n.bounds&&(this.tileBounds=new jt(n.bounds,this.minzoom,this.maxzoom)),this.fire(new p.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,p.$(n)||this.fire(new p.l(p.d(n)))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return p.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield Ei.getImage(yield this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o?.data){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const c=this.map.painter.context,f=c.gl,y=o.data;t.texture=this.map.painter.getTileTexture(y.width),t.texture?t.texture.update(y,{useMipmap:!0}):(t.texture=new p.T(c,y,f.RGBA,{useMipmap:!0}),t.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}}))}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class Xt extends Ci{constructor(t,n,o,c){super(t,n,o,c),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=yield this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const c=yield Ei.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(c?.data){const f=c.data;this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&t.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const y=p.b(f)&&p.a0()?f:yield this.readImageNow(f),x={type:this.type,uid:t.uid,source:this.id,rawImageData:y,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:x}
16),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(c){if(delete t.abortController,t.aborted)t.state="unloaded";else if(c)throw t.state="errored",c}}))}readImageNow(t){return p._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&p.a1()){const n=t.width+2,o=t.height+2;try{return new p.R({width:n,height:o},yield p.a2(t,-1,-1,n,o))}catch{}}return Wt.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,o=Math.pow(2,n.z),c=(n.x-1+o)%o,f=n.x===0?t.wrap-1:t.wrap,y=(n.x+1+o)%o,x=n.x+1===o?t.wrap+1:t.wrap,w={};return w[new p.a3(t.overscaledZ,f,n.z,c,n.y).key]={backfilled:!1},w[new p.a3(t.overscaledZ,x,n.z,y,n.y).key]={backfilled:!1},n.y>0&&(w[new p.a3(t.overscaledZ,f,n.z,c,n.y-1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,x,n.z,y,n.y-1).key]={backfilled:!1}),n.y+1<o&&(w[new p.a3(t.overscaledZ,f,n.z,c,n.y+1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,x,n.z,y,n.y+1).key]={backfilled:!1}),w}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function xi(h,t){return t?h.properties[t]:h.id}function an(h,t){const n={id:h.id};if(t.removeAllProperties&&(delete h.removeProperties,delete h.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const o of t.removeProperties){const c=h.addOrUpdateProperties.findIndex((f=>f.key===o));c>-1&&h.addOrUpdateProperties.splice(c,1)}return(h.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(h.removeProperties||t.removeProperties)&&(n.removeProperties=[...h.removeProperties||[],...t.removeProperties||[]]),(h.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...h.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(h.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||h.newGeometry),n}function Bo(h){var t,n;if(!h)return{};const o={};return o.removeAll=h.removeAll,o.remove=new Set(h.remove||[]),o.add=new Map((t=h.add)===null||t===void 0?void 0:t.map((c=>[c.id,c]))),o.update=new Map((n=h.update)===null||n===void 0?void 0:n.map((c=>[c.id,c]))),o}function Oo(h){return h&&h.length!==0?typeof h[0]=="number"?[h]:h.flatMap((t=>Oo(t))):[]}function kr(h){return h.type==="GeometryCollection"?h.geometries.flatMap((t=>kr(t))):Oo(h.coordinates)}function jn(h){const t=new Fe;let n;switch(h.type){case"FeatureCollection":n=h.features.flatMap((o=>kr(o.geometry)));break;case"Feature":n=kr(h.geometry);break;default:n=kr(h)}if(n.length===0)return t;for(const o of n){const[c,f]=o;t.extend([c,f])}return t}class _s extends p.E{constructor(t,n,o,c){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=o.getActor(),this.setEventedParent(c),this._data=typeof n.data=="str
16ing"?{url:n.data}:{geojson:n.data},this._options=p.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:p.a6,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId=="string"?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:p.a6,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(p.a6/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||p.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return p._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const o=this._updateWorkerData();return n?o:this}updateData(t,n){this._pendingWorkerUpdate.diff=(function(c,f){if(!c)return f||{};if(!f)return c||{};const y=Bo(c),x=Bo(f);(function(S,P){P.removeAll&&(S.add.clear(),S.update.clear(),S.remove.clear(),P.remove.clear());for(const E of P.remove)S.add.delete(E),S.update.delete(E);for(const[E,C]of P.update){const D=S.update.get(E);D&&(P.update.set(E,an(D,C)),S.update.delete(E))}})(y,x);const w={};if((y.removeAll||x.removeAll)&&(w.removeAll=!0),w.remove=new Set([...y.remove,...x.remove]),w.add=new Map([...y.add,...x.add]),w.update=new Map([...y.update,...x.update]),w.remove.size&&w.add.size)for(const S of w.add.keys())w.remove.delete(S);return(function(S){const P={};return S.removeAll&&(P.removeAll=S.removeAll),S.remove&&(P.remove=Array.from(S.remove)),S.add&&(P.add=Array.from(S.add.values())),S.update&&(P.update=Array.from(S.update.values())
16),P})(w)})(this._pendingWorkerUpdate.diff,t);const o=this._updateWorkerData();return n?o:this}getData(){return p._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return p._(this,void 0,void 0,(function*(){return jn(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:o}})}_updateWorkerData(){return p._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void p.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n,updateCluster:o}=this._pendingWorkerUpdate,c=this._getLoadGeoJSONParameters(t,n,o);t!==void 0?this._pendingWorkerUpdate.data=void 0:n?this._pendingWorkerUpdate.diff=void 0:o&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(c)}))}_getLoadGeoJSONParameters(t,n,o){return p._(this,void 0,void 0,(function*(){const c=p.e({type:this.type},this.workerOptions);return typeof t=="string"?(c.request=yield this.map._requestManager.transformRequest(Wt.resolveURL(t),"Source"),c.request.collectResourceTiming=this._collectResourceTiming,c):t!==void 0?(c.data=t,c):n?(c.dataDiff=n,c):o?(c.updateCluster=!0,c):void 0}))}_dispatchWorkerUpdate(t){return p._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new p.n("dataloading",{dataType:"source"}));try{const n=yield t,o=yield this.actor.sendAsync({type:"LD",data:n});if(this._isUpdatingWorker=!1,this._removed||o.abandoned)return void this.fire(new p.n("dataabort",{dataType:"source"}));o.data&&(this._data={geojson:o.data});const c=this._applyDiffToSource(n.dataDiff),f=this._getShouldReloadTileOptions(c),y={dataType:"source"};this._applyResourceTiming(y,o),this.fire(new p.n("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new p.n("data",Object.assign(Object.assign({},y),{sourceDataType:"content",shouldReloadTileOptions:f})))}catch(n){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new p.n("dataabort",{dataType:"source"}));this.fire(new p.l(p.d(n)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,n){var o;if(!this._collectResourceTiming)return;const c=(o=n.resourceTiming)===null||o===void 0?void 0:o[this.id];if(!c)return;const f=c.slice(0);f?.length&&p.e(t,{resourceTiming:f})}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const c=(function(f,y){const x=new Map;if(f==null||f.type==null)return x;if(f.type==="Feature"){const w=xi(f,y);return w==null?void 0:(x.set(w,f),x)}if(f.type==="FeatureCollection"){const w=new Set;for(const S of f.features){const P=xi(S,y);if(P==null||w.has(P))return;w.add(P),x.set(P,S)}return x}})(this._data.geojson,n);if(!c)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:c}}if(!this._data.updateable)return;const o=(function(c,f,y){var x,w;const S=[];if(f.removeAll)c.clear();else if(f.remove)for(const P of f.remove){const E=c.get(P);E&&(S.push(E.geometry),c.delete(P))}if(f.add)for(const P of f.add){const E=xi(P,y);if(E==null)continue;const C=c.get(E);C&&S.push(C.geometry),S.push(P.geometry),c.set(E,P)}if(f.update)for(const P of f.update){const E=c.get(P.id);if(!E)continue;const C=!!P.newGeometry,D=P.removeAllProperties||((x=P.removeProperties)===null||x===void 0?void 0:x.length)>0||((w=P.addOrUpdateProperties)===null||w===void 0?void 0:w.length)>0;if(!C&&!D)continue;S.push(E.geometry);const B=Object.assign({},E);if(c.set(P.id,B),C&&(S.push(P.newGeometry),B.geometry=P.newGeometry),D){if(B.properties=P.removeAllProperties?{}:Object.assign({},B.properties||{}),P.removeProperties)for(const j of P.removeProperties)delete B.properties[j];if(P.addOrUpdateProperties)for(const{key:j,value:$}of P.addOrUpdateProperties)B.properties[j]=$}}return S})(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:o}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>
vendor: 1,424 bytes, line 16
16jn(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:o,extent:c}=this.workerOptions.geojsonVtOptions,f=(function({x:y,y:x,z:w},S=0){const P=p.a4((y-S)/Math.pow(2,w)),E=p.a5((x+1+S)/Math.pow(2,w)),C=p.a4((y+1+S)/Math.pow(2,w)),D=p.a5((x-S)/Math.pow(2,w));return new Fe([P,E],[C,D])})(t.tileID.canonical,o/c);for(const y of n)if(f.intersects(y))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const c=yield this.actor.sendAsync({type:n,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(c,this.map.painter,n==="RT")}))}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
16ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Rr extends p.E{constructor(t,n,o,c){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ei.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n?.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,p.$(n)||this.fire(new p.l(p.d(n)))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(p.a7.fromLngLat);var o;return this.tileID=(function(c){const f=p.a8.fromPoints(c),y=f.width(),x=f.height(),w=Math.max(y,x),S=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),P=Math.pow(2,S);return new p.aa(S,Math.floor((f.minX+f.maxX)/2*P),Math.floor((f.minY+f.maxY)/2*P))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((c=>this.tileID.getTilePoint(c)._round())),this.flippedWindingOrder=((o=this.tileCoords)[1].x-o[0].x)*(o[2].y-o[0].y)-(o[1].y-o[0].y)*(o[2].x-o[0].x)<0,this.fire(new p.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new p.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new p.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return p._(this,void 0,void 0,(function*(){var n;!((n=this.tileID)===null||n===void 0)&&n.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:o,maxX:c,maxY:f}=p.a8.fromPoints(t),y={};for(let x=0;x<=p.a9;x++){const w=Math.pow(2,x),S=Math.floor(n*w),P=Math.floor(o*w),E=Math.floor(c*w),C=Math.floor(f*w),D=(S%w+w)%w,B=E%w,j=Math.floor(S/w),$=Math.floor(E/w);y[x]={minWrap:j,maxWrap:$,minTileXWrapped:D,maxTileXWrapped:B,minTileY:P,maxTileY:C}}return y}}class sn extends Rr{constructor(t,n,o,c){super(t,n,o,c),this._onPlayingHandler=()=>{var f;(f=this.map)===null||f===void 0||f.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(n,"Source")).url);try{const n=yield p.ab(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.l(p.d(n)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new p.l(new p.ac(`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}
vendor: 4,361 bytes, line 16
16onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;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 p.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new p.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class jo extends Rr{constructor(t,n,o,c){super(t,n,o,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((f=>!Array.isArray(f)||f.length!==2||f.some((y=>typeof y!="number"))))||this.fire(new p.l(new p.ac(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.l(new p.ac(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.l(new p.ac(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.l(new p.ac(`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 p.l(new p.ac(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new p.l(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new p.T(n,this.canvas,o.RGBA,{premultiply:!0}),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let c=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,c=!0)}c&&this.fire(new p.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Vo={},gs=h=>{switch(h){case"geojson":return _s;case"image":return Rr;case"raster":return Ci;case"raster-dem":return Xt;case"vector":return Ht;case"video":return sn;case"canvas":return jo}return Vo[h]},Pa="RTLPluginLoaded";class lc extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ci()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return p._(this,arguments,void 0,(function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Wt.resolveURL(n),!this.url)throw new Error(`requested url ${n}
16 is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return p._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.n(Pa))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ys=null;function Lr(){return ys||(ys=new lc),ys}var dr,Ni;(function(h){h[h.Base=0]="Base",h[h.Parent=1]="Parent"})(dr||(dr={})),(function(h){h[h.Departing=0]="Departing",h[h.Incoming=1]="Incoming"})(Ni||(Ni={}));class Vn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=p.ad(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:o,fadeEndTime:c}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=o,this.fadeEndTime=c}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=Je(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,o){if(t?.etagUnmodified!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(c,f){const y={};if(!f)return y;for(const x of c){const w=x.layerIds.map((S=>f.getLayer(S))).filter(Boolean);if(w.length!==0){x.layers=w,x.stateDependentLayerIds&&(x.stateDependentLayers=x.stateDependentLayerIds.map((S=>w.filter((P=>P.id===S))[0])));for(const S of w)y[S.id]=x}}return y})(t.buckets,n?.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const f=this.buckets[c];if(f instanceof p.af){if(this.hasSymbolBuckets=!0,!o)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const f=this.buckets[c];if(f instanceof p.af&&f.hasRTLText){this.hasRTLText=!0,Lr().lazyLoad();break}}this.queryPadding=0;for(const c in this.buckets){const f=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(f))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new p.ae;else this.state="loaded"}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const o in this.buckets){const c=this.buckets[o];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new p.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new p.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,o,c,f,y,x,w,S,P,E){var C;return!((C=this.latestFeatureIndex)===null||C===void 0)&&C.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:f,scale:y,tileSize:this.tileSize,pixelPosMatrix:P,transform:w,params:x,queryPadding:this.queryPadding*S,getElevation:E},t,n,o):{}}
16querySourceFeatures(t,n){const o=this.latestFeatureIndex;if(!o?.rawTileData)return;const c=o.loadVTLayers(),f=n?.sourceLayer?n.sourceLayer:"",y=c[p.ag]||c[f];if(!y)return;const x=p.ah(n?.filter,n?.globalState),{z:w,x:S,y:P}=this.tileID.canonical,E={z:w,x:S,y:P};for(let C=0;C<y.length;C++){const D=y.feature(C);if(x.needGeometry){const $=p.ai(D,!0);if(!x.filter(new p.J(this.tileID.overscaledZ),$,this.tileID.canonical))continue}else if(!x.filter(new p.J(this.tileID.overscaledZ),D))continue;const B=o.getId(D,f),j=new p.aj(D,w,S,P,B);j.tile=E,t.push(j)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const o=p.ak(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const o=Date.now();let c=!1;if(this.expirationTime>o)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const f=this.expirationTime-n;f?this.expirationTime=o+Math.max(f,3e4):c=!0}else c=!0;c?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){var o,c,f;if(!(!((o=this.latestFeatureIndex)===null||o===void 0)&&o.rawTileData)||Object.keys(t).length===0)return;const y=this.latestFeatureIndex.loadVTLayers();for(const x in this.buckets){if(!n.style.hasLayer(x))continue;const w=this.buckets[x],S=w.layers[0].sourceLayer||p.ag,P=y[S],E=t[S];if(!P||!E||Object.keys(E).length===0)continue;w.update(E,P,((c=this.imageAtlas)===null||c===void 0?void 0:c.patternPositions)||{},this.dashPositions||{});const C=(f=n?.style)===null||f===void 0?void 0:f.getLayer(x);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(w)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Je()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=Je()+t}setDependencies(t,n){const o={};for(const c of n)o[c]=!0;this.dependencies[t]=o}hasDependency(t,n){for(const o of t){const c=this.dependencies[o];if(c){for(const f of n)if(c[f])return!0}}return!1}}class No{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,n,o){var c,f,y,x,w;const S=String(n);if((x=this.stateChanges)[t]||(x[t]={}),(w=this.stateChanges[t])[S]||(w[S]={}),p.e(this.stateChanges[t][S],o),this.deletedStates[t]===null){this.deletedStates[t]={};for(const P in this.state[t])P!==S&&(this.deletedStates[t][P]=null)}else if(((c=this.deletedStates[t])===null||c===void 0?void 0:c[S])===null){this.deletedStates[t][S]={};for(const P in this.state[t][S])o[P]||(this.deletedStates[t][S][P]=null)}else for(const P in o)((y=(f=this.deletedStates[t])===null||f===void 0?void 0:f[S])===null||y===void 0?void 0:y[P])===null&&delete this.deletedStates[t][S][P]}removeFeatureState(t,n,o){var c,f,y;if(this.deletedStates[t]===null)return;const x=String(n);if((f=this.deletedStates)[t]||(f[t]={}),o&&n!==void 0)this.deletedStates[t][x]!==null&&((y=this.deletedStates[t])[x]||(y[x]={}),this.deletedStates[t][x][o]=null);else if(n!==void 0)if(!((c=this.stateChanges[t])===null||c===void 0)&&c[x])for(o in this.deletedStates[t][x]={},this.stateChanges[t][x])this.deletedStates[t][x][o]=null;else this.deletedStates[t][x]=null;else this.deletedStates[t]=null}getState(t,n){const o=String(n),c=p.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const f=this.deletedStates[t][n];if(f===null)return{};for(const y in f)delete c[y]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){var o,c,f;const y={};for(const x in this.stateChanges){(o=this.state)[x]||(o[x]={});const w={};for(const S in this.stateChanges[x])(c=this.state[x])[S]||(c[S]={}),p.e(this.state[x][S],this.stateChanges[x][S]),w[S]=this.state[x][S];
16y[x]=w}for(const x in this.deletedStates){(f=this.state)[x]||(f[x]={});const w={};if(this.deletedStates[x]===null)for(const S in this.state[x])w[S]={},this.state[x][S]={};else for(const S in this.deletedStates[x]){if(this.deletedStates[x][S]===null)this.state[x][S]={};else for(const P of Object.keys(this.deletedStates[x][S]))delete this.state[x][S][P];w[S]=this.state[x][S]}y[x]||(y[x]={}),p.e(y[x],w)}this.stateChanges={},this.deletedStates={},Object.keys(y).length!==0&&(this.revision++,t.setFeatureState(y,n))}}const on=89.25;function Ki(h,t){const n=p.al(t.lat,-p.am,p.am);return new p.P(p.Z(t.lng)*h,p.Y(n)*h)}function Nn(h,t){return new p.a7(t.x/h,t.y/h).toLngLat()}function ln(h){return h.cameraToCenterDistance*Math.min(.85*Math.tan(p.an(90-h.pitch)),Math.tan(p.an(on-h.pitch)))}function Ia(h,t){const n=h.canonical,o=t/p.ao(n.z),c=n.x+Math.pow(2,n.z)*h.wrap,f=p.ap(new Float64Array(16));return p.Q(f,f,[c*o,n.y*o,0]),p.S(f,f,[o/p.a6,o/p.a6,1]),f}function Un(h,t,n,o,c){const f=p.a7.fromLngLat(h,t),y=c*p.aq(1,h.lat),{x,y:w,z:S}=vs(n,o);return new p.a7(f.x+y*-x,f.y+y*-w,f.z+y*-S)}function vs(h,t){const n=p.an(h),o=p.an(t),c=Math.cos(-n),f=Math.sin(n);return{x:f*Math.sin(o),y:-f*Math.cos(o),z:c}}function ue(h,t,n){const o=t.intersectsFrustum(h);if(!n||o===0)return o;const c=t.intersectsPlane(n);return c===0?0:o===2&&c===2?2:1}function Uo(h,t,n){let o=0;const c=(n-t)/10;for(let f=0;f<10;f++)o+=c*Math.pow(Math.cos(t+(f+.5)/10*(n-t)),h);return o}function $o(h,t){return function(n,o,c,f,y){const x=2*((h-1)/p.ar(Math.cos(p.an(on-y))/Math.cos(p.an(on)))-1),w=Math.acos(c/f),S=2*Uo(x-1,0,p.an(y/2)),P=Math.min(p.an(on),w+p.an(y/2)),E=Uo(x-1,Math.min(P,w-p.an(y/2)),P),C=Math.atan(o/c),D=Math.hypot(o,c);let B=n;return B+=p.ar(f/D/Math.max(.5,Math.cos(p.an(y/2)))),B+=x*p.ar(Math.cos(C))/2,B-=p.ar(Math.max(1,E/S/t))/2,B}}const nt=$o(9.314,3);function bi(h,t){const n=(t.roundZoom?Math.round:Math.floor)(h.zoom+p.ar(h.tileSize/t.tileSize));return Math.max(0,n)}function cn(h,t){const n=h.getCameraFrustum(),o=h.getClippingPlane(),c=h.screenPointToMercatorCoordinate(h.getCameraPoint()),f=p.a7.fromLngLat(h.center,h.elevation);c.z=f.z+Math.cos(h.pitchInRadians)*h.cameraToCenterDistance/h.worldSize;const y=h.getCoveringTilesDetailsProvider(),x=y.allowVariableZoom(h,t),w=bi(h,t),S=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:h.maxZoom,E=Math.min(Math.max(0,w),P),C=Math.pow(2,E),D=[C*c.x,C*c.y,0],B=[C*f.x,C*f.y,0],j=Math.hypot(f.x-c.x,f.y-c.y),$=Math.abs(f.z-c.z),N=Math.hypot(j,$),G=U=>({zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),X=[],Z=[];if(h.renderWorldCopies&&y.allowWorldCopies())for(let U=1;U<=3;U++)X.push(G(-U)),X.push(G(U));for(X.push(G(0));X.length>0;){const U=X.pop(),H=U.x,q=U.y;let Q=U.fullyVisible;const ae={x:H,y:q,z:U.zoom},oe=y.getTileBoundingVolume(ae,U.wrap,h.elevation,t);if(!Q){const be=ue(n,oe,o);if(be===0)continue;Q=be===2}const fe=y.distanceToTile2d(c.x,c.y,ae,oe);let de=w;x&&(de=(t.calculateTileZoom||nt)(h.zoom+p.ar(h.tileSize/t.tileSize),fe,$,N,h.fov)),de=(t.roundZoom?Math.round:Math.floor)(de),de=Math.max(0,de);const Me=Math.min(de,P);if(U.wrap=y.getWrap(f,ae,U.wrap),U.zoom>=Me){if(U.zoom<S)continue;const be=E-U.zoom,he=D[0]-.5-(H<<be),Se=D[1]-.5-(q<<be),Ae=t.reparseOverscaled?Math.max(U.zoom,de):U.zoom;Z.push({tileID:new p.a3(U.zoom===P?Ae:U.zoom,U.wrap,U.zoom,H,q),distanceSq:p.as([B[0]-.5-H,B[1]-.5-q]),tileDistanceToCamera:Math.sqrt(he*he+Se*Se)})}else for(let be=0;be<4;be++)X.push({zoom:U.zoom+1,x:(H<<1)+be%2,y:(q<<1)+(be>>1),wrap:U.wrap,fullyVisible:Q})}return Z.sort(((U,H)=>U.distanceSq-H.distanceSq)).map((U=>U.tileID))}const cc=p.a8.fromPoints([new p.P(0,0),new p.P(p.a6,p.a6)]);function uc(h){return h==="raster"||h==="image"||h==="video"}function ju(h,t,n,o,c,f,y){if(!t.hasData())return!1;const{tileID:x,fadingRole:w,fadingDirection:S,fadingParentID:P}=t;if(w===dr.Base&&S===Ni.Incoming&&P)return n[P.key]=P,!0;const E=Math.max(x.overscaledZ-c,f);for(let C=x.overscaledZ-1;C>=E;C--){const D=x.scaledTo(C),B=h.getLoadedTile(D);if(B)return t.setCrossFadeLogic({fadingRole:dr.Base,fadingDirection:Ni.Incoming,fadingParentID:B.tileID,fadeEndTime:o+y}),B.setCrossFadeLogic({fadingRole:dr.Parent,fadingDirection:Ni.Departing,fadeEndTime:o+y}),n[D.key]=D,!0}return!1}function xs(h,t,n,o,c,f){if(!t.hasData())return!1;
16const y=t.tileID.children(c);let x=Go(h,t,y,n,o,c,f);if(x)return!0;for(const w of y)Go(h,t,w.children(c),n,o,c,f)&&(x=!0);return x}function Go(h,t,n,o,c,f,y){if(n[0].overscaledZ>=f)return!1;let x=!1;for(const w of n){const S=h.getLoadedTile(w);if(!S)continue;const{fadingRole:P,fadingDirection:E,fadingParentID:C}=S;P===dr.Base&&E===Ni.Departing&&C||(S.setCrossFadeLogic({fadingRole:dr.Base,fadingDirection:Ni.Departing,fadingParentID:t.tileID,fadeEndTime:c+y}),t.setCrossFadeLogic({fadingRole:dr.Parent,fadingDirection:Ni.Incoming,fadeEndTime:c+y})),o[w.key]=w,x=!0}return x}function hc(h,t,n,o){const c=h.tileID;return!!h.selfFading||!h.hasData()&&!!t.has(c)&&(h.setSelfFadeLogic(n+o),!0)}function ve(h,t){var n;h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0;let o=t.tileID.canonical.x-h.tileID.canonical.x;const c=t.tileID.canonical.y-h.tileID.canonical.y,f=Math.pow(2,h.tileID.canonical.z),y=t.tileID.key;o===0&&c===0||Math.abs(c)>1||(Math.abs(o)>1&&(Math.abs(o+f)===1?o+=f:Math.abs(o-f)===1&&(o-=f)),t.dem&&h.dem&&(h.dem.backfillBorder(t.dem,o,c),!((n=h.neighboringTiles)===null||n===void 0)&&n[y]&&(h.neighboringTiles[y].backfilled=!0)))}class un{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const o in this._tiles){const c=this._tiles[o];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+t),n[c.tileID.key]=c}this._tiles=n}setFeatureState(t,n){for(const o in this._tiles)this._tiles[o].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(p.au).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n?.hasData()?n:null}isIdRenderable(t,n=!1){var o;return(o=this.getTileById(t))===null||o===void 0?void 0:o.isRenderable(n)}getRenderableIds(t=0,n){const o=[];for(const c of this.getAllIds())this.isIdRenderable(c,n)&&o.push(this.getTileById(c));return n?o.sort(((c,f)=>{const y=c.tileID,x=f.tileID,w=new p.P(y.canonical.x,y.canonical.y)._rotate(-t),S=new p.P(x.canonical.x,x.canonical.y)._rotate(-t);return y.overscaledZ-x.overscaledZ||S.y-w.y||S.x-w.x})).map((c=>c.tileID.key)):o.map((c=>c.tileID)).sort(p.au).map((c=>c.key))}}class Yt extends p.E{constructor(t,n,o){super(),this.id=t,this.dispatcher=o,this.on("data",(c=>{this._dataHandler(c)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((c,f,y,x)=>{const w=new(gs(f.type))(c,f,y,x);if(w.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${w.id}`);return w})(t,n,o,this),this._inViewTiles=new un,this._outOfViewCache=new p.av(0,(c=>this._unloadTile(c))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new No,this._didEmitContent=!1,this._updated=!1}onAdd(t){var n;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,!((n=this._source)===null||n===void 0)&&n.onAdd&&this._source.onAdd(t)}onRemove(t){var n;for(const o of this._inViewTiles.getAllTiles())o.unloadVectorData();this.clearTiles(),!((n=this._source)===null||n===void 0)&&n.onRemove&&this._source.onRemove(t),this._inViewTiles=new un}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n,o){return p._(this,void 0,void 0,(function*(){try{const c=yield this._source.loadTile(t);this._tileLoaded(t,n,o,c)}catch(c){t.state="errored",c.status!==404?this._source.fire(new p.l(p.d(c),{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new p.n("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const o=this.getLoadedTile(t.scaledTo(n));if(o)return this._inViewTiles.isIdRenderable(o.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const o of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(o);n&&!this._source.shouldReloadTile(c,n)||(t?this._reloadTile(o,"expired"):c.state!=="errored"&&this._reloadTile(o,"reloading"))}}}_reloadTile(t,n){return p._(this,void 0,void 0,(function*(){const o=this._inViewTiles.getTileById(t);o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,t,n))}))}_tileLoaded(t,n,o,c){t.timeAdded=Je(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),o==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),c?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(f,y){var x,w,S;const P=y.getRenderableIds();for(const E of P){if(!(!((x=f.neighboringTiles)===null||x===void 0)&&x[E]))continue;const C=y.getTileById(E);f.neighboringTiles[E].backfilled||ve(f,C),!((S=(w=C.neighboringTiles)===null||w===void 0?void 0:w[f.tileID.key])===null||S===void 0)&&S.backfilled||ve(C,f)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new p.n("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const o=this._getLoadedDescendents(n),c=new Set;for(const f of n){const y=o[f.key];if(!y?.length){c.add(f);continue}const x=f.overscaledZ+Yt.maxOverzooming,w=y.filter((E=>E.tileID.overscaledZ<=x));if(!w.length){c.add(f);continue}const S=Math.min(...w.map((E=>
16E.tileID.overscaledZ))),P=w.filter((E=>E.tileID.overscaledZ===S)).map((E=>E.tileID));for(const E of P)t[E.key]=E;this._areDescendentsComplete(P,S,f.overscaledZ)||c.add(f)}return c}_getLoadedDescendents(t){var n;const o={};for(const c of this._inViewTiles.getAllTiles().filter((f=>f.hasData())))for(const f of t)c.tileID.isChildOf(f)&&(o[n=f.key]||(o[n]=[]),o[f.key].push(c));return o}_areDescendentsComplete(t,n,o){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-o)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,o=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?p.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),f=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._outOfViewCache.setMaxSize(f)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((w=>new p.a3(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y))):(o=cn(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(o=o.filter((w=>this._source.hasTile(w))))):o=[],this.usedForTerrain&&(o=this._addTerrainIdealTiles(o));const c=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new p.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const f=bi(t,this._source),y=this._updateRetainedTiles(o,f),x=uc(this._source.type);x&&this._rasterFadeDuration>0&&!n&&(function(w,S,P,E,C,D,B){const j=Je(),$=p.at(S);for(const N of S){const G=w.getTileById(N.key);G.fadingDirection!==Ni.Departing&&G.fadeOpacity!==0||G.resetFadeLogic(),ju(w,G,P,j,E,C,B)||xs(w,G,P,j,D,B)||hc(G,$,j,B)||G.resetFadeLogic()}})(this._inViewTiles,o,y,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),x?this._cleanUpRasterTiles(y):this._cleanUpVectorTiles(y)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const o=this._inViewTiles.getTileById(n);t[n]?o.clearSymbolFadeHold():o.hasSymbolBuckets?o.holdingForSymbolFade()?o.symbolFadeFinished()&&this._removeTile(n):o.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const o of t)if(o.canonical.z>this._source.minzoom){const c=o.scaledTo(o.canonical.z-1);n.push(c);const f=o.scaledTo(Math.max(this._source.minzoom,Math.min(o.canonical.z,5)));n.push(f)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var o;const c=new Set;for(const S of t)this._addTile(S).hasData()||c.add(S);const f=t.reduce(((S,P)=>(S[P.key]=P,S)),{}),y=this._retainLoadedChildren(f,c),x={},w=Math.max(n-Yt.maxUnderzooming,this._source.minzoom);for(const S of y){let P=this._inViewTiles.getTileById(S.key),E=P?.wasRequested();for(let C=S.overscaledZ-1;C>=w;--C){const D=S.scaledTo(C);if(x[D.key])break;if(x[D.key]=!0,P=this.getTile(D),!P&&E&&(P=this._addTile(D)),P){const B=P.hasData();if((B||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(f[D.key]=D),E=P.wasRequested(),B)break}}}return f}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const o=n;return n||(n=new Vn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),o||this._source.fire(new p.n("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const o=n.getExpiryTimeout();o&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),o))}_clearTileReloadTimer(t){const n=this._timers[t];
16n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const o=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||o.state=="errored")&&t.some((c=>c.equals(o.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,o){const c=[],f=this.transform;if(!f)return c;const y=f.getCoveringTilesDetailsProvider().allowWorldCopies(),x=o?f.getCameraQueryGeometry(t):t,w=D=>f.screenPointToMercatorCoordinate(D,this.terrain),S=this.transformBbox(t,w,!y),P=this.transformBbox(x,w,!y),E=this.getIds(),C=p.a8.fromPoints(P);for(const D of E){const B=this._inViewTiles.getTileById(D);if(B.holdingForSymbolFade())continue;const j=y?[B.tileID]:[B.tileID.unwrapTo(-1),B.tileID.unwrapTo(0)],$=Math.pow(2,f.zoom-B.tileID.overscaledZ),N=n*B.queryPadding*p.a6/B.tileSize/$;for(const G of j){const X=C.map((Z=>G.getTilePoint(new p.a7(Z.x,Z.y))));if(X.expandBy(N),X.intersects(cc)){const Z=S.map((H=>G.getTilePoint(H))),U=P.map((H=>G.getTilePoint(H)));c.push({tile:B,tileID:y?G:G.unwrapTo(0),queryGeometry:Z,cameraQueryGeometry:U,scale:$})}}}return c}transformBbox(t,n,o){let c=t.map(n);if(o){const f=p.a8.fromPoints(t);f.shrinkBy(.001*Math.min(f.width(),f.height()));const y=f.map(n);p.a8.fromPoints(c).covers(y)||(c=c.map((x=>x.x>.5?new p.a7(x.x-1,x.y,x.z):x)))}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((o=>this._inViewTiles.getTileById(o).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||uc(this._source.type)&&(function(t,n){if(n<=0)return!1;const o=Je();for(const c of t.getAllTiles())if(c.fadeEndTime>=o)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,o){t||(t=p.ag),this._state.updateState(t,n,o)}removeFeatureState(t,n,o){t||(t=p.ag),this._state.removeFeatureState(t,n,o)}getFeatureState(t,n){return t||(t=p.ag),this._state.getState(t,n)}setDependencies(t,n,o){const c=this._inViewTiles.getTileById(t);c&&c.setDependencies(n,o)}reloadTilesForDependencies(t,n){for(const o of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(o).hasDependency(t,n)&&this._reloadTile(o,"reloading");this._outOfViewCache.filter((o=>!o.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Yt.maxUnderzooming=10,Yt.maxOverzooming=3;class Zo{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=p.al(t,0,1);let n=1,o=this._distances[n];const c=t*this.paddedLength+this.padding;for(;o<c&&n<this._distances.length;)o=this._distances[++n];const f=n-1,y=this._distances[f],x=o-y,w=x>0?(c-y)/x:0;return this.points[f].mult(1-w).add(this.points[n].mult(w))}}function Fr(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class Te{constructor(t,n,o){const c=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(n/o);for(let y=0;y<this.xCellCount*this.yCellCount;y++)c.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}
vendor: 24,781 bytes, line 16
16insert(t,n,o,c,f){this._forEachCell(n,o,c,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(f)}insertCircle(t,n,o,c){this._forEachCell(n-c,o-c,n+c,o+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(o),this.circles.push(c)}_insertBoxCell(t,n,o,c,f,y){this.boxCells[f].push(y)}_insertCircleCell(t,n,o,c,f,y){this.circleCells[f].push(y)}_query(t,n,o,c,f,y,x){if(o<0||t>this.width||c<0||n>this.height)return[];const w=[];if(t<=0&&n<=0&&this.width<=o&&this.height<=c){if(f)return[{key:null,x1:t,y1:n,x2:o,y2:c}];for(let S=0;S<this.boxKeys.length;S++)w.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const P=this.circles[3*S],E=this.circles[3*S+1],C=this.circles[3*S+2];w.push({key:this.circleKeys[S],x1:P-C,y1:E-C,x2:P+C,y2:E+C})}}else this._forEachCell(t,n,o,c,this._queryCell,w,{hitTest:f,overlapMode:y,seenUids:{box:{},circle:{}}},x);return w}query(t,n,o,c){return this._query(t,n,o,c,!1,null)}hitTest(t,n,o,c,f,y){return this._query(t,n,o,c,!0,f,y).length>0}hitTestCircle(t,n,o,c,f){const y=t-o,x=t+o,w=n-o,S=n+o;if(x<0||y>this.width||S<0||w>this.height)return!1;const P=[];return this._forEachCell(y,w,x,S,this._queryCellCircle,P,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},f),P.length>0}_queryCell(t,n,o,c,f,y,x,w){const{seenUids:S,hitTest:P,overlapMode:E}=x,C=this.boxCells[f],D=1e-6;if(C!==null){const j=this.bboxes;for(const $ of C)if(!S.box[$]){S.box[$]=!0;const N=4*$,G=this.boxKeys[$];if(t<=j[N+2]+D&&n<=j[N+3]+D&&o>=j[N+0]-D&&c>=j[N+1]-D&&(!w||w(G))&&(!P||!Fr(E,G.overlapMode))&&(y.push({key:G,x1:j[N],y1:j[N+1],x2:j[N+2],y2:j[N+3]}),P))return!0}}const B=this.circleCells[f];if(B!==null){const j=this.circles;for(const $ of B)if(!S.circle[$]){S.circle[$]=!0;const N=3*$,G=this.circleKeys[$];if(this._circleAndRectCollide(j[N],j[N+1],j[N+2],t,n,o,c)&&(!w||w(G))&&(!P||!Fr(E,G.overlapMode))){const X=j[N],Z=j[N+1],U=j[N+2];if(y.push({key:G,x1:X-U,y1:Z-U,x2:X+U,y2:Z+U}),P)return!0}}}return!1}_queryCellCircle(t,n,o,c,f,y,x,w){const{circle:S,seenUids:P,overlapMode:E}=x,C=this.boxCells[f];if(C!==null){const B=this.bboxes;for(const j of C)if(!P.box[j]){P.box[j]=!0;const $=4*j,N=this.boxKeys[j];if(this._circleAndRectCollide(S.x,S.y,S.radius,B[$+0],B[$+1],B[$+2],B[$+3])&&(!w||w(N))&&!Fr(E,N.overlapMode))return y.push(!0),!0}}const D=this.circleCells[f];if(D!==null){const B=this.circles;for(const j of D)if(!P.circle[j]){P.circle[j]=!0;const $=3*j,N=this.circleKeys[j];if(this._circlesCollide(B[$],B[$+1],B[$+2],S.x,S.y,S.radius)&&(!w||w(N))&&!Fr(E,N.overlapMode))return y.push(!0),!0}}}_forEachCell(t,n,o,c,f,y,x,w){const S=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),C=this._convertToYCellCoord(c);for(let D=S;D<=E;D++)for(let B=P;B<=C;B++)if(f.call(this,t,n,o,c,this.xCellCount*B+D,y,x,w))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,o,c,f,y){const x=c-t,w=f-n,S=o+y;return S*S>x*x+w*w}_circleAndRectCollide(t,n,o,c,f,y,x){const w=(y-c)/2,S=Math.abs(t-(c+w));if(S>w+o)return!1;const P=(x-f)/2,E=Math.abs(n-(f+P));if(E>P+o)return!1;if(S<=w||E<=P)return!0;const C=S-w,D=E-P;return C*C+D*D<=o*o}}function je(h,t){const n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),o=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),c=t[0]*n,f=t[4]*n,y=t[8]*o,x=t[1]*n,w=t[5]*n,S=t[9]*o,P=t[2]*n,E=t[6]*n,C=t[10]*o;h[0]=c,h[1]=f,h[2]=y,h[4]=x,h[5]=w,h[6]=S,h[8]=P,h[9]=E,h[10]=C;const D=t[12],B=t[13],j=t[14];return h[12]=-c*D-x*B-P*j,h[13]=-f*D-w*B-E*j,h[14]=-y*D-S*B-C*j,h[3]=0,h[7]=0,h[11]=0,h[15]=1,h}const Ge=p.O();function Ai(h,t,n){const o=p.O();if(!h){const{vecSouth:E,vecEast:C}=pr(t),D=Cr();D[0]=C[0],D[1]=C[1],D[2]=E[0],D[3]=E[1],c=D,(P=(y=(f=D)[0])*(S=f[3])-(w=f[2])*(x=f[1]))&&(c[0]=S*(P=1/P),c[1]=-x*P,c[2]=-w*P,c[3]=y*P),o[0]=D[0],o[1]=D[1],o[4]=D[2],o[5]=D[3]}var c,f,y,x,w,S,P;return p.S(o,o,[1/n,1/n,1]),o}function bs(h,t,n,o){if(h){const c=p.O();if(!t){const{vecSouth:f,vecEast:y}=pr(n);c[0]=y[0],c[1]=y[1],c[4]=f[0],c[5]=f[1]}return p.S(c,c,[o,o,1]),c}return n.pixelsToClipSpaceMatrix}function pr(h){const t=Math.cos(h.rollInRadians),n=Math.sin(h.rollInRadians),o=Math.cos(h.pitchInRadians),c=Math.cos(h.bearingInRadians),f=Math.sin(h.bearingInRadians),y=p.az();y[0]=-c*o*n-f*t,y[1]=-f*o*n+c*t;const x=p.aA(y);x<1e-9?p.aB(y):p.aC(y,y,1/x);const w=p.az();w[0]=c*o*t-f*n,w[1]=f*o*t+c*n;const S=p.aA(w);return S<1e-9?p.aB(w):p.aC(w,w,1/S),{vecEast:w,vecSouth:y}}function Ne(h,t,n,o){let c;o?(c=[h,t,o(h,t),1],p.aE(c,c,n)):(c=[h,t,0,1],Ss(c,c,n));const f=c[3];return{point:new p.P(c[0]/f,c[1]/f),signedDistanceFromCamera:f,isOccluded:!1}}function Ma(h,t){return .5+h/t*.5}function Ea(h,t){return h.x>=-t[0]&&h.x<=t[0]&&h.y>=-t[1]&&h.y<=t[1]}function ws(h,t,n,o,c,f,y,x,w,S,P,E,C){const D=n?h.textSizeData:h.iconSizeData,B=p.aw(D,t.transform.zoom),j=[256/t.width*2+1,256/t.height*2+1],$=n?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;$.clear();const N=h.lineVertexArray,G=n?h.text.placedSymbolArray:h.icon.placedSymbolArray,X=t.transform.width/t.transform.height;let Z=!1;for(let U=0;U<G.length;U++){const H=G.get(U);if(H.hidden||H.writingMode===p.ax.vertical&&!Z){dn(H.numGlyphs,$);continue}Z=!1;const q=new p.P(H.anchorX,H.anchorY),Q={getElevation:C,pitchedLabelPlaneMatrix:o,lineVertexArray:N,pitchWithMap:f,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:q,unwrappedTileID:w,width:S,height:P,translation:E},ae=Zn(H.anchorX,H.anchorY,Q);if(!Ea(ae.point,j)){dn(H.numGlyphs,$);continue}const oe=Ma(t.transform.cameraToCenterDistance,ae.signedDistanceFromCamera),fe=p.ay(D,B,H),de=f?fe*t.transform.getPitchedTextCorrection(H.anchorX,H.anchorY,w)/oe:fe*oe,Me=Gn({projectionContext:Q,pitchedLabelPlaneMatrixInverse:c,symbol:H,fontSize:de,flip:!1,keepUpright:y,glyphOffsetArray:h.glyphOffsetArray,dynamicLayoutVertexArray:$,aspectRatio:X,rotateToLine:x});Z=Me.useVertical,(Me.notEnoughRoom||Z||Me.needsFlipping&&Gn({projectionContext:Q,pitchedLabelPlaneMatrixInverse:c,symbol:H,fontSize:de,flip:!0,keepUpright:y,glyphOffsetArray:h.glyphOffsetArray,dynamicLayoutVertexArray:$,aspectRatio:X,rotateToLine:x}).notEnoughRoom)&&dn(H.numGlyphs,$)}n?h.text.dynamicLayoutVertexBuffer.updateData($):h.icon.dynamicLayoutVertexBuffer.updateData($)}function $n(h,t,n,o,c,f,y,x){const w=f.glyphStartIndex+f.numGlyphs,S=f.lineStartIndex,P=f.lineStartIndex+f.lineLength,E=t.getoffsetX(f.glyphStartIndex),C=t.getoffsetX(w-1),D=Ji(h*E,n,o,c,f.segment,S,P,x,y);if(!D)return null;const B=Ji(h*C,n,o,c,f.segment,S,P,x,y);return B?x.projectionCache.anyProjectionOccluded?null:{first:D,last:B}:null}function Ca(h,t,n,o){return h===p.ax.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*o?{useVertical:!0}:(h===p.ax.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function Gn(h){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:o,fontSize:c,flip:f,keepUpright:y,glyphOffsetArray:x,dynamicLayoutVertexArray:w,aspectRatio:S,rotateToLine:P}=h,E=c/24,C=o.lineOffsetX*E,D=o.lineOffsetY*E;let B;if(o.numGlyphs>1){const j=o.glyphStartIndex+o.numGlyphs,$=o.lineStartIndex,N=o.lineStartIndex+o.lineLength,G=$n(E,x,C,D,f,o,P,t);if(!G)return{notEnoughRoom:!0};const X=Ts(G.first.point.x,G.first.point.y,t,n),Z=Ts(G.last.point.x,G.last.point.y,t,n);if(y&&!f){const U=Ca(o.writingMode,X,Z,S);if(U)return U}B=[G.first];for(let U=o.glyphStartIndex+1;U<j-1;U++){const H=Ji(E*x.getoffsetX(U),C,D,f,o.segment,$,N,t,P);if(!H)return{notEnoughRoom:!0};B.push(H)}B.push(G.last)}else{if(y&&!f){const $=at(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,N=o.lineStartIndex+o.segment+1,G=new p.P(t.lineVertexArray.getx(N),t.lineVertexArray.gety(N)),X=at(G.x,G.y,t),Z=X.signedDistanceFromCamera>0?X.point:Aa(t.tileAnchorPoint,G,$,1,t),U=Ts($.x,$.y,t,n),H=Ts(Z.x,Z.y,t,n),q=Ca(o.writingMode,U,H,S);if(q)return q}const j=Ji(E*x.getoffsetX(o.glyphStartIndex),C,D,f,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,t,P);if(!j||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};B=[j]}for(const j of B)p.aD(w,j.point,j.angle);return{}}function Aa(h,t,n,o,c){const f=h.add(h.sub(t)._unit()),y=at(f.x,f.y,c).point,x=n.sub(y);return n.add(x._mult(o/x.mag()))}function Kt(h,t,n){const o=t.projectionCache;if(o.projections[h])return o.projections[h];const c=new p.P(t.lineVertexArray.getx(h),t.lineVertexArray.gety(h)),f=at(c.x,c.y,t);if(f.signedDistanceFromCamera>0)return o.projections[h]=f.point,o.anyProjectionOccluded||(o.anyProjectionOccluded=f.isOccluded),f.point;const y=h-n.direction;return Aa(n.distanceFromAnchor===0?t.tileAnchorPoint:new p.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),c,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function at(h,t,n){const o=h+n.translation[0],c=t+n.translation[1];let f;return n.pitchWithMap?(f=Ne(o,c,n.pitchedLabelPlaneMatrix,n.getElevation),f.isOccluded=!1):(f=n.transform.projectTileCoordinates(o,c,n.unwrappedTileID,n.getElevation),f.point.x=(.5*f.point.x+.5)*n.width,f.point.y=(.5*-f.point.y+.5)*n.height),f}function Ts(h,t,n,o){if(n.pitchWithMap){const c=[h,t,0,1];return p.aE(c,c,o),n.transform.projectTileCoordinates(c[0]/c[3],c[1]/c[3],n.unwrappedTileID,n.getElevation).point}return{x:h/n.width*2-1,y:1-t/n.height*2}}function Zn(h,t,n){return n.transform.projectTileCoordinates(h,t,n.unwrappedTileID,n.getElevation)}function za(h,t,n){return h._unit()._perp()._mult(t*n)}function hn(h,t,n,o,c,f,y,x,w){if(x.projectionCache.offsets[h])return x.projectionCache.offsets[h];const S=n.add(t);if(h+w.direction<o||h+w.direction>=c)return x.projectionCache.offsets[h]=S,S;const P=Kt(h+w.direction,x,w),E=za(P.sub(n),y,w.direction),C=n.add(E),D=P.add(E);return x.projectionCache.offsets[h]=p.aF(f,S,C,D)||S,x.projectionCache.offsets[h]}function Ji(h,t,n,o,c,f,y,x,w){const S=o?h-t:h+t;let P=S>0?1:-1,E=0;o&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let C,D=P>0?f+c:f+c+1;x.projectionCache.cachedAnchorPoint?C=x.projectionCache.cachedAnchorPoint:(C=at(x.tileAnchorPoint.x,x.tileAnchorPoint.y,x).point,x.projectionCache.cachedAnchorPoint=C);let B,j,$=C,N=C,G=0,X=0;const Z=Math.abs(S),U=[];let H;for(;G+X<=Z;){if(D+=P,D<f||D>=y)return null;G+=X,N=$,j=B;const ae={absOffsetX:Z,direction:P,distanceFromAnchor:G,previousVertex:N};if($=Kt(D,x,ae),n===0)U.push(N),H=$.sub(N);else{let oe;const fe=$.sub(N);oe=fe.mag()===0?za(Kt(D+P,x,ae).sub($),n,P):za(fe,n,P),j||(j=N.add(oe)),B=hn(D,oe,$,f,y,j,n,x,ae),U.push(j),H=B.sub(j)}X=H.mag()}const q=H._mult((Z-G)/X)._add(j||N),Q=E+Math.atan2($.y-N.y,$.x-N.x);return U.push(q),{point:q,angle:w?Q:0,path:U}}const dc=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function dn(h,t){for(let n=0;n<h;n++){const o=t.length;t.resize(o+4),t.float32.set(dc,3*o)}}function Ss(h,t,n){const o=t[0],c=t[1];return h[0]=n[0]*o+n[4]*c+n[12],h[1]=n[1]*o+n[5]*c+n[13],h[3]=n[3]*o+n[7]*c+n[15],h}const Tt=100;class pc{constructor(t,n=new Te(t.width+200,t.height+200,25),o=new Te(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=o,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Tt,this.screenBottomBoundary=t.height+Tt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,c,f,y,x,w,S,P,E,C){const D=this.projectAndGetPerspectiveRatio(t.anchorPointX+w[0],t.anchorPointY+w[1],f,P,C),B=o*D.perspectiveRatio;let j;if(y||x)j=this._projectCollisionBox(t,B,c,f,y,x,w,D,P,E,C);else{const H=D.x+(E?E.x*B:0),q=D.y+(E?E.y*B:0);j={allPointsOccluded:!1,box:[H+t.x1*B,q+t.y1*B,H+t.x2*B,q+t.y2*B]}}const[$,N,G,X]=j.box,Z=y?j.allPointsOccluded:D.isOccluded;let U=Z;return U||(U=D.perspectiveRatio<this.perspectiveRatioCutoff),U||(U=!this.isInsideGrid($,N,G,X)),U||n!=="always"&&this.grid.hitTest($,N,G,X,n,S)?{box:[$,N,G,X],placeable:!1,offscreen:!1,occluded:Z}:{box:[$,N,G,X],placeable:!0,offscreen:this.isOffscreen($,N,G,X),occluded:Z}}placeCollisionCircles(t,n,o,c,f,y,x,w,S,P,E,C,D,B){const j=[],$=new p.P(n.anchorX,n.anchorY),N=this.getPerspectiveRatio($.x,$.y,y,B),G=(S?f*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,y)/N:f*N)/p.aJ,X={getElevation:B,pitchedLabelPlaneMatrix:x,lineVertexArray:o,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:$,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:D},Z=$n(G,c,n.lineOffsetX*G,n.lineOffsetY*G,!1,n,!1,X);let U=!1,H=!1,q=!0;if(Z){const Q=.5*E*N+C,ae=new p.P(-100,-100),oe=new p.P(this.screenRightBoundary,this.screenBottomBoundary),fe=new Zo,de=Z.first,Me=Z.last;let be=[];for(let Ae=de.path.length-1;Ae>=1;Ae--)be.push(de.path[Ae]);for(let Ae=1;Ae<Me.path.length;Ae++)be.push(Me.path[Ae]);const he=2.5*Q;if(S){const Ae=this.projectPathToScreenSpace(be,X);be=Ae.some((rt=>rt.signedDistanceFromCamera<=0))?[]:Ae.map((rt=>rt.point))}let Se=[];if(be.length>0){const Ae=be[0].clone(),rt=be[0].clone();for(let Ct=1;Ct<be.length;Ct++)Ae.x=Math.min(Ae.x,be[Ct].x),Ae.y=Math.min(Ae.y,be[Ct].y),rt.x=Math.max(rt.x,be[Ct].x),rt.y=Math.max(rt.y,be[Ct].y);Se=Ae.x>=ae.x&&rt.x<=oe.x&&Ae.y>=ae.y&&rt.y<=oe.y?[be]:rt.x<ae.x||Ae.x>oe.x||rt.y<ae.y||Ae.y>oe.y?[]:p.aG([be],ae.x,ae.y,oe.x,oe.y)}for(const Ae of Se){fe.reset(Ae,.25*Q);let rt=0;rt=fe.length<=.5*Q?1:Math.ceil(fe.paddedLength/he)+1;for(let Ct=0;Ct<rt;Ct++){const ot=Ct/Math.max(rt-1,1),zt=fe.lerp(ot),kt=zt.x+Tt,ii=zt.y+Tt;j.push(kt,ii,Q,0);const St=kt-Q,pi=ii-Q,Jt=kt+Q,Nt=ii+Q;if(q&&(q=this.isOffscreen(St,pi,Jt,Nt)),H||(H=this.isInsideGrid(St,pi,Jt,Nt)),t!=="always"&&this.grid.hitTestCircle(kt,ii,Q,t,P)&&(U=!0,!w))return{circles:[],offscreen:!1,collisionDetected:U}}}}return{circles:!w&&U||!H||N<this.perspectiveRatioCutoff?[]:j,offscreen:q,collisionDetected:U}}projectPathToScreenSpace(t,n){const o=(function(c,f){const y=Ge;return(function(x,w){const S=1/(w[0]*w[5]-w[1]*w[4]);x[0]=w[5]*S,x[1]=-w[1]*S,x[2]=0,x[3]=0,x[4]=-w[4]*S,x[5]=w[0]*S,x[6]=0,x[7]=0,x[8]=0,x[9]=0,x[10]=1/w[10],x[11]=0,x[12]=0,x[13]=0,x[14]=0,x[15]=1/w[15]})(y,f.pitchedLabelPlaneMatrix),c.map((x=>{const w=Ne(x.x,x.y,y,f.getElevation),S=f.transform.projectTileCoordinates(w.point.x,w.point.y,f.unwrappedTileID,f.getElevation);return S.point.x=(.5*S.point.x+.5)*f.width,S.point.y=(.5*-S.point.y+.5)*f.height,S}))})(t,n);return(function(c){let f=0,y=0,x=0,w=0;for(let S=0;S<c.length;S++)c[S].isOccluded?(x=S+1,w=0):(w++,w>y&&(y=w,f=x));return c.slice(f,f+y)})(o)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],o=new p.a8;for(const E of t){const C=new p.P(E.x+Tt,E.y+Tt);o.extend(C),n.push(C)}const{minX:c,minY:f,maxX:y,maxY:x}=o,w=this.grid.query(c,f,y,x).concat(this.ignoredGrid.query(c,f,y,x)),S={},P={};for(const E of w){const C=E.key;if(S[C.bucketInstanceId]===void 0&&(S[C.bucketInstanceId]={}),S[C.bucketInstanceId][C.featureIndex])continue;const D=[new p.P(E.x1,E.y1),new p.P(E.x2,E.y1),new p.P(E.x2,E.y2),new p.P(E.x1,E.y2)];p.aH(n,D)&&(S[C.bucketInstanceId][C.featureIndex]=!0,P[C.bucketInstanceId]===void 0&&(P[C.bucketInstanceId]=[]),P[C.bucketInstanceId].push(C.featureIndex))}return P}insertCollisionBox(t,n,o,c,f,y){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,o,c,f,y){const x=o?this.ignoredGrid:this.grid,w={bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n};for(let S=0;S<t.length;S+=4)x.insertCircle(w,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,o,c,f){if(f){let y;c?(y=[t,n,c(t,n),1],p.aE(y,y,f)):(y=[t,n,0,1],Ss(y,y,f));const x=y[3];return{x:(y[0]/x+1)/2*this.transform.width+Tt,y:(-y[1]/x+1)/2*this.transform.height+Tt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/x*.5,isOccluded:!1,signedDistanceFromCamera:x}}{const y=this.transform.projectTileCoordinates(t,n,o,c);return{x:(y.point.x+1)/2*this.transform.width+Tt,y:(1-y.point.y)/2*this.transform.height+Tt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y.signedDistanceFromCamera*.5,isOccluded:y.isOccluded,signedDistanceFromCamera:y.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,o,c){const f=this.transform.projectTileCoordinates(t,n,o,c);return .5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5}isOffscreen(t,n,o,c){return o<Tt||t>=this.screenRightBoundary||c<Tt||n>this.screenBottomBoundary}isInsideGrid(t,n,o,c){return o>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=p.ap([]);return p.Q(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,o,c,f,y,x,w,S,P,E){let C=1,D=0,B=0,j=1;const $=t.anchorPointX+x[0],N=t.anchorPointY+x[1];if(y&&!f){const be=this.projectAndGetPerspectiveRatio($+1,N,c,S,E),he=be.x-w.x,Se=Math.atan((be.y-w.y)/he)+(he<0?Math.PI:0),Ae=Math.sin(Se),rt=Math.cos(Se);C=rt,D=Ae,B=-Ae,j=rt}else if(!y&&f){const be=pr(this.transform);C=be.vecEast[0],D=be.vecEast[1],B=be.vecSouth[0],j=be.vecSouth[1]}let G=w.x,X=w.y,Z=n;f&&(G=$,X=N,Z=Math.pow(2,-(this.transform.zoom-o.overscaledZ)),Z*=this.transform.getPitchedTextCorrection($,N,c),P||(Z*=p.al(.5+w.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(G+=C*P.x*Z+B*P.y*Z,X+=D*P.x*Z+j*P.y*Z);const U=t.x1*Z,H=t.x2*Z,q=(U+H)/2,Q=t.y1*Z,ae=t.y2*Z,oe=(Q+ae)/2,fe=[{offsetX:U,offsetY:Q},{offsetX:q,offsetY:Q},{offsetX:H,offsetY:Q},{offsetX:H,offsetY:oe},{offsetX:H,offsetY:ae},{offsetX:q,offsetY:ae},{offsetX:U,offsetY:ae},{offsetX:U,offsetY:oe}];let de=[];for(const{offsetX:be,offsetY:he}of fe)de.push(new p.P(G+C*be+B*he,X+D*be+j*he));let Me=!1;if(f){const be=de.map((he=>this.projectAndGetPerspectiveRatio(he.x,he.y,c,S,E)));Me=be.some((he=>!he.isOccluded)),de=be.map((he=>new p.P(he.x,he.y)))}else Me=!0;return{box:p.aI(de),allPointsOccluded:!Me}}}class fc{constructor(t,n,o,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Da{constructor(t,n,o,c,f){this.text=new fc(t?t.text:null,n,o,f),this.icon=new fc(t?t.icon:null,n,c,f)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class mc{constructor(t,n,o){this.text=t,this.icon=n,this.skipFade=o}}class _c{constructor(t,n,o,c,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=c,this.tileID=f}}class gc{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:o=>o.collisionGroupID===n}}return this.collisionGroups[t]}}function Ps(h,t,n,o,c){const{horizontalAlign:f,verticalAlign:y}=p.aP(h);return new p.P(-(f-.5)*t+o[0]*c,-(y-.5)*n+o[1]*c)}class qo{constructor(t,n,o,c,f){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new pc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new gc(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(o,c)=>n.getElevation(t,o,c):null}getBucketParts(t,n,o,c){const f=o.getBucket(n),y=o.latestFeatureIndex;if(!f||!y||n.id!==f.layerIds[0])return;const x=o.collisionBoxArray,w=f.layers[0].layout,S=f.layers[0].paint,P=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/p.a6,C=o.tileID.toUnwrapped(),D=w.get("text-rotation-alignment")==="map",B=p.aK(o,1,this.transform.zoom),j=p.aL(this.collisionIndex.transform,o,S.get("text-translate"),S.get("text-translate-anchor")),$=p.aL(this.collisionIndex.transform,o,S.get("icon-translate"),S.get("icon-translate-anchor")),N=Ai(D,this.transform,B);this.retainedQueryData[f.bucketInstanceId]=new _c(f.bucketInstanceId,y,f.sourceLayerIndex,f.index,o.tileID);const G={bucket:f,layout:w,translationText:j,translationIcon:$,unwrappedTileID:C,pitchedLabelPlaneMatrix:N,scale:P,textPixelRatio:E,holdingForFade:o.holdingForSymbolFade(),collisionBoxArray:x,partiallyEvaluatedTextSize:p.aw(f.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(c)for(const X of f.sortKeyRanges){const{sortKey:Z,symbolInstanceStart:U,symbolInstanceEnd:H}=X;t.push({sortKey:Z,symbolInstanceStart:U,symbolInstanceEnd:H,parameters:G})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:G})}attemptAnchorPlacement(t,n,o,c,f,y,x,w,S,P,E,C,D,B,j,$,N,G,X,Z){var U,H,q;const Q=p.aM[t.textAnchor],ae=[t.textOffset0,t.textOffset1],oe=Ps(Q,o,c,ae,f),fe=this.collisionIndex.placeCollisionBox(n,C,w,S,P,x,y,$,E.predicate,X,oe,Z);if((!G||this.collisionIndex.placeCollisionBox(G,C,w,S,P,x,y,N,E.predicate,X,oe,Z).placeable)&&fe.placeable){let de;if(!((U=this.prevPlacement)===null||U===void 0)&&U.variableOffsets[D.crossTileID]&&(!((q=(H=this.prevPlacement)===null||H===void 0?void 0:H.placements[D.crossTileID])===null||q===void 0)&&q.text)&&(de=this.prevPlacement.variableOffsets[D.crossTileID].anchor),D.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[D.crossTileID]={textOffset:ae,width:o,height:c,anchor:Q,textBoxScale:f,prevAnchor:de},this.markUsedJustification(B,Q,D,j),B.allowVerticalPlacement&&(this.markUsedOrientation(B,j,D),this.placedOrientations[D.crossTileID]=j),{shift:oe,placedGlyphBoxes:fe}}}placeLayerBucketPart(t,n,o){const{bucket:c,layout:f,translationText:y,translationIcon:x,unwrappedTileID:w,pitchedLabelPlaneMatrix:S,textPixelRatio:P,holdingForFade:E,collisionBoxArray:C,partiallyEvaluatedTextSize:D,collisionGroup:B}=t.parameters,j=f.get("text-optional"),$=f.get("icon-optional"),N=p.aN(f,"text-overlap","text-allow-overlap"),G=N==="always",X=p.aN(f,"icon-overlap","icon-allow-overlap"),Z=X==="always",U=f.get("text-rotation-alignment")==="map",H=f.get("text-pitch-alignment")==="map",q=f.get("icon-text-fit")!=="none",Q=f.get("symbol-z-order")==="viewport-y",ae=G&&(Z||!c.hasIconData()||$),oe=Z&&(G||!c.hasTextData()||j);!c.collisionArrays&&C&&c.deserializeCollisionBoxes(C);const fe=this.retainedQueryData[c.bucketInstanceId].tileID,de=this._getTerrainElevationFunc(fe),Me=this.transform.getFastPathSimpleProjectionMatrix(fe),be=(he,Se,Ae)=>{var rt,Ct;if(n[he.crossTileID])return;if(E)return void(this.placements[he.crossTileID]=new mc(!1,!1,!1));let ot=!1,zt=!1,kt=!0,ii=null,St={box:null,placeable:!1,offscreen:null,occluded:!1},pi={placeable:!1},Jt=null,Nt=null,ri=null,$r=0,Gr=0,Zr=0;Se.textFeatureIndex?$r=Se.textFeatureIndex:he.useRuntimeCollisionCircles&&($r=he.featureIndex),Se.verticalTextFeatureIndex&&(Gr=Se.verticalTextFeatureIndex);const ni=Se.textBox;if(ni){const cr=yt=>{let pt=p.ax.horizontal;if(c.allowVerticalPlacement&&!yt&&this.prevPlacement){const Rt=this.prevPlacement.placedOrientations[he.crossTileID];Rt&&(this.placedOrientations[he.crossTileID]=Rt,pt=Rt,this.markUsedOrientation(c,pt,he))}return pt},ur=(yt,pt)=>{if(c.allowVerticalPlacement&&he.numVerticalGlyphVertices>0&&Se.verticalTextBox){for(const Rt of c.writingModes)if(Rt===p.ax.vertical?(St=pt(),pi=St):St=yt(),St?.placeable)break}else St=yt()},Li=he.textAnchorOffsetStartIndex,Zi=he.textAnchorOffsetEndIndex;if(Zi===Li){const yt=(pt,Rt)=>{const vt=this.collisionIndex.placeCollisionBox(pt,N,P,fe,w,H,U,y,B.predicate,de,void 0,Me);return vt?.placeable&&(this.markUsedOrientation(c,Rt,he),this.placedOrientations[he.crossTileID]=Rt),vt};ur((()=>yt(ni,p.ax.horizontal)),(()=>{const pt=Se.verticalTextBox;return c.allowVerticalPlacement&&he.numVerticalGlyphVertices>0&&pt?yt(pt,p.ax.vertical):{box:null,offscreen:null}})),cr(St?.placeable)}else{let yt=p.aM[(Ct=(rt=this.prevPlacement)===null||rt===void 0?void 0:rt.variableOffsets[he.crossTileID])===null||Ct===void 0?void 0:Ct.anchor];const pt=(vt,An,co)=>{const br=vt.x2-vt.x1,Vl=vt.y2-vt.y1,du=he.textBoxScale,Nl=q&&X==="never"?An:null;let Wr=null,Hr=N==="never"?1:2,Xr="never";yt&&Hr++;for(let Ul=0;Ul<Hr;Ul++){for(let $l=Li;$l<Zi;$l++){const uo=c.textAnchorOffsets.get($l);if(yt&&uo.textAnchor!==yt)continue;const ho=this.attemptAnchorPlacement(uo,vt,br,Vl,du,U,H,P,fe,w,B,Xr,he,c,co,y,x,Nl,de);if(ho&&(Wr=ho.placedGlyphBoxes,Wr?.placeable))return ot=!0,ii=ho.shift,Wr}yt?yt=null:Xr=N}return o&&!Wr&&(Wr={box:this.collisionIndex.placeCollisionBox(ni,"always",P,fe,
16w,H,U,y,B.predicate,de,void 0,Me).box,offscreen:!1,placeable:!1,occluded:!1}),Wr};ur((()=>pt(ni,Se.iconBox,p.ax.horizontal)),(()=>{const vt=Se.verticalTextBox;return c.allowVerticalPlacement&&!St?.placeable&&he.numVerticalGlyphVertices>0&&vt?pt(vt,Se.verticalIconBox,p.ax.vertical):{box:null,occluded:!0,offscreen:null}})),St&&(ot=St.placeable,kt=St.offscreen);const Rt=cr(St?.placeable);if(!ot&&this.prevPlacement){const vt=this.prevPlacement.variableOffsets[he.crossTileID];vt&&(this.variableOffsets[he.crossTileID]=vt,this.markUsedJustification(c,vt.anchor,he,Rt))}}}if(Jt=St,ot=Jt?.placeable,kt=Jt?.offscreen,he.useRuntimeCollisionCircles&&he.centerJustifiedTextSymbolIndex>=0){const cr=c.text.placedSymbolArray.get(he.centerJustifiedTextSymbolIndex),ur=p.ay(c.textSizeData,D,cr),Li=f.get("text-padding");Nt=this.collisionIndex.placeCollisionCircles(N,cr,c.lineVertexArray,c.glyphOffsetArray,ur,w,S,o,H,B.predicate,he.collisionCircleDiameter,Li,y,de),Nt.circles.length&&Nt.collisionDetected&&!o&&p.w("Collisions detected, but collision boxes are not shown"),ot=G||Nt.circles.length>0&&!Nt.collisionDetected,kt&&(kt=Nt.offscreen)}if(Se.iconFeatureIndex&&(Zr=Se.iconFeatureIndex),Se.iconBox){const cr=ur=>this.collisionIndex.placeCollisionBox(ur,X,P,fe,w,H,U,x,B.predicate,de,q&&ii?ii:void 0,Me);pi&&pi.placeable&&Se.verticalIconBox?(ri=cr(Se.verticalIconBox),zt=ri.placeable):(ri=cr(Se.iconBox),zt=ri.placeable),kt&&(kt=ri.offscreen)}const xr=j||he.numHorizontalGlyphVertices===0&&he.numVerticalGlyphVertices===0,qr=$||he.numIconVertices===0;xr||qr?qr?xr||zt&&(zt=ot):ot=zt&&ot:zt=ot=zt&&ot;const lo=zt&&ri.placeable;if(ot&&Jt.placeable&&this.collisionIndex.insertCollisionBox(Jt.box,N,f.get("text-ignore-placement"),c.bucketInstanceId,pi&&pi.placeable&&Gr?Gr:$r,B.ID),lo&&this.collisionIndex.insertCollisionBox(ri.box,X,f.get("icon-ignore-placement"),c.bucketInstanceId,Zr,B.ID),Nt&&ot&&this.collisionIndex.insertCollisionCircles(Nt.circles,N,f.get("text-ignore-placement"),c.bucketInstanceId,$r,B.ID),o&&this.storeCollisionData(c.bucketInstanceId,Ae,Se,Jt,ri,Nt),he.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[he.crossTileID]=new mc((ot||ae)&&!Jt?.occluded,(zt||oe)&&!ri?.occluded,kt||c.justReloaded),n[he.crossTileID]=!0};if(Q){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const he=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Se=he.length-1;Se>=0;--Se){const Ae=he[Se];be(c.symbolInstances.get(Ae),c.collisionArrays[Ae],Ae)}}else for(let he=t.symbolInstanceStart;he<t.symbolInstanceEnd;he++)be(c.symbolInstances.get(he),c.collisionArrays[he],he);c.justReloaded=!1}storeCollisionData(t,n,o,c,f,y){if(o.textBox||o.iconBox){let x,w;this.collisionBoxArrays.has(t)?x=this.collisionBoxArrays.get(t):(x=new Map,this.collisionBoxArrays.set(t,x)),x.has(n)?w=x.get(n):(w={text:null,icon:null},x.set(n,w)),o.textBox&&(w.text=c.box),o.iconBox&&(w.icon=f.box)}if(y){let x=this.collisionCircleArrays[t];x===void 0&&(x=this.collisionCircleArrays[t]=[]);for(let w=0;w<y.circles.length;w+=4)x.push(y.circles[w+0]-Tt),x.push(y.circles[w+1]-Tt),x.push(y.circles[w+2]),x.push(y.collisionDetected?1:0)}}markUsedJustification(t,n,o,c){let f;f=c===p.ax.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[p.aO(n)];const y=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const x of y)x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=f>=0&&x!==f?0:o.crossTileID)}markUsedOrientation(t,n,o){const c=n===p.ax.horizontal||n===p.ax.horizontalOnly?n:0,f=n===p.ax.vertical?n:0,y=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const x of y)t.text.placedSymbolArray.get(x).placedOrientation=c;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},y=n?n.variableOffsets:{},x=n?n.placedOrientations:{};for(const w in this.placements){const S=this.placements[w],P=f[w];P?(this.opacities[w]=new Da(P,c,S.text,S.icon),o||(o=S.text!==P.text.placed),o||(o=S.icon!==P.icon.placed)):(this.opacities[w]=new Da(null,c,S.text,S.icon,S.skipFade),o||(o=S.text||S.icon))}for(const w in f){const S=f[w];if(!this.opacities[w]){const P=new Da(S,c,!1,!1);P.isHidden()||(this.opacities[w]=P,o||(o=S.text.placed),o||(o=S.icon.placed))}}for(const w in y)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=y[w]);for(const w in x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const o={};for(const c of n){const f=c.getBucket(t);f&&c.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,c.tileID,o,c.collisionBoxArray)}}updateBucketOpacities(t,n,o,c){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();
vendor: 12,186 bytes, lines 16-43
16const f=t.layers[0],y=f.layout,x=new Da(null,0,!1,!1,!0),w=y.get("text-allow-overlap"),S=y.get("icon-allow-overlap"),P=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=y.get("text-rotation-alignment")==="map",C=y.get("text-pitch-alignment")==="map",D=y.get("icon-text-fit")!=="none",B=new Da(null,0,w&&(S||!t.hasIconData()||y.get("icon-optional")),S&&(w||!t.hasTextData()||y.get("text-optional")),!0);!t.collisionArrays&&c&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(c);const j=(N,G,X)=>{for(let Z=0;Z<G/4;Z++)N.opacityVertexArray.emplaceBack(X);N.hasVisibleVertices||(N.hasVisibleVertices=X!==Ra)},$=this.collisionBoxArrays.get(t.bucketInstanceId);for(let N=0;N<t.symbolInstances.length;N++){const G=t.symbolInstances.get(N),{numHorizontalGlyphVertices:X,numVerticalGlyphVertices:Z,crossTileID:U}=G;let H=this.opacities[U];o[U]?H=x:H||(H=B,this.opacities[U]=H),o[U]=!0;const q=G.numIconVertices>0,Q=this.placedOrientations[G.crossTileID],ae=Q===p.ax.vertical,oe=Q===p.ax.horizontal||Q===p.ax.horizontalOnly;if(X>0||Z>0){const de=Yo(H.text);j(t.text,X,ae?Ra:de),j(t.text,Z,oe?Ra:de);const Me=H.text.isHidden(),be=[G.rightJustifiedTextSymbolIndex,G.centerJustifiedTextSymbolIndex,G.leftJustifiedTextSymbolIndex];for(const Ae of be)Ae>=0&&(t.text.placedSymbolArray.get(Ae).hidden=Me||ae?1:0);G.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(G.verticalPlacedTextSymbolIndex).hidden=Me||oe?1:0);const he=this.variableOffsets[G.crossTileID];he&&this.markUsedJustification(t,he.anchor,G,Q);const Se=this.placedOrientations[G.crossTileID];Se&&(this.markUsedJustification(t,"left",G,Se),this.markUsedOrientation(t,Se,G))}if(q){const de=Yo(H.icon),Me=!(D&&G.verticalPlacedIconSymbolIndex&&ae);G.placedIconSymbolIndex>=0&&(j(t.icon,G.numIconVertices,Me?de:Ra),t.icon.placedSymbolArray.get(G.placedIconSymbolIndex).hidden=H.icon.isHidden()),G.verticalPlacedIconSymbolIndex>=0&&(j(t.icon,G.numVerticalIconVertices,Me?Ra:de),t.icon.placedSymbolArray.get(G.verticalPlacedIconSymbolIndex).hidden=H.icon.isHidden())}const fe=$?.has(N)?$.get(N):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const de=t.collisionArrays[N];if(de){let Me=new p.P(0,0);if(de.textBox||de.verticalTextBox){let be=!0;if(P){const he=this.variableOffsets[U];he?(Me=Ps(he.anchor,he.width,he.height,he.textOffset,he.textBoxScale),E&&Me._rotate(C?-this.transform.bearingInRadians:this.transform.bearingInRadians)):be=!1}if(de.textBox||de.verticalTextBox){let he;de.textBox&&(he=ae),de.verticalTextBox&&(he=oe),Wo(t.textCollisionBox.collisionVertexArray,H.text.placed,!be||he,fe.text,Me.x,Me.y)}}if(de.iconBox||de.verticalIconBox){const be=!!(!oe&&de.verticalIconBox);let he;de.iconBox&&(he=be),de.verticalIconBox&&(he=!be),Wo(t.iconCollisionBox.collisionVertexArray,H.icon.placed,he,fe.icon,D?Me.x:0,D?Me.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function Wo(h,t,n,o,c,f){o&&o.length!==0||(o=[0,0,0,0]);const y=o[0]-Tt,x=o[1]-Tt,w=o[2]-Tt,S=o[3]-Tt;h.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,x),h.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,x),h.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,S),h.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,S)}const Ho=Math.pow(2,25),Xo=Math.pow(2,24),Vu=Math.pow(2,17),ka=Math.pow(2,16),Is=Math.pow(2,9),yc=Math.pow(2,8),qn=Math.pow(2,1);function Yo(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*Ho+t*Xo+n*Vu+t*ka+n*Is+t*yc+n*qn+t}const Ra=0;class Br{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,o,c,f){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort(((x,w)=>x.sortKey-w.sortKey)));this._currentPartIndex<y.length;)if(n.placeLayerBucketPart(y[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,f())return!0;return!1}}class Wn{constructor(t,n,o,c,f,y,x,w){this.placement=new qo(t,n,y,x,w),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(t,n,o){const c=Je(),f=()=>!this._forceFullPlacement&&Je()-c>2;for(;this._currentPlacementIndex>=0;){const y=n[t[this._currentPlacementIndex]],x=this.placement.collisionIndex.transform.zoom;if(p.aQ(y)&&y.layout&&(!y.minzoom||y.minzoom<=x)&&(!y.maxzoom||y.maxzoom>x)){if(this._inProgressLayer||(this._inProgressLayer=new Br(y)),this._inProgressLayer.continuePlacement(o[y.source],this.placement,this._showCollisionBoxes,y,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const $e=512/p.a6/2;class Ko{constructor(t,n,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const c=new Map;for(let f=0;f<n.length;f++){const y=n.get(f),x=y.key,w=c.get(x);w?w.push(y):c.set(x,[y])}for(const[f,y]of c){const x={positions:y.map((w=>({x:Math.floor(w.anchorX*$e),y:Math.floor(w.anchorY*$e)}))),crossTileIDs:y.map((w=>w.crossTileID))};if(x.positions.length>128){const w=new p.aR(x.positions.length,16,Uint16Array);for(const{x:S,y:P}of x.positions)w.add(S,P);w.finish(),delete x.positions,x.index=w}this._symbolsByKey[f]=x}}getScaledCoordinates(t,n){const{x:o,y:c,z:f}=this.tileID.canonical,{x:y,y:x,z:w}=n.canonical,S=$e/Math.pow(2,w-f),P=(x*p.a6+t.anchorY)*S,E=c*p.a6*$e;return{x:Math.floor((y*p.a6+t.anchorX)*S-o*p.a6*$e),y:Math.floor(P-E)}}findMatches(t,n,o){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let f=0;f<t.length;f++){const y=t.get(f);if(y.crossTileID)continue;const x=this._symbolsByKey[y.key];if(!x)continue;const w=this.getScaledCoordinates(y,n);if(x.index){const S=x.index.range(w.x-c,w.y-c,w.x+c,w.y+c).sort();for(const P of S){const E=x.crossTileIDs[P];if(!o[E]){o[E]=!0,y.crossTileID=E;break}}}else if(x.positions)for(let S=0;S<x.positions.length;S++){const P=x.positions[S],E=x.crossTileIDs[S];if(Math.abs(P.x-w.x)<=c&&Math.abs(P.y-w.y)<=c&&!o[E]){o[E]=!0,y.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Nu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Jo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const o in this.indexes){const c=this.indexes[o],f={};for(const y in c){const x=c[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+n),f[x.tileID.key]=x}this.indexes[o]=f}this.lng=t}addBucket(t,n,o){var c,f,y;if(!((c=this.indexes[t.overscaledZ])===null||c===void 0)&&c[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let w=0;w<n.symbolInstances.length;w++)n.symbolInstances.get(w).crossTileID=0;(f=this.usedCrossTileIDs)[y=t.overscaledZ]||(f[y]={});const x=this.usedCrossTileIDs[t.overscaledZ];for(const w in this.indexes){const S=this.indexes[w];if(Number(w)>t.overscaledZ)for(const P in S){const E=S[P];E.tileID.isChildOf(t)&&E.findMatches(n.symbolInstances,t,x)}else{const P=S[t.scaledTo(Number(w)).key];P&&P.findMatches(n.symbolInstances,t,x)}}for(let w=0;w<n.symbolInstances.length;w++){const S=n.symbolInstances.get(w);S.crossTileID||(S.crossTileID=o.generate(),x[S.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ko(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const o of n.getCrossTileIDsLists())for(const c of o)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const o in this.indexes){const c=this.indexes[o];for(const f in c)t[c[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,c[f]),delete c[f],n=!0)}return n}}class wi{constructor(){this.layerIndexes={},this.crossTileIDs=new Nu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Jo);let f=!1;const y={};c.handleWrapJump(o);for(const x of n){const w=x.getBucket(t);t.id===w?.layerIds[0]&&(w.bucketInstanceId||(this.maxBucketInstanceId+=1,w.bucketInstanceId=this.maxBucketInstanceId),c.addBucket(x.tileID,w,this.crossTileIDs)&&(f=!0),y[w.bucketInstanceId]=!0)}return c.removeStaleBuckets(y)&&(f=!0),f}pruneUnusedLayers(t){const n={};for(const o of t)n[o]=!0;for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}var ti="void main() {fragColor=vec4(1.0);}";const _t={prelude:Be(`#ifdef GL_ES 17precision mediump float; 18#else 19#if !defined(lowp) 20#define lowp 21#endif 22#if !defined(mediump) 23#define mediump 24#endif 25#if !defined(highp) 26#define highp 27#endif 28#endif 29out highp vec4 fragColor;`,`#ifdef GL_ES 30precision highp float; 31#else 32#if !defined(lowp) 33#define lowp 34#endif 35#if !defined(mediump) 36#define mediump 37#endif 38#if !defined(highp) 39#define highp 40#endif 41#endif 42vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 43);}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);
43return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c 44);} 45#ifdef TERRAIN3D 46uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; 47#endif 48const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { 49#ifdef TERRAIN3D 50highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); 51#else 52return 1.0; 53#endif 54}float calculate_visibility(vec4 pos) { 55#ifdef TERRAIN3D 56vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; 57#else 58return 1.0; 59#endif 60}float ele(vec2 pos) { 61#ifdef TERRAIN3D 62vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 63#else 64return 0.0; 65#endif 66}float get_elevation(vec2 pos) { 67#ifdef TERRAIN3D 68#ifdef GLOBE 69if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 70#endif 71vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; 72#else 73return 0.0; 74#endif 75}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Be("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Be("",`#define GLOBE_RADIUS 6371008.8 76uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos 77);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); 78if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len 79);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:Be(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 80#ifdef OVERDRAW_INSPECTOR 81fragColor=vec4(1.0); 82#endif 83}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Be(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
83uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; 84#ifdef OVERDRAW_INSPECTOR 85fragColor=vec4(1.0); 86#endif 87}`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Be(`in vec3 v_data;in float v_visibility; 88#pragma mapbox: define highp vec4 color 89#pragma mapbox: define mediump float radius 90#pragma mapbox: define lowp float blur 91#pragma mapbox: define lowp float opacity 92#pragma mapbox: define highp vec4 stroke_color 93#pragma mapbox: define mediump float stroke_width 94#pragma mapbox: define lowp float stroke_opacity 95void main() { 96#pragma mapbox: initialize highp vec4 color 97#pragma mapbox: initialize mediump float radius 98#pragma mapbox: initialize lowp float blur 99#pragma mapbox: initialize lowp float opacity 100#pragma mapbox: initialize highp vec4 stroke_color 101#pragma mapbox: initialize mediump float stroke_width 102#pragma mapbox: initialize lowp float stroke_opacity 103vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} 104#ifdef OVERDRAW_INSPECTOR 105fragColor=vec4(1.0); 106#endif 107}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility; 108#pragma mapbox: define highp vec4 color 109#pragma mapbox: define mediump float radius 110#pragma mapbox: define lowp float blur 111#pragma mapbox: define lowp float opacity 112#pragma mapbox: define highp vec4 stroke_color 113#pragma mapbox: define mediump float stroke_width 114#pragma mapbox: define lowp float stroke_opacity 115void main(void) { 116#pragma mapbox: initialize highp vec4 color 117#pragma mapbox: initialize mediump float radius 118#pragma mapbox: initialize lowp float blur 119#pragma mapbox: initialize lowp float opacity 120#pragma mapbox: initialize highp vec4 stroke_color 121#pragma mapbox: initialize mediump float stroke_width 122#pragma mapbox: initialize lowp float stroke_opacity 123vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { 124#ifdef GLOBE 125vec3 center_vector=projectToSphere(circle_center); 126#endif 127float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { 128#ifdef GLOBE 129vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 130#else 131vec4 projected_center=projectTileWithElevation(circle_center,ele); 132#endif 133corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} 134#ifdef GLOBE 135vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 136#else 137gl_Position=projectTileWithElevation(corner_position,ele); 138#endif 139} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Be(ti,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Be(`uniform highp float u_intensity;in vec2 v_extrude; 140#pragma mapbox: define highp float weight 141#define GAUSS_COEF 0.3989422804014327 142void main() { 143#pragma mapbox: initialize highp float weight 144float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); 145#ifdef OVERDRAW_INSPECTOR 146fragColor=vec4(1.0); 147#endif 148}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude; 149#pragma mapbox: define highp float weight 150#pragma mapbox: define mediump float radius 151const highp float ZERO=1.0/255.0/16.0; 152#define GAUSS_COEF 0.3989422804014327 153void main(void) { 154#pragma mapbox: initialize highp float weight 155#pragma mapbox: initialize mediump float radius 156vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0); 157#ifdef GLOBE 158vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); 159#else 160gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 161#endif 162}`),heatmapTexture:Be(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity; 163#ifdef OVERDRAW_INSPECTOR 164fragColor=vec4(0.0); 165#endif 166}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Be("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Be("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Be(`#ifdef GL_ES 167precision highp float; 168#endif 169uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else 170{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0)); 171#ifdef OVERDRAW_INSPECTOR 172fragColor=vec4(1.0); 173#endif 174}`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Be("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Be(ti,`in vec2 a_pos;void main() { 175#ifdef GLOBE 176gl_Position=projectTileFor3D(a_pos,0.0); 177#else 178gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 179#endif 180}`),fill:Be(`#pragma mapbox: define highp vec4 color 181#pragma mapbox: define lowp float opacity 182void main() { 183#pragma mapbox: initialize highp vec4 color 184#pragma mapbox: initialize lowp float opacity 185fragColor=color*opacity; 186#ifdef OVERDRAW_INSPECTOR 187fragColor=vec4(1.0); 188#endif 189}`,`uniform vec2 u_fill_translate;in vec2 a_pos; 190#pragma mapbox: define highp vec4 color 191#pragma mapbox: define lowp float opacity 192void main() { 193#pragma mapbox: initialize highp vec4 color 194#pragma mapbox: initialize lowp float opacity 195gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Be(`in vec2 v_pos; 196#ifdef GLOBE 197in float v_depth; 198#endif 199#pragma mapbox: define highp vec4 outline_color 200#pragma mapbox: define lowp float opacity 201void main() { 202#pragma mapbox: initialize highp vec4 outline_color 203#pragma mapbox: initialize lowp float opacity 204float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 205#ifdef GLOBE 206if (v_depth > 1.0) {discard;} 207#endif 208#ifdef OVERDRAW_INSPECTOR 209fragColor=vec4(1.0); 210#endif 211}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; 212#ifdef GLOBE 213out float v_depth; 214#endif 215#pragma mapbox: define highp vec4 outline_color 216#pragma mapbox: define lowp float opacity 217void main() { 218#pragma mapbox: initialize highp vec4 outline_color 219#pragma mapbox: initialize lowp float opacity 220gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 221#ifdef GLOBE 222v_depth=gl_Position.z/gl_Position.w; 223#endif 224}`),fillOutlinePattern:Be(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; 225#ifdef GLOBE 226in float v_depth; 227#endif 228#pragma mapbox: define lowp float opacity 229#pragma mapbox: define lowp vec4 pattern_from 230#pragma mapbox: define lowp vec4 pattern_to 231void main() { 232#pragma mapbox: initialize lowp float opacity 233#pragma mapbox: initialize mediump vec4 pattern_from 234#pragma mapbox: initialize mediump vec4 pattern_to 235vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity; 236#ifdef GLOBE 237if (v_depth > 1.0) {discard;} 238#endif 239#ifdef OVERDRAW_INSPECTOR 240fragColor=vec4(1.0); 241#endif 242}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; 243#ifdef GLOBE 244out float v_depth; 245#endif 246#pragma mapbox: define lowp float opacity 247#pragma mapbox: define lowp vec4 pattern_from 248#pragma mapbox: define lowp vec4 pattern_to 249#pragma mapbox: define lowp float pixel_ratio_from 250#pragma mapbox: define lowp float pixel_ratio_to 251void main() { 252#pragma mapbox: initialize lowp float opacity 253#pragma mapbox: initialize mediump vec4 pattern_from 254#pragma mapbox: initialize mediump vec4 pattern_to 255#pragma mapbox: initialize lowp float pixel_ratio_from 256#pragma mapbox: initialize lowp float pixel_ratio_to 257vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 258#ifdef GLOBE 259v_depth=gl_Position.z/gl_Position.w; 260#endif 261}`),fillPattern:Be(`#ifdef GL_ES 262precision highp float; 263#endif 264uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 265#pragma mapbox: define lowp float opacity 266#pragma mapbox: define lowp vec4 pattern_from 267#pragma mapbox: define lowp vec4 pattern_to 268void main() { 269#pragma mapbox: initialize lowp float opacity 270#pragma mapbox: initialize mediump vec4 pattern_from 271#pragma mapbox: initialize mediump vec4 pattern_to 272vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity; 273#ifdef OVERDRAW_INSPECTOR 274fragColor=vec4(1.0); 275#endif 276}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; 277#pragma mapbox: define lowp float opacity 278#pragma mapbox: define lowp vec4 pattern_from 279#pragma mapbox: define lowp vec4 pattern_to 280#pragma mapbox: define lowp float pixel_ratio_from 281#pragma mapbox: define lowp float pixel_ratio_to 282void main() { 283#pragma mapbox: initialize lowp float opacity 284#pragma mapbox: initialize mediump vec4 pattern_from 285#pragma mapbox: initialize mediump vec4 pattern_to 286#pragma mapbox: initialize lowp float pixel_ratio_from 287#pragma mapbox: initialize lowp float pixel_ratio_to 288vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_siz
288e_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Be(`in vec4 v_color;void main() {fragColor=v_color; 289#ifdef OVERDRAW_INSPECTOR 290fragColor=vec4(1.0); 291#endif 292}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed; 293#ifdef TERRAIN3D 294in vec2 a_centroid; 295#endif 296out vec4 v_color; 297#pragma mapbox: define highp float base 298#pragma mapbox: define highp float height 299#pragma mapbox: define highp vec4 color 300void main() { 301#pragma mapbox: initialize highp float base 302#pragma mapbox: initialize highp float height 303#pragma mapbox: initialize highp vec4 color 304vec3 normal=a_normal_ed.xyz; 305#ifdef TERRAIN3D 306float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 307#else 308float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 309#endif 310base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 311#ifdef GLOBE 312vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 313#else 314gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 315#endif 316float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); 317#ifdef GLOBE 318mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 319#endif 320directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Be(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; 321#pragma mapbox: define lowp float base 322#pragma mapbox: define lowp float height 323#pragma mapbox: define lowp vec4 pattern_from 324#pragma mapbox: define lowp vec4 pattern_to 325#pragma mapbox: define lowp float pixel_ratio_from 326#pragma mapbox: define lowp float pixel_ratio_to 327void main() { 328#pragma mapbox: initialize lowp float base 329#pragma mapbox: initialize lowp float height 330#pragma mapbox: initialize mediump vec4 pattern_from 331#pragma mapbox: initialize mediump vec4 pattern_to 332#pragma mapbox: initialize lowp float pixel_ratio_from 333#pragma mapbox: initialize lowp float pixel_ratio_to 334vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; 335#ifdef OVERDRAW_INSPECTOR 336fragColor=vec4(1.0); 337#endif 338}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed; 339#ifdef TERRAIN3D 340in vec2 a_centroid; 341#endif 342#ifdef GLOBE 343out vec3 v_sphere_pos; 344#endif 345out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 346#pragma mapbox: define lowp float base 347#pragma mapbox: define lowp float height 348#pragma mapbox: define lowp vec4 pattern_from 349#pragma mapbox: define lowp vec4 pattern_to 350#pragma mapbox: define lowp float pixel_ratio_from 351#pragma mapbox: define lowp float pixel_ratio_to 352void main() { 353#pragma mapbox: initialize lowp float base 354#pragma mapbox: initialize lowp float height 355#pragma mapbox: initialize mediump vec4 pattern_from 356#pragma mapbox: initialize mediump vec4 pattern_to 357#pragma mapbox: initialize lowp float pixel_ratio_from 358#pragma mapbox: initialize lowp float pixel_ratio_to 359vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; 360#ifdef TERRAIN3D 361float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 362#else 363float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 364#endif 365base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 366#ifdef GLOBE 367vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 368#else 369gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 370#endif 371vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 372? a_pos 373: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Be(`#ifdef GL_ES 374precision highp float; 375#endif 376uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
376ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0); 377#ifdef OVERDRAW_INSPECTOR 378fragColor=vec4(1.0); 379#endif 380}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Be(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES]; 381#define PI 3.141592653589793 382#define STANDARD 0 383#define COMBINED 1 384#define IGOR 2 385#define MULTIDIRECTIONAL 3 386#define BASIC 4 387float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else 388{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else 389{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);} 390#ifdef OVERDRAW_INSPECTOR 391fragColor=vec4(1.0); 392#endif 393}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Be(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 394#ifdef GLOBE 395in float v_depth; 396#endif 397#pragma mapbox: define highp vec4 color 398#pragma mapbox: define lowp float blur 399#pragma mapbox: define lowp float opacity 400void main() { 401#pragma mapbox: initialize highp vec4 color 402#pragma mapbox: initialize lowp float blur 403#pragma mapbox: initialize lowp float opacity 404float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity); 405#ifdef GLOBE 406if (v_depth > 1.0) {discard;} 407#endif 408#ifdef OVERDRAW_INSPECTOR 409fragColor=vec4(1.0); 410#endif 411}`,` 412#define scale 0.015873016 413in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar; 414#ifdef GLOBE 415out float v_depth; 416#endif 417#pragma mapbox: define highp vec4 color 418#pragma mapbox: define lowp float blur 419#pragma mapbox: define lowp float opacity 420#pragma mapbox: define mediump float gapwidth 421#pragma mapbox: define lowp float offset 422#pragma mapbox: define mediump float width 423void main() { 424#pragma mapbox: initialize highp vec4 color 425#pragma mapbox: initialize lowp float blur 426#pragma mapbox: initialize lowp float opacity 427#pragma mapbox: initialize mediump float gapwidth 428#pragma mapbox: initialize lowp float offset 429#pragma mapbox: initialize mediump float width 430float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
430float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 431#ifdef GLOBE 432v_depth=gl_Position.z/gl_Position.w; 433#endif 434#ifdef TERRAIN3D 435v_gamma_scale=1.0; 436#else 437float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 438#endif 439v_width2=vec2(outset,inset);}`),lineGradient:Be(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; 440#ifdef GLOBE 441in float v_depth; 442#endif 443#pragma mapbox: define lowp float blur 444#pragma mapbox: define lowp float opacity 445void main() { 446#pragma mapbox: initialize lowp float blur 447#pragma mapbox: initialize lowp float opacity 448float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity); 449#ifdef GLOBE 450if (v_depth > 1.0) {discard;} 451#endif 452#ifdef OVERDRAW_INSPECTOR 453fragColor=vec4(1.0); 454#endif 455}`,` 456#define scale 0.015873016 457in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; 458#ifdef GLOBE 459out float v_depth; 460#endif 461#pragma mapbox: define lowp float blur 462#pragma mapbox: define lowp float opacity 463#pragma mapbox: define mediump float gapwidth 464#pragma mapbox: define lowp float offset 465#pragma mapbox: define mediump float width 466void main() { 467#pragma mapbox: initialize lowp float blur 468#pragma mapbox: initialize lowp float opacity 469#pragma mapbox: initialize mediump float gapwidth 470#pragma mapbox: initialize lowp float offset 471#pragma mapbox: initialize mediump float width 472float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 473#ifdef GLOBE 474v_depth=gl_Position.z/gl_Position.w; 475#endif 476#ifdef TERRAIN3D 477v_gamma_scale=1.0; 478#else 479float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 480#endif 481v_width2=vec2(outset,inset);}`),linePattern:Be(`#ifdef GL_ES 482precision highp float; 483#endif 484uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width; 485#ifdef GLOBE 486in float v_depth; 487#endif 488#pragma mapbox: define lowp vec4 pattern_from 489#pragma mapbox: define lowp vec4 pattern_to 490#pragma mapbox: define lowp float pixel_ratio_from 491#pragma mapbox: define lowp float pixel_ratio_to 492#pragma mapbox: define lowp float blur 493#pragma mapbox: define lowp float opacity 494void main() { 495#pragma mapbox: initialize mediump vec4 pattern_from 496#pragma mapbox: initialize mediump vec4 pattern_to 497#pragma mapbox: initialize lowp float pixel_ratio_from 498#pragma mapbox: initialize lowp float pixel_ratio_to 499#pragma mapbox: initialize lowp float blur 500#pragma mapbox: initialize lowp float opacity 501vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; 502#ifdef GLOBE 503if (v_depth > 1.0) {discard;} 504#endif 505#ifdef OVERDRAW_INSPECTOR 506fragColor=vec4(1.0); 507#endif 508}`,` 509#define scale 0.015873016 510#define LINE_DISTANCE_SCALE 2.0 511in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width; 512#ifdef GLOBE 513out float v_depth; 514#endif 515#pragma mapbox: define lowp float blur 516#pragma mapbox: define lowp float opacity 517#pragma mapbox: define lowp float offset 518#pragma mapbox: define mediump float gapwidth 519#pragma mapbox: define mediump float width 520#pragma mapbox: define lowp float floorwidth 521#pragma mapbox: define lowp vec4 pattern_from 522#pragma mapbox: define lowp vec4 pattern_to 523#pragma mapbox: define lowp float pixel_ratio_from 524#pragma mapbox: define lowp float pixel_ratio_to 525void main() { 526#pragma mapbox: initialize lowp float blur 527#pragma mapbox: initialize lowp float opacity 528#pragma mapbox: initialize lowp float offset 529#pragma mapbox: initialize mediump float gapwidth 530#pragma mapbox: initialize mediump float width 531#pragma mapbox: initialize lowp float floorwidth 532#pragma mapbox: initialize mediump vec4 pattern_from 533#pragma mapbox: initialize mediump vec4 pattern_to 534#pragma mapbox: initialize lowp float pixel_ratio_from 535#pragma mapbox: initialize lowp float pixel_ratio_to 536float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
536float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 537#ifdef GLOBE 538v_depth=gl_Position.z/gl_Position.w; 539#endif 540#ifdef TERRAIN3D 541v_gamma_scale=1.0; 542#else 543float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 544#endif 545v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Be(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; 546#ifdef GLOBE 547in float v_depth; 548#endif 549#pragma mapbox: define highp vec4 color 550#pragma mapbox: define lowp float blur 551#pragma mapbox: define lowp float opacity 552#pragma mapbox: define mediump float width 553#pragma mapbox: define lowp float floorwidth 554#pragma mapbox: define mediump vec4 dasharray_from 555#pragma mapbox: define mediump vec4 dasharray_to 556void main() { 557#pragma mapbox: initialize highp vec4 color 558#pragma mapbox: initialize lowp float blur 559#pragma mapbox: initialize lowp float opacity 560#pragma mapbox: initialize mediump float width 561#pragma mapbox: initialize lowp float floorwidth 562#pragma mapbox: initialize mediump vec4 dasharray_from 563#pragma mapbox: initialize mediump vec4 dasharray_to 564float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
564float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); 565#ifdef GLOBE 566if (v_depth > 1.0) {discard;} 567#endif 568#ifdef OVERDRAW_INSPECTOR 569fragColor=vec4(1.0); 570#endif 571}`,` 572#define scale 0.015873016 573#define LINE_DISTANCE_SCALE 2.0 574in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; 575#ifdef GLOBE 576out float v_depth; 577#endif 578#pragma mapbox: define highp vec4 color 579#pragma mapbox: define lowp float blur 580#pragma mapbox: define lowp float opacity 581#pragma mapbox: define mediump float gapwidth 582#pragma mapbox: define lowp float offset 583#pragma mapbox: define mediump float width 584#pragma mapbox: define lowp float floorwidth 585#pragma mapbox: define mediump vec4 dasharray_from 586#pragma mapbox: define mediump vec4 dasharray_to 587void main() { 588#pragma mapbox: initialize highp vec4 color 589#pragma mapbox: initialize lowp float blur 590#pragma mapbox: initialize lowp float opacity 591#pragma mapbox: initialize mediump float gapwidth 592#pragma mapbox: initialize lowp float offset 593#pragma mapbox: initialize mediump float width 594#pragma mapbox: initialize lowp float floorwidth 595#pragma mapbox: initialize mediump vec4 dasharray_from 596#pragma mapbox: initialize mediump vec4 dasharray_to 597float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 598#ifdef GLOBE 599v_depth=gl_Position.z/gl_Position.w; 600#endif 601#ifdef TERRAIN3D 602v_gamma_scale=1.0; 603#else 604float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 605#endif 606float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:Be(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv; 607#ifdef GLOBE 608in float v_depth; 609#endif 610#pragma mapbox: define lowp float blur 611#pragma mapbox: define lowp float opacity 612#pragma mapbox: define mediump float width 613#pragma mapbox: define lowp float floorwidth 614#pragma mapbox: define mediump vec4 dasharray_from 615#pragma mapbox: define mediump vec4 dasharray_to 616void main() { 617#pragma mapbox: initialize lowp float blur 618#pragma mapbox: initialize lowp float opacity 619#pragma mapbox: initialize mediump float width 620#pragma mapbox: initialize lowp float floorwidth 621#pragma mapbox: initialize mediump vec4 dasharray_from 622#pragma mapbox: initialize mediump vec4 dasharray_to 623float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
623float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity); 624#ifdef GLOBE 625if (v_depth > 1.0) {discard;} 626#endif 627#ifdef OVERDRAW_INSPECTOR 628fragColor=vec4(1.0); 629#endif 630}`,` 631#define scale 0.015873016 632#define LINE_DISTANCE_SCALE 2.0 633in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b; 634#ifdef GLOBE 635out float v_depth; 636#endif 637#pragma mapbox: define lowp float blur 638#pragma mapbox: define lowp float opacity 639#pragma mapbox: define mediump float gapwidth 640#pragma mapbox: define lowp float offset 641#pragma mapbox: define mediump float width 642#pragma mapbox: define lowp float floorwidth 643#pragma mapbox: define mediump vec4 dasharray_from 644#pragma mapbox: define mediump vec4 dasharray_to 645void main() { 646#pragma mapbox: initialize lowp float blur 647#pragma mapbox: initialize lowp float opacity 648#pragma mapbox: initialize mediump float gapwidth 649#pragma mapbox: initialize lowp float offset 650#pragma mapbox: initialize mediump float width 651#pragma mapbox: initialize lowp float floorwidth 652#pragma mapbox: initialize mediump vec4 dasharray_from 653#pragma mapbox: initialize mediump vec4 dasharray_to 654float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 655#ifdef GLOBE 656v_depth=gl_Position.z/gl_Position.w; 657#endif 658#ifdef TERRAIN3D 659v_gamma_scale=1.0; 660#else 661float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 662#endif 663float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:Be(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); 664#ifdef OVERDRAW_INSPECTOR 665fragColor=vec4(1.0); 666#endif 667}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5; 668#ifdef GLOBE 669if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} 670#endif 671v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Be(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity; 672#ifdef OVERDRAW_INSPECTOR 673fragColor=vec4(1.0); 674#endif 675}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity; 676#pragma mapbox: define lowp float opacity 677void main() { 678#pragma mapbox: initialize lowp float opacity 679vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 680camera_to_anchor_distance/u_camera_to_center_distance : 681u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 682#ifdef GLOBE 683if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 684#endif 685vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:Be(`#define SDF_PX 8.0 686uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1; 687#pragma mapbox: define highp vec4 fill_color 688#pragma mapbox: define highp vec4 halo_color 689#pragma mapbox: define lowp float halo_width 690#pragma mapbox: define lowp float halo_blur 691void main() { 692#pragma mapbox: initialize highp vec4 fill_color 693#pragma mapbox: initialize highp vec4 halo_color 694#pragma mapbox: initialize lowp float halo_width 695#pragma mapbox: initialize lowp float halo_blur 696float 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;} 697#ifdef OVERDRAW_INSPECTOR 698fragColor=vec4(1.0); 699#endif 700}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1; 701#pragma mapbox: define highp vec4 fill_color 702#pragma mapbox: define highp vec4 halo_color 703#pragma mapbox: define lowp float opacity 704#pragma mapbox: define lowp float halo_width 705#pragma mapbox: define lowp float halo_blur 706void main() { 707#pragma mapbox: initialize highp vec4 fill_color 708#pragma mapbox: initialize highp vec4 halo_color 709#pragma mapbox: initialize lowp float opacity 710#pragma mapbox: initialize lowp float halo_width 711#pragma mapbox: initialize lowp float halo_blur 712vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 713camera_to_anchor_distance/u_camera_to_center_distance : 714u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 715#ifdef GLOBE 716if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 717#endif 718vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:Be(`#define SDF_PX 8.0 719#define SDF 1.0 720#define ICON 0.0 721uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1; 722#pragma mapbox: define highp vec4 fill_color 723#pragma mapbox: define highp vec4 halo_color 724#pragma mapbox: define lowp float halo_width 725#pragma mapbox: define lowp float halo_blur 726void main() { 727#pragma mapbox: initialize highp vec4 fill_color 728#pragma mapbox: initialize highp vec4 halo_color 729#pragma mapbox: initialize lowp float halo_width 730#pragma mapbox: initialize lowp float halo_blur 731float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
731fragColor=texture(u_texture_icon,tex_icon)*total_opacity; 732#ifdef OVERDRAW_INSPECTOR 733fragColor=vec4(1.0); 734#endif 735return;}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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;} 736#ifdef OVERDRAW_INSPECTOR 737fragColor=vec4(1.0); 738#endif 739}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1; 740#pragma mapbox: define highp vec4 fill_color 741#pragma mapbox: define highp vec4 halo_color 742#pragma mapbox: define lowp float opacity 743#pragma mapbox: define lowp float halo_width 744#pragma mapbox: define lowp float halo_blur 745void main() { 746#pragma mapbox: initialize highp vec4 fill_color 747#pragma mapbox: initialize highp vec4 halo_color 748#pragma mapbox: initialize lowp float opacity 749#pragma mapbox: initialize lowp float halo_width 750#pragma mapbox: initialize lowp float halo_blur 751vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 752camera_to_anchor_distance/u_camera_to_center_distance : 753u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 754#ifdef GLOBE 755if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 756#endif 757vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:Be("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
757float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Be("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Be("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Be("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Be(`#ifdef GL_ES 758precision highp float; 759#endif 760in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 761);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Be("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
vendor: 63,618 bytes, lines 761-810
761function Be(h,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=t.match(/in ([\w]+) ([\w]+)/g),c=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=f?f.concat(c):c,x={};return{fragmentSource:h=h.replace(n,((w,S,P,E,C)=>(x[C]=!0,S==="define"?` 762#ifndef HAS_UNIFORM_u_${C} 763in ${P} ${E} ${C}; 764#else 765uniform ${P} ${E} u_${C}; 766#endif 767`:` 768#ifdef HAS_UNIFORM_u_${C} 769 ${P} ${E} ${C} = u_${C}; 770#endif 771`))),vertexSource:t=t.replace(n,((w,S,P,E,C)=>{const D=E==="float"?"vec2":"vec4",B=C.match(/color/)?"color":D;return x[C]?S==="define"?` 772#ifndef HAS_UNIFORM_u_${C} 773uniform lowp float u_${C}_t; 774in ${P} ${D} a_${C}; 775out ${P} ${E} ${C}; 776#else 777uniform ${P} ${E} u_${C}; 778#endif 779`:B==="vec4"?` 780#ifndef HAS_UNIFORM_u_${C} 781 ${C} = a_${C}; 782#else 783 ${P} ${E} ${C} = u_${C}; 784#endif 785`:` 786#ifndef HAS_UNIFORM_u_${C} 787 ${C} = unpack_mix_${B}(a_${C}, u_${C}_t); 788#else 789 ${P} ${E} ${C} = u_${C}; 790#endif 791`:S==="define"?` 792#ifndef HAS_UNIFORM_u_${C} 793uniform lowp float u_${C}_t; 794in ${P} ${D} a_${C}; 795#else 796uniform ${P} ${E} u_${C}; 797#endif 798`:B==="vec4"?` 799#ifndef HAS_UNIFORM_u_${C} 800 ${P} ${E} ${C} = a_${C}; 801#else 802 ${P} ${E} ${C} = u_${C}; 803#endif 804`:` 805#ifndef HAS_UNIFORM_u_${C} 806 ${P} ${E} ${C} = unpack_mix_${B}(a_${C}, u_${C}_t); 807#else 808 ${P} ${E} ${C} = u_${C}; 809#endif 810`})),staticAttributes:o,staticUniforms:y}}class ct{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Or=p.aS([{name:"a_pos",type:"Int16",components:2}]);const ui="#define PROJECTION_MERCATOR",zi="mercator";class hi{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return zi}get shaderDefine(){return ui}get shaderPreludeCode(){return _t.projectionMercator}get vertexShaderPreludeCode(){return _t.projectionMercator.vertexSource}get subdivisionGranularity(){return p.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,o,c,f){if(this._cachedMesh)return this._cachedMesh;const y=new p.aU;y.emplaceBack(0,0),y.emplaceBack(p.a6,0),y.emplaceBack(0,p.a6),y.emplaceBack(p.a6,p.a6);const x=t.createVertexBuffer(y,Or.members),w=p.aV.simpleSegment(0,0,4,2),S=new p.aW;S.emplaceBack(1,0,2),S.emplaceBack(1,2,3);const P=t.createIndexBuffer(S);return this._cachedMesh=new ct(x,P,w),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Hn{constructor(t=0,n=0,o=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=o,this.right=c}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=p.H.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=p.H.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=p.H.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=p.H.number(t.right,n.right,o)),this}getCenter(t,n){const o=p.al((this.left+t-this.right)/2,0,t),c=p.al((this.top+n-this.bottom)/2,0,n);return new p.P(o,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Hn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function jr(h,t){if(!h.renderWorldCopies||h.lngRange)return;const n=t.lng-h.center.lng;t.lng+=n>180?-360:n<-180?360:0}function Mt(h){return Math.max(0,Math.floor(h))}class pn{constructor(t,n){var o;this.applyConstrain=(c,f)=>this._constrainOverride!==null?this._constrainOverride(c,f):this._callbacks.defaultConstrain(c,f),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=n?.renderWorldCopies===void 0||!!n?.renderWorldCopies,this._minZoom=n?.minZoom||0,this._maxZoom=n?.maxZoom||22,this._minPitch=n?.minPitch==null?0:n?.minPitch,this._maxPitch=n?.maxPitch==null?60:n?.maxPitch,this._constrainOverride=(o=n?.constrainOverride)!==null&&o!==void 0?o:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new p.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Mt(this._zoom),this._scale=p.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Hn,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,o){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Mt(this._zoom),this._scale=p.ao(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Hn(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!o&&t.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=p.X(t,-180,180)*Math.PI/180;var o,c,f,y,x,w,S,P,E;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=Cr(),o=this._rotationMatrix,f=-this._bearingInRadians,y=(c=this._rotationMatrix)[0],x=c[1],w=c[2],S=c[3],P=Math.sin(f),E=Math.cos(f),o[0]=y*E+w*P,o[1]=x*E+S*P,o[2]=y*-P+w*E,o[3]=x*-P+S*E)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const n=p.al(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const n=t/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return p.aX(this._fovInRadians)}setFov(t){t=p.al(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=p.an(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const n=this.applyConstrain(this._center,t).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=p.ao(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,n){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),this.constrainInternal(),this._calcMatrices()}resize(t,n,o=!0){this._width=t,this._height=n,o&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,n;return((t=this._latRange)===null||t===void 0?void 0:t.length)!==2||((n=this._lngRange)===null||n===void 0?void 0:n.length)!==2?null:new Fe([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-p.am,p.am])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:o,minY:c,maxX:f,maxY:y}=p.a8.fromPoints(n).extend(t);return[new p.P(o,c),new p.P(f,c),new p.P(f,y),new p.P(o,y),new p.P(o,c)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(o),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=p.ap(new Float64Array(16));p.S(t,t,[this._width/2,-this._height/2,1]),p.Q(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=p.ap(new Float64Array(16)),p.S(t,t,[1,-1,1]),p.Q(t,t,[-1,-1,0]),p.S(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,n,o,c){const f=o!==void 0?o:this.bearing,y=c=c!==void 0?c:this.pitch,{distanceToCenter:x,clampedElevation:w}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,y),{x:S,y:P}=vs(y,f),E=p.a7.fromLngLat(t,n);let C,D,B=p.aY(1,E.y),j=0;do{if(j+=1,j>10)break;D=x/B,C=new p.a7(E.x+S*D,E.y+P*D),B=1/C.meterInMercatorCoordinateUnits()}while(Math.abs(x-D*B)>1e-12);return{center:C.toLngLat(),elevation:w,zoom:p.ar(this.height/2/Math.tan(this.fovInRadians/2)/D/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,o=p.aq(1,this.center.lat)*this.worldSize,c=p.a7.fromLngLat(this.center,this.elevation),f=c.x/n,y=c.y/n,x=c.z/n,w=this.pitch,S=this.bearing,{x:P,y:E,z:C}=vs(w,S),D=this.cameraToCenterDistance,B=f+D*-P,j=y+D*-E,$=x+D*C,{distanceToCenter:N,clampedElevation:G}=this._distanceToCenterFromAltElevationPitch($/o,t,w),X=N*o,Z=new p.a7((B+P*X)*n,(j+E*X)*n,0).toLngLat(),U=p.aq(1,Z.lat),H=p.ar(this.height/2/Math.tan(this.fovInRadians/2)/N/U/this.tileSize);this._elevation=G,this._center=Z,this.setZoom(H)}_distanceToCenterFromAltElevationPitch(t,n,o){const c=-Math.cos(p.an(o)),f=t-n;let y,x=n;return c*f>=0||Math.abs(c)<.1?(y=1e4,x=t+y*c):y=-f/c,{distanceToCenter:y,clampedElevation:x}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=p.aq(1,this.center.lat)*this.worldSize;return Un(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const n=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/n,t.canonical.y/n,1/n/p.a6,1/n/p.a6]}}class ar{constructor(t,n){this.min=t,this.max=n,this.center=p.aZ([],p.a_([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],o=p.a$(this.min),c=p.a$(this.max);for(let f=0;f<n.length;f++)o[f]=n[f]?this.min[f]:this.center[f],c[f]=n[f]?this.center[f]:this.max[f];return c[2]=this.max[2],new ar(o,c)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let n=!0;for(const o of t.planes){const c=this.intersectsPlane(o);if(c===0)return 0;c===1&&(n=!1)}return n?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let n=t[3],o=t[3];for(let c=0;c<3;c++)t[c]>0?(n+=t[c]*this.min[c],o+=t[c]*this.max[c]):(o+=t[c]*this.min[c],n+=t[c]*this.max[c]);return n>=0?2:o<0?0:1}}class Ms{distanceToTile2d(t,n,o,c){const f=c,y=f.distanceX([t,n]),x=f.distanceY([t,n]);return Math.hypot(y,x)}getWrap(t,n,o){return o}getTileBoundingVolume(t,n,o,c){var f,y;let x=0,w=0;if(c?.terrain){const P=new p.a3(t.z,n,t.z,t.x,t.y),E=c.terrain.getMinMaxElevation(P);x=(f=E.minElevation)!==null&&f!==void 0?f:Math.min(0,o),w=(y=E.maxElevation)!==null&&y!==void 0?y:Math.max(0,o)}const S=1<<t.z;return new ar([n+t.x/S,t.y/S,x],[n+(t.x+1)/S,(t.y+1)/S,w])}allowVariableZoom(t,n){const o=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,c=p.al(78.5-o/2,0,60);return!!n.terrain||t.pitch>c}allowWorldCopies(){return!0}prepareNextFrame(){}}class Ti{constructor(t,n,o){this.points=t,this.planes=n,this.aabb=o}static fromInvProjectionMatrix(t,n=1,o=0,c,f){const y=f?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],x=Math.pow(2,o),w=[[-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((C=>(function(D,B,j,$){const N=p.aE([],D,B),G=1/N[3]/j*$;return p.b4(N,N,[G,G,1/N[3],G])})(C,t,n,x)));c&&(function(C,D,B,j){const $=j?4:0,N=j?0:4;let G=0;const X=[],Z=[];for(let q=0;q<4;q++){const Q=p.b0([],C[q+N],C[q+$]),ae=p.b5(Q);p.aZ(Q,Q,1/ae),X.push(ae),Z.push(Q)}for(let q=0;q<4;q++){const Q=p.b6(C[q+$],Z[q],B);G=Q!==null&&Q>=0?Math.max(G,Q):Math.max(G,X[q])}const U=(function(q,Q){const ae=p.b0([],q[Q[0]],q[Q[1]]),oe=p.b0([],q[Q[2]],q[Q[1]]),fe=[0,0,0,0];return p.b1(fe,p.b2([],ae,oe)),fe[3]=-p.b3(fe,q[Q[0]]),fe})(C,D),H=(function(q,Q){const ae=p.b7(q),oe=p.b8([],q,1/ae),fe=p.b0([],Q,p.aZ([],oe,p.b3(Q,oe))),de=p.b7(fe);if(de>0){const Me=Math.sqrt(1-oe[3]*oe[3]),be=p.aZ([],oe,-oe[3]),he=p.a_([],be,p.aZ([],fe,Me/de));return p.b9(Q,he)}return null})(B,U);if(H!==null){const q=H/p.b3(Z[0],U);G=Math.min(G,q)}for(let q=0;q<4;q++){const Q=Math.min(G,X[q]);C[q+N]=[C[q+$][0]+Z[q][0]*Q,C[q+$][1]+Z[q][1]*Q,C[q+$][2]+Z[q][2]*Q,1]}})(w,y[0],c,f);const S=y.map((C=>{const D=p.b0([],w[C[0]],w[C[1]]),B=p.b0([],w[C[2]],w[C[1]]),j=p.b1([],p.b2([],D,B)),$=-p.b3(j,w[C[1]]);return j.concat($)})),P=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],E=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const C of w)for(let D=0;D<3;D++)P[D]=Math.min(P[D],C[D]),E[D]=Math.max(E[D],C[D]);return new Ti(w,S,new ar(P,E))}}class fn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,o){this._helper.interpolatePadding(t,n,o)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,o=!0){this._helper.resize(t,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,n){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,o)=>{o=p.al(+o,this.minZoom,this.maxZoom);const c={center:new p.W(n.lng,n.lat),zoom:o};let f=this._helper._lngRange;if(!this._helper._renderWorldCopies&&f===null){const Z=179.9999999999;f=[-Z,Z]}const y=this.tileSize*p.ao(c.zoom);let x=0,w=y,S=0,P=y,E=0,C=0;const{x:D,y:B}=this.size;if(this._helper._latRange){const Z=this._helper._latRange;x=p.Y(Z[1])*y,w=p.Y(Z[0])*y,w-x<B&&(E=B/(w-x))}f&&(S=p.X(p.Z(f[0])*y,0,y),P=p.X(p.Z(f[1])*y,0,y),P<S&&(P+=y),P-S<D&&(C=D/(P-S)));const{x:j,y:$}=Ki(y,n);let N,G;const X=Math.max(C||0,E||0);if(X){const Z=new p.P(C?(P+S)/2:j,E?(w+x)/2:$);return c.center=Nn(y,Z).wrap(),c.zoom+=p.ar(X),c}if(this._helper._latRange){const Z=B/2;$-Z<x&&(G=x+Z),$+Z>w&&(G=w-Z)}if(f){const Z=(S+P)/2;let U=j;this._helper._renderWorldCopies&&(U=p.X(j,Z-y/2,Z+y/2));const H=D/2;U-H<S&&(N=S+H),U+H>P&&(N=P-H)}if(N!==void 0||G!==void 0){const Z=new p.P(N??j,G??$);c.center=Nn(y,Z).wrap()}return c},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new pn({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},t),this._coveringTilesDetailsProvider=new Ms}clone(){const t=new fn;return t.apply(this,!1),t}apply(t,n,o){this._helper.apply(t,n,o)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const n=[new p.ba(0,t)];if(this._helper._renderWorldCopies){const o=this.screenPointToMercatorCoordinate(new p.P(0,0)),c=this.screenPointToMercatorCoordinate(new p.P(this._helper._width,0)),f=this.screenPointToMercatorCoordinate(new p.P(this._helper._width,this._helper._height)),y=this.screenPointToMercatorCoordinate(new p.P(0,this._helper._height)),x=Math.floor(Math.min(o.x,c.x,f.x,y.x)),w=Math.floor(Math.max(o.x,c.x,f.x,y.x)),S=1;for(let P=x-S;P<=w+S;P++)P!==0&&n.push(new p.ba(P,t))}return n}getCameraFrustum(){return Ti.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),o=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(o)}setLocationAtPoint(t,n){const o=p.aq(this.elevation,this.center.lat),c=this.screenPointToMercatorCoordinateAtZ(n,o),f=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,o),y=p.a7.fromLngLat(t),x=new p.a7(y.x-(c.x-f.x),y.y-(c.y-f.y));this.setCenter(x?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(p.a7.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(p.a7.fromLngLat(t))}screenPointToLocation(t,n){var o;return(o=this.screenPointToMercatorCoordinate(t,n))===null||o===void 0?void 0:o.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const o=n.pointCoordinate(t);if(o!=null)return o}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const o=n||0,c=[t.x,t.y,0,1],f=[t.x,t.y,1,1];p.aE(c,c,this._pixelMatrixInverse),p.aE(f,f,this._pixelMatrixInverse);const y=c[3],x=f[3],w=c[1]/y,S=f[1]/x,P=c[2]/y,E=f[2]/x,C=P===E?0:(o-P)/(E-P);return new p.a7(p.H.number(c[0]/y,f[0]/x,C)/this.worldSize,p.H.number(w,S,C)/this.worldSize,o)}coordinatePoint(t,n=0,o=this._pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return p.aE(c,c,o),new p.P(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this._helper._height/2-ln(this));return new Fe().extend(this.screenPointToLocation(new p.P(0,t))).extend(this.screenPointToLocation(new p.P(this._helper._width,t))).extend(this.screenPointToLocation(new p.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new p.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-ln(this)}calculatePosMatrix(t,n=!1,o){var c;const f=(c=t.key)!==null&&c!==void 0?c:p.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),y=n?this._alignedPosMatrixCache:this._posMatrixCache;if(y.has(f)){const S=y.get(f);return o?S.f32:S.f64}const x=Ia(t,this.worldSize);p.U(x,n?this._alignedProjMatrix:this._viewProjMatrix,x);const w={f64:x,f32:new Float32Array(x)};return y.set(f,w),o?w.f32:w.f64}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCacheF32;if(o.has(n))return o.get(n);const c=Ia(t,this.worldSize);return p.U(c,this._fogMatrix,c),o.set(n,new Float32Array(c)),o.get(n)}calculateCenterFromCameraLngLatAlt(t,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,o,c)}_calculateNearFarZIfNeeded(t,n,o){if(!this._helper.autoCalculateNearFarZ)return;const c=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),f=t-c*this._helper._pixelPerMeter/Math.cos(n),y=c<0?f:t,x=Math.PI/2+this.pitchInRadians,w=p.an(this.fov)*(Math.abs(Math.cos(p.an(this.roll)))*this.height+Math.abs(Math.sin(p.an(this.roll)))*this.width)/this.height*(.5+o.y/this.height),S=Math.sin(w)*y/Math.sin(p.al(Math.PI-x-w,.01,Math.PI-.01)),P=ln(this),E=Math.atan(P/this._helper.cameraToCenterDistance),C=p.an(.75),D=E>C?2*E*(.5+o.y/(2*P)):C,B=Math.sin(D)*y/Math.sin(p.al(Math.PI-x-D,.01,Math.PI-.01)),j=Math.min(S,B);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*j+y),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=Ki(this.worldSize,this.center),o=n.x,c=n.y;this._helper._pixelPerMeter=p.aq(1,this.center.lat)*this.worldSize;const f=p.an(Math.min(this.pitch,on)),y=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(f));let x;var w,S;this._calculateNearFarZIfNeeded(y,f,t),x=new Float64Array(16),p.bc(x,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(w=this._invProjMatrix)[0]=1/(S=x)[0],w[1]=0,w[2]=0,w[3]=0,w[4]=0,w[5]=1/S[5],w[6]=0,w[7]=0,w[8]=0,w[9]=0,w[10]=0,w[11]=1/S[14],w[12]=0,w[13]=0,w[14]=-1,w[15]=S[10]/S[14],x[8]=2*-t.x/this._helper._width,x[9]=2*t.y/this._helper._height,this._projectionMatrix=p.bd(x),p.S(x,x,[1,-1,1]),p.Q(x,x,[0,0,-this._helper.cameraToCenterDistance]),p.be(x,x,-this.rollInRadians),p.bf(x,x,this.pitchInRadians),p.be(x,x,-this.bearingInRadians),p.Q(x,x,[-o,-c,0]),this._mercatorMatrix=p.S([],x,[this.worldSize,this.worldSize,this.worldSize]),p.S(x,x,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=p.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,x),p.Q(x,x,[0,0,-this.elevation]),this._viewProjMatrix=x,this._invViewProjMatrix=p.bg([],x);const P=[0,0,-1,1];p.aE(P,P,this._invViewProjMatrix),this._cameraPosition=[P[0]/P[3],P[1]/P[3],P[2]/P[3]],this._fogMatrix=new Float64Array(16),p.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,y,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,p.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),p.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),p.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),p.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),p.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),p.Q(this._fogMatrix,this._fogMatrix,[-o,-c,0]),p.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),p.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=p.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,x);const E=this._helper._width%2/2,C=this._helper._height%2/2,D=Math.cos(this.bearingInRadians),B=Math.sin(-this.bearingInRadians),j=o-Math.round(o)+D*E+B*C,$=c-Math.round(c)+D*C+B*E,N=new Float64Array(x);if(p.Q(N,N,[j>.5?j-1:j,$>.5?$-1:$,0]),this._alignedProjMatrix=N,x=p.bg(new Float64Array(16),this._pixelMatrix),!x)throw new Error("failed to invert matrix");this._pixelMatrixInverse=x,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new p.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return p.aE(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=p.aq(1,this.center.lat)*this.worldSize;return Un(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const o=p.a7.fromLngLat(t),c=[o.x*this.worldSize,o.y*this.worldSize,n,1];return p.aE(c,c,this._viewProjMatrix),c[2]/c[3]}getProjectionData(t){const{overscaledTileID:n,aligned:o,applyTerrainMatrix:c}=t,f=this._helper.getMercatorTileCoordinates(n),y=n?this.calculatePosMatrix(n,o,!0):null;let x;return x=n?.terrainRttPosMatrix32f&&c?n.terrainRttPosMatrix32f:y||p.bh(),{mainMatrix:x,tileMercatorCoords:f,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:x}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,o){return 1}transformLightDirection(t){return p.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,o,c){const f=this.calculatePosMatrix(o);let y;c?(y=[t,n,c(t,n),1],p.aE(y,y,f)):(y=[t,n,0,1],Ss(y,y,f));const x=y[3];return{point:new p.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const o=p.a7.fromLngLat(t,n),c=o.meterInMercatorCoordinateUnits(),f=p.bi();return p.Q(f,f,[o.x,o.y,o.z]),p.be(f,f,Math.PI),p.bf(f,f,Math.PI/2),p.S(f,f,[-c,c,c]),f}getProjectionDataForCustomLayer(t=!0){const n=new p.a3(0,0,0,0,0),o=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),c=Ia(n,this.worldSize);p.U(c,this._viewProjMatrix,c),o.tileMercatorCoords=[0,0,1,1];const f=[p.a6,p.a6,this.worldSize/this._helper.pixelsPerMeter],y=p.bj();return p.S(y,c,f),o.fallbackMatrix=y,o.mainMatrix=y,o}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function fr(){p.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function vc(h){if(h.useSlerp)if(h.k<1){const t=p.bk(h.startEulerAngles.roll,h.startEulerAngles.pitch,h.startEulerAngles.bearing),n=p.bk(h.endEulerAngles.roll,h.endEulerAngles.pitch,h.endEulerAngles.bearing),o=new Float64Array(4);p.bl(o,t,n,h.k);const c=p.bm(o);h.tr.setRoll(c.roll),h.tr.setPitch(c.pitch),h.tr.setBearing(c.bearing)}else h.tr.setRoll(h.endEulerAngles.roll),h.tr.setPitch(h.endEulerAngles.pitch),h.tr.setBearing(h.endEulerAngles.bearing);else h.tr.setRoll(p.H.number(h.startEulerAngles.roll,h.endEulerAngles.roll,h.k)),h.tr.setPitch(p.H.number(h.startEulerAngles.pitch,h.endEulerAngles.pitch,h.k)),h.tr.setBearing(p.H.number(h.startEulerAngles.bearing,h.endEulerAngles.bearing,h.k))}function Qo(h,t,n,o,c){const f=c.padding,y=Ki(c.worldSize,n.getNorthWest()),x=Ki(c.worldSize,n.getNorthEast()),w=Ki(c.worldSize,n.getSouthEast()),S=Ki(c.worldSize,n.getSouthWest()),P=p.an(-o),E=y.rotate(P),C=x.rotate(P),D=w.rotate(P),B=S.rotate(P),j=new p.P(Math.max(E.x,C.x,B.x,D.x),Math.max(E.y,C.y,B.y,D.y)),$=new p.P(Math.min(E.x,C.x,B.x,D.x),Math.min(E.y,C.y,B.y,D.y)),N=j.sub($),G=(c.width-(f.left+f.right+t.left+t.right))/N.x,X=(c.height-(f.top+f.bottom+t.top+t.bottom))/N.y;if(X<0||G<0)return void fr();const Z=Math.min(p.ar(c.scale*Math.min(G,X)),h.maxZoom),U=p.P.convert(h.offset),H=new p.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(p.an(o)),q=U.add(H).mult(c.scale/p.ao(Z));return{center:Nn(c.worldSize,y.add(w).div(2).sub(q)),zoom:Z,bearing:o}}class mn{get useGlobeControls(){return!1}handlePanInertia(t,n){const o=t.mag(),c=Math.abs(ln(n));return{easingOffset:t.mult(Math.min(.75*c/o,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(t,n){t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta),t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta)}handleMapControlsPan(t,n,o){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(o,t.around)}cameraForBoxAndBearing(t,n,o,c,f){return Qo(t,n,o,c,f)}handleJumpToCenterZoom(t,n){t.zoom!==(n.zoom!==void 0?+n.zoom:t.zoom)&&t.setZoom(+n.zoom),n.center!==void 0&&t.setCenter(p.W.convert(n.center))}handleEaseTo(t,n){const o=t.zoom,c=t.padding,f={roll:t.roll,pitch:t.pitch,bearing:t.bearing},y={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},x=n.zoom!==void 0,w=!t.isPaddingEqual(n.padding);let S=!1;const P=x?+n.zoom:t.zoom;let E=t.centerPoint.add(n.offsetAsPoint);const C=t.screenPointToLocation(E),{center:D,zoom:B}=t.applyConstrain(p.W.convert(n.center||C),P??o);jr(t,D);const j=Ki(t.worldSize,C),$=Ki(t.worldSize,D).sub(j),N=p.ao(B-o);return S=B!==o,{easeFunc:G=>{if(S&&t.setZoom(p.H.number(o,B,G)),p.bn(f,y)||vc({startEulerAngles:f,endEulerAngles:y,tr:t,k:G,useSlerp:f.roll!=y.roll}),w&&(t.interpolatePadding(c,n.padding,G),E=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const X=p.ao(t.zoom-o),Z=B>o?Math.min(2,N):Math.max(.5,N),U=Math.pow(Z,1-G),H=Nn(t.worldSize,j.add($.mult(G*U)).mult(X));t.setLocationAtPoint(t.renderWorldCopies?H.wrap():H,E)}},isZooming:S,elevationCenter:D}}handleFlyTo(t,n){const o=n.zoom!==void 0,c=t.zoom,f=t.applyConstrain(p.W.convert(n.center||n.locationAtOffset),o?+n.zoom:c),y=f.center,x=f.zoom;jr(t,y);const w=Ki(t.worldSize,n.locationAtOffset),S=Ki(t.worldSize,y).sub(w),P=S.mag(),E=p.ao(x-c);let C;if(n.minZoom!==void 0){const D=Math.min(+n.minZoom,c,x),B=t.applyConstrain(y,D).zoom;C=p.ao(B-c)}return{easeFunc:(D,B,j,$)=>{t.setZoom(D===1?x:c+p.ar(B));const N=D===1?y:Nn(t.worldSize,w.add(S.mult(j)).mult(B));t.setLocationAtPoint(t.renderWorldCopies?N.wrap():N,$)},scaleOfZoom:E,targetCenter:y,scaleOfMinZoom:C,pixelPathLength:P}}}class ut{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}ut.Replace=[1,0],ut.disabled=new ut(ut.Replace,p.bo.transparent,[!1,!1,!1,!1]),ut.unblended=new ut(ut.Replace,p.bo.transparent,[!0,!0,!0,!0]),ut.alphaBlended=new ut([1,771],p.bo.transparent,[!0,!0,!0,!0]);const Xn=2305;class Xe{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}Xe.disabled=new Xe(!1,1029,Xn),Xe.backCCW=new Xe(!0,1029,Xn),Xe.frontCCW=new Xe(!0,1028,Xn);class Ue{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}Ue.ReadOnly=!1,Ue.ReadWrite=!0,Ue.disabled=new Ue(519,Ue.ReadOnly,[0,1]);const Yn=7680;class Ke{constructor(t,n,o,c,f,y){this.test=t,this.ref=n,this.mask=o,this.fail=c,this.depthFail=f,this.pass=y}}function Qi(h){return typeof WebGL2RenderingContext<"u"&&h instanceof WebGL2RenderingContext}Ke.disabled=new Ke({func:519,mask:0},0,0,Yn,Yn,Yn);class Kn{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const n=t.context,o=n.gl;this._texFormat=o.RGBA,this._texType=o.UNSIGNED_BYTE;const c=new p.aU;c.emplaceBack(-1,-1),c.emplaceBack(2,-1),c.emplaceBack(-1,2);const f=new p.aW;f.emplaceBack(0,1,2),this._fullscreenTriangle=new ct(n.createVertexBuffer(c,Or.members),n.createIndexBuffer(f),p.aV.simpleSegment(0,0,c.length,f.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(o.TEXTURE1);const y=o.createTexture();o.bindTexture(o.TEXTURE_2D,y),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texImage2D(o.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(y),Qi(o)&&(this._pbo=o.createBuffer(),o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.bufferData(o.PIXEL_PACK_BUFFER,4,o.STREAM_READ),o.bindBuffer(o.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,n){const o=this._updateCount;return this._readbackQueue?o>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():o>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,n=t.gl;t.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,n){const o=this._cachedRenderContext.context,c=o.gl;if(this._bindFramebuffer(),o.viewport.set([0,0,this._texWidth,this._texHeight]),o.clear({color:p.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(o,c.TRIANGLES,Ue.disabled,Ke.disabled,ut.unblended,Xe.disabled,((f,y)=>({u_input:f,u_output_expected:y}))(t,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Qi(c)){c.bindBuffer(c.PIXEL_PACK_BUFFER,this._pbo),c.readBuffer(c.COLOR_ATTACHMENT0),c.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null);const f=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:f}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Qi(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return p.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Kn._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let n=0;return n+=t[0]/256,n+=t[1]/65536,n+=t[2]/16777216,t[3]<127&&(n=-n),n/128}}const _n=p.a6/128;function Jn(h,t){const n=h.granularity!==void 0?Math.max(h.granularity,1):1,o=n+(h.generateBorders?2:0),c=n+(h.extendToNorthPole||h.generateBorders?1:0)+(h.extendToSouthPole||h.generateBorders?1:0),f=o+1,y=c+1,x=h.generateBorders?-1:0,w=h.generateBorders||h.extendToNorthPole?-1:0,S=n+(h.generateBorders?1:0),P=n+(h.generateBorders||h.extendToSouthPole?1:0),E=f*y,C=o*c*6,D=f*y>65536;if(D&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const B=D||t==="32bit",j=new Int16Array(2*E);let $=0;for(let X=w;X<=P;X++)for(let Z=x;Z<=S;Z++){let U=Z/n*p.a6;Z===-1&&(U=-_n),Z===n+1&&(U=p.a6+_n);let H=X/n*p.a6;X===-1&&(H=h.extendToNorthPole?p.bq:-_n),X===n+1&&(H=h.extendToSouthPole?p.br:p.a6+_n),j[$++]=U,j[$++]=H}const N=B?new Uint32Array(C):new Uint16Array(C);let G=0;for(let X=0;X<c;X++)for(let Z=0;Z<o;Z++){const U=Z+1+X*f,H=Z+(X+1)*f,q=Z+1+(X+1)*f;N[G++]=Z+X*f,N[G++]=H,N[G++]=U,N[G++]=U,N[G++]=H,N[G++]=q}return{vertices:j.buffer.slice(0),indices:N.buffer.slice(0),uses32bitIndices:B}}const el=new p.aT({fill:new p.bs(128,2),line:new p.bs(512,0),tile:new p.bs(128,32),stencil:new p.bs(128,1),circle:3});class Es{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return _t.projectionGlobe}get vertexShaderPreludeCode(){return _t.projectionMercator.vertexSource}get subdivisionGranularity(){return el}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new Kn(t));const n=p.Y(this._errorQueryLatitudeDegrees),o=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,c=this._errorMeasurement.updateErrorLoop(n,o),f=Je();c!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=c,this._errorMeasurementLastChangeTime=f);const y=Math.min(Math.max((f-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=p.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,p.bu(y))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,o,c,f){const y=(f==="stencil"?el.stencil:el.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:y,generateBorders:o,extendToNorthPole:n.y===0&&c,extendToSouthPole:n.y===(1<<n.z)-1&&c})}_getMesh(t,n){const o=this._getMeshKey(n);if(o in this._tileMeshCache)return this._tileMeshCache[o];const c=(function(f,y){const x=Jn(y,"16bit"),w=p.aU.deserialize({arrayBuffer:x.vertices,length:x.vertices.byteLength/2/2}),S=p.aW.deserialize({arrayBuffer:x.indices,length:x.indices.byteLength/2/3});return new ct(f.createVertexBuffer(w,Or.members),f.createIndexBuffer(S),p.aV.simpleSegment(0,0,w.length,S.length))})(t,n);return this._tileMeshCache[o]=c,c}recalculate(t){}hasTransition(){var t;const n=Je();let o=!1;return o||(o=(n-this._errorMeasurementLastChangeTime)/1e3<.7),o||(o=(t=this._errorMeasurement)===null||t===void 0?void 0:t.awaitingQuery),o}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const xc=new p.u({type:new p.D(p.x.projection.type)});class bc extends p.E{constructor(t){super(),this._transitionable=new p.y(xc,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.J(0)),this._mercatorProjection=new hi,this._verticalPerspectiveProjection=new Es}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof p.bv){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,n,o,c,f){return this.currentProjection.getMeshFromTileID(t,n,o,c,f)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function wc(h){const t=Di(h.worldSize,h.center.lat);return 2*Math.PI*t}function At(h,t,n,o,c){const f=1/(1<<c),y=t/p.a6*f+o*f,x=p.by((h/p.a6*f+n*f)*Math.PI*2+Math.PI,2*Math.PI),w=2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI,S=Math.cos(w),P=new Float64Array(3);return P[0]=Math.sin(x)*S,P[1]=Math.sin(w),P[2]=Math.cos(x)*S,P}function Vt(h){return(function(t,n){const o=Math.cos(n),c=new Float64Array(3);return c[0]=Math.sin(t)*o,c[1]=Math.sin(n),c[2]=Math.cos(t)*o,c})(h.lng*Math.PI/180,h.lat*Math.PI/180)}function Di(h,t){return h/(2*Math.PI)/Math.cos(t*Math.PI/180)}function La(h){const t=Math.asin(h[1])/Math.PI*180,n=Math.sqrt(h[0]*h[0]+h[2]*h[2]);if(n>1e-6){const o=h[0]/n,c=Math.acos(h[2]/n),f=(o>0?c:-c)/Math.PI*180;return new p.W(p.X(f,-180,180),t)}return new p.W(0,t)}function Fa(h){return Math.cos(h*Math.PI/180)}function Bt(h,t){const n=Fa(h),o=Fa(t);return p.ar(o/n)}function gn(h,t){const n=h.rotate(t.bearingInRadians),o=t.zoom+Bt(t.center.lat,0),c=p.bt(1/Fa(t.center.lat),1/Fa(Math.min(Math.abs(t.center.lat),60)),p.bw(o,7,3,0,1)),f=360/wc({worldSize:t.worldSize,center:{lat:t.center.lat}});return new p.W(t.center.lng-n.x*f*c,p.al(t.center.lat+n.y*f,-p.am,p.am))}function tl(h){const t=.5*h,n=Math.sin(t),o=Math.cos(t);return Math.log(n+o)-Math.log(o-n)}function Tc(h,t,n,o){const c=h.lat+n*o;if(Math.abs(n)>1){const f=(Math.sign(h.lat+n)!==Math.sign(h.lat)?-Math.abs(h.lat):Math.abs(h.lat))*Math.PI/180,y=Math.abs(h.lat+n)*Math.PI/180,x=tl(f+o*(y-f)),w=tl(f),S=tl(y);return new p.W(h.lng+t*((x-w)/(S-w)),c)}return new p.W(h.lng+t*o,c)}class Uu{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,n,o,c){const f=`${t.z}_${t.x}_${t.y}_${c?.terrain?"t":""}`,y=this._cache.get(f);if(y)return y;const x=this._cachePrevious.get(f);if(x)return this._cache.set(f,x),x;const w=this._boundingVolumeFactory(t,n,o,c);return this._cache.set(f,w),this._hadAnyChanges=!0,w}}class Qn{constructor(t,n,o,c){this.min=o,this.max=c,this.points=t,this.planes=n}static fromAabb(t,n){const o=[];for(let c=0;c<8;c++)o.push([1&~c?t[0]:n[0],(c>>1&1)==1?n[1]:t[1],(c>>2&1)==1?n[2]:t[2]]);return new Qn(o,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,o){const c=p.bA([],o[0],o[1],o[2]),f=p.bB([],[n[0],0,0],c),y=p.bB([],[0,n[1],0],c),x=p.bB([],[0,0,n[2]],c),w=[...t],S=[...t];for(let E=0;E<8;E++)for(let C=0;C<3;C++){const D=t[C]+f[C]*(1&~E?-1:1)+y[C]*((E>>1&1)==1?1:-1)+x[C]*((E>>2&1)==1?1:-1);w[C]=Math.min(w[C],D),S[C]=Math.max(S[C],D)}const P=[];for(let E=0;E<8;E++){const C=[...t];p.a_(C,C,p.aZ([],f,1&~E?-1:1)),p.a_(C,C,p.aZ([],y,(E>>1&1)==1?1:-1)),p.a_(C,C,p.aZ([],x,(E>>2&1)==1?1:-1)),P.push(C)}return new Qn(P,[[...f,-p.b3(f,P[0])],[...y,-p.b3(y,P[0])],[...x,-p.b3(x,P[0])],[-f[0],-f[1],-f[2],-p.b3(f,P[7])],[-y[0],-y[1],-y[2],-p.b3(y,P[7])],[-x[0],-x[1],-x[2],-p.b3(x,P[7])]],w,S)}intersectsFrustum(t){let n=!0;const o=this.points.length,c=this.planes.length,f=t.planes.length,y=t.points.length;for(let x=0;x<f;x++){const w=t.planes[x];let S=0;for(let P=0;P<o;P++){const E=this.points[P];w[0]*E[0]+w[1]*E[1]+w[2]*E[2]+w[3]>=0&&S++}if(S===0)return 0;S<o&&(n=!1)}if(n)return 2;for(let x=0;x<c;x++){const w=this.planes[x];let S=0;for(let P=0;P<y;P++){const E=t.points[P];w[0]*E[0]+w[1]*E[1]+w[2]*E[2]+w[3]>=0&&S++}if(S===0)return 0}return 1}intersectsPlane(t){const n=this.points.length;let o=0;for(let c=0;c<n;c++){const f=this.points[c];t[0]*f[0]+t[1]*f[1]+t[2]*f[2]+t[3]>=0&&o++}return o===n?2:o===0?0:1}}function Cs(h,t,n){const o=h-t;return o<0?-o:Math.max(0,o-n)}function il(h,t,n,o,c){const f=h-n;let y;return y=f<0?Math.min(-f,1+f-c):f>c?Math.min(Math.max(f-c,0),1-f):0,Math.max(y,Cs(t,o,c))}class As{constructor(){this._boundingVolumeCache=new Uu(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,o,c){const f=1<<o.z,y=1/f,x=o.x/f,w=o.y/f;let S=2;return S=Math.min(S,il(t,n,x,w,y)),S=Math.min(S,il(t,n,x+.5,-w-y,y)),S=Math.min(S,il(t,n,x+.5,2-w-y,y)),S}getWrap(t,n,o){const c=1<<n.z,f=1/c,y=n.x/c,x=Cs(t.x,y,f),w=Cs(t.x,y-1,f),S=Cs(t.x,y+1,f),P=Math.min(x,w,S);return P===S?1:P===w?-1:0}allowVariableZoom(t,n){return bi(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,o,c){return this._boundingVolumeCache.getTileBoundingVolume(t,n,o,c)}_computeTileBoundingVolume(t,n,o,c){var f,y;let x=0,w=0;if(c?.terrain){const S=new p.a3(t.z,n,t.z,t.x,t.y),P=c.terrain.getMinMaxElevation(S);x=(f=P.minElevation)!==null&&f!==void 0?f:Math.min(0,o),w=(y=P.maxElevation)!==null&&y!==void 0?y:Math.max(0,o)}if(x/=p.bD,w/=p.bD,x+=1,w+=1,t.z<=0)return Qn.fromAabb([-w,-w,-w],[w,w,w]);if(t.z===1)return Qn.fromAabb([t.x===0?-w:0,t.y===0?0:-w,-w],[t.x===0?0:w,t.y===0?w:0,w]);{const S=[At(0,0,t.x,t.y,t.z),At(p.a6,0,t.x,t.y,t.z),At(p.a6,p.a6,t.x,t.y,t.z),At(0,p.a6,t.x,t.y,t.z)],P=[];for(const fe of S)P.push(p.aZ([],fe,w));if(w!==x)for(const fe of S)P.push(p.aZ([],fe,x));t.y===0&&P.push([0,1,0]),t.y===(1<<t.z)-1&&P.push([0,-1,0]);const E=[1,1,1],C=[-1,-1,-1];for(const fe of P)for(let de=0;de<3;de++)E[de]=Math.min(E[de],fe[de]),C[de]=Math.max(C[de],fe[de]);const D=At(p.a6/2,p.a6/2,t.x,t.y,t.z),B=p.b2([],[0,1,0],D);p.b1(B,B);const j=p.b2([],D,B);p.b1(j,j);const $=p.b2([],S[2],S[1]);p.b1($,$);const N=p.b2([],S[0],S[3]);p.b1(N,N),P.push(p.aZ([],D,w)),t.y>=(1<<t.z)/2&&P.push(p.aZ([],At(p.a6/2,0,t.x,t.y,t.z),w)),t.y<(1<<t.z)/2&&P.push(p.aZ([],At(p.a6/2,p.a6,t.x,t.y,t.z),w));const G=zs(D,P),X=zs(j,P),Z=[-D[0],-D[1],-D[2],G.max],U=[D[0],D[1],D[2],-G.min],H=[-j[0],-j[1],-j[2],X.max],q=[j[0],j[1],j[2],-X.min],Q=[...$,0],ae=[...N,0],oe=[];return t.y===0?oe.push(p.bC(ae,Q,Z),p.bC(ae,Q,U)):oe.push(p.bC(H,Q,Z),p.bC(H,Q,U),p.bC(H,ae,Z),p.bC(H,ae,U)),t.y===(1<<t.z)-1?oe.push(p.bC(ae,Q,Z),p.bC(ae,Q,U)):oe.push(p.bC(q,Q,Z),p.bC(q,Q,U),p.bC(q,ae,Z),p.bC(q,ae,U)),new Qn(oe,[Z,U,H,q,Q,ae],E,C)}}}function zs(h,t){let n=1/0,o=-1/0;for(const c of t){const f=p.b3(h,c);n=Math.min(n,f),o=Math.max(o,f)}return{min:n,max:o}}class yn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,o){this._helper.interpolatePadding(t,n,o)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n){this._helper.resize(t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=p.bE(),this._projectionMatrix=p.bi(),this._globeViewProjMatrix32f=p.bh(),this._globeViewProjMatrixNoCorrection=p.bi(),this._globeViewProjMatrixNoCorrectionInverted=p.bi(),this._globeProjMatrixInverted=p.bi(),this._cameraPosition=p.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,o)=>{const c=p.al(n.lat,-p.am,p.am),f=p.al(+o,this.minZoom+Bt(0,c),this.maxZoom);return{center:new p.W(n.lng,c),zoom:f}},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new pn({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},t),this._coveringTilesDetailsProvider=new As}clone(){const t=new yn;return t.apply(this,!1),t}apply(t,n,o){this._globeLatitudeErrorCorrectionRadians=o||0,this._helper.apply(t,n)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=p.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:n,applyGlobeMatrix:o}=t,c=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:c,clippingPlane:this._cachedClippingPlane,projectionTransition:o?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,o=this.cameraToCenterDistance/t,c=Math.sin(n)*o,f=Math.cos(n)*o+1,y=1/Math.sqrt(c*c+f*f)*1;let x=-c,w=f;const S=Math.sqrt(x*x+w*w);x/=S,w/=S;const P=[0,x,w];p.bF(P,P,[0,0,0],-this.bearingInRadians),p.bG(P,P,[0,0,0],-1*this.center.lat*Math.PI/180),p.bH(P,P,[0,0,0],this.center.lng*Math.PI/180);const E=1/p.b5(P);return p.aZ(P,P,E),[...P,-y*E]}isLocationOccluded(t){return!this.isSurfacePointVisible(Vt(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,o=this._helper._center.lat*Math.PI/180,c=Math.cos(o),f=[Math.sin(n)*c,Math.sin(o),Math.cos(n)*c],y=[f[2],0,-f[0]],x=[0,0,0];p.b2(x,y,f),p.b1(y,y),p.b1(x,x);const w=[0,0,0];return p.b1(w,[y[0]*t[0]+x[0]*t[1]+f[0]*t[2],y[1]*t[0]+x[1]*t[1]+f[1]*t[2],y[2]*t[0]+x[2]*t[1]+f[2]*t[2]]),w}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,n,o){const c=(function(x,w,S){const P=1/(1<<S.z);return new p.a7(x/p.a6*P+S.x*P,w/p.a6*P+S.y*P)})(t,n,o.canonical),f=(y=c.y,[p.by(c.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI]);var y;return this.getCircleRadiusCorrection()/Math.cos(f[1])}projectTileCoordinates(t,n,o,c){const f=o.canonical,y=At(t,n,f.x,f.y,f.z),x=1+(c?c(t,n):0)/p.bD,w=[y[0]*x,y[1]*x,y[2]*x,1];p.aE(w,w,this._globeViewProjMatrixNoCorrection);const S=this._cachedClippingPlane,P=S[0]*y[0]+S[1]*y[1]+S[2]*y[2]+S[3]<0;return{point:new p.P(w[0]/w[3],w[1]/w[3]),signedDistanceFromCamera:w[3],isOccluded:P}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=Di(this.worldSize,this.center.lat),n=p.bj(),o=p.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),p.bc(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const c=this.centerOffset;n[8]=2*-c.x/this._helper._width,n[9]=2*c.y/this._helper._height,this._projectionMatrix=p.bd(n),this._globeProjMatrixInverted=p.bj(),p.bg(this._globeProjMatrixInverted,n),p.Q(n,n,[0,0,-this.cameraToCenterDistance]),p.be(n,n,this.rollInRadians),p.bf(n,n,-this.pitchInRadians),p.be(n,n,this.bearingInRadians),p.Q(n,n,[0,0,-t]);const f=p.bz();f[0]=t,f[1]=t,f[2]=t,p.bf(o,n,this.center.lat*Math.PI/180),p.bI(o,o,-this.center.lng*Math.PI/180),p.S(o,o,f),this._globeViewProjMatrixNoCorrection=o,p.bf(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),p.bI(n,n,-this.center.lng*Math.PI/180),p.S(n,n,f),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=p.bj(),p.bg(this._globeViewProjMatrixNoCorrectionInverted,o);const y=p.bz();this._cameraPosition=p.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,p.bF(this._cameraPosition,this._cameraPosition,y,-this.rollInRadians),p.bG(this._cameraPosition,this._cameraPosition,y,this.pitchInRadians),p.bF(this._cameraPosition,this._cameraPosition,y,-this.bearingInRadians),p.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),p.bG(this._cameraPosition,this._cameraPosition,y,-this.center.lat*Math.PI/180),p.bH(this._cameraPosition,this._cameraPosition,y,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const x=p.bd(this._globeViewProjMatrixNoCorrectionInverted);p.S(x,x,[1,1,-1]),this._cachedFrustum=Ti.fromInvProjectionMatrix(x,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){p.w("calculateFogMatrix is not supported on globe projection.");const n=p.bj();return p.ap(n),n}getVisibleUnwrappedCoordinates(t){return[new p.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&p.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const o=Vt(t);p.aZ(o,o,1+n/p.bD);const c=p.bE();return p.aE(c,[o[0],o[1],o[2],1],this._globeViewProjMatrixNoCorrection),c[2]/c[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,o=[new p.P(0,0),new p.P(t,0),new p.P(this.width,0),new p.P(this.width,n),new p.P(this.width,this.height),new p.P(t,this.height),new p.P(0,this.height),new p.P(0,n)],c=[];for(const E of o)c.push(this.unprojectScreenPoint(E));let f=0,y=0,x=0,w=0;const S=this.center;for(const E of c){const C=p.bJ(S.lng,E.lng),D=p.bJ(S.lat,E.lat);C<y&&(y=C),C>f&&(f=C),D<w&&(w=D),D>x&&(x=D)}const P=[S.lng+y,S.lat+w,S.lng+f,S.lat+x];return this.isSurfacePointOnScreen([0,1,0])&&(P[3]=90,P[0]=-180,P[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(P[1]=-90,P[0]=-180,P[2]=180),new Fe(P)}calculateCenterFromCameraLngLatAlt(t,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,o,c)}setLocationAtPoint(t,n){const o=Vt(this.unprojectScreenPoint(n)),c=Vt(t),f=p.bz();p.bK(f);const y=p.bz();p.bH(y,o,f,-this.center.lng*Math.PI/180),p.bG(y,y,f,this.center.lat*Math.PI/180);const x=c[0]*c[0]+c[2]*c[2],w=y[0]*y[0];if(x<w)return;const S=Math.sqrt(x-w),P=-S,E=p.bL(c[0],c[2],y[0],S),C=p.bL(c[0],c[2],y[0],P),D=p.bz();p.bH(D,c,f,-E);const B=p.bL(D[1],D[2],y[1],y[2]),j=p.bz();p.bH(j,c,f,-C);const $=p.bL(j[1],j[2],y[1],y[2]),N=.5*Math.PI,G=B>=-N&&B<=N,X=$>=-N&&$<=N;let Z,U;if(G&&X){const ae=this.center.lng*Math.PI/180,oe=this.center.lat*Math.PI/180;p.bM(E,ae)+p.bM(B,oe)<p.bM(C,ae)+p.bM($,oe)?(Z=E,U=B):(Z=C,U=$)}else if(G)Z=E,U=B;else{if(!X)return;Z=C,U=$}const H=Z/Math.PI*180,q=U/Math.PI*180,Q=this.center.lat;this.setCenter(new p.W(H,p.al(q,-90,90))),this.setZoom(this.zoom+Bt(Q,this.center.lat))}locationToScreenPoint(t,n){const o=Vt(t);if(n){const c=n.getElevationForLngLatZoom(t,this._helper._tileZoom);p.aZ(o,o,1+c/p.bD)}return this._projectSurfacePointToScreen(o)}_projectSurfacePointToScreen(t){const n=p.bE();return p.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new p.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const o=n.pointCoordinate(t);if(o)return o}return p.a7.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var o;return(o=this.screenPointToMercatorCoordinate(t,n))===null||o===void 0?void 0:o.toLngLat()}isPointOnMapSurface(t,n){const o=this._cameraPosition,c=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(o,c)}getRayDirectionFromPixel(t){const n=p.bE();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,p.aE(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const o=p.bz();o[0]=n[0]-this._cameraPosition[0],o[1]=n[1]-this._cameraPosition[1],o[2]=n[2]-this._cameraPosition[2];const c=p.bz();return p.b1(c,o),c}isSurfacePointVisible(t){const n=this._cachedClippingPlane;return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const n=p.bE();return p.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(t,n){const o=p.b3(t,n),c=p.bz(),f=p.bz();p.aZ(f,n,o),p.b0(c,t,f);const y=1-p.b3(c,c);if(y<0)return null;const x=p.b3(t,t)-1,w=-o+(o<0?1:-1)*Math.sqrt(y),S=x/w,P=w;return{tMin:Math.min(S,P),tMax:Math.max(S,P)}}unprojectScreenPoint(t){const n=this._cameraPosition,o=this.getRayDirectionFromPixel(t),c=this.rayPlanetIntersection(n,o);if(c){const P=p.bz();p.a_(P,n,[o[0]*c.tMin,o[1]*c.tMin,o[2]*c.tMin]);const E=p.bz();return p.b1(E,P),La(E)}const f=this._cachedClippingPlane,y=f[0]*o[0]+f[1]*o[1]+f[2]*o[2],x=-p.b9(f,n)/y,w=p.bz();if(x>0)p.a_(w,n,[o[0]*x,o[1]*x,o[2]*x]);else{const P=p.bz();p.a_(P,n,[2*o[0],2*o[1],2*o[2]]);const E=p.b9(this._cachedClippingPlane,P);p.b0(w,P,[this._cachedClippingPlane[0]*E,this._cachedClippingPlane[1]*E,this._cachedClippingPlane[2]*E]
vendor: 8,475 bytes, line 810
810)}const S=(function(P){const E=p.bz();return E[0]=P[0]*-P[3],E[1]=P[1]*-P[3],E[2]=P[2]*-P[3],{center:E,radius:Math.sqrt(1-P[3]*P[3])}})(f);return La((function(P,E,C){const D=p.bz();p.b0(D,C,P);const B=p.bz();return p.bx(B,P,D,E/p.b7(D)),B})(S.center,S.radius,w))}getMatrixForModel(t,n){const o=p.W.convert(t),c=1/p.bD,f=p.bi();return p.bI(f,f,o.lng/180*Math.PI),p.bf(f,f,-o.lat/180*Math.PI),p.Q(f,f,[0,0,1+n/p.bD]),p.bf(f,f,.5*Math.PI),p.S(f,f,[c,c,c]),f}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new p.a3(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class ea{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,o){this._helper.interpolatePadding(t,n,o)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,o=!0){this._helper.resize(t,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,n){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,o)=>this.currentTransform.defaultConstrain(n,o),this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new pn({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},t),this._globeness=1,this._mercatorTransform=new fn,this._verticalPerspectiveTransform=new yn}clone(){const t=new ea;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,n){this._helper.apply(t,n),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const n=this._mercatorTransform.getProjectionData(t),o=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?o.mainMatrix:n.mainMatrix,clippingPlane:o.clippingPlane,tileMercatorCoords:o.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return p.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return p.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,o){const c=this._mercatorTransform.getPitchedTextCorrection(t,n,o),f=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,o);return p.bt(c,f,this._globeness)}projectTileCoordinates(t,n,o,c){return this.currentTransform.projectTileCoordinates(t,n,o,c)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){return this.currentTransform.lngLatToCameraDepth(t,n)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,o,c)}setLocationAtPoint(t,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,n),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,n){return this.currentTransform.locationToScreenPoint(t,n)}screenPointToMercatorCoordinate(t,n){return this.currentTransform.screenPointToMercatorCoordinate(t,n)}screenPointToLocation(t,n){return this.currentTransform.screenPointToLocation(t,n)}
vendor: 8,187 bytes, line 810
810isPointOnMapSurface(t,n){return this.currentTransform.isPointOnMapSurface(t,n)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,n){return this.currentTransform.getMatrixForModel(t,n)}getProjectionDataForCustomLayer(t=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return n;const o=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return o.fallbackMatrix=n.mainMatrix,o}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class ki{get useGlobeControls(){return!0}handlePanInertia(t,n){const o=gn(t,n);return Math.abs(o.lng-n.center.lng)>180&&(o.lng=n.center.lng+179.5*Math.sign(o.lng-n.center.lng)),{easingCenter:o,easingOffset:new p.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const o=t.around,c=n.screenPointToLocation(o);t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta);const f=n.zoom;t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta);const y=n.zoom-f;if(y===0)return;const x=p.bJ(n.center.lng,c.lng),w=x/(Math.abs(x/180)+1),S=p.bJ(n.center.lat,c.lat),P=n.getRayDirectionFromPixel(o),E=n.cameraPosition,C=-1*p.b3(E,P),D=p.bz();p.a_(D,E,[P[0]*C,P[1]*C,P[2]*C]);const B=p.b5(D)-1,j=Math.exp(.5*-Math.max(B-.3,0)),$=Di(n.worldSize,n.center.lat)/Math.min(n.width,n.height),N=p.bw($,.9,.5,1,.25),G=(1-p.ao(-y))*Math.min(j,N),X=n.center.lat,Z=n.zoom,U=new p.W(n.center.lng+w*G,p.al(n.center.lat+S*G,-p.am,p.am));n.setLocationAtPoint(c,o);const H=n.center,q=p.bw(Math.abs(x),45,85,0,1),Q=p.bw($,.75,.35,0,1),ae=Math.pow(Math.max(q,Q),.25),oe=p.bJ(H.lng,U.lng),fe=p.bJ(H.lat,U.lat);n.setCenter(new p.W(H.lng+oe*ae,H.lat+fe*ae).wrap()),n.setZoom(Z+Bt(X,n.center.lat))}handleMapControlsPan(t,n,o){if(!t.panDelta)return;const c=n.center.lat,f=n.zoom;n.setCenter(gn(t.panDelta,n).wrap()),n.setZoom(f+Bt(c,n.center.lat))}cameraForBoxAndBearing(t,n,o,c,f){const y=Qo(t,n,o,c,f),x=n.left/f.width*2-1,w=(f.width-n.right)/f.width*2-1,S=n.top/f.height*-2+1,P=(f.height-n.bottom)/f.height*-2+1,E=p.bJ(o.getWest(),o.getEast())<0,C=E?o.getEast():o.getWest(),D=E?o.getWest():o.getEast(),B=Math.max(o.getNorth(),o.getSouth()),j=Math.min(o.getNorth(),o.getSouth()),$=C+.5*p.bJ(C,D),N=B+.5*p.bJ(B,j),G=f.clone();G.setCenter(y.center),G.setBearing(y.bearing),G.setPitch(0),G.setRoll(0),G.setZoom(y.zoom);const X=G.modelViewProjectionMatrix,Z=[Vt(o.getNorthWest()),Vt(o.getNorthEast()),Vt(o.getSouthWest()),Vt(o.getSouthEast()),Vt(new p.W(D,N)),Vt(new p.W(C,N)),Vt(new p.W($,B)),Vt(new p.W($,j))],U=Vt(y.center);let H=Number.POSITIVE_INFINITY;for(const q of Z)x<0&&(H=ki.getLesserNonNegativeNonNull(H,ki.solveVectorScale(q,U,X,"x",x))),w>0&&(H=ki.getLesserNonNegativeNonNull(H,ki.solveVectorScale(q,U,X,"x",w))),S>0&&(H=ki.getLesserNonNegativeNonNull(H,ki.solveVectorScale(q,U,X,"y",S))),P<0&&(H=ki.getLesserNonNegativeNonNull(H,ki.solveVectorScale(q,U,X,"y",P)));if(Number.isFinite(H)&&H!==0)return y.zoom=Math.min(G.zoom+p.ar(H),t.maxZoom),y;fr()}handleJumpToCenterZoom(t,n){const o=t.center.lat,c=t.applyConstrain(n.center?p.W.convert(n.center):t.center,t.zoom).center;t.setCenter(c.wrap());const f=n.zoom!==void 0?+n.zoom:t.zoom+Bt(o,c.lat);t.zoom!==f&&t.setZoom(f)}handleEaseTo(t,n){const o=t.zoom,c=t.center,f=t.padding,y={roll:t.roll,pitch:t.pitch,bearing:t.bearing},x={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},w=n.zoom!==void 0,S=!t.isPaddingEqual(n.padding);let P=!1;const E=n.center?p.W.convert(n.center):c,C=t.applyConstrain(E,o).center;jr(t,C);const D=t.clone();D.setCenter(C),D.setZoom(w?+n.zoom:o+Bt(c.lat,E.lat)),D.setBearing(n.bearing);const B=new p.P(p.al(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),p.al(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));D.setLocationAtPoint(C,B);const j=(n.offset&&n.offsetAsPoint.mag())>0?D.center:C,$=w?+n.zoom:o+Bt(c.lat,j.lat),N=o+Bt(c.lat,0),G=$+Bt(j.lat,0),X=p.bJ(c.lng,j.lng),Z=p.bJ(c.lat,j.lat),U=p.ao(G-N);return P=$!==o,{easeFunc:H=>{if(p.bn(y,x)||vc({startEulerAngles:y,endEulerAngles:x,tr:t,k:H,useSlerp:y.roll!=x.roll}),S&&t.interpolatePadding(f,n.padding,H),n.around)p.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const q=G>N?Math.min(2,U):Math.max(.5,U),Q=Math.pow(q,1-H),ae=Tc(c,X,Z,H*Q);t.setCenter(ae.wrap())}if(P){const q=p.H.number(N,G,H)+Bt(0,t.center.lat);t.setZoom(q)}},isZooming:P,elevationCenter:j}}handleFlyTo(t,n){const o=n.zoom!==void 0,c=t.center,f=t.zoom,y=t.padding,x=!t.isPaddingEqual(n.padding),w=t.applyConstrain(p.W.convert(n.center||n.locationAtOffset),f).center,S=o?+n.zoom:t.zoom+Bt(t.center.lat,w.lat),P=t.clone();P.setCenter(w),P.setZoom(S),P.setBearing(n.bearing);const E=new p.P(p.al(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),p.al(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));P.setLocationAtPoint(w,E);const C=P.center;jr(t,C);const D=(function(Z,U,H){const q=Vt(U),Q=Vt(H),ae=p.b3(q,Q),oe=Math.acos(ae),fe=wc(Z);return oe/(2*Math.PI)*fe})(t,c,C),B=f+Bt(c.lat,0),j=S+Bt(C.lat,0),$=p.ao(j-B);let N;if(typeof n.minZoom=="number"){const Z=+n.minZoom+Bt(C.lat,0),U=Math.min(Z,B,j)+Bt(0,C.lat),H=t.applyConstrain(C,U).zoom+Bt(C.lat,0);N=p.ao(H-B)}const G=p.bJ(c.lng,C.lng),X=p.bJ(c.lat,C.lat);return{easeFunc:(Z,U,H,q)=>{const Q=Tc(c,G,X,H);x&&t.interpolatePadding(y,n.padding,Z);const ae=Z===1?C:Q;t.setCenter(ae.wrap());const oe=B+p.ar(U);t.setZoom(Z===1?S:oe+Bt(0,ae.lat))},scaleOfZoom:$,targetCenter:C,scaleOfMinZoom:N,pixelPathLength:D}}static solveVectorScale(t,n,o,c,f){const y=c==="x"?[o[0],o[4],o[8],o[12]]:[o[1],o[5],o[9],o[13]],x=[o[3],o[7],o[11],o[15]],w=t[0]*y[0]+t[1]*y[1]+t[2]*y[2],S=t[0]*x[0]+t[1]*x[1]+t[2]*x[2],P=n[0]*y[0]+n[1]*y[1]+n[2]*y[2],E=n[0]*x[0]+n[1]*x[1]+n[2]*x[2];return P+f*S===w+f*E||x[3]*(w-P)+y[3]*(E-S)+w*E==P*S?null:(P+y[3]-f*E-f*x[3])/(P-w-f*E+f*S)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class er{constructor(t){this._globe=t,this._mercatorCameraHelper=new mn,this._verticalPerspectiveCameraHelper=new ki}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,n){return this.currentHelper.handlePanInertia(t,n)}handleMapControlsRollPitchBearingZoom(t,n){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,o){this.currentHelper.handleMapControlsPan(t,n,o)}cameraForBoxAndBearing(t,n,o,c,f){return this.currentHelper.cameraForBoxAndBearing(t,n,o,c,f)}handleJumpToCenterZoom(t,n){this.currentHelper.handleJumpToCenterZoom(t,n)}handleEaseTo(t,n){return this.currentHelper.handleEaseTo(t,n)}handleFlyTo(t,n){return this.currentHelper.handleFlyTo(t,n)}}const Ds=(h,t)=>p.C(h,t?.filter((n=>n.identifier!=="source.canvas"))),rl=p.bN();class vn extends p.E{constructor(t,n={}){var o,c;super(),this._rtlPluginLoaded=()=>{for(const y in this.tileManagers){const x=this.tileManagers[y].getSource().type;x!=="vector"&&x!=="geojson"||this.tileManagers[y].reload()}},this.map=t,this.dispatcher=new Ta(rn(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((y,x)=>this.getGlyphs(y,x))),this.dispatcher.registerMessageHandler("GI",((y,x)=>this.getImages(y,x))),this.dispatcher.registerMessageHandler("GDA",((y,x)=>this.getDashes(y,x))),this.imageManager=new wa,this.imageManager.setEventedParent(this);const f=((o=t._container)===null||o===void 0?void 0:o.lang)||typeof document<"u"&&((c=document.documentElement)===null||c===void 0?void 0:c.lang)||void 0;this.glyphManager=new Ce(t._requestManager,n.localIdeographFontFamily,f),this.lineAtlas=new Re(256,512),this.crossTileSymbolIndex=new wi,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",p.bO()),Lr().on(Pa,this._rtlPluginLoaded),this.on("data",(y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const x=this.tileManagers[y.sourceId];if(!x)return;const w=x.getSource();if(w?.vectorLayerIds)for(const S in this._layers){const P=this._layers[S];
810P.source===w.id&&this._validateLayer(P)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new p.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,n){var o,c,f;this._checkLoaded();const y=n===null?(f=(c=(o=this.stylesheet.state)===null||o===void 0?void 0:o[t])===null||c===void 0?void 0:c.default)!==null&&f!==void 0?f:null:n;if(p.bQ(y,this._globalState[t]))return this;this._globalState[t]=y,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const n=[];for(const o in t)!p.bQ(this._globalState[o],t[o].default)&&(n.push(o),this._globalState[o]=t[o].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,o={};for(const c of t){o[c]=this._globalState[c];for(const f in this._layers){const y=this._layers[f],x=y.getLayoutAffectingGlobalStateRefs(),w=y.getPaintAffectingGlobalStateRefs(),S=y.getVisibilityAffectingGlobalStateRefs();if(x.has(c)&&n.add(y.source),w.has(c))for(const{name:P,value:E}of w.get(c))this._updatePaintProperty(y,P,E);S?.has(c)&&(y.recalculateVisibility(),this._updateLayer(y))}}this.dispatcher.broadcast("UGS",o);for(const c in this.tileManagers)n.has(c)&&(this._reloadSource(c),this._changed=!0)}loadURL(t){return p._(this,arguments,void 0,(function*(n,o={},c){this.fire(new p.n("dataloading",{dataType:"style"})),o.validate=typeof o.validate!="boolean"||o.validate,this._loadStyleRequest=new AbortController;const f=this._loadStyleRequest;try{const y=yield this.map._requestManager.transformRequest(n,"Style");p.bR(f.signal);const x=yield p.k(y,f);this._loadStyleRequest===f&&(this._loadStyleRequest=null),this._load(x.data,o,c)}catch(y){this._loadStyleRequest===f&&(this._loadStyleRequest=null),y&&!f.signal.aborted&&this.fire(new p.l(p.d(y)))}}))}loadJSON(t,n={},o){this.fire(new p.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Wt.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,o)})).catch((()=>{}))}loadEmpty(){this.fire(new p.n("dataloading",{dataType:"style"})),this._load(rl,{validate:!1})}_load(t,n,o){var c,f;let y=n.transformStyle?n.transformStyle(o,t):t;if(!n.validate||!Ds(this,p.F(y))){y=Object.assign({},y),this._loaded=!0,this.stylesheet=y;for(const x in y.sources)this.addSource(x,y.sources[x],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new We(this.stylesheet.light),this._setProjectionInternal(((c=this.stylesheet.projection)===null||c===void 0?void 0:c.type)||"mercator"),this.sky=new et(this.stylesheet.sky),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new p.n("data",{dataType:"style"})),this.fire(new p.n("style.load"))}}_createLayers(){var t,n,o;const c=p.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",c),this._order=c.map((f=>f.id)),this._layers={},this._serializedLayers=null;for(const f of c){const y=p.bT(f,this._globalState);if(y.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=y,p.bU(y)&&this.tileManagers[y.source]){const x=(o=(n=f.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&o!==void 0?o:y.paint.get("raster-fade-duration");this.tileManagers[y.source].setRasterFadeDuration(x)}}}_loadSprite(t,n=!1,o=void 0){this.imageManager.setLoaded(!1);const c=new AbortController;let f;this._spriteRequest=c,(function(y,x,w,S){return p._(this,void 0,void 0,(function*(){const P=tn(y),E=w>1?"@2x":"",C={},D={};for(const{id:B,url:j}of P){const $=yield x.transformRequest(Bn(j,E,".json"),"SpriteJSON");C[B]=p.k($,S);const N=yield x.transformRequest(Bn(j,E,".png"),"SpriteImage");D[B]=Ei.getImage(N,S)}return yield Promise.all([...Object.values(C),...Object.values(D)]),(function(B,j){return p._(this,void 0,void 0,(function*(){const $={};for(const N in B){$[N]={};const G=Wt.getImageCanvasContext((yield j[N]).data),X=(yield B[N]).data;for(const Z in X){const{width:U,height:H,x:q,y:Q,sdf:ae,pixelRatio:oe,stretchX:fe,stretchY:de,content:Me,textFitWidth:be,textFitHeight:he}=X[Z];$[N][Z]={data:null,pixelRatio:oe,sdf:ae,stretchX:fe,stretchY:de,content:Me,textFitWidth:be,textFitHeight:he,spriteData:{width:U,height:H,x:q,y:Q,context:G}}}}return $}))})(C,D)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((y=>{if(this._spriteRequest=null,y)for(const x in y){this._spritesImagesIds[x]=[];const w=this._spritesImagesIds[x]?this._spritesImagesIds[x].filter((S=>!(S in y))):[];for(const S of w)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in y[x]){const P=x==="default"?S:`${x}:${S}`;this._spritesImagesIds[x].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,y[x][S],!1):this.imageManager.addImage(P,y[x][S]),n&&(this._changedImages[P]=!0)}}})).catch((y=>{this._spriteRequest=null,f=y,c.signal.aborted||this.fire(new p.l(f))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.n("data",{dataType:"style"})),o&&o(f)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.n("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const o=t.sourceLayer;if(!o)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&!c.vectorLayerIds.includes(o))&&this.fire(new p.l(new Error(`Source layer "${o}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,n=!1){const o=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?p.bV(o):o);const c=[];
vendor: 74,002 bytes, lines 810-812
810for(const f of t)if(o[f]){const y=n?p.bV(o[f]):o[f];c.push(y)}return c}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const c=this._layers[o];c.type!=="custom"&&(t[o]=c.serialize())}return t}hasTransitions(){var t,n,o;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((o=this.projection)===null||o===void 0)&&o.hasTransition())return!0;for(const c in this.tileManagers)if(this.tileManagers[c].hasTransition())return!0;for(const c in this._layers)if(this._layers[c].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const c=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);(c.length||f.length)&&this._updateWorkerLayers(c,f);for(const y in this._updatedSources){const x=this._updatedSources[y];if(x==="reload")this._reloadSource(y);else{if(x!=="clear")throw new Error(`Invalid action ${x}`);this._clearSource(y)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const y in this._updatedPaintProps)this._layers[y].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const o={};for(const c in this.tileManagers){const f=this.tileManagers[c];o[c]=f.used,f.used=!1}for(const c of this._order){const f=this._layers[c];f.recalculate(t,this._availableImages),!f.isHidden(t.zoom)&&f.source&&(this.tileManagers[f.source].used=!0)}for(const c in o){const f=this.tileManagers[c];!!o[c]!=!!f.used&&f.fire(new p.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new p.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var o;this._checkLoaded();const c=this.serialize();if(t=n.transformStyle?n.transformStyle(c,t):t,((o=n.validate)===null||o===void 0||o)&&Ds(this,p.F(t)))return!1;(t=p.bV(t)).layers=p.bS(t.layers);const f=p.bW(c,t),y=this._getOperationsToPerform(f);if(y.unimplemented.length>0)throw new Error(`Unimplemented: ${y.unimplemented.join(", ")}.`);if(y.operations.length===0)return!1;for(const x of y.operations)x();return this.stylesheet=t,this._serializedLayers=null,this.fire(new p.n("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],o=[];for(const c of t)switch(c.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,c.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,c.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,c.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,c.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,c.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,c.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,c.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,c.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,c.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,c.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,c.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,c.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,c.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,c.args)));break;case"setProjection":this.setProjection.apply(this,c.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,c.args)));break;case"setTransition":n.push((()=>{}));break;default:o.push(c.command)}return{operations:n,unimplemented:o}}addImage(t,n){if(this.getImage(t))return this.fire(new p.l(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new p.l(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,o={}){var c;if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);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"].includes(n.type)&&this._validate(p.F.source,`sources.${t}`,n,null,o))return;!((c=this.map)===null||c===void 0)&&c._collectResourceTiming&&(n.collectResourceTiming=!0);const f=this.tileManagers[t]=new Yt(t,n,this.dispatcher);f.style=this,f.setEventedParent(this,(()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:t}))),f.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);for(const o in this._layers)if(this._layers[o].source===t)return this.fire(new p.l(new Error(`Source "${t}" cannot be removed while layer "${o}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new p.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const o=this.tileManagers[t].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(t){var n;return(n=this.tileManagers[t])===null||n===void 0?void 0:n.getSource()}addLayer(t,n,o={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new p.l(new Error(`Layer "${c}" already exists on this map.`)));let f;if(t.type==="custom"){if(Ds(this,p.bX(t)))return;f=p.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=p.bV(t),t=p.e(t,{source:c})),this._validate(p.F.layer,`layers.${c}`,t,{arrayIndex:-1},o))return;f=p.bT(t,this._globalState),this._validateLayer(f),f.setEventedParent(this,{layer:{id:c}})}const y=n?this._order.indexOf(n):this._order.length;if(n&&y===-1)this.fire(new p.l(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(y,0,c),this._layerOrderChanged=!0,this._layers[c]=f,this._removedLayers[c]&&f.source&&f.type!=="custom"){const x=this._removedLayers[c];delete this._removedLayers[c],x.type!==f.type?this._updatedSources[f.source]="clear":(this._updatedSources[f.source]="reload",this.tileManagers[f.source].pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new p.l(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const o=this._order.indexOf(t);this._order.splice(o,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new p.l(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new p.l(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,o){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===o||(n!=null&&(c.minzoom=n),o!=null&&(c.maxzoom=o),this._updateLayer(c)):this.fire(new p.l(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,o={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!p.bQ(c.filter,n))return n==null?(c.setFilter(void 0),void this._updateLayer(c)):void(this._validate(p.F.filter,`layers.${c.id}.filter`,n,null,o)||(c.setFilter(p.bV(n)),this._updateLayer(c)))}else this.fire(new p.l(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return p.bV(this.getLayer(t).filter)}setLayoutProperty(t,n,o,c={}){this._checkLoaded();const f=this.getLayer(t);f?p.bQ(f.getLayoutProperty(n),o)||(f.setLayoutProperty(n,o,c),this._updateLayer(f)):this.fire(new p.l(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const o=this.getLayer(t);if(o)return o.getLayoutProperty(n);this.fire(new p.l(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,o,c={}){this._checkLoaded();const f=this.getLayer(t);f?p.bQ(f.getPaintProperty(n),o)||this._updatePaintProperty(f,n,o,c):this.fire(new p.l(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,o,c={}){t.setPaintProperty(n,o,c)&&this._updateLayer(t),p.bU(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(o),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const o=t.source,c=t.sourceLayer,f=this.tileManagers[o];if(f===void 0)return void this.fire(new p.l(new Error(`The source '${o}' does not exist in the map's style.`)));const y=f.getSource().type;y==="geojson"&&c?this.fire(new p.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):y!=="vector"||c?(t.id===void 0&&this.fire(new p.l(new Error("The feature id parameter must be provided."))),f.setFeatureState(c,t.id,n)):this.fire(new p.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const o=t.source,c=this.tileManagers[o];if(c===void 0)return void this.fire(new p.l(new Error(`The source '${o}' does not exist in the map's style.`)));const f=c.getSource().type,y=f==="vector"?t.sourceLayer:void 0;f!=="vector"||y?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new p.l(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(y,t.id,n):this.fire(new p.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,o=t.sourceLayer,c=this.tileManagers[n];if(c!==void 0)return c.getSource().type!=="vector"||o?(t.id===void 0&&this.fire(new p.l(new Error("The feature id parameter must be provided."))),c.getFeatureState(o,t.id)):void this.fire(new p.l(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.l(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){var t;return p.e({duration:300,delay:0},(t=this.stylesheet)===null||t===void 0?void 0:t.transition)}serialize(){if(!this._loaded)return;const t=p.bY(this.tileManagers,(f=>f.serialize())),n=this._serializeByIds(this._order,!0),o=this.map.getTerrain()||void 0,c=this.stylesheet;return p.bZ({version:c.version,name:c.name,metadata:c.metadata,light:c.light,sky:c.sky,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,projection:c.projection,sources:t,layers:n,terrain:o},(f=>f!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=y=>this._layers[y].type==="fill-extrusion",o={},c=[];for(let y=this._order.length-1;y>=0;y--){const x=this._order[y];if(n(x)){o[x]=y;for(const w of t){const S=w[x];if(S)for(const P of S)c.push(P)}}}c.sort(((y,x)=>x.intersectionZ-y.intersectionZ));const f=[];for(let y=this._order.length-1;y>=0;y--){const x=this._order[y];if(n(x))for(let w=c.length-1;w>=0;w--){const S=c[w].feature;if(o[S.layer.id]<y)break;f.push(S),c.pop()}else for(const w of t){const S=w[x];if(S)for(const P of S)f.push(P.feature)}}return f}queryRenderedFeatures(t,n,o){n?.filter&&this._validate(p.F.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n?.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new p.l(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const S of n.layers){const P=this._layers[S];if(!P)return this.fire(new p.l(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];c[P.source]=!0}}const f=[];n.availableImages=this._availableImages;const y=this._serializedAllLayers(),x=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,w=Object.assign(Object.assign({},n),{layers:x,globalState:this._globalState});for(const S in this.tileManagers)n.layers&&!c[S]||f.push(Vi(this.tileManagers[S],this._layers,y,t,w,o,this.map.terrain?(P,E,C)=>this.map.terrain.getElevation(P,E,C):void 0));return this.placement&&f.push((function(S,P,E,C,D,B,j){const $={},N=B.queryRenderedSymbols(C),G=[];for(const X of Object.keys(N).map(Number))G.push(j[X]);G.sort(Sa);for(const X of G){const Z=X.featureIndex.lookupSymbolFeatures(N[X.bucketInstanceId],P,X.bucketIndex,X.sourceLayerIndex,{filterSpec:D.filter,globalState:D.globalState},D.layers,D.availableImages,S);for(const U in Z){$[U]||($[U]=[]);const H=Z[U];H.sort(((q,Q)=>{const ae=X.featureSortOrder;if(ae){const oe=ae.indexOf(q.featureIndex);return ae.indexOf(Q.featureIndex)-oe}return Q.featureIndex-q.featureIndex}));for(const q of H)$[U].push(q)}}return(function(X,Z,U){for(const H in X)for(const q of X[H])Dr(q,U[Z[H].source]);return X})($,S,E)})(this._layers,y,this.tileManagers,t,w,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(f)}querySourceFeatures(t,n){n?.filter&&this._validate(p.F.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.tileManagers[t];return o?(function(c,f){const y=c.getRenderableIds().map((S=>c.getTileByID(S))),x=[],w={};for(const S of y){const P=S.tileID.canonical.key;w[P]||(w[P]=!0,S.querySourceFeatures(x,f))}return x})(o,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const o=this.light.getLight();let c=!1;for(const y in t)if(!p.bQ(t[y],o[y])){c=!0;break}if(!c)return;const f={now:Je(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(f)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){this._checkLoaded();const n=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===n.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(n.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const o=this.getSky();let c=!1;if(!t&&!o)return;if(t&&!o)c=!0;else if(!t&&o)c=!0;else for(const y in t)if(!p.bQ(t[y],o[y])){c=!0;break}if(!c)return;const f={now:Je(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(f)}_setProjectionInternal(t){const n=(function(o,c){const f={constrainOverride:c};if(Array.isArray(o)){const y=new bc({type:o});return{projection:y,transform:new ea(f),cameraHelper:new er(y)}}switch(o){case"mercator":return{projection:new hi,transform:new fn(f),cameraHelper:new mn};case"globe":{const y=new bc({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:y,transform:new ea(f),cameraHelper:new er(y)}}case"vertical-perspective":return{projection:new Es,transform:new yn(f),cameraHelper:new ki};default:return p.w(`Unknown projection name: ${o}. Falling back to mercator projection.`),{projection:new hi,transform:new fn(f),cameraHelper:new mn}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const o in this.tileManagers)this.tileManagers[o].reload()}_validate(t,n,o,c,f={}){return f?.validate!==!1&&Ds(this,t.call(p.F,p.e({key:n,style:this.serialize(),value:o,styleSpec:p.x},c)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Lr().off(Pa,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const o=this.tileManagers[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const n in this.tileManagers)this.tileManagers[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,n,o,c,f=!1){let y=!1,x=!1;const w={};for(const S of this._order){const P=this._layers[S];if(P.type!=="symbol")continue;if(!w[P.source]){const C=this.tileManagers[P.source];w[P.source]=C.getRenderableIds(!0).map((D=>C.getTileByID(D))).sort(((D,B)=>B.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(B.tileID)?-1:1)))}const E=this.crossTileSymbolIndex.addLayer(P,w[P.source],t.center.lng);y||(y=E)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),f||(f=this._layerOrderChanged||o===0),(f||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Je(),t.zoom))&&(this.pauseablePlacement=new Wn(t,this.map.terrain,this._order,f,n,o,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,w),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Je()),x=!0),y&&this.pauseablePlacement.placement.setStale()),x||y)for(const S of this._order){const P=this._layers[S];P.type==="symbol"&&this.placement.updateLayerOpacities(P,w[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Je())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return p._(this,void 0,void 0,(function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,n.icons),o}))}getGlyphs(t,n){return p._(this,void 0,void 0,(function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,[""]),o}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(p.F.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return p._(this,void 0,void 0,(function*(){const o={};for(const[c,f]of Object.entries(n.dashes))o[c]=this.lineAtlas.getDash(f.dasharray,f.round);return o}))}addSprite(t,n,o={},c){this._checkLoaded();const f=[{id:t,url:n}],y=[...tn(this.stylesheet.sprite),...f];this._validate(p.F.sprite,"sprite",y,null,o)||(this.stylesheet.sprite=y,this._loadSprite(f,!0,c))}removeSprite(t){this._checkLoaded();const n=tn(this.stylesheet.sprite);if(n.find((o=>o.id===t))){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex((o=>o.id===t)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.n("data",{dataType:"style"}))}else this.fire(new p.l(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return tn(this.stylesheet.sprite)}setSprite(t,n={},o){this._checkLoaded(),t&&this._validate(p.F.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const n=this.tileManagers[t];n.setEventedParent(null),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const n=this._layers[t];n.setEventedParent(null),n.onRemove&&n.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Ba=p.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $u{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,o,c,f,y,x,w,S){this.context=t;let P=this.boundPaintVertexBuffers.length!==c.length;for(let E=0;!P&&E<c.length;E++)this.boundPaintVertexBuffers[E]!==c[E]&&(P=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||P||this.boundIndexBuffer!==f||this.boundVertexOffset!==y||this.boundDynamicVertexBuffer!==x||this.boundDynamicVertexBuffer2!==w||this.boundDynamicVertexBuffer3!==S?this.freshBind(n,o,c,f,y,x,w,S):(t.bindVertexArray.set(this.vao),x&&x.bind(),f?.dynamicDraw&&f.bind(),w&&w.bind(),S&&S.bind())}freshBind(t,n,o,c,f,y,x,w){const S=t.numAttributes,P=this.context,E=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=c,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=y,this.boundDynamicVertexBuffer2=x,this.boundDynamicVertexBuffer3=w,n.enableAttributes(E,t);for(const C of o)C.enableAttributes(E,t);y&&y.enableAttributes(E,t),x&&x.enableAttributes(E,t),w&&w.enableAttributes(E,t),n.bind(),n.setVertexAttribPointers(E,t,f);for(const C of o)C.bind(),C.setVertexAttribPointers(E,t,f);y&&(y.bind(),y.setVertexAttribPointers(E,t,f)),c&&c.bind(),x&&(x.bind(),x.setVertexAttribPointers(E,t,f)),w&&(w.bind(),w.setVertexAttribPointers(E,t,f)),P.currentNumAttributes=S}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ks=(h,t,n,o,c)=>({u_texture:0,u_ele_delta:h,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):p.bo.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:c?0:n?n.calculateFogBlendOpacity(o):0,u_horizon_color:n?n.properties.get("horizon-color"):p.bo.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:c?1:0}),Gu={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function mr(h){const t=[];for(const n of h){if(n===null)continue;const o=n.split(" ");t.push(o.pop())}return t}class Zu{constructor(t,n,o,c,f,y,x,w,S=[]){const P=t.gl;this.program=P.createProgram();const E=mr(n.staticAttributes),C=o?o.getBinderAttributes():[],D=E.concat(C),B=_t.prelude.staticUniforms?mr(_t.prelude.staticUniforms):[],j=x.staticUniforms?mr(x.staticUniforms):[],$=n.staticUniforms?mr(n.staticUniforms):[],N=o?o.getBinderUniforms():[],G=B.concat(j).concat($).concat(N),X=[];for(const oe of G)X.includes(oe)||X.push(oe);const Z=o?o.defines():[];Qi(P)&&Z.unshift("#version 300 es"),f&&Z.push("#define OVERDRAW_INSPECTOR;"),y&&Z.push("#define TERRAIN3D;"),w&&Z.push(w),S&&Z.push(...S);let U=Z.concat(_t.prelude.fragmentSource,x.fragmentSource,n.fragmentSource).join(` 811`),H=Z.concat(_t.prelude.vertexSource,x.vertexSource,n.vertexSource).join(` 812`);Qi(P)||(U=(function(oe){return oe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(U),H=(function(oe){return oe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(H));const q=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(q,U),P.compileShader(q),!P.getShaderParameter(q,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(q)}`);P.attachShader(this.program,q);const Q=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(Q,H),P.compileShader(Q),!P.getShaderParameter(Q,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(Q)}`);P.attachShader(this.program,Q),this.attributes={};const ae={};this.numAttributes=D.length;for(let oe=0;oe<this.numAttributes;oe++)D[oe]&&(P.bindAttribLocation(this.program,oe,D[oe]),this.attributes[D[oe]]=oe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(Q),P.deleteShader(q);for(const oe of X)if(oe&&!ae[oe]){const fe=P.getUniformLocation(this.program,oe);fe&&(ae[oe]=fe)}this.fixedUniforms=c(t,ae),this.terrainUniforms=((oe,fe)=>({u_depth:new p.b_(oe,fe.u_depth),u_terrain:new p.b_(oe,fe.u_terrain),u_terrain_dim:new p.bp(oe,fe.u_terrain_dim),u_terrain_matrix:new p.c0(oe,fe.u_terrain_matrix),u_terrain_unpack:new p.c1(oe,fe.u_terrain_unpack),u_terrain_exaggeration:new p.bp(oe,fe.u_terrain_exaggeration)}))(t,ae),this.projectionUniforms=((oe,fe)=>({u_projection_matrix:new p.c0(oe,fe.u_projection_matrix),u_projection_tile_mercator_coords:new p.c1(oe,fe.u_projection_tile_mercator_coords),u_projection_clipping_plane:new p.c1(oe,fe.u_projection_clipping_plane),u_projection_transition:new p.bp(oe,fe.u_projection_transition),u_projection_fallback_matrix:new p.c0(oe,fe.u_projection_fallback_matrix)}))(t,ae),this.binderUniforms=o?o.getUniforms(t,ae):[]}draw(t,n,o,c,f,y,x,w,S,P,E,C,D,B,j,$,N,G,X){var Z;const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(c),t.setColorMode(f),t.setCullFace(y),w){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,w.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,w.texture);for(const q in this.terrainUniforms)this.terrainUniforms[q].set(w[q])}if(S)for(const q in S)this.projectionUniforms[Gu[q]].set(S[q]);if(x)for(const q in this.fixedUniforms)this.fixedUniforms[q].set(x[q]);$&&$.setUniforms(t,this.binderUniforms,B,{zoom:j});let H=0;switch(n){case U.LINES:H=2;break;case U.TRIANGLES:H=3;break;case U.LINE_STRIP:H=1}for(const q of D.get())q.vaos||(q.vaos={}),(Z=q.vaos)[P]||(Z[P]=new $u),q.vaos[P].bind(t,this,E,$?$.getPaintVertexBuffers():[],C,q.vertexOffset,N,G,X),U.drawElements(n,q.primitiveLength*H,U.UNSIGNED_SHORT,q.primitiveOffset*H*2)}}function nl(h,t,n){const o=1/p.aK(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),f=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,y=f*(n.tileID.canonical.x+n.tileID.wrap*c),x=f*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[y>>16,x>>16],u_pixel_coord_lower:[65535&y,65535&x]}}const Sc=(h,t,n,o)=>{const c=h.style.light,f=c.properties.get("position"),y=[f.x,f.y,f.z],x=p.c4();c.properties.get("anchor")==="viewport"&&p.c5(x,h.transform.bearingInRadians),p.c6(y,y,x);const w=h.transform.transformLightDirection(y),S=c.properties.get("color");return{u_lightpos:y,u_lightpos_globe:w,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:o}},Pc=(h,t,n,o,c,f,y)=>p.e(Sc(h,t,n,o),nl(f,h,y),{u_height_factor:-Math.pow(2,c.overscaledZ)/y.tileSize/8}),Rs=(h,t,n,o)=>p.e(nl(t,h,n),{u_fill_translate:o}),Ic=(h,t)=>({u_world:h,u_fill_translate:t}),Mc=(h,t,n,o,c)=>p.e(Rs(h,t,n,c),{u_world:o}),Ec=(h,t,n,o,c)=>{const f=h.transform;let y,x,w=0;if(n.paint.get("circle-pitch-alignment")==="map"){const S=p.aK(t,1,f.zoom);y=!0,x=[S,S],w=S/(p.a6*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*c}else y=!1,x=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+y,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:x,u_globe_extrude_scale:w,u_translate:o}},Cc=h=>({u_pixel_extrude_scale:[1/h.width,1/h.height]}),xn=h=>({u_viewport_size:[h.width,h.height]}),al=(h,t=1)=>({u_color:h,u_overlay:0,u_overlay_scale:t}),sl=(h,t,n,o)=>{const c=p.aK(h,1,t)/(p.a6*Math.pow(2,h.tileID.overscaledZ))*2*Math.PI*o;return{u_extrude_scale:p.aK(h,1,t),u_intensity:n,u_globe_extrude_scale:c}},ta=(h,t,n,o)=>{const c=p.O();p.c7(c,0,h.width,h.height,0,0,1);const f=h.context.gl;return{u_matrix:c,u_world:[f.drawingBufferWidth,f.drawingBufferHeight],u_image:n,u_color_ramp:o,u_opacity:t.paint.get("heatmap-opacity")}},qu=(h,t,n)=>{const o=n.paint.get("hillshade-accent-color");let c;switch(n.paint.get("hillshade-method")){case"basic":c=4;break;case"combined":c=1;break;case"igor":c=2;break;case"multidirectional":c=3;break;default:c=0}const f=n.getIlluminationProperties();for(let y=0;y<f.directionRadians.length;y++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(f.directionRadians[y]+=h.transform.bearingInRadians);return{u_image:0,u_latrange:Wu(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:f.altitudeRadians,u_azimuths:f.directionRadians,u_accent:o,u_method:c,u_highlights:f.highlightColor,u_shadows:f.shadowColor}},Ls=(h,t)=>{const n=t.stride,o=p.O();return p.c7(o,0,p.a6,-p.a6,0,0,1),p.Q(o,o,[0,-p.a6,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:h.overscaledZ,u_unpack:t.getUnpackVector()}};function Wu(h,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new p.a7(0,o/n).toLngLat().lat,new p.a7(0,(o+1)/n).toLngLat().lat]}const Hu=(h,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:h.paint.get("color-relief-opacity")}),Oa=(h,t,n,o)=>{const c=h.transform;return{u_translation:sr(h,t,n),u_ratio:o/p.aK(t,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Ac=(h,t,n,o,c)=>p.e(Oa(h,t,n,o),{u_image:0,u_image_height:c}),zc=(h,t,n,o,c)=>{const f=h.transform,y=ia(t,f);return{u_translation:sr(h,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:o/p.aK(t,1,f.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[y,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},ol=(h,t,n,o,c)=>{const f=ia(t,h.transform);return p.e(Oa(h,t,n,o),{u_tileratio:f,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image:0,u_mix:c.t,u_lineatlas_width:h.lineAtlas.width,u_lineatlas_height:h.lineAtlas.height})},Dc=(h,t,n,o,c,f)=>{const y=ia(t,h.transform);return p.e(Oa(h,t,n,o),{u_image:0,u_image_height:f,u_tileratio:y,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image_dash:1,u_mix:c.t,u_lineatlas_width:h.lineAtlas.width,u_lineatlas_height:h.lineAtlas.height})};function ia(h,t){return 1/p.aK(h,1,t.tileZoom)}function sr(h,t,n){return p.aL(h.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ll=(h,t,n,o,c)=>{return{u_tl_parent:h,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(y=o.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(f=o.paint.get("raster-contrast"),f>0?1/(1-f):1+f),u_spin_weights:cl(o.paint.get("raster-hue-rotate")),u_coords_top:[c[0].x,c[0].y,c[1].x,c[1].y],u_coords_bottom:[c[3].x,c[3].y,c[2].x,c[2].y]};var f,y};function cl(h){h*=Math.PI/180;const t=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Fs=(h,t,n,o,c,f,y,x,w,S,P,E,C)=>{const D=y.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:D.width/D.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_label_plane_matrix:x,u_coord_matrix:w,u_is_text:+P,u_pitch_with_map:+o,u_is_along_line:c,u_is_variable_anchor:f,u_texsize:E,u_texture:0,u_translation:S,u_pitched_scale:C}},ul=(h,t,n,o,c,f,y,x,w,S,P,E,C,D)=>{const B=y.transform;return p.e(Fs(h,t,n,o,c,f,y,x,w,S,P,E,D),{u_gamma_scale:o?Math.cos(B.pitch*Math.PI/180)*B.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:C?1:0,u_is_plain:1})},hl=(h,t,n,o,c,f,y,x,w,S,P,E,C)=>p.e(ul(h,t,n,o,c,f,y,x,w,S,!0,P,!0,C),{u_texsize_icon:E,u_texture_icon:1}),bn=(h,t)=>({u_opacity:h,u_color:t}),dl=(h,t,n,o,c)=>p.e((function(f,y,x,w){const S=x.imageManager.getPattern(f.from.toString()),P=x.imageManager.getPattern(f.to.toString()),{width:E,height:C}=x.imageManager.getPixelSize(),D=Math.pow(2,w.tileID.overscaledZ),B=w.tileSize*Math.pow(2,x.transform.tileZoom)/D,j=B*(w.tileID.canonical.x+w.tileID.wrap*D),$=B*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[E,C],u_mix:y.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/p.aK(w,1,x.transform.tileZoom),u_pixel_coord_upper:[j>>16,$>>16],u_pixel_coord_lower:[65535&j,65535&$]}})(n,c,t,o),{u_opacity:h}),kc=(h,t)=>{},Xu={fillExtrusion:(h,t)=>({u_lightpos:new p.c2(h,t.u_lightpos),u_lightpos_globe:new p.c2(h,t.u_lightpos_globe),u_lightintensity:new p.bp(h,t.u_lightintensity),u_lightcolor:new p.c2(h,t.u_lightcolor),u_vertical_gradient:new p.bp(h,t.u_vertical_gradient),u_opacity:new p.bp(h,t.u_opacity),u_fill_translate:new p.c3(h,t.u_fill_translate)}),fillExtrusionPattern:(h,t)=>({u_lightpos:new p.c2(h,t.u_lightpos),u_lightpos_globe:new p.c2(h,t.u_lightpos_globe),u_lightintensity:new p.bp(h,t.u_lightintensity),u_lightcolor:new p.c2(h,t.u_lightcolor),u_vertical_gradient:new p.bp(h,t.u_vertical_gradient),u_height_factor:new p.bp(h,t.u_height_factor),u_opacity:new p.bp(h,t.u_opacity),u_fill_translate:new p.c3(h,t.u_fill_translate),u_image:new p.b_(h,t.u_image),u_texsize:new p.c3(h,t.u_texsize),u_pixel_coord_upper:new p.c3(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(h,t.u_pixel_coord_lower),u_scale:new p.c2(h,t.u_scale),u_fade:new p.bp(h,t.u_fade)}),fill:(h,t)=>({u_fill_translate:new p.c3(h,t.u_fill_translate)}),fillPattern:(h,t)=>({u_image:new p.b_(h,t.u_image),u_texsize:new p.c3(h,t.u_texsize),u_pixel_coord_upper:new p.c3(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(h,t.u_pixel_coord_lower),u_scale:new p.c2(h,t.u_scale),u_fade:new p.bp(h,t.u_fade),u_fill_translate:new p.c3(h,t.u_fill_translate)}),fillOutline:(h,t)=>({u_world:new p.c3(h,t.u_world),u_fill_translate:new p.c3(h,t.u_fill_translate)}),fillOutlinePattern:(h,t)=>({u_world:new p.c3(h,t.u_world),u_image:new p.b_(h,t.u_image),u_texsize:new p.c3(h,t.u_texsize),u_pixel_coord_upper:new p.c3(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(h,t.u_pixel_coord_lower),u_scale:new p.c2(h,t.u_scale),u_fade:new p.bp(h,t.u_fade),u_fill_translate:new p.c3(h,t.u_fill_translate)}),circle:(h,t)=>({u_camera_to_center_distance:new p.bp(h,t.u_camera_to_center_distance),u_scale_with_map:new p.b_(h,t.u_scale_with_map),u_pitch_with_map:new p.b_(h,t.u_pitch_with_map),u_extrude_scale:new p.c3(h,t.u_extrude_scale),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_globe_extrude_scale:new p.bp(h,t.u_globe_extrude_scale),u_translate:new p.c3(h,t.u_translate)}),collisionBox:(h,t)=>({u_pixel_extrude_scale:new p.c3(h,t.u_pixel_extrude_scale)}),collisionCircle:(h,t)=>({u_viewport_size:new p.c3(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new p.b$(h,t.u_color),u_overlay:new p.b_(h,t.u_overlay),u_overlay_scale:new p.bp(h,t.u_overlay_scale)}),depth:kc,clippingMask:kc,heatmap:(h,t)=>({u_extrude_scale:new p.bp(h,t.u_extrude_scale),u_intensity:new p.bp(h,t.u_intensity),u_globe_extrude_scale:new p.bp(h,t.u_globe_extrude_scale)}),heatmapTexture:(h,t)=>({u_matrix:new p.c0(h,t.u_matrix),u_world:new p.c3(h,t.u_world),u_image:new p.b_(h,t.u_image),u_color_ramp:new p.b_(h,t.u_color_ramp),u_opacity:new p.bp(h,t.u_opacity)}),hillshade:(h,t)=>({u_image:new p.b_(h,t.u_image),u_latrange:new p.c3(h,t.u_latrange),u_exaggeration:new p.bp(h,t.u_exaggeration),u_altitudes:new p.c9(h,t.u_altitudes),u_azimuths:new p.c9(h,t.u_azimuths),u_accent:new p.b$(h,t.u_accent),u_method:new p.b_(h,t.u_method),u_shadows:new p.c8(h,t.u_shadows),u_highlights:new p.c8(h,t.u_highlights)}),hillshadePrepare:(h,t)=>({u_matrix:new p.c0(h,t.u_matrix),u_image:new p.b_(h,t.u_image),u_dimension:new p.c3(h,t.u_dimension),u_zoom:new p.bp(h,t.u_zoom),u_unpack:new p.c1(h,t.u_unpack)}),colorRelief:(h,t)=>({u_image:new p.b_(h,t.u_image),u_unpack:new p.c1(h,t.u_unpack),u_dimension:new p.c3(h,t.u_dimension),u_elevation_stops:new p.b_(h,t.u_elevation_stops),u_color_stops:new p.b_(h,t.u_color_stops),u_color_ramp_size:new p.b_(h,t.u_color_ramp_size),u_opacity:new p.bp(h,t.u_opacity)}),line:(h,t)=>({u_translation:new p.c3(h,t.u_translation),u_ratio:new p.bp(h,t.u_ratio),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_translation:new p.c3(h,t.u_translation),u_ratio:new p.bp(h,t.u_ratio),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(h,t.u_units_to_pixels),u_image:new p.b_(h,t.u_image),u_image_height:new p.bp(h,t.u_image_height)}),linePattern:(h,t)=>({u_translation:new p.c3(h,t.u_translation),u_texsize:new p.c3(h,t.u_texsize),u_ratio:new p.bp(h,t.u_ratio),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_image:new p.b_(h,t.u_image),u_units_to_pixels:new p.c3(h,t.u_units_to_pixels),u_scale:new p.c2(h,t.u_scale),u_fade:new p.bp(h,t.u_fade)}),lineSDF:(h,t)=>({u_translation:new p.c3(h,t.u_translation),u_ratio:new p.bp(h,t.u_ratio),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(h,t.u_units_to_pixels),u_image:new p.b_(h,t.u_image),u_mix:new p.bp(h,t.u_mix),u_tileratio:new p.bp(h,t.u_tileratio),u_crossfade_from:new p.bp(h,t.u_crossfade_from),u_crossfade_to:new p.bp(h,t.u_crossfade_to),u_lineatlas_width:new p.bp(h,t.u_lineatlas_width),u_lineatlas_height:new p.bp(h,t.u_lineatlas_height)}),lineGradientSDF:(h,t)=>({u_translation:new p.c3(h,t.u_translation),u_ratio:new p.bp(h,t.u_ratio),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(h,t.u_units_to_pixels),u_image:new p.b_(h,t.u_image),u_image_height:new p.bp(h,t.u_image_height),u_tileratio:new p.bp(h,t.u_tileratio),u_crossfade_from:new p.bp(h,t.u_crossfade_from),u_crossfade_to:new p.bp(h,t.u_crossfade_to),u_image_dash:new p.b_(h,t.u_image_dash),u_mix:new p.bp(h,t.u_mix),u_lineatlas_width:new p.bp(h,t.u_lineatlas_width),u_lineatlas_height:new p.bp(h,t.u_lineatlas_height)}),raster:(h,t)=>({u_tl_parent:new p.c3(h,t.u_tl_parent),u_scale_parent:new p.bp(h,t.u_scale_parent),u_buffer_scale:new p.bp(h,t.u_buffer_scale),u_fade_t:new p.bp(h,t.u_fade_t),u_opacity:new p.bp(h,t.u_opacity),u_image0:new p.b_(h,t.u_image0),u_image1:new p.b_(h,t.u_image1),u_brightness_low:new p.bp(h,t.u_brightness_low),u_brightness_high:new p.bp(h,t.u_brightness_high),u_saturation_factor:new p.bp(h,t.u_saturation_factor),u_contrast_factor:new p.bp(h,t.u_contrast_factor),u_spin_weights:new p.c2(h,t.u_spin_weights),u_coords_top:new p.c1(h,t.u_coords_top),u_coords_bottom:new p.c1(h,t.u_coords_bottom)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new p.b_(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.b_(h,t.u_is_size_feature_constant),u_size_t:new p.bp(h,t.u_size_t),u_size:new p.bp(h,t.u_size),u_camera_to_center_distance:new p.bp(h,t.u_camera_to_center_distance),u_pitch:new p.bp(h,t.u_pitch),u_rotate_symbol:new p.b_(h,t.u_rotate_symbol),u_aspect_ratio:new p.bp(h,t.u_aspect_ratio),u_fade_change:new p.bp(h,t.u_fade_change),u_label_plane_matrix:new p.c0(h,t.u_label_plane_matrix),u_coord_matrix:new p.c0(h,t.u_coord_matrix),u_is_text:new p.b_(h,t.u_is_text),u_pitch_with_map:new p.b_(h,t.u_pitch_with_map),u_is_along_line:new p.b_(h,t.u_is_along_line),u_is_variable_anchor:new p.b_(h,t.u_is_variable_anchor),u_texsize:new p.c3(h,t.u_texsize),u_texture:new p.b_(h,t.u_texture),u_translation:new p.c3(h,t.u_translation),u_pitched_scale:new p.bp(h,t.u_pitched_scale)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new p.b_(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.b_(h,t.u_is_size_feature_constant),u_size_t:new p.bp(h,t.u_size_t),u_size:new p.bp(h,t.u_size),u_camera_to_center_distance:new p.bp(h,t.u_camera_to_center_distance),u_pitch:new p.bp(h,t.u_pitch),u_rotate_symbol:new p.b_(h,t.u_rotate_symbol),u_aspect_ratio:new p.bp(h,t.u_aspect_ratio),u_fade_change:new p.bp(h,t.u_fade_change),u_label_plane_matrix:new p.c0(h,t.u_label_plane_matrix),u_coord_matrix:new p.c0(h,t.u_coord_matrix),u_is_text:new p.b_(h,t.u_is_text),u_pitch_with_map:new p.b_(h,t.u_pitch_with_map),u_is_along_line:new p.b_(h,t.u_is_along_line),u_is_variable_anchor:new p.b_(h,t.u_is_variable_anchor),u_texsize:new p.c3(h,t.u_texsize),u_texture:new p.b_(h,t.u_texture),u_gamma_scale:new p.bp(h,t.u_gamma_scale),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_is_halo:new p.b_(h,t.u_is_halo),u_is_plain:new p.b_(h,t.u_is_plain),u_translation:new p.c3(h,t.u_translation),u_pitched_scale:new p.bp(h,t.u_pitched_scale)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new p.b_(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.b_(h,t.u_is_size_feature_constant),u_size_t:new p.bp(h,t.u_size_t),u_size:new p.bp(h,t.u_size),u_camera_to_center_distance:new p.bp(h,t.u_camera_to_center_distance),u_pitch:new p.bp(h,t.u_pitch),u_rotate_symbol:new p.b_(h,t.u_rotate_symbol),u_aspect_ratio:new p.bp(h,t.u_aspect_ratio),u_fade_change:new p.bp(h,t.u_fade_change),u_label_plane_matrix:new p.c0(h,t.u_label_plane_matrix),u_coord_matrix:new p.c0(h,t.u_coord_matrix),u_is_text:new p.b_(h,t.u_is_text),u_pitch_with_map:new p.b_(h,t.u_pitch_with_map),u_is_along_line:new p.b_(h,t.u_is_along_line),u_is_variable_anchor:new p.b_(h,t.u_is_variable_anchor),u_texsize:new p.c3(h,t.u_texsize),u_texsize_icon:new p.c3(h,t.u_texsize_icon),u_texture:new p.b_(h,t.u_texture),u_texture_icon:new p.b_(h,t.u_texture_icon),u_gamma_scale:new p.bp(h,t.u_gamma_scale),u_device_pixel_ratio:new p.bp(h,t.u_device_pixel_ratio),u_is_halo:new p.b_(h,t.u_is_halo),u_translation:new p.c3(h,t.u_translation),u_pitched_scale:new p.bp(h,t.u_pitched_scale)}),background:(h,t)=>({u_opacity:new p.bp(h,t.u_opacity),u_color:new p.b$(h,t.u_color)}),backgroundPattern:(h,t)=>({u_opacity:new p.bp(h,t.u_opacity),u_image:new p.b_(h,t.u_image),u_pattern_tl_a:new p.c3(h,t.u_pattern_tl_a),u_pattern_br_a:new p.c3(h,t.u_pattern_br_a),u_pattern_tl_b:new p.c3(h,t.u_pattern_tl_b),u_pattern_br_b:new p.c3(h,t.u_pattern_br_b),u_texsize:new p.c3(h,t.u_texsize),u_mix:new p.bp(h,t.u_mix),u_pattern_size_a:new p.c3(h,t.u_pattern_size_a),u_pattern_size_b:new p.c3(h,t.u_pattern_size_b),u_scale_a:new p.bp(h,t.u_scale_a),u_scale_b:new p.bp(h,t.u_scale_b),u_pixel_coord_upper:new p.c3(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new p.bp(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_texture:new p.b_(h,t.u_texture),u_ele_delta:new p.bp(h,t.u_ele_delta),u_fog_matrix:new p.c0(h,t.u_fog_matrix),u_fog_color:new p.b$(h,t.u_fog_color),u_fog_ground_blend:new p.bp(h,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.bp(h,t.u_fog_ground_blend_opacity),u_horizon_color:new p.b$(h,t.u_horizon_color),u_horizon_fog_blend:new p.bp(h,t.u_horizon_fog_blend),u_is_globe_mode:new p.bp(h,t.u_is_globe_mode)}),terrainDepth:(h,t)=>({u_ele_delta:new p.bp(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_texture:new p.b_(h,t.u_texture),u_terrain_coords_id:new p.bp(h,t.u_terrain_coords_id),u_ele_delta:new p.bp(h,t.u_ele_delta)}),projectionErrorMeasurement:(h,t)=>({u_input:new p.bp(h,t.u_input),u_output_expected:new p.bp(h,t.u_output_expected)}),atmosphere:(h,t)=>({u_sun_pos:new p.c2(h,t.u_sun_pos),u_atmosphere_blend:new p.bp(h,t.u_atmosphere_blend),u_globe_position:new p.c2(h,t.u_globe_position),u_globe_radius:new p.bp(h,t.u_globe_radius),u_inv_proj_matrix:new p.c0(h,t.u_inv_proj_matrix)}),sky:(h,t)=>({u_sky_color:new p.b$(h,t.u_sky_color),u_horizon_color:new p.b$(h,t.u_horizon_color),u_horizon:new p.c3(h,t.u_horizon),u_horizon_normal:new p.c3(h,t.u_horizon_normal),u_sky_horizon_blend:new p.bp(h,t.u_sky_horizon_blend),u_sky_blend:new p.bp(h,t.u_sky_blend)})};class Yu{constructor(t,n,o){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ku={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Rc{constructor(t,n,o,c){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),t.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(const o of this.attributes){const c=n.attributes[o.name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,o){for(const c of this.attributes){const f=n.attributes[c.name];f!==void 0&&t.vertexAttribPointer(f,c.components,t[Ku[c.type]],!1,this.itemSize,c.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class it{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Lc extends it{getDefault(){return p.bo.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Bs extends it{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Os extends it{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class js extends it{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class pl extends it{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class wn extends it{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ja extends it{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ra extends it{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ui extends it{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Fc extends it{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Bc extends it{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class fl extends it{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Tn extends it{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Vs extends it{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ns extends it{getDefault(){return p.bo.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Va extends it{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Us extends it{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Oc extends it{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class na extends it{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class aa extends it{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class jc extends it{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ml extends it{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ze extends it{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class $s extends it{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ju extends it{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Vc extends it{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Na extends it{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Qu extends it{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Qi(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class eh extends it{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Nc extends it{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class th extends it{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ua extends it{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Gs extends Ua{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class $a extends Ua{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Zs extends Ua{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const qs="Framebuffer is not complete";class Uc{constructor(t,n,o,c,f){this.context=t,this.width=n,this.height=o;const y=t.gl,x=this.framebuffer=y.createFramebuffer();if(this.colorAttachment=new Gs(t,x),c)this.depthAttachment=f?new Zs(t,x):new $a(t,x);else if(f)throw new Error("Stencil cannot be set without depth");if(y.checkFramebufferStatus(y.FRAMEBUFFER)!==y.FRAMEBUFFER_COMPLETE)throw new Error(qs)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class Ws{constructor(t){var n,o;if(this.gl=t,this.clearColor=new Lc(this),this.clearDepth=new Bs(this),this.clearStencil=new Os(this),this.colorMask=new js(this),this.depthMask=new pl(this),this.stencilMask=new wn(this),this.stencilFunc=new ja(this),this.stencilOp=new ra(this),this.stencilTest=new Ui(this),this.depthRange=new Fc(this),this.depthTest=new Bc(this),this.depthFunc=new fl(this),this.blend=new Tn(this),this.blendFunc=new Vs(this),this.blendColor=new Ns(this),this.blendEquation=new Va(this),this.cullFace=new Us(this),this.cullFaceSide=new Oc(this),this.frontFace=new na(this),this.program=new aa(this),this.activeTexture=new jc(this),this.viewport=new ml(this),this.bindFramebuffer=new Ze(this),this.bindRenderbuffer=new $s(this),this.bindTexture=new Ju(this),this.bindVertexBuffer=new Vc(this),this.bindElementBuffer=new Na(this),this.bindVertexArray=new Qu(this),this.pixelStoreUnpack=new eh(this),this.pixelStoreUnpackPremultiplyAlpha=new Nc(this),this.pixelStoreUnpackFlipY=new th(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Qi(t)){this.HALF_FLOAT=t.HALF_FLOAT;const c=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:c?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const c=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=c?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new Yu(this,t,n)}createVertexBuffer(t,n,o){return new Rc(this,t,n,o)}createRenderbuffer(t,n,o){const c=this.gl,f=c.createRenderbuffer();return this.bindRenderbuffer.set(f),c.renderbufferStorage(c.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),f}createFramebuffer(t,n,o,c){return new Uc(this,t,n,o,c)}clear({color:t,depth:n,stencil:o}){const c=this.gl;let f=0;t&&(f|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(f|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(f|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),c.clear(f)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){p.bQ(t.blendFunction,ut.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Qi(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;Qi(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0||n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Sn;function sa(h,t,n,o,c){var f,y;const x=h.context,w=h.transform,S=x.gl,P=h.useProgram("collisionBox"),E=[];let C=0,D=0;for(const X of o){const Z=t.getTile(X).getBucket(n);if(!Z)continue;const U=c?Z.textCollisionBox:Z.iconCollisionBox,H=Z.collisionCircleArray;H.length>0&&(E.push({circleArray:H,circleOffset:D,coord:X}),C+=H.length/4,D=C),U&&P.draw(x,S.LINES,Ue.disabled,Ke.disabled,h.colorModeForRenderPass(),Xe.disabled,Cc(h.transform),(f=h.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(X),w.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,null,h.transform.zoom,null,null,U.collisionVertexBuffer)}if(!c||!E.length)return;const B=h.useProgram("collisionCircle"),j=new p.ca;j.resize(4*C),j._trim();let $=0;for(const X of E)for(let Z=0;Z<X.circleArray.length/4;Z++){const U=4*Z,H=X.circleArray[U+0],q=X.circleArray[U+1],Q=X.circleArray[U+2],ae=X.circleArray[U+3];j.emplace($++,H,q,Q,ae,0),j.emplace($++,H,q,Q,ae,1),j.emplace($++,H,q,Q,ae,2),j.emplace($++,H,q,Q,ae,3)}(!Sn||Sn.length<2*C)&&(Sn=(function(X){const Z=2*X,U=new p.cc;U.resize(Z),U._trim();for(let H=0;H<Z;H++){const q=6*H;U.uint16[q+0]=4*H+0,U.uint16[q+1]=4*H+1,U.uint16[q+2]=4*H+2,U.uint16[q+3]=4*H+2,U.uint16[q+4]=4*H+3,U.uint16[q+5]=4*H+0}return U})(C));const N=x.createIndexBuffer(Sn,!0),G=x.createVertexBuffer(j,p.cb.members,!0);for(const X of E){const Z=xn(h.transform);B.draw(x,S.TRIANGLES,Ue.disabled,Ke.disabled,h.colorModeForRenderPass(),Xe.disabled,Z,(y=h.style.map.terrain)===null||y===void 0?void 0:y.getTerrainData(X.coord),null,n.id,G,N,p.aV.simpleSegment(0,2*X.circleOffset,X.circleArray.length,X.circleArray.length/2),null,h.transform.zoom,null,null,null)}G.destroy(),N.destroy()}const oa=p.ap(new Float32Array(16));function _l(h,t,n,o,c,f){const{horizontalAlign:y,verticalAlign:x}=p.aP(h);return new p.P((-(y-.5)*t/c+o[0])*f,(-(x-.5)*n/c+o[1])*f)}function ih(h,t,n,o,c,f){const y=t.tileAnchorPoint.add(new p.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let x=o.mult(f);n||(x=x.rotate(-c));const w=y.add(x);return Ne(w.x,w.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const x=at(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(h),w=Math.atan(x.y/x.x)+(x.x<0?Math.PI:0);return h.add(o.rotate(w))}return h.add(o)}function Ga(h,t,n,o,c,f,y,x,w,S,P,E){const C=h.text.placedSymbolArray,D=h.text.dynamicLayoutVertexArray,B=h.icon.dynamicLayoutVertexArray,j={};D.clear();for(let $=0;$<C.length;$++){const N=C.get($),G=N.hidden||!N.crossTileID||h.allowVerticalPlacement&&!N.placedOrientation?null:o[N.crossTileID];if(G){const X=new p.P(N.anchorX,N.anchorY),Z={getElevation:E,width:c.width,height:c.height,pitchedLabelPlaneMatrix:f,pitchWithMap:n,transform:c,tileAnchorPoint:X,translation:S,unwrappedTileID:P},U=n?Zn(X.x,X.y,Z):at(X.x,X.y,Z),H=Ma(c.cameraToCenterDistance,U.signedDistanceFromCamera);let q=p.ay(h.textSizeData,x,N)*H/p.aJ;n&&(q*=h.tilePixelRatio/y);const{width:Q,height:ae,anchor:oe,textOffset:fe,textBoxScale:de}=G,Me=_l(oe,Q,ae,fe,de,q),be=c.getPitchedTextCorrection(X.x+S[0],X.y+S[1],P),he=ih(U.point,Z,t,Me,-c.bearingInRadians,be),Se=h.allowVerticalPlacement&&N.placedOrientation===p.ax.vertical?Math.PI/2:0;for(let Ae=0;Ae<N.numGlyphs;Ae++)p.aD(D,he,Se);w&&N.associatedIconIndex>=0&&(j[N.associatedIconIndex]={shiftedAnchor:he,angle:Se})}else dn(N.numGlyphs,D)}if(w){B.clear();const $=h.icon.placedSymbolArray;for(let N=0;N<$.length;N++){const G=$.get(N);if(G.hidden)dn(G.numGlyphs,B);else{const X=j[N];if(X)for(let Z=0;Z<G.numGlyphs;Z++)p.aD(B,X.shiftedAnchor,X.angle);else dn(G.numGlyphs,B)}}h.icon.dynamicLayoutVertexBuffer.updateData(B)}h.text.dynamicLayoutVertexBuffer.updateData(D)}function rh(h,t,n){return n.iconsInText&&t?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function gl(h,t,n,o,c,f,y,x,w,S,P,E,C){var D,B;const j=h.context,$=j.gl,N=h.transform,G=x==="map",X=w==="map",Z=x!=="viewport"&&n.layout.get("symbol-placement")!=="point",U=G&&!X&&!Z,H=!n.layout.get("symbol-sort-key").isConstant();let q=!1;const Q=h.getDepthModeForSublayer(0,Ue.ReadOnly),ae=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),oe=[],fe=N.getCircleRadiusCorrection();for(const be of o){const he=t.getTile(be),Se=he.getBucket(n);if(!Se)continue;const Ae=c?Se.text:Se.icon;if(!Ae?.segments.get().length||!Ae.hasVisibleVertices)continue;const rt=Ae.programConfigurations.get(n.id),Ct=c||Se.sdfIcons,ot=c?Se.textSizeData:Se.iconSizeData,zt=X||N.pitch!==0,kt=h.useProgram(rh(Ct,c,Se),rt),ii=p.aw(ot,N.zoom),St=(D=h.style.map.terrain)===null||D===void 0?void 0:D.getTerrainData(be);let pi,Jt,Nt,ri,$r=[0,0],Gr=null;if(c)Jt=he.glyphAtlasTexture,Nt=$.LINEAR,pi=he.glyphAtlasTexture.size,Se.iconsInText&&($r=he.imageAtlasTexture.size,Gr=he.imageAtlasTexture,ri=zt||h.options.rotating||h.options.zooming||ot.kind==="composite"||ot.kind==="camera"?$.LINEAR:$.NEAREST);else{const vt=n.layout.get("icon-size").constantOr(0)!==1||Se.iconsNeedLinear;Jt=he.imageAtlasTexture,Nt=Ct||h.options.rotating||h.options.zooming||vt||zt?$.LINEAR:$.NEAREST,pi=he.imageAtlasTexture.size}const Zr=p.aK(he,1,h.transform.zoom),ni=Ai(G,h.transform,Zr),xr=bs(X,G,h.transform,Zr),qr=p.aL(N,he,f,y),lo=N.getProjectionData({overscaledTileID:be,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),cr=ae&&Se.hasTextData(),ur=n.layout.get("icon-text-fit")!=="none"&&cr&&Se.hasIconData();if(Z){const vt=p.O();je(vt,ni);const An=h.style.map.terrain?(br,Vl)=>h.style.map.terrain.getElevation(be,br,Vl):null,co=n.layout.get("text-rotation-alignment")==="map";ws(Se,h,c,ni,vt,X,S,co,be.toUnwrapped(),N.width,N.height,qr,An)}const Li=c&&ae||ur,Zi=Z||Li?oa:X?ni:h.transform.clipSpaceToPixelsMatrix,yt=Ct&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let pt;pt=Ct?Se.iconsInText?hl(ot.kind,ii,U,X,Z,Li,h,Zi,xr,qr,pi,$r,fe):ul(ot.kind,ii,U,X,Z,Li,h,Zi,xr,qr,c,pi,yt,fe):Fs(ot.kind,ii,U,X,Z,Li,h,Zi,xr,qr,c,pi,fe);const Rt={program:kt,buffers:Ae,uniformValues:pt,projectionData:lo,atlasTexture:Jt,atlasTextureIcon:Gr,atlasInterpolation:Nt,atlasInterpolationIcon:ri,isSDF:Ct,hasHalo:yt};if(H&&Se.canOverlap){q=!0;const vt=Ae.segments.get();for(const An of vt)oe.push({segments:new p.aV([An]),sortKey:An.sortKey,state:Rt,terrainData:St})}else oe.push({segments:Ae.segments,sortKey:0,state:Rt,terrainData:St})}q&&oe.sort(((be,he)=>be.sortKey-he.sortKey));const de=(B=n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(null))!==null&&B!==void 0?B:1/0,Me=n.layout.get("text-letter-spacing").constantOr(0)*p.aJ<0||de>1;for(const be of oe){const he=be.state;j.activeTexture.set($.TEXTURE0),he.atlasTexture.bind(he.atlasInterpolation,$.CLAMP_TO_EDGE),he.atlasTextureIcon&&(j.activeTexture.set($.TEXTURE1),he.atlasTextureIcon&&he.atlasTextureIcon.bind(he.atlasInterpolationIcon,$.CLAMP_TO_EDGE));const Se=he.isSDF&&he.hasHalo;if(Se){const Ae=he.uniformValues;Ae.u_is_halo=1,Me&&(Ae.u_is_plain=0,Za(he.buffers,be.segments,n,h,he.program,Q,P,E,Ae,he.projectionData,be.terrainData),Ae.u_is_halo=0,Ae.u_is_plain=1)}Za(he.buffers,be.segments,n,h,he.program,Q,P,E,he.uniformValues,he.projectionData,be.terrainData),Se&&!Me&&(he.uniformValues.u_is_halo=0)}}function Za(h,t,n,o,c,f,y,x,w,S,P){const E=o.context;c.draw(E,E.gl.TRIANGLES,f,y,x,Xe.backCCW,w,P,S,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,o.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function yl(h,t,n,o,c){const f=h.context,y=f.gl,x=Ke.disabled,w=new ut([y.ONE,y.ONE],p.bo.transparent,[!0,!0,!0,!0]),S=t.getBucket(n);if(!S)return;const P=o.key;let E=n.heatmapFbos.get(P);E||(E=vl(f,t.tileSize,t.tileSize),n.heatmapFbos.set(P,E)),f.bindFramebuffer.set(E.framebuffer),f.viewport.set([0,0,t.tileSize,t.tileSize]),f.clear({color:p.bo.transparent});const C=S.programConfigurations.get(n.id),D=h.useProgram("heatmap",C,!c),B=h.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),j=h.style.map.terrain.getTerrainData(o);D.draw(f,y.TRIANGLES,Ue.disabled,x,w,Xe.disabled,sl(t,h.transform.zoom,n.paint.get("heatmap-intensity"),1),j,B,n.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,n.paint,h.transform.zoom,C)}function $c(h,t,n,o,c){const f=h.context,y=f.gl,x=h.transform;f.setColorMode(h.colorModeForRenderPass());const w=qa(f,t),S=n.key,P=t.heatmapFbos.get(S);if(!P)return;f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.colorAttachment.get()),f.activeTexture.set(y.TEXTURE1),w.bind(y.LINEAR,y.CLAMP_TO_EDGE);const E=x.getProjectionData({overscaledTileID:n,applyTerrainMatrix:c,applyGlobeMatrix:!o});h.useProgram("heatmapTexture").draw(f,y.TRIANGLES,Ue.disabled,Ke.disabled,h.colorModeForRenderPass(),Xe.disabled,ta(h,t,0,1),null,E,t.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments,t.paint,x.zoom),P.destroy(),t.heatmapFbos.delete(S)}function vl(h,t,n){var o,c;const f=h.gl,y=f.createTexture();f.bindTexture(f.TEXTURE_2D,y),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR);const x=(o=h.HALF_FLOAT)!==null&&o!==void 0?o:f.UNSIGNED_BYTE,w=(c=h.RGBA16F)!==null&&c!==void 0?c:f.RGBA;f.texImage2D(f.TEXTURE_2D,0,w,t,n,0,f.RGBA,x,null);const S=h.createFramebuffer(t,n,!1,!1);return S.colorAttachment.set(y),S}function qa(h,t){return t.colorRampTexture||(t.colorRampTexture=new p.T(h,t.colorRamp,h.gl.RGBA)),t.colorRampTexture}function Hs(h,t,n,o,c,f,y,x){let w=256;if(c.stepInterpolant){const S=t.getSource().maxzoom,P=y.canonical.z===S?Math.ceil(1<<h.transform.maxZoom-y.canonical.z):1;w=p.al(p.ce(f.maxLineLength/p.a6*1024*P),256,n.maxTextureSize)}return x.gradient=p.cf({expression:c.gradientExpression(),evaluationKey:"lineProgress",resolution:w,image:x.gradient||void 0,clips:f.lineClipsArray}),x.texture?x.texture.update(x.gradient):x.texture=new p.T(n,x.gradient,o.RGBA),x.version=c.gradientVersion,x.texture}function nh(h,t,n,o,c){h.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),o.updatePaintBuffers(c)}function Gc(h,t,n,o,c,f){(c||h.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),h.lineAtlas.bind(t)),o.updatePaintBuffers(f)}function Et(h,t,n,o,c,f,y){const x=f.gradients[c.id];let w=x.texture;c.gradientVersion!==x.version&&(w=Hs(h,t,n,o,c,f,y,x)),n.activeTexture.set(o.TEXTURE0),w.bind(c.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE)}function Pn(h,t,n,o,c,f,y,x,w){const S=f.gradients[c.id];let P=S.texture;c.gradientVersion!==S.version&&(P=Hs(h,t,n,o,c,f,y,S)),n.activeTexture.set(o.TEXTURE0),P.bind(c.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE1),h.lineAtlas.bind(n),x.updatePaintBuffers(w)}function Si(h,t,n,o,c){if(!n||!o?.imageAtlas)return;const f=o.imageAtlas.patternPositions;let y=f[n.to.toString()],x=f[n.from.toString()];if(!y&&x&&(y=x),!x&&y&&(x=y),!y||!x){const w=c.getPaintProperty(t);y=f[w],x=f[w]}y&&x&&h.setConstantPatternPositions(y,x)}function Xs(h,t,n,o,c,f,y,x){var w;const S=h.context.gl,P="fill-pattern",E=n.paint.get(P),C=E?.constantOr(1),D=n.getCrossfadeParameters();let B,j,$,N,G;const X=h.transform,Z=n.paint.get("fill-translate"),U=n.paint.get("fill-translate-anchor");y?(j=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",B=S.LINES):(j=C?"fillPattern":"fill",B=S.TRIANGLES);const H=E.constantOr(null);for(const q of o){const Q=t.getTile(q);if(C&&!Q.patternsLoaded())continue;const ae=Q.getBucket(n);if(!ae)continue;const oe=ae.programConfigurations.get(n.id),fe=h.useProgram(j,oe),de=(w=h.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(q);C&&(h.context.activeTexture.set(S.TEXTURE0),Q.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),oe.updatePaintBuffers(D)),Si(oe,P,H,Q,n);const Me=X.getProjectionData({overscaledTileID:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0}),be=p.aL(X,Q,Z,U);if(y){N=ae.indexBuffer2,G=ae.segments2;const Se=[S.drawingBufferWidth,S.drawingBufferHeight];$=j==="fillOutlinePattern"&&C?Mc(h,D,Q,Se,be):Ic(Se,be)}else N=ae.indexBuffer,G=ae.segments,$=C?Rs(h,D,Q,be):{u_fill_translate:be};const he=h.stencilModeForClipping(q);fe.draw(h.context,B,c,he,f,Xe.backCCW,$,de,Me,n.id,ae.layoutVertexBuffer,N,G,n.paint,h.transform.zoom,oe)}}function la(h,t,n,o,c,f,y,x){var w;const S=h.context,P=S.gl,E="fill-extrusion-pattern",C=n.paint.get(E),D=C.constantOr(1),B=n.getCrossfadeParameters(),j=n.paint.get("fill-extrusion-opacity"),$=C.constantOr(null),N=h.transform;
812for(const G of o){const X=t.getTile(G),Z=X.getBucket(n);if(!Z)continue;const U=(w=h.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(G),H=Z.programConfigurations.get(n.id),q=h.useProgram(D?"fillExtrusionPattern":"fillExtrusion",H);D&&(h.context.activeTexture.set(P.TEXTURE0),X.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),H.updatePaintBuffers(B));const Q=N.getProjectionData({overscaledTileID:G,applyGlobeMatrix:!x,applyTerrainMatrix:!0});Si(H,E,$,X,n);const ae=p.aL(N,X,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),oe=n.paint.get("fill-extrusion-vertical-gradient"),fe=D?Pc(h,oe,j,ae,G,B,X):Sc(h,oe,j,ae);q.draw(S,S.gl.TRIANGLES,c,f,y,Xe.backCCW,fe,U,Q,n.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,n.paint,h.transform.zoom,H,h.style.map.terrain&&Z.centroidVertexBuffer)}}function Ys(h,t,n,o,c,f,y,x,w){var S;const P=h.style.projection,E=h.context,C=h.transform,D=E.gl,B=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],j=h.useProgram("hillshade",null,!1,B),$=!h.options.moving;for(const N of o){const G=t.getTile(N),X=G.fbo;if(!X)continue;const Z=P.getMeshFromTileID(E,N.canonical,x,!0,"raster"),U=(S=h.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(N);E.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,X.colorAttachment.get());const H=C.getProjectionData({overscaledTileID:N,aligned:$,applyGlobeMatrix:!w,applyTerrainMatrix:!0});j.draw(E,D.TRIANGLES,f,c[N.overscaledZ],y,Xe.backCCW,qu(h,G,n),U,H,n.id,Z.vertexBuffer,Z.indexBuffer,Z.segments)}}let Vr=0;function Wa(h,t,n,o,c,f,y,x,w){var S;const P=h.style.projection,E=h.context,C=h.transform,D=E.gl,B=h.useProgram("colorRelief"),j=!h.options.moving,$=n.paint.get("resampling")==="nearest"?D.NEAREST:D.LINEAR;let N=!0,G=0;for(const X of o){const Z=t.getTile(X),U=Z.dem;if(N){Vr||(Vr=D.getParameter(D.MAX_TEXTURE_SIZE));const fe=Vr,{elevationTexture:de,colorTexture:Me}=n.getColorRampTextures(E,fe,U.getUnpackVector());E.activeTexture.set(D.TEXTURE1),de.bind(D.NEAREST,D.CLAMP_TO_EDGE),E.activeTexture.set(D.TEXTURE4),Me.bind(D.LINEAR,D.CLAMP_TO_EDGE),N=!1,G=de.size[0]}if(!U?.data)continue;const H=U.stride,q=U.getPixels();if(E.activeTexture.set(D.TEXTURE0),E.pixelStoreUnpackPremultiplyAlpha.set(!1),Z.demTexture||(Z.demTexture=h.getTileTexture(H)),Z.demTexture){const fe=Z.demTexture;fe.update(q,{premultiply:!1}),fe.bind($,D.CLAMP_TO_EDGE)}else Z.demTexture=new p.T(E,q,D.RGBA,{premultiply:!1}),Z.demTexture.bind($,D.CLAMP_TO_EDGE);const Q=P.getMeshFromTileID(E,X.canonical,x,!0,"raster"),ae=(S=h.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(X),oe=C.getProjectionData({overscaledTileID:X,aligned:j,applyGlobeMatrix:!w,applyTerrainMatrix:!0});B.draw(E,D.TRIANGLES,f,c[X.overscaledZ],y,Xe.backCCW,Hu(n,Z.dem,G),ae,oe,n.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const In=[new p.P(0,0),new p.P(p.a6,0),new p.P(p.a6,p.a6),new p.P(0,p.a6)];function ca(h,t,n,o,c,f,y,x,w=!1,S=!1){var P;const E=o[o.length-1].overscaledZ,C=h.context,D=C.gl,B=h.useProgram("raster"),j=h.transform,$=h.style.projection,N=h.colorModeForRenderPass(),G=!h.options.moving,X=n.paint.get("raster-opacity"),Z=n.paint.get("resampling")==="nearest"||n.paint.get("raster-resampling")==="nearest"?D.NEAREST:D.LINEAR,U=n.paint.get("raster-fade-duration"),H=!!h.style.map.terrain;for(const q of o){const Q=h.getDepthModeForSublayer(q.overscaledZ-E,X===1?Ue.ReadWrite:Ue.ReadOnly,D.LESS),ae=t.getTile(q);C.activeTexture.set(D.TEXTURE0),ae.texture.bind(Z,D.CLAMP_TO_EDGE,D.LINEAR_MIPMAP_NEAREST),C.activeTexture.set(D.TEXTURE1);const{parentTile:oe,parentScaleBy:fe,parentTopLeft:de,fadeValues:Me}=Zc(ae,t,U,H);ae.fadeOpacity=Me.tileOpacity,oe?(oe.fadeOpacity=Me.parentTileOpacity,oe.texture.bind(Z,D.CLAMP_TO_EDGE,D.LINEAR_MIPMAP_NEAREST)):ae.texture.bind(Z,D.CLAMP_TO_EDGE,D.LINEAR_MIPMAP_NEAREST),ae.texture.useMipmap&&C.extTextureFilterAnisotropic&&h.transform.pitch>h.options.anisotropicFilterPitch&&D.texParameterf(D.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax);const be=(P=h.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(q),he=j.getProjectionData({overscaledTileID:q,aligned:G,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),Se=ll(de,fe,Me.fadeMix,n,x),Ae=$.getMeshFromTileID(C,q.canonical,f,y,"raster");B.draw(C,D.TRIANGLES,Q,c?c[q.overscaledZ]:Ke.disabled,N,w?Xe.frontCCW:Xe.backCCW,Se,be,he,n.id,Ae.vertexBuffer,Ae.indexBuffer,Ae.segments)}}function Zc(h,t,n,o){const c={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||o)return c;if(h.fadingParentID){const f=t.getLoadedTile(h.fadingParentID);if(!f)return c;
vendor: 5,137 bytes, line 812
812const y=Math.pow(2,f.tileID.overscaledZ-h.tileID.overscaledZ),x=[h.tileID.canonical.x*y%1,h.tileID.canonical.y*y%1],w=(function(S,P,E){const C=Je(),D=(C-P.timeAdded)/E,B=S.fadingDirection===Ni.Incoming,j=p.al((C-S.timeAdded)/E,0,1),$=p.al(1-D,0,1),N=B?j:$;return{tileOpacity:N,parentTileOpacity:B?$:j,fadeMix:{opacity:1,mix:1-N}}})(h,f,n);return{parentTile:f,parentScaleBy:y,parentTopLeft:x,fadeValues:w}}if(h.selfFading){const f=(function(y,x){const w=(Je()-y.timeAdded)/x,S=p.al(w,0,1);return{tileOpacity:S,fadeMix:{opacity:S,mix:0}}})(h,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:f}}return c}const qc=new p.bo(1,0,0,1),Wc=new p.bo(0,1,0,1),Hc=new p.bo(0,0,1,1),Xc=new p.bo(1,0,1,1),Nr=new p.bo(0,1,1,1);function xl(h,t,n,o){Ha(h,0,t+n/2,h.transform.width,n,o)}function bl(h,t,n,o){Ha(h,t-n/2,0,n,h.transform.height,o)}function Ha(h,t,n,o,c,f){const y=h.context,x=y.gl;x.enable(x.SCISSOR_TEST),x.scissor(t*h.pixelRatio,n*h.pixelRatio,o*h.pixelRatio,c*h.pixelRatio),y.clear({color:f}),x.disable(x.SCISSOR_TEST)}function Yc(h,t,n){var o;const c=h.context,f=c.gl,y=h.useProgram("debug"),x=Ue.disabled,w=Ke.disabled,S=h.colorModeForRenderPass(),P="$debug",E=(o=h.style.map.terrain)===null||o===void 0?void 0:o.getTerrainData(n);c.activeTexture.set(f.TEXTURE0);const C=t.getTileByID(n.key).latestRawTileData,D=Math.floor((C?.byteLength||0)/1024),B=t.getTile(n).tileSize,j=512/Math.min(B,512)*(n.overscaledZ/h.transform.zoom)*.5;let $=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),(function(G,X){G.initDebugOverlayCanvas();const Z=G.debugOverlayCanvas,U=G.context.gl,H=G.debugOverlayCanvas.getContext("2d");H.clearRect(0,0,Z.width,Z.height),H.shadowColor="white",H.shadowBlur=2,H.lineWidth=1.5,H.strokeStyle="white",H.textBaseline="top",H.font="bold 36px Open Sans, sans-serif",H.fillText(X,5,5),H.strokeText(X,5,5),G.debugOverlayTexture.update(Z),G.debugOverlayTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE)})(h,`${$} ${D}kB`);const N=h.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});y.draw(c,f.TRIANGLES,x,w,ut.alphaBlended,Xe.disabled,al(p.bo.transparent,j),null,N,P,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),y.draw(c,f.LINE_STRIP,x,w,S,Xe.disabled,al(p.bo.red),E,N,P,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function wl(h,t,n,o){const{isRenderingGlobe:c}=o,f=h.context,y=f.gl,x=h.transform,w=h.colorModeForRenderPass(),S=h.getDepthModeFor3D(),P=h.useProgram("terrain");f.bindFramebuffer.set(null),f.viewport.set([0,0,h.width,h.height]);for(const E of n){const C=t.getTerrainMesh(E.tileID),D=h.renderToTexture.getTexture(E),B=t.getTerrainData(E.tileID);f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,D.texture);const j=t.getMeshFrameDelta(x.zoom),$=x.calculateFogMatrix(E.tileID.toUnwrapped()),N=ks(j,$,h.style.sky,x.pitch,c),G=x.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(f,y.TRIANGLES,S,Ke.disabled,w,Xe.backCCW,N,B,G,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}function Tl(h,t){if(!t.mesh){const n=new p.aU;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const o=new p.aW;o.emplaceBack(0,1,2),o.emplaceBack(0,2,3),t.mesh=new ct(h.createVertexBuffer(n,Or.members),h.createIndexBuffer(o),p.aV.simpleSegment(0,0,n.length,o.length))}return t.mesh}const Kc={symbol:function(h,t,n,o,c,f){if(h.renderPass!=="translucent")return;const{isRenderingToTexture:y}=f,x=Ke.disabled,w=h.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(S,P,E,C,D,B,j,$,N){var G;const X=P.transform,Z=P.style.map.terrain,U=D==="map",H=B==="map";for(const q of S){const Q=C.getTile(q),ae=Q.getBucket(E);if(!(!((G=ae?.text)===null||G===void 0)&&G.segments.get().length))continue;const oe=p.aw(ae.textSizeData,X.zoom),fe=p.aK(Q,1,P.transform.zoom),de=Ai(U,P.transform,fe),Me=E.layout.get("icon-text-fit")!=="none"&&ae.hasIconData();if(oe){const be=Math.pow(2,X.zoom-Q.tileID.overscaledZ),he=Z?(Se,Ae)=>Z.getElevation(q,Se,Ae):null;Ga(ae,U,H,N,X,de,be,oe,Me,p.aL(X,Q,j,$),q.toUnwrapped(),he)}}})(o,h,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),c),n.paint.get("icon-opacity").constantOr(1)!==0&&gl(h,t,n,o,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),x,w,y),n.paint.get("text-opacity").constantOr(1)!==0&&gl(h,t,n,o,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),x,w,y),t.map.showCollisionBoxes&&(sa(h,t,n,o,!0),sa(h,t,n,o,!1))},circle:function(h,t,n,o,c){var f;if(h.renderPass!=="translucent")return;const{isRenderingToTexture:y}=c,x=n.paint.get("circle-opacity"),w=n.paint.get("circle-stroke-width"),S=n.paint.get("circle-stroke-opacity"),P=!n.layout.get("
812circle-sort-key").isConstant();if(x.constantOr(1)===0&&(w.constantOr(1)===0||S.constantOr(1)===0))return;const E=h.context,C=E.gl,D=h.transform,B=h.getDepthModeForSublayer(0,Ue.ReadOnly),j=Ke.disabled,$=h.colorModeForRenderPass(),N=[],G=D.getCircleRadiusCorrection();for(const X of o){const Z=t.getTile(X),U=Z.getBucket(n);if(!U)continue;const H=n.paint.get("circle-translate"),q=n.paint.get("circle-translate-anchor"),Q=p.aL(D,Z,H,q),ae=U.programConfigurations.get(n.id),oe=h.useProgram("circle",ae),fe=U.layoutVertexBuffer,de=U.indexBuffer,Me=(f=h.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(X),be={programConfiguration:ae,program:oe,layoutVertexBuffer:fe,indexBuffer:de,uniformValues:Ec(h,Z,n,Q,G),terrainData:Me,projectionData:D.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!y,applyTerrainMatrix:!0})};if(P){const he=U.segments.get();for(const Se of he)N.push({segments:new p.aV([Se]),sortKey:Se.sortKey,state:be})}else N.push({segments:U.segments,sortKey:0,state:be})}P&&N.sort(((X,Z)=>X.sortKey-Z.sortKey));for(const X of N){const{programConfiguration:Z,program:U,layoutVertexBuffer:H,indexBuffer:q,uniformValues:Q,terrainData:ae,projectionData:oe}=X.state;U.draw(E,C.TRIANGLES,B,j,$,Xe.backCCW,Q,ae,oe,n.id,H,q,X.segments,n.paint,h.transform.zoom,Z)}},heatmap:function(h,t,n,o,c){if(n.paint.get("heatmap-opacity")===0)return;const f=h.context,{isRenderingToTexture:y,isRenderingGlobe:x}=c;if(h.style.map.terrain){for(const w of o){const S=t.getTile(w);t.hasRenderableParent(w)||(h.renderPass==="offscreen"?yl(h,S,n,w,x):h.renderPass==="translucent"&&$c(h,n,w,y,x))}f.viewport.set([0,0,h.width,h.height])}else h.renderPass==="offscreen"?(function(w,S,P,E){const C=w.context,D=C.gl,B=w.transform,j=Ke.disabled,$=new ut([D.ONE,D.ONE],p.bo.transparent,[!0,!0,!0,!0]);(function(N,G,X){const Z=N.gl;N.activeTexture.set(Z.TEXTURE1),N.viewport.set([0,0,G.width/4,G.height/4]);let U=X.heatmapFbos.get(p.cd);U?(Z.bindTexture(Z.TEXTURE_2D,U.colorAttachment.get()),N.bindFramebuffer.set(U.framebuffer)):(U=vl(N,G.width/4,G.height/4),X.heatmapFbos.set(p.cd,U))})(C,w,P),C.clear({color:p.bo.transparent});for(const N of E){if(S.hasRenderableParent(N))continue;const G=S.getTile(N),X=G.getBucket(P);if(!X)continue;const Z=X.programConfigurations.get(P.id),U=w.useProgram("heatmap",Z),H=B.getProjectionData({overscaledTileID:N,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),q=B.getCircleRadiusCorrection();U.draw(C,D.TRIANGLES,Ue.disabled,j,$,Xe.backCCW,sl(G,B.zoom,P.paint.get("heatmap-intensity"),q),null,H,P.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,P.paint,B.zoom,Z)}C.viewport.set([0,0,w.width,w.height])})(h,t,n,o):h.renderPass==="translucent"&&(function(w,S){const P=w.context,E=P.gl;P.setColorMode(w.colorModeForRenderPass());const C=S.heatmapFbos.get(p.cd);C&&(P.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,C.colorAttachment.get()),P.activeTexture.set(E.TEXTURE1),qa(P,S).bind(E.LINEAR,E.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(P,E.TRIANGLES,Ue.disabled,Ke.disabled,w.colorModeForRenderPass(),Xe.disabled,ta(w,S,0,1),null,null,S.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,S.paint,w.transform.zoom))})(h,n)},line:function(h,t,n,o,c){var f;if(h.renderPass!=="translucent")return;const{isRenderingToTexture:y}=c,x=n.paint.get("line-opacity"),w=n.paint.get("line-width");if(x.constantOr(1)===0||w.constantOr(1)===0)return;const S=h.getDepthModeForSublayer(0,Ue.ReadOnly),P=h.colorModeForRenderPass(),E=n.paint.get("line-dasharray"),C=E.constantOr(1),D=n.paint.get("line-pattern"),B=D.constantOr(1),j=n.paint.get("line-gradient"),$=n.getCrossfadeParameters();let N;N=B?"linePattern":C&&j?"lineGradientSDF":C?"lineSDF":j?"lineGradient":"line";const G=h.context,X=G.gl,Z=h.transform;let U=!0;for(const H of o){const q=t.getTile(H);if(B&&!q.patternsLoaded())continue;const Q=q.getBucket(n);if(!Q)continue;const ae=Q.programConfigurations.get(n.id),oe=h.context.program.get(),fe=h.useProgram(N,ae),de=U||fe.program!==oe,Me=(f=h.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(H),be=D.constantOr(null),he=E?.constantOr(null);if(be&&q.imageAtlas){const ot=q.imageAtlas,zt=ot.patternPositions[be.to.toString()],kt=ot.patternPositions[be.from.toString()];zt&&kt&&ae.setConstantPatternPositions(zt,kt)}else if(he){const ot=n.layout.get("line-cap").constantOr(null)==="round",zt=h.lineAtlas.getDash(he.to,ot),kt=h.lineAtlas.getDash(he.from,ot);ae.setConstantDashPositions(zt,kt)}const Se=Z.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!y,applyTerrainMatrix:!0}),Ae=Z.getPixelScale();let rt;B?(rt=zc(h,q,n,Ae,$),nh(G,X,q,ae,$)):C&&j?(rt=Dc(h,q,n,Ae,$,Q.lineClipsArray.length),Pn(h,t,G,X,n,Q,H,ae,$)):C?(rt=ol(h,q,n,Ae,$),Gc(h,G,X,ae,de,$)):j?(rt=Ac(h,q,n,Ae,Q.lineClipsArray.length),Et(h,t,G,X,n,Q,H)):rt=Oa(h,q,n,Ae);const Ct=h.stencilModeForClipping(H);fe.draw(G,X.TRIANGLES,S,Ct,P,Xe.disabled,rt,Me,Se,n.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,n.paint,h.transform.zoom,ae,Q.layoutVertexBuffer2),U=!1}},fill:function(h,t,n,o,c){const f=n.paint.get("fill-color"),y=n.paint.get("fill-opacity");if(y.constantOr(1)===0)return;const{isRenderingToTexture:x}=c,w=h.colorModeForRenderPass(),S=n.paint.get("fill-pattern"),P=h.opaquePassEnabledForLayer()&&!S.constantOr(1)&&f.constantOr(p.bo.transparent).a===1&&y.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===P){const E=h.getDepthModeForSublayer(1,h.renderPass==="opaque"?Ue.ReadWrite:Ue.ReadOnly);Xs(h,t,n,o,E,w,!1,x)}if(h.renderPass==="translucent"&&n.paint.get("fill-antialias")){const E=h.getDepthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ue.ReadOnly);Xs(h,t,n,o,E,w,!0,x)}},fillExtrusion:function(h,t,n,o,c){const f=n.paint.get("fill-extrusion-opacity");if(f===0)return;const{isRenderingToTexture:y}=c;if(h.renderPass==="translucent"){const x=new Ue(h.context.gl.LEQUAL,Ue.ReadWrite,h.depthRangeFor3D);if(f!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))la(h,t,n,o,x,Ke.disabled,ut.disabled,y),la(h,t,n,o,x,h.stencilModeFor3D(),h.colorModeForRenderPass(),y);else{const w=h.colorModeForRenderPass();la(h,t,n,o,x,Ke.disabled,w,y)}}},hillshade:function(h,t,n,o,c){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const{isRenderingToTexture:f}=c,y=h.context,x=h.style.projection.useSubdivision,w=h.getDepthModeForSublayer(0,Ue.ReadOnly),S=h.colorModeForRenderPass();if(h.renderPass==="offscreen")(function(P,E,C,D,B,j,$){const N=P.context,G=N.gl,X=D.paint.get("resampling")==="nearest"?G.NEAREST:G.LINEAR;for(const Z of C){const U=E.getTile(Z),H=U.dem;if(!H?.data||!U.needsHillshadePrepare)continue;
vendor: 6,974 bytes, lines 812-814
812const q=H.dim,Q=H.stride,ae=H.getPixels();if(N.activeTexture.set(G.TEXTURE1),N.pixelStoreUnpackPremultiplyAlpha.set(!1),U.demTexture||(U.demTexture=P.getTileTexture(Q)),U.demTexture){const fe=U.demTexture;fe.update(ae,{premultiply:!1}),fe.bind(G.NEAREST,G.CLAMP_TO_EDGE)}else U.demTexture=new p.T(N,ae,G.RGBA,{premultiply:!1}),U.demTexture.bind(G.NEAREST,G.CLAMP_TO_EDGE);N.activeTexture.set(G.TEXTURE0);let oe=U.fbo;if(!oe){const fe=new p.T(N,{width:q,height:q,data:null},G.RGBA);fe.bind(X,G.CLAMP_TO_EDGE),oe=U.fbo=N.createFramebuffer(q,q,!0,!1),oe.colorAttachment.set(fe.texture)}N.bindFramebuffer.set(oe.framebuffer),N.viewport.set([0,0,q,q]),P.useProgram("hillshadePrepare").draw(N,G.TRIANGLES,B,j,$,Xe.disabled,Ls(U.tileID,H),null,null,D.id,P.rasterBoundsBuffer,P.quadTriangleIndexBuffer,P.rasterBoundsSegments),U.needsHillshadePrepare=!1}})(h,t,o,n,w,Ke.disabled,S),y.viewport.set([0,0,h.width,h.height]);else if(h.renderPass==="translucent")if(x){const[P,E,C]=h.stencilConfigForOverlapTwoPass(o);Ys(h,t,n,C,P,w,S,!1,f),Ys(h,t,n,C,E,w,S,!0,f)}else{const[P,E]=h.getStencilConfigForOverlapAndUpdateStencilID(o);Ys(h,t,n,E,P,w,S,!1,f)}},colorRelief:function(h,t,n,o,c){if(h.renderPass!=="translucent"||!o.length)return;const{isRenderingToTexture:f}=c,y=h.style.projection.useSubdivision,x=h.getDepthModeForSublayer(0,Ue.ReadOnly),w=h.colorModeForRenderPass();if(y){const[S,P,E]=h.stencilConfigForOverlapTwoPass(o);Wa(h,t,n,E,S,x,w,!1,f),Wa(h,t,n,E,P,x,w,!0,f)}else{const[S,P]=h.getStencilConfigForOverlapAndUpdateStencilID(o);Wa(h,t,n,P,S,x,w,!1,f)}},raster:function(h,t,n,o,c){if(h.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!o.length)return;const{isRenderingToTexture:f}=c,y=t.getSource(),x=h.style.projection.useSubdivision;if(y instanceof Rr)ca(h,t,n,o,null,!1,!1,y.tileCoords,y.flippedWindingOrder,f);else if(x){const[w,S,P]=h.stencilConfigForOverlapTwoPass(o);ca(h,t,n,P,w,!1,!0,In,!1,f),ca(h,t,n,P,S,!0,!0,In,!1,f)}else{const[w,S]=h.getStencilConfigForOverlapAndUpdateStencilID(o);ca(h,t,n,S,w,!1,!0,In,!1,f)}},background:function(h,t,n,o,c){var f;const y=n.paint.get("background-color"),x=n.paint.get("background-opacity");if(x===0)return;const{isRenderingToTexture:w}=c,S=h.context,P=S.gl,E=h.style.projection,C=h.transform,D=C.tileSize,B=n.paint.get("background-pattern");if(h.isPatternMissing(B))return;const j=!B&&y.a===1&&x===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==j)return;const $=Ke.disabled,N=h.getDepthModeForSublayer(0,j==="opaque"?Ue.ReadWrite:Ue.ReadOnly),G=h.colorModeForRenderPass(),X=h.useProgram(B?"backgroundPattern":"background"),Z=o||cn(C,{tileSize:D,terrain:h.style.map.terrain});B&&(S.activeTexture.set(P.TEXTURE0),h.imageManager.bind(h.context));const U=n.getCrossfadeParameters();for(const H of Z){const q=C.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!w,applyTerrainMatrix:!0}),Q=B?dl(x,h,B,{tileID:H,tileSize:D},U):bn(x,y),ae=(f=h.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(H),oe=E.getMeshFromTileID(S,H.canonical,!1,!0,"raster");X.draw(S,P.TRIANGLES,N,$,G,Xe.backCCW,Q,ae,q,n.id,oe.vertexBuffer,oe.indexBuffer,oe.segments)}},sky:function(h,t){const n=h.context,o=n.gl,c=((P,E,C)=>{const D=Math.cos(E.rollInRadians),B=Math.sin(E.rollInRadians),j=ln(E),$=E.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:P.properties.get("sky-color"),u_horizon_color:P.properties.get("horizon-color"),u_horizon:[(E.width/2-j*B)*C,(E.height/2+j*D)*C],u_horizon_normal:[-B,D],u_sky_horizon_blend:P.properties.get("sky-horizon-blend")*E.height/2*C,u_sky_blend:$}})(t,h.style.map.transform,h.pixelRatio),f=new Ue(o.LEQUAL,Ue.ReadWrite,[0,1]),y=Ke.disabled,x=h.colorModeForRenderPass(),w=h.useProgram("sky"),S=Tl(n,t);w.draw(n,o.TRIANGLES,f,y,x,Xe.disabled,c,null,void 0,"sky",S.vertexBuffer,S.indexBuffer,S.segments)},atmosphere:function(h,t,n){const o=h.context,c=o.gl,f=h.useProgram("atmosphere"),y=new Ue(c.LEQUAL,Ue.ReadOnly,[0,1]),x=h.transform,w=(function($,N){const G=$.properties.get("position"),X=[-G.x,-G.y,-G.z],Z=p.ap(new Float64Array(16));return $.properties.get("anchor")==="map"&&(p.be(Z,Z,N.rollInRadians),p.bf(Z,Z,-N.pitchInRadians),p.be(Z,Z,N.bearingInRadians),p.bf(Z,Z,N.center.lat*Math.PI/180),p.bI(Z,Z,-N.center.lng*Math.PI/180)),p.cg(X,X,Z),X})(n,h.transform),S=x.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),P=t.properties.get("atmosphere-blend")*S.projectionTransition;if(P===0)return;const E=Di(x.worldSize,x.center.lat),C=x.inverseProjectionMatrix,D=new Float64Array(4);D[3]=1,p.aE(D,D,x.modelViewProjectionMatrix),D[0]/=D[3],D[1]/=D[3],D[2]/=D[3],D[3]=1,p.aE(D,D,C),D[0]/=D[3],D[1]/=D[3],D[2]/=D[3],D[3]=1;const B=(($,N,G,X,Z)=>({u_sun_pos:$,u_atmosphere_blend:N,u_globe_position:G,u_globe_radius:X,u_inv_proj_matrix:Z}))(w,P,[D[0],D[1],D[2]],E,C),j=Tl(o,t);f.draw(o,c.TRIANGLES,y,Ke.disabled,ut.alphaBlended,Xe.disabled,B,null,null,"atmosphere",j.vertexBuffer,j.indexBuffer,j.segments)},custom:function(h,t,n,o){const{isRenderingGlobe:c}=o,f=h.context,y=n.implementation,x=h.style.projection,w=h.transform,S=w.getProjectionDataForCustomLayer(c),P={farZ:w.farZ,nearZ:w.nearZ,fov:w.fov*Math.PI/180,modelViewProjectionMatrix:w.modelViewProjectionMatrix,projectionMatrix:w.projectionMatrix,shaderData:{variantName:x.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 813uniform mat4 u_projection_matrix; 814${x.shaderPreludeCode.vertexSource}`,define:x.shaderDefine},defaultProjectionData:S},E=y.renderingMode?y.renderingMode:"2d";if(h.renderPass==="offscreen"){const C=y.prerender;C&&(h.setCustomLayerDefaults(),f.setColorMode(h.colorModeForRenderPass()),C.call(y,f.gl,P),f.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),f.setColorMode(h.colorModeForRenderPass()),f.setStencilMode(Ke.disabled);const C=E==="3d"?h.getDepthModeFor3D():h.getDepthModeForSublayer(0,Ue.ReadOnly);f.setDepthMode(C),y.render(f.gl,P),f.setDirty(),h.setBaseState(),f.bindFramebuffer.set(null)}},debug:function(h,t,n){for(const o of n)Yc(h,t,o)},debugPadding:function(h){const t=h.transform.padding;xl(h,h.transform.height-(t.top||0),3,qc),xl(h,t.bottom||0,3,Wc),bl(h,t.left||0,3,Hc),bl(h,h.transform.width-(t.right||0),3,Xc);const n=h.transform.centerPoint;(function(o,c,f,y){Ha(o,c-1,f-10,2,20,y),Ha(o,c-10,f-1,20,2,y)})(h,n.x,h.transform.height-n.y,Nr)},terrainDepth:function(h,t){const n=h.context,o=n.gl,c=h.transform,f=ut.unblended,y=new Ue(o.LEQUAL,Ue.ReadWrite,[0,1]),x=t.tileManager.getRenderableTiles(),w=h.useProgram("terrainDepth");n.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),n.clear({color:p.bo.transparent,depth:1});for(const S of x){const P=t.getTerrainMesh(S.tileID),E=t.getTerrainData(S.tileID),C=c.getProjectionData({overscaledTileID:S.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}
vendor: 4,217 bytes, line 814
814),D={u_ele_delta:t.getMeshFrameDelta(c.zoom)};w.draw(n,o.TRIANGLES,y,Ke.disabled,f,Xe.backCCW,D,E,C,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,h.width,h.height])},terrainCoords:function(h,t){const n=h.context,o=n.gl,c=h.transform,f=ut.unblended,y=new Ue(o.LEQUAL,Ue.ReadWrite,[0,1]),x=t.getCoordsTexture(),w=t.tileManager.getRenderableTiles(),S=h.useProgram("terrainCoords");n.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),n.clear({color:p.bo.transparent,depth:1}),t.coordsIndex=[];for(const P of w){const E=t.getTerrainMesh(P.tileID),C=t.getTerrainData(P.tileID);n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,x.texture);const D={u_terrain_coords_id:(255-t.coordsIndex.length)/255,u_texture:0,u_ele_delta:t.getMeshFrameDelta(c.zoom)},B=c.getProjectionData({overscaledTileID:P.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});S.draw(n,o.TRIANGLES,y,Ke.disabled,f,Xe.backCCW,D,C,B,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),t.coordsIndex.push(P.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,h.width,h.height])}};class Xa{constructor(t,n){this.drawFunctions=Kc,this.context=new Ws(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:p.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Yt.maxOverzooming+Yt.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new wi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const t=this.context,n=new p.aU;n.emplaceBack(0,0),n.emplaceBack(p.a6,0),n.emplaceBack(0,p.a6),n.emplaceBack(p.a6,p.a6),this.tileExtentBuffer=t.createVertexBuffer(n,Or.members),this.tileExtentSegments=p.aV.simpleSegment(0,0,4,2);const o=new p.aU;o.emplaceBack(0,0),o.emplaceBack(p.a6,0),o.emplaceBack(0,p.a6),o.emplaceBack(p.a6,p.a6),this.debugBuffer=t.createVertexBuffer(o,Or.members),this.debugSegments=p.aV.simpleSegment(0,0,4,5);const c=new p.ch;c.emplaceBack(0,0,0,0),c.emplaceBack(p.a6,0,p.a6,0),c.emplaceBack(0,p.a6,0,p.a6),c.emplaceBack(p.a6,p.a6,p.a6,p.a6),this.rasterBoundsBuffer=t.createVertexBuffer(c,Ba.members),this.rasterBoundsSegments=p.aV.simpleSegment(0,0,4,2);const f=new p.aU;f.emplaceBack(0,0),f.emplaceBack(p.a6,0),f.emplaceBack(0,p.a6),f.emplaceBack(p.a6,p.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(f,Or.members),this.rasterBoundsSegmentsPosOnly=p.aV.simpleSegment(0,0,4,5);const y=new p.aU;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(y,Or.members),this.viewportSegments=p.aV.simpleSegment(0,0,4,2);const x=new p.ci;x.emplaceBack(0),x.emplaceBack(1),x.emplaceBack(3),x.emplaceBack(2),x.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(x);const w=new p.aW;w.emplaceBack(1,0,2),w.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(w);const S=this.context.gl;this.stencilClearMode=new Ke({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO),this.tileExtentMesh=new ct(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=p.O();p.c7(o,0,this.width,this.height,0,0,1),p.S(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const c={mainMatrix:o,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,Ue.disabled,this.stencilClearMode,ut.disabled,Xe.disabled,null,null,c,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,o){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n?.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const c=this.context;c.setColorMode(ut.disabled),c.setDepthMode(Ue.disabled);const f={};for(const y of n)f[y.key]=this.nextStencilID++;
vendor: 4,207 bytes, line 814
814this._renderTileMasks(f,n,o,!0),this._renderTileMasks(f,n,o,!1),this._tileClippingMaskIDs=f}_renderTileMasks(t,n,o,c){var f;const y=this.context,x=y.gl,w=this.style.projection,S=this.transform,P=this.useProgram("clippingMask");for(const E of n){const C=t[E.key],D=(f=this.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(E),B=w.getMeshFromTileID(this.context,E.canonical,c,!0,"stencil"),j=S.getProjectionData({overscaledTileID:E,applyGlobeMatrix:!o,applyTerrainMatrix:!0});P.draw(y,x.TRIANGLES,Ue.disabled,new Ke({func:x.ALWAYS,mask:0},C,255,x.KEEP,x.KEEP,x.REPLACE),ut.disabled,o?Xe.disabled:Xe.backCCW,null,D,j,"$clipping",B.vertexBuffer,B.indexBuffer,B.segments)}}_renderTilesDepthBuffer(){var t;const n=this.context,o=n.gl,c=this.style.projection,f=this.transform,y=this.useProgram("depth"),x=this.getDepthModeFor3D(),w=cn(f,{tileSize:f.tileSize});for(const S of w){const P=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(S),E=c.getMeshFromTileID(this.context,S.canonical,!0,!0,"raster"),C=f.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!0,applyTerrainMatrix:!0});y.draw(n,o.TRIANGLES,x,Ke.disabled,ut.disabled,Xe.backCCW,null,P,C,"$clipping",E.vertexBuffer,E.indexBuffer,E.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Ke({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Ke({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,o=t.sort(((y,x)=>x.overscaledZ-y.overscaledZ)),c=o[o.length-1].overscaledZ,f=o[0].overscaledZ-c+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const y={};for(let x=0;x<f;x++)y[x+c]=new Ke({func:n.GEQUAL,mask:255},x+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=f,[y,o]}return[{[c]:Ke.disabled},o]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,o=t.sort(((y,x)=>x.overscaledZ-y.overscaledZ)),c=o[o.length-1].overscaledZ,f=o[0].overscaledZ-c+1;if(this.clearStencil(),f>1){const y={},x={};for(let w=0;w<f;w++)y[w+c]=new Ke({func:n.GREATER,mask:255},f+1+w,255,n.KEEP,n.KEEP,n.REPLACE),x[w+c]=new Ke({func:n.GREATER,mask:255},1+w,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*f+1,[y,x,o]}return this.nextStencilID=3,[{[c]:new Ke({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[c]:new Ke({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ut([t.CONSTANT_COLOR,t.ONE],new p.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ut.unblended:ut.alphaBlended}getDepthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return Ue.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ue(o||this.context.gl.LEQUAL,n,[c,c])}getDepthModeFor3D(){return new Ue(this.context.gl.LEQUAL,Ue.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o,c,f;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Je()),this.imageManager.beginFrame();const y=this.style._order,x=this.style.tileManagers,w={},S={},P={},E={isRenderingToTexture:!1,isRenderingGlobe:((o=t.projection)===null||o===void 0?void 0:o.transitionState)>0};for(const D in x){const B=x[D];B.used&&B.prepare(this.context),w[D]=B.getVisibleCoordinates(!1),S[D]=w[D].slice().reverse(),P[D]=B.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let D=0;D<y.length;D++)if(this.style._layers[y[D]].is3D()){this.opaquePassCutoff=D;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const D of y){const B=this.style._layers[D];if(!B.hasOffscreenPass()||B.isHidden(this.transform.zoom))continue;const j=S[B.source];
814(B.type==="custom"||j.length)&&this.renderLayer(this,x[B.source],B,j,E)}if((c=this.style.projection)===null||c===void 0||c.updateGPUdependent({context:this.context,useProgram:D=>this.useProgram(D)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?p.bo.black:p.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const D=this.style._layers[y[this.currentLayer]],B=x[D.source],j=w[D.source];this._renderTileClippingMasks(D,j,!1),this.renderLayer(this,B,D,j,E)}this.renderPass="translucent";let C=!1;for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const D=this.style._layers[y[this.currentLayer]],B=x[D.source];if(!((f=this.renderToTexture)===null||f===void 0)&&f.renderLayer(D,E))continue;this.opaquePassEnabledForLayer()||C||(C=!0,E.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const j=(D.type==="symbol"?P:S)[D.source];this._renderTileClippingMasks(D,w[D.source],!!this.renderToTexture),this.renderLayer(this,B,D,j,E)}if(E.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const D=(function(B,j){let $=null;const N=Object.values(B._layers).flatMap((U=>U.source&&!U.isHidden(j)?[B.tileManagers[U.source]]:[])),G=N.filter((U=>U.getSource().type==="vector")),X=N.filter((U=>U.getSource().type!=="vector")),Z=U=>{(!$||$.getSource().maxzoom<U.getSource().maxzoom)&&($=U)};for(const U of G)Z(U);if(!$)for(const U of X)Z(U);return $})(this.style,this.transform.zoom);D&&this.drawFunctions.debug(this,D,D.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var n,o;if(!(!((o=(n=this.style)===null||n===void 0?void 0:n.map)===null||o===void 0)&&o.terrain))return;const c=this.terrainFacilitator.matrix,f=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.depthDirty;y||(y=t?!p.cj(c,f):!p.ck(c,f)),y||(y=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),y&&(p.cl(c,f),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,n;!((n=(t=this.style)===null||t===void 0?void 0:t.map)===null||n===void 0)&&n.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,n,o,c,f){if(o.isHidden(this.transform.zoom)||o.type!=="background"&&o.type!=="custom"&&!(c||[]).length)return;this.id=o.id;const y=this.drawFunctions;p.aQ(o)?y.symbol(t,n,o,c,this.style.placement.variableOffsets,f):p.cm(o)?y.circle(t,n,o,c,f):p.cn(o)?y.heatmap(t,n,o,c,f):p.co(o)?y.line(t,n,o,c,f):p.cp(o)?y.fill(t,n,o,c,f):p.cq(o)?y.fillExtrusion(t,n,o,c,f):p.cr(o)?y.hillshade(t,n,o,c,f):p.cs(o)?y.colorRelief(t,n,o,c,f):p.bU(o)?y.raster(t,n,o,c,f):p.ct(o)?y.background(t,n,o,c,f):p.cu(o)&&y.custom(t,n,o,f)}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.length<Xa.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n,o=!1,c=[]){var f;this.cache||(this.cache={});const y=!!this.style.map.terrain,x=this.style.projection,w=o?_t.projectionMercator:x.shaderPreludeCode,S=o?ui:x.shaderDefine,P=t+(n?n.cacheKey:"")+`/${o?zi:x.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(y?"/terrain":"")+(c?`/${c.join("/")}`:"");return(f=this.cache)[P]||(f[P]=new Zu(this.context,_t[t],n,Xu[t],this._showOverdrawInspector,y,w,S,c)),this.cache[P]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new p.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const o in this._tileTextures){const c=this._tileTextures[o];if(c)for(const f of c)f.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const o in this.cache){const c=this.cache[o];c?.program&&this.context.gl.deleteProgram(c.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function Sl(h,t){let n,o=!1,c=null;const f=()=>{c=null,o&&(h(...n),c=setTimeout(f,t),o=!1)};
vendor: 40,364 bytes, line 814
814return(...y)=>(o=!0,n=y,c||f(),c)}Xa.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Ya{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;const c=n.split("&").map((f=>f.split("=")));for(const f of c)f[0]===this._hashName&&(o=f);return(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let c=o;c.split("&").length>0&&(c=c.split("&")[0]),this._hashName&&(c=`${this._hashName}=${o}`);let f=window.location.hash.replace(c,"");f.startsWith("#&")?f=f.slice(0,1)+f.slice(2):f==="#"&&(f="");let y=window.location.href.replace(/(#.+)?$/,f);y=y.replace("&&","&"),window.history.replaceState(window.history.state,null,y)},this._updateHash=Sl(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,c=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,c),y=Math.round(n.lng*f)/f,x=Math.round(n.lat*f)/f,w=this._map.getBearing(),S=this._map.getPitch();let P="";if(P+=t?`/${y}/${x}/${o}`:`${o}/${x}/${y}`,(w||S)&&(P+="/"+Math.round(10*w)/10),S&&(P+=`/${Math.round(S)}`),this._hashName){const E=this._hashName;let C=!1;const D=window.location.hash.slice(1).split("&").map((B=>{const j=B.split("=")[0];return j===E?(C=!0,`${j}=${P}`):B})).filter((B=>B));return C||D.push(`${E}=${P}`),`#${D.join("&")}`}return`#${P}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new p.W(+t[2],+t[1])}catch{return!1}const n=+t[0],o=+(t[3]||0),c=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&o>=-180&&o<=180&&c>=this._map.getMinPitch()&&c<=this._map.getMaxPitch()}}const ua={linearity:.3,easing:p.cv(0,0,.3,1)},$i=p.e({deceleration:2500,maxSpeed:1400},ua),tr=p.e({deceleration:20,maxSpeed:1400},ua),Jc=p.e({deceleration:1e3,maxSpeed:360},ua),ir=p.e({deceleration:1e3,maxSpeed:90},ua),ah=p.e({deceleration:1e3,maxSpeed:360},ua);class sh{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Je(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=Je();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)n.zoom+=f.zoomDelta||0,n.bearing+=f.bearingDelta||0,n.pitch+=f.pitchDelta||0,n.roll+=f.rollDelta||0,f.panDelta&&n.pan._add(f.panDelta),f.around&&(n.around=f.around),f.pinchAround&&(n.pinchAround=f.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const f=or(n.pan.mag(),o,p.e({},$i,t||{})),y=n.pan.mult(f.amount/n.pan.mag()),x=this._map.cameraHelper.handlePanInertia(y,this._map.transform);c.center=x.easingCenter,c.offset=x.easingOffset,Ka(c,f)}if(n.zoom){const f=or(n.zoom,o,tr);c.zoom=p.cw(this._map.transform.zoom+f.amount,this._map.getZoomSnap(),f.amount),Ka(c,f)}if(n.bearing){const f=or(n.bearing,o,Jc);c.bearing=this._map.transform.bearing+p.al(f.amount,-179,179),Ka(c,f)}if(n.pitch){const f=or(n.pitch,o,ir);c.pitch=this._map.transform.pitch+f.amount,Ka(c,f)}if(n.roll){const f=or(n.roll,o,ah);c.roll=this._map.transform.roll+p.al(f.amount,-179,179),Ka(c,f)}if(c.zoom||c.bearing){const f=n.pinchAround===void 0?n.around:n.pinchAround;c.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),p.e(c,{noMoveStart:!0})}}function Ka(h,t){(!h.duration||h.duration<t.duration)&&(h.duration=t.duration,h.easing=t.easing)}function or(h,t,n){const{maxSpeed:o,linearity:c,deceleration:f}=n,y=p.al(h*c/(t/1e3),-o,o),x=Math.abs(y)/(f*c);return{easing:n.easing,duration:1e3*x,amount:y*(x/2)}}class Ri extends p.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,c={}){o=o instanceof MouseEvent?o:new MouseEvent(t,o);const f=me.mousePos(n.getCanvas(),o),y=n.unproject(f);super(t,p.e({point:f,lngLat:y,originalEvent:o},c)),this._defaultPrevented=!1,this.target=n}}class Ja extends p.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const c=t==="touchend"?o.changedTouches:o.touches,f=me.touchPos(n.getCanvasContainer(),c),y=f.map((w=>n.unproject(w))),x=f.reduce(((w,S,P,E)=>w.add(S.div(E.length))),new p.P(0,0));super(t,{points:f,point:x,lngLats:y,lngLat:n.unproject(x),originalEvent:o}),this._defaultPrevented=!1}}class Qc extends p.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class oh{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Qc(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ri(t.type,this._map,t))}mouseup(t){this._map.fire(new Ri(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ri(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ri(t.type,this._map,t))}mouseover(t){this._map.fire(new Ri(t.type,this._map,t))}mouseout(t){this._map.fire(new Ri(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ja(t.type,this._map,t))}touchmove(t){this._map.fire(new Ja(t.type,this._map,t))}touchend(t){this._map.fire(new Ja(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ja(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eu{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ri(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ri("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ri(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _r{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(p.P.convert(t),this._map.terrain)}}class lr{constructor(t,n){this._map=t,this._tr=new _r(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1,n.boxZoom&&typeof n.boxZoom=="object"&&(this._boxZoomEnd=n.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(me.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=o,this._box||(this._box=me.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const f=Math.min(c.x,o.x),y=Math.max(c.x,o.x),x=Math.min(c.y,o.y),w=Math.max(c.y,o.y);this._box.style.transform=`translate(${f}px,${x}px)`,this._box.style.width=y-f+"px",this._box.style.height=w-x+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,c=n;if(this.reset(),me.suppressClick(),o.x!==c.x||o.y!==c.y)return this._map.fire(new p.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,o,c,t):{cameraAnimation:f=>f.fitScreenCoordinates(o,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),me.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new p.n(t,{originalEvent:n}))}}function Ie(h,t){if(h.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${t.length}`);const n={};for(let o=0;o<h.length;o++)n[h[o].identifier]=t[o];return n}class tu{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=(function(c){const f=new p.P(0,0);for(const y of c)f._add(y);return f.div(c.length)})(n),this.touches=Ie(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const c=Ie(o,n);for(const f in this.touches){const y=c[f];(!y||y.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Qa{constructor(t){this.singleTap=new tu(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const c=this.singleTap.touchend(t,n,o);if(c){const f=t.timeStamp-this.lastTime<500,y=!this.lastTap||this.lastTap.dist(c)<30;if(f&&y||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class iu{constructor(t){this._tr=new _r(t),this._zoomIn=new Qa({numTouches:1,numTaps:2}),this._zoomOut=new Qa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const c=this._zoomIn.touchend(t,n,o),f=this._zoomOut.touchend(t,n,o),y=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:x=>x.easeTo({duration:300,zoom:p.cw(y.zoom+1,x.getZoomSnap()),around:y.unproject(c)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:x=>x.easeTo({duration:300,zoom:p.cw(y.zoom-1,x.getZoomSnap()),around:y.unproject(f)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=Array.isArray(n)?n[0]:n;return!this._moved&&c.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(o,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&me.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const es=0,Pl=2,lh={[es]:1,[Pl]:2};class Mn{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,o){const c=lh[o];return n.buttons===void 0||(n.buttons&c)!==c})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class ru{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Il{constructor(t=new Mn({checkCorrectEvent:()=>!0}),n=new ru){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,o){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?o(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>{this.mouseMoveStateManager.startMove(n)}),(n=>{this.oneFingerTouchMoveStateManager.startMove(n)}))}endMove(t){this._executeRelevantHandler(t,(n=>{this.mouseMoveStateManager.endMove(n)}),(n=>{this.oneFingerTouchMoveStateManager.endMove(n)}))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const Ks=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=t=>{t.preventDefault()}};class nu{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const c=Ie(o,n),f=new p.P(0,0),y=new p.P(0,0);let x=0;for(const S in c){const P=c[S],E=this._touches[S];E&&(f._add(P),y._add(P.sub(E)),x++,c[S]=P)}if(this._touches=c,this._shouldBePrevented(x)||!y.mag())return;const w=y.div(x);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(x),panDelta:w}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ml{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[c,f]=this._firstTwoTouches,y=Js(o,n,c),x=Js(o,n,f);if(!y||!x)return;const w=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],w,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[c,f]=this._firstTwoTouches,y=Js(o,n,c),x=Js(o,n,f);y&&x||(this._active&&me.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Js(h,t,n){for(let o=0;o<h.length;o++)if(h[o].identifier===n)return t[o]}function El(h,t){return Math.log(h/t)/Math.LN2}class au extends Ml{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(El(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:El(this._distance,o)*this._zoomRate,pinchAround:n}}}function Cl(h,t){return 180*h.angleWith(t)/Math.PI}class su extends Ml{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,o){const c=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Cl(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=Cl(t,this._startVector);return Math.abs(o)<n}}function Al(h){return Math.abs(h.y)>Math.abs(h.x)}class yr extends Ml{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Al(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),f=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,f,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+f.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,f=n.mag()>=2;if(!c&&!f)return;if(!c||!f)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const y=t.y>0==n.y>0;return Al(t)&&Al(n)&&y}}const ht={panStep:100,bearingStep:15,pitchStep:10};class ou{constructor(t){this._tr=new _r(t);const n=ht;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,o=0,c=0,f=0,y=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?o=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),f=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),y=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),y=1);break;default:return}return this._rotationDisabled&&(o=0,c=0),{cameraAnimation:x=>{const w=this._tr;x.easeTo({duration:300,easeId:"keyboardHandler",easing:Qs,zoom:n?p.cw(w.zoom+n*(t.shiftKey?2:1),x.getZoomSnap()):w.zoom,bearing:w.bearing+o*this._bearingStep,pitch:w.pitch+c*this._pitchStep,offset:[-f*this._panStep,-y*this._panStep],center:w.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Qs(h){return h*(2-h)}const ts=4.000244140625,zl=1/450;class Dl{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new _r(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=zl}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=Je(),c=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%ts==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*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()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=me.mousePos(this._map.getCanvas(),t),o=this._tr;this._aroundPoint=this._aroundCenter?o.transform.locationToScreenPoint(p.W.convert(o.center)):n,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const x=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=x),typeof this._targetZoom=="number"&&(this._targetZoom+=x)}if(this._delta!==0){const x=this._type==="wheel"&&Math.abs(this._delta)>ts?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*x)));this._delta<0&&w!==0&&(w=1/w);const S=typeof this._targetZoom!="number"?t.scale:p.ao(this._targetZoom),P=t.applyConstrain(t.getCameraLngLat(),p.ar(S*w)).zoom,E=this._map.getZoomSnap();if(this._type==="wheel"&&E>0){const C=p.cw(t.zoom,E);this._targetZoom=p.cw(P,E,P-C)}else this._targetZoom=P;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,o=this._startZoom,c=this._easing;let f,y=!1;if(this._type==="wheel"&&o&&c){const x=Je()-this._lastWheelEventTime,w=Math.min((x+5)/200,1),S=c(w);f=p.H.number(o,n,S),w<1?this._needsRerender=!0:y=!0}else f=n,y=!0;return this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=f,{noInertia:!0,needsRenderFrame:!y,zoomDelta:f-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=p.cy;if(this._prevEase){const o=this._prevEase,c=(Je()-o.start)/o.duration,f=o.easing(c+.01)-o.easing(c),y=.27/Math.sqrt(f*f+1e-4)*.01,x=Math.sqrt(.0729-y*y);n=p.cv(y,x,.25,1)}return this._prevEase={start:Je(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class kl{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 lu{constructor(t){this._tr=new _r(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:p.cw(this._tr.zoom+(t.shiftKey?-1:1),o.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ch{constructor(){this._tap=new Qa({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,o){if(!this._swipePoint)if(this._tapTime){const c=n[0],f=t.timeStamp-this._tapTime<500,y=this._tapPoint.dist(c)<30;f&&y?o.length>0&&(this._swipePoint=c,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const c=n[0],f=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:f/128*this._zoomRate}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const c=this._tap.touchend(t,n,o);c&&(this._tapTime=t.timeStamp,this._tapPoint=c)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rr{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class is{constructor(t,n,o,c){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=o,this._mouseRoll=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ee{constructor(t,n,o,c){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ze{constructor(t,n){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=me.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),c=document.createElement("div");c.className="maplibregl-desktop-message",c.textContent=n,this._container.appendChild(c);const f=document.createElement("div");f.className="maplibregl-mobile-message",f.textContent=o,this._container.appendChild(f),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new p.n("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Ur=h=>h.zoom||h.drag||h.roll||h.pitch||h.rotate;class cu extends p.n{}function ha(h){var t;return((t=h.panDelta)===null||t===void 0?void 0:t.mag())||h.zoomDelta||h.bearingDelta||h.pitchDelta||h.rollDelta}class di{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,n;return((n=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window}constructor(t,n){this.handleWindowEvent=c=>{this.handleEvent(c,`${c.type}Window`)},this.handleEvent=(c,f)=>{if(c.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const y=c.type==="renderFrame"?void 0:c,x={needsRenderFrame:!1},w={},S={};for(const{handlerName:C,handler:D,allowed:B}of this._handlers){if(!D.isEnabled())continue;let j;if(this._blockedByActive(S,B,C))D.reset();else if(D[f||c.type]){if(p.cz(c,f||c.type)){const $=me.mousePos(this._map.getCanvas(),c);j=D[f||c.type](c,$)}else if(p.cA(c,f||c.type)){const $=this._getMapTouches(c.touches),N=me.touchPos(this._map.getCanvas(),$);j=D[f||c.type](c,N,$)}else p.cB(f||c.type)||(j=D[f||c.type](c));this.mergeHandlerResult(x,w,j,C,y),j?.needsRenderFrame&&this._triggerRenderFrame()}(j||D.isActive())&&(S[C]=D)}const P={};for(const C in this._previousActiveHandlers)S[C]||(P[C]=y);this._previousActiveHandlers=S,(Object.keys(P).length||ha(x))&&(this._changes.push([x,w,P]),this._triggerRenderFrame()),(Object.keys(S).length||ha(x))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=x;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new sh(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[c,f,y]of this._listeners)c.addEventListener(f,c===this._ownerDocument?this.handleWindowEvent:this.handleEvent,y)}destroy(){for(const[t,n,o]of this._listeners)t.removeEventListener(n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new oh(n,t));const c=n.boxZoom=new lr(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const f=n.cooperativeGestures=new ze(n,t.cooperativeGestures);this._add("cooperativeGestures",f),t.cooperativeGestures&&f.enable();const y=new iu(n),x=new lu(n);n.doubleClickZoom=new kl(x,y),this._add("tapZoom",y),this._add("clickZoom",x),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const w=new ch;this._add("tapDragZoom",w);const S=n.touchPitch=new yr(n);this._add("touchPitch",S),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=()=>n.project(n.getCenter()),E=(function({enable:Z,clickTolerance:U,aroundCenter:H=!0,minPixelCenterThreshold:q=100,rotateDegreesPerPixelMoved:Q=.8},ae){const oe=new Mn({checkCorrectEvent:fe=>fe.button===0&&fe.ctrlKey||fe.button===2&&!fe.ctrlKey});return new gr({clickTolerance:U,move:(fe,de)=>{const Me=ae();if(H&&Math.abs(Me.y-fe.y)>q)return{bearingDelta:p.cx(new p.P(fe.x,de.y),de,Me)};let be=(de.x-fe.x)*Q;return H&&de.y<Me.y&&(be=-be),{bearingDelta:be}},moveStateManager:oe,enable:Z,assignEvents:Ks})})(t,P),C=(function({enable:Z,clickTolerance:U,pitchDegreesPerPixelMoved:H=-.5}){const q=new Mn({checkCorrectEvent:Q=>Q.button===0&&Q.ctrlKey||Q.button===2});return new gr({clickTolerance:U,move:(Q,ae)=>({pitchDelta:(ae.y-Q.y)*H}),moveStateManager:q,enable:Z,assignEvents:Ks})})(t),D=(function({enable:Z,clickTolerance:U,rollDegreesPerPixelMoved:H=.3},q){const Q=new Mn({checkCorrectEvent:ae=>ae.button===2&&ae.ctrlKey});return new gr({clickTolerance:U,move:(ae,oe)=>{const fe=q();let de=(oe.x-ae.x)*H;return oe.y<fe.y&&(de=-de),{rollDelta:de}},moveStateManager:Q,enable:Z,assignEvents:Ks})})(t,P);n.dragRotate=new is(t,E,C,D),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",C,["mouseRotate","mouseRoll"]),this._add("mouseRoll",D,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const B=(function({enable:Z,clickTolerance:U}){const H=new Mn({checkCorrectEvent:q=>q.button===0&&!q.ctrlKey});return new gr({clickTolerance:U,move:(q,Q)=>({around:Q,panDelta:Q.sub(q)}),activateOnStart:!0,moveStateManager:H,enable:Z,assignEvents:Ks})})(t),j=new nu(t,n);n.dragPan=new rr(o,B,j),this._add("mousePan",B),this._add("touchPan",j,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const $=new su,N=new au;n.touchZoomRotate=new Ee(o,N,$,w),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new eu(n));const G=n.scrollZoom=new Dl(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",G,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const X=n.keyboard=new ou(n);this._add("keyboard",X),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ur(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const c in t)if(c!==o&&!n?.includes(c))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,c,f){if(!o)return;p.e(t,o);const y={handlerName:c,originalEvent:o.originalEvent||f};o.zoomDelta!==void 0&&(n.zoom=y),o.panDelta!==void 0&&(n.drag=y),o.rollDelta!==void 0&&(n.roll=y),o.pitchDelta!==void 0&&(n.pitch=y),o.bearingDelta!==void 0&&(n.rotate=y)}_applyChanges(){const t={},n={},o={};for(const[c,f,y]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new p.P(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.rollDelta&&(t.rollDelta=(t.rollDelta||0)+c.rollDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),p.e(n,f),p.e(o,y);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const c=this._map,f=c._getTransformForUpdate(),y=c.terrain;if(!(ha(t)||y&&this._terrainMovement))return void this._fireEvents(n,o,!0);c._stop(!0);let{panDelta:x,zoomDelta:w,bearingDelta:S,pitchDelta:P,rollDelta:E,around:C,pinchAround:D}=t;D!==void 0&&(C=D),C||(C=c.transform.centerPoint),y&&!f.isPointOnMapSurface(C)&&(C=f.centerPoint);const B={panDelta:x,zoomDelta:w,rollDelta:E,pitchDelta:P,bearingDelta:S,around:C};this._map.cameraHelper.useGlobeControls&&!f.isPointOnMapSurface(C)&&(C=f.centerPoint);const j=C.distSqr(f.centerPoint)<.01?f.center:f.screenPointToLocation(x?C.sub(x):C);this._handleMapControls({terrain:y,tr:f,deltasForHelper:B,preZoomAroundLoc:j,combinedEventsInProgress:n,panDelta:x}),c._applyUpdatedTransform(f),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:o,preZoomAroundLoc:c,combinedEventsInProgress:f,panDelta:y}){const x=this._map.cameraHelper;if(x.handleMapControlsRollPitchBearingZoom(o,n),t)return x.useGlobeControls?(this._terrainMovement||!f.drag&&!f.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void x.handleMapControlsPan(o,n,c)):this._terrainMovement||!f.drag&&!f.zoom?void(f.drag&&this._terrainMovement&&y?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(y))):x.handleMapControlsPan(o,n,c)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void x.handleMapControlsPan(o,n,c));x.handleMapControlsPan(o,n,c)}_fireEvents(t,n,o){const c=Ur(this._eventsInProgress),f=Ur(t),y={};for(const E in t){const{originalEvent:C}=t[E];this._eventsInProgress[E]||(y[`${E}start`]=C),this._eventsInProgress[E]=t[E]}!c&&f&&this._fireEvent("movestart",f.originalEvent);for(const E in y)this._fireEvent(E,y[E]);f&&this._fireEvent("move",f.originalEvent);for(const E in t){const{originalEvent:C}=t[E];this._fireEvent(E,C)}const x={};let w;for(const E in this._eventsInProgress){const{handlerName:C,originalEvent:D}=this._eventsInProgress[E];this._handlersById[C].isActive()||(delete this._eventsInProgress[E],w=n[C]||D,x[`${E}end`]=w)}for(const E in x)this._fireEvent(E,x[E]);const S=Ur(this._eventsInProgress),P=(c||f)&&!S;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=D=>D!==0&&-this._bearingSnap<D&&D<this._bearingSnap;!E||!E.essential&&Wt.prefersReducedMotion?(this._map.fire(new p.n("moveend",{originalEvent:w})),C(this._map.getBearing())&&this._map.resetNorth()):(C(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:w})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new p.n(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new cu("renderFrame",{timeStamp:t})),this._applyChanges()}))}
814_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class uu extends p.E{constructor(t,n,o){super(),this._renderFrameCallback=()=>{const c=Math.min((Je()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(c)),c<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this._zoomSnap=o.zoomSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new p.W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,o){return t=p.P.convert(t).mult(-1),this.panTo(this.transform.center,p.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(p.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(p.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(p.cw(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(p.cw(this.getZoom()-1,this._zoomSnap),t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new p.n("movestart",n)).fire(new p.n("move",n)).fire(new p.n("moveend",n))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,o){return this.easeTo(p.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,p.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(p.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=Fe.convert(t).adjustAntiMeridian();const o=n?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,c){const f={top:0,bottom:0,right:0,left:0};if(typeof(c=p.e({padding:f,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const P=c.padding;c.padding={top:P,bottom:P,right:P,left:P}}const y=p.e(f,c.padding);c.padding=y;const x=this.transform,w=new Fe(t,n),S=this.cameraHelper.cameraForBoxAndBearing(c,y,w,o,x);return S&&this._zoomSnap&&(S.zoom=p.cw(S.zoom,this._zoomSnap,-1)),S}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,c,f){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(p.P.convert(t)),this.transform.screenPointToLocation(p.P.convert(n)),o,c),c,f)}_fitInternal(t,n,o){return t?(delete(n=p.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=p.cw(t.zoom,this._zoomSnap));const o=this._getTransformForUpdate();let c=!1,f=!1,y=!1;const x=o.zoom;this.terrain&&o.setElevation(this.terrain.getElevationForLngLatZoom(t.center?p.W.convert(t.center):o.center,t.zoom||o.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(o,t);const w=o.zoom!==x;return"elevation"in t&&o.elevation!==+t.elevation&&o.setElevation(+t.elevation),"bearing"in t&&o.bearing!==+t.bearing&&(c=!0,o.setBearing(+t.bearing)),"pitch"in t&&o.pitch!==+t.pitch&&(f=!0,o.setPitch(+t.pitch)),"roll"in t&&o.roll!==+t.roll&&(y=!0,o.setRoll(+t.roll)),t.padding==null||o.isPaddingEqual(t.padding)||o.setPadding(t.padding),this._applyUpdatedTransform(o),this.fire(new p.n("movestart",n)).fire(new p.n("move",n)),w&&this.fire(new p.n("zoomstart",n)).fire(new p.n("zoom",n)).fire(new p.n("zoomend",n)),c&&this.fire(new p.n("rotatestart",n)).fire(new p.n("rotate",n)).fire(new p.n("rotateend",n)),f&&this.fire(new p.n("pitchstart",n)).fire(new p.n("pitch",n)).fire(new p.n("pitchend",n)),y&&this.fire(new p.n("rollstart",n)).fire(new p.n("roll",n)).fire(new p.n("rollend",n)),this.fire(new p.n("moveend",n))}calculateCameraOptionsFromTo(t,n,o,c=0){const f=p.a7.fromLngLat(t,n),y=p.a7.fromLngLat(o,c),x=y.x-f.x,w=y.y-f.y,S=y.z-f.z,P=Math.hypot(x,w,S);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(x,w),C=p.ar(this.transform.cameraToCenterDistance/P/this.transform.tileSize),D=180*Math.atan2(x,-w)/Math.PI;let B=180*Math.acos(E/P)/Math.PI;return B=S<0?90-B:90+B,{center:y.toLngLat(),elevation:c,zoom:C,pitch:B,bearing:D}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,o,c,f){const y=this.transform.calculateCenterFromCameraLngLatAlt(t,n,o,c);return{center:y.center,elevation:y.elevation,zoom:y.zoom,bearing:o,pitch:c,roll:f}}easeTo(t,n){this._stop(!1,t.easeId),"zoom"in(t=p.e({offset:[0,0],duration:500,easing:p.cy},t))&&this._zoomSnap&&(t.zoom=p.cw(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&Wt.prefersReducedMotion)&&(t.duration=0);const o=this._getTransformForUpdate(),c=this.getBearing(),f=o.pitch,y=o.roll,x="bearing"in t?this._normalizeBearing(t.bearing,c):c,w="pitch"in t?+t.pitch:f,S="roll"in t?this._normalizeBearing(t.roll,y):y,P="padding"in t?t.padding:o.padding,E=p.P.convert(t.offset);let C,D;t.around&&(C=p.W.convert(t.around),D=o.locationToScreenPoint(C));const B={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},j=this.cameraHelper.handleEaseTo(o,{bearing:x,pitch:w,roll:S,padding:P,around:C,aroundPoint:D,offsetAsPoint:E,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=c!==x),this._pitching||(this._pitching=w!==f),this._rolling||(this._rolling=S!==y),this._padding=!o.isPaddingEqual(P),this._zooming||(this._zooming=j.isZooming),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,B),this.terrain&&this._prepareElevation(j.elevationCenter),this._ease(($=>{j.easeFunc($),this.terrain&&!t.freezeElevation&&this._updateElevation($),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),($=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,$)}),t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new p.n("movestart",t)),this._zooming&&!o.zooming&&this.fire(new p.n("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new p.n("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new p.n("pitchstart",t)),this._rolling&&!o.rolling&&this.fire(new p.n("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(p.H.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGroun
vendor: 9,772 bytes, line 814
814d()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),o=t.getCameraAltitude(),c=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(o<c){const f=this.calculateCameraOptionsFromTo(n,c,t.center,t.elevation);return{pitch:f.pitch,zoom:f.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((c=>this._elevateCameraIfInsideTerrain(c))),this.transformCameraUpdate&&n.push((c=>this.transformCameraUpdate(c))),!n.length)return;const o=t.clone();for(const c of n){const f=o.clone(),{center:y,zoom:x,roll:w,pitch:S,bearing:P,elevation:E}=c(f);y&&f.setCenter(y),E!==void 0&&f.setElevation(E),x!==void 0&&f.setZoom(x),w!==void 0&&f.setRoll(w),S!==void 0&&f.setPitch(S),P!==void 0&&f.setBearing(P),o.apply(f,!1)}this.transform.apply(o,!1)}_fireMoveEvents(t){this.fire(new p.n("move",t)),this._zooming&&this.fire(new p.n("zoom",t)),this._rotating&&this.fire(new p.n("rotate",t)),this._pitching&&this.fire(new p.n("pitch",t)),this._rolling&&this.fire(new p.n("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,c=this._rotating,f=this._pitching,y=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,o&&this.fire(new p.n("zoomend",t)),c&&this.fire(new p.n("rotateend",t)),f&&this.fire(new p.n("pitchend",t)),y&&this.fire(new p.n("rollend",t)),this.fire(new p.n("moveend",t))}flyTo(t,n){if(!t.essential&&Wt.prefersReducedMotion){const de=p.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(de,n)}this.stop(),"zoom"in(t=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.cy},t))&&this._zoomSnap&&(t.zoom=p.cw(t.zoom,this._zoomSnap));const o=this._getTransformForUpdate(),c=o.bearing,f=o.pitch,y=o.roll,x=o.padding,w="bearing"in t?this._normalizeBearing(t.bearing,c):c,S="pitch"in t?+t.pitch:f,P="roll"in t?this._normalizeBearing(t.roll,y):y,E="padding"in t?t.padding:o.padding,C=p.P.convert(t.offset);let D=o.centerPoint.add(C);const B=o.screenPointToLocation(D),j=this.cameraHelper.handleFlyTo(o,{bearing:w,pitch:S,roll:P,padding:E,locationAtOffset:B,offsetAsPoint:C,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let $=t.curve;const N=Math.max(o.width,o.height),G=N/j.scaleOfZoom,X=j.pixelPathLength;typeof j.scaleOfMinZoom=="number"&&($=Math.sqrt(N/j.scaleOfMinZoom/X*2));const Z=$*$;function U(de){const Me=(G*G-N*N+(de?-1:1)*Z*Z*X*X)/(2*(de?G:N)*Z*X);return Math.log(Math.sqrt(Me*Me+1)-Me)}function H(de){return(Math.exp(de)-Math.exp(-de))/2}function q(de){return(Math.exp(de)+Math.exp(-de))/2}const Q=U(!1);let ae=function(de){return q(Q)/q(Q+$*de)},oe=function(de){return N*((q(Q)*(H(Me=Q+$*de)/q(Me))-H(Q))/Z)/X;var Me},fe=(U(!0)-Q)/$;if(Math.abs(X)<2e-6||!isFinite(fe)){if(Math.abs(N-G)<1e-6)return this.easeTo(t,n);const de=G<N?-1:1;fe=Math.abs(Math.log(G/N))/$,oe=()=>0,ae=Me=>Math.exp(de*$*Me)}return t.duration="duration"in t?+t.duration:1e3*fe/("screenSpeed"in t?+t.screenSpeed/$:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=c!==w,this._pitching=S!==f,this._rolling=P!==y,this._padding=!o.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(j.targetCenter),this._ease((de=>{const Me=de*fe,be=1/ae(Me),he=oe(Me);this._rotating&&o.setBearing(p.H.number(c,w,de)),this._pitching&&o.setPitch(p.H.number(f,S,de)),this._rolling&&o.setRoll(p.H.number(y,P,de)),this._padding&&(o.interpolatePadding(x,E,de),D=o.centerPoint.add(C)),j.easeFunc(de,be,he,D),this.terrain&&!t.freezeElevation&&this._updateElevation(de),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=Je(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=p.X(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(p.W.convert(t),this.transform):null}}const eo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Gi{constructor(t=eo){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=me.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=me.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=me.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((c=>typeof c!="string"?"":c))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.tileManagers;for(const c in n){const f=n[c];if(f.used||f.usedForTerrain){const y=f.getSource();y.attribution&&!t.includes(y.attribution)&&t.push(y.attribution)}}t=t.filter((c=>String(c).trim())),t.sort(((c,f)=>c.length-f.length)),t=t.filter(((c,f)=>{for(let y=f+1;y<t.length;y++)if(t[y].includes(c))return!1;return!0}));const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=me.sanitize(o),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Rl{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var n;this._map=t,this._compact=(n=this.options)===null||n===void 0?void 0:n.compact,this._container=me.create("div","maplibregl-ctrl");const o=me.create("a","maplibregl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://maplibre.org/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class uh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;
814for(const c of o)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var hh=p.aS([{name:"a_pos3d",type:"Int16",components:3}]);class dh extends p.E{constructor(t){super(),this._lastTilesetChange=Je(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const o={};for(const c of cn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))o[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.terrainRttPosMatrix32f=new Float64Array(16),p.c7(c.terrainRttPosMatrix32f,0,p.a6,p.a6,0,0,1),this._tiles[c.key]=new Vn(c,this.tileSize),this._lastTilesetChange=Je());for(const c in this._tiles)o[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const o of this._renderableTilesKeys){const c=this._tiles[o].tileID,f=t.clone(),y=p.bj();if(c.canonical.equals(t.canonical))p.c7(y,0,p.a6,p.a6,0,0,1);else if(c.canonical.isChildOf(t.canonical)){const x=c.canonical.z-t.canonical.z,w=c.canonical.x-(c.canonical.x>>x<<x),S=c.canonical.y-(c.canonical.y>>x<<x),P=p.a6>>x;p.c7(y,0,P,P,0,0,1),p.Q(y,y,[-w*P,-S*P,0])}else{if(!t.canonical.isChildOf(c.canonical))continue;{const x=t.canonical.z-c.canonical.z,w=t.canonical.x-(t.canonical.x>>x<<x),S=t.canonical.y-(t.canonical.y>>x<<x),P=p.a6>>x;p.c7(y,0,p.a6,p.a6,0,0,1),p.Q(y,y,[w*P,S*P,0]),p.S(y,y,[1/2**x,1/2**x,0])}}f.terrainRttPosMatrix32f=new Float32Array(y),n[o]=f}return n}_getTerrainCoordsForTileRanges(t,n){const o={};for(const c of this._renderableTilesKeys){const f=this._tiles[c].tileID;if(!this._isWithinTileRanges(f,n))continue;const y=t.clone(),x=p.bj();if(f.canonical.z===t.canonical.z){const w=t.canonical.x-f.canonical.x+t.wrap*(1<<t.canonical.z),S=t.canonical.y-f.canonical.y;p.c7(x,0,p.a6,p.a6,0,0,1),p.Q(x,x,[w*p.a6,S*p.a6,0])}else if(f.canonical.z>t.canonical.z){const w=f.canonical.z-t.canonical.z,S=f.canonical.x-(f.canonical.x>>w<<w)+t.wrap*(1<<f.canonical.z),P=f.canonical.y-(f.canonical.y>>w<<w),E=t.canonical.x-(f.canonical.x>>w),C=t.canonical.y-(f.canonical.y>>w),D=p.a6>>w;p.c7(x,0,D,D,0,0,1),p.Q(x,x,[-S*D+E*p.a6,-P*D+C*p.a6,0])}else{const w=t.canonical.z-f.canonical.z,S=t.canonical.x-(t.canonical.x>>w<<w)+t.wrap*(1<<t.canonical.z),P=t.canonical.y-(t.canonical.y>>w<<w),E=(t.canonical.x>>w)-f.canonical.x,C=(t.canonical.y>>w)-f.canonical.y,D=p.a6<<w;p.c7(x,0,D,D,0,0,1),p.Q(x,x,[S*p.a6+E*D,P*p.a6+C*D,0])}y.terrainRttPosMatrix32f=new Float32Array(x),o[c]=y}return o}getSourceTile(t,n){var o,c;const f=this.tileManager._source;let y=t.overscaledZ-this.deltaZoom;if(y>f.maxzoom&&(y=f.maxzoom),y<f.minzoom)return;(o=this._sourceTileCache)[c=t.key]||(o[c]=t.scaledTo(y).key);let x=this.findTileInCaches(this._sourceTileCache[t.key]);if(!x?.dem&&n)for(;y>=f.minzoom&&!x?.dem;)x=this.findTileInCaches(t.scaledTo(y--).key);return x}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const o=n[t.canonical.z];return!!o&&(t.wrap>o.minWrap||t.wrap<o.maxWrap||t.canonical.x>=o.minTileXWrapped&&t.canonical.x<=o.maxTileXWrapped&&t.canonical.y>=o.minTileY&&t.canonical.y<=o.maxTileY)}}class rs{constructor(t,n,o){this._meshCache={},this.painter=t,this.tileManager=new dh(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qual
814ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,n,o,c=p.a6){var f;const y=t.normalizeCoordinates(n,o,c);if(!y)return 0;const x=this.getTerrainData(y.tileID),w=(f=x.tile)===null||f===void 0?void 0:f.dem;if(!w)return 0;const S=p.cC([],[y.x/c*p.a6,y.y/c*p.a6],x.u_terrain_matrix),P=[S[0]*w.dim,S[1]*w.dim],E=Math.floor(P[0]),C=Math.floor(P[1]),D=P[0]-E,B=P[1]-C;return w.get(E,C)*(1-D)*(1-B)+w.get(E+1,C)*D*(1-B)+w.get(E,C+1)*(1-D)*B+w.get(E+1,C+1)*D*B}getElevationForLngLatZoom(t,n){if(!p.cD(n,t.wrap()))return 0;const{tileID:o,mercatorX:c,mercatorY:f}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,c%p.a6,f%p.a6,p.a6)}getElevationForLngLat(t,n){const o=cn(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let c=0;for(const f of o)f.canonical.z>c&&(c=Math.min(f.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,c)}getElevation(t,n,o,c=p.a6){return this.getDEMElevation(t,n,o,c)*this.exaggeration}getTerrainData(t){var n,o;if(!this._emptyDemTexture){const y=this.painter.context,x=new p.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new p.T(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new p.T(y,new p.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=p.ap([])}const c=this.tileManager.getSourceTile(t,!0);if(c?.dem&&(!c.demTexture||c.needsTerrainPrepare)){const y=this.painter.context;c.demTexture=this.painter.getTileTexture(c.dem.stride),c.demTexture?c.demTexture.update(c.dem.getPixels(),{premultiply:!1}):c.demTexture=new p.T(y,c.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),c.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),c.needsTerrainPrepare=!1}const f=c&&c.toString()+c.tileID.key+t.key;if(f&&!this._demMatrixCache[f]){const y=this.tileManager.getSource().maxzoom;let x=t.canonical.z-c.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=y?x=t.canonical.z-y:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=t.canonical.x-(t.canonical.x>>x<<x),S=t.canonical.y-(t.canonical.y>>x<<x),P=p.cE(new Float64Array(16),[1/(p.a6<<x),1/(p.a6<<x),0]);p.Q(P,P,[w*p.a6,S*p.a6,0]),this._demMatrixCache[f]={matrix:P,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:((n=c?.dem)===null||n===void 0?void 0:n.dim)||1,u_terrain_matrix:f?this._demMatrixCache[f].matrix:this._emptyDemMatrix,u_terrain_unpack:((o=c?.dem)===null||o===void 0?void 0:o.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(c?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:c}}getFramebuffer(t){const n=this.painter,o=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===c||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new p.T(n.context,{width:o,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new p.T(n.context,{width:o,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let f=0,y=0;f<this._coordsTextureSize;f++)for(let x=0;x<this._coordsTextureSize;x++,y+=4)n[y+0]=255&x,n[y+1]=255&f,n[y+2]=x>>8<<4|f>>8,n[y+3]=0;const o=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new p.T(t,o,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();
vendor: 4,801 bytes, line 814
814const n=new Uint8Array(4),o=this.painter.context,c=o.gl,f=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),y=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),x=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(f,x-y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const w=n[0]+(n[2]>>4<<8),S=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],E=P&&this.tileManager.getTileByID(P);if(!E)return null;const C=this._coordsTextureSize,D=(1<<E.tileID.canonical.z)*C;return new p.a7((E.tileID.canonical.x*C+w)/D+E.tileID.wrap,(E.tileID.canonical.y*C+S)/D,this.getElevation(E.tileID,w,S,C))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,c=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const o=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,c=o&&t.canonical.y===0,f=o&&t.canonical.y===(1<<t.canonical.z)-1,y=`m_${c?"n":""}_${f?"s":""}`;if(this._meshCache[y])return this._meshCache[y];const x=this.painter.context,w=new p.cF,S=new p.aW,P=this.meshSize,E=p.a6/P,C=P*P;for(let q=0;q<=P;q++)for(let Q=0;Q<=P;Q++)w.emplaceBack(Q*E,q*E,0);for(let q=0;q<C;q+=P+1)for(let Q=0;Q<P;Q++)S.emplaceBack(Q+q,P+Q+q+1,P+Q+q+2),S.emplaceBack(Q+q,P+Q+q+2,Q+q+1);const D=w.length,B=D+(P+1),j=(P+1)*P,$=c?p.bq:0,N=c?0:1,G=f?p.br:p.a6,X=f?0:1;for(let q=0;q<=P;q++)w.emplaceBack(q*E,$,N);for(let q=0;q<=P;q++)w.emplaceBack(q*E,G,X);for(let q=0;q<P;q++)S.emplaceBack(j+q,B+q,B+q+1),S.emplaceBack(j+q,B+q+1,j+q+1),S.emplaceBack(0+q,D+q+1,D+q),S.emplaceBack(0+q,0+q+1,D+q+1);const Z=w.length,U=Z+2*(P+1);for(const q of[0,1])for(let Q=0;Q<=P;Q++)for(const ae of[0,1])w.emplaceBack(q*p.a6,Q*E,ae);for(let q=0;q<2*P;q+=2)S.emplaceBack(Z+q,Z+q+1,Z+q+3),S.emplaceBack(Z+q,Z+q+3,Z+q+2),S.emplaceBack(U+q,U+q+3,U+q+1),S.emplaceBack(U+q,U+q+2,U+q+3);const H=new ct(x.createVertexBuffer(w,hh.members),x.createIndexBuffer(S),p.aV.simpleSegment(0,0,w.length,S.length));return this._meshCache[y]=H,H}getMeshFrameDelta(t){return 2*Math.PI*p.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var o;if(!p.cD(n,t.wrap()))return 0;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(c).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n?.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=p.a7.fromLngLat(t.wrap()),c=(1<<n)*p.a6,f=o.x*c,y=o.y*c,x=Math.floor(f/p.a6),w=Math.floor(y/p.a6);return{tileID:new p.a3(n,0,n,x,w),mercatorX:f,mercatorY:y}}}class gt{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new p.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const dt={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class hu{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new gt(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}
814prepareForRender(t,n){var o,c,f;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((y=>!t._layers[y].isHidden(n))),this._coordsAscending={};for(const y in t.tileManagers){this._coordsAscending[y]={};const x=t.tileManagers[y].getVisibleCoordinates(),w=t.tileManagers[y].getSource(),S=w instanceof Rr?w.terrainTileRanges:null;for(const P of x){const E=this.terrain.tileManager.getTerrainCoords(P,S);for(const C in E)(f=this._coordsAscending[y])[C]||(f[C]=[]),this._coordsAscending[y][C].push(E[C])}}this._rttFingerprints={};for(const y of t._order){const x=t._layers[y],w=x.source;if(dt[x.type]&&!this._rttFingerprints[w]){this._rttFingerprints[w]={};const S=(c=(o=t.tileManagers[w])===null||o===void 0?void 0:o.getState().revision)!==null&&c!==void 0?c:0;for(const P in this._coordsAscending[w])this._rttFingerprints[w][P]=`${this._coordsAscending[w][P].map((E=>E.key)).sort().join()}#${S}`}}for(const y of this._renderableTiles)for(const x in this._rttFingerprints){const w=this._rttFingerprints[x][y.tileID.key];w&&w!==y.rttFingerprint[x]&&(y.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const o=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),c=t.type,f=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(dt[c]&&(this._prevType&&dt[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(t.id),!y))return!0;if(dt[this._prevType]||dt[c]&&y){this._prevType=c;const x=this._stacks.length-1,w=this._stacks[x]||[];for(const S of this._renderableTiles){if(this.pool.isFull()&&(wl(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(S),S.rtt[x]){const E=this.pool.getObjectForId(S.rtt[x].id);if(E.stamp===S.rtt[x].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),S.rtt[x]={id:P.id,stamp:P.stamp},f.context.bindFramebuffer.set(P.fbo.framebuffer),f.context.clear({color:p.bo.transparent,stencil:0}),f.currentStencilSource=void 0;for(const E of w){const C=f.style._layers[E],D=C.source?this._coordsAscending[C.source][S.tileID.key]:[S.tileID];f.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),f._renderTileClippingMasks(C,D,!0),f.renderLayer(f,f.style.tileManagers[C.source],C,D,o),C.source&&(S.rttFingerprint[C.source]=this._rttFingerprints[C.source][S.tileID.key])}}return wl(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects(),dt[c]}return!1}}const ns={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use â + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},to=Pe,io={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:eo,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileC
814acheSize:null,maxTileCacheZoomLevels:p.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let ro=class extends uu{get _ownerWindow(){var h,t;return((t=(h=this._container)===null||h===void 0?void 0:h.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(h){var t,n,o;const c=Object.assign(Object.assign(Object.assign({},io),h),{canvasContextAttributes:Object.assign(Object.assign({},io.canvasContextAttributes),h.canvasContextAttributes)});if(c.minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const f=new fn,y=new mn;c.minZoom!==void 0&&f.setMinZoom(c.minZoom),c.maxZoom!==void 0&&f.setMaxZoom(c.maxZoom),c.minPitch!==void 0&&f.setMinPitch(c.minPitch),c.maxPitch!==void 0&&f.setMaxPitch(c.maxPitch),c.renderWorldCopies!==void 0&&f.setRenderWorldCopies(c.renderWorldCopies),c.transformConstrain!==null&&f.setConstrainOverride(c.transformConstrain),super(f,y,{bearingSnap:c.bearingSnap,zoomSnap:c.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new uh,this._controls=[],this._mapId=p.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=w=>{if(w.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const S of Object.values(this.style._layers))if(S.type==="custom"&&console.warn(`Custom layer with id '${S.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),S._listeners)for(const[P]of Object.entries(S._listeners))console.warn(`Custom layer with id '${S.id}' had event listeners for event '${P}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new p.n("webglcontextlost",{originalEvent:w}))}else this.fire(new p.n("webglcontextlost",{originalEvent:w}))},this._contextRestored=w=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new p.n("webglcontextrestored",{originalEvent:w}))},this._onMapScroll=w=>{if(w.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._maxTileCacheZoomLevels=c.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},c.canvasContextAttributes),this._trackResize=c.trackResize===!0,this._bearingSnap=c.bearingSnap,this._zoomSnap=c.zoomSnap,this._centerClampedToGround=c.centerClampedToGround,this._refreshExpiredTiles=c.refreshExpiredTiles===!0,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=c.crossSourceCollisions===!0,this._collectResourceTiming=c.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ns),c.locale),this._clickTolerance=c.clickTolerance,this._overridePixelRatio=c.pixelRatio,this._maxCanvasSize=c.maxCanvasSize,this._zoomLevelsToOverscale=c.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=c.transformCameraUpdate,this.transformConstrain=c.transformConstrain,this.cancelPendingTileRequestsWhileZooming=c.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(c.anisotropicFilterPitch),c.reduceMotion!==void 0&&(Wt.prefersReducedMotion=c.reduceMotion),this._imageQueueHandle=Ei.addThrottleControl((()=>this.isMoving())),this._requestManager=new Ft(c.transformRequest),this._container=this._resolveContainer(c.container),c.maxBounds&&this.setMaxBounds(c.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new di(this,c),this._hash=c.hash?new Ya(typeof c.hash=="string"&&c.hash||void 0).addTo(this):void 0,!((t=this._hash)===null||t===void 0)&&t._onHashChange()||(this.jumpTo({center:c.center,elevation:c.elevation,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,roll:c.roll}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,p.e({},c.fitBoundsOptions,{duration:0}))));const x=typeof c.style=="string"||((o=(n=c.style)===null||n===void 0?void 0:n.projection)===null||o===void 0?void 0:o.type)!=="globe";this.resize(null,x),this._localIdeographFontFamily=c.localIdeographFontFamily,this._val
814idateStyle=c.validateStyle,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new Gi(typeof c.attributionControl=="boolean"?void 0:c.attributionControl)),c.maplibreLogo&&this.addControl(new Rl,c.logoPosition),this.on("style.load",(()=>{if(x||this._resizeTransform(),this.transform.unmodified){const w=p.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(w)}})),this.on("data",(w=>{this._update(w.dataType==="style"),this.fire(new p.n(`${w.dataType}data`,w))})),this.on("dataloading",(w=>{this.fire(new p.n(`${w.dataType}dataloading`,w))})),this.on("dataabort",(w=>{this.fire(new p.n("sourcedataabort",w))}))}_getMapId(){return this._mapId}setGlobalStateProperty(h,t){return this.style.setGlobalStateProperty(h,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h?.onAdd)return this.fire(new p.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=h.onAdd(this);this._controls.push(h);const o=this._controlPositions[t];return t.includes("bottom")?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(h){if(!h?.onRemove)return this.fire(new p.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.includes(h)}coveringTiles(h){return cn(this.transform,h)}calculateCameraOptionsFromTo(h,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(h,t,n,o)}resize(h,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new p.n("movestart",h)).fire(new p.n("move",h))),this.fire(new p.n("resize",h)),n&&this.fire(new p.n("moveend",h)),this}_resizeInternal(h=!0){const[t,n]=this._containerDimensions(),o=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,o),this.painter.resize(t,n,o),this.painter.overLimit()){const c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];const f=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,f),this.painter.resize(t,n,f)}this._resizeTransform(h)}_resizeTransform(h=!0){var t;const[n,o]=this._containerDimensions();this.transform.resize(n,o,h),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,o,h)}_getClampedPixelRatio(h,t){const{0:n,1:o}=this._maxCanvasSize,c=this.getPixelRatio(),f=h*c,y=t*c;return Math.min(f>n?n/f:1,y>o?o/y:1)*c}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(Fe.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(h),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new p.n("zoomstart")).fire(new p.n("zoom")).fire(new p.n("zoomend")).fire(new p.n("movestart")).fire(new p.n("move")).fire(new p.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(h),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new p.n("zoomstart")).fire(new p.n("zoom")).fire(new p.n("zoomend")).fire(new p.n("movestart")).fire(new p.n("move")).fire(new p.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(h),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new p.n("pitchstart")).fire(new p.n("pitch")).fire(new p.n("pitchend")).fire(new p.n("movestart")).fire(new p.n("move")).fire(new p.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(h>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();
814return n.setMaxPitch(h),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new p.n("pitchstart")).fire(new p.n("pitch")).fire(new p.n("pitchend")).fire(new p.n("movestart")).fire(new p.n("move")).fire(new p.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(h){if((h=h??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(h<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=h,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.setRenderWorldCopies(h),this._update()}setTransformConstrain(h){return this.transform.setConstrainOverride(h),this._update()}project(h){return this.transform.locationToScreenPoint(p.W.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.screenPointToLocation(p.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,t,n){if(h==="mouseenter"||h==="mouseover"){let o=!1;return{layers:t,listener:n,delegates:{mousemove:f=>{const y=t.filter((w=>this.getLayer(w))),x=y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[];x.length?o||(o=!0,n.call(this,new Ri(h,this,f.originalEvent,{features:x}))):o=!1},mouseout:()=>{o=!1}}}}if(h==="mouseleave"||h==="mouseout"){let o=!1;return{layers:t,listener:n,delegates:{mousemove:y=>{const x=t.filter((w=>this.getLayer(w)));(x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ri(h,this,y.originalEvent)))},mouseout:y=>{o&&(o=!1,n.call(this,new Ri(h,this,y.originalEvent)))}}}}{const o=c=>{const f=t.filter((x=>this.getLayer(x))),y=f.length!==0?this.queryRenderedFeatures(c.point,{layers:f}):[];y.length&&(c.features=y,n.call(this,c),delete c.features)};return{layers:t,listener:n,delegates:{[h]:o}}}}_saveDelegatedListener(h,t){var n;this._delegatedListeners||(this._delegatedListeners={}),(n=this._delegatedListeners)[h]||(n[h]=[]),this._delegatedListeners[h].push(t)}_removeDelegatedListener(h,t,n){var o;if(!(!((o=this._delegatedListeners)===null||o===void 0)&&o[h]))return;const c=this._delegatedListeners[h];for(let f=0;f<c.length;f++){const y=c[f];if(y.listener===n&&y.layers.length===t.length&&y.layers.every((x=>t.includes(x)))){for(const x in y.delegates)this.off(x,y.delegates[x]);return void c.splice(f,1)}}}on(h,t,n){if(n===void 0)return super.on(h,t);const o=typeof t=="string"?[t]:t,c=this._createDelegatedListener(h,o,n);this._saveDelegatedListener(h,c);for(const f in c.delegates)this.on(f,c.delegates[f]);return{unsubscribe:()=>{this._removeDelegatedListener(h,o,n)}}}once(h,t,n){if(n===void 0)return super.once(h,t);const o=typeof t=="string"?[t]:t,c=this._createDelegatedListener(h,o,n);for(const f in c.delegates){const y=c.delegates[f];c.delegates[f]=(...x)=>{this._removeDelegatedListener(h,o,n),y(...x)}}this._saveDelegatedListener(h,c);for(const f in c.delegates)this.once(f,c.delegates[f]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._removeDelegatedListener(h,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(h,t){if(!this.style)return[];let n;const o=h instanceof p.P||Array.isArray(h),c=o?h:[[0,0],[this.transform.width,this.transform.height]];if(t||(t=(o?{}:h)||{}),c instanceof p.P||typeof c[0]=="number")n=[p.P.convert(c)];else{const f=p.P.convert(c[0]),y=p.P.convert(c[1]);n=[f,new p.P(y.x,f.y),y,new p.P(f.x,y.y),f]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(h,t){return this.style.querySourceFeatures(h,t)}setStyle(h,t){return(t=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
814idateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(h,t))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const t=this._locale[h];if(t==null)throw new Error(`Missing UI string '${h}'`);return t}_updateStyle(h,t){var n,o,c;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(h,t)));const f=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new vn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,t,f):this.style.loadJSON(h,t,f),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(c=(o=this.style)===null||o===void 0?void 0:o.projection)===null||c===void 0||c.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new vn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){return p._(this,void 0,void 0,(function*(){var n;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),typeof h=="string"){const o=h;this._diffStyleRequest=new AbortController;const c=this._diffStyleRequest;try{const f=yield this._requestManager.transformRequest(o,"Style");if(c.signal.aborted)return void(this._diffStyleRequest=null);const y=yield p.k(f,c);this._diffStyleRequest=null,this._updateDiff(y.data,t)}catch(f){this._diffStyleRequest=null,p.$(f)||this.fire(new p.l(p.d(f)))}}else typeof h=="object"&&(this._diffStyleRequest=null,this._updateDiff(h,t))}))}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${p.d(n).message}. Rebuilding the style from scratch.`),this._updateStyle(h,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();p.w("There is no style added to the map.")}addSource(h,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){var t;const n=(t=this.style)===null||t===void 0?void 0:t.tileManagers[h];if(n!==void 0)return n.loaded();this.fire(new p.l(new Error(`There is no tile manager with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const t=this.style.tileManagers[h.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===h.source&&p.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),o.type==="color-relief"&&o.source===h.source&&p.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new rs(this.painter,t,h),this.painter.renderToTexture=new hu(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var o;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((o=n.source)===null||o===void 0?void 0:o.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
vendor: 5,563 bytes, line 814
814d&&this.transform.setElevation(0);return this.fire(new p.n("terrain",{terrain:h})),this}getTerrain(){var h,t;return(t=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&t!==void 0?t:null}areTilesLoaded(){var h;const t=(h=this.style)===null||h===void 0?void 0:h.tileManagers;for(const n of Object.values(t))if(!n.areTilesLoaded())return!1;return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}setSourceTileLodParams(h,t,n){if(n){const o=this.getSource(n);if(!o)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);o.calculateTileZoom=$o(Math.max(1,h),Math.max(1,t))}else for(const o in this.style.tileManagers)this.style.tileManagers[o].getSource().calculateTileZoom=$o(Math.max(1,h),Math.max(1,t));return this._update(!0),this}refreshTiles(h,t){const n=this.style.tileManagers[h];if(!n)throw new Error(`There is no tile manager with ID "${h}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((o=>new p.aa(o.z,o.x,o.y))))}addImage(h,t,n={}){const{pixelRatio:o=1,sdf:c=!1,stretchX:f,stretchY:y,content:x,textFitWidth:w,textFitHeight:S}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||p.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new p.l(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:E,data:C}=t,D=t;return this.style.addImage(h,{data:new p.R({width:P,height:E},new Uint8Array(C)),pixelRatio:o,stretchX:f,stretchY:y,content:x,textFitWidth:w,textFitHeight:S,sdf:c,version:0,userImage:D}),D.onAdd&&D.onAdd(this,h),this}}{const{width:P,height:E,data:C}=Wt.getImageData(t);this.style.addImage(h,{data:new p.R({width:P,height:E},C),pixelRatio:o,stretchX:f,stretchY:y,content:x,textFitWidth:w,textFitHeight:S,sdf:c,version:0})}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new p.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||p.b(t)?Wt.getImageData(t):t,{width:c,height:f,data:y}=o;if(c===void 0||f===void 0)return this.fire(new p.l(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||f!==n.data.height)return this.fire(new p.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));const x=!(t instanceof HTMLImageElement||p.b(t));return n.data.replace(y,x),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new p.l(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return p._(this,void 0,void 0,(function*(){return Ei.getImage(yield this._requestManager.transformRequest(h,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,t,n){return this.style.setLayerZoomRange(h,t,n),this._update(!0)}setFilter(h,t,n={}){return this.style.setFilter(h,t,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,n,o={}){return this.style.setPaintProperty(h,t,n,o),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,o={}){return this.style.setLayoutProperty(h,t,n,o),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setGlyphs(h,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,t,n,(o=>{o||this._update(!0)})),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,t,(n=>{n||this._update(!0)})),this}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(h,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupResizeObserver(){var h;let t=!1;const n=Sl((c=>{this._trackResize&&!this._removed&&(this.resize(c),this.redraw())}),50),o=(h=this._ownerWindow.ResizeObserver)!==null&&h!==void 0?h:ResizeObserver;this._resizeObserver=new o((c=>{t?n(c):t=!0})),this._resizeObserver.observe(this._container)}
814_resolveContainer(h){if(typeof h=="string"){const t=document.getElementById(h);if(!t)throw new Error(`Container '${h}' not found.`);return t}if(h instanceof HTMLElement||h&&typeof h=="object"&&h.nodeType===1)return h;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const t=this._canvasContainer=me.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=me.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const c=this._controlContainer=me.create("div","maplibregl-control-container",h),f=this._controlPositions={};for(const y of["top-left","top-right","bottom-left","bottom-right"])f[y]=me.create("div",`maplibregl-ctrl-${y} `,c);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,t,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(o=>{t={requestedAttributes:h},o&&(t.statusMessage=o.statusMessage,t.type=o.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,h):this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h),!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new Xa(n,this.transform)}migrateProjection(h,t){super.migrateProjection(h,t),this.painter.transform=h,this.fire(new p.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){var t;return!((t=this.style)===null||t===void 0)&&t._loaded?(this._styleDirty||(this._styleDirty=h),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){var t,n,o,c,f,y;const x=this._idleTriggered?this._fadeDuration:0,w=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let S=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const C=this.transform.zoom,D=Je();this.style.zoomHistory.update(C,D);const B=new p.J(C,{now:D,fadeDuration:x,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),j=B.crossFadingFactor();j===1&&j===this._crossFadingFactor||(S=!0,this._crossFadingFactor=j),this.style.update(B)}const P=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==w;(o=this.style.projection)===null||o===void 0||o.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((c=this.style.projection)===null||c===void 0?void 0:c.transitionState,(f=this.style.projection)===null||f===void 0?void 0:f.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||P)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
814d&&this.transform.setElevation(0)),this._placementDirty=(y=this.style)===null||y===void 0?void 0:y._updatePlacement(this.transform,this.showCollisionBoxes,x,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:x,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new p.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new p.n("load"))),this.style&&(this.style.hasTransitions()||S)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const E=this._sourcesDirty||this._styleDirty||this._placementDirty;return E||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.n("idle")),!this._loaded||this._fullyLoaded||E||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var h,t;this._hash&&this._hash.remove();for(const o of this._controls)o.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(h=this._diffStyleRequest)===null||h===void 0||h.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ei.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n?.loseContext&&n.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new p.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Wt.frame(this._frameRequest,(h=>{this._frameRequest=null;try{this._render(h)}catch(t){if(!p.$(t)&&!(function(n){return n.message===qs})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return to}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(h){return this._lazyInitEmptyStyle(),this.style.setProjection(h),this._update(!0)}};const Ll={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class as{constructor(t,n,o=!1){this.mousedown=f=>{this.startMove(f,me.mousePos(this.element,f)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=f=>{this.move(f,me.mousePos(this.element,f))},this.mouseup=f=>{this._rotatePitchHandler.dragEnd(f),this.offTemp()},this.touchstart=f=>{f.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=me.touchPos(this.element,f.targetTouches)[0],this.startMove(f,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=f=>{f.targetTouches.length!==1?this.reset():(this._lastPos=me.touchPos(this.element,f.targetTouches)[0],this.move(f,this._lastPos))},this.touchend=f=>{f.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const c=new Il;this._rotatePitchHandler=new gr({clickTolerance:3,move:(f,y)=>{const x=n.getBoundingClientRect(),w=new p.P((x.bottom-x.top)/2,(x.right-x.left)/2);return{bearingDelta:p.cx(new p.P(f.x,y.y),y,w),pitchDelta:o?-.5*(y.y-f.y):void 0}},moveStateManager:c,enable:!0,assignEvents:()=>{}}),this.map=t,n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),me.disableDrag()}move(t,n){const o=this.map,{bearingDelta:c,pitchDelta:f}=this._rotatePitchHandler.dragMove(t,n)||{};c&&o.setBearing(o.getBearing()+c),f&&o.setPitch(o.getPitch()+f)}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){me.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let vr;
814function no(h,t,n,o=!1){if(o||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return h?.wrap();const c=new p.W(h.lng,h.lat);if(h=new p.W(h.lng,h.lat),t){const f=new p.W(h.lng-360,h.lat),y=new p.W(h.lng+360,h.lat),x=n.locationToScreenPoint(h).distSqr(t);n.locationToScreenPoint(f).distSqr(t)<x?h=f:n.locationToScreenPoint(y).distSqr(t)<x&&(h=y)}for(;Math.abs(h.lng-n.center.lng)>180;){const f=n.locationToScreenPoint(h);if(f.x>=0&&f.y>=0&&f.x<=n.width&&f.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h.lng!==c.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(h))?h:c}const ss={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ao(h,t,n){const o=h.classList;for(const c in ss)o.remove(`maplibregl-${n}-anchor-${c}`);o.add(`maplibregl-${n}-anchor-${t}`)}class os extends p.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new p.n("click",{originalEvent:n}))},this._onKeyPress=n=>{n.code!=="Space"&&n.code!=="Enter"||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,c=this._element;this._popup&&(o===c||c.contains(o))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=no(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${ss[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${c}`,Wt.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(n?.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new p.n("dragstart"))),this.fire(new p.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new p.n("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=p.P.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=me.create("div");const n=me.createNS("http://www.w3.org/2000/svg","svg"),o=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${o}`);const f=me.createNS("http://www.w3.org/2000/svg","g");
vendor: 5,347 bytes, line 814
814f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const y=me.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const x=me.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"transform","translate(3.0, 29.0)"),x.setAttributeNS(null,"fill","#000000");const w=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const N of w){const G=me.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",N.rx),G.setAttributeNS(null,"ry",N.ry),x.appendChild(G)}const S=me.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const P=me.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),S.appendChild(P);const E=me.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const C=me.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),E.appendChild(C);const D=me.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(6.0, 7.0)"),D.setAttributeNS(null,"fill","#FFFFFF");const B=me.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const j=me.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#000000"),j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962");const $=me.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),B.appendChild(j),B.appendChild($),y.appendChild(x),y.appendChild(S),y.appendChild(E),y.appendChild(D),y.appendChild(B),n.appendChild(y),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),ao(this._element,this._anchor,"marker"),t?.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=p.W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
8140,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,o;const c=(n=this._map)===null||n===void 0?void 0:n.terrain,f=this._map.transform.isLocationOccluded(this._lngLat);if(!c||f){const D=f?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==D&&(this._element.style.opacity=D,this._element.classList.toggle("maplibregl-marker-covered",f)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),w=y.terrain.getElevationForLngLat(this._lngLat,y.transform);if(y.transform.lngLatToCameraDepth(this._lngLat,w)-x<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");const S=-this._offset.y/y.transform.pixelsPerMeter,P=Math.sin(y.getPitch()*Math.PI/180)*S,E=y.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),C=y.transform.lngLatToCameraDepth(this._lngLat,w+P)-E>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",C)}getOffset(){return this._offset}setOffset(t){return this._offset=p.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=String(t)),n!==void 0&&(this._opacityWhenCovered=String(n)),this._map&&this._updateOpacity(!0),this}}const Fl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let da=0,En=!1;const Bl={maxWidth:100,unit:"metric"};function ls(h,t,n){const o=n?.maxWidth||100,c=h._container.clientHeight/2,f=h._container.clientWidth/2,y=h.unproject([f-o/2,c]),x=h.unproject([f+o/2,c]),w=Math.round(h.project(x).x-h.project(y).x),S=Math.min(o,w,h._container.clientWidth),P=y.distanceTo(x);if(n?.unit==="imperial"){const E=3.2808*P;E>5280?Cn(t,S,E/5280,h._getUIString("ScaleControl.Miles")):Cn(t,S,E,h._getUIString("ScaleControl.Feet"))}else n?.unit==="nautical"?Cn(t,S,P/1852,h._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Cn(t,S,P/1e3,h._getUIString("ScaleControl.Kilometers")):Cn(t,S,P,h._getUIString("ScaleControl.Meters"))}function Cn(h,t,n,o){const c=(function(f){const y=Math.pow(10,`${Math.floor(f)}`.length-1);let x=f/y;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:(function(w){const S=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*S)/S})(x),y*x})(n);h.style.width=t*(c/n)+"px",h.innerHTML=`${c} ${o}`}const Ol={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0}
vendor: 4,959 bytes, line 814
814,so=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function oo(h){if(h){if(typeof h=="number"){const t=Math.round(Math.abs(h)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,h),"top-left":new p.P(t,t),"top-right":new p.P(-t,t),bottom:new p.P(0,-h),"bottom-left":new p.P(t,-t),"bottom-right":new p.P(-t,-t),left:new p.P(h,0),right:new p.P(-h,0)}}if(h instanceof p.P||Array.isArray(h)){const t=p.P.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:p.P.convert(h.center||[0,0]),top:p.P.convert(h.top||[0,0]),"top-left":p.P.convert(h["top-left"]||[0,0]),"top-right":p.P.convert(h["top-right"]||[0,0]),bottom:p.P.convert(h.bottom||[0,0]),"bottom-left":p.P.convert(h["bottom-left"]||[0,0]),"bottom-right":p.P.convert(h["bottom-right"]||[0,0]),left:p.P.convert(h.left||[0,0]),right:p.P.convert(h.right||[0,0])}}return oo(new p.P(0,0))}const jl=Pe;R.AJAXError=p.cG,R.EXTENT=p.a6,R.Event=p.n,R.Evented=p.E,R.LngLat=p.W,R.MercatorCoordinate=p.a7,R.Point=p.P,R.addProtocol=p.cH,R.config=p.c,R.removeProtocol=p.cI,R.AttributionControl=Gi,R.BoxZoomHandler=lr,R.CanvasSource=jo,R.CooperativeGesturesHandler=ze,R.DoubleClickZoomHandler=kl,R.DragPanHandler=rr,R.DragRotateHandler=is,R.EdgeInsets=Hn,R.FullscreenControl=class extends p.E{constructor(h={}){var t;super(),this._onFullscreenChange=()=>{var n;let o=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=o?.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)o=o.shadowRoot.fullscreenElement;o===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=h.pseudo)!==null&&t!==void 0&&t,h?.container&&(h.container instanceof HTMLElement?this._container=h.container:p.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=me.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=me.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);me.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new p.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},R.GeoJSONSource=_s,R.GeolocateControl=class extends p.E{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new p.n("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_E
814RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new p.W(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,c=this._map.getBearing(),f=p.e({bearing:c},this.options.fitBoundsOptions),y=Fe.fromLngLat(n,o);this._map.fitBounds(y,f,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new p.W(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._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&En)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.n("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;const n=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.n("trackuserlocationend")),this.fire(new p.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>{t.preventDefault()})),this._geolocateButton=me.create("button","maplibregl-ctrl-geolocate",this._container),me.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=me.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new os({element:this._dotElement}),this._circleElement=me.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new os({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=p.e({},Fl,h)}onAdd(h){return this._map=h,this._container=me.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return p._(this,arguments,void 0,(function*(t=!1){if(vr!==void 0&&!t)return vr;if(window.navigator.permissions===void 0)return vr=!!window.navigator.geolocation,vr;try{vr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{vr=!!window.navigator.geolocation}return vr}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,da=0,En=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),n=h.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
814RROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const h=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&h))return;const t=this._map.project(h),n=this._map.unproject([t.x+100,t.y]),o=h.distanceTo(n)/100,c=2*this._accuracy/o;this._circleElement.style.width=`${c.toFixed(2)}px`,this._circleElement.style.height=`${c.toFixed(2)}px`}trigger(){if(!this._setup)return p.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new p.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":da--,En=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new p.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new p.n("trackuserlocationstart")),this.fire(new p.n("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),da++,da>1?(h={maximumAge:6e5,timeout:0},En=!0):(h=this.options.positionOptions,En=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},R.GlobeControl=class{constructor(){this._toggleProjection=()=>{var h;const t=(h=this._map.getProjection())===null||h===void 0?void 0:h.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var h;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((h=this._map.getProjection())===null||h===void 0?void 0:h.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(h){return this._map=h,this._container=me.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=me.create("button","maplibregl-ctrl-globe",this._container),me.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},R.Hash=Ya,R.ImageSource=Rr,R.KeyboardHandler=ou,R.LngLatBounds=Fe,R.LogoControl
814=Rl,R.Map=ro,R.MapLibreMap=ro,R.MapMouseEvent=Ri,R.MapTouchEvent=Ja,R.MapWheelEvent=Qc,R.Marker=os,R.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=p.e({},Ll,h),this._container=me.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),me.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),me.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=me.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new as(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const n=me.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}},R.Popup=class extends p.E{constructor(h){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.n("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=me.create("div","maplibregl-popup",this._map.getContainer()),this._tip=me.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const x of this.options.className.split(" "))this._container.classList.add(x);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let n;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=no(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(n=t.point),this._trackPointer&&!n)return;const o=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map.transform.locationToScreenPoint(this._lngLat));let c=this.options.anchor;const f=oo(this.options.offset);if(!c){const x=this._container.offsetWidth,w=this._container.offsetHeight,S=(function(E){var C,D,B,j;return E?{top:(C=E.top)!==null&&C!==void 0?C:0,right:(D=E.right)!==null&&D!==void 0?D:0,bottom:(B=E.bottom)!==null&&B!==void 0?B:0,left:(j=E.left)!==null&&j!==void 0?j:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let P;P=o.y+f.bottom.y<w+S.top?["top"]:o.y>this._map.transform.height-w-S.bottom?["bottom"]:[],o.x<x/2+S.left?P.push("left"):o.x>this._map.transform.width-x/2-S.right&&P.push("right"),c=P.length===0?"bottom":P.join("-")}let y=o.add(f[c]);this.options.subpixelPositioning||(y=y.round()),this._container.style.transform=`${ss[c]} translate(${y.x}px,${y.y}px)`,ao(this._container,c,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(Ol),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new p.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=p.W.convert(h),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=h;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}getMaxWidth(){var h;
vendor: 4,684 bytes, line 814
814return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=me.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}setPadding(h){this.options.padding=h,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=me.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(so);h&&h.focus()}},R.RasterDEMTileSource=Xt,R.RasterTileSource=Ci,R.ScaleControl=class{constructor(h){this._onMove=()=>{ls(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ls(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Bl),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=me.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},R.ScrollZoomHandler=Dl,R.Style=vn,R.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=h}onAdd(h){return this._map=h,this._container=me.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=me.create("button","maplibregl-ctrl-terrain",this._container),me.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},R.TwoFingersTouchPitchHandler=yr,R.TwoFingersTouchRotateHandler=su,R.TwoFingersTouchZoomHandler=au,R.TwoFingersTouchZoomRotateHandler=Ee,R.VectorTileSource=Ht,R.VideoSource=sn,R.addSourceType=(h,t)=>p._(void 0,void 0,void 0,(function*(){if(gs(h))throw new Error(`A source type called "${h}" already exists.`);((n,o)=>{Vo[n]=o})(h,t)})),R.clearPrewarmedResources=function(){const h=ji;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(bt),ji=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()"))},R.createTileMesh=Jn,R.getGlobalDispatcher=ci,R.getMaxParallelImageRequests=function(){return p.c.MAX_PARALLEL_IMAGE_REQUESTS},R.getRTLTextPluginStatus=function(){return Lr().getRTLTextPluginStatus()},R.getVersion=function(){return jl},R.getWorkerCount=function(){return wt.workerCount},R.getWorkerUrl=function(){return p.c.WORKER_URL},R.importScriptInWorkers=function(h){return ci().broadcast("IS",h)},R.isTimeFrozen=function(){return Ar.isFrozen()},R.now=Je,R.prewarm=function(){rn().acquire(bt)},R.restoreNow=function(){Ar.restoreNow()},R.setMaxParallelImageRequests=function(h){p.c.MAX_PARALLEL_IMAGE_REQUESTS=h},R.setNow=function(h){Ar.setNow(h)},R.setRTLTextPlugin=function(h,t){return Lr().setRTLTextPlugin(h,t)},R.setWorkerCount=function(h){wt.workerCount=h},R.setWorkerUrl=function(h){p.c.WORKER_URL=h}}));var Yf=Oe;return Yf}))})(Ou)),Ou.exports}var ry=iy();const ay=Zg(ry);
814export{Qg as C,ey as R,ay as m};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.