index.9ea0bbd5.js 2.7 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935
  1. var O3=Object.defineProperty;var N3=(u,e,t)=>e in u?O3(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t;var Q3=(u,e)=>()=>(e||u((e={exports:{}}).exports,e),e.exports);var Qi=(u,e,t)=>(N3(u,typeof e!="symbol"?e+"":e,t),t);var CH=Q3(k_=>{function SS(u,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in u)){const p=Object.getOwnPropertyDescriptor(r,c);p&&Object.defineProperty(u,c,p.get?p:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const p of c)if(p.type==="childList")for(const y of p.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&r(y)}).observe(document,{childList:!0,subtree:!0});function t(c){const p={};return c.integrity&&(p.integrity=c.integrity),c.referrerpolicy&&(p.referrerPolicy=c.referrerpolicy),c.crossorigin==="use-credentials"?p.credentials="include":c.crossorigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function r(c){if(c.ep)return;c.ep=!0;const p=t(c);fetch(c.href,p)}})();if(typeof window<"u"){let u=function(){var e=document.body,t=document.getElementById("__svg__icons__dom__");t||(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.style.position="absolute",t.style.width="0",t.style.height="0",t.id="__svg__icons__dom__",t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),t.innerHTML='<symbol class="icon" viewBox="0 0 1024 1024" id="arrow_right"><path d="M320 885.333c-8.533 0-17.067-4.266-23.467-10.666-12.8-12.8-10.666-34.134 2.134-44.8L654.933 512 298.667 194.133c-12.8-10.666-14.934-32-2.134-44.8 10.667-12.8 32-14.933 44.8-2.133l384 341.333c6.4 6.4 10.667 14.934 10.667 23.467s-4.267 17.067-10.667 23.467l-384 341.333c-6.4 6.4-12.8 8.533-21.333 8.533z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="circle_radio"><path d="M512 42.667C252.288 42.667 42.667 252.288 42.667 512S252.288 981.333 512 981.333 981.333 771.712 981.333 512 771.712 42.667 512 42.667zm0 611.712A142.89 142.89 0 0 1 369.621 512 142.89 142.89 0 0 1 512 369.621 142.89 142.89 0 0 1 654.379 512 142.89 142.89 0 0 1 512 654.379z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="fly"><path d="M16.056 688A16.032 16.032 0 0 1 .728 667.408l33.6-112a16 16 0 0 1 30.656 9.184l-26.208 87.424 5.568-.928A83.872 83.872 0 0 0 87.8 629.824a84.544 84.544 0 0 0 24.736-41.632A16 16 0 0 1 128.056 576h94.4c55.52 0 110.944 5.488 164.752 16.32C438.952 602.72 492.264 608 545.656 608h350.4c25.648 0 49.76-9.984 67.888-28.112A95.424 95.424 0 0 0 992.056 512c0-52.944-43.056-96-96-96h-350.4c-53.392 0-106.72 5.28-158.448 15.68A836.992 836.992 0 0 1 222.456 448h-94.4a16 16 0 0 1-15.52-12.112 84.688 84.688 0 0 0-68.224-62.976l-5.552-.928L65 459.408a16 16 0 0 1-30.672 9.184l-33.6-112a16.016 16.016 0 0 1 17.952-20.368l30.88 5.12A116.624 116.624 0 0 1 139.832 416h82.624c53.392 0 106.72-5.28 158.448-15.68A836.992 836.992 0 0 1 545.656 384h350.4c70.576 0 128 57.424 128 128a127.2 127.2 0 0 1-37.488 90.512A127.2 127.2 0 0 1 896.056 640h-350.4c-55.52 0-110.944-5.488-164.752-16.32A805.264 805.264 0 0 0 222.456 608h-82.592a117.392 117.392 0 0 1-30.336 45.296 115.76 115.76 0 0 1-60.032 29.376l-30.816 5.12c-.88.128-1.76.208-2.624.208z" /><path d="M144.056 528h-128a16 16 0 1 1 0-32h128a16 16 0 1 1 0 32zm768 48a16 16 0 0 1-12.464-26.032c16.544-20.576 16.544-55.36 0-75.936a16 16 0 0 1 24.928-20.064c26.176 32.544 26.176 83.52 0 116.064A16 16 0 0 1 912.056 576zm-496 448a16 16 0 0 1-15.6-19.6l88.64-384.96a16 16 0 0 1 31.2 7.2l-83.12 360.848 27.264-5.408a47.984 47.984 0 0 0 32.096-23.12L694.52 616a16 16 0 0 1 27.712 16l-197.92 342.88a79.888 79.888 0 0 1-53.536 38.56l-51.6 10.24a15.088 15.088 0 0 1-3.12.32zm88.64-607.04a16 16 0 0 1-15.6-12.416l-88.64-384.96A16 16 0 0 1 419.176.32l51.52 10.24A79.952 79.952 0 0 1 524.36 49.2L722.232 392a16 16 0 0 1-27.712 16L496.6 65.12a48.048 48.048 0 0 0-32.208-23.2l-27.2-5.408 83.104 360.848a16 16 0 0 1-15.616 19.6z" /><path d="M704.056 288h-69.6a16 16 0 1 1 0-32h69.6v-64h-124.96a16 16 0 1 1 0-32h124.96c17.648 0 32 14.352 32 32v64c0 17.648-14.352 32-32 32zm0 576h-124.96a16 16 0 1 1 0-32h124.96v-64h-69.6a16 16 0 1 1 0-32h69.6c17.648 0 32 14.352 32 32v64c0 17.648-14.352 32-32 32zm-304-608c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-8.992-10.24-14.384-10.24s-7.952 2.496-14.4 10.24c-7.232 8.672-18.144 21.76-38.96 21.76-20.816 0-31.728-13.088-38.944-21.76-6.8-8.176-9.2-10.24-14.336-10.24a16 16 0 1 1 0-32c20.816 0 31.728 13.088 38.944 21.76 6.8 8.176 9.2 10.24 14.336 10.24 5.392 0 7.936-2.496 14.384-10.24 7.232-8.672 18.144-21.76 38.976-21.76s31.744 13.088 38.976 21.76c6.448 7.744 8.992 10.24 14.384 10.24a16 16 0 1 1 0 32zm-53.36 576c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-9.008-10.24-14.4-10.24-5.12 0-7.52 2.064-14.32 10.24-7.216 8.672-18.144 21.76-38.944 21.76a16 16 0 1 1 0-32c5.12 0 7.536-2.064 14.336-10.24 7.216-8.672 18.128-21.76 38.944-21.76 20.816 0 31.728 13.088 38.96 21.76 6.448 7.744 9.008 10.24 14.4 10.24s7.936-2.496 14.4-10.24c7.184-8.688 18.112-21.76 38.96-21.76a16 16 0 1 1 0 32c-5.392 0-7.936 2.496-14.4 10.24-7.2 8.672-18.128 21.76-38.96 21.76zm-42.64-656c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-8.992-10.24-14.384-10.24s-7.952 2.496-14.4 10.24c-7.232 8.672-18.144 21.76-38.96 21.76-20.816 0-31.728-13.088-38.944-21.76-6.8-8.176-9.2-10.24-14.336-10.24a16 16 0 1 1 0-32c20.816 0 31.728 13.088 38.944 21.76 6.8 8.176 9.2 10.24 14.336 10.24 5.376 0 7.936-2.496 14.384-10.24 7.232-8.672 18.144-21.76 38.976-21.76s31.744 13.088 38.976 21.76c6.448 7.744 8.992 10.24 14.384 10.24a16 16 0 1 1 0 32zm-69.36 736c-20.832 0-31.744-13.088-38.976-21.76-6.448-7.744-9.008-10.24-14.4-10.24-5.12 0-7.52 2.064-14.32 10.24-7.216 8.672-18.144 21.76-38.944 21.76a16 16 0 1 1 0-32c5.12 0 7.536-2.064 14.336-10.24 7.216-8.672 18.128-21.76 38.944-21.76 20.816 0 31.728 13.088 38.96 21.76 6.448 7.744 9.008 10.24 14.4 10.24s7.936-2.496 14.4-10.24c7.184-8.688 18.112-21.76 38.96-21.76a16 16 0 1 1 0 32c-5.392 0-7.936 2.496-14.4 10.24-7.2 8.672-18.128 21.76-38.96 21.76zm549.36-336c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.04 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.04 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.04 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.04 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.04 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.8-5.92 22.72 0 2.88 3.04 4.64 7.04 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.04 4.64-11.36 4.64zm192-96c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.2 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.04-4.64-11.36 0-4.16 1.76-8.32 4.64-11.36 5.92-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.2 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.2-4.64-11.36s1.76-8.32 4.64-11.36c6.08-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36 0 4.32-1.76 8.32-4.64 11.36-3.04 2.88-7.2 4.64-11.36 4.64zm-64 0c-4.16 0-8.32-1.76-11.36-4.64-2.88-3.04-4.64-7.04-4.64-11.36 0-4.32 1.76-8.32 4.64-11.36 6.08-5.92 16.64-5.92 22.72 0 2.88 3.04 4.64 7.2 4.64 11.36s-1.76 8.32-4.64 11.36c-3.04 2.88-7.2 4.64-11.36 4.64z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="operation"><path d="M548.907 472.17c-3.35-3.029-7.296-5.482-11.584-7.231l-140.118-87.36 88.598 139.37a39.668 39.668 0 0 0 7.296 11.478l1.109 1.792.32-.32a39.51 39.51 0 0 0 28.075 11.477c21.93-.064 39.594-17.941 39.488-39.83-.043-10.965-4.502-20.863-11.712-27.989l.256-.256-1.728-1.13z" /><path d="M521.088 196.8h-.17l-12.502.064.683 151.68h.106c.555 13.76 11.862 24.747 25.771 24.747 14.25 0 25.813-11.563 25.813-25.792 0-.534-.042-1.046-.085-1.579l1.173-95.488c129.088 17.984 217.344 117.141 217.899 251.285.661 147.136-110.144 256-257.301 256.619-147.158.661-254.656-109.483-255.296-256.619-.342-74.688 27.797-141.312 77.077-189.909l-.021-.021a18.725 18.725 0 0 0 2.24-2.091c6.976-7.723 3.84-20.267-4.118-27.456-7.232-6.528-24.277-5.93-31.402-.128l-.022-.043-.384.384a16.396 16.396 0 0 0-1.642 1.579c-.043.064-.086.128-.128.17-56.619 55.66-91.606 133.185-91.243 218.838.768 168.427 137.877 304.32 306.304 303.573 168.384-.789 304.299-137.877 303.552-306.282-.768-168.363-137.899-304.278-306.304-303.531z" /><path d="M511.979 11.115c-276.608 0-500.886 224.256-500.886 500.864 0 276.778 224.278 500.885 500.886 500.885 114.88 0 223.872-38.784 311.914-108.885 10.518-8.363 12.267-23.766 3.904-34.304-8.448-10.539-23.786-12.288-34.368-3.883-79.424 63.296-177.664 98.283-281.408 98.283-249.642 0-451.989-202.411-451.989-452.096 0-249.6 202.325-451.99 451.99-451.99 249.685 0 452.031 202.39 452.031 451.99 0 85.589-23.786 167.637-68.074 238.72-7.083 11.413-3.584 26.538 7.85 33.664 11.435 7.168 26.475 3.584 33.6-7.83 49.152-78.741 75.499-169.706 75.499-264.554-.021-276.608-224.256-500.864-500.95-500.864z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="right_bold"><path d="M761.056 532.128c.512-.992 1.344-1.824 1.792-2.848 8.8-18.304 5.92-40.704-9.664-55.424L399.936 139.744c-19.264-18.208-49.632-17.344-67.872 1.888-18.208 19.264-17.376 49.632 1.888 67.872l316.96 299.84L335.2 813.632c-19.072 18.4-19.648 48.768-1.248 67.872 9.408 9.792 21.984 14.688 34.56 14.688 12 0 24-4.48 33.312-13.44l350.048-337.376c.672-.672.928-1.6 1.6-2.304.512-.48 1.056-.832 1.568-1.344 2.72-2.848 4.16-6.336 6.016-9.6z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="weather"><path d="M554.752 256.427c135.168 0 211.883 89.472 223.019 197.546h3.413a157.312 157.312 0 0 1 157.525 157.142 157.312 157.312 0 0 1-157.525 157.098l-26.41-.042-66.134 111.957a32 32 0 0 1-57.344-28.075l1.92-3.925 47.701-79.957h-91.136l-66.218 111.957a32 32 0 0 1-57.344-28.075l1.962-3.925 47.702-79.957h-91.136l-66.219 111.957a32 32 0 0 1-57.344-28.075l1.92-3.925 47.701-79.957-22.528.042a157.312 157.312 0 0 1-157.525-157.098 157.312 157.312 0 0 1 157.525-157.142h3.414c11.221-108.8 87.893-197.546 223.061-197.546zm0 63.914c-88.405 0-165.419 69.675-165.419 165.931 0 15.232-13.61 27.221-29.184 27.221h-29.44c-53.845 0-97.45 42.71-97.45 95.403 0 52.693 43.605 95.445 97.408 95.445h448.128c53.802 0 97.408-42.752 97.408-95.445s-43.606-95.403-97.408-95.403h-29.44c-15.574 0-29.184-11.946-29.184-27.221 0-97.493-77.056-165.973-165.419-165.973zM186.325 433.75a32 32 0 0 1-13.397 39.851l-3.883 1.963-39.552 16.341a32 32 0 0 1-28.373-57.173l3.883-1.963 39.552-16.341a32 32 0 0 1 41.813 17.322zM463.104 227.5l-7.296 2.474a248.405 248.405 0 0 0-62.293 32.342 104.192 104.192 0 0 0-119.168 156.458 196.736 196.736 0 0 0-58.326 27.307 168.192 168.192 0 0 1 247.083-218.539zm-337.621 1.322 4.48 1.494 39.509 16.384a32 32 0 0 1-19.968 60.586l-4.523-1.45-39.509-16.384a32 32 0 0 1 20.01-60.587zM288.256 101.42l1.92 3.882 16.384 39.552a32 32 0 0 1-57.173 28.374l-1.963-3.883-16.384-39.552a32 32 0 0 1 57.173-28.373zM473.984 87.85a32 32 0 0 1 18.816 37.29l-1.493 4.48-16.342 39.552a32 32 0 0 1-60.629-20.01l1.493-4.48 16.342-39.552a32 32 0 0 1 41.813-17.28z" /></symbol>',e.insertBefore(t,e.lastChild)};var loadSvg=u;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",u):u()}class V3{constructor(e){Qi(this,"_CompEventChain");Qi(this,"_parentUnit");this._CompEventChain=e}get parentUnit(){return this._parentUnit}setParentUnit(e){return this._parentUnit=e,this}get CompEventChain(){return this._CompEventChain}addEvent(e){return this._CompEventChain.push(e),this}setCompEvent(e){return this._CompEventChain}remoteCompEvent(e){return this._CompEventChain}setCompEventChain(e){return this._CompEventChain=e,this._CompEventChain}clearCompEvent(){return this._CompEventChain=[],this._CompEventChain}}class H3{constructor(e){Qi(this,"_id");Qi(this,"_position");Qi(this,"_info");Qi(this,"_eventchain",new V3([]).setParentUnit(this));return this._id=e,this}get id(){return this._id}setId(e){return this._id=e,this}get position(){return this._position}setPosition(e){return this._position=e,this}get info(){return this._info}setInfo(e){return this._info=e,this}get eventchain(){return this._eventchain}setEventchain(e){return this._eventchain=e.setParentUnit(this),this}addEvent(e){return this._eventchain.addEvent(e),this}async eventStart(){}}var Nu=(u=>(u.stop="stop",u.run="run",u.pause="pause",u))(Nu||{});class G3{constructor(){Qi(this,"_FnQueue",[]);Qi(this,"_index",0);Qi(this,"_QueueStatus",Nu.stop)}get FnQueue(){return this._FnQueue}formatEventChain2Queue(e,t=()=>{}){let r=0,c=0;for(let p of e.ids)if(r+=p.eventchain.CompEventChain.length,p.eventchain.CompEventChain.length>0){let y=p.eventchain.parentUnit;for(let i of p.eventchain.CompEventChain){c+=1;let C={fn:i.Fn,args:Object.assign(y,{args:i.args}),prepare:i.prepareTime,delay:i.delayTime};this._FnQueue.push(C),t((c/r).toFixed(1))}}return this}async start(e,t=()=>{}){if(this._QueueStatus===Nu.stop?(this._index=-1,this._QueueStatus=Nu.run):this._QueueStatus===Nu.pause?this._QueueStatus=Nu.run:(this._index=-1,this._QueueStatus=Nu.run),this._FnQueue.length!==0)for(let r in this._FnQueue)if(this._QueueStatus===Nu.run){if(parseInt(r)>this._index){let c=this._FnQueue[r];this._index=parseInt(r),await this.runFun(c),this._index+1===this._FnQueue.length&&t(this._index)}}else break}async runPrepare(e){return new Promise(async(t,r)=>{await setTimeout(()=>{t()},e.prepare)})}async runFun(e){return await this.runPrepare(e),new Promise(async(t,r)=>{await e.fn(e.args),await setTimeout(()=>{t()},e.delay)})}stop(){this._QueueStatus=Nu.stop}pause(){this._QueueStatus=Nu.pause}}class q1{constructor(){Qi(this,"_ids",[]);Qi(this,"_queue");Qi(this,"_loop");Qi(this,"_loopIndex",0);Qi(this,"_loopDone",()=>{});this._queue=new G3}setLoop(e,t=()=>{}){return this._loop=e,this._loopDone=t,this}destory(){this._ids=[],this._queue=null}get queue(){return this._queue}get ids(){return this._ids}start(){this.queue.start({},this.queneEndOnceLoop.bind(this))}stop(){this.queue.stop()}pause(){this.queue.pause()}queneEndOnceLoop(e){this._loopIndex+=1,this._loop===-1?this.start():this._loop>this._loopIndex?this.start():this._loopDone()}addUnit(e){return this._ids.push(e),this}removeUnit(e){let t=[];for(let r in this._ids){let c=this._ids[r];c.id!==e&&t.push(c)}return this._ids=t,this}clearUnit(){return this._ids=[],this}buildQueue(e){return this.queue.formatEventChain2Queue(this,e),this}}var MS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof{}<"u"?{}:typeof self<"u"?self:{},P_={},W3=u=>encodeURIComponent(u).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),IS="%[a-f0-9]{2}",UC=new RegExp("("+IS+")|([^%]+?)","gi"),RC=new RegExp("("+IS+")+","gi");function ab(u,e){try{return[decodeURIComponent(u.join(""))]}catch{}if(u.length===1)return u;e=e||1;var t=u.slice(0,e),r=u.slice(e);return Array.prototype.concat.call([],ab(t),ab(r))}function j3(u){try{return decodeURIComponent(u)}catch{for(var e=u.match(UC)||[],t=1;t<e.length;t++)u=ab(e,t).join(""),e=u.match(UC)||[];return u}}function K3(u){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=RC.exec(u);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var r=j3(t[0]);r!==t[0]&&(e[t[0]]=r)}t=RC.exec(u)}e["%C2"]="\uFFFD";for(var c=Object.keys(e),p=0;p<c.length;p++){var y=c[p];u=u.replace(new RegExp(y,"g"),e[y])}return u}var $3=function(u){if(typeof u!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof u+"`");try{return u=u.replace(/\+/g," "),decodeURIComponent(u)}catch{return K3(u)}},Z3=(u,e)=>{if(!(typeof u=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[u];const t=u.indexOf(e);return t===-1?[u]:[u.slice(0,t),u.slice(t+e.length)]},X3=function(u,e){for(var t={},r=Object.keys(u),c=Array.isArray(e),p=0;p<r.length;p++){var y=r[p],i=u[y];(c?e.indexOf(y)!==-1:e(y,i,u))&&(t[y]=i)}return t};(function(u){const e=W3,t=$3,r=Z3,c=X3,p=ae=>ae==null;function y(ae){switch(ae.arrayFormat){case"index":return ce=>(Ae,we)=>{const me=Ae.length;return we===void 0||ae.skipNull&&we===null||ae.skipEmptyString&&we===""?Ae:we===null?[...Ae,[D(ce,ae),"[",me,"]"].join("")]:[...Ae,[D(ce,ae),"[",D(me,ae),"]=",D(we,ae)].join("")]};case"bracket":return ce=>(Ae,we)=>we===void 0||ae.skipNull&&we===null||ae.skipEmptyString&&we===""?Ae:we===null?[...Ae,[D(ce,ae),"[]"].join("")]:[...Ae,[D(ce,ae),"[]=",D(we,ae)].join("")];case"comma":case"separator":return ce=>(Ae,we)=>we==null||we.length===0?Ae:Ae.length===0?[[D(ce,ae),"=",D(we,ae)].join("")]:[[Ae,D(we,ae)].join(ae.arrayFormatSeparator)];default:return ce=>(Ae,we)=>we===void 0||ae.skipNull&&we===null||ae.skipEmptyString&&we===""?Ae:we===null?[...Ae,D(ce,ae)]:[...Ae,[D(ce,ae),"=",D(we,ae)].join("")]}}function i(ae){let ce;switch(ae.arrayFormat){case"index":return(Ae,we,me)=>{if(ce=/\[(\d*)\]$/.exec(Ae),Ae=Ae.replace(/\[\d*\]$/,""),!ce){me[Ae]=we;return}me[Ae]===void 0&&(me[Ae]={}),me[Ae][ce[1]]=we};case"bracket":return(Ae,we,me)=>{if(ce=/(\[\])$/.exec(Ae),Ae=Ae.replace(/\[\]$/,""),!ce){me[Ae]=we;return}if(me[Ae]===void 0){me[Ae]=[we];return}me[Ae]=[].concat(me[Ae],we)};case"comma":case"separator":return(Ae,we,me)=>{const De=typeof we=="string"&&we.includes(ae.arrayFormatSeparator),Je=typeof we=="string"&&!De&&R(we,ae).includes(ae.arrayFormatSeparator);we=Je?R(we,ae):we;const Fe=De||Je?we.split(ae.arrayFormatSeparator).map(Ge=>R(Ge,ae)):we===null?we:R(we,ae);me[Ae]=Fe};default:return(Ae,we,me)=>{if(me[Ae]===void 0){me[Ae]=we;return}me[Ae]=[].concat(me[Ae],we)}}}function C(ae){if(typeof ae!="string"||ae.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function D(ae,ce){return ce.encode?ce.strict?e(ae):encodeURIComponent(ae):ae}function R(ae,ce){return ce.decode?t(ae):ae}function Q(ae){return Array.isArray(ae)?ae.sort():typeof ae=="object"?Q(Object.keys(ae)).sort((ce,Ae)=>Number(ce)-Number(Ae)).map(ce=>ae[ce]):ae}function z(ae){const ce=ae.indexOf("#");return ce!==-1&&(ae=ae.slice(0,ce)),ae}function G(ae){let ce="";const Ae=ae.indexOf("#");return Ae!==-1&&(ce=ae.slice(Ae)),ce}function J(ae){ae=z(ae);const ce=ae.indexOf("?");return ce===-1?"":ae.slice(ce+1)}function Y(ae,ce){return ce.parseNumbers&&!Number.isNaN(Number(ae))&&typeof ae=="string"&&ae.trim()!==""?ae=Number(ae):ce.parseBooleans&&ae!==null&&(ae.toLowerCase()==="true"||ae.toLowerCase()==="false")&&(ae=ae.toLowerCase()==="true"),ae}function B(ae,ce){ce=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},ce),C(ce.arrayFormatSeparator);const Ae=i(ce),we=Object.create(null);if(typeof ae!="string"||(ae=ae.trim().replace(/^[?#&]/,""),!ae))return we;for(const me of ae.split("&")){if(me==="")continue;let[De,Je]=r(ce.decode?me.replace(/\+/g," "):me,"=");Je=Je===void 0?null:["comma","separator"].includes(ce.arrayFormat)?Je:R(Je,ce),Ae(R(De,ce),Je,we)}for(const me of Object.keys(we)){const De=we[me];if(typeof De=="object"&&De!==null)for(const Je of Object.keys(De))De[Je]=Y(De[Je],ce);else we[me]=Y(De,ce)}return ce.sort===!1?we:(ce.sort===!0?Object.keys(we).sort():Object.keys(we).sort(ce.sort)).reduce((me,De)=>{const Je=we[De];return Boolean(Je)&&typeof Je=="object"&&!Array.isArray(Je)?me[De]=Q(Je):me[De]=Je,me},Object.create(null))}u.extract=J,u.parse=B,u.stringify=(ae,ce)=>{if(!ae)return"";ce=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},ce),C(ce.arrayFormatSeparator);const Ae=Je=>ce.skipNull&&p(ae[Je])||ce.skipEmptyString&&ae[Je]==="",we=y(ce),me={};for(const Je of Object.keys(ae))Ae(Je)||(me[Je]=ae[Je]);const De=Object.keys(me);return ce.sort!==!1&&De.sort(ce.sort),De.map(Je=>{const Fe=ae[Je];return Fe===void 0?"":Fe===null?D(Je,ce):Array.isArray(Fe)?Fe.reduce(we(Je),[]).join("&"):D(Je,ce)+"="+D(Fe,ce)}).filter(Je=>Je.length>0).join("&")},u.parseUrl=(ae,ce)=>{ce=Object.assign({decode:!0},ce);const[Ae,we]=r(ae,"#");return Object.assign({url:Ae.split("?")[0]||"",query:B(J(ae),ce)},ce&&ce.parseFragmentIdentifier&&we?{fragmentIdentifier:R(we,ce)}:{})},u.stringifyUrl=(ae,ce)=>{ce=Object.assign({encode:!0,strict:!0},ce);const Ae=z(ae.url).split("?")[0]||"",we=u.extract(ae.url),me=u.parse(we,{sort:!1}),De=Object.assign(me,ae.query);let Je=u.stringify(De,ce);Je&&(Je=`?${Je}`);let Fe=G(ae.url);return ae.fragmentIdentifier&&(Fe=`#${D(ae.fragmentIdentifier,ce)}`),`${Ae}${Je}${Fe}`},u.pick=(ae,ce,Ae)=>{Ae=Object.assign({parseFragmentIdentifier:!0},Ae);const{url:we,query:me,fragmentIdentifier:De}=u.parseUrl(ae,Ae);return u.stringifyUrl({url:we,query:c(me,ce),fragmentIdentifier:De},Ae)},u.exclude=(ae,ce,Ae)=>{const we=Array.isArray(ce)?me=>!ce.includes(me):(me,De)=>!ce(me,De);return u.pick(ae,we,Ae)}})(P_);const q3=SS({__proto__:null,default:P_},[P_]);/*!
  2. * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
  3. * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
  4. * Released under MIT License
  5. *//*! *****************************************************************************
  6. Copyright (c) Microsoft Corporation.
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted.
  9. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  10. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  11. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  12. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. PERFORMANCE OF THIS SOFTWARE.
  16. ***************************************************************************** */var lb=function(u,e){return lb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])},lb(u,e)};function Au(u,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");lb(u,e);function t(){this.constructor=u}u.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var cb=function(){return cb=Object.assign||function(e){for(var t,r=1,c=arguments.length;r<c;r++){t=arguments[r];for(var p in t)Object.prototype.hasOwnProperty.call(t,p)&&(e[p]=t[p])}return e},cb.apply(this,arguments)};function Il(u,e,t,r){function c(p){return p instanceof t?p:new t(function(y){y(p)})}return new(t||(t=Promise))(function(p,y){function i(R){try{D(r.next(R))}catch(Q){y(Q)}}function C(R){try{D(r.throw(R))}catch(Q){y(Q)}}function D(R){R.done?p(R.value):c(R.value).then(i,C)}D((r=r.apply(u,e||[])).next())})}function tl(u,e){var t={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},r,c,p,y;return y={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function i(D){return function(R){return C([D,R])}}function C(D){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,c&&(p=D[0]&2?c.return:D[0]?c.throw||((p=c.return)&&p.call(c),0):c.next)&&!(p=p.call(c,D[1])).done)return p;switch(c=0,p&&(D=[D[0]&2,p.value]),D[0]){case 0:case 1:p=D;break;case 4:return t.label++,{value:D[1],done:!1};case 5:t.label++,c=D[1],D=[0];continue;case 7:D=t.ops.pop(),t.trys.pop();continue;default:if(p=t.trys,!(p=p.length>0&&p[p.length-1])&&(D[0]===6||D[0]===2)){t=0;continue}if(D[0]===3&&(!p||D[1]>p[0]&&D[1]<p[3])){t.label=D[1];break}if(D[0]===6&&t.label<p[1]){t.label=p[1],p=D;break}if(p&&t.label<p[2]){t.label=p[2],t.ops.push(D);break}p[2]&&t.ops.pop(),t.trys.pop();continue}D=e.call(u,t)}catch(R){D=[6,R],c=0}finally{r=p=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}}function T0(u,e,t){if(t||arguments.length===2)for(var r=0,c=e.length,p;r<c;r++)(p||!(r in e))&&(p||(p=Array.prototype.slice.call(e,0,r)),p[r]=e[r]);return u.concat(p||e)}var $A=function(){function u(e,t,r,c){this.left=e,this.top=t,this.width=r,this.height=c}return u.prototype.add=function(e,t,r,c){return new u(this.left+e,this.top+t,this.width+r,this.height+c)},u.fromClientRect=function(e,t){return new u(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},u.fromDOMRectList=function(e,t){var r=Array.from(t).find(function(c){return c.width!==0});return r?new u(r.left+e.windowBounds.left,r.top+e.windowBounds.top,r.width,r.height):u.EMPTY},u.EMPTY=new u(0,0,0,0),u}(),Tv=function(u,e){return $A.fromClientRect(u,e.getBoundingClientRect())},Y3=function(u){var e=u.body,t=u.documentElement;if(!e||!t)throw new Error("Unable to get document size");var r=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),c=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new $A(0,0,r,c)},Sv=function(u){for(var e=[],t=0,r=u.length;t<r;){var c=u.charCodeAt(t++);if(c>=55296&&c<=56319&&t<r){var p=u.charCodeAt(t++);(p&64512)===56320?e.push(((c&1023)<<10)+(p&1023)+65536):(e.push(c),t--)}else e.push(c)}return e},Bo=function(){for(var u=[],e=0;e<arguments.length;e++)u[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,u);var t=u.length;if(!t)return"";for(var r=[],c=-1,p="";++c<t;){var y=u[c];y<=65535?r.push(y):(y-=65536,r.push((y>>10)+55296,y%1024+56320)),(c+1===t||r.length>16384)&&(p+=String.fromCharCode.apply(String,r),r.length=0)}return p},zC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J3=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var S0=0;S0<zC.length;S0++)J3[zC.charCodeAt(S0)]=S0;var kC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d_=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var M0=0;M0<kC.length;M0++)d_[kC.charCodeAt(M0)]=M0;var eL=function(u){var e=u.length*.75,t=u.length,r,c=0,p,y,i,C;u[u.length-1]==="="&&(e--,u[u.length-2]==="="&&e--);var D=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),R=Array.isArray(D)?D:new Uint8Array(D);for(r=0;r<t;r+=4)p=d_[u.charCodeAt(r)],y=d_[u.charCodeAt(r+1)],i=d_[u.charCodeAt(r+2)],C=d_[u.charCodeAt(r+3)],R[c++]=p<<2|y>>4,R[c++]=(y&15)<<4|i>>2,R[c++]=(i&3)<<6|C&63;return D},tL=function(u){for(var e=u.length,t=[],r=0;r<e;r+=2)t.push(u[r+1]<<8|u[r]);return t},iL=function(u){for(var e=u.length,t=[],r=0;r<e;r+=4)t.push(u[r+3]<<24|u[r+2]<<16|u[r+1]<<8|u[r]);return t},lf=5,B2=6+5,Y1=2,nL=B2-lf,FS=65536>>lf,rL=1<<lf,J1=rL-1,sL=1024>>lf,oL=FS+sL,aL=oL,lL=32,cL=aL+lL,hL=65536>>B2,uL=1<<nL,AL=uL-1,OC=function(u,e,t){return u.slice?u.slice(e,t):new Uint16Array(Array.prototype.slice.call(u,e,t))},dL=function(u,e,t){return u.slice?u.slice(e,t):new Uint32Array(Array.prototype.slice.call(u,e,t))},pL=function(u,e){var t=eL(u),r=Array.isArray(t)?iL(t):new Uint32Array(t),c=Array.isArray(t)?tL(t):new Uint16Array(t),p=24,y=OC(c,p/2,r[4]/2),i=r[5]===2?OC(c,(p+r[4])/2):dL(r,Math.ceil((p+r[4])/4));return new fL(r[0],r[1],r[2],r[3],y,i)},fL=function(){function u(e,t,r,c,p,y){this.initialValue=e,this.errorValue=t,this.highStart=r,this.highValueIndex=c,this.index=p,this.data=y}return u.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>lf],t=(t<<Y1)+(e&J1),this.data[t];if(e<=65535)return t=this.index[FS+(e-55296>>lf)],t=(t<<Y1)+(e&J1),this.data[t];if(e<this.highStart)return t=cL-hL+(e>>B2),t=this.index[t],t+=e>>lf&AL,t=this.index[t],t=(t<<Y1)+(e&J1),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},u}(),NC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mL=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var I0=0;I0<NC.length;I0++)mL[NC.charCodeAt(I0)]=I0;var gL="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",QC=50,_L=1,LS=2,DS=3,yL=4,xL=5,VC=7,PS=8,HC=9,Kd=10,hb=11,GC=12,ub=13,vL=14,p_=15,Ab=16,F0=17,qg=18,wL=19,WC=20,db=21,Yg=22,ew=23,im=24,Ic=25,f_=26,m_=27,nm=28,bL=29,Zp=30,BL=31,L0=32,D0=33,pb=34,fb=35,mb=36,U_=37,gb=38,Nx=39,Qx=40,tw=41,US=42,CL=43,EL=[9001,65288],RS="!",Kr="\xD7",P0="\xF7",_b=pL(gL),PA=[Zp,mb],yb=[_L,LS,DS,xL],zS=[Kd,PS],jC=[m_,f_],TL=yb.concat(zS),KC=[gb,Nx,Qx,pb,fb],SL=[p_,ub],ML=function(u,e){e===void 0&&(e="strict");var t=[],r=[],c=[];return u.forEach(function(p,y){var i=_b.get(p);if(i>QC?(c.push(!0),i-=QC):c.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(p)!==-1)return r.push(y),t.push(Ab);if(i===yL||i===hb){if(y===0)return r.push(y),t.push(Zp);var C=t[y-1];return TL.indexOf(C)===-1?(r.push(r[y-1]),t.push(C)):(r.push(y),t.push(Zp))}if(r.push(y),i===BL)return t.push(e==="strict"?db:U_);if(i===US||i===bL)return t.push(Zp);if(i===CL)return p>=131072&&p<=196605||p>=196608&&p<=262141?t.push(U_):t.push(Zp);t.push(i)}),[r,t,c]},iw=function(u,e,t,r){var c=r[t];if(Array.isArray(u)?u.indexOf(c)!==-1:u===c)for(var p=t;p<=r.length;){p++;var y=r[p];if(y===e)return!0;if(y!==Kd)break}if(c===Kd)for(var p=t;p>0;){p--;var i=r[p];if(Array.isArray(u)?u.indexOf(i)!==-1:u===i)for(var C=t;C<=r.length;){C++;var y=r[C];if(y===e)return!0;if(y!==Kd)break}if(i!==Kd)break}return!1},$C=function(u,e){for(var t=u;t>=0;){var r=e[t];if(r===Kd)t--;else return r}return 0},IL=function(u,e,t,r,c){if(t[r]===0)return Kr;var p=r-1;if(Array.isArray(c)&&c[p]===!0)return Kr;var y=p-1,i=p+1,C=e[p],D=y>=0?e[y]:0,R=e[i];if(C===LS&&R===DS)return Kr;if(yb.indexOf(C)!==-1)return RS;if(yb.indexOf(R)!==-1||zS.indexOf(R)!==-1)return Kr;if($C(p,e)===PS)return P0;if(_b.get(u[p])===hb||(C===L0||C===D0)&&_b.get(u[i])===hb||C===VC||R===VC||C===HC||[Kd,ub,p_].indexOf(C)===-1&&R===HC||[F0,qg,wL,im,nm].indexOf(R)!==-1||$C(p,e)===Yg||iw(ew,Yg,p,e)||iw([F0,qg],db,p,e)||iw(GC,GC,p,e))return Kr;if(C===Kd)return P0;if(C===ew||R===ew)return Kr;if(R===Ab||C===Ab)return P0;if([ub,p_,db].indexOf(R)!==-1||C===vL||D===mb&&SL.indexOf(C)!==-1||C===nm&&R===mb||R===WC||PA.indexOf(R)!==-1&&C===Ic||PA.indexOf(C)!==-1&&R===Ic||C===m_&&[U_,L0,D0].indexOf(R)!==-1||[U_,L0,D0].indexOf(C)!==-1&&R===f_||PA.indexOf(C)!==-1&&jC.indexOf(R)!==-1||jC.indexOf(C)!==-1&&PA.indexOf(R)!==-1||[m_,f_].indexOf(C)!==-1&&(R===Ic||[Yg,p_].indexOf(R)!==-1&&e[i+1]===Ic)||[Yg,p_].indexOf(C)!==-1&&R===Ic||C===Ic&&[Ic,nm,im].indexOf(R)!==-1)return Kr;if([Ic,nm,im,F0,qg].indexOf(R)!==-1)for(var Q=p;Q>=0;){var z=e[Q];if(z===Ic)return Kr;if([nm,im].indexOf(z)!==-1)Q--;else break}if([m_,f_].indexOf(R)!==-1)for(var Q=[F0,qg].indexOf(C)!==-1?y:p;Q>=0;){var z=e[Q];if(z===Ic)return Kr;if([nm,im].indexOf(z)!==-1)Q--;else break}if(gb===C&&[gb,Nx,pb,fb].indexOf(R)!==-1||[Nx,pb].indexOf(C)!==-1&&[Nx,Qx].indexOf(R)!==-1||[Qx,fb].indexOf(C)!==-1&&R===Qx||KC.indexOf(C)!==-1&&[WC,f_].indexOf(R)!==-1||KC.indexOf(R)!==-1&&C===m_||PA.indexOf(C)!==-1&&PA.indexOf(R)!==-1||C===im&&PA.indexOf(R)!==-1||PA.concat(Ic).indexOf(C)!==-1&&R===Yg&&EL.indexOf(u[i])===-1||PA.concat(Ic).indexOf(R)!==-1&&C===qg)return Kr;if(C===tw&&R===tw){for(var G=t[p],J=1;G>0&&(G--,e[G]===tw);)J++;if(J%2!==0)return Kr}return C===L0&&R===D0?Kr:P0},FL=function(u,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=ML(u,e.lineBreak),r=t[0],c=t[1],p=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(c=c.map(function(i){return[Ic,Zp,US].indexOf(i)!==-1?U_:i}));var y=e.wordBreak==="keep-all"?p.map(function(i,C){return i&&u[C]>=19968&&u[C]<=40959}):void 0;return[r,c,y]},LL=function(){function u(e,t,r,c){this.codePoints=e,this.required=t===RS,this.start=r,this.end=c}return u.prototype.slice=function(){return Bo.apply(void 0,this.codePoints.slice(this.start,this.end))},u}(),DL=function(u,e){var t=Sv(u),r=FL(t,e),c=r[0],p=r[1],y=r[2],i=t.length,C=0,D=0;return{next:function(){if(D>=i)return{done:!0,value:null};for(var R=Kr;D<i&&(R=IL(t,p,c,++D,y))===Kr;);if(R!==Kr||D===i){var Q=new LL(t,R,C,D);return C=D,{value:Q,done:!1}}return{done:!0,value:null}}}},PL=1<<0,UL=1<<1,oy=1<<2,ZC=1<<3,ev=10,XC=47,w_=92,RL=9,zL=32,U0=34,Jg=61,kL=35,OL=36,NL=37,R0=39,z0=40,e_=41,QL=95,nc=45,VL=33,HL=60,GL=62,WL=64,jL=91,KL=93,$L=61,ZL=123,k0=63,XL=125,qC=124,qL=126,YL=128,YC=65533,nw=42,nf=43,JL=44,eD=58,tD=59,R_=46,iD=0,nD=8,rD=11,sD=14,oD=31,aD=127,zu=-1,kS=48,OS=97,NS=101,lD=102,cD=117,hD=122,QS=65,VS=69,HS=70,uD=85,AD=90,il=function(u){return u>=kS&&u<=57},dD=function(u){return u>=55296&&u<=57343},rm=function(u){return il(u)||u>=QS&&u<=HS||u>=OS&&u<=lD},pD=function(u){return u>=OS&&u<=hD},fD=function(u){return u>=QS&&u<=AD},mD=function(u){return pD(u)||fD(u)},gD=function(u){return u>=YL},O0=function(u){return u===ev||u===RL||u===zL},tv=function(u){return mD(u)||gD(u)||u===QL},JC=function(u){return tv(u)||il(u)||u===nc},_D=function(u){return u>=iD&&u<=nD||u===rD||u>=sD&&u<=oD||u===aD},Wd=function(u,e){return u!==w_?!1:e!==ev},N0=function(u,e,t){return u===nc?tv(e)||Wd(e,t):tv(u)?!0:!!(u===w_&&Wd(u,e))},rw=function(u,e,t){return u===nf||u===nc?il(e)?!0:e===R_&&il(t):il(u===R_?e:u)},yD=function(u){var e=0,t=1;(u[e]===nf||u[e]===nc)&&(u[e]===nc&&(t=-1),e++);for(var r=[];il(u[e]);)r.push(u[e++]);var c=r.length?parseInt(Bo.apply(void 0,r),10):0;u[e]===R_&&e++;for(var p=[];il(u[e]);)p.push(u[e++]);var y=p.length,i=y?parseInt(Bo.apply(void 0,p),10):0;(u[e]===VS||u[e]===NS)&&e++;var C=1;(u[e]===nf||u[e]===nc)&&(u[e]===nc&&(C=-1),e++);for(var D=[];il(u[e]);)D.push(u[e++]);var R=D.length?parseInt(Bo.apply(void 0,D),10):0;return t*(c+i*Math.pow(10,-y))*Math.pow(10,C*R)},xD={type:2},vD={type:3},wD={type:4},bD={type:13},BD={type:8},CD={type:21},ED={type:9},TD={type:10},SD={type:11},MD={type:12},ID={type:14},Q0={type:23},FD={type:1},LD={type:25},DD={type:24},PD={type:26},UD={type:27},RD={type:28},zD={type:29},kD={type:31},xb={type:32},GS=function(){function u(){this._value=[]}return u.prototype.write=function(e){this._value=this._value.concat(Sv(e))},u.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==xb;)e.push(t),t=this.consumeToken();return e},u.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case U0:return this.consumeStringToken(U0);case kL:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),c=this.peekCodePoint(2);if(JC(t)||Wd(r,c)){var p=N0(t,r,c)?UL:PL,y=this.consumeName();return{type:5,value:y,flags:p}}break;case OL:if(this.peekCodePoint(0)===Jg)return this.consumeCodePoint(),bD;break;case R0:return this.consumeStringToken(R0);case z0:return xD;case e_:return vD;case nw:if(this.peekCodePoint(0)===Jg)return this.consumeCodePoint(),ID;break;case nf:if(rw(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case JL:return wD;case nc:var i=e,C=this.peekCodePoint(0),D=this.peekCodePoint(1);if(rw(i,C,D))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(N0(i,C,D))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(C===nc&&D===GL)return this.consumeCodePoint(),this.consumeCodePoint(),DD;break;case R_:if(rw(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case XC:if(this.peekCodePoint(0)===nw)for(this.consumeCodePoint();;){var R=this.consumeCodePoint();if(R===nw&&(R=this.consumeCodePoint(),R===XC))return this.consumeToken();if(R===zu)return this.consumeToken()}break;case eD:return PD;case tD:return UD;case HL:if(this.peekCodePoint(0)===VL&&this.peekCodePoint(1)===nc&&this.peekCodePoint(2)===nc)return this.consumeCodePoint(),this.consumeCodePoint(),LD;break;case WL:var Q=this.peekCodePoint(0),z=this.peekCodePoint(1),G=this.peekCodePoint(2);if(N0(Q,z,G)){var y=this.consumeName();return{type:7,value:y}}break;case jL:return RD;case w_:if(Wd(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case KL:return zD;case $L:if(this.peekCodePoint(0)===Jg)return this.consumeCodePoint(),BD;break;case ZL:return SD;case XL:return MD;case cD:case uD:var J=this.peekCodePoint(0),Y=this.peekCodePoint(1);return J===nf&&(rm(Y)||Y===k0)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case qC:if(this.peekCodePoint(0)===Jg)return this.consumeCodePoint(),ED;if(this.peekCodePoint(0)===qC)return this.consumeCodePoint(),CD;break;case qL:if(this.peekCodePoint(0)===Jg)return this.consumeCodePoint(),TD;break;case zu:return xb}return O0(e)?(this.consumeWhiteSpace(),kD):il(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):tv(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Bo(e)}},u.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},u.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},u.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},u.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();rm(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===k0&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var c=parseInt(Bo.apply(void 0,e.map(function(C){return C===k0?kS:C})),16),p=parseInt(Bo.apply(void 0,e.map(function(C){return C===k0?HS:C})),16);return{type:30,start:c,end:p}}var y=parseInt(Bo.apply(void 0,e),16);if(this.peekCodePoint(0)===nc&&rm(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var i=[];rm(t)&&i.length<6;)i.push(t),t=this.consumeCodePoint();var p=parseInt(Bo.apply(void 0,i),16);return{type:30,start:y,end:p}}else return{type:30,start:y,end:y}},u.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===z0?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===z0?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},u.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===zu)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===R0||t===U0){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===zu||this.peekCodePoint(0)===e_)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),Q0)}for(;;){var c=this.consumeCodePoint();if(c===zu||c===e_)return{type:22,value:Bo.apply(void 0,e)};if(O0(c))return this.consumeWhiteSpace(),this.peekCodePoint(0)===zu||this.peekCodePoint(0)===e_?(this.consumeCodePoint(),{type:22,value:Bo.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Q0);if(c===U0||c===R0||c===z0||_D(c))return this.consumeBadUrlRemnants(),Q0;if(c===w_)if(Wd(c,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Q0;else e.push(c)}},u.prototype.consumeWhiteSpace=function(){for(;O0(this.peekCodePoint(0));)this.consumeCodePoint()},u.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===e_||e===zu)return;Wd(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},u.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var c=Math.min(t,e);r+=Bo.apply(void 0,this._value.splice(0,c)),e-=c}return this._value.shift(),r},u.prototype.consumeStringToken=function(e){var t="",r=0;do{var c=this._value[r];if(c===zu||c===void 0||c===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(c===ev)return this._value.splice(0,r),FD;if(c===w_){var p=this._value[r+1];p!==zu&&p!==void 0&&(p===ev?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Wd(c,p)&&(t+=this.consumeStringSlice(r),t+=Bo(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},u.prototype.consumeNumber=function(){var e=[],t=oy,r=this.peekCodePoint(0);for((r===nf||r===nc)&&e.push(this.consumeCodePoint());il(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var c=this.peekCodePoint(1);if(r===R_&&il(c))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=ZC;il(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),c=this.peekCodePoint(1);var p=this.peekCodePoint(2);if((r===VS||r===NS)&&((c===nf||c===nc)&&il(p)||il(c)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=ZC;il(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[yD(e),t]},u.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],c=this.peekCodePoint(0),p=this.peekCodePoint(1),y=this.peekCodePoint(2);if(N0(c,p,y)){var i=this.consumeName();return{type:15,number:t,flags:r,unit:i}}return c===NL?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},u.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(rm(e)){for(var t=Bo(e);rm(this.peekCodePoint(0))&&t.length<6;)t+=Bo(this.consumeCodePoint());O0(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||dD(r)||r>1114111?YC:r}return e===zu?YC:e},u.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(JC(t))e+=Bo(t);else if(Wd(t,this.peekCodePoint(0)))e+=Bo(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},u}(),WS=function(){function u(e){this._tokens=e}return u.create=function(e){var t=new GS;return t.write(e),new u(t.read())},u.parseValue=function(e){return u.create(e).parseComponentValue()},u.parseValues=function(e){return u.create(e).parseComponentValues()},u.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},u.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},u.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},u.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||ND(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},u.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},u.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?xb:e},u.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},u}(),ay=function(u){return u.type===15},Xm=function(u){return u.type===17},Ss=function(u){return u.type===20},OD=function(u){return u.type===0},vb=function(u,e){return Ss(u)&&u.value===e},jS=function(u){return u.type!==31},Hm=function(u){return u.type!==31&&u.type!==4},$u=function(u){var e=[],t=[];return u.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},ND=function(u,e){return e===11&&u.type===12||e===28&&u.type===29?!0:e===2&&u.type===3},np=function(u){return u.type===17||u.type===15},zo=function(u){return u.type===16||np(u)},KS=function(u){return u.length>1?[u[0],u[1]]:[u[0]]},ka={type:17,number:0,flags:oy},C2={type:16,number:50,flags:oy},$d={type:16,number:100,flags:oy},g_=function(u,e,t){var r=u[0],c=u[1];return[Gs(r,e),Gs(typeof c<"u"?c:r,t)]},Gs=function(u,e){if(u.type===16)return u.number/100*e;if(ay(u))switch(u.unit){case"rem":case"em":return 16*u.number;case"px":default:return u.number}return u.number},$S="deg",ZS="grad",XS="rad",qS="turn",Mv={name:"angle",parse:function(u,e){if(e.type===15)switch(e.unit){case $S:return Math.PI*e.number/180;case ZS:return Math.PI/200*e.number;case XS:return e.number;case qS:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},YS=function(u){return u.type===15&&(u.unit===$S||u.unit===ZS||u.unit===XS||u.unit===qS)},JS=function(u){var e=u.filter(Ss).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ka,ka];case"to top":case"bottom":return bh(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ka,$d];case"to right":case"left":return bh(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[$d,$d];case"to bottom":case"top":return bh(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[$d,ka];case"to left":case"right":return bh(270)}return 0},bh=function(u){return Math.PI*u/180},Yd={name:"color",parse:function(u,e){if(e.type===18){var t=QD[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(u,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),c=e.value.substring(1,2),p=e.value.substring(2,3);return Zd(parseInt(r+r,16),parseInt(c+c,16),parseInt(p+p,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),c=e.value.substring(1,2),p=e.value.substring(2,3),y=e.value.substring(3,4);return Zd(parseInt(r+r,16),parseInt(c+c,16),parseInt(p+p,16),parseInt(y+y,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),c=e.value.substring(2,4),p=e.value.substring(4,6);return Zd(parseInt(r,16),parseInt(c,16),parseInt(p,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),c=e.value.substring(2,4),p=e.value.substring(4,6),y=e.value.substring(6,8);return Zd(parseInt(r,16),parseInt(c,16),parseInt(p,16),parseInt(y,16)/255)}}if(e.type===20){var i=jA[e.value.toUpperCase()];if(typeof i<"u")return i}return jA.TRANSPARENT}},Jd=function(u){return(255&u)===0},ma=function(u){var e=255&u,t=255&u>>8,r=255&u>>16,c=255&u>>24;return e<255?"rgba("+c+","+r+","+t+","+e/255+")":"rgb("+c+","+r+","+t+")"},Zd=function(u,e,t,r){return(u<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},eE=function(u,e){if(u.type===17)return u.number;if(u.type===16){var t=e===3?1:255;return e===3?u.number/100*t:Math.round(u.number/100*t)}return 0},tE=function(u,e){var t=e.filter(Hm);if(t.length===3){var r=t.map(eE),c=r[0],p=r[1],y=r[2];return Zd(c,p,y,1)}if(t.length===4){var i=t.map(eE),c=i[0],p=i[1],y=i[2],C=i[3];return Zd(c,p,y,C)}return 0};function sw(u,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-u)*t*6+u:t<1/2?e:t<2/3?(e-u)*6*(2/3-t)+u:u}var iE=function(u,e){var t=e.filter(Hm),r=t[0],c=t[1],p=t[2],y=t[3],i=(r.type===17?bh(r.number):Mv.parse(u,r))/(Math.PI*2),C=zo(c)?c.number/100:0,D=zo(p)?p.number/100:0,R=typeof y<"u"&&zo(y)?Gs(y,1):1;if(C===0)return Zd(D*255,D*255,D*255,1);var Q=D<=.5?D*(C+1):D+C-D*C,z=D*2-Q,G=sw(z,Q,i+1/3),J=sw(z,Q,i),Y=sw(z,Q,i-1/3);return Zd(G*255,J*255,Y*255,R)},QD={hsl:iE,hsla:iE,rgb:tE,rgba:tE},b_=function(u,e){return Yd.parse(u,WS.create(e).parseComponentValue())},jA={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},VD={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(u,e){return e.map(function(t){if(Ss(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},HD={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Iv=function(u,e){var t=Yd.parse(u,e[0]),r=e[1];return r&&zo(r)?{color:t,stop:r}:{color:t,stop:null}},nE=function(u,e){var t=u[0],r=u[u.length-1];t.stop===null&&(t.stop=ka),r.stop===null&&(r.stop=$d);for(var c=[],p=0,y=0;y<u.length;y++){var i=u[y].stop;if(i!==null){var C=Gs(i,e);C>p?c.push(C):c.push(p),p=C}else c.push(null)}for(var D=null,y=0;y<c.length;y++){var R=c[y];if(R===null)D===null&&(D=y);else if(D!==null){for(var Q=y-D,z=c[D-1],G=(R-z)/(Q+1),J=1;J<=Q;J++)c[D+J-1]=G*J;D=null}}return u.map(function(Y,B){var ae=Y.color;return{color:ae,stop:Math.max(Math.min(1,c[B]/e),0)}})},GD=function(u,e,t){var r=e/2,c=t/2,p=Gs(u[0],e)-r,y=c-Gs(u[1],t);return(Math.atan2(y,p)+Math.PI*2)%(Math.PI*2)},WD=function(u,e,t){var r=typeof u=="number"?u:GD(u,e,t),c=Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)),p=e/2,y=t/2,i=c/2,C=Math.sin(r-Math.PI/2)*i,D=Math.cos(r-Math.PI/2)*i;return[c,p-D,p+D,y-C,y+C]},lu=function(u,e){return Math.sqrt(u*u+e*e)},rE=function(u,e,t,r,c){var p=[[0,0],[0,e],[u,0],[u,e]];return p.reduce(function(y,i){var C=i[0],D=i[1],R=lu(t-C,r-D);return(c?R<y.optimumDistance:R>y.optimumDistance)?{optimumCorner:i,optimumDistance:R}:y},{optimumDistance:c?1/0:-1/0,optimumCorner:null}).optimumCorner},jD=function(u,e,t,r,c){var p=0,y=0;switch(u.size){case 0:u.shape===0?p=y=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-c)):u.shape===1&&(p=Math.min(Math.abs(e),Math.abs(e-r)),y=Math.min(Math.abs(t),Math.abs(t-c)));break;case 2:if(u.shape===0)p=y=Math.min(lu(e,t),lu(e,t-c),lu(e-r,t),lu(e-r,t-c));else if(u.shape===1){var i=Math.min(Math.abs(t),Math.abs(t-c))/Math.min(Math.abs(e),Math.abs(e-r)),C=rE(r,c,e,t,!0),D=C[0],R=C[1];p=lu(D-e,(R-t)/i),y=i*p}break;case 1:u.shape===0?p=y=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-c)):u.shape===1&&(p=Math.max(Math.abs(e),Math.abs(e-r)),y=Math.max(Math.abs(t),Math.abs(t-c)));break;case 3:if(u.shape===0)p=y=Math.max(lu(e,t),lu(e,t-c),lu(e-r,t),lu(e-r,t-c));else if(u.shape===1){var i=Math.max(Math.abs(t),Math.abs(t-c))/Math.max(Math.abs(e),Math.abs(e-r)),Q=rE(r,c,e,t,!1),D=Q[0],R=Q[1];p=lu(D-e,(R-t)/i),y=i*p}break}return Array.isArray(u.size)&&(p=Gs(u.size[0],r),y=u.size.length===2?Gs(u.size[1],c):p),[p,y]},KD=function(u,e){var t=bh(180),r=[];return $u(e).forEach(function(c,p){if(p===0){var y=c[0];if(y.type===20&&y.value==="to"){t=JS(c);return}else if(YS(y)){t=Mv.parse(u,y);return}}var i=Iv(u,c);r.push(i)}),{angle:t,stops:r,type:1}},V0=function(u,e){var t=bh(180),r=[];return $u(e).forEach(function(c,p){if(p===0){var y=c[0];if(y.type===20&&["top","left","right","bottom"].indexOf(y.value)!==-1){t=JS(c);return}else if(YS(y)){t=(Mv.parse(u,y)+bh(270))%bh(360);return}}var i=Iv(u,c);r.push(i)}),{angle:t,stops:r,type:1}},$D=function(u,e){var t=bh(180),r=[],c=1,p=0,y=3,i=[];return $u(e).forEach(function(C,D){var R=C[0];if(D===0){if(Ss(R)&&R.value==="linear"){c=1;return}else if(Ss(R)&&R.value==="radial"){c=2;return}}if(R.type===18){if(R.name==="from"){var Q=Yd.parse(u,R.values[0]);r.push({stop:ka,color:Q})}else if(R.name==="to"){var Q=Yd.parse(u,R.values[0]);r.push({stop:$d,color:Q})}else if(R.name==="color-stop"){var z=R.values.filter(Hm);if(z.length===2){var Q=Yd.parse(u,z[1]),G=z[0];Xm(G)&&r.push({stop:{type:16,number:G.number*100,flags:G.flags},color:Q})}}}}),c===1?{angle:(t+bh(180))%bh(360),stops:r,type:c}:{size:y,shape:p,stops:r,position:i,type:c}},eM="closest-side",tM="farthest-side",iM="closest-corner",nM="farthest-corner",rM="circle",sM="ellipse",oM="cover",aM="contain",ZD=function(u,e){var t=0,r=3,c=[],p=[];return $u(e).forEach(function(y,i){var C=!0;if(i===0){var D=!1;C=y.reduce(function(Q,z){if(D)if(Ss(z))switch(z.value){case"center":return p.push(C2),Q;case"top":case"left":return p.push(ka),Q;case"right":case"bottom":return p.push($d),Q}else(zo(z)||np(z))&&p.push(z);else if(Ss(z))switch(z.value){case rM:return t=0,!1;case sM:return t=1,!1;case"at":return D=!0,!1;case eM:return r=0,!1;case oM:case tM:return r=1,!1;case aM:case iM:return r=2,!1;case nM:return r=3,!1}else if(np(z)||zo(z))return Array.isArray(r)||(r=[]),r.push(z),!1;return Q},C)}if(C){var R=Iv(u,y);c.push(R)}}),{size:r,shape:t,stops:c,position:p,type:2}},H0=function(u,e){var t=0,r=3,c=[],p=[];return $u(e).forEach(function(y,i){var C=!0;if(i===0?C=y.reduce(function(R,Q){if(Ss(Q))switch(Q.value){case"center":return p.push(C2),!1;case"top":case"left":return p.push(ka),!1;case"right":case"bottom":return p.push($d),!1}else if(zo(Q)||np(Q))return p.push(Q),!1;return R},C):i===1&&(C=y.reduce(function(R,Q){if(Ss(Q))switch(Q.value){case rM:return t=0,!1;case sM:return t=1,!1;case aM:case eM:return r=0,!1;case tM:return r=1,!1;case iM:return r=2,!1;case oM:case nM:return r=3,!1}else if(np(Q)||zo(Q))return Array.isArray(r)||(r=[]),r.push(Q),!1;return R},C)),C){var D=Iv(u,y);c.push(D)}}),{size:r,shape:t,stops:c,position:p,type:2}},XD=function(u){return u.type===1},qD=function(u){return u.type===2},E2={name:"image",parse:function(u,e){if(e.type===22){var t={url:e.value,type:0};return u.cache.addImage(e.value),t}if(e.type===18){var r=lM[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(u,e.values)}throw new Error("Unsupported image type "+e.type)}};function YD(u){return!(u.type===20&&u.value==="none")&&(u.type!==18||!!lM[u.name])}var lM={"linear-gradient":KD,"-moz-linear-gradient":V0,"-ms-linear-gradient":V0,"-o-linear-gradient":V0,"-webkit-linear-gradient":V0,"radial-gradient":ZD,"-moz-radial-gradient":H0,"-ms-radial-gradient":H0,"-o-radial-gradient":H0,"-webkit-radial-gradient":H0,"-webkit-gradient":$D},JD={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(u,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return Hm(r)&&YD(r)}).map(function(r){return E2.parse(u,r)})}},eP={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(u,e){return e.map(function(t){if(Ss(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},tP={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(u,e){return $u(e).map(function(t){return t.filter(zo)}).map(KS)}},iP={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(u,e){return $u(e).map(function(t){return t.filter(Ss).map(function(r){return r.value}).join(" ")}).map(nP)}},nP=function(u){switch(u){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Om;(function(u){u.AUTO="auto",u.CONTAIN="contain",u.COVER="cover"})(Om||(Om={}));var rP={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(u,e){return $u(e).map(function(t){return t.filter(sP)})}},sP=function(u){return Ss(u)||zo(u)},Fv=function(u){return{name:"border-"+u+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},oP=Fv("top"),aP=Fv("right"),lP=Fv("bottom"),cP=Fv("left"),Lv=function(u){return{name:"border-radius-"+u,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return KS(t.filter(zo))}}},hP=Lv("top-left"),uP=Lv("top-right"),AP=Lv("bottom-right"),dP=Lv("bottom-left"),Dv=function(u){return{name:"border-"+u+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},pP=Dv("top"),fP=Dv("right"),mP=Dv("bottom"),gP=Dv("left"),Pv=function(u){return{name:"border-"+u+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return ay(t)?t.number:0}}},_P=Pv("top"),yP=Pv("right"),xP=Pv("bottom"),vP=Pv("left"),wP={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},bP={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(u,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},BP={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(u,e){return e.filter(Ss).reduce(function(t,r){return t|CP(r.value)},0)}},CP=function(u){switch(u){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},EP={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},TP={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(u,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},iv;(function(u){u.NORMAL="normal",u.STRICT="strict"})(iv||(iv={}));var SP={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"strict":return iv.STRICT;case"normal":default:return iv.NORMAL}}},MP={name:"line-height",initialValue:"normal",prefix:!1,type:4},sE=function(u,e){return Ss(u)&&u.value==="normal"?1.2*e:u.type===17?e*u.number:zo(u)?Gs(u,e):e},IP={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(u,e){return e.type===20&&e.value==="none"?null:E2.parse(u,e)}},FP={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(u,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},wb={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Uv=function(u){return{name:"margin-"+u,initialValue:"0",prefix:!1,type:4}},LP=Uv("top"),DP=Uv("right"),PP=Uv("bottom"),UP=Uv("left"),RP={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(u,e){return e.filter(Ss).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},zP={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Rv=function(u){return{name:"padding-"+u,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},kP=Rv("top"),OP=Rv("right"),NP=Rv("bottom"),QP=Rv("left"),VP={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(u,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},HP={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(u,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},GP={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(u,e){return e.length===1&&vb(e[0],"none")?[]:$u(e).map(function(t){for(var r={color:jA.TRANSPARENT,offsetX:ka,offsetY:ka,blur:ka},c=0,p=0;p<t.length;p++){var y=t[p];np(y)?(c===0?r.offsetX=y:c===1?r.offsetY=y:r.blur=y,c++):r.color=Yd.parse(u,y)}return r})}},WP={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},jP={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(u,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=ZP[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},KP=function(u){var e=u.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},$P=function(u){var e=u.filter(function(C){return C.type===17}).map(function(C){return C.number}),t=e[0],r=e[1];e[2],e[3];var c=e[4],p=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var y=e[12],i=e[13];return e[14],e[15],e.length===16?[t,r,c,p,y,i]:null},ZP={matrix:KP,matrix3d:$P},oE={type:16,number:50,flags:oy},XP=[oE,oE],qP={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(u,e){var t=e.filter(zo);return t.length!==2?XP:[t[0],t[1]]}},YP={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(u,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},B_;(function(u){u.NORMAL="normal",u.BREAK_ALL="break-all",u.KEEP_ALL="keep-all"})(B_||(B_={}));var JP={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"break-all":return B_.BREAK_ALL;case"keep-all":return B_.KEEP_ALL;case"normal":default:return B_.NORMAL}}},eU={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(u,e){if(e.type===20)return{auto:!0,order:0};if(Xm(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},cM={name:"time",parse:function(u,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},tU={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(u,e){return Xm(e)?e.number:1}},iU={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},nU={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(u,e){return e.filter(Ss).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},rU={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(u,e){var t=[],r=[];return e.forEach(function(c){switch(c.type){case 20:case 0:t.push(c.value);break;case 17:t.push(c.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(c){return c.indexOf(" ")===-1?c:"'"+c+"'"})}},sU={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},oU={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(u,e){if(Xm(e))return e.number;if(Ss(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},aU={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(u,e){return e.filter(Ss).map(function(t){return t.value})}},lU={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(u,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},na=function(u,e){return(u&e)!==0},cU={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(u,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},hU={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(u,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var r=[],c=e.filter(jS),p=0;p<c.length;p++){var y=c[p],i=c[p+1];if(y.type===20){var C=i&&Xm(i)?i.number:1;r.push({counter:y.value,increment:C})}}return r}},uU={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(u,e){if(e.length===0)return[];for(var t=[],r=e.filter(jS),c=0;c<r.length;c++){var p=r[c],y=r[c+1];if(Ss(p)&&p.value!=="none"){var i=y&&Xm(y)?y.number:0;t.push({counter:p.value,reset:i})}}return t}},AU={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(u,e){return e.filter(ay).map(function(t){return cM.parse(u,t)})}},dU={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(u,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var r=[],c=e.filter(OD);if(c.length%2!==0)return null;for(var p=0;p<c.length;p+=2){var y=c[p].value,i=c[p+1].value;r.push({open:y,close:i})}return r}},aE=function(u,e,t){if(!u)return"";var r=u[Math.min(e,u.length-1)];return r?t?r.open:r.close:""},pU={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(u,e){return e.length===1&&vb(e[0],"none")?[]:$u(e).map(function(t){for(var r={color:255,offsetX:ka,offsetY:ka,blur:ka,spread:ka,inset:!1},c=0,p=0;p<t.length;p++){var y=t[p];vb(y,"inset")?r.inset=!0:np(y)?(c===0?r.offsetX=y:c===1?r.offsetY=y:c===2?r.blur=y:r.spread=y,c++):r.color=Yd.parse(u,y)}return r})}},fU={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(u,e){var t=[0,1,2],r=[];return e.filter(Ss).forEach(function(c){switch(c.value){case"stroke":r.push(1);break;case"fill":r.push(0);break;case"markers":r.push(2);break}}),t.forEach(function(c){r.indexOf(c)===-1&&r.push(c)}),r}},mU={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},gU={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(u,e){return ay(e)?e.number:0}},_U=function(){function u(e,t){var r,c;this.animationDuration=Nn(e,AU,t.animationDuration),this.backgroundClip=Nn(e,VD,t.backgroundClip),this.backgroundColor=Nn(e,HD,t.backgroundColor),this.backgroundImage=Nn(e,JD,t.backgroundImage),this.backgroundOrigin=Nn(e,eP,t.backgroundOrigin),this.backgroundPosition=Nn(e,tP,t.backgroundPosition),this.backgroundRepeat=Nn(e,iP,t.backgroundRepeat),this.backgroundSize=Nn(e,rP,t.backgroundSize),this.borderTopColor=Nn(e,oP,t.borderTopColor),this.borderRightColor=Nn(e,aP,t.borderRightColor),this.borderBottomColor=Nn(e,lP,t.borderBottomColor),this.borderLeftColor=Nn(e,cP,t.borderLeftColor),this.borderTopLeftRadius=Nn(e,hP,t.borderTopLeftRadius),this.borderTopRightRadius=Nn(e,uP,t.borderTopRightRadius),this.borderBottomRightRadius=Nn(e,AP,t.borderBottomRightRadius),this.borderBottomLeftRadius=Nn(e,dP,t.borderBottomLeftRadius),this.borderTopStyle=Nn(e,pP,t.borderTopStyle),this.borderRightStyle=Nn(e,fP,t.borderRightStyle),this.borderBottomStyle=Nn(e,mP,t.borderBottomStyle),this.borderLeftStyle=Nn(e,gP,t.borderLeftStyle),this.borderTopWidth=Nn(e,_P,t.borderTopWidth),this.borderRightWidth=Nn(e,yP,t.borderRightWidth),this.borderBottomWidth=Nn(e,xP,t.borderBottomWidth),this.borderLeftWidth=Nn(e,vP,t.borderLeftWidth),this.boxShadow=Nn(e,pU,t.boxShadow),this.color=Nn(e,wP,t.color),this.direction=Nn(e,bP,t.direction),this.display=Nn(e,BP,t.display),this.float=Nn(e,EP,t.cssFloat),this.fontFamily=Nn(e,rU,t.fontFamily),this.fontSize=Nn(e,sU,t.fontSize),this.fontStyle=Nn(e,lU,t.fontStyle),this.fontVariant=Nn(e,aU,t.fontVariant),this.fontWeight=Nn(e,oU,t.fontWeight),this.letterSpacing=Nn(e,TP,t.letterSpacing),this.lineBreak=Nn(e,SP,t.lineBreak),this.lineHeight=Nn(e,MP,t.lineHeight),this.listStyleImage=Nn(e,IP,t.listStyleImage),this.listStylePosition=Nn(e,FP,t.listStylePosition),this.listStyleType=Nn(e,wb,t.listStyleType),this.marginTop=Nn(e,LP,t.marginTop),this.marginRight=Nn(e,DP,t.marginRight),this.marginBottom=Nn(e,PP,t.marginBottom),this.marginLeft=Nn(e,UP,t.marginLeft),this.opacity=Nn(e,tU,t.opacity);var p=Nn(e,RP,t.overflow);this.overflowX=p[0],this.overflowY=p[p.length>1?1:0],this.overflowWrap=Nn(e,zP,t.overflowWrap),this.paddingTop=Nn(e,kP,t.paddingTop),this.paddingRight=Nn(e,OP,t.paddingRight),this.paddingBottom=Nn(e,NP,t.paddingBottom),this.paddingLeft=Nn(e,QP,t.paddingLeft),this.paintOrder=Nn(e,fU,t.paintOrder),this.position=Nn(e,HP,t.position),this.textAlign=Nn(e,VP,t.textAlign),this.textDecorationColor=Nn(e,iU,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Nn(e,nU,(c=t.textDecorationLine)!==null&&c!==void 0?c:t.textDecoration),this.textShadow=Nn(e,GP,t.textShadow),this.textTransform=Nn(e,WP,t.textTransform),this.transform=Nn(e,jP,t.transform),this.transformOrigin=Nn(e,qP,t.transformOrigin),this.visibility=Nn(e,YP,t.visibility),this.webkitTextStrokeColor=Nn(e,mU,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Nn(e,gU,t.webkitTextStrokeWidth),this.wordBreak=Nn(e,JP,t.wordBreak),this.zIndex=Nn(e,eU,t.zIndex)}return u.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},u.prototype.isTransparent=function(){return Jd(this.backgroundColor)},u.prototype.isTransformed=function(){return this.transform!==null},u.prototype.isPositioned=function(){return this.position!==0},u.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},u.prototype.isFloating=function(){return this.float!==0},u.prototype.isInlineLevel=function(){return na(this.display,4)||na(this.display,33554432)||na(this.display,268435456)||na(this.display,536870912)||na(this.display,67108864)||na(this.display,134217728)},u}(),yU=function(){function u(e,t){this.content=Nn(e,cU,t.content),this.quotes=Nn(e,dU,t.quotes)}return u}(),lE=function(){function u(e,t){this.counterIncrement=Nn(e,hU,t.counterIncrement),this.counterReset=Nn(e,uU,t.counterReset)}return u}(),Nn=function(u,e,t){var r=new GS,c=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(c);var p=new WS(r.read());switch(e.type){case 2:var y=p.parseComponentValue();return e.parse(u,Ss(y)?y.value:e.initialValue);case 0:return e.parse(u,p.parseComponentValue());case 1:return e.parse(u,p.parseComponentValues());case 4:return p.parseComponentValue();case 3:switch(e.format){case"angle":return Mv.parse(u,p.parseComponentValue());case"color":return Yd.parse(u,p.parseComponentValue());case"image":return E2.parse(u,p.parseComponentValue());case"length":var i=p.parseComponentValue();return np(i)?i:ka;case"length-percentage":var C=p.parseComponentValue();return zo(C)?C:ka;case"time":return cM.parse(u,p.parseComponentValue())}break}},xU="data-html2canvas-debug",vU=function(u){var e=u.getAttribute(xU);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},bb=function(u,e){var t=vU(u);return t===1||e===t},Zu=function(){function u(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,bb(t,3))debugger;this.styles=new _U(e,window.getComputedStyle(t,null)),Eb(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Tv(this.context,t),bb(t,4)&&(this.flags|=16)}return u}(),wU="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",cE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",__=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var G0=0;G0<cE.length;G0++)__[cE.charCodeAt(G0)]=G0;var bU=function(u){var e=u.length*.75,t=u.length,r,c=0,p,y,i,C;u[u.length-1]==="="&&(e--,u[u.length-2]==="="&&e--);var D=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),R=Array.isArray(D)?D:new Uint8Array(D);for(r=0;r<t;r+=4)p=__[u.charCodeAt(r)],y=__[u.charCodeAt(r+1)],i=__[u.charCodeAt(r+2)],C=__[u.charCodeAt(r+3)],R[c++]=p<<2|y>>4,R[c++]=(y&15)<<4|i>>2,R[c++]=(i&3)<<6|C&63;return D},BU=function(u){for(var e=u.length,t=[],r=0;r<e;r+=2)t.push(u[r+1]<<8|u[r]);return t},CU=function(u){for(var e=u.length,t=[],r=0;r<e;r+=4)t.push(u[r+3]<<24|u[r+2]<<16|u[r+1]<<8|u[r]);return t},cf=5,T2=6+5,ow=2,EU=T2-cf,hM=65536>>cf,TU=1<<cf,aw=TU-1,SU=1024>>cf,MU=hM+SU,IU=MU,FU=32,LU=IU+FU,DU=65536>>T2,PU=1<<EU,UU=PU-1,hE=function(u,e,t){return u.slice?u.slice(e,t):new Uint16Array(Array.prototype.slice.call(u,e,t))},RU=function(u,e,t){return u.slice?u.slice(e,t):new Uint32Array(Array.prototype.slice.call(u,e,t))},zU=function(u,e){var t=bU(u),r=Array.isArray(t)?CU(t):new Uint32Array(t),c=Array.isArray(t)?BU(t):new Uint16Array(t),p=24,y=hE(c,p/2,r[4]/2),i=r[5]===2?hE(c,(p+r[4])/2):RU(r,Math.ceil((p+r[4])/4));return new kU(r[0],r[1],r[2],r[3],y,i)},kU=function(){function u(e,t,r,c,p,y){this.initialValue=e,this.errorValue=t,this.highStart=r,this.highValueIndex=c,this.index=p,this.data=y}return u.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>cf],t=(t<<ow)+(e&aw),this.data[t];if(e<=65535)return t=this.index[hM+(e-55296>>cf)],t=(t<<ow)+(e&aw),this.data[t];if(e<this.highStart)return t=LU-DU+(e>>T2),t=this.index[t],t+=e>>cf&UU,t=this.index[t],t=(t<<ow)+(e&aw),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},u}(),uE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",OU=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var W0=0;W0<uE.length;W0++)OU[uE.charCodeAt(W0)]=W0;var NU=1,lw=2,cw=3,AE=4,dE=5,QU=7,pE=8,hw=9,uw=10,fE=11,mE=12,gE=13,_E=14,Aw=15,VU=function(u){for(var e=[],t=0,r=u.length;t<r;){var c=u.charCodeAt(t++);if(c>=55296&&c<=56319&&t<r){var p=u.charCodeAt(t++);(p&64512)===56320?e.push(((c&1023)<<10)+(p&1023)+65536):(e.push(c),t--)}else e.push(c)}return e},HU=function(){for(var u=[],e=0;e<arguments.length;e++)u[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,u);var t=u.length;if(!t)return"";for(var r=[],c=-1,p="";++c<t;){var y=u[c];y<=65535?r.push(y):(y-=65536,r.push((y>>10)+55296,y%1024+56320)),(c+1===t||r.length>16384)&&(p+=String.fromCharCode.apply(String,r),r.length=0)}return p},GU=zU(wU),yh="\xD7",dw="\xF7",WU=function(u){return GU.get(u)},jU=function(u,e,t){var r=t-2,c=e[r],p=e[t-1],y=e[t];if(p===lw&&y===cw)return yh;if(p===lw||p===cw||p===AE||y===lw||y===cw||y===AE)return dw;if(p===pE&&[pE,hw,fE,mE].indexOf(y)!==-1||(p===fE||p===hw)&&(y===hw||y===uw)||(p===mE||p===uw)&&y===uw||y===gE||y===dE||y===QU||p===NU)return yh;if(p===gE&&y===_E){for(;c===dE;)c=e[--r];if(c===_E)return yh}if(p===Aw&&y===Aw){for(var i=0;c===Aw;)i++,c=e[--r];if(i%2===0)return yh}return dw},KU=function(u){var e=VU(u),t=e.length,r=0,c=0,p=e.map(WU);return{next:function(){if(r>=t)return{done:!0,value:null};for(var y=yh;r<t&&(y=jU(e,p,++r))===yh;);if(y!==yh||r===t){var i=HU.apply(null,e.slice(c,r));return c=r,{value:i,done:!1}}return{done:!0,value:null}}}},$U=function(u){for(var e=KU(u),t=[],r;!(r=e.next()).done;)r.value&&t.push(r.value.slice());return t},ZU=function(u){var e=123;if(u.createRange){var t=u.createRange();if(t.getBoundingClientRect){var r=u.createElement("boundtest");r.style.height=e+"px",r.style.display="block",u.body.appendChild(r),t.selectNode(r);var c=t.getBoundingClientRect(),p=Math.round(c.height);if(u.body.removeChild(r),p===e)return!0}}return!1},XU=function(u){var e=u.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",u.body.appendChild(e);var t=u.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var r=e.firstChild,c=Sv(r.data).map(function(C){return Bo(C)}),p=0,y={},i=c.every(function(C,D){t.setStart(r,p),t.setEnd(r,p+C.length);var R=t.getBoundingClientRect();p+=C.length;var Q=R.x>y.x||R.y>y.y;return y=R,D===0?!0:Q});return u.body.removeChild(e),i},qU=function(){return typeof new Image().crossOrigin<"u"},YU=function(){return typeof new XMLHttpRequest().responseType=="string"},JU=function(u){var e=new Image,t=u.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},yE=function(u){return u[0]===0&&u[1]===255&&u[2]===0&&u[3]===255},e4=function(u){var e=u.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var c=new Image,p=e.toDataURL();c.src=p;var y=Bb(t,t,0,0,c);return r.fillStyle="red",r.fillRect(0,0,t,t),xE(y).then(function(i){r.drawImage(i,0,0);var C=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var D=u.createElement("div");return D.style.backgroundImage="url("+p+")",D.style.height=t+"px",yE(C)?xE(Bb(t,t,0,0,D)):Promise.reject(!1)}).then(function(i){return r.drawImage(i,0,0),yE(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Bb=function(u,e,t,r,c){var p="http://www.w3.org/2000/svg",y=document.createElementNS(p,"svg"),i=document.createElementNS(p,"foreignObject");return y.setAttributeNS(null,"width",u.toString()),y.setAttributeNS(null,"height",e.toString()),i.setAttributeNS(null,"width","100%"),i.setAttributeNS(null,"height","100%"),i.setAttributeNS(null,"x",t.toString()),i.setAttributeNS(null,"y",r.toString()),i.setAttributeNS(null,"externalResourcesRequired","true"),y.appendChild(i),i.appendChild(c),y},xE=function(u){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(u))})},Ra={get SUPPORT_RANGE_BOUNDS(){var u=ZU(document);return Object.defineProperty(Ra,"SUPPORT_RANGE_BOUNDS",{value:u}),u},get SUPPORT_WORD_BREAKING(){var u=Ra.SUPPORT_RANGE_BOUNDS&&XU(document);return Object.defineProperty(Ra,"SUPPORT_WORD_BREAKING",{value:u}),u},get SUPPORT_SVG_DRAWING(){var u=JU(document);return Object.defineProperty(Ra,"SUPPORT_SVG_DRAWING",{value:u}),u},get SUPPORT_FOREIGNOBJECT_DRAWING(){var u=typeof Array.from=="function"&&typeof window.fetch=="function"?e4(document):Promise.resolve(!1);return Object.defineProperty(Ra,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:u}),u},get SUPPORT_CORS_IMAGES(){var u=qU();return Object.defineProperty(Ra,"SUPPORT_CORS_IMAGES",{value:u}),u},get SUPPORT_RESPONSE_TYPE(){var u=YU();return Object.defineProperty(Ra,"SUPPORT_RESPONSE_TYPE",{value:u}),u},get SUPPORT_CORS_XHR(){var u="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ra,"SUPPORT_CORS_XHR",{value:u}),u},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var u=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ra,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:u}),u}},C_=function(){function u(e,t){this.text=e,this.bounds=t}return u}(),t4=function(u,e,t,r){var c=r4(e,t),p=[],y=0;return c.forEach(function(i){if(t.textDecorationLine.length||i.trim().length>0)if(Ra.SUPPORT_RANGE_BOUNDS){var C=vE(r,y,i.length).getClientRects();if(C.length>1){var D=S2(i),R=0;D.forEach(function(z){p.push(new C_(z,$A.fromDOMRectList(u,vE(r,R+y,z.length).getClientRects()))),R+=z.length})}else p.push(new C_(i,$A.fromDOMRectList(u,C)))}else{var Q=r.splitText(i.length);p.push(new C_(i,i4(u,r))),r=Q}else Ra.SUPPORT_RANGE_BOUNDS||(r=r.splitText(i.length));y+=i.length}),p},i4=function(u,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var c=e.parentNode;if(c){c.replaceChild(r,e);var p=Tv(u,r);return r.firstChild&&c.replaceChild(r.firstChild,r),p}}return $A.EMPTY},vE=function(u,e,t){var r=u.ownerDocument;if(!r)throw new Error("Node has no owner document");var c=r.createRange();return c.setStart(u,e),c.setEnd(u,e+t),c},S2=function(u){if(Ra.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(u)).map(function(t){return t.segment})}return $U(u)},n4=function(u,e){if(Ra.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(u)).map(function(r){return r.segment})}return o4(u,e)},r4=function(u,e){return e.letterSpacing!==0?S2(u):n4(u,e)},s4=[32,160,4961,65792,65793,4153,4241],o4=function(u,e){for(var t=DL(u,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],c,p=function(){if(c.value){var y=c.value.slice(),i=Sv(y),C="";i.forEach(function(D){s4.indexOf(D)===-1?C+=Bo(D):(C.length&&r.push(C),r.push(Bo(D)),C="")}),C.length&&r.push(C)}};!(c=t.next()).done;)p();return r},a4=function(){function u(e,t,r){this.text=l4(t.data,r.textTransform),this.textBounds=t4(e,this.text,r,t)}return u}(),l4=function(u,e){switch(e){case 1:return u.toLowerCase();case 3:return u.replace(c4,h4);case 2:return u.toUpperCase();default:return u}},c4=/(^|\s|:|-|\(|\))([a-z])/g,h4=function(u,e,t){return u.length>0?e+t.toUpperCase():u},uM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.src=r.currentSrc||r.src,c.intrinsicWidth=r.naturalWidth,c.intrinsicHeight=r.naturalHeight,c.context.cache.addImage(c.src),c}return e}(Zu),AM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.canvas=r,c.intrinsicWidth=r.width,c.intrinsicHeight=r.height,c}return e}(Zu),dM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this,p=new XMLSerializer,y=Tv(t,r);return r.setAttribute("width",y.width+"px"),r.setAttribute("height",y.height+"px"),c.svg="data:image/svg+xml,"+encodeURIComponent(p.serializeToString(r)),c.intrinsicWidth=r.width.baseVal.value,c.intrinsicHeight=r.height.baseVal.value,c.context.cache.addImage(c.svg),c}return e}(Zu),pM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.value=r.value,c}return e}(Zu),Cb=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.start=r.start,c.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,c}return e}(Zu),u4=[{type:15,flags:0,unit:"px",number:3}],A4=[{type:16,flags:0,number:50}],d4=function(u){return u.width>u.height?new $A(u.left+(u.width-u.height)/2,u.top,u.height,u.height):u.width<u.height?new $A(u.left,u.top+(u.height-u.width)/2,u.width,u.width):u},p4=function(u){var e=u.type===f4?new Array(u.value.length+1).join("\u2022"):u.value;return e.length===0?u.placeholder||"":e},nv="checkbox",rv="radio",f4="password",wE=707406591,M2=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;switch(c.type=r.type.toLowerCase(),c.checked=r.checked,c.value=p4(r),(c.type===nv||c.type===rv)&&(c.styles.backgroundColor=3739148031,c.styles.borderTopColor=c.styles.borderRightColor=c.styles.borderBottomColor=c.styles.borderLeftColor=2779096575,c.styles.borderTopWidth=c.styles.borderRightWidth=c.styles.borderBottomWidth=c.styles.borderLeftWidth=1,c.styles.borderTopStyle=c.styles.borderRightStyle=c.styles.borderBottomStyle=c.styles.borderLeftStyle=1,c.styles.backgroundClip=[0],c.styles.backgroundOrigin=[0],c.bounds=d4(c.bounds)),c.type){case nv:c.styles.borderTopRightRadius=c.styles.borderTopLeftRadius=c.styles.borderBottomRightRadius=c.styles.borderBottomLeftRadius=u4;break;case rv:c.styles.borderTopRightRadius=c.styles.borderTopLeftRadius=c.styles.borderBottomRightRadius=c.styles.borderBottomLeftRadius=A4;break}return c}return e}(Zu),fM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this,p=r.options[r.selectedIndex||0];return c.value=p&&p.text||"",c}return e}(Zu),mM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.value=r.value,c}return e}(Zu),gM=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;c.src=r.src,c.width=parseInt(r.width,10)||0,c.height=parseInt(r.height,10)||0,c.backgroundColor=c.styles.backgroundColor;try{if(r.contentWindow&&r.contentWindow.document&&r.contentWindow.document.documentElement){c.tree=yM(t,r.contentWindow.document.documentElement);var p=r.contentWindow.document.documentElement?b_(t,getComputedStyle(r.contentWindow.document.documentElement).backgroundColor):jA.TRANSPARENT,y=r.contentWindow.document.body?b_(t,getComputedStyle(r.contentWindow.document.body).backgroundColor):jA.TRANSPARENT;c.backgroundColor=Jd(p)?Jd(y)?c.styles.backgroundColor:y:p}}catch{}return c}return e}(Zu),m4=["OL","UL","MENU"],Vx=function(u,e,t,r){for(var c=e.firstChild,p=void 0;c;c=p)if(p=c.nextSibling,xM(c)&&c.data.trim().length>0)t.textNodes.push(new a4(u,c,t.styles));else if(Fm(c))if(BM(c)&&c.assignedNodes)c.assignedNodes().forEach(function(i){return Vx(u,i,t,r)});else{var y=_M(u,c);y.styles.isVisible()&&(g4(c,y,r)?y.flags|=4:_4(y.styles)&&(y.flags|=2),m4.indexOf(c.tagName)!==-1&&(y.flags|=8),t.elements.push(y),c.slot,c.shadowRoot?Vx(u,c.shadowRoot,y,r):!sv(c)&&!vM(c)&&!ov(c)&&Vx(u,c,y,r))}},_M=function(u,e){return Tb(e)?new uM(u,e):wM(e)?new AM(u,e):vM(e)?new dM(u,e):y4(e)?new pM(u,e):x4(e)?new Cb(u,e):v4(e)?new M2(u,e):ov(e)?new fM(u,e):sv(e)?new mM(u,e):bM(e)?new gM(u,e):new Zu(u,e)},yM=function(u,e){var t=_M(u,e);return t.flags|=4,Vx(u,e,t,t),t},g4=function(u,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||I2(u)&&t.styles.isTransparent()},_4=function(u){return u.isPositioned()||u.isFloating()},xM=function(u){return u.nodeType===Node.TEXT_NODE},Fm=function(u){return u.nodeType===Node.ELEMENT_NODE},Eb=function(u){return Fm(u)&&typeof u.style<"u"&&!Hx(u)},Hx=function(u){return typeof u.className=="object"},y4=function(u){return u.tagName==="LI"},x4=function(u){return u.tagName==="OL"},v4=function(u){return u.tagName==="INPUT"},w4=function(u){return u.tagName==="HTML"},vM=function(u){return u.tagName==="svg"},I2=function(u){return u.tagName==="BODY"},wM=function(u){return u.tagName==="CANVAS"},bE=function(u){return u.tagName==="VIDEO"},Tb=function(u){return u.tagName==="IMG"},bM=function(u){return u.tagName==="IFRAME"},BE=function(u){return u.tagName==="STYLE"},b4=function(u){return u.tagName==="SCRIPT"},sv=function(u){return u.tagName==="TEXTAREA"},ov=function(u){return u.tagName==="SELECT"},BM=function(u){return u.tagName==="SLOT"},CE=function(u){return u.tagName.indexOf("-")>0},B4=function(){function u(){this.counters={}}return u.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},u.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},u.prototype.pop=function(e){var t=this;e.forEach(function(r){return t.counters[r].pop()})},u.prototype.parse=function(e){var t=this,r=e.counterIncrement,c=e.counterReset,p=!0;r!==null&&r.forEach(function(i){var C=t.counters[i.counter];C&&i.increment!==0&&(p=!1,C.length||C.push(1),C[Math.max(0,C.length-1)]+=i.increment)});var y=[];return p&&c.forEach(function(i){var C=t.counters[i.counter];y.push(i.counter),C||(C=t.counters[i.counter]=[]),C.push(i.reset)}),y},u}(),EE={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},TE={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},C4={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},E4={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},sm=function(u,e,t,r,c,p){return u<e||u>t?z_(u,c,p.length>0):r.integers.reduce(function(y,i,C){for(;u>=i;)u-=i,y+=r.values[C];return y},"")+p},CM=function(u,e,t,r){var c="";do t||u--,c=r(u)+c,u/=e;while(u*e>=e);return c},wo=function(u,e,t,r,c){var p=t-e+1;return(u<0?"-":"")+(CM(Math.abs(u),p,r,function(y){return Bo(Math.floor(y%p)+e)})+c)},zp=function(u,e,t){t===void 0&&(t=". ");var r=e.length;return CM(Math.abs(u),r,!1,function(c){return e[Math.floor(c%r)]})+t},Sm=1<<0,Hd=1<<1,Gd=1<<2,y_=1<<3,UA=function(u,e,t,r,c,p){if(u<-9999||u>9999)return z_(u,4,c.length>0);var y=Math.abs(u),i=c;if(y===0)return e[0]+i;for(var C=0;y>0&&C<=4;C++){var D=y%10;D===0&&na(p,Sm)&&i!==""?i=e[D]+i:D>1||D===1&&C===0||D===1&&C===1&&na(p,Hd)||D===1&&C===1&&na(p,Gd)&&u>100||D===1&&C>1&&na(p,y_)?i=e[D]+(C>0?t[C-1]:"")+i:D===1&&C>0&&(i=t[C-1]+i),y=Math.floor(y/10)}return(u<0?r:"")+i},SE="\u5341\u767E\u5343\u842C",ME="\u62FE\u4F70\u4EDF\u842C",IE="\u30DE\u30A4\u30CA\u30B9",pw="\uB9C8\uC774\uB108\uC2A4",z_=function(u,e,t){var r=t?". ":"",c=t?"\u3001":"",p=t?", ":"",y=t?" ":"";switch(e){case 0:return"\u2022"+y;case 1:return"\u25E6"+y;case 2:return"\u25FE"+y;case 5:var i=wo(u,48,57,!0,r);return i.length<4?"0"+i:i;case 4:return zp(u,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",c);case 6:return sm(u,1,3999,EE,3,r).toLowerCase();case 7:return sm(u,1,3999,EE,3,r);case 8:return wo(u,945,969,!1,r);case 9:return wo(u,97,122,!1,r);case 10:return wo(u,65,90,!1,r);case 11:return wo(u,1632,1641,!0,r);case 12:case 49:return sm(u,1,9999,TE,3,r);case 35:return sm(u,1,9999,TE,3,r).toLowerCase();case 13:return wo(u,2534,2543,!0,r);case 14:case 30:return wo(u,6112,6121,!0,r);case 15:return zp(u,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",c);case 16:return zp(u,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",c);case 17:case 48:return UA(u,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",SE,"\u8CA0",c,Hd|Gd|y_);case 47:return UA(u,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",ME,"\u8CA0",c,Sm|Hd|Gd|y_);case 42:return UA(u,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",SE,"\u8D1F",c,Hd|Gd|y_);case 41:return UA(u,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",ME,"\u8D1F",c,Sm|Hd|Gd|y_);case 26:return UA(u,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",IE,c,0);case 25:return UA(u,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",IE,c,Sm|Hd|Gd);case 31:return UA(u,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",pw,p,Sm|Hd|Gd);case 33:return UA(u,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",pw,p,0);case 32:return UA(u,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",pw,p,Sm|Hd|Gd);case 18:return wo(u,2406,2415,!0,r);case 20:return sm(u,1,19999,E4,3,r);case 21:return wo(u,2790,2799,!0,r);case 22:return wo(u,2662,2671,!0,r);case 22:return sm(u,1,10999,C4,3,r);case 23:return zp(u,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return zp(u,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return wo(u,3302,3311,!0,r);case 28:return zp(u,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",c);case 29:return zp(u,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",c);case 34:return wo(u,3792,3801,!0,r);case 37:return wo(u,6160,6169,!0,r);case 38:return wo(u,4160,4169,!0,r);case 39:return wo(u,2918,2927,!0,r);case 40:return wo(u,1776,1785,!0,r);case 43:return wo(u,3046,3055,!0,r);case 44:return wo(u,3174,3183,!0,r);case 45:return wo(u,3664,3673,!0,r);case 46:return wo(u,3872,3881,!0,r);case 3:default:return wo(u,48,57,!0,r)}},EM="data-html2canvas-ignore",FE=function(){function u(e,t,r){if(this.context=e,this.options=r,this.scrolledElements=[],this.referenceElement=t,this.counters=new B4,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return u.prototype.toIFrame=function(e,t){var r=this,c=T4(e,t);if(!c.contentWindow)return Promise.reject("Unable to find iframe window");var p=e.defaultView.pageXOffset,y=e.defaultView.pageYOffset,i=c.contentWindow,C=i.document,D=I4(c).then(function(){return Il(r,void 0,void 0,function(){var R,Q;return tl(this,function(z){switch(z.label){case 0:return this.scrolledElements.forEach(P4),i&&(i.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(i.scrollY!==t.top||i.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(i.scrollX-t.left,i.scrollY-t.top,0,0))),R=this.options.onclone,Q=this.clonedReferenceElement,typeof Q>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:C.fonts&&C.fonts.ready?[4,C.fonts.ready]:[3,2];case 1:z.sent(),z.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,M4(C)]:[3,4];case 3:z.sent(),z.label=4;case 4:return typeof R=="function"?[2,Promise.resolve().then(function(){return R(C,Q)}).then(function(){return c})]:[2,c]}})})});return C.open(),C.write(L4(document.doctype)+"<html></html>"),D4(this.referenceElement.ownerDocument,p,y),C.replaceChild(C.adoptNode(this.documentElement),C.documentElement),C.close(),D},u.prototype.createElementClone=function(e){if(bb(e,2))debugger;if(wM(e))return this.createCanvasClone(e);if(bE(e))return this.createVideoClone(e);if(BE(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Tb(t)&&(Tb(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),CE(t)?this.createCustomElementClone(t):t},u.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return fw(e.style,t),t},u.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var r=[].slice.call(t.cssRules,0).reduce(function(p,y){return y&&typeof y.cssText=="string"?p+y.cssText:p},""),c=e.cloneNode(!1);return c.textContent=r,c}}catch(p){if(this.context.logger.error("Unable to access cssRules property",p),p.name!=="SecurityError")throw p}return e.cloneNode(!1)},u.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var r=e.ownerDocument.createElement("img");try{return r.src=e.toDataURL(),r}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var c=e.cloneNode(!1);try{c.width=e.width,c.height=e.height;var p=e.getContext("2d"),y=c.getContext("2d");if(y)if(!this.options.allowTaint&&p)y.putImageData(p.getImageData(0,0,e.width,e.height),0,0);else{var i=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(i){var C=i.getContextAttributes();(C==null?void 0:C.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}y.drawImage(e,0,0)}return c}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return c},u.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var r=t.getContext("2d");try{return r&&(r.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||r.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var c=e.ownerDocument.createElement("canvas");return c.width=e.offsetWidth,c.height=e.offsetHeight,c},u.prototype.appendChildNode=function(e,t,r){(!Fm(t)||!b4(t)&&!t.hasAttribute(EM)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Fm(t)||!BE(t))&&e.appendChild(this.cloneNode(t,r))},u.prototype.cloneChildNodes=function(e,t,r){for(var c=this,p=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;p;p=p.nextSibling)if(Fm(p)&&BM(p)&&typeof p.assignedNodes=="function"){var y=p.assignedNodes();y.length&&y.forEach(function(i){return c.appendChildNode(t,i,r)})}else this.appendChildNode(t,p,r)},u.prototype.cloneNode=function(e,t){if(xM(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var r=e.ownerDocument.defaultView;if(r&&Fm(e)&&(Eb(e)||Hx(e))){var c=this.createElementClone(e);c.style.transitionProperty="none";var p=r.getComputedStyle(e),y=r.getComputedStyle(e,":before"),i=r.getComputedStyle(e,":after");this.referenceElement===e&&Eb(c)&&(this.clonedReferenceElement=c),I2(c)&&z4(c);var C=this.counters.parse(new lE(this.context,p)),D=this.resolvePseudoContent(e,c,y,E_.BEFORE);CE(e)&&(t=!0),bE(e)||this.cloneChildNodes(e,c,t),D&&c.insertBefore(D,c.firstChild);var R=this.resolvePseudoContent(e,c,i,E_.AFTER);return R&&c.appendChild(R),this.counters.pop(C),(p&&(this.options.copyStyles||Hx(e))&&!bM(e)||t)&&fw(p,c),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([c,e.scrollLeft,e.scrollTop]),(sv(e)||ov(e))&&(sv(c)||ov(c))&&(c.value=e.value),c}return e.cloneNode(!1)},u.prototype.resolvePseudoContent=function(e,t,r,c){var p=this;if(!!r){var y=r.content,i=t.ownerDocument;if(!(!i||!y||y==="none"||y==="-moz-alt-content"||r.display==="none")){this.counters.parse(new lE(this.context,r));var C=new yU(this.context,r),D=i.createElement("html2canvaspseudoelement");fw(r,D),C.content.forEach(function(Q){if(Q.type===0)D.appendChild(i.createTextNode(Q.value));else if(Q.type===22){var z=i.createElement("img");z.src=Q.value,z.style.opacity="1",D.appendChild(z)}else if(Q.type===18){if(Q.name==="attr"){var G=Q.values.filter(Ss);G.length&&D.appendChild(i.createTextNode(e.getAttribute(G[0].value)||""))}else if(Q.name==="counter"){var J=Q.values.filter(Hm),Y=J[0],B=J[1];if(Y&&Ss(Y)){var ae=p.counters.getCounterValue(Y.value),ce=B&&Ss(B)?wb.parse(p.context,B.value):3;D.appendChild(i.createTextNode(z_(ae,ce,!1)))}}else if(Q.name==="counters"){var Ae=Q.values.filter(Hm),Y=Ae[0],we=Ae[1],B=Ae[2];if(Y&&Ss(Y)){var me=p.counters.getCounterValues(Y.value),De=B&&Ss(B)?wb.parse(p.context,B.value):3,Je=we&&we.type===0?we.value:"",Fe=me.map(function(li){return z_(li,De,!1)}).join(Je);D.appendChild(i.createTextNode(Fe))}}}else if(Q.type===20)switch(Q.value){case"open-quote":D.appendChild(i.createTextNode(aE(C.quotes,p.quoteDepth++,!0)));break;case"close-quote":D.appendChild(i.createTextNode(aE(C.quotes,--p.quoteDepth,!1)));break;default:D.appendChild(i.createTextNode(Q.value))}}),D.className=Sb+" "+Mb;var R=c===E_.BEFORE?" "+Sb:" "+Mb;return Hx(t)?t.className.baseValue+=R:t.className+=R,D}}},u.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},u}(),E_;(function(u){u[u.BEFORE=0]="BEFORE",u[u.AFTER=1]="AFTER"})(E_||(E_={}));var T4=function(u,e){var t=u.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(EM,"true"),u.body.appendChild(t),t},S4=function(u){return new Promise(function(e){if(u.complete){e();return}if(!u.src){e();return}u.onload=e,u.onerror=e})},M4=function(u){return Promise.all([].slice.call(u.images,0).map(S4))},I4=function(u){return new Promise(function(e,t){var r=u.contentWindow;if(!r)return t("No window assigned for iframe");var c=r.document;r.onload=u.onload=function(){r.onload=u.onload=null;var p=setInterval(function(){c.body.childNodes.length>0&&c.readyState==="complete"&&(clearInterval(p),e(u))},50)}})},F4=["all","d","content"],fw=function(u,e){for(var t=u.length-1;t>=0;t--){var r=u.item(t);F4.indexOf(r)===-1&&e.style.setProperty(r,u.getPropertyValue(r))}return e},L4=function(u){var e="";return u&&(e+="<!DOCTYPE ",u.name&&(e+=u.name),u.internalSubset&&(e+=u.internalSubset),u.publicId&&(e+='"'+u.publicId+'"'),u.systemId&&(e+='"'+u.systemId+'"'),e+=">"),e},D4=function(u,e,t){u&&u.defaultView&&(e!==u.defaultView.pageXOffset||t!==u.defaultView.pageYOffset)&&u.defaultView.scrollTo(e,t)},P4=function(u){var e=u[0],t=u[1],r=u[2];e.scrollLeft=t,e.scrollTop=r},U4=":before",R4=":after",Sb="___html2canvas___pseudoelement_before",Mb="___html2canvas___pseudoelement_after",LE=`{
  17. content: "" !important;
  18. display: none !important;
  19. }`,z4=function(u){k4(u,"."+Sb+U4+LE+`
  20. .`+Mb+R4+LE)},k4=function(u,e){var t=u.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,u.appendChild(r)}},TM=function(){function u(){}return u.getOrigin=function(e){var t=u._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},u.isSameOrigin=function(e){return u.getOrigin(e)===u._origin},u.setContext=function(e){u._link=e.document.createElement("a"),u._origin=u.getOrigin(e.location.href)},u._origin="about:blank",u}(),O4=function(){function u(e,t){this.context=e,this._options=t,this._cache={}}return u.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(gw(e)||H4(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},u.prototype.match=function(e){return this._cache[e]},u.prototype.loadImage=function(e){return Il(this,void 0,void 0,function(){var t,r,c,p,y=this;return tl(this,function(i){switch(i.label){case 0:return t=TM.isSameOrigin(e),r=!mw(e)&&this._options.useCORS===!0&&Ra.SUPPORT_CORS_IMAGES&&!t,c=!mw(e)&&!t&&!gw(e)&&typeof this._options.proxy=="string"&&Ra.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!mw(e)&&!gw(e)&&!c&&!r?[2]:(p=e,c?[4,this.proxy(p)]:[3,2]);case 1:p=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(C,D){var R=new Image;R.onload=function(){return C(R)},R.onerror=D,(G4(p)||r)&&(R.crossOrigin="anonymous"),R.src=p,R.complete===!0&&setTimeout(function(){return C(R)},500),y._options.imageTimeout>0&&setTimeout(function(){return D("Timed out ("+y._options.imageTimeout+"ms) loading image")},y._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},u.prototype.has=function(e){return typeof this._cache[e]<"u"},u.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},u.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var c=e.substring(0,256);return new Promise(function(p,y){var i=Ra.SUPPORT_RESPONSE_TYPE?"blob":"text",C=new XMLHttpRequest;C.onload=function(){if(C.status===200)if(i==="text")p(C.response);else{var Q=new FileReader;Q.addEventListener("load",function(){return p(Q.result)},!1),Q.addEventListener("error",function(z){return y(z)},!1),Q.readAsDataURL(C.response)}else y("Failed to proxy resource "+c+" with status code "+C.status)},C.onerror=y;var D=r.indexOf("?")>-1?"&":"?";if(C.open("GET",""+r+D+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&C instanceof XMLHttpRequest&&(C.responseType=i),t._options.imageTimeout){var R=t._options.imageTimeout;C.timeout=R,C.ontimeout=function(){return y("Timed out ("+R+"ms) proxying "+c)}}C.send()})},u}(),N4=/^data:image\/svg\+xml/i,Q4=/^data:image\/.*;base64,/i,V4=/^data:image\/.*/i,H4=function(u){return Ra.SUPPORT_SVG_DRAWING||!W4(u)},mw=function(u){return V4.test(u)},G4=function(u){return Q4.test(u)},gw=function(u){return u.substr(0,4)==="blob"},W4=function(u){return u.substr(-3).toLowerCase()==="svg"||N4.test(u)},Rn=function(){function u(e,t){this.type=0,this.x=e,this.y=t}return u.prototype.add=function(e,t){return new u(this.x+e,this.y+t)},u}(),om=function(u,e,t){return new Rn(u.x+(e.x-u.x)*t,u.y+(e.y-u.y)*t)},j0=function(){function u(e,t,r,c){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=c}return u.prototype.subdivide=function(e,t){var r=om(this.start,this.startControl,e),c=om(this.startControl,this.endControl,e),p=om(this.endControl,this.end,e),y=om(r,c,e),i=om(c,p,e),C=om(y,i,e);return t?new u(this.start,r,y,C):new u(C,i,p,this.end)},u.prototype.add=function(e,t){return new u(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},u.prototype.reverse=function(){return new u(this.end,this.endControl,this.startControl,this.start)},u}(),vh=function(u){return u.type===1},j4=function(){function u(e){var t=e.styles,r=e.bounds,c=g_(t.borderTopLeftRadius,r.width,r.height),p=c[0],y=c[1],i=g_(t.borderTopRightRadius,r.width,r.height),C=i[0],D=i[1],R=g_(t.borderBottomRightRadius,r.width,r.height),Q=R[0],z=R[1],G=g_(t.borderBottomLeftRadius,r.width,r.height),J=G[0],Y=G[1],B=[];B.push((p+C)/r.width),B.push((J+Q)/r.width),B.push((y+Y)/r.height),B.push((D+z)/r.height);var ae=Math.max.apply(Math,B);ae>1&&(p/=ae,y/=ae,C/=ae,D/=ae,Q/=ae,z/=ae,J/=ae,Y/=ae);var ce=r.width-C,Ae=r.height-z,we=r.width-Q,me=r.height-Y,De=t.borderTopWidth,Je=t.borderRightWidth,Fe=t.borderBottomWidth,Ge=t.borderLeftWidth,Et=Gs(t.paddingTop,e.bounds.width),li=Gs(t.paddingRight,e.bounds.width),xi=Gs(t.paddingBottom,e.bounds.width),te=Gs(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=p>0||y>0?ro(r.left+Ge/3,r.top+De/3,p-Ge/3,y-De/3,ys.TOP_LEFT):new Rn(r.left+Ge/3,r.top+De/3),this.topRightBorderDoubleOuterBox=p>0||y>0?ro(r.left+ce,r.top+De/3,C-Je/3,D-De/3,ys.TOP_RIGHT):new Rn(r.left+r.width-Je/3,r.top+De/3),this.bottomRightBorderDoubleOuterBox=Q>0||z>0?ro(r.left+we,r.top+Ae,Q-Je/3,z-Fe/3,ys.BOTTOM_RIGHT):new Rn(r.left+r.width-Je/3,r.top+r.height-Fe/3),this.bottomLeftBorderDoubleOuterBox=J>0||Y>0?ro(r.left+Ge/3,r.top+me,J-Ge/3,Y-Fe/3,ys.BOTTOM_LEFT):new Rn(r.left+Ge/3,r.top+r.height-Fe/3),this.topLeftBorderDoubleInnerBox=p>0||y>0?ro(r.left+Ge*2/3,r.top+De*2/3,p-Ge*2/3,y-De*2/3,ys.TOP_LEFT):new Rn(r.left+Ge*2/3,r.top+De*2/3),this.topRightBorderDoubleInnerBox=p>0||y>0?ro(r.left+ce,r.top+De*2/3,C-Je*2/3,D-De*2/3,ys.TOP_RIGHT):new Rn(r.left+r.width-Je*2/3,r.top+De*2/3),this.bottomRightBorderDoubleInnerBox=Q>0||z>0?ro(r.left+we,r.top+Ae,Q-Je*2/3,z-Fe*2/3,ys.BOTTOM_RIGHT):new Rn(r.left+r.width-Je*2/3,r.top+r.height-Fe*2/3),this.bottomLeftBorderDoubleInnerBox=J>0||Y>0?ro(r.left+Ge*2/3,r.top+me,J-Ge*2/3,Y-Fe*2/3,ys.BOTTOM_LEFT):new Rn(r.left+Ge*2/3,r.top+r.height-Fe*2/3),this.topLeftBorderStroke=p>0||y>0?ro(r.left+Ge/2,r.top+De/2,p-Ge/2,y-De/2,ys.TOP_LEFT):new Rn(r.left+Ge/2,r.top+De/2),this.topRightBorderStroke=p>0||y>0?ro(r.left+ce,r.top+De/2,C-Je/2,D-De/2,ys.TOP_RIGHT):new Rn(r.left+r.width-Je/2,r.top+De/2),this.bottomRightBorderStroke=Q>0||z>0?ro(r.left+we,r.top+Ae,Q-Je/2,z-Fe/2,ys.BOTTOM_RIGHT):new Rn(r.left+r.width-Je/2,r.top+r.height-Fe/2),this.bottomLeftBorderStroke=J>0||Y>0?ro(r.left+Ge/2,r.top+me,J-Ge/2,Y-Fe/2,ys.BOTTOM_LEFT):new Rn(r.left+Ge/2,r.top+r.height-Fe/2),this.topLeftBorderBox=p>0||y>0?ro(r.left,r.top,p,y,ys.TOP_LEFT):new Rn(r.left,r.top),this.topRightBorderBox=C>0||D>0?ro(r.left+ce,r.top,C,D,ys.TOP_RIGHT):new Rn(r.left+r.width,r.top),this.bottomRightBorderBox=Q>0||z>0?ro(r.left+we,r.top+Ae,Q,z,ys.BOTTOM_RIGHT):new Rn(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=J>0||Y>0?ro(r.left,r.top+me,J,Y,ys.BOTTOM_LEFT):new Rn(r.left,r.top+r.height),this.topLeftPaddingBox=p>0||y>0?ro(r.left+Ge,r.top+De,Math.max(0,p-Ge),Math.max(0,y-De),ys.TOP_LEFT):new Rn(r.left+Ge,r.top+De),this.topRightPaddingBox=C>0||D>0?ro(r.left+Math.min(ce,r.width-Je),r.top+De,ce>r.width+Je?0:Math.max(0,C-Je),Math.max(0,D-De),ys.TOP_RIGHT):new Rn(r.left+r.width-Je,r.top+De),this.bottomRightPaddingBox=Q>0||z>0?ro(r.left+Math.min(we,r.width-Ge),r.top+Math.min(Ae,r.height-Fe),Math.max(0,Q-Je),Math.max(0,z-Fe),ys.BOTTOM_RIGHT):new Rn(r.left+r.width-Je,r.top+r.height-Fe),this.bottomLeftPaddingBox=J>0||Y>0?ro(r.left+Ge,r.top+Math.min(me,r.height-Fe),Math.max(0,J-Ge),Math.max(0,Y-Fe),ys.BOTTOM_LEFT):new Rn(r.left+Ge,r.top+r.height-Fe),this.topLeftContentBox=p>0||y>0?ro(r.left+Ge+te,r.top+De+Et,Math.max(0,p-(Ge+te)),Math.max(0,y-(De+Et)),ys.TOP_LEFT):new Rn(r.left+Ge+te,r.top+De+Et),this.topRightContentBox=C>0||D>0?ro(r.left+Math.min(ce,r.width+Ge+te),r.top+De+Et,ce>r.width+Ge+te?0:C-Ge+te,D-(De+Et),ys.TOP_RIGHT):new Rn(r.left+r.width-(Je+li),r.top+De+Et),this.bottomRightContentBox=Q>0||z>0?ro(r.left+Math.min(we,r.width-(Ge+te)),r.top+Math.min(Ae,r.height+De+Et),Math.max(0,Q-(Je+li)),z-(Fe+xi),ys.BOTTOM_RIGHT):new Rn(r.left+r.width-(Je+li),r.top+r.height-(Fe+xi)),this.bottomLeftContentBox=J>0||Y>0?ro(r.left+Ge+te,r.top+me,Math.max(0,J-(Ge+te)),Y-(Fe+xi),ys.BOTTOM_LEFT):new Rn(r.left+Ge+te,r.top+r.height-(Fe+xi))}return u}(),ys;(function(u){u[u.TOP_LEFT=0]="TOP_LEFT",u[u.TOP_RIGHT=1]="TOP_RIGHT",u[u.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",u[u.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ys||(ys={}));var ro=function(u,e,t,r,c){var p=4*((Math.sqrt(2)-1)/3),y=t*p,i=r*p,C=u+t,D=e+r;switch(c){case ys.TOP_LEFT:return new j0(new Rn(u,D),new Rn(u,D-i),new Rn(C-y,e),new Rn(C,e));case ys.TOP_RIGHT:return new j0(new Rn(u,e),new Rn(u+y,e),new Rn(C,D-i),new Rn(C,D));case ys.BOTTOM_RIGHT:return new j0(new Rn(C,e),new Rn(C,e+i),new Rn(u+y,D),new Rn(u,D));case ys.BOTTOM_LEFT:default:return new j0(new Rn(C,D),new Rn(C-y,D),new Rn(u,e+i),new Rn(u,e))}},av=function(u){return[u.topLeftBorderBox,u.topRightBorderBox,u.bottomRightBorderBox,u.bottomLeftBorderBox]},K4=function(u){return[u.topLeftContentBox,u.topRightContentBox,u.bottomRightContentBox,u.bottomLeftContentBox]},lv=function(u){return[u.topLeftPaddingBox,u.topRightPaddingBox,u.bottomRightPaddingBox,u.bottomLeftPaddingBox]},$4=function(){function u(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return u}(),K0=function(){function u(e,t){this.path=e,this.target=t,this.type=1}return u}(),Z4=function(){function u(e){this.opacity=e,this.type=2,this.target=6}return u}(),X4=function(u){return u.type===0},SM=function(u){return u.type===1},q4=function(u){return u.type===2},DE=function(u,e){return u.length===e.length?u.some(function(t,r){return t===e[r]}):!1},Y4=function(u,e,t,r,c){return u.map(function(p,y){switch(y){case 0:return p.add(e,t);case 1:return p.add(e+r,t);case 2:return p.add(e+r,t+c);case 3:return p.add(e,t+c)}return p})},MM=function(){function u(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return u}(),IM=function(){function u(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new j4(this.container),this.container.styles.opacity<1&&this.effects.push(new Z4(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,c=this.container.bounds.top+this.container.styles.transformOrigin[1].number,p=this.container.styles.transform;this.effects.push(new $4(r,c,p))}if(this.container.styles.overflowX!==0){var y=av(this.curves),i=lv(this.curves);DE(y,i)?this.effects.push(new K0(y,6)):(this.effects.push(new K0(y,2)),this.effects.push(new K0(i,4)))}}return u.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,c=this.effects.slice(0);r;){var p=r.effects.filter(function(C){return!SM(C)});if(t||r.container.styles.position!==0||!r.parent){if(c.unshift.apply(c,p),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var y=av(r.curves),i=lv(r.curves);DE(y,i)||c.unshift(new K0(i,6))}}else c.unshift.apply(c,p);r=r.parent}return c.filter(function(C){return na(C.target,e)})},u}(),Ib=function(u,e,t,r){u.container.elements.forEach(function(c){var p=na(c.flags,4),y=na(c.flags,2),i=new IM(c,u);na(c.styles.display,2048)&&r.push(i);var C=na(c.flags,8)?[]:r;if(p||y){var D=p||c.styles.isPositioned()?t:e,R=new MM(i);if(c.styles.isPositioned()||c.styles.opacity<1||c.styles.isTransformed()){var Q=c.styles.zIndex.order;if(Q<0){var z=0;D.negativeZIndex.some(function(J,Y){return Q>J.element.container.styles.zIndex.order?(z=Y,!1):z>0}),D.negativeZIndex.splice(z,0,R)}else if(Q>0){var G=0;D.positiveZIndex.some(function(J,Y){return Q>=J.element.container.styles.zIndex.order?(G=Y+1,!1):G>0}),D.positiveZIndex.splice(G,0,R)}else D.zeroOrAutoZIndexOrTransformedOrOpacity.push(R)}else c.styles.isFloating()?D.nonPositionedFloats.push(R):D.nonPositionedInlineLevel.push(R);Ib(i,R,p?R:t,C)}else c.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),Ib(i,e,t,C);na(c.flags,8)&&FM(c,C)})},FM=function(u,e){for(var t=u instanceof Cb?u.start:1,r=u instanceof Cb?u.reversed:!1,c=0;c<e.length;c++){var p=e[c];p.container instanceof pM&&typeof p.container.value=="number"&&p.container.value!==0&&(t=p.container.value),p.listValue=z_(t,p.container.styles.listStyleType,!0),t+=r?-1:1}},J4=function(u){var e=new IM(u,null),t=new MM(e),r=[];return Ib(e,t,t,r),FM(e.container,r),t},PE=function(u,e){switch(e){case 0:return Bh(u.topLeftBorderBox,u.topLeftPaddingBox,u.topRightBorderBox,u.topRightPaddingBox);case 1:return Bh(u.topRightBorderBox,u.topRightPaddingBox,u.bottomRightBorderBox,u.bottomRightPaddingBox);case 2:return Bh(u.bottomRightBorderBox,u.bottomRightPaddingBox,u.bottomLeftBorderBox,u.bottomLeftPaddingBox);case 3:default:return Bh(u.bottomLeftBorderBox,u.bottomLeftPaddingBox,u.topLeftBorderBox,u.topLeftPaddingBox)}},eR=function(u,e){switch(e){case 0:return Bh(u.topLeftBorderBox,u.topLeftBorderDoubleOuterBox,u.topRightBorderBox,u.topRightBorderDoubleOuterBox);case 1:return Bh(u.topRightBorderBox,u.topRightBorderDoubleOuterBox,u.bottomRightBorderBox,u.bottomRightBorderDoubleOuterBox);case 2:return Bh(u.bottomRightBorderBox,u.bottomRightBorderDoubleOuterBox,u.bottomLeftBorderBox,u.bottomLeftBorderDoubleOuterBox);case 3:default:return Bh(u.bottomLeftBorderBox,u.bottomLeftBorderDoubleOuterBox,u.topLeftBorderBox,u.topLeftBorderDoubleOuterBox)}},tR=function(u,e){switch(e){case 0:return Bh(u.topLeftBorderDoubleInnerBox,u.topLeftPaddingBox,u.topRightBorderDoubleInnerBox,u.topRightPaddingBox);case 1:return Bh(u.topRightBorderDoubleInnerBox,u.topRightPaddingBox,u.bottomRightBorderDoubleInnerBox,u.bottomRightPaddingBox);case 2:return Bh(u.bottomRightBorderDoubleInnerBox,u.bottomRightPaddingBox,u.bottomLeftBorderDoubleInnerBox,u.bottomLeftPaddingBox);case 3:default:return Bh(u.bottomLeftBorderDoubleInnerBox,u.bottomLeftPaddingBox,u.topLeftBorderDoubleInnerBox,u.topLeftPaddingBox)}},iR=function(u,e){switch(e){case 0:return $0(u.topLeftBorderStroke,u.topRightBorderStroke);case 1:return $0(u.topRightBorderStroke,u.bottomRightBorderStroke);case 2:return $0(u.bottomRightBorderStroke,u.bottomLeftBorderStroke);case 3:default:return $0(u.bottomLeftBorderStroke,u.topLeftBorderStroke)}},$0=function(u,e){var t=[];return vh(u)?t.push(u.subdivide(.5,!1)):t.push(u),vh(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},Bh=function(u,e,t,r){var c=[];return vh(u)?c.push(u.subdivide(.5,!1)):c.push(u),vh(t)?c.push(t.subdivide(.5,!0)):c.push(t),vh(r)?c.push(r.subdivide(.5,!0).reverse()):c.push(r),vh(e)?c.push(e.subdivide(.5,!1).reverse()):c.push(e),c},LM=function(u){var e=u.bounds,t=u.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},cv=function(u){var e=u.styles,t=u.bounds,r=Gs(e.paddingLeft,t.width),c=Gs(e.paddingRight,t.width),p=Gs(e.paddingTop,t.width),y=Gs(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,p+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+c),-(e.borderTopWidth+e.borderBottomWidth+p+y))},nR=function(u,e){return u===0?e.bounds:u===2?cv(e):LM(e)},rR=function(u,e){return u===0?e.bounds:u===2?cv(e):LM(e)},_w=function(u,e,t){var r=nR(Mm(u.styles.backgroundOrigin,e),u),c=rR(Mm(u.styles.backgroundClip,e),u),p=sR(Mm(u.styles.backgroundSize,e),t,r),y=p[0],i=p[1],C=g_(Mm(u.styles.backgroundPosition,e),r.width-y,r.height-i),D=oR(Mm(u.styles.backgroundRepeat,e),C,p,r,c),R=Math.round(r.left+C[0]),Q=Math.round(r.top+C[1]);return[D,R,Q,y,i]},am=function(u){return Ss(u)&&u.value===Om.AUTO},Z0=function(u){return typeof u=="number"},sR=function(u,e,t){var r=e[0],c=e[1],p=e[2],y=u[0],i=u[1];if(!y)return[0,0];if(zo(y)&&i&&zo(i))return[Gs(y,t.width),Gs(i,t.height)];var C=Z0(p);if(Ss(y)&&(y.value===Om.CONTAIN||y.value===Om.COVER)){if(Z0(p)){var D=t.width/t.height;return D<p!=(y.value===Om.COVER)?[t.width,t.width/p]:[t.height*p,t.height]}return[t.width,t.height]}var R=Z0(r),Q=Z0(c),z=R||Q;if(am(y)&&(!i||am(i))){if(R&&Q)return[r,c];if(!C&&!z)return[t.width,t.height];if(z&&C){var G=R?r:c*p,J=Q?c:r/p;return[G,J]}var Y=R?r:t.width,B=Q?c:t.height;return[Y,B]}if(C){var ae=0,ce=0;return zo(y)?ae=Gs(y,t.width):zo(i)&&(ce=Gs(i,t.height)),am(y)?ae=ce*p:(!i||am(i))&&(ce=ae/p),[ae,ce]}var Ae=null,we=null;if(zo(y)?Ae=Gs(y,t.width):i&&zo(i)&&(we=Gs(i,t.height)),Ae!==null&&(!i||am(i))&&(we=R&&Q?Ae/r*c:t.height),we!==null&&am(y)&&(Ae=R&&Q?we/c*r:t.width),Ae!==null&&we!==null)return[Ae,we];throw new Error("Unable to calculate background-size for element")},Mm=function(u,e){var t=u[e];return typeof t>"u"?u[0]:t},oR=function(u,e,t,r,c){var p=e[0],y=e[1],i=t[0],C=t[1];switch(u){case 2:return[new Rn(Math.round(r.left),Math.round(r.top+y)),new Rn(Math.round(r.left+r.width),Math.round(r.top+y)),new Rn(Math.round(r.left+r.width),Math.round(C+r.top+y)),new Rn(Math.round(r.left),Math.round(C+r.top+y))];case 3:return[new Rn(Math.round(r.left+p),Math.round(r.top)),new Rn(Math.round(r.left+p+i),Math.round(r.top)),new Rn(Math.round(r.left+p+i),Math.round(r.height+r.top)),new Rn(Math.round(r.left+p),Math.round(r.height+r.top))];case 1:return[new Rn(Math.round(r.left+p),Math.round(r.top+y)),new Rn(Math.round(r.left+p+i),Math.round(r.top+y)),new Rn(Math.round(r.left+p+i),Math.round(r.top+y+C)),new Rn(Math.round(r.left+p),Math.round(r.top+y+C))];default:return[new Rn(Math.round(c.left),Math.round(c.top)),new Rn(Math.round(c.left+c.width),Math.round(c.top)),new Rn(Math.round(c.left+c.width),Math.round(c.height+c.top)),new Rn(Math.round(c.left),Math.round(c.height+c.top))]}},aR="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",UE="Hidden Text",lR=function(){function u(e){this._data={},this._document=e}return u.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),c=this._document.createElement("img"),p=this._document.createElement("span"),y=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",y.appendChild(r),c.src=aR,c.width=1,c.height=1,c.style.margin="0",c.style.padding="0",c.style.verticalAlign="baseline",p.style.fontFamily=e,p.style.fontSize=t,p.style.margin="0",p.style.padding="0",p.appendChild(this._document.createTextNode(UE)),r.appendChild(p),r.appendChild(c);var i=c.offsetTop-p.offsetTop+2;r.removeChild(p),r.appendChild(this._document.createTextNode(UE)),r.style.lineHeight="normal",c.style.verticalAlign="super";var C=c.offsetTop-r.offsetTop+2;return y.removeChild(r),{baseline:i,middle:C}},u.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},u}(),DM=function(){function u(e,t){this.context=e,this.options=t}return u}(),cR=1e4,hR=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c._activeEffects=[],c.canvas=r.canvas?r.canvas:document.createElement("canvas"),c.ctx=c.canvas.getContext("2d"),r.canvas||(c.canvas.width=Math.floor(r.width*r.scale),c.canvas.height=Math.floor(r.height*r.scale),c.canvas.style.width=r.width+"px",c.canvas.style.height=r.height+"px"),c.fontMetrics=new lR(document),c.ctx.scale(c.options.scale,c.options.scale),c.ctx.translate(-r.x,-r.y),c.ctx.textBaseline="bottom",c._activeEffects=[],c.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),c}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(c){return r.applyEffect(c)})},e.prototype.applyEffect=function(t){this.ctx.save(),q4(t)&&(this.ctx.globalAlpha=t.opacity),X4(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),SM(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Il(this,void 0,void 0,function(){var r;return tl(this,function(c){switch(c.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Il(this,void 0,void 0,function(){return tl(this,function(r){switch(r.label){case 0:if(na(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,c){var p=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+c);else{var y=S2(t.text);y.reduce(function(i,C){return p.ctx.fillText(C,i,t.bounds.top+c),i+p.ctx.measureText(C).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(y){return y==="normal"||y==="small-caps"}).join(""),c=fR(t.fontFamily).join(", "),p=ay(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,p,c].join(" "),c,p]},e.prototype.renderTextNode=function(t,r){return Il(this,void 0,void 0,function(){var c,p,y,i,C,D,R,Q,z=this;return tl(this,function(G){return c=this.createFontStyle(r),p=c[0],y=c[1],i=c[2],this.ctx.font=p,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",C=this.fontMetrics.getMetrics(y,i),D=C.baseline,R=C.middle,Q=r.paintOrder,t.textBounds.forEach(function(J){Q.forEach(function(Y){switch(Y){case 0:z.ctx.fillStyle=ma(r.color),z.renderTextWithLetterSpacing(J,r.letterSpacing,D);var B=r.textShadow;B.length&&J.text.trim().length&&(B.slice(0).reverse().forEach(function(ae){z.ctx.shadowColor=ma(ae.color),z.ctx.shadowOffsetX=ae.offsetX.number*z.options.scale,z.ctx.shadowOffsetY=ae.offsetY.number*z.options.scale,z.ctx.shadowBlur=ae.blur.number,z.renderTextWithLetterSpacing(J,r.letterSpacing,D)}),z.ctx.shadowColor="",z.ctx.shadowOffsetX=0,z.ctx.shadowOffsetY=0,z.ctx.shadowBlur=0),r.textDecorationLine.length&&(z.ctx.fillStyle=ma(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(ae){switch(ae){case 1:z.ctx.fillRect(J.bounds.left,Math.round(J.bounds.top+D),J.bounds.width,1);break;case 2:z.ctx.fillRect(J.bounds.left,Math.round(J.bounds.top),J.bounds.width,1);break;case 3:z.ctx.fillRect(J.bounds.left,Math.ceil(J.bounds.top+R),J.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&J.text.trim().length&&(z.ctx.strokeStyle=ma(r.webkitTextStrokeColor),z.ctx.lineWidth=r.webkitTextStrokeWidth,z.ctx.lineJoin=window.chrome?"miter":"round",z.ctx.strokeText(J.text,J.bounds.left,J.bounds.top+D)),z.ctx.strokeStyle="",z.ctx.lineWidth=0,z.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,c){if(c&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var p=cv(t),y=lv(r);this.path(y),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(c,0,0,t.intrinsicWidth,t.intrinsicHeight,p.left,p.top,p.width,p.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Il(this,void 0,void 0,function(){var r,c,p,y,i,C,ce,ce,D,R,Q,z,we,G,J,me,Y,B,ae,ce,Ae,we,me;return tl(this,function(De){switch(De.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,c=t.curves,p=r.styles,y=0,i=r.textNodes,De.label=1;case 1:return y<i.length?(C=i[y],[4,this.renderTextNode(C,p)]):[3,4];case 2:De.sent(),De.label=3;case 3:return y++,[3,1];case 4:if(!(r instanceof uM))return[3,8];De.label=5;case 5:return De.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return ce=De.sent(),this.renderReplacedElement(r,c,ce),[3,8];case 7:return De.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof AM&&this.renderReplacedElement(r,c,r.canvas),!(r instanceof dM))return[3,12];De.label=9;case 9:return De.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return ce=De.sent(),this.renderReplacedElement(r,c,ce),[3,12];case 11:return De.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof gM&&r.tree?(D=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,D.render(r.tree)]):[3,14];case 13:R=De.sent(),r.width&&r.height&&this.ctx.drawImage(R,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),De.label=14;case 14:if(r instanceof M2&&(Q=Math.min(r.bounds.width,r.bounds.height),r.type===nv?r.checked&&(this.ctx.save(),this.path([new Rn(r.bounds.left+Q*.39363,r.bounds.top+Q*.79),new Rn(r.bounds.left+Q*.16,r.bounds.top+Q*.5549),new Rn(r.bounds.left+Q*.27347,r.bounds.top+Q*.44071),new Rn(r.bounds.left+Q*.39694,r.bounds.top+Q*.5649),new Rn(r.bounds.left+Q*.72983,r.bounds.top+Q*.23),new Rn(r.bounds.left+Q*.84,r.bounds.top+Q*.34085),new Rn(r.bounds.left+Q*.39363,r.bounds.top+Q*.79)]),this.ctx.fillStyle=ma(wE),this.ctx.fill(),this.ctx.restore()):r.type===rv&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+Q/2,r.bounds.top+Q/2,Q/4,0,Math.PI*2,!0),this.ctx.fillStyle=ma(wE),this.ctx.fill(),this.ctx.restore())),uR(r)&&r.value.length){switch(z=this.createFontStyle(p),we=z[0],G=z[1],J=this.fontMetrics.getMetrics(we,G).baseline,this.ctx.font=we,this.ctx.fillStyle=ma(p.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=dR(r.styles.textAlign),me=cv(r),Y=0,r.styles.textAlign){case 1:Y+=me.width/2;break;case 2:Y+=me.width;break}B=me.add(Y,0,0,-me.height/2+1),this.ctx.save(),this.path([new Rn(me.left,me.top),new Rn(me.left+me.width,me.top),new Rn(me.left+me.width,me.top+me.height),new Rn(me.left,me.top+me.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new C_(r.value,B),p.letterSpacing,J),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!na(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(ae=r.styles.listStyleImage,ae.type!==0)return[3,18];ce=void 0,Ae=ae.url,De.label=15;case 15:return De.trys.push([15,17,,18]),[4,this.context.cache.match(Ae)];case 16:return ce=De.sent(),this.ctx.drawImage(ce,r.bounds.left-(ce.width+10),r.bounds.top),[3,18];case 17:return De.sent(),this.context.logger.error("Error loading list-style-image "+Ae),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(we=this.createFontStyle(p)[0],this.ctx.font=we,this.ctx.fillStyle=ma(p.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",me=new $A(r.bounds.left,r.bounds.top+Gs(r.styles.paddingTop,r.bounds.width),r.bounds.width,sE(p.lineHeight,p.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new C_(t.listValue,me),p.letterSpacing,sE(p.lineHeight,p.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),De.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Il(this,void 0,void 0,function(){var r,c,ae,p,y,ae,i,C,ae,D,R,ae,Q,z,ae,G,J,ae,Y,B,ae;return tl(this,function(ce){switch(ce.label){case 0:if(na(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:ce.sent(),r=0,c=t.negativeZIndex,ce.label=2;case 2:return r<c.length?(ae=c[r],[4,this.renderStack(ae)]):[3,5];case 3:ce.sent(),ce.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:ce.sent(),p=0,y=t.nonInlineLevel,ce.label=7;case 7:return p<y.length?(ae=y[p],[4,this.renderNode(ae)]):[3,10];case 8:ce.sent(),ce.label=9;case 9:return p++,[3,7];case 10:i=0,C=t.nonPositionedFloats,ce.label=11;case 11:return i<C.length?(ae=C[i],[4,this.renderStack(ae)]):[3,14];case 12:ce.sent(),ce.label=13;case 13:return i++,[3,11];case 14:D=0,R=t.nonPositionedInlineLevel,ce.label=15;case 15:return D<R.length?(ae=R[D],[4,this.renderStack(ae)]):[3,18];case 16:ce.sent(),ce.label=17;case 17:return D++,[3,15];case 18:Q=0,z=t.inlineLevel,ce.label=19;case 19:return Q<z.length?(ae=z[Q],[4,this.renderNode(ae)]):[3,22];case 20:ce.sent(),ce.label=21;case 21:return Q++,[3,19];case 22:G=0,J=t.zeroOrAutoZIndexOrTransformedOrOpacity,ce.label=23;case 23:return G<J.length?(ae=J[G],[4,this.renderStack(ae)]):[3,26];case 24:ce.sent(),ce.label=25;case 25:return G++,[3,23];case 26:Y=0,B=t.positiveZIndex,ce.label=27;case 27:return Y<B.length?(ae=B[Y],[4,this.renderStack(ae)]):[3,30];case 28:ce.sent(),ce.label=29;case 29:return Y++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(c,p){var y=vh(c)?c.start:c;p===0?r.ctx.moveTo(y.x,y.y):r.ctx.lineTo(y.x,y.y),vh(c)&&r.ctx.bezierCurveTo(c.startControl.x,c.startControl.y,c.endControl.x,c.endControl.y,c.end.x,c.end.y)})},e.prototype.renderRepeat=function(t,r,c,p){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(c,p),this.ctx.fill(),this.ctx.translate(-c,-p)},e.prototype.resizeImage=function(t,r,c){var p;if(t.width===r&&t.height===c)return t;var y=(p=this.canvas.ownerDocument)!==null&&p!==void 0?p:document,i=y.createElement("canvas");i.width=Math.max(1,r),i.height=Math.max(1,c);var C=i.getContext("2d");return C.drawImage(t,0,0,t.width,t.height,0,0,r,c),i},e.prototype.renderBackgroundImage=function(t){return Il(this,void 0,void 0,function(){var r,c,p,y,i,C;return tl(this,function(D){switch(D.label){case 0:r=t.styles.backgroundImage.length-1,c=function(R){var Q,z,G,Et,xe,Re,te,le,Fe,J,Et,xe,Re,te,le,Y,B,ae,ce,Ae,we,me,De,Je,Fe,Ge,Et,li,xi,te,le,ye,xe,Re,Oe,We,Ve,Qe,Se,Ke,nt,vt;return tl(this,function(be){switch(be.label){case 0:if(R.type!==0)return[3,5];Q=void 0,z=R.url,be.label=1;case 1:return be.trys.push([1,3,,4]),[4,p.context.cache.match(z)];case 2:return Q=be.sent(),[3,4];case 3:return be.sent(),p.context.logger.error("Error loading background-image "+z),[3,4];case 4:return Q&&(G=_w(t,r,[Q.width,Q.height,Q.width/Q.height]),Et=G[0],xe=G[1],Re=G[2],te=G[3],le=G[4],Fe=p.ctx.createPattern(p.resizeImage(Q,te,le),"repeat"),p.renderRepeat(Et,Fe,xe,Re)),[3,6];case 5:XD(R)?(J=_w(t,r,[null,null,null]),Et=J[0],xe=J[1],Re=J[2],te=J[3],le=J[4],Y=WD(R.angle,te,le),B=Y[0],ae=Y[1],ce=Y[2],Ae=Y[3],we=Y[4],me=document.createElement("canvas"),me.width=te,me.height=le,De=me.getContext("2d"),Je=De.createLinearGradient(ae,Ae,ce,we),nE(R.stops,B).forEach(function(At){return Je.addColorStop(At.stop,ma(At.color))}),De.fillStyle=Je,De.fillRect(0,0,te,le),te>0&&le>0&&(Fe=p.ctx.createPattern(me,"repeat"),p.renderRepeat(Et,Fe,xe,Re))):qD(R)&&(Ge=_w(t,r,[null,null,null]),Et=Ge[0],li=Ge[1],xi=Ge[2],te=Ge[3],le=Ge[4],ye=R.position.length===0?[C2]:R.position,xe=Gs(ye[0],te),Re=Gs(ye[ye.length-1],le),Oe=jD(R,xe,Re,te,le),We=Oe[0],Ve=Oe[1],We>0&&Ve>0&&(Qe=p.ctx.createRadialGradient(li+xe,xi+Re,0,li+xe,xi+Re,We),nE(R.stops,We*2).forEach(function(At){return Qe.addColorStop(At.stop,ma(At.color))}),p.path(Et),p.ctx.fillStyle=Qe,We!==Ve?(Se=t.bounds.left+.5*t.bounds.width,Ke=t.bounds.top+.5*t.bounds.height,nt=Ve/We,vt=1/nt,p.ctx.save(),p.ctx.translate(Se,Ke),p.ctx.transform(1,0,0,nt,0,0),p.ctx.translate(-Se,-Ke),p.ctx.fillRect(li,vt*(xi-Ke)+Ke,te,le*vt),p.ctx.restore()):p.ctx.fill())),be.label=6;case 6:return r--,[2]}})},p=this,y=0,i=t.styles.backgroundImage.slice(0).reverse(),D.label=1;case 1:return y<i.length?(C=i[y],[5,c(C)]):[3,4];case 2:D.sent(),D.label=3;case 3:return y++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,c){return Il(this,void 0,void 0,function(){return tl(this,function(p){return this.path(PE(c,r)),this.ctx.fillStyle=ma(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,c,p){return Il(this,void 0,void 0,function(){var y,i;return tl(this,function(C){switch(C.label){case 0:return r<3?[4,this.renderSolidBorder(t,c,p)]:[3,2];case 1:return C.sent(),[2];case 2:return y=eR(p,c),this.path(y),this.ctx.fillStyle=ma(t),this.ctx.fill(),i=tR(p,c),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Il(this,void 0,void 0,function(){var r,c,p,y,i,C,D,R,Q=this;return tl(this,function(z){switch(z.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,c=!Jd(r.backgroundColor)||r.backgroundImage.length,p=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],y=AR(Mm(r.backgroundClip,0),t.curves),c||r.boxShadow.length?(this.ctx.save(),this.path(y),this.ctx.clip(),Jd(r.backgroundColor)||(this.ctx.fillStyle=ma(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:z.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(G){Q.ctx.save();var J=av(t.curves),Y=G.inset?0:cR,B=Y4(J,-Y+(G.inset?1:-1)*G.spread.number,(G.inset?1:-1)*G.spread.number,G.spread.number*(G.inset?-2:2),G.spread.number*(G.inset?-2:2));G.inset?(Q.path(J),Q.ctx.clip(),Q.mask(B)):(Q.mask(J),Q.ctx.clip(),Q.path(B)),Q.ctx.shadowOffsetX=G.offsetX.number+Y,Q.ctx.shadowOffsetY=G.offsetY.number,Q.ctx.shadowColor=ma(G.color),Q.ctx.shadowBlur=G.blur.number,Q.ctx.fillStyle=G.inset?ma(G.color):"rgba(0,0,0,1)",Q.ctx.fill(),Q.ctx.restore()}),z.label=2;case 2:i=0,C=0,D=p,z.label=3;case 3:return C<D.length?(R=D[C],R.style!==0&&!Jd(R.color)&&R.width>0?R.style!==2?[3,5]:[4,this.renderDashedDottedBorder(R.color,R.width,i,t.curves,2)]:[3,11]):[3,13];case 4:return z.sent(),[3,11];case 5:return R.style!==3?[3,7]:[4,this.renderDashedDottedBorder(R.color,R.width,i,t.curves,3)];case 6:return z.sent(),[3,11];case 7:return R.style!==4?[3,9]:[4,this.renderDoubleBorder(R.color,R.width,i,t.curves)];case 8:return z.sent(),[3,11];case 9:return[4,this.renderSolidBorder(R.color,i,t.curves)];case 10:z.sent(),z.label=11;case 11:i++,z.label=12;case 12:return C++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,c,p,y){return Il(this,void 0,void 0,function(){var i,C,D,R,Q,z,G,J,Y,B,ae,ce,Ae,we,me,De,me,De;return tl(this,function(Je){return this.ctx.save(),i=iR(p,c),C=PE(p,c),y===2&&(this.path(C),this.ctx.clip()),vh(C[0])?(D=C[0].start.x,R=C[0].start.y):(D=C[0].x,R=C[0].y),vh(C[1])?(Q=C[1].end.x,z=C[1].end.y):(Q=C[1].x,z=C[1].y),c===0||c===2?G=Math.abs(D-Q):G=Math.abs(R-z),this.ctx.beginPath(),y===3?this.formatPath(i):this.formatPath(C.slice(0,2)),J=r<3?r*3:r*2,Y=r<3?r*2:r,y===3&&(J=r,Y=r),B=!0,G<=J*2?B=!1:G<=J*2+Y?(ae=G/(2*J+Y),J*=ae,Y*=ae):(ce=Math.floor((G+Y)/(J+Y)),Ae=(G-ce*J)/(ce-1),we=(G-(ce+1)*J)/ce,Y=we<=0||Math.abs(Y-Ae)<Math.abs(Y-we)?Ae:we),B&&(y===3?this.ctx.setLineDash([0,J+Y]):this.ctx.setLineDash([J,Y])),y===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=ma(t),this.ctx.stroke(),this.ctx.setLineDash([]),y===2&&(vh(C[0])&&(me=C[3],De=C[0],this.ctx.beginPath(),this.formatPath([new Rn(me.end.x,me.end.y),new Rn(De.start.x,De.start.y)]),this.ctx.stroke()),vh(C[1])&&(me=C[1],De=C[2],this.ctx.beginPath(),this.formatPath([new Rn(me.end.x,me.end.y),new Rn(De.start.x,De.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Il(this,void 0,void 0,function(){var r;return tl(this,function(c){switch(c.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=ma(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=J4(t),[4,this.renderStack(r)];case 1:return c.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(DM),uR=function(u){return u instanceof mM||u instanceof fM?!0:u instanceof M2&&u.type!==rv&&u.type!==nv},AR=function(u,e){switch(u){case 0:return av(e);case 2:return K4(e);case 1:default:return lv(e)}},dR=function(u){switch(u){case 1:return"center";case 2:return"right";case 0:default:return"left"}},pR=["-apple-system","system-ui"],fR=function(u){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?u.filter(function(e){return pR.indexOf(e)===-1}):u},mR=function(u){Au(e,u);function e(t,r){var c=u.call(this,t,r)||this;return c.canvas=r.canvas?r.canvas:document.createElement("canvas"),c.ctx=c.canvas.getContext("2d"),c.options=r,c.canvas.width=Math.floor(r.width*r.scale),c.canvas.height=Math.floor(r.height*r.scale),c.canvas.style.width=r.width+"px",c.canvas.style.height=r.height+"px",c.ctx.scale(c.options.scale,c.options.scale),c.ctx.translate(-r.x,-r.y),c.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),c}return e.prototype.render=function(t){return Il(this,void 0,void 0,function(){var r,c;return tl(this,function(p){switch(p.label){case 0:return r=Bb(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,gR(r)];case 1:return c=p.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=ma(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(c,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(DM),gR=function(u){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(u))})},_R=function(){function u(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return u.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,T0([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},u.prototype.getTime=function(){return Date.now()-this.start},u.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,T0([this.id,this.getTime()+"ms"],e))},u.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,T0([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},u.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,T0([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},u.instances={},u}(),yR=function(){function u(e,t){var r;this.windowBounds=t,this.instanceName="#"+u.instanceCount++,this.logger=new _R({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new O4(this,e)}return u.instanceCount=1,u}(),RE=function(u,e){return e===void 0&&(e={}),xR(u,e)};typeof window<"u"&&TM.setContext(window);var xR=function(u,e){return Il(void 0,void 0,void 0,function(){var t,r,c,p,y,i,C,D,R,Q,z,G,J,Y,B,ae,ce,Ae,we,me,Je,De,Je,Fe,Ge,Et,li,xi,te,le,ye,xe,Re,Oe,We,Ve,Qe,Se,Ke,nt;return tl(this,function(vt){switch(vt.label){case 0:if(!u||typeof u!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=u.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return c={allowTaint:(Fe=e.allowTaint)!==null&&Fe!==void 0?Fe:!1,imageTimeout:(Ge=e.imageTimeout)!==null&&Ge!==void 0?Ge:15e3,proxy:e.proxy,useCORS:(Et=e.useCORS)!==null&&Et!==void 0?Et:!1},p=cb({logging:(li=e.logging)!==null&&li!==void 0?li:!0,cache:e.cache},c),y={windowWidth:(xi=e.windowWidth)!==null&&xi!==void 0?xi:r.innerWidth,windowHeight:(te=e.windowHeight)!==null&&te!==void 0?te:r.innerHeight,scrollX:(le=e.scrollX)!==null&&le!==void 0?le:r.pageXOffset,scrollY:(ye=e.scrollY)!==null&&ye!==void 0?ye:r.pageYOffset},i=new $A(y.scrollX,y.scrollY,y.windowWidth,y.windowHeight),C=new yR(p,i),D=(xe=e.foreignObjectRendering)!==null&&xe!==void 0?xe:!1,R={allowTaint:(Re=e.allowTaint)!==null&&Re!==void 0?Re:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:D,copyStyles:D},C.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),Q=new FE(C,u,R),z=Q.clonedReferenceElement,z?[4,Q.toIFrame(t,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return G=vt.sent(),J=I2(z)||w4(z)?Y3(z.ownerDocument):Tv(C,z),Y=J.width,B=J.height,ae=J.left,ce=J.top,Ae=vR(C,z,e.backgroundColor),we={canvas:e.canvas,backgroundColor:Ae,scale:(We=(Oe=e.scale)!==null&&Oe!==void 0?Oe:r.devicePixelRatio)!==null&&We!==void 0?We:1,x:((Ve=e.x)!==null&&Ve!==void 0?Ve:0)+ae,y:((Qe=e.y)!==null&&Qe!==void 0?Qe:0)+ce,width:(Se=e.width)!==null&&Se!==void 0?Se:Math.ceil(Y),height:(Ke=e.height)!==null&&Ke!==void 0?Ke:Math.ceil(B)},D?(C.logger.debug("Document cloned, using foreign object rendering"),Je=new mR(C,we),[4,Je.render(z)]):[3,3];case 2:return me=vt.sent(),[3,5];case 3:return C.logger.debug("Document cloned, element located at "+ae+","+ce+" with size "+Y+"x"+B+" using computed rendering"),C.logger.debug("Starting DOM parsing"),De=yM(C,z),Ae===De.styles.backgroundColor&&(De.styles.backgroundColor=jA.TRANSPARENT),C.logger.debug("Starting renderer for element at "+we.x+","+we.y+" with size "+we.width+"x"+we.height),Je=new hR(C,we),[4,Je.render(De)];case 4:me=vt.sent(),vt.label=5;case 5:return(!((nt=e.removeContainer)!==null&&nt!==void 0)||nt)&&(FE.destroy(G)||C.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),C.logger.debug("Finished rendering"),[2,me]}})})},vR=function(u,e,t){var r=e.ownerDocument,c=r.documentElement?b_(u,getComputedStyle(r.documentElement).backgroundColor):jA.TRANSPARENT,p=r.body?b_(u,getComputedStyle(r.body).backgroundColor):jA.TRANSPARENT,y=typeof t=="string"?b_(u,t):t===null?jA.TRANSPARENT:4294967295;return e===r.documentElement?Jd(c)?Jd(p)?y:p:c:y};window.queryString=q3;const ef=class{constructor(){Qi(this,"domId","");Qi(this,"baseOption",{});Qi(this,"nativeFns",{});Qi(this,"params",{});Qi(this,"_ParseUrl2Params",()=>{let e=P_.parse(window.location.search),t=P_.parse(window.location.hash);return this.params=Object.assign(this.params,e,t),ef._instance});Qi(this,"Init",()=>{console.dir(this.nativeFns)});Qi(this,"IsPC",()=>{let e=navigator.userAgent,t=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"],r=!0;for(let c=0;c<t.length;c++)if(e.indexOf(t[c])>0){r=!1;break}return r});Qi(this,"_OutScreenshot",async function(e=""){$(`#${this.domId} > div`).css("width","100%"),$(`#${this.domId} > div`).css("height","100%"),$(`#${this.domId} > div`).css("overflow","hidden"),$("#bim-cache").css("display","none");let t;if(e!==""&&document.getElementById(e)){let c=document.getElementById(e);t=await RE(c)}t=await RE(document.body);let r=t.toDataURL();return await this._scaleImage(600,r),r});Qi(this,"_scaleImage",async function(e=720,t=""){return new Promise((r,c)=>{let p="";if(!t||t==="")r(p);else{let y=document.body.offsetHeight,i=document.body.offsetWidth,C=e,D=e/(i/y),R=document.createElement("canvas");R.width=C,R.height=D;let Q=R.getContext("2d"),z=document.createElement("img");z.id="testimg",z.src=t,z.style.width="200px",z.style.position="absolute",z.style.top="0px",z.style.zIndex="9999",z.onload=G=>{console.dir(z),Q.drawImage(z,0,0,C,D),R.style.position="absolute",R.style.display="block",R.style.top="0px",R.style.right="0px",R.style.zIndex="10000",R.style.backgroundColor="red",p=R.toDataURL(),r(p)}}})})}static getInstance(){return ef._instance==null&&(ef._instance=new ef),ef._instance}BindFn(e){return this.nativeFns=e,this}};let Nm=ef;Qi(Nm,"_instance");const zm=class{constructor(){Qi(this,"targetComponentID","")}static getInstance(){return zm._instance==null&&(zm._instance=new zm),zm._instance}BindCbFn(e){return Jp.getInstance().Fn,this}};let T_=zm;Qi(T_,"_instance");var Ml={exports:{}};(function(u,e){(function({},t){u.exports=t()})(MS,function(){var t,r,c;function p(i,C){if(!t)t=C;else if(!r)r=C;else{var D="var sharedChunk = {}; ("+t+")(sharedChunk); ("+r+")(sharedChunk);",R={};t(R),c=C(R),typeof window<"u"&&(c.workerUrl=window.URL.createObjectURL(new Blob([D],{type:"text/javascript"})))}}p(["exports"],function(i){var C=D;function D(A,l,f,w){this.cx=3*A,this.bx=3*(f-A)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*l,this.by=3*(w-l)-this.cy,this.ay=1-this.cy-this.by,this.p1x=A,this.p1y=l,this.p2x=f,this.p2y=w}function R(A,l,f,w){const I=new C(A,l,f,w);return function(U){return I.solve(U)}}D.prototype={sampleCurveX:function(A){return((this.ax*A+this.bx)*A+this.cx)*A},sampleCurveY:function(A){return((this.ay*A+this.by)*A+this.cy)*A},sampleCurveDerivativeX:function(A){return(3*this.ax*A+2*this.bx)*A+this.cx},solveCurveX:function(A,l){if(l===void 0&&(l=1e-6),A<0)return 0;if(A>1)return 1;for(var f=A,w=0;w<8;w++){var I=this.sampleCurveX(f)-A;if(Math.abs(I)<l)return f;var U=this.sampleCurveDerivativeX(f);if(Math.abs(U)<1e-6)break;f-=I/U}var N=0,Z=1;for(f=A,w=0;w<20&&(I=this.sampleCurveX(f),!(Math.abs(I-A)<l));w++)A>I?N=f:Z=f,f=.5*(Z-N)+N;return f},solve:function(A,l){return this.sampleCurveY(this.solveCurveX(A,l))}};const Q=R(.25,.1,.25,1);function z(A,l,f){return Math.min(f,Math.max(l,A))}function G(A,l,f){const w=f-l,I=((A-l)%w+w)%w+l;return I===l?f:I}function J(A,...l){for(const f of l)for(const w in f)A[w]=f[w];return A}let Y=1;function B(A,l){A.forEach(f=>{l[f]&&(l[f]=l[f].bind(l))})}function ae(A,l,f){const w={};for(const I in A)w[I]=l.call(f||this,A[I],I,A);return w}function ce(A,l,f){const w={};for(const I in A)l.call(f||this,A[I],I,A)&&(w[I]=A[I]);return w}function Ae(A){return Array.isArray(A)?A.map(Ae):typeof A=="object"&&A?ae(A,Ae):A}const we={};function me(A){we[A]||(typeof console<"u"&&console.warn(A),we[A]=!0)}function De(A,l,f){return(f.y-A.y)*(l.x-A.x)>(l.y-A.y)*(f.x-A.x)}function Je(A){let l=0;for(let f,w,I=0,U=A.length,N=U-1;I<U;N=I++)f=A[I],w=A[N],l+=(w.x-f.x)*(f.y+w.y);return l}function Fe(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ge(A){const l={};if(A.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(f,w,I,U)=>{const N=I||U;return l[w]=!N||N.toLowerCase(),""}),l["max-age"]){const f=parseInt(l["max-age"],10);isNaN(f)?delete l["max-age"]:l["max-age"]=f}return l}let Et,li,xi=null;function te(A){if(xi==null){const l=A.navigator?A.navigator.userAgent:null;xi=!!A.safari||!(!l||!(/\b(iPad|iPhone|iPod)\b/.test(l)||l.match("Safari")&&!l.match("Chrome")))}return xi}function le(A){return typeof ImageBitmap<"u"&&A instanceof ImageBitmap}const ye={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(A){const l=requestAnimationFrame(A);return{cancel:()=>cancelAnimationFrame(l)}},getImageData(A,l=0){const f=window.document.createElement("canvas"),w=f.getContext("2d");if(!w)throw new Error("failed to create canvas 2d context");return f.width=A.width,f.height=A.height,w.drawImage(A,0,0,A.width,A.height),w.getImageData(-l,-l,A.width+2*l,A.height+2*l)},resolveURL:A=>(Et||(Et=document.createElement("a")),Et.href=A,Et.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(li==null&&(li=matchMedia("(prefers-reduced-motion: reduce)")),li.matches)}};var xe=Re;function Re(A,l){this.x=A,this.y=l}Re.prototype={clone:function(){return new Re(this.x,this.y)},add:function(A){return this.clone()._add(A)},sub:function(A){return this.clone()._sub(A)},multByPoint:function(A){return this.clone()._multByPoint(A)},divByPoint:function(A){return this.clone()._divByPoint(A)},mult:function(A){return this.clone()._mult(A)},div:function(A){return this.clone()._div(A)},rotate:function(A){return this.clone()._rotate(A)},rotateAround:function(A,l){return this.clone()._rotateAround(A,l)},matMult:function(A){return this.clone()._matMult(A)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(A){return this.x===A.x&&this.y===A.y},dist:function(A){return Math.sqrt(this.distSqr(A))},distSqr:function(A){var l=A.x-this.x,f=A.y-this.y;return l*l+f*f},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(A){return Math.atan2(this.y-A.y,this.x-A.x)},angleWith:function(A){return this.angleWithSep(A.x,A.y)},angleWithSep:function(A,l){return Math.atan2(this.x*l-this.y*A,this.x*A+this.y*l)},_matMult:function(A){var l=A[2]*this.x+A[3]*this.y;return this.x=A[0]*this.x+A[1]*this.y,this.y=l,this},_add:function(A){return this.x+=A.x,this.y+=A.y,this},_sub:function(A){return this.x-=A.x,this.y-=A.y,this},_mult:function(A){return this.x*=A,this.y*=A,this},_div:function(A){return this.x/=A,this.y/=A,this},_multByPoint:function(A){return this.x*=A.x,this.y*=A.y,this},_divByPoint:function(A){return this.x/=A.x,this.y/=A.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var A=this.y;return this.y=this.x,this.x=-A,this},_rotate:function(A){var l=Math.cos(A),f=Math.sin(A),w=f*this.x+l*this.y;return this.x=l*this.x-f*this.y,this.y=w,this},_rotateAround:function(A,l){var f=Math.cos(A),w=Math.sin(A),I=l.y+w*(this.x-l.x)+f*(this.y-l.y);return this.x=l.x+f*(this.x-l.x)-w*(this.y-l.y),this.y=I,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Re.convert=function(A){return A instanceof Re?A:Array.isArray(A)?new Re(A[0],A[1]):A};const Oe={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},We="mapbox-tiles";let Ve,Qe,Se=500,Ke=50;function nt(){typeof caches>"u"||Ve||(Ve=caches.open(We))}let vt=1/0;const be={supported:!1,testSupport:function(A){!Nt&&ut&&(Gt?Qt(A):At=A)}};let At,ut,Nt=!1,Gt=!1;function Qt(A){const l=A.createTexture();A.bindTexture(A.TEXTURE_2D,l);try{if(A.texImage2D(A.TEXTURE_2D,0,A.RGBA,A.RGBA,A.UNSIGNED_BYTE,ut),A.isContextLost())return;be.supported=!0}catch{}A.deleteTexture(l),Nt=!0}typeof document<"u"&&(ut=document.createElement("img"),ut.onload=function(){At&&Qt(At),At=null,Gt=!0},ut.onerror=function(){Nt=!0,At=null},ut.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ct={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Ct);class Ft extends Error{constructor(l,f,w,I){super(`AJAXError: ${f} (${l}): ${w}`),this.status=l,this.statusText=f,this.url=w,this.body=I}}const Xt=Fe()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function _i(A,l){const f=new AbortController,w=new Request(A.url,{method:A.method||"GET",body:A.body,credentials:A.credentials,headers:A.headers,referrer:Xt(),signal:f.signal});let I=!1,U=!1;return A.type==="json"&&w.headers.set("Accept","application/json"),((N,Z,re)=>{if(U)return;const ge=Date.now();fetch(w).then(Ce=>Ce.ok?((Ie,ke,$e)=>{(A.type==="arrayBuffer"?Ie.arrayBuffer():A.type==="json"?Ie.json():Ie.text()).then(Ze=>{U||(ke&&$e&&function(Rt,Mt,ri){if(nt(),!Ve)return;const mi={status:Mt.status,statusText:Mt.statusText,headers:new Headers};Mt.headers.forEach((ui,Pi)=>mi.headers.set(Pi,ui));const ei=Ge(Mt.headers.get("Cache-Control")||"");ei["no-store"]||(ei["max-age"]&&mi.headers.set("Expires",new Date(ri+1e3*ei["max-age"]).toUTCString()),new Date(mi.headers.get("Expires")).getTime()-ri<42e4||function(ui,Pi){if(Qe===void 0)try{new Response(new ReadableStream),Qe=!0}catch{Qe=!1}Qe?Pi(ui.body):ui.blob().then(Pi)}(Mt,ui=>{const Pi=new Response(ui,mi);nt(),Ve&&Ve.then(Fi=>Fi.put(function(Sn){const fn=Sn.indexOf("?");return fn<0?Sn:Sn.slice(0,fn)}(Rt.url),Pi)).catch(Fi=>me(Fi.message))}))}(w,ke,$e),I=!0,l(null,Ze,Ie.headers.get("Cache-Control"),Ie.headers.get("Expires")))}).catch(Ze=>{U||l(new Error(Ze.message))})})(Ce,null,ge):Ce.blob().then(Ie=>l(new Ft(Ce.status,Ce.statusText,A.url,Ie)))).catch(Ce=>{Ce.code!==20&&l(new Error(Ce.message))})})(),{cancel:()=>{U=!0,I||f.abort()}}}const fi=function(A,l){if(/:\/\//.test(A.url)&&!/^https?:|^file:/.test(A.url)){if(Fe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",A,l);if(!Fe()){const w=A.url.substring(0,A.url.indexOf("://"));return(Oe.REGISTERED_PROTOCOLS[w]||_i)(A,l)}}if(!(/^file:/.test(f=A.url)||/^file:/.test(Xt())&&!/^\w+:/.test(f))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return _i(A,l);if(Fe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",A,l,void 0,!0)}var f;return function(w,I){const U=new XMLHttpRequest;U.open(w.method||"GET",w.url,!0),w.type==="arrayBuffer"&&(U.responseType="arraybuffer");for(const N in w.headers)U.setRequestHeader(N,w.headers[N]);return w.type==="json"&&(U.responseType="text",U.setRequestHeader("Accept","application/json")),U.withCredentials=w.credentials==="include",U.onerror=()=>{I(new Error(U.statusText))},U.onload=()=>{if((U.status>=200&&U.status<300||U.status===0)&&U.response!==null){let N=U.response;if(w.type==="json")try{N=JSON.parse(U.response)}catch(Z){return I(Z)}I(null,N,U.getResponseHeader("Cache-Control"),U.getResponseHeader("Expires"))}else{const N=new Blob([U.response],{type:U.getResponseHeader("Content-Type")});I(new Ft(U.status,U.statusText,w.url,N))}},U.send(w.body),{cancel:()=>U.abort()}}(A,l)},Gi=function(A,l){return fi(J(A,{type:"arrayBuffer"}),l)};function wn(A){const l=window.document.createElement("a");return l.href=A,l.protocol===window.document.location.protocol&&l.host===window.document.location.host}const zi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Gn,kn;Gn=[],kn=0;const yt=function(A,l){if(be.supported&&(A.headers||(A.headers={}),A.headers.accept="image/webp,*/*"),kn>=Oe.MAX_PARALLEL_IMAGE_REQUESTS){const U={requestParameters:A,callback:l,cancelled:!1,cancel(){this.cancelled=!0}};return Gn.push(U),U}kn++;let f=!1;const w=()=>{if(!f)for(f=!0,kn--;Gn.length&&kn<Oe.MAX_PARALLEL_IMAGE_REQUESTS;){const U=Gn.shift(),{requestParameters:N,callback:Z,cancelled:re}=U;re||(U.cancel=yt(N,Z).cancel)}},I=Gi(A,(U,N,Z,re)=>{w(),U?l(U):N&&function(ge,Ce){typeof createImageBitmap=="function"?function(Ie,ke){const $e=new Blob([new Uint8Array(Ie)],{type:"image/png"});createImageBitmap($e).then(Ze=>{ke(null,Ze)}).catch(Ze=>{ke(new Error(`Could not load image because of ${Ze.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(ge,Ce):function(Ie,ke){const $e=new Image;$e.onload=()=>{ke(null,$e),URL.revokeObjectURL($e.src),$e.onload=null,window.requestAnimationFrame(()=>{$e.src=zi})},$e.onerror=()=>ke(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 Ze=new Blob([new Uint8Array(Ie)],{type:"image/png"});$e.src=Ie.byteLength?URL.createObjectURL(Ze):zi}(ge,Ce)}(N,(ge,Ce)=>{ge!=null?l(ge):Ce!=null&&l(null,Ce,{cacheControl:Z,expires:re})})});return{cancel:()=>{I.cancel(),w()}}};function rt(A,l,f){f[A]&&f[A].indexOf(l)!==-1||(f[A]=f[A]||[],f[A].push(l))}function ti(A,l,f){if(f&&f[A]){const w=f[A].indexOf(l);w!==-1&&f[A].splice(w,1)}}class Ni{constructor(l,f={}){J(this,f),this.type=l}}class qi extends Ni{constructor(l,f={}){super("error",J({error:l},f))}}class en{on(l,f){return this._listeners=this._listeners||{},rt(l,f,this._listeners),this}off(l,f){return ti(l,f,this._listeners),ti(l,f,this._oneTimeListeners),this}once(l,f){return this._oneTimeListeners=this._oneTimeListeners||{},rt(l,f,this._oneTimeListeners),this}fire(l,f){typeof l=="string"&&(l=new Ni(l,f||{}));const w=l.type;if(this.listens(w)){l.target=this;const I=this._listeners&&this._listeners[w]?this._listeners[w].slice():[];for(const Z of I)Z.call(this,l);const U=this._oneTimeListeners&&this._oneTimeListeners[w]?this._oneTimeListeners[w].slice():[];for(const Z of U)ti(w,Z,this._oneTimeListeners),Z.call(this,l);const N=this._eventedParent;N&&(J(l,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),N.fire(l))}else l instanceof qi&&console.error(l.error);return this}listens(l){return this._listeners&&this._listeners[l]&&this._listeners[l].length>0||this._oneTimeListeners&&this._oneTimeListeners[l]&&this._oneTimeListeners[l].length>0||this._eventedParent&&this._eventedParent.listens(l)}setEventedParent(l,f){return this._eventedParent=l,this._eventedParentData=f,this}}var $t={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class at{constructor(l,f,w,I){this.message=(l?`${l}: `:"")+w,I&&(this.identifier=I),f!=null&&f.__line__&&(this.line=f.__line__)}}function ii(A){const l=A.value;return l?[new at(A.key,l,"constants have been deprecated as of v8")]:[]}function hn(A,...l){for(const f of l)for(const w in f)A[w]=f[w];return A}function Xi(A){return A instanceof Number||A instanceof String||A instanceof Boolean?A.valueOf():A}function on(A){if(Array.isArray(A))return A.map(on);if(A instanceof Object&&!(A instanceof Number||A instanceof String||A instanceof Boolean)){const l={};for(const f in A)l[f]=on(A[f]);return l}return Xi(A)}class Cn extends Error{constructor(l,f){super(f),this.message=f,this.key=l}}class Tn{constructor(l,f=[]){this.parent=l,this.bindings={};for(const[w,I]of f)this.bindings[w]=I}concat(l){return new Tn(this,l)}get(l){if(this.bindings[l])return this.bindings[l];if(this.parent)return this.parent.get(l);throw new Error(`${l} not found in scope.`)}has(l){return!!this.bindings[l]||!!this.parent&&this.parent.has(l)}}const nr={kind:"null"},Ii={kind:"number"},bn={kind:"string"},Ot={kind:"boolean"},wi={kind:"color"},Wi={kind:"object"},Ui={kind:"value"},Pn={kind:"collator"},qn={kind:"formatted"},Hr={kind:"padding"},fr={kind:"resolvedImage"};function kr(A,l){return{kind:"array",itemType:A,N:l}}function Qn(A){if(A.kind==="array"){const l=Qn(A.itemType);return typeof A.N=="number"?`array<${l}, ${A.N}>`:A.itemType.kind==="value"?"array":`array<${l}>`}return A.kind}const Rs=[nr,Ii,bn,Ot,wi,qn,Wi,kr(Ui),Hr,fr];function ot(A,l){if(l.kind==="error")return null;if(A.kind==="array"){if(l.kind==="array"&&(l.N===0&&l.itemType.kind==="value"||!ot(A.itemType,l.itemType))&&(typeof A.N!="number"||A.N===l.N))return null}else{if(A.kind===l.kind)return null;if(A.kind==="value"){for(const f of Rs)if(!ot(f,l))return null}}return`Expected ${Qn(A)} but found ${Qn(l)} instead.`}function Ee(A,l){return l.some(f=>f.kind===A.kind)}function Pe(A,l){return l.some(f=>f==="null"?A===null:f==="array"?Array.isArray(A):f==="object"?A&&!Array.isArray(A)&&typeof A=="object":f===typeof A)}var ct,wt={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function X(A){return(A=Math.round(A))<0?0:A>255?255:A}function j(A){return X(A[A.length-1]==="%"?parseFloat(A)/100*255:parseInt(A))}function ie(A){return(l=A[A.length-1]==="%"?parseFloat(A)/100:parseFloat(A))<0?0:l>1?1:l;var l}function ne(A,l,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?A+(l-A)*f*6:2*f<1?l:3*f<2?A+(l-A)*(2/3-f)*6:A}try{ct={}.parseCSSColor=function(A){var l,f=A.replace(/ /g,"").toLowerCase();if(f in wt)return wt[f].slice();if(f[0]==="#")return f.length===4?(l=parseInt(f.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:f.length===7&&(l=parseInt(f.substr(1),16))>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null;var w=f.indexOf("("),I=f.indexOf(")");if(w!==-1&&I+1===f.length){var U=f.substr(0,w),N=f.substr(w+1,I-(w+1)).split(","),Z=1;switch(U){case"rgba":if(N.length!==4)return null;Z=ie(N.pop());case"rgb":return N.length!==3?null:[j(N[0]),j(N[1]),j(N[2]),Z];case"hsla":if(N.length!==4)return null;Z=ie(N.pop());case"hsl":if(N.length!==3)return null;var re=(parseFloat(N[0])%360+360)%360/360,ge=ie(N[1]),Ce=ie(N[2]),Ie=Ce<=.5?Ce*(ge+1):Ce+ge-Ce*ge,ke=2*Ce-Ie;return[X(255*ne(ke,Ie,re+1/3)),X(255*ne(ke,Ie,re)),X(255*ne(ke,Ie,re-1/3)),Z];default:return null}}return null}}catch{}class de{constructor(l,f,w,I=1){this.r=l,this.g=f,this.b=w,this.a=I}static parse(l){if(!l)return;if(l instanceof de)return l;if(typeof l!="string")return;const f=ct(l);return f?new de(f[0]/255*f[3],f[1]/255*f[3],f[2]/255*f[3],f[3]):void 0}toString(){const[l,f,w,I]=this.toArray();return`rgba(${Math.round(l)},${Math.round(f)},${Math.round(w)},${I})`}toArray(){const{r:l,g:f,b:w,a:I}=this;return I===0?[0,0,0,0]:[255*l/I,255*f/I,255*w/I,I]}}de.black=new de(0,0,0,1),de.white=new de(1,1,1,1),de.transparent=new de(0,0,0,0),de.red=new de(1,0,0,1);class Ue{constructor(l,f,w){this.sensitivity=l?f?"variant":"case":f?"accent":"base",this.locale=w,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(l,f){return this.collator.compare(l,f)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class tt{constructor(l,f,w,I,U){this.text=l,this.image=f,this.scale=w,this.fontStack=I,this.textColor=U}}class He{constructor(l){this.sections=l}static fromString(l){return new He([new tt(l,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(l=>l.text.length!==0||l.image&&l.image.name.length!==0)}static factory(l){return l instanceof He?l:He.fromString(l)}toString(){return this.sections.length===0?"":this.sections.map(l=>l.text).join("")}}class et{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof et)return l;if(typeof l=="number")return new et([l,l,l,l]);if(Array.isArray(l)&&!(l.length<1||l.length>4)){for(const f of l)if(typeof f!="number")return;switch(l.length){case 1:l=[l[0],l[0],l[0],l[0]];break;case 2:l=[l[0],l[1],l[0],l[1]];break;case 3:l=[l[0],l[1],l[2],l[1]]}return new et(l)}}toString(){return JSON.stringify(this.values)}}class pt{constructor(l){this.name=l.name,this.available=l.available}toString(){return this.name}static fromString(l){return l?new pt({name:l,available:!1}):null}}function Lt(A,l,f,w){return typeof A=="number"&&A>=0&&A<=255&&typeof l=="number"&&l>=0&&l<=255&&typeof f=="number"&&f>=0&&f<=255?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid rgba value [${[A,l,f,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof w=="number"?[A,l,f,w]:[A,l,f]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jt(A){if(A===null||typeof A=="string"||typeof A=="boolean"||typeof A=="number"||A instanceof de||A instanceof Ue||A instanceof He||A instanceof et||A instanceof pt)return!0;if(Array.isArray(A)){for(const l of A)if(!jt(l))return!1;return!0}if(typeof A=="object"){for(const l in A)if(!jt(A[l]))return!1;return!0}return!1}function Wt(A){if(A===null)return nr;if(typeof A=="string")return bn;if(typeof A=="boolean")return Ot;if(typeof A=="number")return Ii;if(A instanceof de)return wi;if(A instanceof Ue)return Pn;if(A instanceof He)return qn;if(A instanceof et)return Hr;if(A instanceof pt)return fr;if(Array.isArray(A)){const l=A.length;let f;for(const w of A){const I=Wt(w);if(f){if(f===I)continue;f=Ui;break}f=I}return kr(f||Ui,l)}return Wi}function ki(A){const l=typeof A;return A===null?"":l==="string"||l==="number"||l==="boolean"?String(A):A instanceof de||A instanceof He||A instanceof et||A instanceof pt?A.toString():JSON.stringify(A)}class bi{constructor(l,f){this.type=l,this.value=f}static parse(l,f){if(l.length!==2)return f.error(`'literal' expression requires exactly one argument, but found ${l.length-1} instead.`);if(!jt(l[1]))return f.error("invalid value");const w=l[1];let I=Wt(w);const U=f.expectedType;return I.kind!=="array"||I.N!==0||!U||U.kind!=="array"||typeof U.N=="number"&&U.N!==0||(I=U),new bi(I,w)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Oi{constructor(l){this.name="ExpressionEvaluationError",this.message=l}toJSON(){return this.message}}const Yi={string:bn,number:Ii,boolean:Ot,object:Wi};class tn{constructor(l,f){this.type=l,this.args=f}static parse(l,f){if(l.length<2)return f.error("Expected at least one argument.");let w,I=1;const U=l[0];if(U==="array"){let Z,re;if(l.length>2){const ge=l[1];if(typeof ge!="string"||!(ge in Yi)||ge==="object")return f.error('The item type argument of "array" must be one of string, number, boolean',1);Z=Yi[ge],I++}else Z=Ui;if(l.length>3){if(l[2]!==null&&(typeof l[2]!="number"||l[2]<0||l[2]!==Math.floor(l[2])))return f.error('The length argument to "array" must be a positive integer literal',2);re=l[2],I++}w=kr(Z,re)}else{if(!Yi[U])throw new Error(`Types doesn't contain name = ${U}`);w=Yi[U]}const N=[];for(;I<l.length;I++){const Z=f.parse(l[I],I,Ui);if(!Z)return null;N.push(Z)}return new tn(w,N)}evaluate(l){for(let f=0;f<this.args.length;f++){const w=this.args[f].evaluate(l);if(!ot(this.type,Wt(w)))return w;if(f===this.args.length-1)throw new Oi(`Expected value to be of type ${Qn(this.type)}, but found ${Qn(Wt(w))} instead.`)}throw new Error}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}const rr={"to-boolean":Ot,"to-color":wi,"to-number":Ii,"to-string":bn};class yn{constructor(l,f){this.type=l,this.args=f}static parse(l,f){if(l.length<2)return f.error("Expected at least one argument.");const w=l[0];if(!rr[w])throw new Error(`Can't parse ${w} as it is not part of the known types`);if((w==="to-boolean"||w==="to-string")&&l.length!==2)return f.error("Expected one argument.");const I=rr[w],U=[];for(let N=1;N<l.length;N++){const Z=f.parse(l[N],N,Ui);if(!Z)return null;U.push(Z)}return new yn(I,U)}evaluate(l){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(l));if(this.type.kind==="color"){let f,w;for(const I of this.args){if(f=I.evaluate(l),w=null,f instanceof de)return f;if(typeof f=="string"){const U=l.parseColor(f);if(U)return U}else if(Array.isArray(f)&&(w=f.length<3||f.length>4?`Invalid rbga value ${JSON.stringify(f)}: expected an array containing either three or four numeric values.`:Lt(f[0],f[1],f[2],f[3]),!w))return new de(f[0]/255,f[1]/255,f[2]/255,f[3])}throw new Oi(w||`Could not parse color from value '${typeof f=="string"?f:JSON.stringify(f)}'`)}if(this.type.kind==="padding"){let f;for(const w of this.args){f=w.evaluate(l);const I=et.parse(f);if(I)return I}throw new Oi(`Could not parse padding from value '${typeof f=="string"?f:JSON.stringify(f)}'`)}if(this.type.kind==="number"){let f=null;for(const w of this.args){if(f=w.evaluate(l),f===null)return 0;const I=Number(f);if(!isNaN(I))return I}throw new Oi(`Could not convert ${JSON.stringify(f)} to number.`)}return this.type.kind==="formatted"?He.fromString(ki(this.args[0].evaluate(l))):this.type.kind==="resolvedImage"?pt.fromString(ki(this.args[0].evaluate(l))):ki(this.args[0].evaluate(l))}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}const Yt=["Unknown","Point","LineString","Polygon"];class sr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Yt[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(l){let f=this._parseColorCache[l];return f||(f=this._parseColorCache[l]=de.parse(l)),f}}class Yn{constructor(l,f,w,I){this.name=l,this.type=f,this._evaluate=w,this.args=I}evaluate(l){return this._evaluate(l,this.args)}eachChild(l){this.args.forEach(l)}outputDefined(){return!1}static parse(l,f){const w=l[0],I=Yn.definitions[w];if(!I)return f.error(`Unknown expression "${w}". If you wanted a literal array, use ["literal", [...]].`,0);const U=Array.isArray(I)?I[0]:I.type,N=Array.isArray(I)?[[I[1],I[2]]]:I.overloads,Z=N.filter(([ge])=>!Array.isArray(ge)||ge.length===l.length-1);let re=null;for(const[ge,Ce]of Z){re=new Ol(f.registry,f.path,null,f.scope);const Ie=[];let ke=!1;for(let $e=1;$e<l.length;$e++){const Ze=l[$e],Rt=Array.isArray(ge)?ge[$e-1]:ge.type,Mt=re.parse(Ze,1+Ie.length,Rt);if(!Mt){ke=!0;break}Ie.push(Mt)}if(!ke)if(Array.isArray(ge)&&ge.length!==Ie.length)re.error(`Expected ${ge.length} arguments, but found ${Ie.length} instead.`);else{for(let $e=0;$e<Ie.length;$e++){const Ze=Array.isArray(ge)?ge[$e]:ge.type,Rt=Ie[$e];re.concat($e+1).checkSubtype(Ze,Rt.type)}if(re.errors.length===0)return new Yn(w,U,Ce,Ie)}}if(Z.length===1)f.errors.push(...re.errors);else{const ge=(Z.length?Z:N).map(([Ie])=>{return ke=Ie,Array.isArray(ke)?`(${ke.map(Qn).join(", ")})`:`(${Qn(ke.type)}...)`;var ke}).join(" | "),Ce=[];for(let Ie=1;Ie<l.length;Ie++){const ke=f.parse(l[Ie],1+Ce.length);if(!ke)return null;Ce.push(Qn(ke.type))}f.error(`Expected arguments of type ${ge}, but found (${Ce.join(", ")}) instead.`)}return null}static register(l,f){Yn.definitions=f;for(const w in f)l[w]=Yn}}class Wr{constructor(l,f,w){this.type=Pn,this.locale=w,this.caseSensitive=l,this.diacriticSensitive=f}static parse(l,f){if(l.length!==2)return f.error("Expected one argument.");const w=l[1];if(typeof w!="object"||Array.isArray(w))return f.error("Collator options argument must be an object.");const I=f.parse(w["case-sensitive"]!==void 0&&w["case-sensitive"],1,Ot);if(!I)return null;const U=f.parse(w["diacritic-sensitive"]!==void 0&&w["diacritic-sensitive"],1,Ot);if(!U)return null;let N=null;return w.locale&&(N=f.parse(w.locale,1,bn),!N)?null:new Wr(I,U,N)}evaluate(l){return new Ue(this.caseSensitive.evaluate(l),this.diacriticSensitive.evaluate(l),this.locale?this.locale.evaluate(l):null)}eachChild(l){l(this.caseSensitive),l(this.diacriticSensitive),this.locale&&l(this.locale)}outputDefined(){return!1}}const mr=8192;function Mr(A,l){A[0]=Math.min(A[0],l[0]),A[1]=Math.min(A[1],l[1]),A[2]=Math.max(A[2],l[0]),A[3]=Math.max(A[3],l[1])}function Oo(A,l){return!(A[0]<=l[0]||A[2]>=l[2]||A[1]<=l[1]||A[3]>=l[3])}function zs(A,l){const f=(180+A[0])/360,w=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+A[1]*Math.PI/360)))/360,I=Math.pow(2,l.z);return[Math.round(f*I*mr),Math.round(w*I*mr)]}function or(A,l,f){const w=A[0]-l[0],I=A[1]-l[1],U=A[0]-f[0],N=A[1]-f[1];return w*N-U*I==0&&w*U<=0&&I*N<=0}function rn(A,l){let f=!1;for(let N=0,Z=l.length;N<Z;N++){const re=l[N];for(let ge=0,Ce=re.length;ge<Ce-1;ge++){if(or(A,re[ge],re[ge+1]))return!1;(I=re[ge])[1]>(w=A)[1]!=(U=re[ge+1])[1]>w[1]&&w[0]<(U[0]-I[0])*(w[1]-I[1])/(U[1]-I[1])+I[0]&&(f=!f)}}var w,I,U;return f}function cr(A,l){for(let f=0;f<l.length;f++)if(rn(A,l[f]))return!0;return!1}function Ar(A,l,f,w){const I=w[0]-f[0],U=w[1]-f[1],N=(A[0]-f[0])*U-I*(A[1]-f[1]),Z=(l[0]-f[0])*U-I*(l[1]-f[1]);return N>0&&Z<0||N<0&&Z>0}function aa(A,l,f){for(const ge of f)for(let Ce=0;Ce<ge.length-1;++Ce)if((Z=[(N=ge[Ce+1])[0]-(U=ge[Ce])[0],N[1]-U[1]])[0]*(re=[(I=l)[0]-(w=A)[0],I[1]-w[1]])[1]-Z[1]*re[0]!=0&&Ar(w,I,U,N)&&Ar(U,N,w,I))return!0;var w,I,U,N,Z,re;return!1}function al(A,l){for(let f=0;f<A.length;++f)if(!rn(A[f],l))return!1;for(let f=0;f<A.length-1;++f)if(aa(A[f],A[f+1],l))return!1;return!0}function dr(A,l){for(let f=0;f<l.length;f++)if(al(A,l[f]))return!0;return!1}function Ul(A,l,f){const w=[];for(let I=0;I<A.length;I++){const U=[];for(let N=0;N<A[I].length;N++){const Z=zs(A[I][N],f);Mr(l,Z),U.push(Z)}w.push(U)}return w}function Rl(A,l,f){const w=[];for(let I=0;I<A.length;I++){const U=Ul(A[I],l,f);w.push(U)}return w}function ll(A,l,f,w){if(A[0]<f[0]||A[0]>f[2]){const I=.5*w;let U=A[0]-f[0]>I?-w:f[0]-A[0]>I?w:0;U===0&&(U=A[0]-f[2]>I?-w:f[2]-A[0]>I?w:0),A[0]+=U}Mr(l,A)}function qs(A,l,f,w){const I=Math.pow(2,w.z)*mr,U=[w.x*mr,w.y*mr],N=[];for(const Z of A)for(const re of Z){const ge=[re.x+U[0],re.y+U[1]];ll(ge,l,f,I),N.push(ge)}return N}function cs(A,l,f,w){const I=Math.pow(2,w.z)*mr,U=[w.x*mr,w.y*mr],N=[];for(const re of A){const ge=[];for(const Ce of re){const Ie=[Ce.x+U[0],Ce.y+U[1]];Mr(l,Ie),ge.push(Ie)}N.push(ge)}if(l[2]-l[0]<=I/2){(Z=l)[0]=Z[1]=1/0,Z[2]=Z[3]=-1/0;for(const re of N)for(const ge of re)ll(ge,l,f,I)}var Z;return N}class ho{constructor(l,f){this.type=Ot,this.geojson=l,this.geometries=f}static parse(l,f){if(l.length!==2)return f.error(`'within' expression requires exactly one argument, but found ${l.length-1} instead.`);if(jt(l[1])){const w=l[1];if(w.type==="FeatureCollection")for(let I=0;I<w.features.length;++I){const U=w.features[I].geometry.type;if(U==="Polygon"||U==="MultiPolygon")return new ho(w,w.features[I].geometry)}else if(w.type==="Feature"){const I=w.geometry.type;if(I==="Polygon"||I==="MultiPolygon")return new ho(w,w.geometry)}else if(w.type==="Polygon"||w.type==="MultiPolygon")return new ho(w,w)}return f.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(l){if(l.geometry()!=null&&l.canonicalID()!=null){if(l.geometryType()==="Point")return function(f,w){const I=[1/0,1/0,-1/0,-1/0],U=[1/0,1/0,-1/0,-1/0],N=f.canonicalID();if(w.type==="Polygon"){const Z=Ul(w.coordinates,U,N),re=qs(f.geometry(),I,U,N);if(!Oo(I,U))return!1;for(const ge of re)if(!rn(ge,Z))return!1}if(w.type==="MultiPolygon"){const Z=Rl(w.coordinates,U,N),re=qs(f.geometry(),I,U,N);if(!Oo(I,U))return!1;for(const ge of re)if(!cr(ge,Z))return!1}return!0}(l,this.geometries);if(l.geometryType()==="LineString")return function(f,w){const I=[1/0,1/0,-1/0,-1/0],U=[1/0,1/0,-1/0,-1/0],N=f.canonicalID();if(w.type==="Polygon"){const Z=Ul(w.coordinates,U,N),re=cs(f.geometry(),I,U,N);if(!Oo(I,U))return!1;for(const ge of re)if(!al(ge,Z))return!1}if(w.type==="MultiPolygon"){const Z=Rl(w.coordinates,U,N),re=cs(f.geometry(),I,U,N);if(!Oo(I,U))return!1;for(const ge of re)if(!dr(ge,Z))return!1}return!0}(l,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function cl(A){if(A instanceof Yn&&(A.name==="get"&&A.args.length===1||A.name==="feature-state"||A.name==="has"&&A.args.length===1||A.name==="properties"||A.name==="geometry-type"||A.name==="id"||/^filter-/.test(A.name))||A instanceof ho)return!1;let l=!0;return A.eachChild(f=>{l&&!cl(f)&&(l=!1)}),l}function Oa(A){if(A instanceof Yn&&A.name==="feature-state")return!1;let l=!0;return A.eachChild(f=>{l&&!Oa(f)&&(l=!1)}),l}function zl(A,l){if(A instanceof Yn&&l.indexOf(A.name)>=0)return!1;let f=!0;return A.eachChild(w=>{f&&!zl(w,l)&&(f=!1)}),f}class kl{constructor(l,f){this.type=f.type,this.name=l,this.boundExpression=f}static parse(l,f){if(l.length!==2||typeof l[1]!="string")return f.error("'var' expression requires exactly one string literal argument.");const w=l[1];return f.scope.has(w)?new kl(w,f.scope.get(w)):f.error(`Unknown variable "${w}". Make sure "${w}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}}class Ol{constructor(l,f=[],w,I=new Tn,U=[]){this.registry=l,this.path=f,this.key=f.map(N=>`[${N}]`).join(""),this.scope=I,this.errors=U,this.expectedType=w}parse(l,f,w,I,U={}){return f?this.concat(f,w,I)._parse(l,U):this._parse(l,U)}_parse(l,f){function w(I,U,N){return N==="assert"?new tn(U,[I]):N==="coerce"?new yn(U,[I]):I}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const I=l[0];if(typeof I!="string")return this.error(`Expression name must be a string, but found ${typeof I} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const U=this.registry[I];if(U){let N=U.parse(l,this);if(!N)return null;if(this.expectedType){const Z=this.expectedType,re=N.type;if(Z.kind!=="string"&&Z.kind!=="number"&&Z.kind!=="boolean"&&Z.kind!=="object"&&Z.kind!=="array"||re.kind!=="value")if(Z.kind!=="color"&&Z.kind!=="formatted"&&Z.kind!=="resolvedImage"||re.kind!=="value"&&re.kind!=="string")if(Z.kind!=="padding"||re.kind!=="value"&&re.kind!=="number"&&re.kind!=="array"){if(this.checkSubtype(Z,re))return null}else N=w(N,Z,f.typeAnnotation||"coerce");else N=w(N,Z,f.typeAnnotation||"coerce");else N=w(N,Z,f.typeAnnotation||"assert")}if(!(N instanceof bi)&&N.type.kind!=="resolvedImage"&&Na(N)){const Z=new sr;try{N=new bi(N.type,N.evaluate(Z))}catch(re){return this.error(re.message),null}}return N}return this.error(`Unknown expression "${I}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,f,w){const I=typeof l=="number"?this.path.concat(l):this.path,U=w?this.scope.concat(w):this.scope;return new Ol(this.registry,I,f||null,U,this.errors)}error(l,...f){const w=`${this.key}${f.map(I=>`[${I}]`).join("")}`;this.errors.push(new Cn(w,l))}checkSubtype(l,f){const w=ot(l,f);return w&&this.error(w),w}}function Na(A){if(A instanceof kl)return Na(A.boundExpression);if(A instanceof Yn&&A.name==="error"||A instanceof Wr||A instanceof ho)return!1;const l=A instanceof yn||A instanceof tn;let f=!0;return A.eachChild(w=>{f=l?f&&Na(w):f&&w instanceof bi}),!!f&&cl(A)&&zl(A,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Nl(A,l){const f=A.length-1;let w,I,U=0,N=f,Z=0;for(;U<=N;)if(Z=Math.floor((U+N)/2),w=A[Z],I=A[Z+1],w<=l){if(Z===f||l<I)return Z;U=Z+1}else{if(!(w>l))throw new Oi("Input is not a number.");N=Z-1}return 0}class Ql{constructor(l,f,w){this.type=l,this.input=f,this.labels=[],this.outputs=[];for(const[I,U]of w)this.labels.push(I),this.outputs.push(U)}static parse(l,f){if(l.length-1<4)return f.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return f.error("Expected an even number of arguments.");const w=f.parse(l[1],1,Ii);if(!w)return null;const I=[];let U=null;f.expectedType&&f.expectedType.kind!=="value"&&(U=f.expectedType);for(let N=1;N<l.length;N+=2){const Z=N===1?-1/0:l[N],re=l[N+1],ge=N,Ce=N+1;if(typeof Z!="number")return f.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ge);if(I.length&&I[I.length-1][0]>=Z)return f.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',ge);const Ie=f.parse(re,Ce,U);if(!Ie)return null;U=U||Ie.type,I.push([Z,Ie])}return new Ql(U,w,I)}evaluate(l){const f=this.labels,w=this.outputs;if(f.length===1)return w[0].evaluate(l);const I=this.input.evaluate(l);if(I<=f[0])return w[0].evaluate(l);const U=f.length;return I>=f[U-1]?w[U-1].evaluate(l):w[Nl(f,I)].evaluate(l)}eachChild(l){l(this.input);for(const f of this.outputs)l(f)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}}function is(A,l,f){return A*(1-f)+l*f}var Ys=Object.freeze({__proto__:null,number:is,color:function(A,l,f){return new de(is(A.r,l.r,f),is(A.g,l.g,f),is(A.b,l.b,f),is(A.a,l.a,f))},array:function(A,l,f){return A.map((w,I)=>is(w,l[I],f))},padding:function(A,l,f){const w=A.values,I=l.values;return new et([is(w[0],I[0],f),is(w[1],I[1],f),is(w[2],I[2],f),is(w[3],I[3],f)])}});const ps=.95047,Rc=1.08883,Eh=4/29,ks=6/29,No=3*ks*ks,JA=Math.PI/180,fu=180/Math.PI;function Bs(A){return A>.008856451679035631?Math.pow(A,1/3):A/No+Eh}function sc(A){return A>ks?A*A*A:No*(A-Eh)}function Th(A){return 255*(A<=.0031308?12.92*A:1.055*Math.pow(A,1/2.4)-.055)}function oc(A){return(A/=255)<=.04045?A/12.92:Math.pow((A+.055)/1.055,2.4)}function er(A){const l=oc(A.r),f=oc(A.g),w=oc(A.b),I=Bs((.4124564*l+.3575761*f+.1804375*w)/ps),U=Bs((.2126729*l+.7151522*f+.072175*w)/1);return{l:116*U-16,a:500*(I-U),b:200*(U-Bs((.0193339*l+.119192*f+.9503041*w)/Rc)),alpha:A.a}}function ac(A){let l=(A.l+16)/116,f=isNaN(A.a)?l:l+A.a/500,w=isNaN(A.b)?l:l-A.b/200;return l=1*sc(l),f=ps*sc(f),w=Rc*sc(w),new de(Th(3.2404542*f-1.5371385*l-.4985314*w),Th(-.969266*f+1.8760108*l+.041556*w),Th(.0556434*f-.2040259*l+1.0572252*w),A.alpha)}function Ju(A,l,f){const w=l-A;return A+f*(w>180||w<-180?w-360*Math.round(w/360):w)}const Qo={forward:er,reverse:ac,interpolate:function(A,l,f){return{l:is(A.l,l.l,f),a:is(A.a,l.a,f),b:is(A.b,l.b,f),alpha:is(A.alpha,l.alpha,f)}}},hl={forward:function(A){const{l,a:f,b:w}=er(A),I=Math.atan2(w,f)*fu;return{h:I<0?I+360:I,c:Math.sqrt(f*f+w*w),l,alpha:A.a}},reverse:function(A){const l=A.h*JA,f=A.c;return ac({l:A.l,a:Math.cos(l)*f,b:Math.sin(l)*f,alpha:A.alpha})},interpolate:function(A,l,f){return{h:Ju(A.h,l.h,f),c:is(A.c,l.c,f),l:is(A.l,l.l,f),alpha:is(A.alpha,l.alpha,f)}}};var Sh=Object.freeze({__proto__:null,lab:Qo,hcl:hl});class Vo{constructor(l,f,w,I,U){this.type=l,this.operator=f,this.interpolation=w,this.input=I,this.labels=[],this.outputs=[];for(const[N,Z]of U)this.labels.push(N),this.outputs.push(Z)}static interpolationFactor(l,f,w,I){let U=0;if(l.name==="exponential")U=Mh(f,l.base,w,I);else if(l.name==="linear")U=Mh(f,1,w,I);else if(l.name==="cubic-bezier"){const N=l.controlPoints;U=new C(N[0],N[1],N[2],N[3]).solve(Mh(f,1,w,I))}return U}static parse(l,f){let[w,I,U,...N]=l;if(!Array.isArray(I)||I.length===0)return f.error("Expected an interpolation type expression.",1);if(I[0]==="linear")I={name:"linear"};else if(I[0]==="exponential"){const ge=I[1];if(typeof ge!="number")return f.error("Exponential interpolation requires a numeric base.",1,1);I={name:"exponential",base:ge}}else{if(I[0]!=="cubic-bezier")return f.error(`Unknown interpolation type ${String(I[0])}`,1,0);{const ge=I.slice(1);if(ge.length!==4||ge.some(Ce=>typeof Ce!="number"||Ce<0||Ce>1))return f.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);I={name:"cubic-bezier",controlPoints:ge}}}if(l.length-1<4)return f.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return f.error("Expected an even number of arguments.");if(U=f.parse(U,2,Ii),!U)return null;const Z=[];let re=null;w==="interpolate-hcl"||w==="interpolate-lab"?re=wi:f.expectedType&&f.expectedType.kind!=="value"&&(re=f.expectedType);for(let ge=0;ge<N.length;ge+=2){const Ce=N[ge],Ie=N[ge+1],ke=ge+3,$e=ge+4;if(typeof Ce!="number")return f.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ke);if(Z.length&&Z[Z.length-1][0]>=Ce)return f.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',ke);const Ze=f.parse(Ie,$e,re);if(!Ze)return null;re=re||Ze.type,Z.push([Ce,Ze])}return re.kind==="number"||re.kind==="color"||re.kind==="padding"||re.kind==="array"&&re.itemType.kind==="number"&&typeof re.N=="number"?new Vo(re,w,I,U,Z):f.error(`Type ${Qn(re)} is not interpolatable.`)}evaluate(l){const f=this.labels,w=this.outputs;if(f.length===1)return w[0].evaluate(l);const I=this.input.evaluate(l);if(I<=f[0])return w[0].evaluate(l);const U=f.length;if(I>=f[U-1])return w[U-1].evaluate(l);const N=Nl(f,I),Z=Vo.interpolationFactor(this.interpolation,I,f[N],f[N+1]),re=w[N].evaluate(l),ge=w[N+1].evaluate(l);return this.operator==="interpolate"?Ys[this.type.kind.toLowerCase()](re,ge,Z):this.operator==="interpolate-hcl"?hl.reverse(hl.interpolate(hl.forward(re),hl.forward(ge),Z)):Qo.reverse(Qo.interpolate(Qo.forward(re),Qo.forward(ge),Z))}eachChild(l){l(this.input);for(const f of this.outputs)l(f)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}}function Mh(A,l,f,w){const I=w-f,U=A-f;return I===0?0:l===1?U/I:(Math.pow(l,U)-1)/(Math.pow(l,I)-1)}class Qa{constructor(l,f){this.type=l,this.args=f}static parse(l,f){if(l.length<2)return f.error("Expectected at least one argument.");let w=null;const I=f.expectedType;I&&I.kind!=="value"&&(w=I);const U=[];for(const Z of l.slice(1)){const re=f.parse(Z,1+U.length,w,void 0,{typeAnnotation:"omit"});if(!re)return null;w=w||re.type,U.push(re)}if(!w)throw new Error("No output type");const N=I&&U.some(Z=>ot(I,Z.type));return new Qa(N?Ui:w,U)}evaluate(l){let f,w=null,I=0;for(const U of this.args)if(I++,w=U.evaluate(l),w&&w instanceof pt&&!w.available&&(f||(f=w.name),w=null,I===this.args.length&&(w=f)),w!==null)break;return w}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}}class lc{constructor(l,f){this.type=f.type,this.bindings=[].concat(l),this.result=f}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(const f of this.bindings)l(f[1]);l(this.result)}static parse(l,f){if(l.length<4)return f.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);const w=[];for(let U=1;U<l.length-1;U+=2){const N=l[U];if(typeof N!="string")return f.error(`Expected string, but found ${typeof N} instead.`,U);if(/[^a-zA-Z0-9_]/.test(N))return f.error("Variable names must contain only alphanumeric characters or '_'.",U);const Z=f.parse(l[U+1],U+1);if(!Z)return null;w.push([N,Z])}const I=f.parse(l[l.length-1],l.length-1,f.expectedType,w);return I?new lc(w,I):null}outputDefined(){return this.result.outputDefined()}}class mu{constructor(l,f,w){this.type=l,this.index=f,this.input=w}static parse(l,f){if(l.length!==3)return f.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ii),I=f.parse(l[2],2,kr(f.expectedType||Ui));return w&&I?new mu(I.type.itemType,w,I):null}evaluate(l){const f=this.index.evaluate(l),w=this.input.evaluate(l);if(f<0)throw new Oi(`Array index out of bounds: ${f} < 0.`);if(f>=w.length)throw new Oi(`Array index out of bounds: ${f} > ${w.length-1}.`);if(f!==Math.floor(f))throw new Oi(`Array index must be an integer, but found ${f} instead.`);return w[f]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}}class Vl{constructor(l,f){this.type=Ot,this.needle=l,this.haystack=f}static parse(l,f){if(l.length!==3)return f.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ui),I=f.parse(l[2],2,Ui);return w&&I?Ee(w.type,[Ot,bn,Ii,nr,Ui])?new Vl(w,I):f.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(w.type)} instead`):null}evaluate(l){const f=this.needle.evaluate(l),w=this.haystack.evaluate(l);if(!w)return!1;if(!Pe(f,["boolean","string","number","null"]))throw new Oi(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(Wt(f))} instead.`);if(!Pe(w,["string","array"]))throw new Oi(`Expected second argument to be of type array or string, but found ${Qn(Wt(w))} instead.`);return w.indexOf(f)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}}class ya{constructor(l,f,w){this.type=Ii,this.needle=l,this.haystack=f,this.fromIndex=w}static parse(l,f){if(l.length<=2||l.length>=5)return f.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ui),I=f.parse(l[2],2,Ui);if(!w||!I)return null;if(!Ee(w.type,[Ot,bn,Ii,nr,Ui]))return f.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(w.type)} instead`);if(l.length===4){const U=f.parse(l[3],3,Ii);return U?new ya(w,I,U):null}return new ya(w,I)}evaluate(l){const f=this.needle.evaluate(l),w=this.haystack.evaluate(l);if(!Pe(f,["boolean","string","number","null"]))throw new Oi(`Expected first argument to be of type boolean, string, number or null, but found ${Qn(Wt(f))} instead.`);if(!Pe(w,["string","array"]))throw new Oi(`Expected second argument to be of type array or string, but found ${Qn(Wt(w))} instead.`);if(this.fromIndex){const I=this.fromIndex.evaluate(l);return w.indexOf(f,I)}return w.indexOf(f)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}}class zc{constructor(l,f,w,I,U,N){this.inputType=l,this.type=f,this.input=w,this.cases=I,this.outputs=U,this.otherwise=N}static parse(l,f){if(l.length<5)return f.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return f.error("Expected an even number of arguments.");let w,I;f.expectedType&&f.expectedType.kind!=="value"&&(I=f.expectedType);const U={},N=[];for(let ge=2;ge<l.length-1;ge+=2){let Ce=l[ge];const Ie=l[ge+1];Array.isArray(Ce)||(Ce=[Ce]);const ke=f.concat(ge);if(Ce.length===0)return ke.error("Expected at least one branch label.");for(const Ze of Ce){if(typeof Ze!="number"&&typeof Ze!="string")return ke.error("Branch labels must be numbers or strings.");if(typeof Ze=="number"&&Math.abs(Ze)>Number.MAX_SAFE_INTEGER)return ke.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Ze=="number"&&Math.floor(Ze)!==Ze)return ke.error("Numeric branch labels must be integer values.");if(w){if(ke.checkSubtype(w,Wt(Ze)))return null}else w=Wt(Ze);if(U[String(Ze)]!==void 0)return ke.error("Branch labels must be unique.");U[String(Ze)]=N.length}const $e=f.parse(Ie,ge,I);if(!$e)return null;I=I||$e.type,N.push($e)}const Z=f.parse(l[1],1,Ui);if(!Z)return null;const re=f.parse(l[l.length-1],l.length-1,I);return re?Z.type.kind!=="value"&&f.concat(1).checkSubtype(w,Z.type)?null:new zc(w,I,Z,U,N,re):null}evaluate(l){const f=this.input.evaluate(l);return(Wt(f)===this.inputType&&this.outputs[this.cases[f]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every(l=>l.outputDefined())&&this.otherwise.outputDefined()}}class Ws{constructor(l,f,w){this.type=l,this.branches=f,this.otherwise=w}static parse(l,f){if(l.length<4)return f.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return f.error("Expected an odd number of arguments.");let w;f.expectedType&&f.expectedType.kind!=="value"&&(w=f.expectedType);const I=[];for(let N=1;N<l.length-1;N+=2){const Z=f.parse(l[N],N,Ot);if(!Z)return null;const re=f.parse(l[N+1],N+1,w);if(!re)return null;I.push([Z,re]),w=w||re.type}const U=f.parse(l[l.length-1],l.length-1,w);if(!U)return null;if(!w)throw new Error("Can't infer output type");return new Ws(w,I,U)}evaluate(l){for(const[f,w]of this.branches)if(f.evaluate(l))return w.evaluate(l);return this.otherwise.evaluate(l)}eachChild(l){for(const[f,w]of this.branches)l(f),l(w);l(this.otherwise)}outputDefined(){return this.branches.every(([l,f])=>f.outputDefined())&&this.otherwise.outputDefined()}}class cc{constructor(l,f,w,I){this.type=l,this.input=f,this.beginIndex=w,this.endIndex=I}static parse(l,f){if(l.length<=2||l.length>=5)return f.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const w=f.parse(l[1],1,Ui),I=f.parse(l[2],2,Ii);if(!w||!I)return null;if(!Ee(w.type,[kr(Ui),bn,Ui]))return f.error(`Expected first argument to be of type array or string, but found ${Qn(w.type)} instead`);if(l.length===4){const U=f.parse(l[3],3,Ii);return U?new cc(w.type,w,I,U):null}return new cc(w.type,w,I)}evaluate(l){const f=this.input.evaluate(l),w=this.beginIndex.evaluate(l);if(!Pe(f,["string","array"]))throw new Oi(`Expected first argument to be of type array or string, but found ${Qn(Wt(f))} instead.`);if(this.endIndex){const I=this.endIndex.evaluate(l);return f.slice(w,I)}return f.slice(w)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}}function kc(A,l){return A==="=="||A==="!="?l.kind==="boolean"||l.kind==="string"||l.kind==="number"||l.kind==="null"||l.kind==="value":l.kind==="string"||l.kind==="number"||l.kind==="value"}function eA(A,l,f,w){return w.compare(l,f)===0}function hc(A,l,f){const w=A!=="=="&&A!=="!=";return class PM{constructor(U,N,Z){this.type=Ot,this.lhs=U,this.rhs=N,this.collator=Z,this.hasUntypedArgument=U.type.kind==="value"||N.type.kind==="value"}static parse(U,N){if(U.length!==3&&U.length!==4)return N.error("Expected two or three arguments.");const Z=U[0];let re=N.parse(U[1],1,Ui);if(!re)return null;if(!kc(Z,re.type))return N.concat(1).error(`"${Z}" comparisons are not supported for type '${Qn(re.type)}'.`);let ge=N.parse(U[2],2,Ui);if(!ge)return null;if(!kc(Z,ge.type))return N.concat(2).error(`"${Z}" comparisons are not supported for type '${Qn(ge.type)}'.`);if(re.type.kind!==ge.type.kind&&re.type.kind!=="value"&&ge.type.kind!=="value")return N.error(`Cannot compare types '${Qn(re.type)}' and '${Qn(ge.type)}'.`);w&&(re.type.kind==="value"&&ge.type.kind!=="value"?re=new tn(ge.type,[re]):re.type.kind!=="value"&&ge.type.kind==="value"&&(ge=new tn(re.type,[ge])));let Ce=null;if(U.length===4){if(re.type.kind!=="string"&&ge.type.kind!=="string"&&re.type.kind!=="value"&&ge.type.kind!=="value")return N.error("Cannot use collator to compare non-string types.");if(Ce=N.parse(U[3],3,Pn),!Ce)return null}return new PM(re,ge,Ce)}evaluate(U){const N=this.lhs.evaluate(U),Z=this.rhs.evaluate(U);if(w&&this.hasUntypedArgument){const re=Wt(N),ge=Wt(Z);if(re.kind!==ge.kind||re.kind!=="string"&&re.kind!=="number")throw new Oi(`Expected arguments for "${A}" to be (string, string) or (number, number), but found (${re.kind}, ${ge.kind}) instead.`)}if(this.collator&&!w&&this.hasUntypedArgument){const re=Wt(N),ge=Wt(Z);if(re.kind!=="string"||ge.kind!=="string")return l(U,N,Z)}return this.collator?f(U,N,Z,this.collator.evaluate(U)):l(U,N,Z)}eachChild(U){U(this.lhs),U(this.rhs),this.collator&&U(this.collator)}outputDefined(){return!0}}}const gu=hc("==",function(A,l,f){return l===f},eA),ed=hc("!=",function(A,l,f){return l!==f},function(A,l,f,w){return!eA(0,l,f,w)}),_u=hc("<",function(A,l,f){return l<f},function(A,l,f,w){return w.compare(l,f)<0}),Ih=hc(">",function(A,l,f){return l>f},function(A,l,f,w){return w.compare(l,f)>0}),tA=hc("<=",function(A,l,f){return l<=f},function(A,l,f,w){return w.compare(l,f)<=0}),td=hc(">=",function(A,l,f){return l>=f},function(A,l,f,w){return w.compare(l,f)>=0});class uc{constructor(l,f,w,I,U){this.type=bn,this.number=l,this.locale=f,this.currency=w,this.minFractionDigits=I,this.maxFractionDigits=U}static parse(l,f){if(l.length!==3)return f.error("Expected two arguments.");const w=f.parse(l[1],1,Ii);if(!w)return null;const I=l[2];if(typeof I!="object"||Array.isArray(I))return f.error("NumberFormat options argument must be an object.");let U=null;if(I.locale&&(U=f.parse(I.locale,1,bn),!U))return null;let N=null;if(I.currency&&(N=f.parse(I.currency,1,bn),!N))return null;let Z=null;if(I["min-fraction-digits"]&&(Z=f.parse(I["min-fraction-digits"],1,Ii),!Z))return null;let re=null;return I["max-fraction-digits"]&&(re=f.parse(I["max-fraction-digits"],1,Ii),!re)?null:new uc(w,U,N,Z,re)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}}class Oc{constructor(l){this.type=qn,this.sections=l}static parse(l,f){if(l.length<2)return f.error("Expected at least one argument.");const w=l[1];if(!Array.isArray(w)&&typeof w=="object")return f.error("First argument must be an image or text section.");const I=[];let U=!1;for(let N=1;N<=l.length-1;++N){const Z=l[N];if(U&&typeof Z=="object"&&!Array.isArray(Z)){U=!1;let re=null;if(Z["font-scale"]&&(re=f.parse(Z["font-scale"],1,Ii),!re))return null;let ge=null;if(Z["text-font"]&&(ge=f.parse(Z["text-font"],1,kr(bn)),!ge))return null;let Ce=null;if(Z["text-color"]&&(Ce=f.parse(Z["text-color"],1,wi),!Ce))return null;const Ie=I[I.length-1];Ie.scale=re,Ie.font=ge,Ie.textColor=Ce}else{const re=f.parse(l[N],1,Ui);if(!re)return null;const ge=re.type.kind;if(ge!=="string"&&ge!=="value"&&ge!=="null"&&ge!=="resolvedImage")return f.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");U=!0,I.push({content:re,scale:null,font:null,textColor:null})}}return new Oc(I)}evaluate(l){return new He(this.sections.map(f=>{const w=f.content.evaluate(l);return Wt(w)===fr?new tt("",w,null,null,null):new tt(ki(w),null,f.scale?f.scale.evaluate(l):null,f.font?f.font.evaluate(l).join(","):null,f.textColor?f.textColor.evaluate(l):null)}))}eachChild(l){for(const f of this.sections)l(f.content),f.scale&&l(f.scale),f.font&&l(f.font),f.textColor&&l(f.textColor)}outputDefined(){return!1}}class ul{constructor(l){this.type=fr,this.input=l}static parse(l,f){if(l.length!==2)return f.error("Expected two arguments.");const w=f.parse(l[1],1,bn);return w?new ul(w):f.error("No image name provided.")}evaluate(l){const f=this.input.evaluate(l),w=pt.fromString(f);return w&&l.availableImages&&(w.available=l.availableImages.indexOf(f)>-1),w}eachChild(l){l(this.input)}outputDefined(){return!1}}class Ir{constructor(l){this.type=Ii,this.input=l}static parse(l,f){if(l.length!==2)return f.error(`Expected 1 argument, but found ${l.length-1} instead.`);const w=f.parse(l[1],1);return w?w.type.kind!=="array"&&w.type.kind!=="string"&&w.type.kind!=="value"?f.error(`Expected argument of type string or array, but found ${Qn(w.type)} instead.`):new Ir(w):null}evaluate(l){const f=this.input.evaluate(l);if(typeof f=="string"||Array.isArray(f))return f.length;throw new Oi(`Expected value to be of type string or array, but found ${Qn(Wt(f))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}}const Ac={"==":gu,"!=":ed,">":Ih,"<":_u,">=":td,"<=":tA,array:tn,at:mu,boolean:tn,case:Ws,coalesce:Qa,collator:Wr,format:Oc,image:ul,in:Vl,"index-of":ya,interpolate:Vo,"interpolate-hcl":Vo,"interpolate-lab":Vo,length:Ir,let:lc,literal:bi,match:zc,number:tn,"number-format":uc,object:tn,slice:cc,step:Ql,string:tn,"to-boolean":yn,"to-color":yn,"to-number":yn,"to-string":yn,var:kl,within:ho};function Nc(A,[l,f,w,I]){l=l.evaluate(A),f=f.evaluate(A),w=w.evaluate(A);const U=I?I.evaluate(A):1,N=Lt(l,f,w,U);if(N)throw new Oi(N);return new de(l/255*U,f/255*U,w/255*U,U)}function yu(A,l){return A in l}function Al(A,l){const f=l[A];return f===void 0?null:f}function Va(A){return{type:A}}function Qc(A){return{result:"success",value:A}}function dl(A){return{result:"error",value:A}}function qr(A){return A["property-type"]==="data-driven"||A["property-type"]==="cross-faded-data-driven"}function Fh(A){return!!A.expression&&A.expression.parameters.indexOf("zoom")>-1}function hr(A){return!!A.expression&&A.expression.interpolated}function Br(A){return A instanceof Number?"number":A instanceof String?"string":A instanceof Boolean?"boolean":Array.isArray(A)?"array":A===null?"null":typeof A}function jr(A){return typeof A=="object"&&A!==null&&!Array.isArray(A)}function $r(A){return A}function Hl(A,l){const f=l.type==="color",w=A.stops&&typeof A.stops[0][0]=="object",I=w||!(w||A.property!==void 0),U=A.type||(hr(l)?"exponential":"interval");if(f||l.type==="padding"){const ge=f?de.parse:et.parse;(A=hn({},A)).stops&&(A.stops=A.stops.map(Ce=>[Ce[0],ge(Ce[1])])),A.default=ge(A.default?A.default:l.default)}if(A.colorSpace&&A.colorSpace!=="rgb"&&!Sh[A.colorSpace])throw new Error(`Unknown color space: ${A.colorSpace}`);let N,Z,re;if(U==="exponential")N=nA;else if(U==="interval")N=iA;else if(U==="categorical"){N=xu,Z=Object.create(null);for(const ge of A.stops)Z[ge[0]]=ge[1];re=typeof A.stops[0][0]}else{if(U!=="identity")throw new Error(`Unknown function type "${U}"`);N=rA}if(w){const ge={},Ce=[];for(let $e=0;$e<A.stops.length;$e++){const Ze=A.stops[$e],Rt=Ze[0].zoom;ge[Rt]===void 0&&(ge[Rt]={zoom:Rt,type:A.type,property:A.property,default:A.default,stops:[]},Ce.push(Rt)),ge[Rt].stops.push([Ze[0].value,Ze[1]])}const Ie=[];for(const $e of Ce)Ie.push([ge[$e].zoom,Hl(ge[$e],l)]);const ke={name:"linear"};return{kind:"composite",interpolationType:ke,interpolationFactor:Vo.interpolationFactor.bind(void 0,ke),zoomStops:Ie.map($e=>$e[0]),evaluate:({zoom:$e},Ze)=>nA({stops:Ie,base:A.base},l,$e).evaluate($e,Ze)}}if(I){const ge=U==="exponential"?{name:"exponential",base:A.base!==void 0?A.base:1}:null;return{kind:"camera",interpolationType:ge,interpolationFactor:Vo.interpolationFactor.bind(void 0,ge),zoomStops:A.stops.map(Ce=>Ce[0]),evaluate:({zoom:Ce})=>N(A,l,Ce,Z,re)}}return{kind:"source",evaluate(ge,Ce){const Ie=Ce&&Ce.properties?Ce.properties[A.property]:void 0;return Ie===void 0?gr(A.default,l.default):N(A,l,Ie,Z,re)}}}function gr(A,l,f){return A!==void 0?A:l!==void 0?l:f!==void 0?f:void 0}function xu(A,l,f,w,I){return gr(typeof f===I?w[f]:void 0,A.default,l.default)}function iA(A,l,f){if(Br(f)!=="number")return gr(A.default,l.default);const w=A.stops.length;if(w===1||f<=A.stops[0][0])return A.stops[0][1];if(f>=A.stops[w-1][0])return A.stops[w-1][1];const I=Nl(A.stops.map(U=>U[0]),f);return A.stops[I][1]}function nA(A,l,f){const w=A.base!==void 0?A.base:1;if(Br(f)!=="number")return gr(A.default,l.default);const I=A.stops.length;if(I===1||f<=A.stops[0][0])return A.stops[0][1];if(f>=A.stops[I-1][0])return A.stops[I-1][1];const U=Nl(A.stops.map(Ce=>Ce[0]),f),N=function(Ce,Ie,ke,$e){const Ze=$e-ke,Rt=Ce-ke;return Ze===0?0:Ie===1?Rt/Ze:(Math.pow(Ie,Rt)-1)/(Math.pow(Ie,Ze)-1)}(f,w,A.stops[U][0],A.stops[U+1][0]),Z=A.stops[U][1],re=A.stops[U+1][1];let ge=Ys[l.type]||$r;if(A.colorSpace&&A.colorSpace!=="rgb"){const Ce=Sh[A.colorSpace];ge=(Ie,ke)=>Ce.reverse(Ce.interpolate(Ce.forward(Ie),Ce.forward(ke),N))}return typeof Z.evaluate=="function"?{evaluate(...Ce){const Ie=Z.evaluate.apply(void 0,Ce),ke=re.evaluate.apply(void 0,Ce);if(Ie!==void 0&&ke!==void 0)return ge(Ie,ke,N)}}:ge(Z,re,N)}function rA(A,l,f){switch(l.type){case"color":f=de.parse(f);break;case"formatted":f=He.fromString(f.toString());break;case"resolvedImage":f=pt.fromString(f.toString());break;case"padding":f=et.parse(f);break;default:Br(f)===l.type||l.type==="enum"&&l.values[f]||(f=void 0)}return gr(f,A.default,l.default)}Yn.register(Ac,{error:[{kind:"error"},[bn],(A,[l])=>{throw new Oi(l.evaluate(A))}],typeof:[bn,[Ui],(A,[l])=>Qn(Wt(l.evaluate(A)))],"to-rgba":[kr(Ii,4),[wi],(A,[l])=>l.evaluate(A).toArray()],rgb:[wi,[Ii,Ii,Ii],Nc],rgba:[wi,[Ii,Ii,Ii,Ii],Nc],has:{type:Ot,overloads:[[[bn],(A,[l])=>yu(l.evaluate(A),A.properties())],[[bn,Wi],(A,[l,f])=>yu(l.evaluate(A),f.evaluate(A))]]},get:{type:Ui,overloads:[[[bn],(A,[l])=>Al(l.evaluate(A),A.properties())],[[bn,Wi],(A,[l,f])=>Al(l.evaluate(A),f.evaluate(A))]]},"feature-state":[Ui,[bn],(A,[l])=>Al(l.evaluate(A),A.featureState||{})],properties:[Wi,[],A=>A.properties()],"geometry-type":[bn,[],A=>A.geometryType()],id:[Ui,[],A=>A.id()],zoom:[Ii,[],A=>A.globals.zoom],"heatmap-density":[Ii,[],A=>A.globals.heatmapDensity||0],"line-progress":[Ii,[],A=>A.globals.lineProgress||0],accumulated:[Ui,[],A=>A.globals.accumulated===void 0?null:A.globals.accumulated],"+":[Ii,Va(Ii),(A,l)=>{let f=0;for(const w of l)f+=w.evaluate(A);return f}],"*":[Ii,Va(Ii),(A,l)=>{let f=1;for(const w of l)f*=w.evaluate(A);return f}],"-":{type:Ii,overloads:[[[Ii,Ii],(A,[l,f])=>l.evaluate(A)-f.evaluate(A)],[[Ii],(A,[l])=>-l.evaluate(A)]]},"/":[Ii,[Ii,Ii],(A,[l,f])=>l.evaluate(A)/f.evaluate(A)],"%":[Ii,[Ii,Ii],(A,[l,f])=>l.evaluate(A)%f.evaluate(A)],ln2:[Ii,[],()=>Math.LN2],pi:[Ii,[],()=>Math.PI],e:[Ii,[],()=>Math.E],"^":[Ii,[Ii,Ii],(A,[l,f])=>Math.pow(l.evaluate(A),f.evaluate(A))],sqrt:[Ii,[Ii],(A,[l])=>Math.sqrt(l.evaluate(A))],log10:[Ii,[Ii],(A,[l])=>Math.log(l.evaluate(A))/Math.LN10],ln:[Ii,[Ii],(A,[l])=>Math.log(l.evaluate(A))],log2:[Ii,[Ii],(A,[l])=>Math.log(l.evaluate(A))/Math.LN2],sin:[Ii,[Ii],(A,[l])=>Math.sin(l.evaluate(A))],cos:[Ii,[Ii],(A,[l])=>Math.cos(l.evaluate(A))],tan:[Ii,[Ii],(A,[l])=>Math.tan(l.evaluate(A))],asin:[Ii,[Ii],(A,[l])=>Math.asin(l.evaluate(A))],acos:[Ii,[Ii],(A,[l])=>Math.acos(l.evaluate(A))],atan:[Ii,[Ii],(A,[l])=>Math.atan(l.evaluate(A))],min:[Ii,Va(Ii),(A,l)=>Math.min(...l.map(f=>f.evaluate(A)))],max:[Ii,Va(Ii),(A,l)=>Math.max(...l.map(f=>f.evaluate(A)))],abs:[Ii,[Ii],(A,[l])=>Math.abs(l.evaluate(A))],round:[Ii,[Ii],(A,[l])=>{const f=l.evaluate(A);return f<0?-Math.round(-f):Math.round(f)}],floor:[Ii,[Ii],(A,[l])=>Math.floor(l.evaluate(A))],ceil:[Ii,[Ii],(A,[l])=>Math.ceil(l.evaluate(A))],"filter-==":[Ot,[bn,Ui],(A,[l,f])=>A.properties()[l.value]===f.value],"filter-id-==":[Ot,[Ui],(A,[l])=>A.id()===l.value],"filter-type-==":[Ot,[bn],(A,[l])=>A.geometryType()===l.value],"filter-<":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w<I}],"filter-id-<":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f<w}],"filter->":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w>I}],"filter-id->":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f>w}],"filter-<=":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w<=I}],"filter-id-<=":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f<=w}],"filter->=":[Ot,[bn,Ui],(A,[l,f])=>{const w=A.properties()[l.value],I=f.value;return typeof w==typeof I&&w>=I}],"filter-id->=":[Ot,[Ui],(A,[l])=>{const f=A.id(),w=l.value;return typeof f==typeof w&&f>=w}],"filter-has":[Ot,[Ui],(A,[l])=>l.value in A.properties()],"filter-has-id":[Ot,[],A=>A.id()!==null&&A.id()!==void 0],"filter-type-in":[Ot,[kr(bn)],(A,[l])=>l.value.indexOf(A.geometryType())>=0],"filter-id-in":[Ot,[kr(Ui)],(A,[l])=>l.value.indexOf(A.id())>=0],"filter-in-small":[Ot,[bn,kr(Ui)],(A,[l,f])=>f.value.indexOf(A.properties()[l.value])>=0],"filter-in-large":[Ot,[bn,kr(Ui)],(A,[l,f])=>function(w,I,U,N){for(;U<=N;){const Z=U+N>>1;if(I[Z]===w)return!0;I[Z]>w?N=Z-1:U=Z+1}return!1}(A.properties()[l.value],f.value,0,f.value.length-1)],all:{type:Ot,overloads:[[[Ot,Ot],(A,[l,f])=>l.evaluate(A)&&f.evaluate(A)],[Va(Ot),(A,l)=>{for(const f of l)if(!f.evaluate(A))return!1;return!0}]]},any:{type:Ot,overloads:[[[Ot,Ot],(A,[l,f])=>l.evaluate(A)||f.evaluate(A)],[Va(Ot),(A,l)=>{for(const f of l)if(f.evaluate(A))return!0;return!1}]]},"!":[Ot,[Ot],(A,[l])=>!l.evaluate(A)],"is-supported-script":[Ot,[bn],(A,[l])=>{const f=A.globals&&A.globals.isSupportedScript;return!f||f(l.evaluate(A))}],upcase:[bn,[bn],(A,[l])=>l.evaluate(A).toUpperCase()],downcase:[bn,[bn],(A,[l])=>l.evaluate(A).toLowerCase()],concat:[bn,Va(Ui),(A,l)=>l.map(f=>ki(f.evaluate(A))).join("")],"resolved-locale":[bn,[Pn],(A,[l])=>l.evaluate(A).resolvedLocale()]});class dc{constructor(l,f){this.expression=l,this._warningHistory={},this._evaluator=new sr,this._defaultValue=f?function(w){return w.type==="color"&&jr(w.default)?new de(0,0,0,0):w.type==="color"?de.parse(w.default)||null:w.type==="padding"?et.parse(w.default)||null:w.default===void 0?null:w.default}(f):null,this._enumValues=f&&f.type==="enum"?f.values:null}evaluateWithoutErrorHandling(l,f,w,I,U,N){return this._evaluator.globals=l,this._evaluator.feature=f,this._evaluator.featureState=w,this._evaluator.canonical=I,this._evaluator.availableImages=U||null,this._evaluator.formattedSection=N,this.expression.evaluate(this._evaluator)}evaluate(l,f,w,I,U,N){this._evaluator.globals=l,this._evaluator.feature=f||null,this._evaluator.featureState=w||null,this._evaluator.canonical=I,this._evaluator.availableImages=U||null,this._evaluator.formattedSection=N||null;try{const Z=this.expression.evaluate(this._evaluator);if(Z==null||typeof Z=="number"&&Z!=Z)return this._defaultValue;if(this._enumValues&&!(Z in this._enumValues))throw new Oi(`Expected value to be one of ${Object.keys(this._enumValues).map(re=>JSON.stringify(re)).join(", ")}, but found ${JSON.stringify(Z)} instead.`);return Z}catch(Z){return this._warningHistory[Z.message]||(this._warningHistory[Z.message]=!0,typeof console<"u"&&console.warn(Z.message)),this._defaultValue}}}function Vc(A){return Array.isArray(A)&&A.length>0&&typeof A[0]=="string"&&A[0]in Ac}function Hc(A,l){const f=new Ol(Ac,[],l?function(I){const U={color:wi,string:bn,number:Ii,enum:bn,boolean:Ot,formatted:qn,padding:Hr,resolvedImage:fr};return I.type==="array"?kr(U[I.value]||Ui,I.length):U[I.type]}(l):void 0),w=f.parse(A,void 0,void 0,void 0,l&&l.type==="string"?{typeAnnotation:"coerce"}:void 0);return w?Qc(new dc(w,l)):dl(f.errors)}class Lh{constructor(l,f){this.kind=l,this._styleExpression=f,this.isStateDependent=l!=="constant"&&!Oa(f.expression)}evaluateWithoutErrorHandling(l,f,w,I,U,N){return this._styleExpression.evaluateWithoutErrorHandling(l,f,w,I,U,N)}evaluate(l,f,w,I,U,N){return this._styleExpression.evaluate(l,f,w,I,U,N)}}class Gc{constructor(l,f,w,I){this.kind=l,this.zoomStops=w,this._styleExpression=f,this.isStateDependent=l!=="camera"&&!Oa(f.expression),this.interpolationType=I}evaluateWithoutErrorHandling(l,f,w,I,U,N){return this._styleExpression.evaluateWithoutErrorHandling(l,f,w,I,U,N)}evaluate(l,f,w,I,U,N){return this._styleExpression.evaluate(l,f,w,I,U,N)}interpolationFactor(l,f,w){return this.interpolationType?Vo.interpolationFactor(this.interpolationType,l,f,w):0}}function Dh(A,l){const f=Hc(A,l);if(f.result==="error")return f;const w=f.value.expression,I=cl(w);if(!I&&!qr(l))return dl([new Cn("","data expressions not supported")]);const U=zl(w,["zoom"]);if(!U&&!Fh(l))return dl([new Cn("","zoom expressions not supported")]);const N=jc(w);return N||U?N instanceof Cn?dl([N]):N instanceof Vo&&!hr(l)?dl([new Cn("",'"interpolate" expressions cannot be used with this property')]):Qc(N?new Gc(I?"camera":"composite",f.value,N.labels,N instanceof Vo?N.interpolation:void 0):new Lh(I?"constant":"source",f.value)):dl([new Cn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wc{constructor(l,f){this._parameters=l,this._specification=f,hn(this,Hl(this._parameters,this._specification))}static deserialize(l){return new Wc(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function jc(A){let l=null;if(A instanceof lc)l=jc(A.result);else if(A instanceof Qa){for(const f of A.args)if(l=jc(f),l)break}else(A instanceof Ql||A instanceof Vo)&&A.input instanceof Yn&&A.input.name==="zoom"&&(l=A);return l instanceof Cn||A.eachChild(f=>{const w=jc(f);w instanceof Cn?l=w:!l&&w?l=new Cn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):l&&w&&l!==w&&(l=new Cn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),l}function la(A){const l=A.key,f=A.value,w=A.valueSpec||{},I=A.objectElementValidators||{},U=A.style,N=A.styleSpec;let Z=[];const re=Br(f);if(re!=="object")return[new at(l,f,`object expected, ${re} found`)];for(const ge in f){const Ce=ge.split(".")[0],Ie=w[Ce]||w["*"];let ke;if(I[Ce])ke=I[Ce];else if(w[Ce])ke=Mo;else if(I["*"])ke=I["*"];else{if(!w["*"]){Z.push(new at(l,f[ge],`unknown property "${ge}"`));continue}ke=Mo}Z=Z.concat(ke({key:(l&&`${l}.`)+ge,value:f[ge],valueSpec:Ie,style:U,styleSpec:N,object:f,objectKey:ge},f))}for(const ge in w)I[ge]||w[ge].required&&w[ge].default===void 0&&f[ge]===void 0&&Z.push(new at(l,f,`missing required property "${ge}"`));return Z}function sA(A){const l=A.value,f=A.valueSpec,w=A.style,I=A.styleSpec,U=A.key,N=A.arrayElementValidator||Mo;if(Br(l)!=="array")return[new at(U,l,`array expected, ${Br(l)} found`)];if(f.length&&l.length!==f.length)return[new at(U,l,`array length ${f.length} expected, length ${l.length} found`)];if(f["min-length"]&&l.length<f["min-length"])return[new at(U,l,`array length at least ${f["min-length"]} expected, length ${l.length} found`)];let Z={type:f.value,values:f.values};I.$version<7&&(Z.function=f.function),Br(f.value)==="object"&&(Z=f.value);let re=[];for(let ge=0;ge<l.length;ge++)re=re.concat(N({array:l,arrayIndex:ge,value:l[ge],valueSpec:Z,style:w,styleSpec:I,key:`${U}[${ge}]`}));return re}function oA(A){const l=A.key,f=A.value,w=A.valueSpec;let I=Br(f);return I==="number"&&f!=f&&(I="NaN"),I!=="number"?[new at(l,f,`number expected, ${I} found`)]:"minimum"in w&&f<w.minimum?[new at(l,f,`${f} is less than the minimum value ${w.minimum}`)]:"maximum"in w&&f>w.maximum?[new at(l,f,`${f} is greater than the maximum value ${w.maximum}`)]:[]}function Kc(A){const l=A.valueSpec,f=Xi(A.value.type);let w,I,U,N={};const Z=f!=="categorical"&&A.value.property===void 0,re=!Z,ge=Br(A.value.stops)==="array"&&Br(A.value.stops[0])==="array"&&Br(A.value.stops[0][0])==="object",Ce=la({key:A.key,value:A.value,valueSpec:A.styleSpec.function,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{stops:function($e){if(f==="identity")return[new at($e.key,$e.value,'identity function may not have a "stops" property')];let Ze=[];const Rt=$e.value;return Ze=Ze.concat(sA({key:$e.key,value:Rt,valueSpec:$e.valueSpec,style:$e.style,styleSpec:$e.styleSpec,arrayElementValidator:Ie})),Br(Rt)==="array"&&Rt.length===0&&Ze.push(new at($e.key,Rt,"array must have at least one stop")),Ze},default:function($e){return Mo({key:$e.key,value:$e.value,valueSpec:l,style:$e.style,styleSpec:$e.styleSpec})}}});return f==="identity"&&Z&&Ce.push(new at(A.key,A.value,'missing required property "property"')),f==="identity"||A.value.stops||Ce.push(new at(A.key,A.value,'missing required property "stops"')),f==="exponential"&&A.valueSpec.expression&&!hr(A.valueSpec)&&Ce.push(new at(A.key,A.value,"exponential functions not supported")),A.styleSpec.$version>=8&&(re&&!qr(A.valueSpec)?Ce.push(new at(A.key,A.value,"property functions not supported")):Z&&!Fh(A.valueSpec)&&Ce.push(new at(A.key,A.value,"zoom functions not supported"))),f!=="categorical"&&!ge||A.value.property!==void 0||Ce.push(new at(A.key,A.value,'"property" property is required')),Ce;function Ie($e){let Ze=[];const Rt=$e.value,Mt=$e.key;if(Br(Rt)!=="array")return[new at(Mt,Rt,`array expected, ${Br(Rt)} found`)];if(Rt.length!==2)return[new at(Mt,Rt,`array length 2 expected, length ${Rt.length} found`)];if(ge){if(Br(Rt[0])!=="object")return[new at(Mt,Rt,`object expected, ${Br(Rt[0])} found`)];if(Rt[0].zoom===void 0)return[new at(Mt,Rt,"object stop key must have zoom")];if(Rt[0].value===void 0)return[new at(Mt,Rt,"object stop key must have value")];if(U&&U>Xi(Rt[0].zoom))return[new at(Mt,Rt[0].zoom,"stop zoom values must appear in ascending order")];Xi(Rt[0].zoom)!==U&&(U=Xi(Rt[0].zoom),I=void 0,N={}),Ze=Ze.concat(la({key:`${Mt}[0]`,value:Rt[0],valueSpec:{zoom:{}},style:$e.style,styleSpec:$e.styleSpec,objectElementValidators:{zoom:oA,value:ke}}))}else Ze=Ze.concat(ke({key:`${Mt}[0]`,value:Rt[0],valueSpec:{},style:$e.style,styleSpec:$e.styleSpec},Rt));return Vc(on(Rt[1]))?Ze.concat([new at(`${Mt}[1]`,Rt[1],"expressions are not allowed in function stops.")]):Ze.concat(Mo({key:`${Mt}[1]`,value:Rt[1],valueSpec:l,style:$e.style,styleSpec:$e.styleSpec}))}function ke($e,Ze){const Rt=Br($e.value),Mt=Xi($e.value),ri=$e.value!==null?$e.value:Ze;if(w){if(Rt!==w)return[new at($e.key,ri,`${Rt} stop domain type must match previous stop domain type ${w}`)]}else w=Rt;if(Rt!=="number"&&Rt!=="string"&&Rt!=="boolean")return[new at($e.key,ri,"stop domain value must be a number, string, or boolean")];if(Rt!=="number"&&f!=="categorical"){let mi=`number expected, ${Rt} found`;return qr(l)&&f===void 0&&(mi+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at($e.key,ri,mi)]}return f!=="categorical"||Rt!=="number"||isFinite(Mt)&&Math.floor(Mt)===Mt?f!=="categorical"&&Rt==="number"&&I!==void 0&&Mt<I?[new at($e.key,ri,"stop domain values must appear in ascending order")]:(I=Mt,f==="categorical"&&Mt in N?[new at($e.key,ri,"stop domain values must be unique")]:(N[Mt]=!0,[])):[new at($e.key,ri,`integer expected, found ${Mt}`)]}}function ca(A){const l=(A.expressionContext==="property"?Dh:Hc)(on(A.value),A.valueSpec);if(l.result==="error")return l.value.map(w=>new at(`${A.key}${w.key}`,A.value,w.message));const f=l.value.expression||l.value._styleExpression.expression;if(A.expressionContext==="property"&&A.propertyKey==="text-font"&&!f.outputDefined())return[new at(A.key,A.value,`Invalid data expression for "${A.propertyKey}". Output values must be contained as literals within the expression.`)];if(A.expressionContext==="property"&&A.propertyType==="layout"&&!Oa(f))return[new at(A.key,A.value,'"feature-state" data expressions are not supported with layout properties.')];if(A.expressionContext==="filter"&&!Oa(f))return[new at(A.key,A.value,'"feature-state" data expressions are not supported with filters.')];if(A.expressionContext&&A.expressionContext.indexOf("cluster")===0){if(!zl(f,["zoom","feature-state"]))return[new at(A.key,A.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(A.expressionContext==="cluster-initial"&&!cl(f))return[new at(A.key,A.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function $c(A){const l=A.key,f=A.value,w=A.valueSpec,I=[];return Array.isArray(w.values)?w.values.indexOf(Xi(f))===-1&&I.push(new at(l,f,`expected one of [${w.values.join(", ")}], ${JSON.stringify(f)} found`)):Object.keys(w.values).indexOf(Xi(f))===-1&&I.push(new at(l,f,`expected one of [${Object.keys(w.values).join(", ")}], ${JSON.stringify(f)} found`)),I}function pl(A){if(A===!0||A===!1)return!0;if(!Array.isArray(A)||A.length===0)return!1;switch(A[0]){case"has":return A.length>=2&&A[1]!=="$id"&&A[1]!=="$type";case"in":return A.length>=3&&(typeof A[1]!="string"||Array.isArray(A[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return A.length!==3||Array.isArray(A[1])||Array.isArray(A[2]);case"any":case"all":for(const l of A.slice(1))if(!pl(l)&&typeof l!="boolean")return!1;return!0;default:return!0}}const aA={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ho(A){if(A==null)return{filter:()=>!0,needGeometry:!1};pl(A)||(A=Gl(A));const l=Hc(A,aA);if(l.result==="error")throw new Error(l.value.map(f=>`${f.key}: ${f.message}`).join(", "));return{filter:(f,w,I)=>l.value.evaluate(f,w,{},I),needGeometry:vu(A)}}function Ph(A,l){return A<l?-1:A>l?1:0}function vu(A){if(!Array.isArray(A))return!1;if(A[0]==="within")return!0;for(let l=1;l<A.length;l++)if(vu(A[l]))return!0;return!1}function Gl(A){if(!A)return!0;const l=A[0];return A.length<=1?l!=="any":l==="=="?wu(A[1],A[2],"=="):l==="!="?fl(wu(A[1],A[2],"==")):l==="<"||l===">"||l==="<="||l===">="?wu(A[1],A[2],l):l==="any"?(f=A.slice(1),["any"].concat(f.map(Gl))):l==="all"?["all"].concat(A.slice(1).map(Gl)):l==="none"?["all"].concat(A.slice(1).map(Gl).map(fl)):l==="in"?Zc(A[1],A.slice(2)):l==="!in"?fl(Zc(A[1],A.slice(2))):l==="has"?Xc(A[1]):l==="!has"?fl(Xc(A[1])):l!=="within"||A;var f}function wu(A,l,f){switch(A){case"$type":return[`filter-type-${f}`,l];case"$id":return[`filter-id-${f}`,l];default:return[`filter-${f}`,A,l]}}function Zc(A,l){if(l.length===0)return!1;switch(A){case"$type":return["filter-type-in",["literal",l]];case"$id":return["filter-id-in",["literal",l]];default:return l.length>200&&!l.some(f=>typeof f!=typeof l[0])?["filter-in-large",A,["literal",l.sort(Ph)]]:["filter-in-small",A,["literal",l]]}}function Xc(A){switch(A){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",A]}}function fl(A){return["!",A]}function qc(A){return pl(on(A.value))?ca(hn({},A,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Uh(A)}function Uh(A){const l=A.value,f=A.key;if(Br(l)!=="array")return[new at(f,l,`array expected, ${Br(l)} found`)];const w=A.styleSpec;let I,U=[];if(l.length<1)return[new at(f,l,"filter array must have at least 1 element")];switch(U=U.concat($c({key:`${f}[0]`,value:l[0],valueSpec:w.filter_operator,style:A.style,styleSpec:A.styleSpec})),Xi(l[0])){case"<":case"<=":case">":case">=":l.length>=2&&Xi(l[1])==="$type"&&U.push(new at(f,l,`"$type" cannot be use with operator "${l[0]}"`));case"==":case"!=":l.length!==3&&U.push(new at(f,l,`filter array for operator "${l[0]}" must have 3 elements`));case"in":case"!in":l.length>=2&&(I=Br(l[1]),I!=="string"&&U.push(new at(`${f}[1]`,l[1],`string expected, ${I} found`)));for(let N=2;N<l.length;N++)I=Br(l[N]),Xi(l[1])==="$type"?U=U.concat($c({key:`${f}[${N}]`,value:l[N],valueSpec:w.geometry_type,style:A.style,styleSpec:A.styleSpec})):I!=="string"&&I!=="number"&&I!=="boolean"&&U.push(new at(`${f}[${N}]`,l[N],`string, number, or boolean expected, ${I} found`));break;case"any":case"all":case"none":for(let N=1;N<l.length;N++)U=U.concat(Uh({key:`${f}[${N}]`,value:l[N],style:A.style,styleSpec:A.styleSpec}));break;case"has":case"!has":I=Br(l[1]),l.length!==2?U.push(new at(f,l,`filter array for "${l[0]}" operator must have 2 elements`)):I!=="string"&&U.push(new at(`${f}[1]`,l[1],`string expected, ${I} found`));break;case"within":I=Br(l[1]),l.length!==2?U.push(new at(f,l,`filter array for "${l[0]}" operator must have 2 elements`)):I!=="object"&&U.push(new at(`${f}[1]`,l[1],`object expected, ${I} found`))}return U}function Rh(A,l){const f=A.key,w=A.style,I=A.styleSpec,U=A.value,N=A.objectKey,Z=I[`${l}_${A.layerType}`];if(!Z)return[];const re=N.match(/^(.*)-transition$/);if(l==="paint"&&re&&Z[re[1]]&&Z[re[1]].transition)return Mo({key:f,value:U,valueSpec:I.transition,style:w,styleSpec:I});const ge=A.valueSpec||Z[N];if(!ge)return[new at(f,U,`unknown property "${N}"`)];let Ce;if(Br(U)==="string"&&qr(ge)&&!ge.tokens&&(Ce=/^{([^}]+)}$/.exec(U)))return[new at(f,U,`"${N}" does not support interpolation syntax
  21. Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(Ce[1])} }\`.`)];const Ie=[];return A.layerType==="symbol"&&(N==="text-field"&&w&&!w.glyphs&&Ie.push(new at(f,U,'use of "text-field" requires a style "glyphs" property')),N==="text-font"&&jr(on(U))&&Xi(U.type)==="identity"&&Ie.push(new at(f,U,'"text-font" does not support identity functions'))),Ie.concat(Mo({key:A.key,value:U,valueSpec:ge,style:w,styleSpec:I,expressionContext:"property",propertyType:l,propertyKey:N}))}function bu(A){return Rh(A,"paint")}function id(A){return Rh(A,"layout")}function pc(A){let l=[];const f=A.value,w=A.key,I=A.style,U=A.styleSpec;f.type||f.ref||l.push(new at(w,f,'either "type" or "ref" is required'));let N=Xi(f.type);const Z=Xi(f.ref);if(f.id){const re=Xi(f.id);for(let ge=0;ge<A.arrayIndex;ge++){const Ce=I.layers[ge];Xi(Ce.id)===re&&l.push(new at(w,f.id,`duplicate layer id "${f.id}", previously used at line ${Ce.id.__line__}`))}}if("ref"in f){let re;["type","source","source-layer","filter","layout"].forEach(ge=>{ge in f&&l.push(new at(w,f[ge],`"${ge}" is prohibited for ref layers`))}),I.layers.forEach(ge=>{Xi(ge.id)===Z&&(re=ge)}),re?re.ref?l.push(new at(w,f.ref,"ref cannot reference another ref layer")):N=Xi(re.type):l.push(new at(w,f.ref,`ref layer "${Z}" not found`))}else if(N!=="background")if(f.source){const re=I.sources&&I.sources[f.source],ge=re&&Xi(re.type);re?ge==="vector"&&N==="raster"?l.push(new at(w,f.source,`layer "${f.id}" requires a raster source`)):ge==="raster"&&N!=="raster"?l.push(new at(w,f.source,`layer "${f.id}" requires a vector source`)):ge!=="vector"||f["source-layer"]?ge==="raster-dem"&&N!=="hillshade"?l.push(new at(w,f.source,"raster-dem source can only be used with layer type 'hillshade'.")):N!=="line"||!f.paint||!f.paint["line-gradient"]||ge==="geojson"&&re.lineMetrics||l.push(new at(w,f,`layer "${f.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):l.push(new at(w,f,`layer "${f.id}" must specify a "source-layer"`)):l.push(new at(w,f.source,`source "${f.source}" not found`))}else l.push(new at(w,f,'missing required property "source"'));return l=l.concat(la({key:w,value:f,valueSpec:U.layer,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Mo({key:`${w}.type`,value:f.type,valueSpec:U.layer.type,style:A.style,styleSpec:A.styleSpec,object:f,objectKey:"type"}),filter:qc,layout:re=>la({layer:f,key:re.key,value:re.value,style:re.style,styleSpec:re.styleSpec,objectElementValidators:{"*":ge=>id(hn({layerType:N},ge))}}),paint:re=>la({layer:f,key:re.key,value:re.value,style:re.style,styleSpec:re.styleSpec,objectElementValidators:{"*":ge=>bu(hn({layerType:N},ge))}})}})),l}function fc(A){const l=A.value,f=A.key,w=Br(l);return w!=="string"?[new at(f,l,`string expected, ${w} found`)]:[]}const Yc={promoteId:function({key:A,value:l}){if(Br(l)==="string")return fc({key:A,value:l});{const f=[];for(const w in l)f.push(...fc({key:`${A}.${w}`,value:l[w]}));return f}}};function zh(A){const l=A.value,f=A.key,w=A.styleSpec,I=A.style;if(!l.type)return[new at(f,l,'"type" is required')];const U=Xi(l.type);let N;switch(U){case"vector":case"raster":case"raster-dem":return N=la({key:f,value:l,valueSpec:w[`source_${U.replace("-","_")}`],style:A.style,styleSpec:w,objectElementValidators:Yc}),N;case"geojson":if(N=la({key:f,value:l,valueSpec:w.source_geojson,style:I,styleSpec:w,objectElementValidators:Yc}),l.cluster)for(const Z in l.clusterProperties){const[re,ge]=l.clusterProperties[Z],Ce=typeof re=="string"?[re,["accumulated"],["get",Z]]:re;N.push(...ca({key:`${f}.${Z}.map`,value:ge,expressionContext:"cluster-map"})),N.push(...ca({key:`${f}.${Z}.reduce`,value:Ce,expressionContext:"cluster-reduce"}))}return N;case"video":return la({key:f,value:l,valueSpec:w.source_video,style:I,styleSpec:w});case"image":return la({key:f,value:l,valueSpec:w.source_image,style:I,styleSpec:w});case"canvas":return[new at(f,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return $c({key:`${f}.type`,value:l.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:I,styleSpec:w})}}function Jc(A){const l=A.value,f=A.styleSpec,w=f.light,I=A.style;let U=[];const N=Br(l);if(l===void 0)return U;if(N!=="object")return U=U.concat([new at("light",l,`object expected, ${N} found`)]),U;for(const Z in l){const re=Z.match(/^(.*)-transition$/);U=U.concat(re&&w[re[1]]&&w[re[1]].transition?Mo({key:Z,value:l[Z],valueSpec:f.transition,style:I,styleSpec:f}):w[Z]?Mo({key:Z,value:l[Z],valueSpec:w[Z],style:I,styleSpec:f}):[new at(Z,l[Z],`unknown property "${Z}"`)])}return U}function So(A){const l=A.value,f=A.styleSpec,w=f.terrain,I=A.style;let U=[];const N=Br(l);if(l===void 0)return U;if(N!=="object")return U=U.concat([new at("terrain",l,`object expected, ${N} found`)]),U;for(const Z in l)U=U.concat(w[Z]?Mo({key:Z,value:l[Z],valueSpec:w[Z],style:I,styleSpec:f}):[new at(Z,l[Z],`unknown property "${Z}"`)]);return U}const xa={"*":()=>[],array:sA,boolean:function(A){const l=A.value,f=A.key,w=Br(l);return w!=="boolean"?[new at(f,l,`boolean expected, ${w} found`)]:[]},number:oA,color:function(A){const l=A.key,f=A.value,w=Br(f);return w!=="string"?[new at(l,f,`color expected, ${w} found`)]:ct(f)===null?[new at(l,f,`color expected, "${f}" found`)]:[]},constants:ii,enum:$c,filter:qc,function:Kc,layer:pc,object:la,source:zh,light:Jc,terrain:So,string:fc,formatted:function(A){return fc(A).length===0?[]:ca(A)},resolvedImage:function(A){return fc(A).length===0?[]:ca(A)},padding:function(A){const l=A.key,f=A.value;if(Br(f)==="array"){if(f.length<1||f.length>4)return[new at(l,f,`padding requires 1 to 4 values; ${f.length} values found`)];const w={type:"number"};let I=[];for(let U=0;U<f.length;U++)I=I.concat(Mo({key:`${l}[${U}]`,value:f[U],valueSpec:w}));return I}return oA({key:l,value:f,valueSpec:{}})}};function Mo(A){const l=A.value,f=A.valueSpec,w=A.styleSpec;return f.expression&&jr(Xi(l))?Kc(A):f.expression&&Vc(on(l))?ca(A):f.type&&xa[f.type]?xa[f.type](A):la(hn({},A,{valueSpec:f.type?w[f.type]:f}))}function nd(A){const l=A.value,f=A.key,w=fc(A);return w.length||(l.indexOf("{fontstack}")===-1&&w.push(new at(f,l,'"glyphs" url must include a "{fontstack}" token')),l.indexOf("{range}")===-1&&w.push(new at(f,l,'"glyphs" url must include a "{range}" token'))),w}function Ha(A,l=$t){let f=[];return f=f.concat(Mo({key:"",value:A,valueSpec:l.$root,styleSpec:l,style:A,objectElementValidators:{glyphs:nd,"*":()=>[]}})),A.constants&&(f=f.concat(ii({key:"constants",value:A.constants,style:A,styleSpec:l}))),rd(f)}function rd(A){return[].concat(A).sort((l,f)=>l.line-f.line)}function ml(A){return function(...l){return rd(A.apply(this,l))}}Ha.source=ml(zh),Ha.light=ml(Jc),Ha.terrain=ml(So),Ha.layer=ml(pc),Ha.filter=ml(qc),Ha.paintProperty=ml(bu),Ha.layoutProperty=ml(id);const kh=Ha,Oh=kh.light,lA=kh.paintProperty,sd=kh.layoutProperty;function Nh(A,l){let f=!1;if(l&&l.length)for(const w of l)A.fire(new qi(new Error(w.message))),f=!0;return f}class mc{constructor(l,f,w){const I=this.cells=[];if(l instanceof ArrayBuffer){this.arrayBuffer=l;const N=new Int32Array(this.arrayBuffer);l=N[0],this.d=(f=N[1])+2*(w=N[2]);for(let re=0;re<this.d*this.d;re++){const ge=N[3+re],Ce=N[3+re+1];I.push(ge===Ce?null:N.subarray(ge,Ce))}const Z=N[3+I.length+1];this.keys=N.subarray(N[3+I.length],Z),this.bboxes=N.subarray(Z),this.insert=this._insertReadonly}else{this.d=f+2*w;for(let N=0;N<this.d*this.d;N++)I.push([]);this.keys=[],this.bboxes=[]}this.n=f,this.extent=l,this.padding=w,this.scale=f/l,this.uid=0;const U=w/f*l;this.min=-U,this.max=l+U}insert(l,f,w,I,U){this._forEachCell(f,w,I,U,this._insertCell,this.uid++,void 0,void 0),this.keys.push(l),this.bboxes.push(f),this.bboxes.push(w),this.bboxes.push(I),this.bboxes.push(U)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(l,f,w,I,U,N){this.cells[U].push(N)}query(l,f,w,I,U){const N=this.min,Z=this.max;if(l<=N&&f<=N&&Z<=w&&Z<=I&&!U)return Array.prototype.slice.call(this.keys);{const re=[];return this._forEachCell(l,f,w,I,this._queryCell,re,{},U),re}}_queryCell(l,f,w,I,U,N,Z,re){const ge=this.cells[U];if(ge!==null){const Ce=this.keys,Ie=this.bboxes;for(let ke=0;ke<ge.length;ke++){const $e=ge[ke];if(Z[$e]===void 0){const Ze=4*$e;(re?re(Ie[Ze+0],Ie[Ze+1],Ie[Ze+2],Ie[Ze+3]):l<=Ie[Ze+2]&&f<=Ie[Ze+3]&&w>=Ie[Ze+0]&&I>=Ie[Ze+1])?(Z[$e]=!0,N.push(Ce[$e])):Z[$e]=!1}}}}_forEachCell(l,f,w,I,U,N,Z,re){const ge=this._convertToCellCoord(l),Ce=this._convertToCellCoord(f),Ie=this._convertToCellCoord(w),ke=this._convertToCellCoord(I);for(let $e=ge;$e<=Ie;$e++)for(let Ze=Ce;Ze<=ke;Ze++){const Rt=this.d*Ze+$e;if((!re||re(this._convertFromCellCoord($e),this._convertFromCellCoord(Ze),this._convertFromCellCoord($e+1),this._convertFromCellCoord(Ze+1)))&&U.call(this,l,f,w,I,Rt,N,Z,re))return}}_convertFromCellCoord(l){return(l-this.padding)/this.scale}_convertToCellCoord(l){return Math.max(0,Math.min(this.d-1,Math.floor(l*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const l=this.cells,f=3+this.cells.length+1+1;let w=0;for(let N=0;N<this.cells.length;N++)w+=this.cells[N].length;const I=new Int32Array(f+w+this.keys.length+this.bboxes.length);I[0]=this.extent,I[1]=this.n,I[2]=this.padding;let U=f;for(let N=0;N<l.length;N++){const Z=l[N];I[3+N]=U,I.set(Z,U),U+=Z.length}return I[3+l.length]=U,I.set(this.keys,U),U+=this.keys.length,I[3+l.length+1]=U,I.set(this.bboxes,U),U+=this.bboxes.length,I.buffer}static serialize(l,f){const w=l.toArrayBuffer();return f&&f.push(w),{buffer:w}}static deserialize(l){return new mc(l.buffer)}}const ha={};function pn(A,l,f={}){if(ha[A])throw new Error(`${A} is already registered.`);Object.defineProperty(l,"_classRegistryKey",{value:A,writeable:!1}),ha[A]={klass:l,omit:f.omit||[],shallow:f.shallow||[]}}pn("Object",Object),pn("TransferableGridIndex",mc),pn("Color",de),pn("Error",Error),pn("AJAXError",Ft),pn("ResolvedImage",pt),pn("StylePropertyFunction",Wc),pn("StyleExpression",dc,{omit:["_evaluator"]}),pn("ZoomDependentExpression",Gc),pn("ZoomConstantExpression",Lh),pn("CompoundExpression",Yn,{omit:["_evaluate"]});for(const A in Ac)Ac[A]._classRegistryKey||pn(`Expression_${A}`,Ac[A]);function eh(A){return A&&typeof ArrayBuffer<"u"&&(A instanceof ArrayBuffer||A.constructor&&A.constructor.name==="ArrayBuffer")}function Wl(A,l){if(A==null||typeof A=="boolean"||typeof A=="number"||typeof A=="string"||A instanceof Boolean||A instanceof Number||A instanceof String||A instanceof Date||A instanceof RegExp||A instanceof Blob)return A;if(eh(A)||le(A))return l&&l.push(A),A;if(ArrayBuffer.isView(A)){const f=A;return l&&l.push(f.buffer),f}if(A instanceof ImageData)return l&&l.push(A.data.buffer),A;if(Array.isArray(A)){const f=[];for(const w of A)f.push(Wl(w,l));return f}if(typeof A=="object"){const f=A.constructor,w=f._classRegistryKey;if(!w)throw new Error("can't serialize object of unregistered class");if(!ha[w])throw new Error(`${w} is not registered.`);const I=f.serialize?f.serialize(A,l):{};if(f.serialize){if(l&&I===l[l.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const U in A){if(!A.hasOwnProperty(U)||ha[w].omit.indexOf(U)>=0)continue;const N=A[U];I[U]=ha[w].shallow.indexOf(U)>=0?N:Wl(N,l)}A instanceof Error&&(I.message=A.message)}if(I.$name)throw new Error("$name property is reserved for worker serialization logic.");return w!=="Object"&&(I.$name=w),I}throw new Error("can't serialize object of type "+typeof A)}function Os(A){if(A==null||typeof A=="boolean"||typeof A=="number"||typeof A=="string"||A instanceof Boolean||A instanceof Number||A instanceof String||A instanceof Date||A instanceof RegExp||A instanceof Blob||eh(A)||le(A)||ArrayBuffer.isView(A)||A instanceof ImageData)return A;if(Array.isArray(A))return A.map(Os);if(typeof A=="object"){const l=A.$name||"Object";if(!ha[l])throw new Error(`can't deserialize unregistered class ${l}`);const{klass:f}=ha[l];if(!f)throw new Error(`can't deserialize unregistered class ${l}`);if(f.deserialize)return f.deserialize(A);const w=Object.create(f.prototype);for(const I of Object.keys(A)){if(I==="$name")continue;const U=A[I];w[I]=ha[l].shallow.indexOf(I)>=0?U:Os(U)}return w}throw new Error("can't deserialize object of type "+typeof A)}class gl{constructor(){this.first=!0}update(l,f){const w=Math.floor(l);return this.first?(this.first=!1,this.lastIntegerZoom=w,this.lastIntegerZoomTime=0,this.lastZoom=l,this.lastFloorZoom=w,!0):(this.lastFloorZoom>w?(this.lastIntegerZoom=w+1,this.lastIntegerZoomTime=f):this.lastFloorZoom<w&&(this.lastIntegerZoom=w,this.lastIntegerZoomTime=f),l!==this.lastZoom&&(this.lastZoom=l,this.lastFloorZoom=w,!0))}}const un={"Latin-1 Supplement":A=>A>=128&&A<=255,Arabic:A=>A>=1536&&A<=1791,"Arabic Supplement":A=>A>=1872&&A<=1919,"Arabic Extended-A":A=>A>=2208&&A<=2303,"Hangul Jamo":A=>A>=4352&&A<=4607,"Unified Canadian Aboriginal Syllabics":A=>A>=5120&&A<=5759,Khmer:A=>A>=6016&&A<=6143,"Unified Canadian Aboriginal Syllabics Extended":A=>A>=6320&&A<=6399,"General Punctuation":A=>A>=8192&&A<=8303,"Letterlike Symbols":A=>A>=8448&&A<=8527,"Number Forms":A=>A>=8528&&A<=8591,"Miscellaneous Technical":A=>A>=8960&&A<=9215,"Control Pictures":A=>A>=9216&&A<=9279,"Optical Character Recognition":A=>A>=9280&&A<=9311,"Enclosed Alphanumerics":A=>A>=9312&&A<=9471,"Geometric Shapes":A=>A>=9632&&A<=9727,"Miscellaneous Symbols":A=>A>=9728&&A<=9983,"Miscellaneous Symbols and Arrows":A=>A>=11008&&A<=11263,"CJK Radicals Supplement":A=>A>=11904&&A<=12031,"Kangxi Radicals":A=>A>=12032&&A<=12255,"Ideographic Description Characters":A=>A>=12272&&A<=12287,"CJK Symbols and Punctuation":A=>A>=12288&&A<=12351,Hiragana:A=>A>=12352&&A<=12447,Katakana:A=>A>=12448&&A<=12543,Bopomofo:A=>A>=12544&&A<=12591,"Hangul Compatibility Jamo":A=>A>=12592&&A<=12687,Kanbun:A=>A>=12688&&A<=12703,"Bopomofo Extended":A=>A>=12704&&A<=12735,"CJK Strokes":A=>A>=12736&&A<=12783,"Katakana Phonetic Extensions":A=>A>=12784&&A<=12799,"Enclosed CJK Letters and Months":A=>A>=12800&&A<=13055,"CJK Compatibility":A=>A>=13056&&A<=13311,"CJK Unified Ideographs Extension A":A=>A>=13312&&A<=19903,"Yijing Hexagram Symbols":A=>A>=19904&&A<=19967,"CJK Unified Ideographs":A=>A>=19968&&A<=40959,"Yi Syllables":A=>A>=40960&&A<=42127,"Yi Radicals":A=>A>=42128&&A<=42191,"Hangul Jamo Extended-A":A=>A>=43360&&A<=43391,"Hangul Syllables":A=>A>=44032&&A<=55215,"Hangul Jamo Extended-B":A=>A>=55216&&A<=55295,"Private Use Area":A=>A>=57344&&A<=63743,"CJK Compatibility Ideographs":A=>A>=63744&&A<=64255,"Arabic Presentation Forms-A":A=>A>=64336&&A<=65023,"Vertical Forms":A=>A>=65040&&A<=65055,"CJK Compatibility Forms":A=>A>=65072&&A<=65103,"Small Form Variants":A=>A>=65104&&A<=65135,"Arabic Presentation Forms-B":A=>A>=65136&&A<=65279,"Halfwidth and Fullwidth Forms":A=>A>=65280&&A<=65519};function th(A){for(const l of A)if(cA(l.charCodeAt(0)))return!0;return!1}function Ur(A){for(const l of A)if(!gc(l.charCodeAt(0)))return!1;return!0}function gc(A){return!(un.Arabic(A)||un["Arabic Supplement"](A)||un["Arabic Extended-A"](A)||un["Arabic Presentation Forms-A"](A)||un["Arabic Presentation Forms-B"](A))}function cA(A){return!(A!==746&&A!==747&&(A<4352||!(un["Bopomofo Extended"](A)||un.Bopomofo(A)||un["CJK Compatibility Forms"](A)&&!(A>=65097&&A<=65103)||un["CJK Compatibility Ideographs"](A)||un["CJK Compatibility"](A)||un["CJK Radicals Supplement"](A)||un["CJK Strokes"](A)||!(!un["CJK Symbols and Punctuation"](A)||A>=12296&&A<=12305||A>=12308&&A<=12319||A===12336)||un["CJK Unified Ideographs Extension A"](A)||un["CJK Unified Ideographs"](A)||un["Enclosed CJK Letters and Months"](A)||un["Hangul Compatibility Jamo"](A)||un["Hangul Jamo Extended-A"](A)||un["Hangul Jamo Extended-B"](A)||un["Hangul Jamo"](A)||un["Hangul Syllables"](A)||un.Hiragana(A)||un["Ideographic Description Characters"](A)||un.Kanbun(A)||un["Kangxi Radicals"](A)||un["Katakana Phonetic Extensions"](A)||un.Katakana(A)&&A!==12540||!(!un["Halfwidth and Fullwidth Forms"](A)||A===65288||A===65289||A===65293||A>=65306&&A<=65310||A===65339||A===65341||A===65343||A>=65371&&A<=65503||A===65507||A>=65512&&A<=65519)||!(!un["Small Form Variants"](A)||A>=65112&&A<=65118||A>=65123&&A<=65126)||un["Unified Canadian Aboriginal Syllabics"](A)||un["Unified Canadian Aboriginal Syllabics Extended"](A)||un["Vertical Forms"](A)||un["Yijing Hexagram Symbols"](A)||un["Yi Syllables"](A)||un["Yi Radicals"](A))))}function Qh(A){return!(cA(A)||function(l){return!!(un["Latin-1 Supplement"](l)&&(l===167||l===169||l===174||l===177||l===188||l===189||l===190||l===215||l===247)||un["General Punctuation"](l)&&(l===8214||l===8224||l===8225||l===8240||l===8241||l===8251||l===8252||l===8258||l===8263||l===8264||l===8265||l===8273)||un["Letterlike Symbols"](l)||un["Number Forms"](l)||un["Miscellaneous Technical"](l)&&(l>=8960&&l<=8967||l>=8972&&l<=8991||l>=8996&&l<=9e3||l===9003||l>=9085&&l<=9114||l>=9150&&l<=9165||l===9167||l>=9169&&l<=9179||l>=9186&&l<=9215)||un["Control Pictures"](l)&&l!==9251||un["Optical Character Recognition"](l)||un["Enclosed Alphanumerics"](l)||un["Geometric Shapes"](l)||un["Miscellaneous Symbols"](l)&&!(l>=9754&&l<=9759)||un["Miscellaneous Symbols and Arrows"](l)&&(l>=11026&&l<=11055||l>=11088&&l<=11097||l>=11192&&l<=11243)||un["CJK Symbols and Punctuation"](l)||un.Katakana(l)||un["Private Use Area"](l)||un["CJK Compatibility Forms"](l)||un["Small Form Variants"](l)||un["Halfwidth and Fullwidth Forms"](l)||l===8734||l===8756||l===8757||l>=9984&&l<=10087||l>=10102&&l<=10131||l===65532||l===65533)}(A))}function _c(A){return A>=1424&&A<=2303||un["Arabic Presentation Forms-A"](A)||un["Arabic Presentation Forms-B"](A)}function hA(A,l){return!(!l&&_c(A)||A>=2304&&A<=3583||A>=3840&&A<=4255||un.Khmer(A))}function uA(A){for(const l of A)if(_c(l.charCodeAt(0)))return!0;return!1}const Vh="deferred",Hh="loading",ih="loaded";let yc=null,Ms="unavailable",fo=null;const Gh=function(A){A&&typeof A=="string"&&A.indexOf("NetworkError")>-1&&(Ms="error"),yc&&yc(A)};function jl(){Kl.fire(new Ni("pluginStateChange",{pluginStatus:Ms,pluginURL:fo}))}const Kl=new en,_l=function(){return Ms},An=function(){if(Ms!==Vh||!fo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ms=Hh,jl(),fo&&Gi({url:fo},A=>{A?Gh(A):(Ms=ih,jl())})},xs={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ms===ih||xs.applyArabicShaping!=null,isLoading:()=>Ms===Hh,setState(A){if(!Fe())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ms=A.pluginStatus,fo=A.pluginURL},isParsed(){if(!Fe())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return xs.applyArabicShaping!=null&&xs.processBidirectionalText!=null&&xs.processStyledBidirectionalText!=null},getPluginURL(){if(!Fe())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return fo}};class Zr{constructor(l,f){this.zoom=l,f?(this.now=f.now,this.fadeDuration=f.fadeDuration,this.zoomHistory=f.zoomHistory,this.transition=f.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new gl,this.transition={})}isSupportedScript(l){return function(f,w){for(const I of f)if(!hA(I.charCodeAt(0),w))return!1;return!0}(l,xs.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const l=this.zoom,f=l-Math.floor(l),w=this.crossFadingFactor();return l>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:f+(1-f)*w}:{fromScale:.5,toScale:1,t:1-(1-w)*f}}}class nh{constructor(l,f){this.property=l,this.value=f,this.expression=function(w,I){if(jr(w))return new Wc(w,I);if(Vc(w)){const U=Dh(w,I);if(U.result==="error")throw new Error(U.value.map(N=>`${N.key}: ${N.message}`).join(", "));return U.value}{let U=w;return I.type==="color"&&typeof w=="string"?U=de.parse(w):I.type!=="padding"||typeof w!="number"&&!Array.isArray(w)||(U=et.parse(w)),{kind:"constant",evaluate:()=>U}}}(f===void 0?l.specification.default:f,l.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(l,f,w){return this.property.possiblyEvaluate(this,l,f,w)}}class Wh{constructor(l){this.property=l,this.value=new nh(l,void 0)}transitioned(l,f){return new AA(this.property,this.value,f,J({},l.transition,this.transition),l.now)}untransitioned(){return new AA(this.property,this.value,null,{},0)}}class xc{constructor(l){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues)}getValue(l){return Ae(this._values[l].value.value)}setValue(l,f){Object.prototype.hasOwnProperty.call(this._values,l)||(this._values[l]=new Wh(this._values[l].property)),this._values[l].value=new nh(this._values[l].property,f===null?void 0:Ae(f))}getTransition(l){return Ae(this._values[l].transition)}setTransition(l,f){Object.prototype.hasOwnProperty.call(this._values,l)||(this._values[l]=new Wh(this._values[l].property)),this._values[l].transition=Ae(f)||void 0}serialize(){const l={};for(const f of Object.keys(this._values)){const w=this.getValue(f);w!==void 0&&(l[f]=w);const I=this.getTransition(f);I!==void 0&&(l[`${f}-transition`]=I)}return l}transitioned(l,f){const w=new jh(this._properties);for(const I of Object.keys(this._values))w._values[I]=this._values[I].transitioned(l,f._values[I]);return w}untransitioned(){const l=new jh(this._properties);for(const f of Object.keys(this._values))l._values[f]=this._values[f].untransitioned();return l}}class AA{constructor(l,f,w,I,U){this.property=l,this.value=f,this.begin=U+I.delay||0,this.end=this.begin+I.duration||0,l.specification.transition&&(I.delay||I.duration)&&(this.prior=w)}possiblyEvaluate(l,f,w){const I=l.now||0,U=this.value.possiblyEvaluate(l,f,w),N=this.prior;if(N){if(I>this.end)return this.prior=null,U;if(this.value.isDataDriven())return this.prior=null,U;if(I<this.begin)return N.possiblyEvaluate(l,f,w);{const Z=(I-this.begin)/(this.end-this.begin);return this.property.interpolate(N.possiblyEvaluate(l,f,w),U,function(re){if(re<=0)return 0;if(re>=1)return 1;const ge=re*re,Ce=ge*re;return 4*(re<.5?Ce:3*(re-ge)+Ce-.75)}(Z))}}return U}}class jh{constructor(l){this._properties=l,this._values=Object.create(l.defaultTransitioningPropertyValues)}possiblyEvaluate(l,f,w){const I=new Js(this._properties);for(const U of Object.keys(this._values))I._values[U]=this._values[U].possiblyEvaluate(l,f,w);return I}hasTransition(){for(const l of Object.keys(this._values))if(this._values[l].prior)return!0;return!1}}class rh{constructor(l){this._properties=l,this._values=Object.create(l.defaultPropertyValues)}getValue(l){return Ae(this._values[l].value)}setValue(l,f){this._values[l]=new nh(this._values[l].property,f===null?void 0:Ae(f))}serialize(){const l={};for(const f of Object.keys(this._values)){const w=this.getValue(f);w!==void 0&&(l[f]=w)}return l}possiblyEvaluate(l,f,w){const I=new Js(this._properties);for(const U of Object.keys(this._values))I._values[U]=this._values[U].possiblyEvaluate(l,f,w);return I}}class uo{constructor(l,f,w){this.property=l,this.value=f,this.parameters=w}isConstant(){return this.value.kind==="constant"}constantOr(l){return this.value.kind==="constant"?this.value.value:l}evaluate(l,f,w,I){return this.property.evaluate(this.value,this.parameters,l,f,w,I)}}class Js{constructor(l){this._properties=l,this._values=Object.create(l.defaultPossiblyEvaluatedValues)}get(l){return this._values[l]}}class Fn{constructor(l){this.specification=l}possiblyEvaluate(l,f){if(l.isDataDriven())throw new Error("Value should not be data driven");return l.expression.evaluate(f)}interpolate(l,f,w){const I=Ys[this.specification.type];return I?I(l,f,w):l}}class Vn{constructor(l,f){this.specification=l,this.overrides=f}possiblyEvaluate(l,f,w,I){return new uo(this,l.expression.kind==="constant"||l.expression.kind==="camera"?{kind:"constant",value:l.expression.evaluate(f,null,{},w,I)}:l.expression,f)}interpolate(l,f,w){if(l.value.kind!=="constant"||f.value.kind!=="constant")return l;if(l.value.value===void 0||f.value.value===void 0)return new uo(this,{kind:"constant",value:void 0},l.parameters);const I=Ys[this.specification.type];return I?new uo(this,{kind:"constant",value:I(l.value.value,f.value.value,w)},l.parameters):l}evaluate(l,f,w,I,U,N){return l.kind==="constant"?l.value:l.evaluate(f,w,I,U,N)}}class sh extends Vn{possiblyEvaluate(l,f,w,I){if(l.value===void 0)return new uo(this,{kind:"constant",value:void 0},f);if(l.expression.kind==="constant"){const U=l.expression.evaluate(f,null,{},w,I),N=l.property.specification.type==="resolvedImage"&&typeof U!="string"?U.name:U,Z=this._calculate(N,N,N,f);return new uo(this,{kind:"constant",value:Z},f)}if(l.expression.kind==="camera"){const U=this._calculate(l.expression.evaluate({zoom:f.zoom-1}),l.expression.evaluate({zoom:f.zoom}),l.expression.evaluate({zoom:f.zoom+1}),f);return new uo(this,{kind:"constant",value:U},f)}return new uo(this,l.expression,f)}evaluate(l,f,w,I,U,N){if(l.kind==="source"){const Z=l.evaluate(f,w,I,U,N);return this._calculate(Z,Z,Z,f)}return l.kind==="composite"?this._calculate(l.evaluate({zoom:Math.floor(f.zoom)-1},w,I),l.evaluate({zoom:Math.floor(f.zoom)},w,I),l.evaluate({zoom:Math.floor(f.zoom)+1},w,I),f):l.value}_calculate(l,f,w,I){return I.zoom>I.zoomHistory.lastIntegerZoom?{from:l,to:f}:{from:w,to:f}}interpolate(l){return l}}class dA{constructor(l){this.specification=l}possiblyEvaluate(l,f,w,I){if(l.value!==void 0){if(l.expression.kind==="constant"){const U=l.expression.evaluate(f,null,{},w,I);return this._calculate(U,U,U,f)}return this._calculate(l.expression.evaluate(new Zr(Math.floor(f.zoom-1),f)),l.expression.evaluate(new Zr(Math.floor(f.zoom),f)),l.expression.evaluate(new Zr(Math.floor(f.zoom+1),f)),f)}}_calculate(l,f,w,I){return I.zoom>I.zoomHistory.lastIntegerZoom?{from:l,to:f}:{from:w,to:f}}interpolate(l){return l}}class yl{constructor(l){this.specification=l}possiblyEvaluate(l,f,w,I){return!!l.expression.evaluate(f,null,{},w,I)}interpolate(){return!1}}class Cs{constructor(l){this.properties=l,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const f in l){const w=l[f];w.specification.overridable&&this.overridableProperties.push(f);const I=this.defaultPropertyValues[f]=new nh(w,void 0),U=this.defaultTransitionablePropertyValues[f]=new Wh(w);this.defaultTransitioningPropertyValues[f]=U.untransitioned(),this.defaultPossiblyEvaluatedValues[f]=I.possiblyEvaluate({})}}}pn("DataDrivenProperty",Vn),pn("DataConstantProperty",Fn),pn("CrossFadedDataDrivenProperty",sh),pn("CrossFadedProperty",dA),pn("ColorRampProperty",yl);const Ga="-transition";class Go extends en{constructor(l,f){if(super(),this.id=l.id,this.type=l.type,this._featureFilter={filter:()=>!0,needGeometry:!1},l.type!=="custom"&&(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type!=="background"&&(this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter),f.layout&&(this._unevaluatedLayout=new rh(f.layout)),f.paint)){this._transitionablePaint=new xc(f.paint);for(const w in l.paint)this.setPaintProperty(w,l.paint[w],{validate:!1});for(const w in l.layout)this.setLayoutProperty(w,l.layout[w],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Js(f.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(l){return l==="visibility"?this.visibility:this._unevaluatedLayout.getValue(l)}setLayoutProperty(l,f,w={}){f!=null&&this._validate(sd,`layers.${this.id}.layout.${l}`,l,f,w)||(l!=="visibility"?this._unevaluatedLayout.setValue(l,f):this.visibility=f)}getPaintProperty(l){return l.endsWith(Ga)?this._transitionablePaint.getTransition(l.slice(0,-Ga.length)):this._transitionablePaint.getValue(l)}setPaintProperty(l,f,w={}){if(f!=null&&this._validate(lA,`layers.${this.id}.paint.${l}`,l,f,w))return!1;if(l.endsWith(Ga))return this._transitionablePaint.setTransition(l.slice(0,-Ga.length),f||void 0),!1;{const I=this._transitionablePaint._values[l],U=I.property.specification["property-type"]==="cross-faded-data-driven",N=I.value.isDataDriven(),Z=I.value;this._transitionablePaint.setValue(l,f),this._handleSpecialPaintPropertyUpdate(l);const re=this._transitionablePaint._values[l].value;return re.isDataDriven()||N||U||this._handleOverridablePaintPropertyUpdate(l,Z,re)}}_handleSpecialPaintPropertyUpdate(l){}_handleOverridablePaintPropertyUpdate(l,f,w){return!1}isHidden(l){return!!(this.minzoom&&l<this.minzoom)||!!(this.maxzoom&&l>=this.maxzoom)||this.visibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(l,f){l.getCrossfadeParameters&&(this._crossfadeParameters=l.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,f)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,f)}serialize(){const l={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(l.layout=l.layout||{},l.layout.visibility=this.visibility),ce(l,(f,w)=>!(f===void 0||w==="layout"&&!Object.keys(f).length||w==="paint"&&!Object.keys(f).length))}_validate(l,f,w,I,U={}){return(!U||U.validate!==!1)&&Nh(this,l.call(kh,{key:f,layerType:this.type,objectKey:w,value:I,styleSpec:$t,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const l in this.paint._values){const f=this.paint.get(l);if(f instanceof uo&&qr(f.property.specification)&&(f.value.kind==="source"||f.value.kind==="composite")&&f.value.isStateDependent)return!0}return!1}}const pA={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class va{constructor(l,f){this._structArray=l,this._pos1=f*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class hs{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(l,f){return l._trim(),f&&(l.isTransferred=!0,f.push(l.arrayBuffer)),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){const f=Object.create(this.prototype);return f.arrayBuffer=l.arrayBuffer,f.length=l.length,f.capacity=l.arrayBuffer.byteLength/f.bytesPerElement,f._refreshViews(),f}_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(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const f=this.uint8;this._refreshViews(),f&&this.uint8.set(f)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Is(A,l=1){let f=0,w=0;return{members:A.map(I=>{const U=pA[I.type].BYTES_PER_ELEMENT,N=f=Kh(f,Math.max(l,U)),Z=I.components||1;return w=Math.max(w,U),f+=U*Z,{name:I.name,type:I.type,components:Z,offset:N}}),size:Kh(f,Math.max(w,l)),alignment:l}}function Kh(A,l){return Math.ceil(A/l)*l}class xl extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f){const w=this.length;return this.resize(w+1),this.emplace(w,l,f)}emplace(l,f,w){const I=2*l;return this.int16[I+0]=f,this.int16[I+1]=w,l}}xl.prototype.bytesPerElement=4,pn("StructArrayLayout2i4",xl);class M extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I){const U=this.length;return this.resize(U+1),this.emplace(U,l,f,w,I)}emplace(l,f,w,I,U){const N=4*l;return this.int16[N+0]=f,this.int16[N+1]=w,this.int16[N+2]=I,this.int16[N+3]=U,l}}M.prototype.bytesPerElement=8,pn("StructArrayLayout4i8",M);class h extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,U,N){const Z=this.length;return this.resize(Z+1),this.emplace(Z,l,f,w,I,U,N)}emplace(l,f,w,I,U,N,Z){const re=6*l;return this.int16[re+0]=f,this.int16[re+1]=w,this.int16[re+2]=I,this.int16[re+3]=U,this.int16[re+4]=N,this.int16[re+5]=Z,l}}h.prototype.bytesPerElement=12,pn("StructArrayLayout2i4i12",h);class _ extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,U,N){const Z=this.length;return this.resize(Z+1),this.emplace(Z,l,f,w,I,U,N)}emplace(l,f,w,I,U,N,Z){const re=4*l,ge=8*l;return this.int16[re+0]=f,this.int16[re+1]=w,this.uint8[ge+4]=I,this.uint8[ge+5]=U,this.uint8[ge+6]=N,this.uint8[ge+7]=Z,l}}_.prototype.bytesPerElement=8,pn("StructArrayLayout2i4ub8",_);class T extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f){const w=this.length;return this.resize(w+1),this.emplace(w,l,f)}emplace(l,f,w){const I=2*l;return this.float32[I+0]=f,this.float32[I+1]=w,l}}T.prototype.bytesPerElement=8,pn("StructArrayLayout2f8",T);class F extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,U,N,Z,re,ge,Ce){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,l,f,w,I,U,N,Z,re,ge,Ce)}emplace(l,f,w,I,U,N,Z,re,ge,Ce,Ie){const ke=10*l;return this.uint16[ke+0]=f,this.uint16[ke+1]=w,this.uint16[ke+2]=I,this.uint16[ke+3]=U,this.uint16[ke+4]=N,this.uint16[ke+5]=Z,this.uint16[ke+6]=re,this.uint16[ke+7]=ge,this.uint16[ke+8]=Ce,this.uint16[ke+9]=Ie,l}}F.prototype.bytesPerElement=20,pn("StructArrayLayout10ui20",F);class O extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke){const $e=this.length;return this.resize($e+1),this.emplace($e,l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke)}emplace(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e){const Ze=12*l;return this.int16[Ze+0]=f,this.int16[Ze+1]=w,this.int16[Ze+2]=I,this.int16[Ze+3]=U,this.uint16[Ze+4]=N,this.uint16[Ze+5]=Z,this.uint16[Ze+6]=re,this.uint16[Ze+7]=ge,this.int16[Ze+8]=Ce,this.int16[Ze+9]=Ie,this.int16[Ze+10]=ke,this.int16[Ze+11]=$e,l}}O.prototype.bytesPerElement=24,pn("StructArrayLayout4i4ui4i24",O);class K extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const U=3*l;return this.float32[U+0]=f,this.float32[U+1]=w,this.float32[U+2]=I,l}}K.prototype.bytesPerElement=12,pn("StructArrayLayout3f12",K);class oe extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){const f=this.length;return this.resize(f+1),this.emplace(f,l)}emplace(l,f){return this.uint32[1*l+0]=f,l}}oe.prototype.bytesPerElement=4,pn("StructArrayLayout1ul4",oe);class ue extends hs{_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(l,f,w,I,U,N,Z,re,ge){const Ce=this.length;return this.resize(Ce+1),this.emplace(Ce,l,f,w,I,U,N,Z,re,ge)}emplace(l,f,w,I,U,N,Z,re,ge,Ce){const Ie=10*l,ke=5*l;return this.int16[Ie+0]=f,this.int16[Ie+1]=w,this.int16[Ie+2]=I,this.int16[Ie+3]=U,this.int16[Ie+4]=N,this.int16[Ie+5]=Z,this.uint32[ke+3]=re,this.uint16[Ie+8]=ge,this.uint16[Ie+9]=Ce,l}}ue.prototype.bytesPerElement=20,pn("StructArrayLayout6i1ul2ui20",ue);class ve extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,U,N){const Z=this.length;return this.resize(Z+1),this.emplace(Z,l,f,w,I,U,N)}emplace(l,f,w,I,U,N,Z){const re=6*l;return this.int16[re+0]=f,this.int16[re+1]=w,this.int16[re+2]=I,this.int16[re+3]=U,this.int16[re+4]=N,this.int16[re+5]=Z,l}}ve.prototype.bytesPerElement=12,pn("StructArrayLayout2i2i2i12",ve);class Te extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w,I,U){const N=this.length;return this.resize(N+1),this.emplace(N,l,f,w,I,U)}emplace(l,f,w,I,U,N){const Z=4*l,re=8*l;return this.float32[Z+0]=f,this.float32[Z+1]=w,this.float32[Z+2]=I,this.int16[re+6]=U,this.int16[re+7]=N,l}}Te.prototype.bytesPerElement=16,pn("StructArrayLayout2f1f2i16",Te);class ze extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w,I){const U=this.length;return this.resize(U+1),this.emplace(U,l,f,w,I)}emplace(l,f,w,I,U){const N=12*l,Z=3*l;return this.uint8[N+0]=f,this.uint8[N+1]=w,this.float32[Z+1]=I,this.float32[Z+2]=U,l}}ze.prototype.bytesPerElement=12,pn("StructArrayLayout2ub2f12",ze);class je extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const U=3*l;return this.uint16[U+0]=f,this.uint16[U+1]=w,this.uint16[U+2]=I,l}}je.prototype.bytesPerElement=6,pn("StructArrayLayout3ui6",je);class bt extends hs{_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(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt,Mt,ri){const mi=this.length;return this.resize(mi+1),this.emplace(mi,l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt,Mt,ri)}emplace(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt,Mt,ri,mi){const ei=24*l,ui=12*l,Pi=48*l;return this.int16[ei+0]=f,this.int16[ei+1]=w,this.uint16[ei+2]=I,this.uint16[ei+3]=U,this.uint32[ui+2]=N,this.uint32[ui+3]=Z,this.uint32[ui+4]=re,this.uint16[ei+10]=ge,this.uint16[ei+11]=Ce,this.uint16[ei+12]=Ie,this.float32[ui+7]=ke,this.float32[ui+8]=$e,this.uint8[Pi+36]=Ze,this.uint8[Pi+37]=Rt,this.uint8[Pi+38]=Mt,this.uint32[ui+10]=ri,this.int16[ei+22]=mi,l}}bt.prototype.bytesPerElement=48,pn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",bt);class mt extends hs{_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(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt,Mt,ri,mi,ei,ui,Pi,Fi,Sn,fn,mn,an,nn,vn){const gn=this.length;return this.resize(gn+1),this.emplace(gn,l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt,Mt,ri,mi,ei,ui,Pi,Fi,Sn,fn,mn,an,nn,vn)}emplace(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt,Mt,ri,mi,ei,ui,Pi,Fi,Sn,fn,mn,an,nn,vn,gn){const Ji=34*l,Wn=17*l;return this.int16[Ji+0]=f,this.int16[Ji+1]=w,this.int16[Ji+2]=I,this.int16[Ji+3]=U,this.int16[Ji+4]=N,this.int16[Ji+5]=Z,this.int16[Ji+6]=re,this.int16[Ji+7]=ge,this.uint16[Ji+8]=Ce,this.uint16[Ji+9]=Ie,this.uint16[Ji+10]=ke,this.uint16[Ji+11]=$e,this.uint16[Ji+12]=Ze,this.uint16[Ji+13]=Rt,this.uint16[Ji+14]=Mt,this.uint16[Ji+15]=ri,this.uint16[Ji+16]=mi,this.uint16[Ji+17]=ei,this.uint16[Ji+18]=ui,this.uint16[Ji+19]=Pi,this.uint16[Ji+20]=Fi,this.uint16[Ji+21]=Sn,this.uint16[Ji+22]=fn,this.uint32[Wn+12]=mn,this.float32[Wn+13]=an,this.float32[Wn+14]=nn,this.float32[Wn+15]=vn,this.float32[Wn+16]=gn,l}}mt.prototype.bytesPerElement=68,pn("StructArrayLayout8i15ui1ul4f68",mt);class gt extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){const f=this.length;return this.resize(f+1),this.emplace(f,l)}emplace(l,f){return this.float32[1*l+0]=f,l}}gt.prototype.bytesPerElement=4,pn("StructArrayLayout1f4",gt);class Vt extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const U=3*l;return this.int16[U+0]=f,this.int16[U+1]=w,this.int16[U+2]=I,l}}Vt.prototype.bytesPerElement=6,pn("StructArrayLayout3i6",Vt);class Zt extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f,w){const I=this.length;return this.resize(I+1),this.emplace(I,l,f,w)}emplace(l,f,w,I){const U=4*l;return this.uint32[2*l+0]=f,this.uint16[U+2]=w,this.uint16[U+3]=I,l}}Zt.prototype.bytesPerElement=8,pn("StructArrayLayout1ul2ui8",Zt);class ni extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,f){const w=this.length;return this.resize(w+1),this.emplace(w,l,f)}emplace(l,f,w){const I=2*l;return this.uint16[I+0]=f,this.uint16[I+1]=w,l}}ni.prototype.bytesPerElement=4,pn("StructArrayLayout2ui4",ni);class St extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){const f=this.length;return this.resize(f+1),this.emplace(f,l)}emplace(l,f){return this.uint16[1*l+0]=f,l}}St.prototype.bytesPerElement=2,pn("StructArrayLayout1ui2",St);class zt extends hs{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,f,w,I){const U=this.length;return this.resize(U+1),this.emplace(U,l,f,w,I)}emplace(l,f,w,I,U){const N=4*l;return this.float32[N+0]=f,this.float32[N+1]=w,this.float32[N+2]=I,this.float32[N+3]=U,l}}zt.prototype.bytesPerElement=16,pn("StructArrayLayout4f16",zt);class ai extends va{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 xe(this.anchorPointX,this.anchorPointY)}}ai.prototype.size=20;class Ei extends ue{get(l){return new ai(this,l)}}pn("CollisionBoxArray",Ei);class Bi extends va{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(l){this._structArray.uint8[this._pos1+37]=l}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(l){this._structArray.uint8[this._pos1+38]=l}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(l){this._structArray.uint32[this._pos4+10]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Bi.prototype.size=48;class Hi extends bt{get(l){return new Bi(this,l)}}pn("PlacedSymbolArray",Hi);class vi extends va{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(l){this._structArray.uint32[this._pos4+12]=l}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}vi.prototype.size=68;class xn extends mt{get(l){return new vi(this,l)}}pn("SymbolInstanceArray",xn);class cn extends gt{getoffsetX(l){return this.float32[1*l+0]}}pn("GlyphOffsetArray",cn);class Bn extends Vt{getx(l){return this.int16[3*l+0]}gety(l){return this.int16[3*l+1]}gettileUnitDistanceFromAnchor(l){return this.int16[3*l+2]}}pn("SymbolLineVertexArray",Bn);class tr extends va{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]}}tr.prototype.size=8;class ur extends Zt{get(l){return new tr(this,l)}}pn("FeatureIndexArray",ur);class Un extends xl{}class Lr extends xl{}class Rr extends xl{}class Cr extends h{}class Er extends _{}class Gr extends T{}class js extends F{}class wa extends O{}class ua extends K{}class ba extends oe{}class Wa extends ve{}class Wo extends ze{}class mo extends je{}class Ba extends ni{}const $l=Is([{name:"a_pos",components:2,type:"Int16"}],4),{members:x}=$l;class a{constructor(l=[]){this.segments=l}prepareSegment(l,f,w,I){let U=this.segments[this.segments.length-1];return l>a.MAX_VERTEX_ARRAY_LENGTH&&me(`Max vertices per segment is ${a.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}`),(!U||U.vertexLength+l>a.MAX_VERTEX_ARRAY_LENGTH||U.sortKey!==I)&&(U={vertexOffset:f.length,primitiveOffset:w.length,vertexLength:0,primitiveLength:0},I!==void 0&&(U.sortKey=I),this.segments.push(U)),U}get(){return this.segments}destroy(){for(const l of this.segments)for(const f in l.vaos)l.vaos[f].destroy()}static simpleSegment(l,f,w,I){return new a([{vertexOffset:l,primitiveOffset:f,vertexLength:w,primitiveLength:I,vaos:{},sortKey:0}])}}function m(A,l){return 256*(A=z(Math.floor(A),0,255))+z(Math.floor(l),0,255)}a.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,pn("SegmentVector",a);const b=Is([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var S={exports:{}},P={exports:{}};P.exports=function(A,l){var f,w,I,U,N,Z,re,ge;for(w=A.length-(f=3&A.length),I=l,N=3432918353,Z=461845907,ge=0;ge<w;)re=255&A.charCodeAt(ge)|(255&A.charCodeAt(++ge))<<8|(255&A.charCodeAt(++ge))<<16|(255&A.charCodeAt(++ge))<<24,++ge,I=27492+(65535&(U=5*(65535&(I=(I^=re=(65535&(re=(re=(65535&re)*N+(((re>>>16)*N&65535)<<16)&4294967295)<<15|re>>>17))*Z+(((re>>>16)*Z&65535)<<16)&4294967295)<<13|I>>>19))+((5*(I>>>16)&65535)<<16)&4294967295))+((58964+(U>>>16)&65535)<<16);switch(re=0,f){case 3:re^=(255&A.charCodeAt(ge+2))<<16;case 2:re^=(255&A.charCodeAt(ge+1))<<8;case 1:I^=re=(65535&(re=(re=(65535&(re^=255&A.charCodeAt(ge)))*N+(((re>>>16)*N&65535)<<16)&4294967295)<<15|re>>>17))*Z+(((re>>>16)*Z&65535)<<16)&4294967295}return I^=A.length,I=2246822507*(65535&(I^=I>>>16))+((2246822507*(I>>>16)&65535)<<16)&4294967295,I=3266489909*(65535&(I^=I>>>13))+((3266489909*(I>>>16)&65535)<<16)&4294967295,(I^=I>>>16)>>>0};var H={exports:{}};H.exports=function(A,l){for(var f,w=A.length,I=l^w,U=0;w>=4;)f=1540483477*(65535&(f=255&A.charCodeAt(U)|(255&A.charCodeAt(++U))<<8|(255&A.charCodeAt(++U))<<16|(255&A.charCodeAt(++U))<<24))+((1540483477*(f>>>16)&65535)<<16),I=1540483477*(65535&I)+((1540483477*(I>>>16)&65535)<<16)^(f=1540483477*(65535&(f^=f>>>24))+((1540483477*(f>>>16)&65535)<<16)),w-=4,++U;switch(w){case 3:I^=(255&A.charCodeAt(U+2))<<16;case 2:I^=(255&A.charCodeAt(U+1))<<8;case 1:I=1540483477*(65535&(I^=255&A.charCodeAt(U)))+((1540483477*(I>>>16)&65535)<<16)}return I=1540483477*(65535&(I^=I>>>13))+((1540483477*(I>>>16)&65535)<<16),(I^=I>>>15)>>>0};var W=P.exports,ee=H.exports;S.exports=W,S.exports.murmur3=W,S.exports.murmur2=ee;class pe{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(l,f,w,I){this.ids.push(fe(l)),this.positions.push(f,w,I)}getPositions(l){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const f=fe(l);let w=0,I=this.ids.length-1;for(;w<I;){const N=w+I>>1;this.ids[N]>=f?I=N:w=N+1}const U=[];for(;this.ids[w]===f;)U.push({index:this.positions[3*w],start:this.positions[3*w+1],end:this.positions[3*w+2]}),w++;return U}static serialize(l,f){const w=new Float64Array(l.ids),I=new Uint32Array(l.positions);return Me(w,I,0,w.length-1),f&&f.push(w.buffer,I.buffer),{ids:w,positions:I}}static deserialize(l){const f=new pe;return f.ids=l.ids,f.positions=l.positions,f.indexed=!0,f}}function fe(A){const l=+A;return!isNaN(l)&&l<=Number.MAX_SAFE_INTEGER?l:S.exports(String(A))}function Me(A,l,f,w){for(;f<w;){const I=A[f+w>>1];let U=f-1,N=w+1;for(;;){do U++;while(A[U]<I);do N--;while(A[N]>I);if(U>=N)break;Ne(A,U,N),Ne(l,3*U,3*N),Ne(l,3*U+1,3*N+1),Ne(l,3*U+2,3*N+2)}N-f<w-N?(Me(A,l,f,N),f=N+1):(Me(A,l,N+1,w),w=N)}}function Ne(A,l,f){const w=A[l];A[l]=A[f],A[f]=w}pn("FeaturePositionMap",pe);class st{constructor(l,f){this.gl=l.gl,this.location=f}}class it extends st{constructor(l,f){super(l,f),this.current=0}set(l){this.current!==l&&(this.current=l,this.gl.uniform1f(this.location,l))}}class lt extends st{constructor(l,f){super(l,f),this.current=[0,0,0,0]}set(l){l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]&&l[3]===this.current[3]||(this.current=l,this.gl.uniform4f(this.location,l[0],l[1],l[2],l[3]))}}class qe extends st{constructor(l,f){super(l,f),this.current=de.transparent}set(l){l.r===this.current.r&&l.g===this.current.g&&l.b===this.current.b&&l.a===this.current.a||(this.current=l,this.gl.uniform4f(this.location,l.r,l.g,l.b,l.a))}}const Ye=new Float32Array(16);function dt(A){return[m(255*A.r,255*A.g),m(255*A.b,255*A.a)]}class ht{constructor(l,f,w){this.value=l,this.uniformNames=f.map(I=>`u_${I}`),this.type=w}setUniform(l,f,w){l.set(w.constantOr(this.value))}getBinding(l,f,w){return this.type==="color"?new qe(l,f):new it(l,f)}}class Bt{constructor(l,f){this.uniformNames=f.map(w=>`u_${w}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(l,f){this.pixelRatioFrom=f.pixelRatio,this.pixelRatioTo=l.pixelRatio,this.patternFrom=f.tlbr,this.patternTo=l.tlbr}setUniform(l,f,w,I){const U=I==="u_pattern_to"?this.patternTo:I==="u_pattern_from"?this.patternFrom:I==="u_pixel_ratio_to"?this.pixelRatioTo:I==="u_pixel_ratio_from"?this.pixelRatioFrom:null;U&&l.set(U)}getBinding(l,f,w){return w.substr(0,9)==="u_pattern"?new lt(l,f):new it(l,f)}}class Pt{constructor(l,f,w,I){this.expression=l,this.type=w,this.maxValue=0,this.paintVertexAttributes=f.map(U=>({name:`a_${U}`,type:"Float32",components:w==="color"?2:1,offset:0})),this.paintVertexArray=new I}populatePaintArray(l,f,w,I,U){const N=this.paintVertexArray.length,Z=this.expression.evaluate(new Zr(0),f,{},I,[],U);this.paintVertexArray.resize(l),this._setPaintValue(N,l,Z)}updatePaintArray(l,f,w,I){const U=this.expression.evaluate({zoom:0},w,I);this._setPaintValue(l,f,U)}_setPaintValue(l,f,w){if(this.type==="color"){const I=dt(w);for(let U=l;U<f;U++)this.paintVertexArray.emplace(U,I[0],I[1])}else{for(let I=l;I<f;I++)this.paintVertexArray.emplace(I,w);this.maxValue=Math.max(this.maxValue,Math.abs(w))}}upload(l){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=l.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class It{constructor(l,f,w,I,U,N){this.expression=l,this.uniformNames=f.map(Z=>`u_${Z}_t`),this.type=w,this.useIntegerZoom=I,this.zoom=U,this.maxValue=0,this.paintVertexAttributes=f.map(Z=>({name:`a_${Z}`,type:"Float32",components:w==="color"?4:2,offset:0})),this.paintVertexArray=new N}populatePaintArray(l,f,w,I,U){const N=this.expression.evaluate(new Zr(this.zoom),f,{},I,[],U),Z=this.expression.evaluate(new Zr(this.zoom+1),f,{},I,[],U),re=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(re,l,N,Z)}updatePaintArray(l,f,w,I){const U=this.expression.evaluate({zoom:this.zoom},w,I),N=this.expression.evaluate({zoom:this.zoom+1},w,I);this._setPaintValue(l,f,U,N)}_setPaintValue(l,f,w,I){if(this.type==="color"){const U=dt(w),N=dt(I);for(let Z=l;Z<f;Z++)this.paintVertexArray.emplace(Z,U[0],U[1],N[0],N[1])}else{for(let U=l;U<f;U++)this.paintVertexArray.emplace(U,w,I);this.maxValue=Math.max(this.maxValue,Math.abs(w),Math.abs(I))}}upload(l){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=l.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(l,f){const w=this.useIntegerZoom?Math.floor(f.zoom):f.zoom,I=z(this.expression.interpolationFactor(w,this.zoom,this.zoom+1),0,1);l.set(I)}getBinding(l,f,w){return new it(l,f)}}class Ht{constructor(l,f,w,I,U,N){this.expression=l,this.type=f,this.useIntegerZoom=w,this.zoom=I,this.layerId=N,this.zoomInPaintVertexArray=new U,this.zoomOutPaintVertexArray=new U}populatePaintArray(l,f,w){const I=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(l),this.zoomOutPaintVertexArray.resize(l),this._setPaintValues(I,l,f.patterns&&f.patterns[this.layerId],w)}updatePaintArray(l,f,w,I,U){this._setPaintValues(l,f,w.patterns&&w.patterns[this.layerId],U)}_setPaintValues(l,f,w,I){if(!I||!w)return;const{min:U,mid:N,max:Z}=w,re=I[U],ge=I[N],Ce=I[Z];if(re&&ge&&Ce)for(let Ie=l;Ie<f;Ie++)this.zoomInPaintVertexArray.emplace(Ie,ge.tl[0],ge.tl[1],ge.br[0],ge.br[1],re.tl[0],re.tl[1],re.br[0],re.br[1],ge.pixelRatio,re.pixelRatio),this.zoomOutPaintVertexArray.emplace(Ie,ge.tl[0],ge.tl[1],ge.br[0],ge.br[1],Ce.tl[0],Ce.tl[1],Ce.br[0],Ce.br[1],ge.pixelRatio,Ce.pixelRatio)}upload(l){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=l.createVertexBuffer(this.zoomInPaintVertexArray,b.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=l.createVertexBuffer(this.zoomOutPaintVertexArray,b.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class hi{constructor(l,f,w){this.binders={},this._buffers=[];const I=[];for(const U in l.paint._values){if(!w(U))continue;const N=l.paint.get(U);if(!(N instanceof uo&&qr(N.property.specification)))continue;const Z=qt(U,l.type),re=N.value,ge=N.property.specification.type,Ce=N.property.useIntegerZoom,Ie=N.property.specification["property-type"],ke=Ie==="cross-faded"||Ie==="cross-faded-data-driven";if(re.kind==="constant")this.binders[U]=ke?new Bt(re.value,Z):new ht(re.value,Z,ge),I.push(`/u_${U}`);else if(re.kind==="source"||ke){const $e=ji(U,ge,"source");this.binders[U]=ke?new Ht(re,ge,Ce,f,$e,l.id):new Pt(re,Z,ge,$e),I.push(`/a_${U}`)}else{const $e=ji(U,ge,"composite");this.binders[U]=new It(re,Z,ge,Ce,f,$e),I.push(`/z_${U}`)}}this.cacheKey=I.sort().join("")}getMaxValue(l){const f=this.binders[l];return f instanceof Pt||f instanceof It?f.maxValue:0}populatePaintArrays(l,f,w,I,U){for(const N in this.binders){const Z=this.binders[N];(Z instanceof Pt||Z instanceof It||Z instanceof Ht)&&Z.populatePaintArray(l,f,w,I,U)}}setConstantPatternPositions(l,f){for(const w in this.binders){const I=this.binders[w];I instanceof Bt&&I.setConstantPatternPositions(l,f)}}updatePaintArrays(l,f,w,I,U){let N=!1;for(const Z in l){const re=f.getPositions(Z);for(const ge of re){const Ce=w.feature(ge.index);for(const Ie in this.binders){const ke=this.binders[Ie];if((ke instanceof Pt||ke instanceof It||ke instanceof Ht)&&ke.expression.isStateDependent===!0){const $e=I.paint.get(Ie);ke.expression=$e.value,ke.updatePaintArray(ge.start,ge.end,Ce,l[Z],U),N=!0}}}}return N}defines(){const l=[];for(const f in this.binders){const w=this.binders[f];(w instanceof ht||w instanceof Bt)&&l.push(...w.uniformNames.map(I=>`#define HAS_UNIFORM_${I}`))}return l}getBinderAttributes(){const l=[];for(const f in this.binders){const w=this.binders[f];if(w instanceof Pt||w instanceof It)for(let I=0;I<w.paintVertexAttributes.length;I++)l.push(w.paintVertexAttributes[I].name);else if(w instanceof Ht)for(let I=0;I<b.members.length;I++)l.push(b.members[I].name)}return l}getBinderUniforms(){const l=[];for(const f in this.binders){const w=this.binders[f];if(w instanceof ht||w instanceof Bt||w instanceof It)for(const I of w.uniformNames)l.push(I)}return l}getPaintVertexBuffers(){return this._buffers}getUniforms(l,f){const w=[];for(const I in this.binders){const U=this.binders[I];if(U instanceof ht||U instanceof Bt||U instanceof It){for(const N of U.uniformNames)if(f[N]){const Z=U.getBinding(l,f[N],N);w.push({name:N,property:I,binding:Z})}}}return w}setUniforms(l,f,w,I){for(const{name:U,property:N,binding:Z}of f)this.binders[N].setUniform(Z,I,w.get(N),U)}updatePaintBuffers(l){this._buffers=[];for(const f in this.binders){const w=this.binders[f];if(l&&w instanceof Ht){const I=l.fromScale===2?w.zoomInPaintVertexBuffer:w.zoomOutPaintVertexBuffer;I&&this._buffers.push(I)}else(w instanceof Pt||w instanceof It)&&w.paintVertexBuffer&&this._buffers.push(w.paintVertexBuffer)}}upload(l){for(const f in this.binders){const w=this.binders[f];(w instanceof Pt||w instanceof It||w instanceof Ht)&&w.upload(l)}this.updatePaintBuffers()}destroy(){for(const l in this.binders){const f=this.binders[l];(f instanceof Pt||f instanceof It||f instanceof Ht)&&f.destroy()}}}class si{constructor(l,f,w=()=>!0){this.programConfigurations={};for(const I of l)this.programConfigurations[I.id]=new hi(I,f,w);this.needsUpload=!1,this._featureMap=new pe,this._bufferOffset=0}populatePaintArrays(l,f,w,I,U,N){for(const Z in this.programConfigurations)this.programConfigurations[Z].populatePaintArrays(l,f,I,U,N);f.id!==void 0&&this._featureMap.add(f.id,w,this._bufferOffset,l),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,f,w,I){for(const U of w)this.needsUpload=this.programConfigurations[U.id].updatePaintArrays(l,this._featureMap,f,U,I)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(const f in this.programConfigurations)this.programConfigurations[f].upload(l);this.needsUpload=!1}}destroy(){for(const l in this.programConfigurations)this.programConfigurations[l].destroy()}}function qt(A,l){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[A]||[A.replace(`${l}-`,"").replace(/-/g,"_")]}function ji(A,l,f){const w={color:{source:T,composite:zt},number:{source:gt,composite:T}},I=function(U){return{"line-pattern":{source:js,composite:js},"fill-pattern":{source:js,composite:js},"fill-extrusion-pattern":{source:js,composite:js}}[U]}(A);return I&&I[f]||w[l][f]}pn("ConstantBinder",ht),pn("CrossFadedConstantBinder",Bt),pn("SourceExpressionBinder",Pt),pn("CrossFadedCompositeBinder",Ht),pn("CompositeExpressionBinder",It),pn("ProgramConfiguration",hi,{omit:["_buffers"]}),pn("ProgramConfigurationSet",si);var Kt=8192;const Ci=Math.pow(2,14)-1,di=-Ci-1;function Ri(A){const l=Kt/A.extent,f=A.loadGeometry();for(let w=0;w<f.length;w++){const I=f[w];for(let U=0;U<I.length;U++){const N=I[U],Z=Math.round(N.x*l),re=Math.round(N.y*l);N.x=z(Z,di,Ci),N.y=z(re,di,Ci),(Z<N.x||Z>N.x+1||re<N.y||re>N.y+1)&&me("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return f}function Ai(A,l){return{type:A.type,id:A.id,properties:A.properties,geometry:l?Ri(A):[]}}function Mi(A,l,f,w,I){A.emplaceBack(2*l+(w+1)/2,2*f+(I+1)/2)}class $i{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new Lr,this.indexArray=new mo,this.segments=new a,this.programConfigurations=new si(l.layers,l.zoom),this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){const I=this.layers[0],U=[];let N=null,Z=!1;I.type==="circle"&&(N=I.layout.get("circle-sort-key"),Z=!N.isConstant());for(const{feature:re,id:ge,index:Ce,sourceLayerIndex:Ie}of l){const ke=this.layers[0]._featureFilter.needGeometry,$e=Ai(re,ke);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),$e,w))continue;const Ze=Z?N.evaluate($e,{},w):void 0,Rt={id:ge,properties:re.properties,type:re.type,sourceLayerIndex:Ie,index:Ce,geometry:ke?$e.geometry:Ri(re),patterns:{},sortKey:Ze};U.push(Rt)}Z&&U.sort((re,ge)=>re.sortKey-ge.sortKey);for(const re of U){const{geometry:ge,index:Ce,sourceLayerIndex:Ie}=re,ke=l[Ce].feature;this.addFeature(re,ge,Ce,w),f.featureIndex.insert(ke,ge,Ce,Ie,this.index)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,x),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(l,f,w,I){for(const U of f)for(const N of U){const Z=N.x,re=N.y;if(Z<0||Z>=Kt||re<0||re>=Kt)continue;const ge=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,l.sortKey),Ce=ge.vertexLength;Mi(this.layoutVertexArray,Z,re,-1,-1),Mi(this.layoutVertexArray,Z,re,1,-1),Mi(this.layoutVertexArray,Z,re,1,1),Mi(this.layoutVertexArray,Z,re,-1,1),this.indexArray.emplaceBack(Ce,Ce+1,Ce+2),this.indexArray.emplaceBack(Ce,Ce+3,Ce+2),ge.vertexLength+=4,ge.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,{},I)}}function Jt(A,l){for(let f=0;f<A.length;f++)if(Dr(l,A[f]))return!0;for(let f=0;f<l.length;f++)if(Dr(A,l[f]))return!0;return!!Mn(A,l)}function pi(A,l,f){return!!Dr(A,l)||!!lr(l,A,f)}function In(A,l){if(A.length===1)return _n(l,A[0]);for(let f=0;f<l.length;f++){const w=l[f];for(let I=0;I<w.length;I++)if(Dr(A,w[I]))return!0}for(let f=0;f<A.length;f++)if(_n(l,A[f]))return!0;for(let f=0;f<l.length;f++)if(Mn(A,l[f]))return!0;return!1}function Hn(A,l,f){if(A.length>1){if(Mn(A,l))return!0;for(let w=0;w<l.length;w++)if(lr(l[w],A,f))return!0}for(let w=0;w<A.length;w++)if(lr(A[w],l,f))return!0;return!1}function Mn(A,l){if(A.length===0||l.length===0)return!1;for(let f=0;f<A.length-1;f++){const w=A[f],I=A[f+1];for(let U=0;U<l.length-1;U++)if($n(w,I,l[U],l[U+1]))return!0}return!1}function $n(A,l,f,w){return De(A,f,w)!==De(l,f,w)&&De(A,l,f)!==De(A,l,w)}function lr(A,l,f){const w=f*f;if(l.length===1)return A.distSqr(l[0])<w;for(let I=1;I<l.length;I++)if(On(A,l[I-1],l[I])<w)return!0;return!1}function On(A,l,f){const w=l.distSqr(f);if(w===0)return A.distSqr(l);const I=((A.x-l.x)*(f.x-l.x)+(A.y-l.y)*(f.y-l.y))/w;return A.distSqr(I<0?l:I>1?f:f.sub(l)._mult(I)._add(l))}function _n(A,l){let f,w,I,U=!1;for(let N=0;N<A.length;N++){f=A[N];for(let Z=0,re=f.length-1;Z<f.length;re=Z++)w=f[Z],I=f[re],w.y>l.y!=I.y>l.y&&l.x<(I.x-w.x)*(l.y-w.y)/(I.y-w.y)+w.x&&(U=!U)}return U}function Dr(A,l){let f=!1;for(let w=0,I=A.length-1;w<A.length;I=w++){const U=A[w],N=A[I];U.y>l.y!=N.y>l.y&&l.x<(N.x-U.x)*(l.y-U.y)/(N.y-U.y)+U.x&&(f=!f)}return f}function Or(A,l,f){const w=f[0],I=f[2];if(A.x<w.x&&l.x<w.x||A.x>I.x&&l.x>I.x||A.y<w.y&&l.y<w.y||A.y>I.y&&l.y>I.y)return!1;const U=De(A,l,f[0]);return U!==De(A,l,f[1])||U!==De(A,l,f[2])||U!==De(A,l,f[3])}function Nr(A,l,f){const w=l.paint.get(A).value;return w.kind==="constant"?w.value:f.programConfigurations.get(l.id).getMaxValue(A)}function Qr(A){return Math.sqrt(A[0]*A[0]+A[1]*A[1])}function go(A,l,f,w,I){if(!l[0]&&!l[1])return A;const U=xe.convert(l)._mult(I);f==="viewport"&&U._rotate(-w);const N=[];for(let Z=0;Z<A.length;Z++)N.push(A[Z].sub(U));return N}pn("CircleBucket",$i,{omit:["layers"]});const Ca=new Cs({"circle-sort-key":new Vn($t.layout_circle["circle-sort-key"])});var jo={paint:new Cs({"circle-radius":new Vn($t.paint_circle["circle-radius"]),"circle-color":new Vn($t.paint_circle["circle-color"]),"circle-blur":new Vn($t.paint_circle["circle-blur"]),"circle-opacity":new Vn($t.paint_circle["circle-opacity"]),"circle-translate":new Fn($t.paint_circle["circle-translate"]),"circle-translate-anchor":new Fn($t.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Fn($t.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Fn($t.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Vn($t.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Vn($t.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Vn($t.paint_circle["circle-stroke-opacity"])}),layout:Ca},vs=1e-6,_r=typeof Float32Array<"u"?Float32Array:Array;function Xr(){var A=new _r(9);return _r!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[5]=0,A[6]=0,A[7]=0),A[0]=1,A[4]=1,A[8]=1,A}function Fr(A){return A[0]=1,A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=1,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[10]=1,A[11]=0,A[12]=0,A[13]=0,A[14]=0,A[15]=1,A}function Fs(A,l,f){var w=l[0],I=l[1],U=l[2],N=l[3],Z=l[4],re=l[5],ge=l[6],Ce=l[7],Ie=l[8],ke=l[9],$e=l[10],Ze=l[11],Rt=l[12],Mt=l[13],ri=l[14],mi=l[15],ei=f[0],ui=f[1],Pi=f[2],Fi=f[3];return A[0]=ei*w+ui*Z+Pi*Ie+Fi*Rt,A[1]=ei*I+ui*re+Pi*ke+Fi*Mt,A[2]=ei*U+ui*ge+Pi*$e+Fi*ri,A[3]=ei*N+ui*Ce+Pi*Ze+Fi*mi,A[4]=(ei=f[4])*w+(ui=f[5])*Z+(Pi=f[6])*Ie+(Fi=f[7])*Rt,A[5]=ei*I+ui*re+Pi*ke+Fi*Mt,A[6]=ei*U+ui*ge+Pi*$e+Fi*ri,A[7]=ei*N+ui*Ce+Pi*Ze+Fi*mi,A[8]=(ei=f[8])*w+(ui=f[9])*Z+(Pi=f[10])*Ie+(Fi=f[11])*Rt,A[9]=ei*I+ui*re+Pi*ke+Fi*Mt,A[10]=ei*U+ui*ge+Pi*$e+Fi*ri,A[11]=ei*N+ui*Ce+Pi*Ze+Fi*mi,A[12]=(ei=f[12])*w+(ui=f[13])*Z+(Pi=f[14])*Ie+(Fi=f[15])*Rt,A[13]=ei*I+ui*re+Pi*ke+Fi*Mt,A[14]=ei*U+ui*ge+Pi*$e+Fi*ri,A[15]=ei*N+ui*Ce+Pi*Ze+Fi*mi,A}Math.hypot||(Math.hypot=function(){for(var A=0,l=arguments.length;l--;)A+=arguments[l]*arguments[l];return Math.sqrt(A)});var eo,ns=Fs;function Io(){var A=new _r(3);return _r!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0),A}function Bu(A,l,f){var w=new _r(3);return w[0]=A,w[1]=l,w[2]=f,w}function ja(A,l,f){var w=l[0],I=l[1],U=l[2],N=l[3];return A[0]=f[0]*w+f[4]*I+f[8]*U+f[12]*N,A[1]=f[1]*w+f[5]*I+f[9]*U+f[13]*N,A[2]=f[2]*w+f[6]*I+f[10]*U+f[14]*N,A[3]=f[3]*w+f[7]*I+f[11]*U+f[15]*N,A}function _o(){var A=new _r(4);return _r!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0),A[3]=1,A}function Ea(A,l){const f=ja([],[A.x,A.y,0,1],l);return new xe(f[0]/f[3],f[1]/f[3])}Io(),eo=new _r(4),_r!=Float32Array&&(eo[0]=0,eo[1]=0,eo[2]=0,eo[3]=0),Io(),Bu(1,0,0),Bu(0,1,0),_o(),_o(),Xr(),function(){var A;A=new _r(2),_r!=Float32Array&&(A[0]=0,A[1]=0)}();class vl extends $i{}pn("HeatmapBucket",vl,{omit:["layers"]});var Zl={paint:new Cs({"heatmap-radius":new Vn($t.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vn($t.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Fn($t.paint_heatmap["heatmap-intensity"]),"heatmap-color":new yl($t.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Fn($t.paint_heatmap["heatmap-opacity"])})};function $h(A,{width:l,height:f},w,I){if(I){if(I instanceof Uint8ClampedArray)I=new Uint8Array(I.buffer);else if(I.length!==l*f*w)throw new RangeError(`mismatched image size. expected: ${I.length} but got: ${l*f*w}`)}else I=new Uint8Array(l*f*w);return A.width=l,A.height=f,A.data=I,A}function Zh(A,{width:l,height:f},w){if(l===A.width&&f===A.height)return;const I=$h({},{width:l,height:f},w);Ka(A,I,{x:0,y:0},{x:0,y:0},{width:Math.min(A.width,l),height:Math.min(A.height,f)},w),A.width=l,A.height=f,A.data=I.data}function Ka(A,l,f,w,I,U){if(I.width===0||I.height===0)return l;if(I.width>A.width||I.height>A.height||f.x>A.width-I.width||f.y>A.height-I.height)throw new RangeError("out of range source coordinates for image copy");if(I.width>l.width||I.height>l.height||w.x>l.width-I.width||w.y>l.height-I.height)throw new RangeError("out of range destination coordinates for image copy");const N=A.data,Z=l.data;if(N===Z)throw new Error("srcData equals dstData, so image is already copied");for(let re=0;re<I.height;re++){const ge=((f.y+re)*A.width+f.x)*U,Ce=((w.y+re)*l.width+w.x)*U;for(let Ie=0;Ie<I.width*U;Ie++)Z[Ce+Ie]=N[ge+Ie]}return l}class Xh{constructor(l,f){$h(this,l,1,f)}resize(l){Zh(this,l,1)}clone(){return new Xh({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(l,f,w,I,U){Ka(l,f,w,I,U,1)}}class Aa{constructor(l,f){$h(this,l,4,f)}resize(l){Zh(this,l,4)}replace(l,f){f?this.data.set(l):this.data=l instanceof Uint8ClampedArray?new Uint8Array(l.buffer):l}clone(){return new Aa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(l,f,w,I,U){Ka(l,f,w,I,U,4)}}function rg(A){const l={},f=A.resolution||256,w=A.clips?A.clips.length:1,I=A.image||new Aa({width:f,height:w});if(Math.log(f)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${f}`);const U=(N,Z,re)=>{l[A.evaluationKey]=re;const ge=A.expression.evaluate(l);I.data[N+Z+0]=Math.floor(255*ge.r/ge.a),I.data[N+Z+1]=Math.floor(255*ge.g/ge.a),I.data[N+Z+2]=Math.floor(255*ge.b/ge.a),I.data[N+Z+3]=Math.floor(255*ge.a)};if(A.clips)for(let N=0,Z=0;N<w;++N,Z+=4*f)for(let re=0,ge=0;re<f;re++,ge+=4){const Ce=re/(f-1),{start:Ie,end:ke}=A.clips[N];U(Z,ge,Ie*(1-Ce)+ke*Ce)}else for(let N=0,Z=0;N<f;N++,Z+=4)U(0,Z,N/(f-1));return I}pn("AlphaImage",Xh),pn("RGBAImage",Aa);var sg={paint:new Cs({"hillshade-illumination-direction":new Fn($t.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Fn($t.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Fn($t.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Fn($t.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Fn($t.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Fn($t.paint_hillshade["hillshade-accent-color"])})};const Ey=Is([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ty}=Ey;var up={exports:{}};function Ap(A,l,f){f=f||2;var w,I,U,N,Z,re,ge,Ce=l&&l.length,Ie=Ce?l[0]*f:A.length,ke=og(A,0,Ie,f,!0),$e=[];if(!ke||ke.next===ke.prev)return $e;if(Ce&&(ke=function(Rt,Mt,ri,mi){var ei,ui,Pi,Fi=[];for(ei=0,ui=Mt.length;ei<ui;ei++)(Pi=og(Rt,Mt[ei]*mi,ei<ui-1?Mt[ei+1]*mi:Rt.length,mi,!1))===Pi.next&&(Pi.steiner=!0),Fi.push(r1(Pi));for(Fi.sort(ad),ei=0;ei<Fi.length;ei++)ri=Iy(Fi[ei],ri);return ri}(A,l,ke,f)),A.length>80*f){w=U=A[0],I=N=A[1];for(var Ze=f;Ze<Ie;Ze+=f)(Z=A[Ze])<w&&(w=Z),(re=A[Ze+1])<I&&(I=re),Z>U&&(U=Z),re>N&&(N=re);ge=(ge=Math.max(U-w,N-I))!==0?32767/ge:0}return od(ke,$e,f,w,I,ge,0),$e}function og(A,l,f,w,I){var U,N;if(I===gA(A,l,f,w)>0)for(U=l;U<f;U+=w)N=Py(U,A[U],A[U+1],N);else for(U=f-w;U>=l;U-=w)N=Py(U,A[U],A[U+1],N);return N&&fA(N,N.next)&&(pp(N),N=N.next),N}function Cu(A,l){if(!A)return A;l||(l=A);var f,w=A;do if(f=!1,w.steiner||!fA(w,w.next)&&Ls(w.prev,w,w.next)!==0)w=w.next;else{if(pp(w),(w=l=w.prev)===w.next)break;f=!0}while(f||w!==l);return l}function od(A,l,f,w,I,U,N){if(A){!N&&U&&function(Ce,Ie,ke,$e){var Ze=Ce;do Ze.z===0&&(Ze.z=Bf(Ze.x,Ze.y,Ie,ke,$e)),Ze.prevZ=Ze.prev,Ze.nextZ=Ze.next,Ze=Ze.next;while(Ze!==Ce);Ze.prevZ.nextZ=null,Ze.prevZ=null,function(Rt){var Mt,ri,mi,ei,ui,Pi,Fi,Sn,fn=1;do{for(ri=Rt,Rt=null,ui=null,Pi=0;ri;){for(Pi++,mi=ri,Fi=0,Mt=0;Mt<fn&&(Fi++,mi=mi.nextZ);Mt++);for(Sn=fn;Fi>0||Sn>0&&mi;)Fi!==0&&(Sn===0||!mi||ri.z<=mi.z)?(ei=ri,ri=ri.nextZ,Fi--):(ei=mi,mi=mi.nextZ,Sn--),ui?ui.nextZ=ei:Rt=ei,ei.prevZ=ui,ui=ei;ri=mi}ui.nextZ=null,fn*=2}while(Pi>1)}(Ze)}(A,w,I,U);for(var Z,re,ge=A;A.prev!==A.next;)if(Z=A.prev,re=A.next,U?My(A,w,I,U):Sy(A))l.push(Z.i/f|0),l.push(A.i/f|0),l.push(re.i/f|0),pp(A),A=re.next,ge=re.next;else if((A=re)===ge){N?N===1?od(A=i1(Cu(A),l,f),l,f,w,I,U,2):N===2&&n1(A,l,f,w,I,U):od(Cu(A),l,f,w,I,U,1);break}}}function Sy(A){var l=A.prev,f=A,w=A.next;if(Ls(l,f,w)>=0)return!1;for(var I=l.x,U=f.x,N=w.x,Z=l.y,re=f.y,ge=w.y,Ce=I<U?I<N?I:N:U<N?U:N,Ie=Z<re?Z<ge?Z:ge:re<ge?re:ge,ke=I>U?I>N?I:N:U>N?U:N,$e=Z>re?Z>ge?Z:ge:re>ge?re:ge,Ze=w.next;Ze!==l;){if(Ze.x>=Ce&&Ze.x<=ke&&Ze.y>=Ie&&Ze.y<=$e&&qh(I,Z,U,re,N,ge,Ze.x,Ze.y)&&Ls(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.next}return!0}function My(A,l,f,w){var I=A.prev,U=A,N=A.next;if(Ls(I,U,N)>=0)return!1;for(var Z=I.x,re=U.x,ge=N.x,Ce=I.y,Ie=U.y,ke=N.y,$e=Z<re?Z<ge?Z:ge:re<ge?re:ge,Ze=Ce<Ie?Ce<ke?Ce:ke:Ie<ke?Ie:ke,Rt=Z>re?Z>ge?Z:ge:re>ge?re:ge,Mt=Ce>Ie?Ce>ke?Ce:ke:Ie>ke?Ie:ke,ri=Bf($e,Ze,l,f,w),mi=Bf(Rt,Mt,l,f,w),ei=A.prevZ,ui=A.nextZ;ei&&ei.z>=ri&&ui&&ui.z<=mi;){if(ei.x>=$e&&ei.x<=Rt&&ei.y>=Ze&&ei.y<=Mt&&ei!==I&&ei!==N&&qh(Z,Ce,re,Ie,ge,ke,ei.x,ei.y)&&Ls(ei.prev,ei,ei.next)>=0||(ei=ei.prevZ,ui.x>=$e&&ui.x<=Rt&&ui.y>=Ze&&ui.y<=Mt&&ui!==I&&ui!==N&&qh(Z,Ce,re,Ie,ge,ke,ui.x,ui.y)&&Ls(ui.prev,ui,ui.next)>=0))return!1;ui=ui.nextZ}for(;ei&&ei.z>=ri;){if(ei.x>=$e&&ei.x<=Rt&&ei.y>=Ze&&ei.y<=Mt&&ei!==I&&ei!==N&&qh(Z,Ce,re,Ie,ge,ke,ei.x,ei.y)&&Ls(ei.prev,ei,ei.next)>=0)return!1;ei=ei.prevZ}for(;ui&&ui.z<=mi;){if(ui.x>=$e&&ui.x<=Rt&&ui.y>=Ze&&ui.y<=Mt&&ui!==I&&ui!==N&&qh(Z,Ce,re,Ie,ge,ke,ui.x,ui.y)&&Ls(ui.prev,ui,ui.next)>=0)return!1;ui=ui.nextZ}return!0}function i1(A,l,f){var w=A;do{var I=w.prev,U=w.next.next;!fA(I,U)&&oh(I,w,w.next,U)&&ld(I,U)&&ld(U,I)&&(l.push(I.i/f|0),l.push(w.i/f|0),l.push(U.i/f|0),pp(w),pp(w.next),w=A=U),w=w.next}while(w!==A);return Cu(w)}function n1(A,l,f,w,I,U){var N=A;do{for(var Z=N.next.next;Z!==N.prev;){if(N.i!==Z.i&&Ly(N,Z)){var re=Dy(N,Z);return N=Cu(N,N.next),re=Cu(re,re.next),od(N,l,f,w,I,U,0),void od(re,l,f,w,I,U,0)}Z=Z.next}N=N.next}while(N!==A)}function ad(A,l){return A.x-l.x}function Iy(A,l){var f=function(I,U){var N,Z=U,re=I.x,ge=I.y,Ce=-1/0;do{if(ge<=Z.y&&ge>=Z.next.y&&Z.next.y!==Z.y){var Ie=Z.x+(ge-Z.y)*(Z.next.x-Z.x)/(Z.next.y-Z.y);if(Ie<=re&&Ie>Ce&&(Ce=Ie,N=Z.x<Z.next.x?Z:Z.next,Ie===re))return N}Z=Z.next}while(Z!==U);if(!N)return null;var ke,$e=N,Ze=N.x,Rt=N.y,Mt=1/0;Z=N;do re>=Z.x&&Z.x>=Ze&&re!==Z.x&&qh(ge<Rt?re:Ce,ge,Ze,Rt,ge<Rt?Ce:re,ge,Z.x,Z.y)&&(ke=Math.abs(ge-Z.y)/(re-Z.x),ld(Z,I)&&(ke<Mt||ke===Mt&&(Z.x>N.x||Z.x===N.x&&Fy(N,Z)))&&(N=Z,Mt=ke)),Z=Z.next;while(Z!==$e);return N}(A,l);if(!f)return l;var w=Dy(f,A);return Cu(w,w.next),Cu(f,f.next)}function Fy(A,l){return Ls(A.prev,A,l.prev)<0&&Ls(l.next,A,A.next)<0}function Bf(A,l,f,w,I){return(A=1431655765&((A=858993459&((A=252645135&((A=16711935&((A=(A-f)*I|0)|A<<8))|A<<4))|A<<2))|A<<1))|(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-w)*I|0)|l<<8))|l<<4))|l<<2))|l<<1))<<1}function r1(A){var l=A,f=A;do(l.x<f.x||l.x===f.x&&l.y<f.y)&&(f=l),l=l.next;while(l!==A);return f}function qh(A,l,f,w,I,U,N,Z){return(I-N)*(l-Z)>=(A-N)*(U-Z)&&(A-N)*(w-Z)>=(f-N)*(l-Z)&&(f-N)*(U-Z)>=(I-N)*(w-Z)}function Ly(A,l){return A.next.i!==l.i&&A.prev.i!==l.i&&!function(f,w){var I=f;do{if(I.i!==f.i&&I.next.i!==f.i&&I.i!==w.i&&I.next.i!==w.i&&oh(I,I.next,f,w))return!0;I=I.next}while(I!==f);return!1}(A,l)&&(ld(A,l)&&ld(l,A)&&function(f,w){var I=f,U=!1,N=(f.x+w.x)/2,Z=(f.y+w.y)/2;do I.y>Z!=I.next.y>Z&&I.next.y!==I.y&&N<(I.next.x-I.x)*(Z-I.y)/(I.next.y-I.y)+I.x&&(U=!U),I=I.next;while(I!==f);return U}(A,l)&&(Ls(A.prev,A,l.prev)||Ls(A,l.prev,l))||fA(A,l)&&Ls(A.prev,A,A.next)>0&&Ls(l.prev,l,l.next)>0)}function Ls(A,l,f){return(l.y-A.y)*(f.x-l.x)-(l.x-A.x)*(f.y-l.y)}function fA(A,l){return A.x===l.x&&A.y===l.y}function oh(A,l,f,w){var I=dp(Ls(A,l,f)),U=dp(Ls(A,l,w)),N=dp(Ls(f,w,A)),Z=dp(Ls(f,w,l));return I!==U&&N!==Z||!(I!==0||!mA(A,f,l))||!(U!==0||!mA(A,w,l))||!(N!==0||!mA(f,A,w))||!(Z!==0||!mA(f,l,w))}function mA(A,l,f){return l.x<=Math.max(A.x,f.x)&&l.x>=Math.min(A.x,f.x)&&l.y<=Math.max(A.y,f.y)&&l.y>=Math.min(A.y,f.y)}function dp(A){return A>0?1:A<0?-1:0}function ld(A,l){return Ls(A.prev,A,A.next)<0?Ls(A,l,A.next)>=0&&Ls(A,A.prev,l)>=0:Ls(A,l,A.prev)<0||Ls(A,A.next,l)<0}function Dy(A,l){var f=new fp(A.i,A.x,A.y),w=new fp(l.i,l.x,l.y),I=A.next,U=l.prev;return A.next=l,l.prev=A,f.next=I,I.prev=f,w.next=f,f.prev=w,U.next=w,w.prev=U,w}function Py(A,l,f,w){var I=new fp(A,l,f);return w?(I.next=w.next,I.prev=w,w.next.prev=I,w.next=I):(I.prev=I,I.next=I),I}function pp(A){A.next.prev=A.prev,A.prev.next=A.next,A.prevZ&&(A.prevZ.nextZ=A.nextZ),A.nextZ&&(A.nextZ.prevZ=A.prevZ)}function fp(A,l,f){this.i=A,this.x=l,this.y=f,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gA(A,l,f,w){for(var I=0,U=l,N=f-w;U<f;U+=w)I+=(A[N]-A[U])*(A[U+1]+A[N+1]),N=U;return I}function cd(A,l,f,w,I){ah(A,l,f||0,w||A.length-1,I||Eu)}function ah(A,l,f,w,I){for(;w>f;){if(w-f>600){var U=w-f+1,N=l-f+1,Z=Math.log(U),re=.5*Math.exp(2*Z/3),ge=.5*Math.sqrt(Z*re*(U-re)/U)*(N-U/2<0?-1:1);ah(A,l,Math.max(f,Math.floor(l-N*re/U+ge)),Math.min(w,Math.floor(l+(U-N)*re/U+ge)),I)}var Ce=A[l],Ie=f,ke=w;for(Ta(A,f,l),I(A[w],Ce)>0&&Ta(A,f,w);Ie<ke;){for(Ta(A,Ie,ke),Ie++,ke--;I(A[Ie],Ce)<0;)Ie++;for(;I(A[ke],Ce)>0;)ke--}I(A[f],Ce)===0?Ta(A,f,ke):Ta(A,++ke,w),ke<=l&&(f=ke+1),l<=ke&&(w=ke-1)}}function Ta(A,l,f){var w=A[l];A[l]=A[f],A[f]=w}function Eu(A,l){return A<l?-1:A>l?1:0}function lh(A,l){const f=A.length;if(f<=1)return[A];const w=[];let I,U;for(let N=0;N<f;N++){const Z=Je(A[N]);Z!==0&&(A[N].area=Math.abs(Z),U===void 0&&(U=Z<0),U===Z<0?(I&&w.push(I),I=[A[N]]):I.push(A[N]))}if(I&&w.push(I),l>1)for(let N=0;N<w.length;N++)w[N].length<=l||(cd(w[N],l,1,w[N].length-1,_A),w[N]=w[N].slice(0,l));return w}function _A(A,l){return l.area-A.area}function ag(A,l,f){const w=f.patternDependencies;let I=!1;for(const U of l){const N=U.paint.get(`${A}-pattern`);N.isConstant()||(I=!0);const Z=N.constantOr(null);Z&&(I=!0,w[Z.to]=!0,w[Z.from]=!0)}return I}function lg(A,l,f,w,I){const U=I.patternDependencies;for(const N of l){const Z=N.paint.get(`${A}-pattern`).value;if(Z.kind!=="constant"){let re=Z.evaluate({zoom:w-1},f,{},I.availableImages),ge=Z.evaluate({zoom:w},f,{},I.availableImages),Ce=Z.evaluate({zoom:w+1},f,{},I.availableImages);re=re&&re.name?re.name:re,ge=ge&&ge.name?ge.name:ge,Ce=Ce&&Ce.name?Ce.name:Ce,U[re]=!0,U[ge]=!0,U[Ce]=!0,f.patterns[N.id]={min:re,mid:ge,max:Ce}}}return f}up.exports=Ap,up.exports.default=Ap,Ap.deviation=function(A,l,f,w){var I=l&&l.length,U=Math.abs(gA(A,0,I?l[0]*f:A.length,f));if(I)for(var N=0,Z=l.length;N<Z;N++)U-=Math.abs(gA(A,l[N]*f,N<Z-1?l[N+1]*f:A.length,f));var re=0;for(N=0;N<w.length;N+=3){var ge=w[N]*f,Ce=w[N+1]*f,Ie=w[N+2]*f;re+=Math.abs((A[ge]-A[Ie])*(A[Ce+1]-A[ge+1])-(A[ge]-A[Ce])*(A[Ie+1]-A[ge+1]))}return U===0&&re===0?0:Math.abs((re-U)/U)},Ap.flatten=function(A){for(var l=A[0][0].length,f={vertices:[],holes:[],dimensions:l},w=0,I=0;I<A.length;I++){for(var U=0;U<A[I].length;U++)for(var N=0;N<l;N++)f.vertices.push(A[I][U][N]);I>0&&f.holes.push(w+=A[I-1].length)}return f};class cg{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Rr,this.indexArray=new mo,this.indexArray2=new Ba,this.programConfigurations=new si(l.layers,l.zoom),this.segments=new a,this.segments2=new a,this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){this.hasPattern=ag("fill",this.layers,f);const I=this.layers[0].layout.get("fill-sort-key"),U=!I.isConstant(),N=[];for(const{feature:Z,id:re,index:ge,sourceLayerIndex:Ce}of l){const Ie=this.layers[0]._featureFilter.needGeometry,ke=Ai(Z,Ie);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),ke,w))continue;const $e=U?I.evaluate(ke,{},w,f.availableImages):void 0,Ze={id:re,properties:Z.properties,type:Z.type,sourceLayerIndex:Ce,index:ge,geometry:Ie?ke.geometry:Ri(Z),patterns:{},sortKey:$e};N.push(Ze)}U&&N.sort((Z,re)=>Z.sortKey-re.sortKey);for(const Z of N){const{geometry:re,index:ge,sourceLayerIndex:Ce}=Z;if(this.hasPattern){const Ie=lg("fill",this.layers,Z,this.zoom,f);this.patternFeatures.push(Ie)}else this.addFeature(Z,re,ge,w,{});f.featureIndex.insert(l[ge].feature,re,ge,Ce,this.index)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}addFeatures(l,f,w){for(const I of this.patternFeatures)this.addFeature(I,I.geometry,I.index,f,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Ty),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.indexBuffer2=l.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(l),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(l,f,w,I,U){for(const N of lh(f,500)){let Z=0;for(const $e of N)Z+=$e.length;const re=this.segments.prepareSegment(Z,this.layoutVertexArray,this.indexArray),ge=re.vertexLength,Ce=[],Ie=[];for(const $e of N){if($e.length===0)continue;$e!==N[0]&&Ie.push(Ce.length/2);const Ze=this.segments2.prepareSegment($e.length,this.layoutVertexArray,this.indexArray2),Rt=Ze.vertexLength;this.layoutVertexArray.emplaceBack($e[0].x,$e[0].y),this.indexArray2.emplaceBack(Rt+$e.length-1,Rt),Ce.push($e[0].x),Ce.push($e[0].y);for(let Mt=1;Mt<$e.length;Mt++)this.layoutVertexArray.emplaceBack($e[Mt].x,$e[Mt].y),this.indexArray2.emplaceBack(Rt+Mt-1,Rt+Mt),Ce.push($e[Mt].x),Ce.push($e[Mt].y);Ze.vertexLength+=$e.length,Ze.primitiveLength+=$e.length}const ke=up.exports(Ce,Ie);for(let $e=0;$e<ke.length;$e+=3)this.indexArray.emplaceBack(ge+ke[$e],ge+ke[$e+1],ge+ke[$e+2]);re.vertexLength+=Z,re.primitiveLength+=ke.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,U,I)}}pn("FillBucket",cg,{omit:["layers","patternFeatures"]});const s1=new Cs({"fill-sort-key":new Vn($t.layout_fill["fill-sort-key"])});var Uy={paint:new Cs({"fill-antialias":new Fn($t.paint_fill["fill-antialias"]),"fill-opacity":new Vn($t.paint_fill["fill-opacity"]),"fill-color":new Vn($t.paint_fill["fill-color"]),"fill-outline-color":new Vn($t.paint_fill["fill-outline-color"]),"fill-translate":new Fn($t.paint_fill["fill-translate"]),"fill-translate-anchor":new Fn($t.paint_fill["fill-translate-anchor"]),"fill-pattern":new sh($t.paint_fill["fill-pattern"])}),layout:s1};const Cf=Is([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),vc=Is([{name:"a_centroid",components:2,type:"Int16"}],4),{members:o1}=Cf;var Tu={},to=xe,Zn=wl;function wl(A,l,f,w,I){this.properties={},this.extent=f,this.type=0,this._pbf=A,this._geometry=-1,this._keys=w,this._values=I,A.readFields(Ef,this,l)}function Ef(A,l,f){A==1?l.id=f.readVarint():A==2?function(w,I){for(var U=w.readVarint()+w.pos;w.pos<U;){var N=I._keys[w.readVarint()],Z=I._values[w.readVarint()];I.properties[N]=Z}}(f,l):A==3?l.type=f.readVarint():A==4&&(l._geometry=f.pos)}function Pr(A){for(var l,f,w=0,I=0,U=A.length,N=U-1;I<U;N=I++)w+=((f=A[N]).x-(l=A[I]).x)*(l.y+f.y);return w}wl.types=["Unknown","Point","LineString","Polygon"],wl.prototype.loadGeometry=function(){var A=this._pbf;A.pos=this._geometry;for(var l,f=A.readVarint()+A.pos,w=1,I=0,U=0,N=0,Z=[];A.pos<f;){if(I<=0){var re=A.readVarint();w=7&re,I=re>>3}if(I--,w===1||w===2)U+=A.readSVarint(),N+=A.readSVarint(),w===1&&(l&&Z.push(l),l=[]),l.push(new to(U,N));else{if(w!==7)throw new Error("unknown command "+w);l&&l.push(l[0].clone())}}return l&&Z.push(l),Z},wl.prototype.bbox=function(){var A=this._pbf;A.pos=this._geometry;for(var l=A.readVarint()+A.pos,f=1,w=0,I=0,U=0,N=1/0,Z=-1/0,re=1/0,ge=-1/0;A.pos<l;){if(w<=0){var Ce=A.readVarint();f=7&Ce,w=Ce>>3}if(w--,f===1||f===2)(I+=A.readSVarint())<N&&(N=I),I>Z&&(Z=I),(U+=A.readSVarint())<re&&(re=U),U>ge&&(ge=U);else if(f!==7)throw new Error("unknown command "+f)}return[N,re,Z,ge]},wl.prototype.toGeoJSON=function(A,l,f){var w,I,U=this.extent*Math.pow(2,f),N=this.extent*A,Z=this.extent*l,re=this.loadGeometry(),ge=wl.types[this.type];function Ce($e){for(var Ze=0;Ze<$e.length;Ze++){var Rt=$e[Ze];$e[Ze]=[360*(Rt.x+N)/U-180,360/Math.PI*Math.atan(Math.exp((180-360*(Rt.y+Z)/U)*Math.PI/180))-90]}}switch(this.type){case 1:var Ie=[];for(w=0;w<re.length;w++)Ie[w]=re[w][0];Ce(re=Ie);break;case 2:for(w=0;w<re.length;w++)Ce(re[w]);break;case 3:for(re=function($e){var Ze=$e.length;if(Ze<=1)return[$e];for(var Rt,Mt,ri=[],mi=0;mi<Ze;mi++){var ei=Pr($e[mi]);ei!==0&&(Mt===void 0&&(Mt=ei<0),Mt===ei<0?(Rt&&ri.push(Rt),Rt=[$e[mi]]):Rt.push($e[mi]))}return Rt&&ri.push(Rt),ri}(re),w=0;w<re.length;w++)for(I=0;I<re[w].length;I++)Ce(re[w][I])}re.length===1?re=re[0]:ge="Multi"+ge;var ke={type:"Feature",geometry:{type:ge,coordinates:re},properties:this.properties};return"id"in this&&(ke.id=this.id),ke};var Ry=Zn,Tf=wc;function wc(A,l){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=A,this._keys=[],this._values=[],this._features=[],A.readFields(ch,this,l),this.length=this._features.length}function ch(A,l,f){A===15?l.version=f.readVarint():A===1?l.name=f.readString():A===5?l.extent=f.readVarint():A===2?l._features.push(f.pos):A===3?l._keys.push(f.readString()):A===4&&l._values.push(function(w){for(var I=null,U=w.readVarint()+w.pos;w.pos<U;){var N=w.readVarint()>>3;I=N===1?w.readString():N===2?w.readFloat():N===3?w.readDouble():N===4?w.readVarint64():N===5?w.readVarint():N===6?w.readSVarint():N===7?w.readBoolean():null}return I}(f))}wc.prototype.feature=function(A){if(A<0||A>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[A];var l=this._pbf.readVarint()+this._pbf.pos;return new Ry(this._pbf,l,this.extent,this._keys,this._values)};var Xl=Tf;function bl(A,l,f){if(A===3){var w=new Xl(f,f.readVarint()+f.pos);w.length&&(l[w.name]=w)}}Tu.VectorTile=function(A,l){this.layers=A.readFields(bl,{},l)},Tu.VectorTileFeature=Zn,Tu.VectorTileLayer=Tf;const Fo=Tu.VectorTileFeature.types,Sf=Math.pow(2,13);function $a(A,l,f,w,I,U,N,Z){A.emplaceBack(l,f,2*Math.floor(w*Sf)+N,I*Sf*2,U*Sf*2,Math.round(Z))}class Mf{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new Cr,this.centroidVertexArray=new Un,this.indexArray=new mo,this.programConfigurations=new si(l.layers,l.zoom),this.segments=new a,this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){this.features=[],this.hasPattern=ag("fill-extrusion",this.layers,f);for(const{feature:I,id:U,index:N,sourceLayerIndex:Z}of l){const re=this.layers[0]._featureFilter.needGeometry,ge=Ai(I,re);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),ge,w))continue;const Ce={id:U,sourceLayerIndex:Z,index:N,geometry:re?ge.geometry:Ri(I),properties:I.properties,type:I.type,patterns:{}};this.hasPattern?this.features.push(lg("fill-extrusion",this.layers,Ce,this.zoom,f)):this.addFeature(Ce,Ce.geometry,N,w,{}),f.featureIndex.insert(I,Ce.geometry,N,Z,this.index,!0)}}addFeatures(l,f,w){for(const I of this.features){const{geometry:U}=I;this.addFeature(I,U,I.index,f,w)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,o1),this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,vc.members,!0),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(l,f,w,I,U){const N={x:0,y:0,vertexCount:0};for(const Z of lh(f,500)){let re=0;for(const Ze of Z)re+=Ze.length;let ge=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Ze of Z){if(Ze.length===0||hg(Ze))continue;let Rt=0;for(let Mt=0;Mt<Ze.length;Mt++){const ri=Ze[Mt];if(Mt>=1){const mi=Ze[Mt-1];if(!hd(ri,mi)){ge.vertexLength+4>a.MAX_VERTEX_ARRAY_LENGTH&&(ge=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ei=ri.sub(mi)._perp()._unit(),ui=mi.dist(ri);Rt+ui>32768&&(Rt=0),$a(this.layoutVertexArray,ri.x,ri.y,ei.x,ei.y,0,0,Rt),$a(this.layoutVertexArray,ri.x,ri.y,ei.x,ei.y,0,1,Rt),N.x+=2*ri.x,N.y+=2*ri.y,N.vertexCount+=2,Rt+=ui,$a(this.layoutVertexArray,mi.x,mi.y,ei.x,ei.y,0,0,Rt),$a(this.layoutVertexArray,mi.x,mi.y,ei.x,ei.y,0,1,Rt),N.x+=2*mi.x,N.y+=2*mi.y,N.vertexCount+=2;const Pi=ge.vertexLength;this.indexArray.emplaceBack(Pi,Pi+2,Pi+1),this.indexArray.emplaceBack(Pi+1,Pi+2,Pi+3),ge.vertexLength+=4,ge.primitiveLength+=2}}}}if(ge.vertexLength+re>a.MAX_VERTEX_ARRAY_LENGTH&&(ge=this.segments.prepareSegment(re,this.layoutVertexArray,this.indexArray)),Fo[l.type]!=="Polygon")continue;const Ce=[],Ie=[],ke=ge.vertexLength;for(const Ze of Z)if(Ze.length!==0){Ze!==Z[0]&&Ie.push(Ce.length/2);for(let Rt=0;Rt<Ze.length;Rt++){const Mt=Ze[Rt];$a(this.layoutVertexArray,Mt.x,Mt.y,0,0,1,1,0),N.x+=Mt.x,N.y+=Mt.y,N.vertexCount+=1,Ce.push(Mt.x),Ce.push(Mt.y)}}const $e=up.exports(Ce,Ie);for(let Ze=0;Ze<$e.length;Ze+=3)this.indexArray.emplaceBack(ke+$e[Ze],ke+$e[Ze+2],ke+$e[Ze+1]);ge.primitiveLength+=$e.length/3,ge.vertexLength+=re}for(let Z=0;Z<N.vertexCount;Z++)this.centroidVertexArray.emplaceBack(Math.floor(N.x/N.vertexCount),Math.floor(N.y/N.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,U,I)}}function hd(A,l){return A.x===l.x&&(A.x<0||A.x>Kt)||A.y===l.y&&(A.y<0||A.y>Kt)}function hg(A){return A.every(l=>l.x<0)||A.every(l=>l.x>Kt)||A.every(l=>l.y<0)||A.every(l=>l.y>Kt)}pn("FillExtrusionBucket",Mf,{omit:["layers","features"]});var zy={paint:new Cs({"fill-extrusion-opacity":new Fn($t["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vn($t["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Fn($t["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Fn($t["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new sh($t["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vn($t["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vn($t["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Fn($t["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function yA(A,l){return A.x*l.x+A.y*l.y}function ky(A,l){if(A.length===1){let f=0;const w=l[f++];let I;for(;!I||w.equals(I);)if(I=l[f++],!I)return 1/0;for(;f<l.length;f++){const U=l[f],N=A[0],Z=I.sub(w),re=U.sub(w),ge=N.sub(w),Ce=yA(Z,Z),Ie=yA(Z,re),ke=yA(re,re),$e=yA(ge,Z),Ze=yA(ge,re),Rt=Ce*ke-Ie*Ie,Mt=(ke*$e-Ie*Ze)/Rt,ri=(Ce*Ze-Ie*$e)/Rt,mi=w.z*(1-Mt-ri)+I.z*Mt+U.z*ri;if(isFinite(mi))return mi}return 1/0}{let f=1/0;for(const w of l)f=Math.min(f,w.z);return f}}const ug=Is([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Oy}=ug,a1=Is([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Yh}=a1,xA=Tu.VectorTileFeature.types,If=Math.cos(Math.PI/180*37.5),mp=Math.pow(2,14)/.5;class gp{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(f=>f.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(f=>{this.gradients[f.id]={}}),this.layoutVertexArray=new Er,this.layoutVertexArray2=new Gr,this.indexArray=new mo,this.programConfigurations=new si(l.layers,l.zoom),this.segments=new a,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id)}populate(l,f,w){this.hasPattern=ag("line",this.layers,f);const I=this.layers[0].layout.get("line-sort-key"),U=!I.isConstant(),N=[];for(const{feature:Z,id:re,index:ge,sourceLayerIndex:Ce}of l){const Ie=this.layers[0]._featureFilter.needGeometry,ke=Ai(Z,Ie);if(!this.layers[0]._featureFilter.filter(new Zr(this.zoom),ke,w))continue;const $e=U?I.evaluate(ke,{},w):void 0,Ze={id:re,properties:Z.properties,type:Z.type,sourceLayerIndex:Ce,index:ge,geometry:Ie?ke.geometry:Ri(Z),patterns:{},sortKey:$e};N.push(Ze)}U&&N.sort((Z,re)=>Z.sortKey-re.sortKey);for(const Z of N){const{geometry:re,index:ge,sourceLayerIndex:Ce}=Z;if(this.hasPattern){const Ie=lg("line",this.layers,Z,this.zoom,f);this.patternFeatures.push(Ie)}else this.addFeature(Z,re,ge,w,{});f.featureIndex.insert(l[ge].feature,re,ge,Ce,this.index)}}update(l,f,w){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,f,this.stateDependentLayers,w)}addFeatures(l,f,w){for(const I of this.patternFeatures)this.addFeature(I,I.geometry,I.index,f,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,Yh)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Oy),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l){if(l.properties&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_end"))return{start:+l.properties.mapbox_clip_start,end:+l.properties.mapbox_clip_end}}addFeature(l,f,w,I,U){const N=this.layers[0].layout,Z=N.get("line-join").evaluate(l,{}),re=N.get("line-cap"),ge=N.get("line-miter-limit"),Ce=N.get("line-round-limit");this.lineClips=this.lineFeatureClips(l);for(const Ie of f)this.addLine(Ie,l,Z,re,ge,Ce);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,w,U,I)}addLine(l,f,w,I,U,N){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ri=0;ri<l.length-1;ri++)this.totalDistance+=l[ri].dist(l[ri+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const Z=xA[f.type]==="Polygon";let re=l.length;for(;re>=2&&l[re-1].equals(l[re-2]);)re--;let ge=0;for(;ge<re-1&&l[ge].equals(l[ge+1]);)ge++;if(re<(Z?3:2))return;w==="bevel"&&(U=1.05);const Ce=this.overscaling<=16?122880/(512*this.overscaling):0,Ie=this.segments.prepareSegment(10*re,this.layoutVertexArray,this.indexArray);let ke,$e,Ze,Rt,Mt;this.e1=this.e2=-1,Z&&(ke=l[re-2],Mt=l[ge].sub(ke)._unit()._perp());for(let ri=ge;ri<re;ri++){if(Ze=ri===re-1?Z?l[ge+1]:void 0:l[ri+1],Ze&&l[ri].equals(Ze))continue;Mt&&(Rt=Mt),ke&&($e=ke),ke=l[ri],Mt=Ze?Ze.sub(ke)._unit()._perp():Rt,Rt=Rt||Mt;let mi=Rt.add(Mt);mi.x===0&&mi.y===0||mi._unit();const ei=Rt.x*Mt.x+Rt.y*Mt.y,ui=mi.x*Mt.x+mi.y*Mt.y,Pi=ui!==0?1/ui:1/0,Fi=2*Math.sqrt(2-2*ui),Sn=ui<If&&$e&&Ze,fn=Rt.x*Mt.y-Rt.y*Mt.x>0;if(Sn&&ri>ge){const nn=ke.dist($e);if(nn>2*Ce){const vn=ke.sub(ke.sub($e)._mult(Ce/nn)._round());this.updateDistance($e,vn),this.addCurrentVertex(vn,Rt,0,0,Ie),$e=vn}}const mn=$e&&Ze;let an=mn?w:Z?"butt":I;if(mn&&an==="round"&&(Pi<N?an="miter":Pi<=2&&(an="fakeround")),an==="miter"&&Pi>U&&(an="bevel"),an==="bevel"&&(Pi>2&&(an="flipbevel"),Pi<U&&(an="miter")),$e&&this.updateDistance($e,ke),an==="miter")mi._mult(Pi),this.addCurrentVertex(ke,mi,0,0,Ie);else if(an==="flipbevel"){if(Pi>100)mi=Mt.mult(-1);else{const nn=Pi*Rt.add(Mt).mag()/Rt.sub(Mt).mag();mi._perp()._mult(nn*(fn?-1:1))}this.addCurrentVertex(ke,mi,0,0,Ie),this.addCurrentVertex(ke,mi.mult(-1),0,0,Ie)}else if(an==="bevel"||an==="fakeround"){const nn=-Math.sqrt(Pi*Pi-1),vn=fn?nn:0,gn=fn?0:nn;if($e&&this.addCurrentVertex(ke,Rt,vn,gn,Ie),an==="fakeround"){const Ji=Math.round(180*Fi/Math.PI/20);for(let Wn=1;Wn<Ji;Wn++){let zn=Wn/Ji;if(zn!==.5){const fs=zn-.5;zn+=zn*fs*(zn-1)*((1.0904+ei*(ei*(3.55645-1.43519*ei)-3.2452))*fs*fs+(.848013+ei*(.215638*ei-1.06021)))}const yr=Mt.sub(Rt)._mult(zn)._add(Rt)._unit()._mult(fn?-1:1);this.addHalfVertex(ke,yr.x,yr.y,!1,fn,0,Ie)}}Ze&&this.addCurrentVertex(ke,Mt,-vn,-gn,Ie)}else if(an==="butt")this.addCurrentVertex(ke,mi,0,0,Ie);else if(an==="square"){const nn=$e?1:-1;this.addCurrentVertex(ke,mi,nn,nn,Ie)}else an==="round"&&($e&&(this.addCurrentVertex(ke,Rt,0,0,Ie),this.addCurrentVertex(ke,Rt,1,1,Ie,!0)),Ze&&(this.addCurrentVertex(ke,Mt,-1,-1,Ie,!0),this.addCurrentVertex(ke,Mt,0,0,Ie)));if(Sn&&ri<re-1){const nn=ke.dist(Ze);if(nn>2*Ce){const vn=ke.add(Ze.sub(ke)._mult(Ce/nn)._round());this.updateDistance(ke,vn),this.addCurrentVertex(vn,Mt,0,0,Ie),ke=vn}}}}addCurrentVertex(l,f,w,I,U,N=!1){const Z=f.y*I-f.x,re=-f.y-f.x*I;this.addHalfVertex(l,f.x+f.y*w,f.y-f.x*w,N,!1,w,U),this.addHalfVertex(l,Z,re,N,!0,-I,U),this.distance>mp/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(l,f,w,I,U,N))}addHalfVertex({x:l,y:f},w,I,U,N,Z,re){const ge=.5*(this.lineClips?this.scaledDistance*(mp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((l<<1)+(U?1:0),(f<<1)+(N?1:0),Math.round(63*w)+128,Math.round(63*I)+128,1+(Z===0?0:Z<0?-1:1)|(63&ge)<<2,ge>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const Ce=re.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,Ce),re.primitiveLength++),N?this.e2=Ce:this.e1=Ce}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(l,f){this.distance+=l.dist(f),this.updateScaledDistance()}}pn("LineBucket",gp,{omit:["layers","patternFeatures"]});const Ny=new Cs({"line-cap":new Fn($t.layout_line["line-cap"]),"line-join":new Vn($t.layout_line["line-join"]),"line-miter-limit":new Fn($t.layout_line["line-miter-limit"]),"line-round-limit":new Fn($t.layout_line["line-round-limit"]),"line-sort-key":new Vn($t.layout_line["line-sort-key"])});var Qy={paint:new Cs({"line-opacity":new Vn($t.paint_line["line-opacity"]),"line-color":new Vn($t.paint_line["line-color"]),"line-translate":new Fn($t.paint_line["line-translate"]),"line-translate-anchor":new Fn($t.paint_line["line-translate-anchor"]),"line-width":new Vn($t.paint_line["line-width"]),"line-gap-width":new Vn($t.paint_line["line-gap-width"]),"line-offset":new Vn($t.paint_line["line-offset"]),"line-blur":new Vn($t.paint_line["line-blur"]),"line-dasharray":new dA($t.paint_line["line-dasharray"]),"line-pattern":new sh($t.paint_line["line-pattern"]),"line-gradient":new yl($t.paint_line["line-gradient"])}),layout:Ny};const Ag=new class extends Vn{possiblyEvaluate(A,l){return l=new Zr(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,zoomHistory:l.zoomHistory,transition:l.transition}),super.possiblyEvaluate(A,l)}evaluate(A,l,f,w){return l=J({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(A,l,f,w)}}(Qy.paint.properties["line-width"].specification);function Vy(A,l){return l>0?l+2*A:A}Ag.useIntegerZoom=!0;const dg=Is([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),l1=Is([{name:"a_projected_pos",components:3,type:"Float32"}],4);Is([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const pg=Is([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Is([{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 fg=Is([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Hy=Is([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function vA(A,l,f){return A.sections.forEach(w=>{w.text=function(I,U,N){const Z=U.layout.get("text-transform").evaluate(N,{});return Z==="uppercase"?I=I.toLocaleUpperCase():Z==="lowercase"&&(I=I.toLocaleLowerCase()),xs.applyArabicShaping&&(I=xs.applyArabicShaping(I)),I}(w.text,l,f)}),A}Is([{name:"triangle",components:3,type:"Uint16"}]),Is([{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"}]),Is([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Is([{type:"Float32",name:"offsetX"}]),Is([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const ud={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var yo=24,Su=Yr,_p=function(A,l,f,w,I){var U,N,Z=8*I-w-1,re=(1<<Z)-1,ge=re>>1,Ce=-7,Ie=f?I-1:0,ke=f?-1:1,$e=A[l+Ie];for(Ie+=ke,U=$e&(1<<-Ce)-1,$e>>=-Ce,Ce+=Z;Ce>0;U=256*U+A[l+Ie],Ie+=ke,Ce-=8);for(N=U&(1<<-Ce)-1,U>>=-Ce,Ce+=w;Ce>0;N=256*N+A[l+Ie],Ie+=ke,Ce-=8);if(U===0)U=1-ge;else{if(U===re)return N?NaN:1/0*($e?-1:1);N+=Math.pow(2,w),U-=ge}return($e?-1:1)*N*Math.pow(2,U-w)},mg=function(A,l,f,w,I,U){var N,Z,re,ge=8*U-I-1,Ce=(1<<ge)-1,Ie=Ce>>1,ke=I===23?Math.pow(2,-24)-Math.pow(2,-77):0,$e=w?0:U-1,Ze=w?1:-1,Rt=l<0||l===0&&1/l<0?1:0;for(l=Math.abs(l),isNaN(l)||l===1/0?(Z=isNaN(l)?1:0,N=Ce):(N=Math.floor(Math.log(l)/Math.LN2),l*(re=Math.pow(2,-N))<1&&(N--,re*=2),(l+=N+Ie>=1?ke/re:ke*Math.pow(2,1-Ie))*re>=2&&(N++,re/=2),N+Ie>=Ce?(Z=0,N=Ce):N+Ie>=1?(Z=(l*re-1)*Math.pow(2,I),N+=Ie):(Z=l*Math.pow(2,Ie-1)*Math.pow(2,I),N=0));I>=8;A[f+$e]=255&Z,$e+=Ze,Z/=256,I-=8);for(N=N<<I|Z,ge+=I;ge>0;A[f+$e]=255&N,$e+=Ze,N/=256,ge-=8);A[f+$e-Ze]|=128*Rt};function Yr(A){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(A)?A:new Uint8Array(A||0),this.pos=0,this.type=0,this.length=this.buf.length}Yr.Varint=0,Yr.Fixed64=1,Yr.Bytes=2,Yr.Fixed32=5;var Mu,gg=4294967296,yp=1/gg,Sa=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function hh(A){return A.type===Yr.Bytes?A.readVarint()+A.pos:A.pos+1}function wA(A,l,f){return f?4294967296*l+(A>>>0):4294967296*(l>>>0)+(A>>>0)}function ql(A,l,f){var w=l<=16383?1:l<=2097151?2:l<=268435455?3:Math.floor(Math.log(l)/(7*Math.LN2));f.realloc(w);for(var I=f.pos-1;I>=A;I--)f.buf[I+w]=f.buf[I]}function _g(A,l){for(var f=0;f<A.length;f++)l.writeVarint(A[f])}function bA(A,l){for(var f=0;f<A.length;f++)l.writeSVarint(A[f])}function xp(A,l){for(var f=0;f<A.length;f++)l.writeFloat(A[f])}function BA(A,l){for(var f=0;f<A.length;f++)l.writeDouble(A[f])}function yg(A,l){for(var f=0;f<A.length;f++)l.writeBoolean(A[f])}function Ff(A,l){for(var f=0;f<A.length;f++)l.writeFixed32(A[f])}function Gy(A,l){for(var f=0;f<A.length;f++)l.writeSFixed32(A[f])}function Wy(A,l){for(var f=0;f<A.length;f++)l.writeFixed64(A[f])}function c1(A,l){for(var f=0;f<A.length;f++)l.writeSFixed64(A[f])}function Ad(A,l){return(A[l]|A[l+1]<<8|A[l+2]<<16)+16777216*A[l+3]}function CA(A,l,f){A[f]=l,A[f+1]=l>>>8,A[f+2]=l>>>16,A[f+3]=l>>>24}function dd(A,l){return(A[l]|A[l+1]<<8|A[l+2]<<16)+(A[l+3]<<24)}function pd(A,l,f){A===1&&f.readMessage(Jh,l)}function Jh(A,l,f){if(A===3){const{id:w,bitmap:I,width:U,height:N,left:Z,top:re,advance:ge}=f.readMessage(xg,{});l.push({id:w,bitmap:new Xh({width:U+6,height:N+6},I),metrics:{width:U,height:N,left:Z,top:re,advance:ge}})}}function xg(A,l,f){A===1?l.id=f.readVarint():A===2?l.bitmap=f.readBytes():A===3?l.width=f.readVarint():A===4?l.height=f.readVarint():A===5?l.left=f.readSVarint():A===6?l.top=f.readSVarint():A===7&&(l.advance=f.readVarint())}function vg(A){let l=0,f=0;for(const N of A)l+=N.w*N.h,f=Math.max(f,N.w);A.sort((N,Z)=>Z.h-N.h);const w=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(l/.95)),f),h:1/0}];let I=0,U=0;for(const N of A)for(let Z=w.length-1;Z>=0;Z--){const re=w[Z];if(!(N.w>re.w||N.h>re.h)){if(N.x=re.x,N.y=re.y,U=Math.max(U,N.y+N.h),I=Math.max(I,N.x+N.w),N.w===re.w&&N.h===re.h){const ge=w.pop();Z<w.length&&(w[Z]=ge)}else N.h===re.h?(re.x+=N.w,re.w-=N.w):N.w===re.w?(re.y+=N.h,re.h-=N.h):(w.push({x:re.x+N.w,y:re.y,w:re.w-N.w,h:N.h}),re.y+=N.h,re.h-=N.h);break}}return{w:I,h:U,fill:l/(I*U)||0}}Yr.prototype={destroy:function(){this.buf=null},readFields:function(A,l,f){for(f=f||this.length;this.pos<f;){var w=this.readVarint(),I=w>>3,U=this.pos;this.type=7&w,A(I,l,this),this.pos===U&&this.skip(w)}return l},readMessage:function(A,l){return this.readFields(A,l,this.readVarint()+this.pos)},readFixed32:function(){var A=Ad(this.buf,this.pos);return this.pos+=4,A},readSFixed32:function(){var A=dd(this.buf,this.pos);return this.pos+=4,A},readFixed64:function(){var A=Ad(this.buf,this.pos)+Ad(this.buf,this.pos+4)*gg;return this.pos+=8,A},readSFixed64:function(){var A=Ad(this.buf,this.pos)+dd(this.buf,this.pos+4)*gg;return this.pos+=8,A},readFloat:function(){var A=_p(this.buf,this.pos,!0,23,4);return this.pos+=4,A},readDouble:function(){var A=_p(this.buf,this.pos,!0,52,8);return this.pos+=8,A},readVarint:function(A){var l,f,w=this.buf;return l=127&(f=w[this.pos++]),f<128?l:(l|=(127&(f=w[this.pos++]))<<7,f<128?l:(l|=(127&(f=w[this.pos++]))<<14,f<128?l:(l|=(127&(f=w[this.pos++]))<<21,f<128?l:function(I,U,N){var Z,re,ge=N.buf;if(Z=(112&(re=ge[N.pos++]))>>4,re<128||(Z|=(127&(re=ge[N.pos++]))<<3,re<128)||(Z|=(127&(re=ge[N.pos++]))<<10,re<128)||(Z|=(127&(re=ge[N.pos++]))<<17,re<128)||(Z|=(127&(re=ge[N.pos++]))<<24,re<128)||(Z|=(1&(re=ge[N.pos++]))<<31,re<128))return wA(I,Z,U);throw new Error("Expected varint not more than 10 bytes")}(l|=(15&(f=w[this.pos]))<<28,A,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var A=this.readVarint();return A%2==1?(A+1)/-2:A/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var A=this.readVarint()+this.pos,l=this.pos;return this.pos=A,A-l>=12&&Sa?function(f,w,I){return Sa.decode(f.subarray(w,I))}(this.buf,l,A):function(f,w,I){for(var U="",N=w;N<I;){var Z,re,ge,Ce=f[N],Ie=null,ke=Ce>239?4:Ce>223?3:Ce>191?2:1;if(N+ke>I)break;ke===1?Ce<128&&(Ie=Ce):ke===2?(192&(Z=f[N+1]))==128&&(Ie=(31&Ce)<<6|63&Z)<=127&&(Ie=null):ke===3?(re=f[N+2],(192&(Z=f[N+1]))==128&&(192&re)==128&&((Ie=(15&Ce)<<12|(63&Z)<<6|63&re)<=2047||Ie>=55296&&Ie<=57343)&&(Ie=null)):ke===4&&(re=f[N+2],ge=f[N+3],(192&(Z=f[N+1]))==128&&(192&re)==128&&(192&ge)==128&&((Ie=(15&Ce)<<18|(63&Z)<<12|(63&re)<<6|63&ge)<=65535||Ie>=1114112)&&(Ie=null)),Ie===null?(Ie=65533,ke=1):Ie>65535&&(Ie-=65536,U+=String.fromCharCode(Ie>>>10&1023|55296),Ie=56320|1023&Ie),U+=String.fromCharCode(Ie),N+=ke}return U}(this.buf,l,A)},readBytes:function(){var A=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,A);return this.pos=A,l},readPackedVarint:function(A,l){if(this.type!==Yr.Bytes)return A.push(this.readVarint(l));var f=hh(this);for(A=A||[];this.pos<f;)A.push(this.readVarint(l));return A},readPackedSVarint:function(A){if(this.type!==Yr.Bytes)return A.push(this.readSVarint());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readSVarint());return A},readPackedBoolean:function(A){if(this.type!==Yr.Bytes)return A.push(this.readBoolean());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readBoolean());return A},readPackedFloat:function(A){if(this.type!==Yr.Bytes)return A.push(this.readFloat());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readFloat());return A},readPackedDouble:function(A){if(this.type!==Yr.Bytes)return A.push(this.readDouble());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readDouble());return A},readPackedFixed32:function(A){if(this.type!==Yr.Bytes)return A.push(this.readFixed32());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readFixed32());return A},readPackedSFixed32:function(A){if(this.type!==Yr.Bytes)return A.push(this.readSFixed32());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readSFixed32());return A},readPackedFixed64:function(A){if(this.type!==Yr.Bytes)return A.push(this.readFixed64());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readFixed64());return A},readPackedSFixed64:function(A){if(this.type!==Yr.Bytes)return A.push(this.readSFixed64());var l=hh(this);for(A=A||[];this.pos<l;)A.push(this.readSFixed64());return A},skip:function(A){var l=7&A;if(l===Yr.Varint)for(;this.buf[this.pos++]>127;);else if(l===Yr.Bytes)this.pos=this.readVarint()+this.pos;else if(l===Yr.Fixed32)this.pos+=4;else{if(l!==Yr.Fixed64)throw new Error("Unimplemented type: "+l);this.pos+=8}},writeTag:function(A,l){this.writeVarint(A<<3|l)},realloc:function(A){for(var l=this.length||16;l<this.pos+A;)l*=2;if(l!==this.length){var f=new Uint8Array(l);f.set(this.buf),this.buf=f,this.length=l}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(A){this.realloc(4),CA(this.buf,A,this.pos),this.pos+=4},writeSFixed32:function(A){this.realloc(4),CA(this.buf,A,this.pos),this.pos+=4},writeFixed64:function(A){this.realloc(8),CA(this.buf,-1&A,this.pos),CA(this.buf,Math.floor(A*yp),this.pos+4),this.pos+=8},writeSFixed64:function(A){this.realloc(8),CA(this.buf,-1&A,this.pos),CA(this.buf,Math.floor(A*yp),this.pos+4),this.pos+=8},writeVarint:function(A){(A=+A||0)>268435455||A<0?function(l,f){var w,I;if(l>=0?(w=l%4294967296|0,I=l/4294967296|0):(I=~(-l/4294967296),4294967295^(w=~(-l%4294967296))?w=w+1|0:(w=0,I=I+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");f.realloc(10),function(U,N,Z){Z.buf[Z.pos++]=127&U|128,U>>>=7,Z.buf[Z.pos++]=127&U|128,U>>>=7,Z.buf[Z.pos++]=127&U|128,U>>>=7,Z.buf[Z.pos++]=127&U|128,Z.buf[Z.pos]=127&(U>>>=7)}(w,0,f),function(U,N){var Z=(7&U)<<4;N.buf[N.pos++]|=Z|((U>>>=3)?128:0),U&&(N.buf[N.pos++]=127&U|((U>>>=7)?128:0),U&&(N.buf[N.pos++]=127&U|((U>>>=7)?128:0),U&&(N.buf[N.pos++]=127&U|((U>>>=7)?128:0),U&&(N.buf[N.pos++]=127&U|((U>>>=7)?128:0),U&&(N.buf[N.pos++]=127&U)))))}(I,f)}(A,this):(this.realloc(4),this.buf[this.pos++]=127&A|(A>127?128:0),A<=127||(this.buf[this.pos++]=127&(A>>>=7)|(A>127?128:0),A<=127||(this.buf[this.pos++]=127&(A>>>=7)|(A>127?128:0),A<=127||(this.buf[this.pos++]=A>>>7&127))))},writeSVarint:function(A){this.writeVarint(A<0?2*-A-1:2*A)},writeBoolean:function(A){this.writeVarint(Boolean(A))},writeString:function(A){A=String(A),this.realloc(4*A.length),this.pos++;var l=this.pos;this.pos=function(w,I,U){for(var N,Z,re=0;re<I.length;re++){if((N=I.charCodeAt(re))>55295&&N<57344){if(!Z){N>56319||re+1===I.length?(w[U++]=239,w[U++]=191,w[U++]=189):Z=N;continue}if(N<56320){w[U++]=239,w[U++]=191,w[U++]=189,Z=N;continue}N=Z-55296<<10|N-56320|65536,Z=null}else Z&&(w[U++]=239,w[U++]=191,w[U++]=189,Z=null);N<128?w[U++]=N:(N<2048?w[U++]=N>>6|192:(N<65536?w[U++]=N>>12|224:(w[U++]=N>>18|240,w[U++]=N>>12&63|128),w[U++]=N>>6&63|128),w[U++]=63&N|128)}return U}(this.buf,A,this.pos);var f=this.pos-l;f>=128&&ql(l,f,this),this.pos=l-1,this.writeVarint(f),this.pos+=f},writeFloat:function(A){this.realloc(4),mg(this.buf,A,this.pos,!0,23,4),this.pos+=4},writeDouble:function(A){this.realloc(8),mg(this.buf,A,this.pos,!0,52,8),this.pos+=8},writeBytes:function(A){var l=A.length;this.writeVarint(l),this.realloc(l);for(var f=0;f<l;f++)this.buf[this.pos++]=A[f]},writeRawMessage:function(A,l){this.pos++;var f=this.pos;A(l,this);var w=this.pos-f;w>=128&&ql(f,w,this),this.pos=f-1,this.writeVarint(w),this.pos+=w},writeMessage:function(A,l,f){this.writeTag(A,Yr.Bytes),this.writeRawMessage(l,f)},writePackedVarint:function(A,l){l.length&&this.writeMessage(A,_g,l)},writePackedSVarint:function(A,l){l.length&&this.writeMessage(A,bA,l)},writePackedBoolean:function(A,l){l.length&&this.writeMessage(A,yg,l)},writePackedFloat:function(A,l){l.length&&this.writeMessage(A,xp,l)},writePackedDouble:function(A,l){l.length&&this.writeMessage(A,BA,l)},writePackedFixed32:function(A,l){l.length&&this.writeMessage(A,Ff,l)},writePackedSFixed32:function(A,l){l.length&&this.writeMessage(A,Gy,l)},writePackedFixed64:function(A,l){l.length&&this.writeMessage(A,Wy,l)},writePackedSFixed64:function(A,l){l.length&&this.writeMessage(A,c1,l)},writeBytesField:function(A,l){this.writeTag(A,Yr.Bytes),this.writeBytes(l)},writeFixed32Field:function(A,l){this.writeTag(A,Yr.Fixed32),this.writeFixed32(l)},writeSFixed32Field:function(A,l){this.writeTag(A,Yr.Fixed32),this.writeSFixed32(l)},writeFixed64Field:function(A,l){this.writeTag(A,Yr.Fixed64),this.writeFixed64(l)},writeSFixed64Field:function(A,l){this.writeTag(A,Yr.Fixed64),this.writeSFixed64(l)},writeVarintField:function(A,l){this.writeTag(A,Yr.Varint),this.writeVarint(l)},writeSVarintField:function(A,l){this.writeTag(A,Yr.Varint),this.writeSVarint(l)},writeStringField:function(A,l){this.writeTag(A,Yr.Bytes),this.writeString(l)},writeFloatField:function(A,l){this.writeTag(A,Yr.Fixed32),this.writeFloat(l)},writeDoubleField:function(A,l){this.writeTag(A,Yr.Fixed64),this.writeDouble(l)},writeBooleanField:function(A,l){this.writeVarintField(A,Boolean(l))}};class EA{constructor(l,{pixelRatio:f,version:w,stretchX:I,stretchY:U,content:N}){this.paddedRect=l,this.pixelRatio=f,this.stretchX=I,this.stretchY=U,this.content=N,this.version=w}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 fd{constructor(l,f){const w={},I={};this.haveRenderCallbacks=[];const U=[];this.addImages(l,w,U),this.addImages(f,I,U);const{w:N,h:Z}=vg(U),re=new Aa({width:N||1,height:Z||1});for(const ge in l){const Ce=l[ge],Ie=w[ge].paddedRect;Aa.copy(Ce.data,re,{x:0,y:0},{x:Ie.x+1,y:Ie.y+1},Ce.data)}for(const ge in f){const Ce=f[ge],Ie=I[ge].paddedRect,ke=Ie.x+1,$e=Ie.y+1,Ze=Ce.data.width,Rt=Ce.data.height;Aa.copy(Ce.data,re,{x:0,y:0},{x:ke,y:$e},Ce.data),Aa.copy(Ce.data,re,{x:0,y:Rt-1},{x:ke,y:$e-1},{width:Ze,height:1}),Aa.copy(Ce.data,re,{x:0,y:0},{x:ke,y:$e+Rt},{width:Ze,height:1}),Aa.copy(Ce.data,re,{x:Ze-1,y:0},{x:ke-1,y:$e},{width:1,height:Rt}),Aa.copy(Ce.data,re,{x:0,y:0},{x:ke+Ze,y:$e},{width:1,height:Rt})}this.image=re,this.iconPositions=w,this.patternPositions=I}addImages(l,f,w){for(const I in l){const U=l[I],N={x:0,y:0,w:U.data.width+2,h:U.data.height+2};w.push(N),f[I]=new EA(N,U),U.hasRenderCallback&&this.haveRenderCallbacks.push(I)}}patchUpdatedImages(l,f){l.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const w in l.updatedImages)this.patchUpdatedImage(this.iconPositions[w],l.getImage(w),f),this.patchUpdatedImage(this.patternPositions[w],l.getImage(w),f)}patchUpdatedImage(l,f,w){if(!l||!f||l.version===f.version)return;l.version=f.version;const[I,U]=l.tl;w.update(f.data,void 0,{x:I,y:U})}}pn("ImagePosition",EA),pn("ImageAtlas",fd),i.WritingMode=void 0,(Mu=i.WritingMode||(i.WritingMode={}))[Mu.none=0]="none",Mu[Mu.horizontal=1]="horizontal",Mu[Mu.vertical=2]="vertical",Mu[Mu.horizontalOnly=3]="horizontalOnly";const da=-17;class eu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(l,f){const w=new eu;return w.scale=l||1,w.fontStack=f,w}static forImage(l){const f=new eu;return f.imageName=l,f}}class so{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(l,f){const w=new so;for(let I=0;I<l.sections.length;I++){const U=l.sections[I];U.image?w.addImageSection(U):w.addTextSection(U,f)}return w}length(){return this.text.length}getSection(l){return this.sections[this.sectionIndex[l]]}getSectionIndex(l){return this.sectionIndex[l]}getCharCode(l){return this.text.charCodeAt(l)}verticalizePunctuation(){this.text=function(l){let f="";for(let w=0;w<l.length;w++){const I=l.charCodeAt(w+1)||null,U=l.charCodeAt(w-1)||null;f+=I&&Qh(I)&&!ud[l[w+1]]||U&&Qh(U)&&!ud[l[w-1]]||!ud[l[w]]?l[w]:ud[l[w]]}return f}(this.text)}trim(){let l=0;for(let w=0;w<this.text.length&&md[this.text.charCodeAt(w)];w++)l++;let f=this.text.length;for(let w=this.text.length-1;w>=0&&w>=l&&md[this.text.charCodeAt(w)];w--)f--;this.text=this.text.substring(l,f),this.sectionIndex=this.sectionIndex.slice(l,f)}substring(l,f){const w=new so;return w.text=this.text.substring(l,f),w.sectionIndex=this.sectionIndex.slice(l,f),w.sections=this.sections,w}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((l,f)=>Math.max(l,this.sections[f].scale),0)}addTextSection(l,f){this.text+=l.text,this.sections.push(eu.forText(l.scale,l.fontStack||f));const w=this.sections.length-1;for(let I=0;I<l.text.length;++I)this.sectionIndex.push(w)}addImageSection(l){const f=l.image?l.image.name:"";if(f.length===0)return void me("Can't add FormattedSection with an empty image.");const w=this.getNextImageSectionCharCode();w?(this.text+=String.fromCharCode(w),this.sections.push(eu.forImage(f)),this.sectionIndex.push(this.sections.length-1)):me("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ma(A,l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt){const Mt=so.fromFeature(A,I);let ri;Ie===i.WritingMode.vertical&&Mt.verticalizePunctuation();const{processBidirectionalText:mi,processStyledBidirectionalText:ei}=xs;if(mi&&Mt.sections.length===1){ri=[];const Fi=mi(Mt.toString(),Lf(Mt,ge,U,l,w,$e,Ze));for(const Sn of Fi){const fn=new so;fn.text=Sn,fn.sections=Mt.sections;for(let mn=0;mn<Sn.length;mn++)fn.sectionIndex.push(0);ri.push(fn)}}else if(ei){ri=[];const Fi=ei(Mt.text,Mt.sectionIndex,Lf(Mt,ge,U,l,w,$e,Ze));for(const Sn of Fi){const fn=new so;fn.text=Sn[0],fn.sectionIndex=Sn[1],fn.sections=Mt.sections,ri.push(fn)}}else ri=function(Fi,Sn){const fn=[],mn=Fi.text;let an=0;for(const nn of Sn)fn.push(Fi.substring(an,nn)),an=nn;return an<mn.length&&fn.push(Fi.substring(an,mn.length)),fn}(Mt,Lf(Mt,ge,U,l,w,$e,Ze));const ui=[],Pi={positionedLines:ui,text:Mt.toString(),top:Ce[1],bottom:Ce[1],left:Ce[0],right:Ce[0],writingMode:Ie,iconsInText:!1,verticalizable:!1};return function(Fi,Sn,fn,mn,an,nn,vn,gn,Ji,Wn,zn,yr){let fs=0,ws=da,Qs=0,Cl=0;const xo=gn==="right"?1:gn==="left"?0:.5;let Ks=0;for(const io of an){io.trim();const Do=io.getMaxScale(),Po=(Do-1)*yo,pa={positionedGlyphs:[],lineOffset:0};Fi.positionedLines[Ks]=pa;const Jr=pa.positionedGlyphs;let Vs=0;if(!io.length()){ws+=nn,++Ks;continue}for(let $s=0;$s<io.length();$s++){const pr=io.getSection($s),qa=io.getSectionIndex($s),Uo=io.getCharCode($s);let ao=0,Jl=null,Cc=null,Fa=null,Ah=yo;const El=!(Ji===i.WritingMode.horizontal||!zn&&!cA(Uo)||zn&&(md[Uo]||(oo=Uo,un.Arabic(oo)||un["Arabic Supplement"](oo)||un["Arabic Extended-A"](oo)||un["Arabic Presentation Forms-A"](oo)||un["Arabic Presentation Forms-B"](oo))));if(pr.imageName){const vr=mn[pr.imageName];if(!vr)continue;Fa=pr.imageName,Fi.iconsInText=Fi.iconsInText||!0,Cc=vr.paddedRect;const Zo=vr.displaySize;pr.scale=pr.scale*yo/yr,Jl={width:Zo[0],height:Zo[1],left:1,top:-3,advance:El?Zo[1]:Zo[0]},ao=Po+(yo-Zo[1]*pr.scale),Ah=Jl.advance;const dh=El?Zo[0]*pr.scale-yo*Do:Zo[1]*pr.scale-yo*Do;dh>0&&dh>Vs&&(Vs=dh)}else{const vr=fn[pr.fontStack],Zo=vr&&vr[Uo];if(Zo&&Zo.rect)Cc=Zo.rect,Jl=Zo.metrics;else{const dh=Sn[pr.fontStack],Td=dh&&dh[Uo];if(!Td)continue;Jl=Td.metrics}ao=(Do-pr.scale)*yo}El?(Fi.verticalizable=!0,Jr.push({glyph:Uo,imageName:Fa,x:fs,y:ws+ao,vertical:El,scale:pr.scale,fontStack:pr.fontStack,sectionIndex:qa,metrics:Jl,rect:Cc}),fs+=Ah*pr.scale+Wn):(Jr.push({glyph:Uo,imageName:Fa,x:fs,y:ws+ao,vertical:El,scale:pr.scale,fontStack:pr.fontStack,sectionIndex:qa,metrics:Jl,rect:Cc}),fs+=Jl.advance*pr.scale+Wn)}Jr.length!==0&&(Qs=Math.max(fs-Wn,Qs),TA(Jr,0,Jr.length-1,xo,Vs)),fs=0;const ms=nn*Do+Vs;pa.lineOffset=Math.max(Vs,Po),ws+=ms,Cl=Math.max(ms,Cl),++Ks}var oo;const Lo=ws-da,{horizontalAlign:$o,verticalAlign:Ia}=Df(vn);(function(io,Do,Po,pa,Jr,Vs,ms,$s,pr){const qa=(Do-Po)*Jr;let Uo=0;Uo=Vs!==ms?-$s*pa-da:(-pa*pr+.5)*ms;for(const ao of io)for(const Jl of ao.positionedGlyphs)Jl.x+=qa,Jl.y+=Uo})(Fi.positionedLines,xo,$o,Ia,Qs,Cl,nn,Lo,an.length),Fi.top+=-Ia*Lo,Fi.bottom=Fi.top+Lo,Fi.left+=-$o*Qs,Fi.right=Fi.left+Qs}(Pi,l,f,w,ri,N,Z,re,Ie,ge,ke,Rt),!function(Fi){for(const Sn of Fi)if(Sn.positionedGlyphs.length!==0)return!1;return!0}(ui)&&Pi}const md={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ns={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function wg(A,l,f,w,I,U){if(l.imageName){const N=w[l.imageName];return N?N.displaySize[0]*l.scale*yo/U+I:0}{const N=f[l.fontStack],Z=N&&N[A];return Z?Z.metrics.advance*l.scale+I:0}}function gd(A,l,f,w){const I=Math.pow(A-l,2);return w?A<l?I/2:2*I:I+Math.abs(f)*f}function bc(A,l,f){let w=0;return A===10&&(w-=1e4),f&&(w+=150),A!==40&&A!==65288||(w+=50),l!==41&&l!==65289||(w+=50),w}function jy(A,l,f,w,I,U){let N=null,Z=gd(l,f,I,U);for(const re of w){const ge=gd(l-re.x,f,I,U)+re.badness;ge<=Z&&(N=re,Z=ge)}return{index:A,x:l,priorBreak:N,badness:Z}}function Ky(A){return A?Ky(A.priorBreak).concat(A.index):[]}function Lf(A,l,f,w,I,U,N){if(U!=="point")return[];if(!A)return[];const Z=[],re=function(ke,$e,Ze,Rt,Mt,ri){let mi=0;for(let ei=0;ei<ke.length();ei++){const ui=ke.getSection(ei);mi+=wg(ke.getCharCode(ei),ui,Rt,Mt,$e,ri)}return mi/Math.max(1,Math.ceil(mi/Ze))}(A,l,f,w,I,N),ge=A.text.indexOf("\u200B")>=0;let Ce=0;for(let ke=0;ke<A.length();ke++){const $e=A.getSection(ke),Ze=A.getCharCode(ke);if(md[Ze]||(Ce+=wg(Ze,$e,w,I,l,N)),ke<A.length()-1){const Rt=!((Ie=Ze)<11904||!(un["Bopomofo Extended"](Ie)||un.Bopomofo(Ie)||un["CJK Compatibility Forms"](Ie)||un["CJK Compatibility Ideographs"](Ie)||un["CJK Compatibility"](Ie)||un["CJK Radicals Supplement"](Ie)||un["CJK Strokes"](Ie)||un["CJK Symbols and Punctuation"](Ie)||un["CJK Unified Ideographs Extension A"](Ie)||un["CJK Unified Ideographs"](Ie)||un["Enclosed CJK Letters and Months"](Ie)||un["Halfwidth and Fullwidth Forms"](Ie)||un.Hiragana(Ie)||un["Ideographic Description Characters"](Ie)||un["Kangxi Radicals"](Ie)||un["Katakana Phonetic Extensions"](Ie)||un.Katakana(Ie)||un["Vertical Forms"](Ie)||un["Yi Radicals"](Ie)||un["Yi Syllables"](Ie)));(Ns[Ze]||Rt||$e.imageName)&&Z.push(jy(ke+1,Ce,re,Z,bc(Ze,A.getCharCode(ke+1),Rt&&ge),!1))}}var Ie;return Ky(jy(A.length(),Ce,re,Z,0,!0))}function Df(A){let l=.5,f=.5;switch(A){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(A){case"bottom":case"bottom-right":case"bottom-left":f=1;break;case"top":case"top-right":case"top-left":f=0}return{horizontalAlign:l,verticalAlign:f}}function TA(A,l,f,w,I){if(!w&&!I)return;const U=A[f],N=(A[f].x+U.metrics.advance*U.scale)*w;for(let Z=l;Z<=f;Z++)A[Z].x-=N,A[Z].y+=I}function $y(A,l,f){const{horizontalAlign:w,verticalAlign:I}=Df(f),U=l[0]-A.displaySize[0]*w,N=l[1]-A.displaySize[1]*I;return{image:A,top:N,bottom:N+A.displaySize[1],left:U,right:U+A.displaySize[0]}}function bg(A,l,f,w,I,U){const N=A.image;let Z;if(N.content){const Mt=N.content,ri=N.pixelRatio||1;Z=[Mt[0]/ri,Mt[1]/ri,N.displaySize[0]-Mt[2]/ri,N.displaySize[1]-Mt[3]/ri]}const re=l.left*U,ge=l.right*U;let Ce,Ie,ke,$e;f==="width"||f==="both"?($e=I[0]+re-w[3],Ie=I[0]+ge+w[1]):($e=I[0]+(re+ge-N.displaySize[0])/2,Ie=$e+N.displaySize[0]);const Ze=l.top*U,Rt=l.bottom*U;return f==="height"||f==="both"?(Ce=I[1]+Ze-w[0],ke=I[1]+Rt+w[2]):(Ce=I[1]+(Ze+Rt-N.displaySize[1])/2,ke=Ce+N.displaySize[1]),{image:N,top:Ce,right:Ie,bottom:ke,left:$e,collisionPadding:Z}}const uh=128;function Bg(A,l){const{expression:f}=l;if(f.kind==="constant")return{kind:"constant",layoutSize:f.evaluate(new Zr(A+1))};if(f.kind==="source")return{kind:"source"};{const{zoomStops:w,interpolationType:I}=f;let U=0;for(;U<w.length&&w[U]<=A;)U++;U=Math.max(0,U-1);let N=U;for(;N<w.length&&w[N]<A+1;)N++;N=Math.min(w.length-1,N);const Z=w[U],re=w[N];return f.kind==="composite"?{kind:"composite",minZoom:Z,maxZoom:re,interpolationType:I}:{kind:"camera",minZoom:Z,maxZoom:re,minSize:f.evaluate(new Zr(Z)),maxSize:f.evaluate(new Zr(re)),interpolationType:I}}}class Iu extends xe{constructor(l,f,w,I){super(l,f),this.angle=w,I!==void 0&&(this.segment=I)}clone(){return new Iu(this.x,this.y,this.angle,this.segment)}}function Pf(A,l,f,w,I){if(l.segment===void 0)return!0;let U=l,N=l.segment+1,Z=0;for(;Z>-f/2;){if(N--,N<0)return!1;Z-=A[N].dist(U),U=A[N]}Z+=A[N].dist(A[N+1]),N++;const re=[];let ge=0;for(;Z<f/2;){const Ce=A[N],Ie=A[N+1];if(!Ie)return!1;let ke=A[N-1].angleTo(Ce)-Ce.angleTo(Ie);for(ke=Math.abs((ke+3*Math.PI)%(2*Math.PI)-Math.PI),re.push({distance:Z,angleDelta:ke}),ge+=ke;Z-re[0].distance>w;)ge-=re.shift().angleDelta;if(ge>I)return!1;N++,Z+=Ce.dist(Ie)}return!0}function Uf(A){let l=0;for(let f=0;f<A.length-1;f++)l+=A[f].dist(A[f+1]);return l}function Rf(A,l,f){return A?.6*l*f:0}function Ko(A,l){return Math.max(A?A.right-A.left:0,l?l.right-l.left:0)}function Zy(A,l,f,w,I,U){const N=Rf(f,I,U),Z=Ko(f,w)*U;let re=0;const ge=Uf(A)/2;for(let Ce=0;Ce<A.length-1;Ce++){const Ie=A[Ce],ke=A[Ce+1],$e=Ie.dist(ke);if(re+$e>ge){const Ze=(ge-re)/$e,Rt=is(Ie.x,ke.x,Ze),Mt=is(Ie.y,ke.y,Ze),ri=new Iu(Rt,Mt,ke.angleTo(Ie),Ce);return ri._round(),!N||Pf(A,ri,Z,N,l)?ri:void 0}re+=$e}}function h1(A,l,f,w,I,U,N,Z,re){const ge=Rf(w,U,N),Ce=Ko(w,I),Ie=Ce*N,ke=A[0].x===0||A[0].x===re||A[0].y===0||A[0].y===re;return l-Ie<l/4&&(l=Ie+l/4),Cg(A,ke?l/2*Z%l:(Ce/2+2*U)*N*Z%l,l,ge,f,Ie,ke,!1,re)}function Cg(A,l,f,w,I,U,N,Z,re){const ge=U/2,Ce=Uf(A);let Ie=0,ke=l-f,$e=[];for(let Ze=0;Ze<A.length-1;Ze++){const Rt=A[Ze],Mt=A[Ze+1],ri=Rt.dist(Mt),mi=Mt.angleTo(Rt);for(;ke+f<Ie+ri;){ke+=f;const ei=(ke-Ie)/ri,ui=is(Rt.x,Mt.x,ei),Pi=is(Rt.y,Mt.y,ei);if(ui>=0&&ui<re&&Pi>=0&&Pi<re&&ke-ge>=0&&ke+ge<=Ce){const Fi=new Iu(ui,Pi,mi,Ze);Fi._round(),w&&!Pf(A,Fi,U,w,I)||$e.push(Fi)}}Ie+=ri}return Z||$e.length||N||($e=Cg(A,Ie/2,f,w,I,U,N,!0,re)),$e}function Xy(A,l,f,w,I){const U=[];for(let N=0;N<A.length;N++){const Z=A[N];let re;for(let ge=0;ge<Z.length-1;ge++){let Ce=Z[ge],Ie=Z[ge+1];Ce.x<l&&Ie.x<l||(Ce.x<l?Ce=new xe(l,Ce.y+(l-Ce.x)/(Ie.x-Ce.x)*(Ie.y-Ce.y))._round():Ie.x<l&&(Ie=new xe(l,Ce.y+(l-Ce.x)/(Ie.x-Ce.x)*(Ie.y-Ce.y))._round()),Ce.y<f&&Ie.y<f||(Ce.y<f?Ce=new xe(Ce.x+(f-Ce.y)/(Ie.y-Ce.y)*(Ie.x-Ce.x),f)._round():Ie.y<f&&(Ie=new xe(Ce.x+(f-Ce.y)/(Ie.y-Ce.y)*(Ie.x-Ce.x),f)._round()),Ce.x>=w&&Ie.x>=w||(Ce.x>=w?Ce=new xe(w,Ce.y+(w-Ce.x)/(Ie.x-Ce.x)*(Ie.y-Ce.y))._round():Ie.x>=w&&(Ie=new xe(w,Ce.y+(w-Ce.x)/(Ie.x-Ce.x)*(Ie.y-Ce.y))._round()),Ce.y>=I&&Ie.y>=I||(Ce.y>=I?Ce=new xe(Ce.x+(I-Ce.y)/(Ie.y-Ce.y)*(Ie.x-Ce.x),I)._round():Ie.y>=I&&(Ie=new xe(Ce.x+(I-Ce.y)/(Ie.y-Ce.y)*(Ie.x-Ce.x),I)._round()),re&&Ce.equals(re[re.length-1])||(re=[Ce],U.push(re)),re.push(Ie)))))}}return U}function qy(A,l,f,w){const I=[],U=A.image,N=U.pixelRatio,Z=U.paddedRect.w-2,re=U.paddedRect.h-2,ge=A.right-A.left,Ce=A.bottom-A.top,Ie=U.stretchX||[[0,Z]],ke=U.stretchY||[[0,re]],$e=(nn,vn)=>nn+vn[1]-vn[0],Ze=Ie.reduce($e,0),Rt=ke.reduce($e,0),Mt=Z-Ze,ri=re-Rt;let mi=0,ei=Ze,ui=0,Pi=Rt,Fi=0,Sn=Mt,fn=0,mn=ri;if(U.content&&w){const nn=U.content;mi=vp(Ie,0,nn[0]),ui=vp(ke,0,nn[1]),ei=vp(Ie,nn[0],nn[2]),Pi=vp(ke,nn[1],nn[3]),Fi=nn[0]-mi,fn=nn[1]-ui,Sn=nn[2]-nn[0]-ei,mn=nn[3]-nn[1]-Pi}const an=(nn,vn,gn,Ji)=>{const Wn=wp(nn.stretch-mi,ei,ge,A.left),zn=_d(nn.fixed-Fi,Sn,nn.stretch,Ze),yr=wp(vn.stretch-ui,Pi,Ce,A.top),fs=_d(vn.fixed-fn,mn,vn.stretch,Rt),ws=wp(gn.stretch-mi,ei,ge,A.left),Qs=_d(gn.fixed-Fi,Sn,gn.stretch,Ze),Cl=wp(Ji.stretch-ui,Pi,Ce,A.top),xo=_d(Ji.fixed-fn,mn,Ji.stretch,Rt),Ks=new xe(Wn,yr),oo=new xe(ws,yr),Lo=new xe(ws,Cl),$o=new xe(Wn,Cl),Ia=new xe(zn/N,fs/N),io=new xe(Qs/N,xo/N),Do=l*Math.PI/180;if(Do){const Jr=Math.sin(Do),Vs=Math.cos(Do),ms=[Vs,-Jr,Jr,Vs];Ks._matMult(ms),oo._matMult(ms),$o._matMult(ms),Lo._matMult(ms)}const Po=nn.stretch+nn.fixed,pa=vn.stretch+vn.fixed;return{tl:Ks,tr:oo,bl:$o,br:Lo,tex:{x:U.paddedRect.x+1+Po,y:U.paddedRect.y+1+pa,w:gn.stretch+gn.fixed-Po,h:Ji.stretch+Ji.fixed-pa},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ia,pixelOffsetBR:io,minFontScaleX:Sn/N/ge,minFontScaleY:mn/N/Ce,isSDF:f}};if(w&&(U.stretchX||U.stretchY)){const nn=Eg(Ie,Mt,Ze),vn=Eg(ke,ri,Rt);for(let gn=0;gn<nn.length-1;gn++){const Ji=nn[gn],Wn=nn[gn+1];for(let zn=0;zn<vn.length-1;zn++)I.push(an(Ji,vn[zn],Wn,vn[zn+1]))}}else I.push(an({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:Z+1},{fixed:0,stretch:re+1}));return I}function vp(A,l,f){let w=0;for(const I of A)w+=Math.max(l,Math.min(f,I[1]))-Math.max(l,Math.min(f,I[0]));return w}function Eg(A,l,f){const w=[{fixed:-1,stretch:0}];for(const[I,U]of A){const N=w[w.length-1];w.push({fixed:I-N.stretch,stretch:N.stretch}),w.push({fixed:I-N.stretch,stretch:N.stretch+(U-I)})}return w.push({fixed:l+1,stretch:f}),w}function wp(A,l,f,w){return A/l*f+w}function _d(A,l,f,w){return A-l*f/w}pn("Anchor",Iu);class Yl{constructor(l,f,w,I,U,N,Z,re,ge,Ce){if(this.boxStartIndex=l.length,ge){let Ie=N.top,ke=N.bottom;const $e=N.collisionPadding;$e&&(Ie-=$e[1],ke+=$e[3]);let Ze=ke-Ie;Ze>0&&(Ze=Math.max(10,Ze),this.circleDiameter=Ze)}else{let Ie=N.top*Z-re[0],ke=N.bottom*Z+re[2],$e=N.left*Z-re[3],Ze=N.right*Z+re[1];const Rt=N.collisionPadding;if(Rt&&($e-=Rt[0]*Z,Ie-=Rt[1]*Z,Ze+=Rt[2]*Z,ke+=Rt[3]*Z),Ce){const Mt=new xe($e,Ie),ri=new xe(Ze,Ie),mi=new xe($e,ke),ei=new xe(Ze,ke),ui=Ce*Math.PI/180;Mt._rotate(ui),ri._rotate(ui),mi._rotate(ui),ei._rotate(ui),$e=Math.min(Mt.x,ri.x,mi.x,ei.x),Ze=Math.max(Mt.x,ri.x,mi.x,ei.x),Ie=Math.min(Mt.y,ri.y,mi.y,ei.y),ke=Math.max(Mt.y,ri.y,mi.y,ei.y)}l.emplaceBack(f.x,f.y,$e,Ie,Ze,ke,w,I,U)}this.boxEndIndex=l.length}}class Za{constructor(l=[],f=u1){if(this.data=l,this.length=this.data.length,this.compare=f,this.length>0)for(let w=(this.length>>1)-1;w>=0;w--)this._down(w)}push(l){this.data.push(l),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const l=this.data[0],f=this.data.pop();return this.length--,this.length>0&&(this.data[0]=f,this._down(0)),l}peek(){return this.data[0]}_up(l){const{data:f,compare:w}=this,I=f[l];for(;l>0;){const U=l-1>>1,N=f[U];if(w(I,N)>=0)break;f[l]=N,l=U}f[l]=I}_down(l){const{data:f,compare:w}=this,I=this.length>>1,U=f[l];for(;l<I;){let N=1+(l<<1),Z=f[N];const re=N+1;if(re<this.length&&w(f[re],Z)<0&&(N=re,Z=f[re]),w(Z,U)>=0)break;f[l]=Z,l=N}f[l]=U}}function u1(A,l){return A<l?-1:A>l?1:0}function Tg(A,l=1,f=!1){let w=1/0,I=1/0,U=-1/0,N=-1/0;const Z=A[0];for(let $e=0;$e<Z.length;$e++){const Ze=Z[$e];(!$e||Ze.x<w)&&(w=Ze.x),(!$e||Ze.y<I)&&(I=Ze.y),(!$e||Ze.x>U)&&(U=Ze.x),(!$e||Ze.y>N)&&(N=Ze.y)}const re=Math.min(U-w,N-I);let ge=re/2;const Ce=new Za([],A1);if(re===0)return new xe(w,I);for(let $e=w;$e<U;$e+=re)for(let Ze=I;Ze<N;Ze+=re)Ce.push(new yd($e+ge,Ze+ge,ge,A));let Ie=function($e){let Ze=0,Rt=0,Mt=0;const ri=$e[0];for(let mi=0,ei=ri.length,ui=ei-1;mi<ei;ui=mi++){const Pi=ri[mi],Fi=ri[ui],Sn=Pi.x*Fi.y-Fi.x*Pi.y;Rt+=(Pi.x+Fi.x)*Sn,Mt+=(Pi.y+Fi.y)*Sn,Ze+=3*Sn}return new yd(Rt/Ze,Mt/Ze,0,$e)}(A),ke=Ce.length;for(;Ce.length;){const $e=Ce.pop();($e.d>Ie.d||!Ie.d)&&(Ie=$e,f&&console.log("found best %d after %d probes",Math.round(1e4*$e.d)/1e4,ke)),$e.max-Ie.d<=l||(ge=$e.h/2,Ce.push(new yd($e.p.x-ge,$e.p.y-ge,ge,A)),Ce.push(new yd($e.p.x+ge,$e.p.y-ge,ge,A)),Ce.push(new yd($e.p.x-ge,$e.p.y+ge,ge,A)),Ce.push(new yd($e.p.x+ge,$e.p.y+ge,ge,A)),ke+=4)}return f&&(console.log(`num probes: ${ke}`),console.log(`best distance: ${Ie.d}`)),Ie.p}function A1(A,l){return l.max-A.max}function yd(A,l,f,w){this.p=new xe(A,l),this.h=f,this.d=function(I,U){let N=!1,Z=1/0;for(let re=0;re<U.length;re++){const ge=U[re];for(let Ce=0,Ie=ge.length,ke=Ie-1;Ce<Ie;ke=Ce++){const $e=ge[Ce],Ze=ge[ke];$e.y>I.y!=Ze.y>I.y&&I.x<(Ze.x-$e.x)*(I.y-$e.y)/(Ze.y-$e.y)+$e.x&&(N=!N),Z=Math.min(Z,On(I,$e,Ze))}}return(N?1:-1)*Math.sqrt(Z)}(this.p,w),this.max=this.d+this.h*Math.SQRT2}const Sg=Number.POSITIVE_INFINITY;function xd(A,l){return l[1]!==Sg?function(f,w,I){let U=0,N=0;switch(w=Math.abs(w),I=Math.abs(I),f){case"top-right":case"top-left":case"top":N=I-7;break;case"bottom-right":case"bottom-left":case"bottom":N=7-I}switch(f){case"top-right":case"bottom-right":case"right":U=-w;break;case"top-left":case"bottom-left":case"left":U=w}return[U,N]}(A,l[0],l[1]):function(f,w){let I=0,U=0;w<0&&(w=0);const N=w/Math.sqrt(2);switch(f){case"top-right":case"top-left":U=N-7;break;case"bottom-right":case"bottom-left":U=7-N;break;case"bottom":U=7-w;break;case"top":U=w-7}switch(f){case"top-right":case"bottom-right":I=-N;break;case"top-left":case"bottom-left":I=N;break;case"left":I=w;break;case"right":I=-w}return[I,U]}(A,l[0])}function vd(A){switch(A){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Yy(A,l,f,w,I,U,N,Z,re,ge,Ce){let Ie=U.textMaxSize.evaluate(l,{});Ie===void 0&&(Ie=N);const ke=A.layers[0].layout,$e=ke.get("icon-offset").evaluate(l,{},Ce),Ze=Jy(f.horizontal),Rt=N/24,Mt=A.tilePixelRatio*Rt,ri=A.tilePixelRatio*Ie/24,mi=A.tilePixelRatio*Z,ei=A.tilePixelRatio*ke.get("symbol-spacing"),ui=ke.get("text-padding")*A.tilePixelRatio,Pi=function(Ji,Wn,zn,yr=1){const fs=Ji.get("icon-padding").evaluate(Wn,{},zn),ws=fs&&fs.values;return[ws[0]*yr,ws[1]*yr,ws[2]*yr,ws[3]*yr]}(ke,l,Ce,A.tilePixelRatio),Fi=ke.get("text-max-angle")/180*Math.PI,Sn=ke.get("text-rotation-alignment")!=="viewport"&&ke.get("symbol-placement")!=="point",fn=ke.get("icon-rotation-alignment")==="map"&&ke.get("symbol-placement")!=="point",mn=ke.get("symbol-placement"),an=ei/2,nn=ke.get("icon-text-fit");let vn;w&&nn!=="none"&&(A.allowVerticalPlacement&&f.vertical&&(vn=bg(w,f.vertical,nn,ke.get("icon-text-fit-padding"),$e,Rt)),Ze&&(w=bg(w,Ze,nn,ke.get("icon-text-fit-padding"),$e,Rt)));const gn=(Ji,Wn)=>{Wn.x<0||Wn.x>=Kt||Wn.y<0||Wn.y>=Kt||function(zn,yr,fs,ws,Qs,Cl,xo,Ks,oo,Lo,$o,Ia,io,Do,Po,pa,Jr,Vs,ms,$s,pr,qa,Uo,ao,Jl){const Cc=zn.addToLineVertexArray(yr,fs);let Fa,Ah,El,vr,Zo=0,dh=0,Td=0,ph=0,Fu=-1,Hf=-1;const tu={};let l0=S.exports(""),Ug=0,Rg=0;if(Ks._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Ug,Rg]=Ks.layout.get("text-offset").evaluate(pr,{},ao).map(Xo=>Xo*yo):(Ug=Ks.layout.get("text-radial-offset").evaluate(pr,{},ao)*yo,Rg=Sg),zn.allowVerticalPlacement&&ws.vertical){const Xo=Ks.layout.get("text-rotate").evaluate(pr,{},ao)+90;El=new Yl(oo,yr,Lo,$o,Ia,ws.vertical,io,Do,Po,Xo),xo&&(vr=new Yl(oo,yr,Lo,$o,Ia,xo,Jr,Vs,Po,Xo))}if(Qs){const Xo=Ks.layout.get("icon-rotate").evaluate(pr,{}),Tc=Ks.layout.get("icon-text-fit")!=="none",qo=qy(Qs,Xo,Uo,Tc),iu=xo?qy(xo,Xo,Uo,Tc):void 0;Ah=new Yl(oo,yr,Lo,$o,Ia,Qs,Jr,Vs,!1,Xo),Zo=4*qo.length;const IA=zn.iconSizeData;let nu=null;IA.kind==="source"?(nu=[uh*Ks.layout.get("icon-size").evaluate(pr,{})],nu[0]>Xa&&me(`${zn.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):IA.kind==="composite"&&(nu=[uh*qa.compositeIconSizes[0].evaluate(pr,{},ao),uh*qa.compositeIconSizes[1].evaluate(pr,{},ao)],(nu[0]>Xa||nu[1]>Xa)&&me(`${zn.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),zn.addSymbols(zn.icon,qo,nu,$s,ms,pr,i.WritingMode.none,yr,Cc.lineStartIndex,Cc.lineLength,-1,ao),Fu=zn.icon.placedSymbolArray.length-1,iu&&(dh=4*iu.length,zn.addSymbols(zn.icon,iu,nu,$s,ms,pr,i.WritingMode.vertical,yr,Cc.lineStartIndex,Cc.lineLength,-1,ao),Hf=zn.icon.placedSymbolArray.length-1)}const c0=Object.keys(ws.horizontal);for(const Xo of c0){const Tc=ws.horizontal[Xo];if(!Fa){l0=S.exports(Tc.text);const iu=Ks.layout.get("text-rotate").evaluate(pr,{},ao);Fa=new Yl(oo,yr,Lo,$o,Ia,Tc,io,Do,Po,iu)}const qo=Tc.positionedLines.length===1;if(Td+=wd(zn,yr,Tc,Cl,Ks,Po,pr,pa,Cc,ws.vertical?i.WritingMode.horizontal:i.WritingMode.horizontalOnly,qo?c0:[Xo],tu,Fu,qa,ao),qo)break}ws.vertical&&(ph+=wd(zn,yr,ws.vertical,Cl,Ks,Po,pr,pa,Cc,i.WritingMode.vertical,["vertical"],tu,Hf,qa,ao));const x1=Fa?Fa.boxStartIndex:zn.collisionBoxArray.length,v1=Fa?Fa.boxEndIndex:zn.collisionBoxArray.length,w1=El?El.boxStartIndex:zn.collisionBoxArray.length,b1=El?El.boxEndIndex:zn.collisionBoxArray.length,Gf=Ah?Ah.boxStartIndex:zn.collisionBoxArray.length,Sd=Ah?Ah.boxEndIndex:zn.collisionBoxArray.length,h0=vr?vr.boxStartIndex:zn.collisionBoxArray.length,B1=vr?vr.boxEndIndex:zn.collisionBoxArray.length;let Ec=-1;const Wf=(Xo,Tc)=>Xo&&Xo.circleDiameter?Math.max(Xo.circleDiameter,Tc):Tc;Ec=Wf(Fa,Ec),Ec=Wf(El,Ec),Ec=Wf(Ah,Ec),Ec=Wf(vr,Ec);const jf=Ec>-1?1:0;jf&&(Ec*=Jl/yo),zn.glyphOffsetArray.length>=Bc.MAX_GLYPHS&&me("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pr.sortKey!==void 0&&zn.addToSortKeyRanges(zn.symbolInstances.length,pr.sortKey),zn.symbolInstances.emplaceBack(yr.x,yr.y,tu.right>=0?tu.right:-1,tu.center>=0?tu.center:-1,tu.left>=0?tu.left:-1,tu.vertical||-1,Fu,Hf,l0,x1,v1,w1,b1,Gf,Sd,h0,B1,Lo,Td,ph,Zo,dh,jf,0,io,Ug,Rg,Ec)}(A,Wn,Ji,f,w,I,vn,A.layers[0],A.collisionBoxArray,l.index,l.sourceLayerIndex,A.index,Mt,[ui,ui,ui,ui],Sn,re,mi,Pi,fn,$e,l,U,ge,Ce,N)};if(mn==="line")for(const Ji of Xy(l.geometry,0,0,Kt,Kt)){const Wn=h1(Ji,ei,Fi,f.vertical||Ze,w,24,ri,A.overscaling,Kt);for(const zn of Wn){const yr=Ze;yr&&d1(A,yr.text,an,zn)||gn(Ji,zn)}}else if(mn==="line-center"){for(const Ji of l.geometry)if(Ji.length>1){const Wn=Zy(Ji,Fi,f.vertical||Ze,w,24,ri);Wn&&gn(Ji,Wn)}}else if(l.type==="Polygon")for(const Ji of lh(l.geometry,0)){const Wn=Tg(Ji,16);gn(Ji[0],new Iu(Wn.x,Wn.y,0))}else if(l.type==="LineString")for(const Ji of l.geometry)gn(Ji,new Iu(Ji[0].x,Ji[0].y,0));else if(l.type==="Point")for(const Ji of l.geometry)for(const Wn of Ji)gn([Wn],new Iu(Wn.x,Wn.y,0))}const Xa=32640;function wd(A,l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze){const Rt=function(mi,ei,ui,Pi,Fi,Sn,fn,mn){const an=Pi.layout.get("text-rotate").evaluate(Sn,{})*Math.PI/180,nn=[];for(const vn of ei.positionedLines)for(const gn of vn.positionedGlyphs){if(!gn.rect)continue;const Ji=gn.rect||{};let Wn=4,zn=!0,yr=1,fs=0;const ws=(Fi||mn)&&gn.vertical,Qs=gn.metrics.advance*gn.scale/2;if(mn&&ei.verticalizable){const ms=(gn.scale-1)*yo,$s=(yo-gn.metrics.width*gn.scale)/2;fs=vn.lineOffset/2-(gn.imageName?-$s:ms)}if(gn.imageName){const ms=fn[gn.imageName];zn=ms.sdf,yr=ms.pixelRatio,Wn=1/yr}const Cl=Fi?[gn.x+Qs,gn.y]:[0,0];let xo=Fi?[0,0]:[gn.x+Qs+ui[0],gn.y+ui[1]-fs],Ks=[0,0];ws&&(Ks=xo,xo=[0,0]);const oo=(gn.metrics.left-Wn)*gn.scale-Qs+xo[0],Lo=(-gn.metrics.top-Wn)*gn.scale+xo[1],$o=oo+Ji.w*gn.scale/yr,Ia=Lo+Ji.h*gn.scale/yr,io=new xe(oo,Lo),Do=new xe($o,Lo),Po=new xe(oo,Ia),pa=new xe($o,Ia);if(ws){const ms=new xe(-Qs,Qs-da),$s=-Math.PI/2,pr=12-Qs,qa=new xe(22-pr,-(gn.imageName?pr:0)),Uo=new xe(...Ks);io._rotateAround($s,ms)._add(qa)._add(Uo),Do._rotateAround($s,ms)._add(qa)._add(Uo),Po._rotateAround($s,ms)._add(qa)._add(Uo),pa._rotateAround($s,ms)._add(qa)._add(Uo)}if(an){const ms=Math.sin(an),$s=Math.cos(an),pr=[$s,-ms,ms,$s];io._matMult(pr),Do._matMult(pr),Po._matMult(pr),pa._matMult(pr)}const Jr=new xe(0,0),Vs=new xe(0,0);nn.push({tl:io,tr:Do,bl:Po,br:pa,tex:Ji,writingMode:ei.writingMode,glyphOffset:Cl,sectionIndex:gn.sectionIndex,isSDF:zn,pixelOffsetTL:Jr,pixelOffsetBR:Vs,minFontScaleX:0,minFontScaleY:0})}return nn}(0,f,Z,I,U,N,w,A.allowVerticalPlacement),Mt=A.textSizeData;let ri=null;Mt.kind==="source"?(ri=[uh*I.layout.get("text-size").evaluate(N,{})],ri[0]>Xa&&me(`${A.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Mt.kind==="composite"&&(ri=[uh*$e.compositeTextSizes[0].evaluate(N,{},Ze),uh*$e.compositeTextSizes[1].evaluate(N,{},Ze)],(ri[0]>Xa||ri[1]>Xa)&&me(`${A.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),A.addSymbols(A.text,Rt,ri,Z,U,N,ge,l,re.lineStartIndex,re.lineLength,ke,Ze);for(const mi of Ce)Ie[mi]=A.text.placedSymbolArray.length-1;return 4*Rt.length}function Jy(A){for(const l in A)return A[l];return null}function d1(A,l,f,w){const I=A.compareText;if(l in I){const U=I[l];for(let N=U.length-1;N>=0;N--)if(w.dist(U[N])<f)return!0}else I[l]=[];return I[l].push(w),!1}const p1=Tu.VectorTileFeature.types,f1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function zf(A,l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke){const $e=Z?Math.min(Xa,Math.round(Z[0])):0,Ze=Z?Math.min(Xa,Math.round(Z[1])):0;A.emplaceBack(l,f,Math.round(32*w),Math.round(32*I),U,N,($e<<1)+(re?1:0),Ze,16*ge,16*Ce,256*Ie,256*ke)}function Mg(A,l,f){A.emplaceBack(l.x,l.y,f),A.emplaceBack(l.x,l.y,f),A.emplaceBack(l.x,l.y,f),A.emplaceBack(l.x,l.y,f)}function m1(A){for(const l of A.sections)if(uA(l.text))return!0;return!1}class bp{constructor(l){this.layoutVertexArray=new wa,this.indexArray=new mo,this.programConfigurations=l,this.segments=new a,this.dynamicLayoutVertexArray=new ua,this.opacityVertexArray=new ba,this.placedSymbolArray=new Hi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(l,f,w,I){this.isEmpty()||(w&&(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,dg.members),this.indexBuffer=l.createIndexBuffer(this.indexArray,f),this.dynamicLayoutVertexBuffer=l.createVertexBuffer(this.dynamicLayoutVertexArray,l1.members,!0),this.opacityVertexBuffer=l.createVertexBuffer(this.opacityVertexArray,f1,!0),this.opacityVertexBuffer.itemSize=1),(w||I)&&this.programConfigurations.upload(l))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}pn("SymbolBuffers",bp);class Ig{constructor(l,f,w){this.layoutVertexArray=new l,this.layoutAttributes=f,this.indexArray=new w,this.segments=new a,this.collisionVertexArray=new Wo}upload(l){this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=l.createVertexBuffer(this.collisionVertexArray,pg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}pn("CollisionBuffers",Ig);class Bc{constructor(l){this.collisionBoxArray=l.collisionBoxArray,this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(N=>N.id),this.index=l.index,this.pixelRatio=l.pixelRatio,this.sourceLayerIndex=l.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Fr([]),this.placementViewportMatrix=Fr([]);const f=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Bg(this.zoom,f["text-size"]),this.iconSizeData=Bg(this.zoom,f["icon-size"]);const w=this.layers[0].layout,I=w.get("symbol-sort-key"),U=w.get("symbol-z-order");this.canOverlap=bd(w,"text-overlap","text-allow-overlap")!=="never"||bd(w,"icon-overlap","icon-allow-overlap")!=="never"||w.get("text-ignore-placement")||w.get("icon-ignore-placement"),this.sortFeaturesByKey=U!=="viewport-y"&&!I.isConstant(),this.sortFeaturesByY=(U==="viewport-y"||U==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,w.get("symbol-placement")==="point"&&(this.writingModes=w.get("text-writing-mode").map(N=>i.WritingMode[N])),this.stateDependentLayerIds=this.layers.filter(N=>N.isStateDependent()).map(N=>N.id),this.sourceID=l.sourceID}createArrays(){this.text=new bp(new si(this.layers,this.zoom,l=>/^text/.test(l))),this.icon=new bp(new si(this.layers,this.zoom,l=>/^icon/.test(l))),this.glyphOffsetArray=new cn,this.lineVertexArray=new Bn,this.symbolInstances=new xn}calculateGlyphDependencies(l,f,w,I,U){for(let N=0;N<l.length;N++)if(f[l.charCodeAt(N)]=!0,(w||I)&&U){const Z=ud[l.charAt(N)];Z&&(f[Z.charCodeAt(0)]=!0)}}populate(l,f,w){const I=this.layers[0],U=I.layout,N=U.get("text-font"),Z=U.get("text-field"),re=U.get("icon-image"),ge=(Z.value.kind!=="constant"||Z.value.value instanceof He&&!Z.value.value.isEmpty()||Z.value.value.toString().length>0)&&(N.value.kind!=="constant"||N.value.value.length>0),Ce=re.value.kind!=="constant"||!!re.value.value||Object.keys(re.parameters).length>0,Ie=U.get("symbol-sort-key");if(this.features=[],!ge&&!Ce)return;const ke=f.iconDependencies,$e=f.glyphDependencies,Ze=f.availableImages,Rt=new Zr(this.zoom);for(const{feature:Mt,id:ri,index:mi,sourceLayerIndex:ei}of l){const ui=I._featureFilter.needGeometry,Pi=Ai(Mt,ui);if(!I._featureFilter.filter(Rt,Pi,w))continue;let Fi,Sn;if(ui||(Pi.geometry=Ri(Mt)),ge){const mn=I.getValueAndResolveTokens("text-field",Pi,w,Ze),an=He.factory(mn);m1(an)&&(this.hasRTLText=!0),(!this.hasRTLText||_l()==="unavailable"||this.hasRTLText&&xs.isParsed())&&(Fi=vA(an,I,Pi))}if(Ce){const mn=I.getValueAndResolveTokens("icon-image",Pi,w,Ze);Sn=mn instanceof pt?mn:pt.fromString(mn)}if(!Fi&&!Sn)continue;const fn=this.sortFeaturesByKey?Ie.evaluate(Pi,{},w):void 0;if(this.features.push({id:ri,text:Fi,icon:Sn,index:mi,sourceLayerIndex:ei,geometry:Pi.geometry,properties:Mt.properties,type:p1[Mt.type],sortKey:fn}),Sn&&(ke[Sn.name]=!0),Fi){const mn=N.evaluate(Pi,{},w).join(","),an=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(i.WritingMode.vertical)>=0;for(const nn of Fi.sections)if(nn.image)ke[nn.image.name]=!0;else{const vn=th(Fi.toString()),gn=nn.fontStack||mn,Ji=$e[gn]=$e[gn]||{};this.calculateGlyphDependencies(nn.text,Ji,an,this.allowVerticalPlacement,vn)}}}U.get("symbol-placement")==="line"&&(this.features=function(Mt){const ri={},mi={},ei=[];let ui=0;function Pi(mn){ei.push(Mt[mn]),ui++}function Fi(mn,an,nn){const vn=mi[mn];return delete mi[mn],mi[an]=vn,ei[vn].geometry[0].pop(),ei[vn].geometry[0]=ei[vn].geometry[0].concat(nn[0]),vn}function Sn(mn,an,nn){const vn=ri[an];return delete ri[an],ri[mn]=vn,ei[vn].geometry[0].shift(),ei[vn].geometry[0]=nn[0].concat(ei[vn].geometry[0]),vn}function fn(mn,an,nn){const vn=nn?an[0][an[0].length-1]:an[0][0];return`${mn}:${vn.x}:${vn.y}`}for(let mn=0;mn<Mt.length;mn++){const an=Mt[mn],nn=an.geometry,vn=an.text?an.text.toString():null;if(!vn){Pi(mn);continue}const gn=fn(vn,nn),Ji=fn(vn,nn,!0);if(gn in mi&&Ji in ri&&mi[gn]!==ri[Ji]){const Wn=Sn(gn,Ji,nn),zn=Fi(gn,Ji,ei[Wn].geometry);delete ri[gn],delete mi[Ji],mi[fn(vn,ei[zn].geometry,!0)]=zn,ei[Wn].geometry=null}else gn in mi?Fi(gn,Ji,nn):Ji in ri?Sn(gn,Ji,nn):(Pi(mn),ri[gn]=ui-1,mi[Ji]=ui-1)}return ei.filter(mn=>mn.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Mt,ri)=>Mt.sortKey-ri.sortKey)}update(l,f,w){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(l,f,this.layers,w),this.icon.programConfigurations.updatePaintArrays(l,f,this.layers,w))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(l){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(l),this.iconCollisionBox.upload(l)),this.text.upload(l,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(l,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(l,f){const w=this.lineVertexArray.length;if(l.segment!==void 0){let I=l.dist(f[l.segment+1]),U=l.dist(f[l.segment]);const N={};for(let Z=l.segment+1;Z<f.length;Z++)N[Z]={x:f[Z].x,y:f[Z].y,tileUnitDistanceFromAnchor:I},Z<f.length-1&&(I+=f[Z+1].dist(f[Z]));for(let Z=l.segment||0;Z>=0;Z--)N[Z]={x:f[Z].x,y:f[Z].y,tileUnitDistanceFromAnchor:U},Z>0&&(U+=f[Z-1].dist(f[Z]));for(let Z=0;Z<f.length;Z++){const re=N[Z];this.lineVertexArray.emplaceBack(re.x,re.y,re.tileUnitDistanceFromAnchor)}}return{lineStartIndex:w,lineLength:this.lineVertexArray.length-w}}addSymbols(l,f,w,I,U,N,Z,re,ge,Ce,Ie,ke){const $e=l.indexArray,Ze=l.layoutVertexArray,Rt=l.segments.prepareSegment(4*f.length,Ze,$e,this.canOverlap?N.sortKey:void 0),Mt=this.glyphOffsetArray.length,ri=Rt.vertexLength,mi=this.allowVerticalPlacement&&Z===i.WritingMode.vertical?Math.PI/2:0,ei=N.text&&N.text.sections;for(let ui=0;ui<f.length;ui++){const{tl:Pi,tr:Fi,bl:Sn,br:fn,tex:mn,pixelOffsetTL:an,pixelOffsetBR:nn,minFontScaleX:vn,minFontScaleY:gn,glyphOffset:Ji,isSDF:Wn,sectionIndex:zn}=f[ui],yr=Rt.vertexLength,fs=Ji[1];zf(Ze,re.x,re.y,Pi.x,fs+Pi.y,mn.x,mn.y,w,Wn,an.x,an.y,vn,gn),zf(Ze,re.x,re.y,Fi.x,fs+Fi.y,mn.x+mn.w,mn.y,w,Wn,nn.x,an.y,vn,gn),zf(Ze,re.x,re.y,Sn.x,fs+Sn.y,mn.x,mn.y+mn.h,w,Wn,an.x,nn.y,vn,gn),zf(Ze,re.x,re.y,fn.x,fs+fn.y,mn.x+mn.w,mn.y+mn.h,w,Wn,nn.x,nn.y,vn,gn),Mg(l.dynamicLayoutVertexArray,re,mi),$e.emplaceBack(yr,yr+1,yr+2),$e.emplaceBack(yr+1,yr+2,yr+3),Rt.vertexLength+=4,Rt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ji[0]),ui!==f.length-1&&zn===f[ui+1].sectionIndex||l.programConfigurations.populatePaintArrays(Ze.length,N,N.index,{},ke,ei&&ei[zn])}l.placedSymbolArray.emplaceBack(re.x,re.y,Mt,this.glyphOffsetArray.length-Mt,ri,ge,Ce,re.segment,w?w[0]:0,w?w[1]:0,I[0],I[1],Z,0,!1,0,Ie)}_addCollisionDebugVertex(l,f,w,I,U,N){return f.emplaceBack(0,0),l.emplaceBack(w.x,w.y,I,U,Math.round(N.x),Math.round(N.y))}addCollisionDebugVertices(l,f,w,I,U,N,Z){const re=U.segments.prepareSegment(4,U.layoutVertexArray,U.indexArray),ge=re.vertexLength,Ce=U.layoutVertexArray,Ie=U.collisionVertexArray,ke=Z.anchorX,$e=Z.anchorY;this._addCollisionDebugVertex(Ce,Ie,N,ke,$e,new xe(l,f)),this._addCollisionDebugVertex(Ce,Ie,N,ke,$e,new xe(w,f)),this._addCollisionDebugVertex(Ce,Ie,N,ke,$e,new xe(w,I)),this._addCollisionDebugVertex(Ce,Ie,N,ke,$e,new xe(l,I)),re.vertexLength+=4;const Ze=U.indexArray;Ze.emplaceBack(ge,ge+1),Ze.emplaceBack(ge+1,ge+2),Ze.emplaceBack(ge+2,ge+3),Ze.emplaceBack(ge+3,ge),re.primitiveLength+=4}addDebugCollisionBoxes(l,f,w,I){for(let U=l;U<f;U++){const N=this.collisionBoxArray.get(U);this.addCollisionDebugVertices(N.x1,N.y1,N.x2,N.y2,I?this.textCollisionBox:this.iconCollisionBox,N.anchorPoint,w)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ig(Wa,fg.members,Ba),this.iconCollisionBox=new Ig(Wa,fg.members,Ba);for(let l=0;l<this.symbolInstances.length;l++){const f=this.symbolInstances.get(l);this.addDebugCollisionBoxes(f.textBoxStartIndex,f.textBoxEndIndex,f,!0),this.addDebugCollisionBoxes(f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f,!0),this.addDebugCollisionBoxes(f.iconBoxStartIndex,f.iconBoxEndIndex,f,!1),this.addDebugCollisionBoxes(f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f,!1)}}_deserializeCollisionBoxesForSymbol(l,f,w,I,U,N,Z,re,ge){const Ce={};for(let Ie=f;Ie<w;Ie++){const ke=l.get(Ie);Ce.textBox={x1:ke.x1,y1:ke.y1,x2:ke.x2,y2:ke.y2,anchorPointX:ke.anchorPointX,anchorPointY:ke.anchorPointY},Ce.textFeatureIndex=ke.featureIndex;break}for(let Ie=I;Ie<U;Ie++){const ke=l.get(Ie);Ce.verticalTextBox={x1:ke.x1,y1:ke.y1,x2:ke.x2,y2:ke.y2,anchorPointX:ke.anchorPointX,anchorPointY:ke.anchorPointY},Ce.verticalTextFeatureIndex=ke.featureIndex;break}for(let Ie=N;Ie<Z;Ie++){const ke=l.get(Ie);Ce.iconBox={x1:ke.x1,y1:ke.y1,x2:ke.x2,y2:ke.y2,anchorPointX:ke.anchorPointX,anchorPointY:ke.anchorPointY},Ce.iconFeatureIndex=ke.featureIndex;break}for(let Ie=re;Ie<ge;Ie++){const ke=l.get(Ie);Ce.verticalIconBox={x1:ke.x1,y1:ke.y1,x2:ke.x2,y2:ke.y2,anchorPointX:ke.anchorPointX,anchorPointY:ke.anchorPointY},Ce.verticalIconFeatureIndex=ke.featureIndex;break}return Ce}deserializeCollisionBoxes(l){this.collisionArrays=[];for(let f=0;f<this.symbolInstances.length;f++){const w=this.symbolInstances.get(f);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(l,w.textBoxStartIndex,w.textBoxEndIndex,w.verticalTextBoxStartIndex,w.verticalTextBoxEndIndex,w.iconBoxStartIndex,w.iconBoxEndIndex,w.verticalIconBoxStartIndex,w.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(l,f){const w=l.placedSymbolArray.get(f),I=w.vertexStartIndex+4*w.numGlyphs;for(let U=w.vertexStartIndex;U<I;U+=4)l.indexArray.emplaceBack(U,U+1,U+2),l.indexArray.emplaceBack(U+1,U+2,U+3)}getSortedSymbolIndexes(l){if(this.sortedAngle===l&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const f=Math.sin(l),w=Math.cos(l),I=[],U=[],N=[];for(let Z=0;Z<this.symbolInstances.length;++Z){N.push(Z);const re=this.symbolInstances.get(Z);I.push(0|Math.round(f*re.anchorX+w*re.anchorY)),U.push(re.featureIndex)}return N.sort((Z,re)=>I[Z]-I[re]||U[re]-U[Z]),N}addToSortKeyRanges(l,f){const w=this.sortKeyRanges[this.sortKeyRanges.length-1];w&&w.sortKey===f?w.symbolInstanceEnd=l+1:this.sortKeyRanges.push({sortKey:f,symbolInstanceStart:l,symbolInstanceEnd:l+1})}sortFeatures(l){if(this.sortFeaturesByY&&this.sortedAngle!==l&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(l),this.sortedAngle=l,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const f of this.symbolInstanceIndexes){const w=this.symbolInstances.get(f);this.featureSortOrder.push(w.featureIndex),[w.rightJustifiedTextSymbolIndex,w.centerJustifiedTextSymbolIndex,w.leftJustifiedTextSymbolIndex].forEach((I,U,N)=>{I>=0&&N.indexOf(I)===U&&this.addIndicesForPlacedSymbol(this.text,I)}),w.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,w.verticalPlacedTextSymbolIndex),w.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,w.placedIconSymbolIndex),w.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,w.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}pn("SymbolBucket",Bc,{omit:["layers","collisionBoxArray","features","compareText"]}),Bc.MAX_GLYPHS=65535,Bc.addDynamicAttributes=Mg;const g1=new Cs({"symbol-placement":new Fn($t.layout_symbol["symbol-placement"]),"symbol-spacing":new Fn($t.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Fn($t.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vn($t.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Fn($t.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Fn($t.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Fn($t.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Fn($t.layout_symbol["icon-ignore-placement"]),"icon-optional":new Fn($t.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Fn($t.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vn($t.layout_symbol["icon-size"]),"icon-text-fit":new Fn($t.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Fn($t.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vn($t.layout_symbol["icon-image"]),"icon-rotate":new Vn($t.layout_symbol["icon-rotate"]),"icon-padding":new Vn($t.layout_symbol["icon-padding"]),"icon-keep-upright":new Fn($t.layout_symbol["icon-keep-upright"]),"icon-offset":new Vn($t.layout_symbol["icon-offset"]),"icon-anchor":new Vn($t.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Fn($t.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Fn($t.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Fn($t.layout_symbol["text-rotation-alignment"]),"text-field":new Vn($t.layout_symbol["text-field"]),"text-font":new Vn($t.layout_symbol["text-font"]),"text-size":new Vn($t.layout_symbol["text-size"]),"text-max-width":new Vn($t.layout_symbol["text-max-width"]),"text-line-height":new Fn($t.layout_symbol["text-line-height"]),"text-letter-spacing":new Vn($t.layout_symbol["text-letter-spacing"]),"text-justify":new Vn($t.layout_symbol["text-justify"]),"text-radial-offset":new Vn($t.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Fn($t.layout_symbol["text-variable-anchor"]),"text-anchor":new Vn($t.layout_symbol["text-anchor"]),"text-max-angle":new Fn($t.layout_symbol["text-max-angle"]),"text-writing-mode":new Fn($t.layout_symbol["text-writing-mode"]),"text-rotate":new Vn($t.layout_symbol["text-rotate"]),"text-padding":new Fn($t.layout_symbol["text-padding"]),"text-keep-upright":new Fn($t.layout_symbol["text-keep-upright"]),"text-transform":new Vn($t.layout_symbol["text-transform"]),"text-offset":new Vn($t.layout_symbol["text-offset"]),"text-allow-overlap":new Fn($t.layout_symbol["text-allow-overlap"]),"text-overlap":new Fn($t.layout_symbol["text-overlap"]),"text-ignore-placement":new Fn($t.layout_symbol["text-ignore-placement"]),"text-optional":new Fn($t.layout_symbol["text-optional"])});var Ds={paint:new Cs({"icon-opacity":new Vn($t.paint_symbol["icon-opacity"]),"icon-color":new Vn($t.paint_symbol["icon-color"]),"icon-halo-color":new Vn($t.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vn($t.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vn($t.paint_symbol["icon-halo-blur"]),"icon-translate":new Fn($t.paint_symbol["icon-translate"]),"icon-translate-anchor":new Fn($t.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vn($t.paint_symbol["text-opacity"]),"text-color":new Vn($t.paint_symbol["text-color"],{runtimeType:wi,getOverride:A=>A.textColor,hasOverride:A=>!!A.textColor}),"text-halo-color":new Vn($t.paint_symbol["text-halo-color"]),"text-halo-width":new Vn($t.paint_symbol["text-halo-width"]),"text-halo-blur":new Vn($t.paint_symbol["text-halo-blur"]),"text-translate":new Fn($t.paint_symbol["text-translate"]),"text-translate-anchor":new Fn($t.paint_symbol["text-translate-anchor"])}),layout:g1};class Bp{constructor(l){if(l.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=l.property.overrides?l.property.overrides.runtimeType:nr,this.defaultValue=l}evaluate(l){if(l.formattedSection){const f=this.defaultValue.property.overrides;if(f&&f.hasOverride(l.formattedSection))return f.getOverride(l.formattedSection)}return l.feature&&l.featureState?this.defaultValue.evaluate(l.feature,l.featureState):this.defaultValue.property.specification.default}eachChild(l){this.defaultValue.isConstant()||l(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}pn("FormatSectionOverride",Bp,{omit:["defaultValue"]});class Cp extends Go{constructor(l){super(l,Ds)}recalculate(l,f){if(super.recalculate(l,f),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 w=this.layout.get("text-writing-mode");if(w){const I=[];for(const U of w)I.indexOf(U)<0&&I.push(U);this.layout._values["text-writing-mode"]=I}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(l,f,w,I){const U=this.layout.get(l).evaluate(f,{},w,I),N=this._unevaluatedLayout._values[l];return N.isDataDriven()||Vc(N.value)||!U?U:function(Z,re){return re.replace(/{([^{}]+)}/g,(ge,Ce)=>Ce in Z?String(Z[Ce]):"")}(f.properties,U)}createBucket(l){return new Bc(l)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const l of Ds.paint.overridableProperties){if(!Cp.hasPaintOverride(this.layout,l))continue;const f=this.paint.get(l),w=new Bp(f),I=new dc(w,f.property.specification);let U=null;U=f.value.kind==="constant"||f.value.kind==="source"?new Lh("source",I):new Gc("composite",I,f.value.zoomStops),this.paint._values[l]=new uo(f.property,U,f.parameters)}}_handleOverridablePaintPropertyUpdate(l,f,w){return!(!this.layout||f.isDataDriven()||w.isDataDriven())&&Cp.hasPaintOverride(this.layout,l)}static hasPaintOverride(l,f){const w=l.get("text-field"),I=Ds.paint.properties[f];let U=!1;const N=Z=>{for(const re of Z)if(I.overrides&&I.overrides.hasOverride(re))return void(U=!0)};if(w.value.kind==="constant"&&w.value.value instanceof He)N(w.value.value.sections);else if(w.value.kind==="source"){const Z=ge=>{U||(ge instanceof bi&&Wt(ge.value)===qn?N(ge.value.sections):ge instanceof Oc?N(ge.sections):ge.eachChild(Z))},re=w.value;re._styleExpression&&Z(re._styleExpression.expression)}return U}}function bd(A,l,f){let w="never";const I=A.get(l);return I?w=I:A.get(f)&&(w="always"),w}var kf={paint:new Cs({"background-color":new Fn($t.paint_background["background-color"]),"background-pattern":new dA($t.paint_background["background-pattern"]),"background-opacity":new Fn($t.paint_background["background-opacity"])})},Ep={paint:new Cs({"raster-opacity":new Fn($t.paint_raster["raster-opacity"]),"raster-hue-rotate":new Fn($t.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Fn($t.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Fn($t.paint_raster["raster-brightness-max"]),"raster-saturation":new Fn($t.paint_raster["raster-saturation"]),"raster-contrast":new Fn($t.paint_raster["raster-contrast"]),"raster-resampling":new Fn($t.paint_raster["raster-resampling"]),"raster-fade-duration":new Fn($t.paint_raster["raster-fade-duration"])})};class e0 extends Go{constructor(l){super(l,{}),this.onAdd=f=>{this.implementation.onAdd&&this.implementation.onAdd(f,f.painter.context.gl)},this.onRemove=f=>{this.implementation.onRemove&&this.implementation.onRemove(f,f.painter.context.gl)},this.implementation=l}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")}}const t0={circle:class extends Go{constructor(A){super(A,jo)}createBucket(A){return new $i(A)}queryRadius(A){const l=A;return Nr("circle-radius",this,l)+Nr("circle-stroke-width",this,l)+Qr(this.paint.get("circle-translate"))}queryIntersectsFeature(A,l,f,w,I,U,N,Z){const re=go(A,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),U.angle,N),ge=this.paint.get("circle-radius").evaluate(l,f)+this.paint.get("circle-stroke-width").evaluate(l,f),Ce=this.paint.get("circle-pitch-alignment")==="map",Ie=Ce?re:function($e,Ze){return $e.map(Rt=>Ea(Rt,Ze))}(re,Z),ke=Ce?ge*N:ge;for(const $e of w)for(const Ze of $e){const Rt=Ce?Ze:Ea(Ze,Z);let Mt=ke;const ri=ja([],[Ze.x,Ze.y,0,1],Z);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Mt*=ri[3]/U.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Mt*=U.cameraToCenterDistance/ri[3]),pi(Ie,Rt,Mt))return!0}return!1}},heatmap:class extends Go{constructor(A){super(A,Zl),this._updateColorRamp()}createBucket(A){return new vl(A)}_handleSpecialPaintPropertyUpdate(A){A==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=rg({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends Go{constructor(A){super(A,sg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Go{constructor(A){super(A,Uy)}recalculate(A,l){super.recalculate(A,l);const f=this.paint._values["fill-outline-color"];f.value.kind==="constant"&&f.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(A){return new cg(A)}queryRadius(){return Qr(this.paint.get("fill-translate"))}queryIntersectsFeature(A,l,f,w,I,U,N){return In(go(A,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),U.angle,N),w)}isTileClipped(){return!0}},"fill-extrusion":class extends Go{constructor(A){super(A,zy)}createBucket(A){return new Mf(A)}queryRadius(){return Qr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(A,l,f,w,I,U,N,Z){const re=go(A,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),U.angle,N),ge=this.paint.get("fill-extrusion-height").evaluate(l,f),Ce=this.paint.get("fill-extrusion-base").evaluate(l,f),Ie=function($e,Ze,Rt,Mt){const ri=[];for(const mi of $e){const ei=[mi.x,mi.y,0,1];ja(ei,ei,Ze),ri.push(new xe(ei[0]/ei[3],ei[1]/ei[3]))}return ri}(re,Z),ke=function($e,Ze,Rt,Mt){const ri=[],mi=[],ei=Mt[8]*Ze,ui=Mt[9]*Ze,Pi=Mt[10]*Ze,Fi=Mt[11]*Ze,Sn=Mt[8]*Rt,fn=Mt[9]*Rt,mn=Mt[10]*Rt,an=Mt[11]*Rt;for(const nn of $e){const vn=[],gn=[];for(const Ji of nn){const Wn=Ji.x,zn=Ji.y,yr=Mt[0]*Wn+Mt[4]*zn+Mt[12],fs=Mt[1]*Wn+Mt[5]*zn+Mt[13],ws=Mt[2]*Wn+Mt[6]*zn+Mt[14],Qs=Mt[3]*Wn+Mt[7]*zn+Mt[15],Cl=ws+Pi,xo=Qs+Fi,Ks=yr+Sn,oo=fs+fn,Lo=ws+mn,$o=Qs+an,Ia=new xe((yr+ei)/xo,(fs+ui)/xo);Ia.z=Cl/xo,vn.push(Ia);const io=new xe(Ks/$o,oo/$o);io.z=Lo/$o,gn.push(io)}ri.push(vn),mi.push(gn)}return[ri,mi]}(w,Ce,ge,Z);return function($e,Ze,Rt){let Mt=1/0;In(Rt,Ze)&&(Mt=ky(Rt,Ze[0]));for(let ri=0;ri<Ze.length;ri++){const mi=Ze[ri],ei=$e[ri];for(let ui=0;ui<mi.length-1;ui++){const Pi=mi[ui],Fi=[Pi,mi[ui+1],ei[ui+1],ei[ui],Pi];Jt(Rt,Fi)&&(Mt=Math.min(Mt,ky(Rt,Fi)))}}return Mt!==1/0&&Mt}(ke[0],ke[1],Ie)}},line:class extends Go{constructor(A){super(A,Qy),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(A){A==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ql,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(A,l){super.recalculate(A,l),this.paint._values["line-floorwidth"]=Ag.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,A)}createBucket(A){return new gp(A)}queryRadius(A){const l=A,f=Vy(Nr("line-width",this,l),Nr("line-gap-width",this,l)),w=Nr("line-offset",this,l);return f/2+Math.abs(w)+Qr(this.paint.get("line-translate"))}queryIntersectsFeature(A,l,f,w,I,U,N){const Z=go(A,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),U.angle,N),re=N/2*Vy(this.paint.get("line-width").evaluate(l,f),this.paint.get("line-gap-width").evaluate(l,f)),ge=this.paint.get("line-offset").evaluate(l,f);return ge&&(w=function(Ce,Ie){const ke=[];for(let $e=0;$e<Ce.length;$e++){const Ze=Ce[$e],Rt=[];for(let Mt=0;Mt<Ze.length;Mt++){const ri=Ze[Mt-1],mi=Ze[Mt],ei=Ze[Mt+1],ui=Mt===0?new xe(0,0):mi.sub(ri)._unit()._perp(),Pi=Mt===Ze.length-1?new xe(0,0):ei.sub(mi)._unit()._perp(),Fi=ui._add(Pi)._unit(),Sn=Fi.x*Pi.x+Fi.y*Pi.y;Sn!==0&&Fi._mult(1/Sn),Rt.push(Fi._mult(Ie)._add(mi))}ke.push(Rt)}return ke}(w,ge*N)),function(Ce,Ie,ke){for(let $e=0;$e<Ie.length;$e++){const Ze=Ie[$e];if(Ce.length>=3){for(let Rt=0;Rt<Ze.length;Rt++)if(Dr(Ce,Ze[Rt]))return!0}if(Hn(Ce,Ze,ke))return!0}return!1}(Z,w,re)}isTileClipped(){return!0}},symbol:Cp,background:class extends Go{constructor(A){super(A,kf)}},raster:class extends Go{constructor(A){super(A,Ep)}}};class Tp{constructor(l){this._callback=l,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Of=63710088e-1;class Es{constructor(l,f){if(isNaN(l)||isNaN(f))throw new Error(`Invalid LngLat object: (${l}, ${f})`);if(this.lng=+l,this.lat=+f,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Es(G(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){const f=Math.PI/180,w=this.lat*f,I=l.lat*f,U=Math.sin(w)*Math.sin(I)+Math.cos(w)*Math.cos(I)*Math.cos((l.lng-this.lng)*f);return Of*Math.acos(Math.min(U,1))}toBounds(l=0){const f=360*l/40075017,w=f/Math.cos(Math.PI/180*this.lat);return new SA(new Es(this.lng-w,this.lat-f),new Es(this.lng+w,this.lat+f))}static convert(l){if(l instanceof Es)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new Es(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new Es(Number("lng"in l?l.lng:l.lon),Number(l.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>]")}}class SA{constructor(l,f){l&&(f?this.setSouthWest(l).setNorthEast(f):l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1]))}setNorthEast(l){return this._ne=l instanceof Es?new Es(l.lng,l.lat):Es.convert(l),this}setSouthWest(l){return this._sw=l instanceof Es?new Es(l.lng,l.lat):Es.convert(l),this}extend(l){const f=this._sw,w=this._ne;let I,U;if(l instanceof Es)I=l,U=l;else{if(!(l instanceof SA))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(SA.convert(l)):this.extend(Es.convert(l)):this;if(I=l._sw,U=l._ne,!I||!U)return this}return f||w?(f.lng=Math.min(I.lng,f.lng),f.lat=Math.min(I.lat,f.lat),w.lng=Math.max(U.lng,w.lng),w.lat=Math.max(U.lat,w.lat)):(this._sw=new Es(I.lng,I.lat),this._ne=new Es(U.lng,U.lat)),this}getCenter(){return new Es((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Es(this.getWest(),this.getNorth())}getSouthEast(){return new Es(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(l){const{lng:f,lat:w}=Es.convert(l);let I=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(I=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=w&&w<=this._ne.lat&&I}static convert(l){return l instanceof SA?l:l&&new SA(l)}}const Fg=2*Math.PI*Of;function Bd(A){return Fg*Math.cos(A*Math.PI/180)}function i0(A){return(180+A)/360}function Nf(A){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+A*Math.PI/360)))/360}function n0(A,l){return A/Bd(l)}function Sp(A){return 360/Math.PI*Math.atan(Math.exp((180-360*A)*Math.PI/180))-90}class Cd{constructor(l,f,w=0){this.x=+l,this.y=+f,this.z=+w}static fromLngLat(l,f=0){const w=Es.convert(l);return new Cd(i0(w.lng),Nf(w.lat),n0(f,w.lat))}toLngLat(){return new Es(360*this.x-180,Sp(this.y))}toAltitude(){return this.z*Bd(Sp(this.y))}meterInMercatorCoordinateUnits(){return 1/Fg*(l=Sp(this.y),1/Math.cos(l*Math.PI/180));var l}}function Mp(A,l,f){var w=2*Math.PI*6378137/256/Math.pow(2,f);return[A*w-2*Math.PI*6378137/2,l*w-2*Math.PI*6378137/2]}class Lg{constructor(l,f,w){if(l<0||l>25||w<0||w>=Math.pow(2,l)||f<0||f>=Math.pow(2,l))throw new Error(`x=${f}, y=${w}, z=${l} outside of bounds. 0<=x<${Math.pow(2,l)}, 0<=y<${Math.pow(2,l)} 0<=z<=25 `);this.z=l,this.x=f,this.y=w,this.key=Ip(0,l,l,f,w)}equals(l){return this.z===l.z&&this.x===l.x&&this.y===l.y}url(l,f,w){const I=(N=this.y,Z=this.z,re=Mp(256*(U=this.x),256*(N=Math.pow(2,Z)-N-1),Z),ge=Mp(256*(U+1),256*(N+1),Z),re[0]+","+re[1]+","+ge[0]+","+ge[1]);var U,N,Z,re,ge;const Ce=function(Ie,ke,$e){let Ze,Rt="";for(let Mt=Ie;Mt>0;Mt--)Ze=1<<Mt-1,Rt+=(ke&Ze?1:0)+($e&Ze?2:0);return Rt}(this.z,this.x,this.y);return l[(this.x+this.y)%l.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(w==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,f>1?"@2x":"").replace(/{quadkey}/g,Ce).replace(/{bbox-epsg-3857}/g,I)}isChildOf(l){const f=this.z-l.z;return f>0&&l.x===this.x>>f&&l.y===this.y>>f}getTilePoint(l){const f=Math.pow(2,this.z);return new xe((l.x*f-this.x)*Kt,(l.y*f-this.y)*Kt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class r0{constructor(l,f){this.wrap=l,this.canonical=f,this.key=Ip(l,f.z,f.z,f.x,f.y)}}class Bl{constructor(l,f,w,I,U){if(l<w)throw new Error(`overscaledZ should be >= z; overscaledZ = ${l}; z = ${w}`);this.overscaledZ=l,this.wrap=f,this.canonical=new Lg(w,+I,+U),this.key=Ip(f,l,w,I,U)}clone(){return new Bl(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(l){return this.overscaledZ===l.overscaledZ&&this.wrap===l.wrap&&this.canonical.equals(l.canonical)}scaledTo(l){if(l>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-l;return l>this.canonical.z?new Bl(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Bl(l,this.wrap,l,this.canonical.x>>f,this.canonical.y>>f)}calculateScaledKey(l,f){if(l>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);const w=this.canonical.z-l;return l>this.canonical.z?Ip(this.wrap*+f,l,this.canonical.z,this.canonical.x,this.canonical.y):Ip(this.wrap*+f,l,l,this.canonical.x>>w,this.canonical.y>>w)}isChildOf(l){if(l.wrap!==this.wrap)return!1;const f=this.canonical.z-l.canonical.z;return l.overscaledZ===0||l.overscaledZ<this.overscaledZ&&l.canonical.x===this.canonical.x>>f&&l.canonical.y===this.canonical.y>>f}children(l){if(this.overscaledZ>=l)return[new Bl(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const f=this.canonical.z+1,w=2*this.canonical.x,I=2*this.canonical.y;return[new Bl(f,this.wrap,f,w,I),new Bl(f,this.wrap,f,w+1,I),new Bl(f,this.wrap,f,w,I+1),new Bl(f,this.wrap,f,w+1,I+1)]}isLessThan(l){return this.wrap<l.wrap||!(this.wrap>l.wrap)&&(this.overscaledZ<l.overscaledZ||!(this.overscaledZ>l.overscaledZ)&&(this.canonical.x<l.canonical.x||!(this.canonical.x>l.canonical.x)&&this.canonical.y<l.canonical.y))}wrapped(){return new Bl(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(l){return new Bl(this.overscaledZ,l,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new r0(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(l){return this.canonical.getTilePoint(new Cd(l.x-this.wrap,l.y))}}function Ip(A,l,f,w,I){(A*=2)<0&&(A=-1*A-1);const U=1<<f;return(U*U*A+U*I+w).toString(36)+f.toString(36)+l.toString(36)}pn("CanonicalTileID",Lg),pn("OverscaledTileID",Bl,{omit:["posMatrix"]});class s0{constructor(l,f,w){if(this.uid=l,f.height!==f.width)throw new RangeError("DEM tiles must be square");if(w&&w!=="mapbox"&&w!=="terrarium")return void me(`"${w}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=f.height;const I=this.dim=f.height-2;this.data=new Uint32Array(f.data.buffer),this.encoding=w||"mapbox";for(let U=0;U<I;U++)this.data[this._idx(-1,U)]=this.data[this._idx(0,U)],this.data[this._idx(I,U)]=this.data[this._idx(I-1,U)],this.data[this._idx(U,-1)]=this.data[this._idx(U,0)],this.data[this._idx(U,I)]=this.data[this._idx(U,I-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(I,-1)]=this.data[this._idx(I-1,0)],this.data[this._idx(-1,I)]=this.data[this._idx(0,I-1)],this.data[this._idx(I,I)]=this.data[this._idx(I-1,I-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let U=0;U<I;U++)for(let N=0;N<I;N++){const Z=this.get(U,N);Z>this.max&&(this.max=Z),Z<this.min&&(this.min=Z)}}get(l,f){const w=new Uint8Array(this.data.buffer),I=4*this._idx(l,f);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(w[I],w[I+1],w[I+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(l,f){if(l<-1||l>=this.dim+1||f<-1||f>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(f+1)*this.stride+(l+1)}_unpackMapbox(l,f,w){return(256*l*256+256*f+w)/10-1e4}_unpackTerrarium(l,f,w){return 256*l+f+w/256-32768}getPixels(){return new Aa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(l,f,w){if(this.dim!==l.dim)throw new Error("dem dimension mismatch");let I=f*this.dim,U=f*this.dim+this.dim,N=w*this.dim,Z=w*this.dim+this.dim;switch(f){case-1:I=U-1;break;case 1:U=I+1}switch(w){case-1:N=Z-1;break;case 1:Z=N+1}const re=-f*this.dim,ge=-w*this.dim;for(let Ce=N;Ce<Z;Ce++)for(let Ie=I;Ie<U;Ie++)this.data[this._idx(Ie,Ce)]=l.data[this._idx(Ie+re,Ce+ge)]}}pn("DEMData",s0);class o0{constructor(l){this._stringToNumber={},this._numberToString=[];for(let f=0;f<l.length;f++){const w=l[f];this._stringToNumber[w]=f,this._numberToString[f]=w}}encode(l){return this._stringToNumber[l]}decode(l){if(l>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${l} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[l]}}class Fp{constructor(l,f,w,I,U){this.type="Feature",this._vectorTileFeature=l,l._z=f,l._x=w,l._y=I,this.properties=l.properties,this.id=U}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(l){this._geometry=l}toJSON(){const l={geometry:this.geometry};for(const f in this)f!=="_geometry"&&f!=="_vectorTileFeature"&&(l[f]=this[f]);return l}}class a0{constructor(l,f){this.tileID=l,this.x=l.canonical.x,this.y=l.canonical.y,this.z=l.canonical.z,this.grid=new mc(Kt,16,0),this.grid3D=new mc(Kt,16,0),this.featureIndexArray=new ur,this.promoteId=f}insert(l,f,w,I,U,N){const Z=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(w,I,U);const re=N?this.grid3D:this.grid;for(let ge=0;ge<f.length;ge++){const Ce=f[ge],Ie=[1/0,1/0,-1/0,-1/0];for(let ke=0;ke<Ce.length;ke++){const $e=Ce[ke];Ie[0]=Math.min(Ie[0],$e.x),Ie[1]=Math.min(Ie[1],$e.y),Ie[2]=Math.max(Ie[2],$e.x),Ie[3]=Math.max(Ie[3],$e.y)}Ie[0]<Kt&&Ie[1]<Kt&&Ie[2]>=0&&Ie[3]>=0&&re.insert(Z,Ie[0],Ie[1],Ie[2],Ie[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Tu.VectorTile(new Su(this.rawTileData)).layers,this.sourceLayerCoder=new o0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(l,f,w,I){this.loadVTLayers();const U=l.params||{},N=Kt/l.tileSize/l.scale,Z=Ho(U.filter),re=l.queryGeometry,ge=l.queryPadding*N,Ce=MA(re),Ie=this.grid.query(Ce.minX-ge,Ce.minY-ge,Ce.maxX+ge,Ce.maxY+ge),ke=MA(l.cameraQueryGeometry),$e=this.grid3D.query(ke.minX-ge,ke.minY-ge,ke.maxX+ge,ke.maxY+ge,(Mt,ri,mi,ei)=>function(ui,Pi,Fi,Sn,fn){for(const an of ui)if(Pi<=an.x&&Fi<=an.y&&Sn>=an.x&&fn>=an.y)return!0;const mn=[new xe(Pi,Fi),new xe(Pi,fn),new xe(Sn,fn),new xe(Sn,Fi)];if(ui.length>2){for(const an of mn)if(Dr(ui,an))return!0}for(let an=0;an<ui.length-1;an++)if(Or(ui[an],ui[an+1],mn))return!0;return!1}(l.cameraQueryGeometry,Mt-ge,ri-ge,mi+ge,ei+ge));for(const Mt of $e)Ie.push(Mt);Ie.sort(_1);const Ze={};let Rt;for(let Mt=0;Mt<Ie.length;Mt++){const ri=Ie[Mt];if(ri===Rt)continue;Rt=ri;const mi=this.featureIndexArray.get(ri);let ei=null;this.loadMatchingFeature(Ze,mi.bucketIndex,mi.sourceLayerIndex,mi.featureIndex,Z,U.layers,U.availableImages,f,w,I,(ui,Pi,Fi)=>(ei||(ei=Ri(ui)),Pi.queryIntersectsFeature(re,ui,Fi,ei,this.z,l.transform,N,l.pixelPosMatrix)))}return Ze}loadMatchingFeature(l,f,w,I,U,N,Z,re,ge,Ce,Ie){const ke=this.bucketLayerIDs[f];if(N&&!function(Mt,ri){for(let mi=0;mi<Mt.length;mi++)if(ri.indexOf(Mt[mi])>=0)return!0;return!1}(N,ke))return;const $e=this.sourceLayerCoder.decode(w),Ze=this.vtLayers[$e].feature(I);if(U.needGeometry){const Mt=Ai(Ze,!0);if(!U.filter(new Zr(this.tileID.overscaledZ),Mt,this.tileID.canonical))return}else if(!U.filter(new Zr(this.tileID.overscaledZ),Ze))return;const Rt=this.getId(Ze,$e);for(let Mt=0;Mt<ke.length;Mt++){const ri=ke[Mt];if(N&&N.indexOf(ri)<0)continue;const mi=re[ri];if(!mi)continue;let ei={};Rt&&Ce&&(ei=Ce.getState(mi.sourceLayer||"_geojsonTileLayer",Rt));const ui=J({},ge[ri]);ui.paint=Dg(ui.paint,mi.paint,Ze,ei,Z),ui.layout=Dg(ui.layout,mi.layout,Ze,ei,Z);const Pi=!Ie||Ie(Ze,mi,ei);if(!Pi)continue;const Fi=new Fp(Ze,this.z,this.x,this.y,Rt);Fi.layer=ui;let Sn=l[ri];Sn===void 0&&(Sn=l[ri]=[]),Sn.push({featureIndex:I,feature:Fi,intersectionZ:Pi})}}lookupSymbolFeatures(l,f,w,I,U,N,Z,re){const ge={};this.loadVTLayers();const Ce=Ho(U);for(const Ie of l)this.loadMatchingFeature(ge,w,I,Ie,Ce,N,Z,re,f);return ge}hasLayer(l){for(const f of this.bucketLayerIDs)for(const w of f)if(l===w)return!0;return!1}getId(l,f){let w=l.id;return this.promoteId&&(w=l.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[f]],typeof w=="boolean"&&(w=Number(w))),w}}function Dg(A,l,f,w,I){return ae(A,(U,N)=>{const Z=l instanceof Js?l.get(N):null;return Z&&Z.evaluate?Z.evaluate(f,w,I):Z})}function MA(A){let l=1/0,f=1/0,w=-1/0,I=-1/0;for(const U of A)l=Math.min(l,U.x),f=Math.min(f,U.y),w=Math.max(w,U.x),I=Math.max(I,U.y);return{minX:l,minY:f,maxX:w,maxY:I}}function _1(A,l){return l-A}var Pg;pn("FeatureIndex",a0,{omit:["rawTileData","sourceLayerCoder"]}),i.PerformanceMarkers=void 0,(Pg=i.PerformanceMarkers||(i.PerformanceMarkers={})).create="create",Pg.load="load",Pg.fullLoad="fullLoad";let Qf=null,Ed=[];const Vf=1e3/30,y1={mark(A){performance.mark(A)},frame(A){const l=A;Qf!=null&&Ed.push(l-Qf),Qf=l},clearMetrics(){Qf=null,Ed=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const A in i.PerformanceMarkers)performance.clearMarks(i.PerformanceMarkers[A])},getPerformanceMetrics(){performance.measure("loadTime",i.PerformanceMarkers.create,i.PerformanceMarkers.load),performance.measure("fullLoadTime",i.PerformanceMarkers.create,i.PerformanceMarkers.fullLoad);const A=performance.getEntriesByName("loadTime")[0].duration,l=performance.getEntriesByName("fullLoadTime")[0].duration,f=Ed.length,w=1/(Ed.reduce((U,N)=>U+N,0)/f/1e3),I=Ed.filter(U=>U>Vf).reduce((U,N)=>U+(N-Vf)/Vf,0);return{loadTime:A,fullLoadTime:l,fps:w,percentDroppedFrames:I/(f+I)*100}}};i.AJAXError=Ft,i.ARRAY_TYPE=_r,i.Actor=class{constructor(A,l,f){this.target=A,this.parent=l,this.mapId=f,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},B(["receive","process"],this),this.invoker=new Tp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Fe()?A:window}send(A,l,f,w,I=!1){const U=Math.round(1e18*Math.random()).toString(36).substring(0,10);f&&(this.callbacks[U]=f);const N=te(this.globalScope)?void 0:[];return this.target.postMessage({id:U,type:A,hasCallback:!!f,targetMapId:w,mustQueue:I,sourceMapId:this.mapId,data:Wl(l,N)},N),{cancel:()=>{f&&delete this.callbacks[U],this.target.postMessage({id:U,type:"<cancel>",targetMapId:w,sourceMapId:this.mapId})}}}receive(A){const l=A.data,f=l.id;if(f&&(!l.targetMapId||this.mapId===l.targetMapId))if(l.type==="<cancel>"){delete this.tasks[f];const w=this.cancelCallbacks[f];delete this.cancelCallbacks[f],w&&w()}else Fe()||l.mustQueue?(this.tasks[f]=l,this.taskQueue.push(f),this.invoker.trigger()):this.processTask(f,l)}process(){if(!this.taskQueue.length)return;const A=this.taskQueue.shift(),l=this.tasks[A];delete this.tasks[A],this.taskQueue.length&&this.invoker.trigger(),l&&this.processTask(A,l)}processTask(A,l){if(l.type==="<response>"){const f=this.callbacks[A];delete this.callbacks[A],f&&(l.error?f(Os(l.error)):f(null,Os(l.data)))}else{let f=!1;const w=te(this.globalScope)?void 0:[],I=l.hasCallback?(Z,re)=>{f=!0,delete this.cancelCallbacks[A],this.target.postMessage({id:A,type:"<response>",sourceMapId:this.mapId,error:Z?Wl(Z):null,data:Wl(re,w)},w)}:Z=>{f=!0};let U=null;const N=Os(l.data);if(this.parent[l.type])U=this.parent[l.type](l.sourceMapId,N,I);else if(this.parent.getWorkerSource){const Z=l.type.split(".");U=this.parent.getWorkerSource(l.sourceMapId,Z[0],N.source)[Z[1]](N,I)}else I(new Error(`Could not find function ${l.type}`));!f&&U&&U.cancel&&(this.cancelCallbacks[A]=U.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.AlphaImage=Xh,i.CanonicalTileID=Lg,i.CollisionBoxArray=Ei,i.CollisionCircleLayoutArray=class extends Te{},i.Color=de,i.DEMData=s0,i.DataConstantProperty=Fn,i.DictionaryCoder=o0,i.EXTENT=Kt,i.ErrorEvent=qi,i.EvaluationParameters=Zr,i.Event=Ni,i.Evented=en,i.FeatureIndex=a0,i.FillBucket=cg,i.FillExtrusionBucket=Mf,i.GeoJSONFeature=Fp,i.ImageAtlas=fd,i.ImagePosition=EA,i.LineBucket=gp,i.LineStripIndexArray=class extends St{},i.LngLat=Es,i.LngLatBounds=SA,i.MercatorCoordinate=Cd,i.ONE_EM=yo,i.OverscaledTileID=Bl,i.PerformanceUtils=y1,i.PosArray=Un,i.Properties=Cs,i.QuadTriangleArray=class extends je{},i.RGBAImage=Aa,i.RasterBoundsArray=class extends M{},i.RequestPerformance=class{constructor(A){this._marks={start:[A.url,"start"].join("#"),end:[A.url,"end"].join("#"),measure:A.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let A=performance.getEntriesByName(this._marks.measure);return A.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),A=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),A}},i.ResourceType=Ct,i.SegmentVector=a,i.SymbolBucket=Bc,i.Transitionable=xc,i.TriangleIndexArray=mo,i.Uniform1f=it,i.Uniform1i=class extends st{constructor(A,l){super(A,l),this.current=0}set(A){this.current!==A&&(this.current=A,this.gl.uniform1i(this.location,A))}},i.Uniform2f=class extends st{constructor(A,l){super(A,l),this.current=[0,0]}set(A){A[0]===this.current[0]&&A[1]===this.current[1]||(this.current=A,this.gl.uniform2f(this.location,A[0],A[1]))}},i.Uniform3f=class extends st{constructor(A,l){super(A,l),this.current=[0,0,0]}set(A){A[0]===this.current[0]&&A[1]===this.current[1]&&A[2]===this.current[2]||(this.current=A,this.gl.uniform3f(this.location,A[0],A[1],A[2]))}},i.Uniform4f=lt,i.UniformColor=qe,i.UniformMatrix4f=class extends st{constructor(A,l){super(A,l),this.current=Ye}set(A){if(A[12]!==this.current[12]||A[0]!==this.current[0])return this.current=A,void this.gl.uniformMatrix4fv(this.location,!1,A);for(let l=1;l<16;l++)if(A[l]!==this.current[l]){this.current=A,this.gl.uniformMatrix4fv(this.location,!1,A);break}}},i.UnwrappedTileID=r0,i.ValidationError=at,i.ZoomHistory=gl,i.add=function(A,l,f){return A[0]=l[0]+f[0],A[1]=l[1]+f[1],A[2]=l[2]+f[2],A},i.addDynamicAttributes=Mg,i.asyncAll=function(A,l,f){if(!A.length)return f(null,[]);let w=A.length;const I=new Array(A.length);let U=null;A.forEach((N,Z)=>{l(N,(re,ge)=>{re&&(U=re),I[Z]=ge,--w==0&&f(U,I)})})},i.bezier=R,i.bindAll=B,i.cacheEntryPossiblyAdded=function(A){vt++,vt>Ke&&(A.getActor().send("enforceCacheSizeLimit",Se),vt=0)},i.clamp=z,i.clearTileCache=function(A){const l=caches.delete(We);A&&l.catch(A).then(()=>A())},i.clipLine=Xy,i.clone=function(A){var l=new _r(16);return l[0]=A[0],l[1]=A[1],l[2]=A[2],l[3]=A[3],l[4]=A[4],l[5]=A[5],l[6]=A[6],l[7]=A[7],l[8]=A[8],l[9]=A[9],l[10]=A[10],l[11]=A[11],l[12]=A[12],l[13]=A[13],l[14]=A[14],l[15]=A[15],l},i.clone$1=Ae,i.clone$2=function(A){var l=new _r(3);return l[0]=A[0],l[1]=A[1],l[2]=A[2],l},i.collisionCircleLayout=Hy,i.config=Oe,i.copy=function(A,l){return A[0]=l[0],A[1]=l[1],A[2]=l[2],A[3]=l[3],A[4]=l[4],A[5]=l[5],A[6]=l[6],A[7]=l[7],A[8]=l[8],A[9]=l[9],A[10]=l[10],A[11]=l[11],A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15],A},i.create=function(){var A=new _r(16);return _r!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[11]=0,A[12]=0,A[13]=0,A[14]=0),A[0]=1,A[5]=1,A[10]=1,A[15]=1,A},i.create$1=Xr,i.createExpression=Hc,i.createFilter=Ho,i.createLayout=Is,i.createStyleLayer=function(A){return A.type==="custom"?new e0(A):new t0[A.type](A)},i.cross=function(A,l,f){var w=l[0],I=l[1],U=l[2],N=f[0],Z=f[1],re=f[2];return A[0]=I*re-U*Z,A[1]=U*N-w*re,A[2]=w*Z-I*N,A},i.dot=function(A,l){return A[0]*l[0]+A[1]*l[1]+A[2]*l[2]},i.dot$1=function(A,l){return A[0]*l[0]+A[1]*l[1]+A[2]*l[2]+A[3]*l[3]},i.ease=Q,i.emitValidationErrors=Nh,i.enforceCacheSizeLimit=function(A){nt(),Ve&&Ve.then(l=>{l.keys().then(f=>{for(let w=0;w<f.length-A;w++)l.delete(f[w])})})},i.equals=function(A,l){var f=A[0],w=A[1],I=A[2],U=A[3],N=A[4],Z=A[5],re=A[6],ge=A[7],Ce=A[8],Ie=A[9],ke=A[10],$e=A[11],Ze=A[12],Rt=A[13],Mt=A[14],ri=A[15],mi=l[0],ei=l[1],ui=l[2],Pi=l[3],Fi=l[4],Sn=l[5],fn=l[6],mn=l[7],an=l[8],nn=l[9],vn=l[10],gn=l[11],Ji=l[12],Wn=l[13],zn=l[14],yr=l[15];return Math.abs(f-mi)<=vs*Math.max(1,Math.abs(f),Math.abs(mi))&&Math.abs(w-ei)<=vs*Math.max(1,Math.abs(w),Math.abs(ei))&&Math.abs(I-ui)<=vs*Math.max(1,Math.abs(I),Math.abs(ui))&&Math.abs(U-Pi)<=vs*Math.max(1,Math.abs(U),Math.abs(Pi))&&Math.abs(N-Fi)<=vs*Math.max(1,Math.abs(N),Math.abs(Fi))&&Math.abs(Z-Sn)<=vs*Math.max(1,Math.abs(Z),Math.abs(Sn))&&Math.abs(re-fn)<=vs*Math.max(1,Math.abs(re),Math.abs(fn))&&Math.abs(ge-mn)<=vs*Math.max(1,Math.abs(ge),Math.abs(mn))&&Math.abs(Ce-an)<=vs*Math.max(1,Math.abs(Ce),Math.abs(an))&&Math.abs(Ie-nn)<=vs*Math.max(1,Math.abs(Ie),Math.abs(nn))&&Math.abs(ke-vn)<=vs*Math.max(1,Math.abs(ke),Math.abs(vn))&&Math.abs($e-gn)<=vs*Math.max(1,Math.abs($e),Math.abs(gn))&&Math.abs(Ze-Ji)<=vs*Math.max(1,Math.abs(Ze),Math.abs(Ji))&&Math.abs(Rt-Wn)<=vs*Math.max(1,Math.abs(Rt),Math.abs(Wn))&&Math.abs(Mt-zn)<=vs*Math.max(1,Math.abs(Mt),Math.abs(zn))&&Math.abs(ri-yr)<=vs*Math.max(1,Math.abs(ri),Math.abs(yr))},i.evaluateSizeForFeature=function(A,{uSize:l,uSizeT:f},{lowerSize:w,upperSize:I}){return A.kind==="source"?w/uh:A.kind==="composite"?is(w/uh,I/uh,f):l},i.evaluateSizeForZoom=function(A,l){let f=0,w=0;if(A.kind==="constant")w=A.layoutSize;else if(A.kind!=="source"){const{interpolationType:I,minZoom:U,maxZoom:N}=A,Z=I?z(Vo.interpolationFactor(I,l,U,N),0,1):0;A.kind==="camera"?w=is(A.minSize,A.maxSize,Z):f=Z}return{uSizeT:f,uSize:w}},i.evaluateVariableOffset=xd,i.evented=Kl,i.exported=ye,i.exported$1=be,i.extend=J,i.filterObject=ce,i.fromRotation=function(A,l){var f=Math.sin(l),w=Math.cos(l);return A[0]=w,A[1]=f,A[2]=0,A[3]=-f,A[4]=w,A[5]=0,A[6]=0,A[7]=0,A[8]=1,A},i.fromScaling=function(A,l){return A[0]=l[0],A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=l[1],A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[10]=l[2],A[11]=0,A[12]=0,A[13]=0,A[14]=0,A[15]=1,A},i.getAnchorAlignment=Df,i.getAnchorJustification=vd,i.getArrayBuffer=Gi,i.getImage=yt,i.getJSON=function(A,l){return fi(J(A,{type:"json"}),l)},i.getOverlapMode=bd,i.getRTLTextPluginStatus=_l,i.getReferrer=Xt,i.getVideo=function(A,l){const f=window.document.createElement("video");f.muted=!0,f.onloadstart=function(){l(null,f)};for(let w=0;w<A.length;w++){const I=window.document.createElement("source");wn(A[w])||(f.crossOrigin="Anonymous"),I.src=A[w],f.appendChild(I)}return{cancel:()=>{}}},i.identity=Fr,i.invert=function(A,l){var f=l[0],w=l[1],I=l[2],U=l[3],N=l[4],Z=l[5],re=l[6],ge=l[7],Ce=l[8],Ie=l[9],ke=l[10],$e=l[11],Ze=l[12],Rt=l[13],Mt=l[14],ri=l[15],mi=f*Z-w*N,ei=f*re-I*N,ui=f*ge-U*N,Pi=w*re-I*Z,Fi=w*ge-U*Z,Sn=I*ge-U*re,fn=Ce*Rt-Ie*Ze,mn=Ce*Mt-ke*Ze,an=Ce*ri-$e*Ze,nn=Ie*Mt-ke*Rt,vn=Ie*ri-$e*Rt,gn=ke*ri-$e*Mt,Ji=mi*gn-ei*vn+ui*nn+Pi*an-Fi*mn+Sn*fn;return Ji?(A[0]=(Z*gn-re*vn+ge*nn)*(Ji=1/Ji),A[1]=(I*vn-w*gn-U*nn)*Ji,A[2]=(Rt*Sn-Mt*Fi+ri*Pi)*Ji,A[3]=(ke*Fi-Ie*Sn-$e*Pi)*Ji,A[4]=(re*an-N*gn-ge*mn)*Ji,A[5]=(f*gn-I*an+U*mn)*Ji,A[6]=(Mt*ui-Ze*Sn-ri*ei)*Ji,A[7]=(Ce*Sn-ke*ui+$e*ei)*Ji,A[8]=(N*vn-Z*an+ge*fn)*Ji,A[9]=(w*an-f*vn-U*fn)*Ji,A[10]=(Ze*Fi-Rt*ui+ri*mi)*Ji,A[11]=(Ie*ui-Ce*Fi-$e*mi)*Ji,A[12]=(Z*mn-N*nn-re*fn)*Ji,A[13]=(f*nn-w*mn+I*fn)*Ji,A[14]=(Rt*ei-Ze*Pi-Mt*mi)*Ji,A[15]=(Ce*Pi-Ie*ei+ke*mi)*Ji,A):null},i.isImageBitmap=le,i.isSafari=te,i.isWorker=Fe,i.keysDifference=function(A,l){const f=[];for(const w in A)w in l||f.push(w);return f},i.lazyLoadRTLTextPlugin=function(){xs.isLoading()||xs.isLoaded()||_l()!=="deferred"||An()},i.makeRequest=fi,i.mapObject=ae,i.mercatorXfromLng=i0,i.mercatorYfromLat=Nf,i.mercatorZfromAltitude=n0,i.mul=ns,i.mul$1=function(A,l,f){return A[0]=l[0]*f[0],A[1]=l[1]*f[1],A[2]=l[2]*f[2],A[3]=l[3]*f[3],A},i.multiply=Fs,i.nextPowerOfTwo=function(A){return A<=1?1:Math.pow(2,Math.ceil(Math.log(A)/Math.LN2))},i.normalize=function(A,l){var f=l[0],w=l[1],I=l[2],U=f*f+w*w+I*I;return U>0&&(U=1/Math.sqrt(U)),A[0]=l[0]*U,A[1]=l[1]*U,A[2]=l[2]*U,A},i.number=is,i.ortho=function(A,l,f,w,I,U,N){var Z=1/(l-f),re=1/(w-I),ge=1/(U-N);return A[0]=-2*Z,A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=-2*re,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[10]=2*ge,A[11]=0,A[12]=(l+f)*Z,A[13]=(I+w)*re,A[14]=(N+U)*ge,A[15]=1,A},i.parseCacheControl=Ge,i.parseGlyphPbf=function(A){return new Su(A).readFields(pd,[])},i.pbf=Su,i.performSymbolLayout=function(A){A.bucket.createArrays(),A.bucket.tilePixelRatio=Kt/(512*A.bucket.overscaling),A.bucket.compareText={},A.bucket.iconsNeedLinear=!1;const l=A.bucket.layers[0].layout,f=A.bucket.layers[0]._unevaluatedLayout._values,w={layoutIconSize:f["icon-size"].possiblyEvaluate(new Zr(A.bucket.zoom+1),A.canonical),layoutTextSize:f["text-size"].possiblyEvaluate(new Zr(A.bucket.zoom+1),A.canonical),textMaxSize:f["text-size"].possiblyEvaluate(new Zr(18))};if(A.bucket.textSizeData.kind==="composite"){const{minZoom:re,maxZoom:ge}=A.bucket.textSizeData;w.compositeTextSizes=[f["text-size"].possiblyEvaluate(new Zr(re),A.canonical),f["text-size"].possiblyEvaluate(new Zr(ge),A.canonical)]}if(A.bucket.iconSizeData.kind==="composite"){const{minZoom:re,maxZoom:ge}=A.bucket.iconSizeData;w.compositeIconSizes=[f["icon-size"].possiblyEvaluate(new Zr(re),A.canonical),f["icon-size"].possiblyEvaluate(new Zr(ge),A.canonical)]}const I=l.get("text-line-height")*yo,U=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point",N=l.get("text-keep-upright"),Z=l.get("text-size");for(const re of A.bucket.features){const ge=l.get("text-font").evaluate(re,{},A.canonical).join(","),Ce=Z.evaluate(re,{},A.canonical),Ie=w.layoutTextSize.evaluate(re,{},A.canonical),ke=w.layoutIconSize.evaluate(re,{},A.canonical),$e={horizontal:{},vertical:void 0},Ze=re.text;let Rt,Mt=[0,0];if(Ze){const ei=Ze.toString(),ui=l.get("text-letter-spacing").evaluate(re,{},A.canonical)*yo,Pi=Ur(ei)?ui:0,Fi=l.get("text-anchor").evaluate(re,{},A.canonical),Sn=l.get("text-variable-anchor");if(!Sn){const vn=l.get("text-radial-offset").evaluate(re,{},A.canonical);Mt=vn?xd(Fi,[vn*yo,Sg]):l.get("text-offset").evaluate(re,{},A.canonical).map(gn=>gn*yo)}let fn=U?"center":l.get("text-justify").evaluate(re,{},A.canonical);const mn=l.get("symbol-placement"),an=mn==="point"?l.get("text-max-width").evaluate(re,{},A.canonical)*yo:0,nn=()=>{A.bucket.allowVerticalPlacement&&th(ei)&&($e.vertical=Ma(Ze,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,Fi,"left",Pi,Mt,i.WritingMode.vertical,!0,mn,Ie,Ce))};if(!U&&Sn){const vn=fn==="auto"?Sn.map(Ji=>vd(Ji)):[fn];let gn=!1;for(let Ji=0;Ji<vn.length;Ji++){const Wn=vn[Ji];if(!$e.horizontal[Wn])if(gn)$e.horizontal[Wn]=$e.horizontal[0];else{const zn=Ma(Ze,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,"center",Wn,Pi,Mt,i.WritingMode.horizontal,!1,mn,Ie,Ce);zn&&($e.horizontal[Wn]=zn,gn=zn.positionedLines.length===1)}}nn()}else{fn==="auto"&&(fn=vd(Fi));const vn=Ma(Ze,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,Fi,fn,Pi,Mt,i.WritingMode.horizontal,!1,mn,Ie,Ce);vn&&($e.horizontal[fn]=vn),nn(),th(ei)&&U&&N&&($e.vertical=Ma(Ze,A.glyphMap,A.glyphPositions,A.imagePositions,ge,an,I,Fi,fn,Pi,Mt,i.WritingMode.vertical,!1,mn,Ie,Ce))}}let ri=!1;if(re.icon&&re.icon.name){const ei=A.imageMap[re.icon.name];ei&&(Rt=$y(A.imagePositions[re.icon.name],l.get("icon-offset").evaluate(re,{},A.canonical),l.get("icon-anchor").evaluate(re,{},A.canonical)),ri=!!ei.sdf,A.bucket.sdfIcons===void 0?A.bucket.sdfIcons=ri:A.bucket.sdfIcons!==ri&&me("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ei.pixelRatio!==A.bucket.pixelRatio||l.get("icon-rotate").constantOr(1)!==0)&&(A.bucket.iconsNeedLinear=!0))}const mi=Jy($e.horizontal)||$e.vertical;A.bucket.iconsInText=!!mi&&mi.iconsInText,(mi||Rt)&&Yy(A.bucket,re,$e,Rt,A.imageMap,w,Ie,ke,Mt,ri,A.canonical)}A.showCollisionBoxes&&A.bucket.generateCollisionDebugBuffers()},i.perspective=function(A,l,f,w,I){var U,N=1/Math.tan(l/2);return A[0]=N/f,A[1]=0,A[2]=0,A[3]=0,A[4]=0,A[5]=N,A[6]=0,A[7]=0,A[8]=0,A[9]=0,A[11]=-1,A[12]=0,A[13]=0,A[15]=0,I!=null&&I!==1/0?(A[10]=(I+w)*(U=1/(w-I)),A[14]=2*I*w*U):(A[10]=-1,A[14]=-2*w),A},i.pick=function(A,l){const f={};for(let w=0;w<l.length;w++){const I=l[w];I in A&&(f[I]=A[I])}return f},i.plugin=xs,i.pointGeometry=xe,i.polygonIntersectsPolygon=Jt,i.potpack=vg,i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.register=pn,i.registerForPluginStateChange=function(A){return A({pluginStatus:Ms,pluginURL:fo}),Kl.on("pluginStateChange",A),A},i.renderColorRamp=rg,i.rotateX=function(A,l,f){var w=Math.sin(f),I=Math.cos(f),U=l[4],N=l[5],Z=l[6],re=l[7],ge=l[8],Ce=l[9],Ie=l[10],ke=l[11];return l!==A&&(A[0]=l[0],A[1]=l[1],A[2]=l[2],A[3]=l[3],A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15]),A[4]=U*I+ge*w,A[5]=N*I+Ce*w,A[6]=Z*I+Ie*w,A[7]=re*I+ke*w,A[8]=ge*I-U*w,A[9]=Ce*I-N*w,A[10]=Ie*I-Z*w,A[11]=ke*I-re*w,A},i.rotateZ=function(A,l,f){var w=Math.sin(f),I=Math.cos(f),U=l[0],N=l[1],Z=l[2],re=l[3],ge=l[4],Ce=l[5],Ie=l[6],ke=l[7];return l!==A&&(A[8]=l[8],A[9]=l[9],A[10]=l[10],A[11]=l[11],A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15]),A[0]=U*I+ge*w,A[1]=N*I+Ce*w,A[2]=Z*I+Ie*w,A[3]=re*I+ke*w,A[4]=ge*I-U*w,A[5]=Ce*I-N*w,A[6]=Ie*I-Z*w,A[7]=ke*I-re*w,A},i.scale=function(A,l,f){var w=f[0],I=f[1],U=f[2];return A[0]=l[0]*w,A[1]=l[1]*w,A[2]=l[2]*w,A[3]=l[3]*w,A[4]=l[4]*I,A[5]=l[5]*I,A[6]=l[6]*I,A[7]=l[7]*I,A[8]=l[8]*U,A[9]=l[9]*U,A[10]=l[10]*U,A[11]=l[11]*U,A[12]=l[12],A[13]=l[13],A[14]=l[14],A[15]=l[15],A},i.scale$1=function(A,l,f){return A[0]=l[0]*f,A[1]=l[1]*f,A[2]=l[2]*f,A},i.setCacheLimits=function(A,l){Se=A,Ke=l},i.setRTLTextPlugin=function(A,l,f=!1){if(Ms===Vh||Ms===Hh||Ms===ih)throw new Error("setRTLTextPlugin cannot be called multiple times.");fo=ye.resolveURL(A),Ms=Vh,yc=l,jl(),f||An()},i.spec=$t,i.sphericalToCartesian=function([A,l,f]){return l+=90,l*=Math.PI/180,f*=Math.PI/180,{x:A*Math.cos(l)*Math.sin(f),y:A*Math.sin(l)*Math.sin(f),z:A*Math.cos(f)}},i.sqrLen=function(A){var l=A[0],f=A[1];return l*l+f*f},i.sub=function(A,l,f){return A[0]=l[0]-f[0],A[1]=l[1]-f[1],A[2]=l[2]-f[2],A},i.toEvaluationFeature=Ai,i.transformMat3=function(A,l,f){var w=l[0],I=l[1],U=l[2];return A[0]=w*f[0]+I*f[3]+U*f[6],A[1]=w*f[1]+I*f[4]+U*f[7],A[2]=w*f[2]+I*f[5]+U*f[8],A},i.transformMat4=ja,i.transformMat4$1=function(A,l,f){var w=l[0],I=l[1];return A[0]=f[0]*w+f[4]*I+f[12],A[1]=f[1]*w+f[5]*I+f[13],A},i.translate=function(A,l,f){var w,I,U,N,Z,re,ge,Ce,Ie,ke,$e,Ze,Rt=f[0],Mt=f[1],ri=f[2];return l===A?(A[12]=l[0]*Rt+l[4]*Mt+l[8]*ri+l[12],A[13]=l[1]*Rt+l[5]*Mt+l[9]*ri+l[13],A[14]=l[2]*Rt+l[6]*Mt+l[10]*ri+l[14],A[15]=l[3]*Rt+l[7]*Mt+l[11]*ri+l[15]):(I=l[1],U=l[2],N=l[3],Z=l[4],re=l[5],ge=l[6],Ce=l[7],Ie=l[8],ke=l[9],$e=l[10],Ze=l[11],A[0]=w=l[0],A[1]=I,A[2]=U,A[3]=N,A[4]=Z,A[5]=re,A[6]=ge,A[7]=Ce,A[8]=Ie,A[9]=ke,A[10]=$e,A[11]=Ze,A[12]=w*Rt+Z*Mt+Ie*ri+l[12],A[13]=I*Rt+re*Mt+ke*ri+l[13],A[14]=U*Rt+ge*Mt+$e*ri+l[14],A[15]=N*Rt+Ce*Mt+Ze*ri+l[15]),A},i.triggerPluginCompletionEvent=Gh,i.unicodeBlockLookup=un,i.uniqueId=function(){return Y++},i.validateCustomStyleLayer=function(A){const l=[],f=A.id;return f===void 0&&l.push({message:`layers.${f}: missing required property "id"`}),A.render===void 0&&l.push({message:`layers.${f}: missing required method "render"`}),A.renderingMode&&A.renderingMode!=="2d"&&A.renderingMode!=="3d"&&l.push({message:`layers.${f}: property "renderingMode" must be either "2d" or "3d"`}),l},i.validateLight=Oh,i.validateStyle=kh,i.vectorTile=Tu,i.warnOnce=me,i.wrap=G}),p(["./shared"],function(i){function C(X){const j=typeof X;if(j==="number"||j==="boolean"||j==="string"||X==null)return JSON.stringify(X);if(Array.isArray(X)){let de="[";for(const Ue of X)de+=`${C(Ue)},`;return`${de}]`}const ie=Object.keys(X).sort();let ne="{";for(let de=0;de<ie.length;de++)ne+=`${JSON.stringify(ie[de])}:${C(X[ie[de]])},`;return`${ne}}`}function D(X){let j="";for(const ie of i.refProperties)j+=`/${C(X[ie])}`;return j}class R{constructor(j){this.keyCache={},j&&this.replace(j)}replace(j){this._layerConfigs={},this._layers={},this.update(j,[])}update(j,ie){for(const de of j){this._layerConfigs[de.id]=de;const Ue=this._layers[de.id]=i.createStyleLayer(de);Ue._featureFilter=i.createFilter(Ue.filter),this.keyCache[de.id]&&delete this.keyCache[de.id]}for(const de of ie)delete this.keyCache[de],delete this._layerConfigs[de],delete this._layers[de];this.familiesBySource={};const ne=function(de,Ue){const tt={};for(let et=0;et<de.length;et++){const pt=Ue&&Ue[de[et].id]||D(de[et]);Ue&&(Ue[de[et].id]=pt);let Lt=tt[pt];Lt||(Lt=tt[pt]=[]),Lt.push(de[et])}const He=[];for(const et in tt)He.push(tt[et]);return He}(Object.values(this._layerConfigs),this.keyCache);for(const de of ne){const Ue=de.map(jt=>this._layers[jt.id]),tt=Ue[0];if(tt.visibility==="none")continue;const He=tt.source||"";let et=this.familiesBySource[He];et||(et=this.familiesBySource[He]={});const pt=tt.sourceLayer||"_geojsonTileLayer";let Lt=et[pt];Lt||(Lt=et[pt]=[]),Lt.push(Ue)}}}class Q{constructor(j){const ie={},ne=[];for(const He in j){const et=j[He],pt=ie[He]={};for(const Lt in et){const jt=et[+Lt];if(!jt||jt.bitmap.width===0||jt.bitmap.height===0)continue;const Wt={x:0,y:0,w:jt.bitmap.width+2,h:jt.bitmap.height+2};ne.push(Wt),pt[Lt]={rect:Wt,metrics:jt.metrics}}}const{w:de,h:Ue}=i.potpack(ne),tt=new i.AlphaImage({width:de||1,height:Ue||1});for(const He in j){const et=j[He];for(const pt in et){const Lt=et[+pt];if(!Lt||Lt.bitmap.width===0||Lt.bitmap.height===0)continue;const jt=ie[He][pt].rect;i.AlphaImage.copy(Lt.bitmap,tt,{x:0,y:0},{x:jt.x+1,y:jt.y+1},Lt.bitmap)}}this.image=tt,this.positions=ie}}i.register("GlyphAtlas",Q);class z{constructor(j){this.tileID=new i.OverscaledTileID(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.uid=j.uid,this.zoom=j.zoom,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=j.showCollisionBoxes,this.collectResourceTiming=!!j.collectResourceTiming,this.returnDependencies=!!j.returnDependencies,this.promoteId=j.promoteId}parse(j,ie,ne,de,Ue){this.status="parsing",this.data=j,this.collisionBoxArray=new i.CollisionBoxArray;const tt=new i.DictionaryCoder(Object.keys(j.layers).sort()),He=new i.FeatureIndex(this.tileID,this.promoteId);He.bucketLayerIDs=[];const et={},pt={featureIndex:He,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ne},Lt=ie.familiesBySource[this.source];for(const yn in Lt){const Yt=j.layers[yn];if(!Yt)continue;Yt.version===1&&i.warnOnce(`Vector tile source "${this.source}" layer "${yn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const sr=tt.encode(yn),Yn=[];for(let Wr=0;Wr<Yt.length;Wr++){const mr=Yt.feature(Wr),Mr=He.getId(mr,yn);Yn.push({feature:mr,id:Mr,index:Wr,sourceLayerIndex:sr})}for(const Wr of Lt[yn]){const mr=Wr[0];mr.source!==this.source&&i.warnOnce(`layer.source = ${mr.source} does not equal this.source = ${this.source}`),mr.minzoom&&this.zoom<Math.floor(mr.minzoom)||mr.maxzoom&&this.zoom>=mr.maxzoom||mr.visibility!=="none"&&(G(Wr,this.zoom,ne),(et[mr.id]=mr.createBucket({index:He.bucketLayerIDs.length,layers:Wr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:sr,sourceID:this.source})).populate(Yn,pt,this.tileID.canonical),He.bucketLayerIDs.push(Wr.map(Mr=>Mr.id)))}}let jt,Wt,ki,bi;const Oi=i.mapObject(pt.glyphDependencies,yn=>Object.keys(yn).map(Number));Object.keys(Oi).length?de.send("getGlyphs",{uid:this.uid,stacks:Oi},(yn,Yt)=>{jt||(jt=yn,Wt=Yt,rr.call(this))}):Wt={};const Yi=Object.keys(pt.iconDependencies);Yi.length?de.send("getImages",{icons:Yi,source:this.source,tileID:this.tileID,type:"icons"},(yn,Yt)=>{jt||(jt=yn,ki=Yt,rr.call(this))}):ki={};const tn=Object.keys(pt.patternDependencies);function rr(){if(jt)return Ue(jt);if(Wt&&ki&&bi){const yn=new Q(Wt),Yt=new i.ImageAtlas(ki,bi);for(const sr in et){const Yn=et[sr];Yn instanceof i.SymbolBucket?(G(Yn.layers,this.zoom,ne),i.performSymbolLayout({bucket:Yn,glyphMap:Wt,glyphPositions:yn.positions,imageMap:ki,imagePositions:Yt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Yn.hasPattern&&(Yn instanceof i.LineBucket||Yn instanceof i.FillBucket||Yn instanceof i.FillExtrusionBucket)&&(G(Yn.layers,this.zoom,ne),Yn.addFeatures(pt,this.tileID.canonical,Yt.patternPositions))}this.status="done",Ue(null,{buckets:Object.values(et).filter(sr=>!sr.isEmpty()),featureIndex:He,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:yn.image,imageAtlas:Yt,glyphMap:this.returnDependencies?Wt:null,iconMap:this.returnDependencies?ki:null,glyphPositions:this.returnDependencies?yn.positions:null})}}tn.length?de.send("getImages",{icons:tn,source:this.source,tileID:this.tileID,type:"patterns"},(yn,Yt)=>{jt||(jt=yn,bi=Yt,rr.call(this))}):bi={},rr.call(this)}}function G(X,j,ie){const ne=new i.EvaluationParameters(j);for(const de of X)de.recalculate(ne,ie)}function J(X,j){const ie=i.getArrayBuffer(X.request,(ne,de,Ue,tt)=>{ne?j(ne):de&&j(null,{vectorTile:new i.vectorTile.VectorTile(new i.pbf(de)),rawData:de,cacheControl:Ue,expires:tt})});return()=>{ie.cancel(),j()}}class Y{constructor(j,ie,ne,de){this.actor=j,this.layerIndex=ie,this.availableImages=ne,this.loadVectorData=de||J,this.loading={},this.loaded={}}loadTile(j,ie){const ne=j.uid;this.loading||(this.loading={});const de=!!(j&&j.request&&j.request.collectResourceTiming)&&new i.RequestPerformance(j.request),Ue=this.loading[ne]=new z(j);Ue.abort=this.loadVectorData(j,(tt,He)=>{if(delete this.loading[ne],tt||!He)return Ue.status="done",this.loaded[ne]=Ue,ie(tt);const et=He.rawData,pt={};He.expires&&(pt.expires=He.expires),He.cacheControl&&(pt.cacheControl=He.cacheControl);const Lt={};if(de){const jt=de.finish();jt&&(Lt.resourceTiming=JSON.parse(JSON.stringify(jt)))}Ue.vectorTile=He.vectorTile,Ue.parse(He.vectorTile,this.layerIndex,this.availableImages,this.actor,(jt,Wt)=>{if(jt||!Wt)return ie(jt);ie(null,i.extend({rawTileData:et.slice(0)},Wt,pt,Lt))}),this.loaded=this.loaded||{},this.loaded[ne]=Ue})}reloadTile(j,ie){const ne=this.loaded,de=j.uid,Ue=this;if(ne&&ne[de]){const tt=ne[de];tt.showCollisionBoxes=j.showCollisionBoxes;const He=(et,pt)=>{const Lt=tt.reloadCallback;Lt&&(delete tt.reloadCallback,tt.parse(tt.vectorTile,Ue.layerIndex,this.availableImages,Ue.actor,Lt)),ie(et,pt)};tt.status==="parsing"?tt.reloadCallback=He:tt.status==="done"&&(tt.vectorTile?tt.parse(tt.vectorTile,this.layerIndex,this.availableImages,this.actor,He):He())}}abortTile(j,ie){const ne=this.loading,de=j.uid;ne&&ne[de]&&ne[de].abort&&(ne[de].abort(),delete ne[de]),ie()}removeTile(j,ie){const ne=this.loaded,de=j.uid;ne&&ne[de]&&delete ne[de],ie()}}class B{constructor(){this.loaded={}}loadTile(j,ie){const{uid:ne,encoding:de,rawImageData:Ue}=j,tt=i.isImageBitmap(Ue)?this.getImageData(Ue):Ue,He=new i.DEMData(ne,tt,de);this.loaded=this.loaded||{},this.loaded[ne]=He,ie(null,He)}getImageData(j){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(j.width,j.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=j.width,this.offscreenCanvas.height=j.height,this.offscreenCanvasContext.drawImage(j,0,0,j.width,j.height);const ie=this.offscreenCanvasContext.getImageData(-1,-1,j.width+2,j.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:ie.width,height:ie.height},ie.data)}removeTile(j){const ie=this.loaded,ne=j.uid;ie&&ie[ne]&&delete ie[ne]}}var ae=function X(j,ie){var ne,de=j&&j.type;if(de==="FeatureCollection")for(ne=0;ne<j.features.length;ne++)X(j.features[ne],ie);else if(de==="GeometryCollection")for(ne=0;ne<j.geometries.length;ne++)X(j.geometries[ne],ie);else if(de==="Feature")X(j.geometry,ie);else if(de==="Polygon")ce(j.coordinates,ie);else if(de==="MultiPolygon")for(ne=0;ne<j.coordinates.length;ne++)ce(j.coordinates[ne],ie);return j};function ce(X,j){if(X.length!==0){Ae(X[0],j);for(var ie=1;ie<X.length;ie++)Ae(X[ie],!j)}}function Ae(X,j){for(var ie=0,ne=0,de=0,Ue=X.length,tt=Ue-1;de<Ue;tt=de++){var He=(X[de][0]-X[tt][0])*(X[tt][1]+X[de][1]),et=ie+He;ne+=Math.abs(ie)>=Math.abs(He)?ie-et+He:He-et+ie,ie=et}ie+ne>=0!=!!j&&X.reverse()}const we=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class me{constructor(j){this._feature=j,this.extent=i.EXTENT,this.type=j.type,this.properties=j.tags,"id"in j&&!isNaN(j.id)&&(this.id=parseInt(j.id,10))}loadGeometry(){if(this._feature.type===1){const j=[];for(const ie of this._feature.geometry)j.push([new i.pointGeometry(ie[0],ie[1])]);return j}{const j=[];for(const ie of this._feature.geometry){const ne=[];for(const de of ie)ne.push(new i.pointGeometry(de[0],de[1]));j.push(ne)}return j}}toGeoJSON(j,ie,ne){return we.call(this,j,ie,ne)}}class De{constructor(j){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=j.length,this._features=j}feature(j){return new me(this._features[j])}}var Je={exports:{}},Fe=i.pointGeometry,Ge=i.vectorTile.VectorTileFeature,Et=li;function li(X,j){this.options=j||{},this.features=X,this.length=X.length}function xi(X,j){this.id=typeof X.id=="number"?X.id:void 0,this.type=X.type,this.rawGeometry=X.type===1?[X.geometry]:X.geometry,this.properties=X.tags,this.extent=j||4096}li.prototype.feature=function(X){return new xi(this.features[X],this.options.extent)},xi.prototype.loadGeometry=function(){var X=this.rawGeometry;this.geometry=[];for(var j=0;j<X.length;j++){for(var ie=X[j],ne=[],de=0;de<ie.length;de++)ne.push(new Fe(ie[de][0],ie[de][1]));this.geometry.push(ne)}return this.geometry},xi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var X=this.geometry,j=1/0,ie=-1/0,ne=1/0,de=-1/0,Ue=0;Ue<X.length;Ue++)for(var tt=X[Ue],He=0;He<tt.length;He++){var et=tt[He];j=Math.min(j,et.x),ie=Math.max(ie,et.x),ne=Math.min(ne,et.y),de=Math.max(de,et.y)}return[j,ne,ie,de]},xi.prototype.toGeoJSON=Ge.prototype.toGeoJSON;var te=i.pbf,le=Et;function ye(X){var j=new te;return function(ie,ne){for(var de in ie.layers)ne.writeMessage(3,xe,ie.layers[de])}(X,j),j.finish()}function xe(X,j){var ie;j.writeVarintField(15,X.version||1),j.writeStringField(1,X.name||""),j.writeVarintField(5,X.extent||4096);var ne={keys:[],values:[],keycache:{},valuecache:{}};for(ie=0;ie<X.length;ie++)ne.feature=X.feature(ie),j.writeMessage(2,Re,ne);var de=ne.keys;for(ie=0;ie<de.length;ie++)j.writeStringField(3,de[ie]);var Ue=ne.values;for(ie=0;ie<Ue.length;ie++)j.writeMessage(4,Se,Ue[ie])}function Re(X,j){var ie=X.feature;ie.id!==void 0&&j.writeVarintField(1,ie.id),j.writeMessage(2,Oe,X),j.writeVarintField(3,ie.type),j.writeMessage(4,Qe,ie)}function Oe(X,j){var ie=X.feature,ne=X.keys,de=X.values,Ue=X.keycache,tt=X.valuecache;for(var He in ie.properties){var et=ie.properties[He],pt=Ue[He];if(et!==null){pt===void 0&&(ne.push(He),Ue[He]=pt=ne.length-1),j.writeVarint(pt);var Lt=typeof et;Lt!=="string"&&Lt!=="boolean"&&Lt!=="number"&&(et=JSON.stringify(et));var jt=Lt+":"+et,Wt=tt[jt];Wt===void 0&&(de.push(et),tt[jt]=Wt=de.length-1),j.writeVarint(Wt)}}}function We(X,j){return(j<<3)+(7&X)}function Ve(X){return X<<1^X>>31}function Qe(X,j){for(var ie=X.loadGeometry(),ne=X.type,de=0,Ue=0,tt=ie.length,He=0;He<tt;He++){var et=ie[He],pt=1;ne===1&&(pt=et.length),j.writeVarint(We(1,pt));for(var Lt=ne===3?et.length-1:et.length,jt=0;jt<Lt;jt++){jt===1&&ne!==1&&j.writeVarint(We(2,Lt-1));var Wt=et[jt].x-de,ki=et[jt].y-Ue;j.writeVarint(Ve(Wt)),j.writeVarint(Ve(ki)),de+=Wt,Ue+=ki}ne===3&&j.writeVarint(We(7,1))}}function Se(X,j){var ie=typeof X;ie==="string"?j.writeStringField(1,X):ie==="boolean"?j.writeBooleanField(7,X):ie==="number"&&(X%1!=0?j.writeDoubleField(3,X):X<0?j.writeSVarintField(6,X):j.writeVarintField(5,X))}function Ke(X,j,ie,ne,de,Ue){if(de-ne<=ie)return;const tt=ne+de>>1;nt(X,j,tt,ne,de,Ue%2),Ke(X,j,ie,ne,tt-1,Ue+1),Ke(X,j,ie,tt+1,de,Ue+1)}function nt(X,j,ie,ne,de,Ue){for(;de>ne;){if(de-ne>600){const pt=de-ne+1,Lt=ie-ne+1,jt=Math.log(pt),Wt=.5*Math.exp(2*jt/3),ki=.5*Math.sqrt(jt*Wt*(pt-Wt)/pt)*(Lt-pt/2<0?-1:1);nt(X,j,ie,Math.max(ne,Math.floor(ie-Lt*Wt/pt+ki)),Math.min(de,Math.floor(ie+(pt-Lt)*Wt/pt+ki)),Ue)}const tt=j[2*ie+Ue];let He=ne,et=de;for(vt(X,j,ne,ie),j[2*de+Ue]>tt&&vt(X,j,ne,de);He<et;){for(vt(X,j,He,et),He++,et--;j[2*He+Ue]<tt;)He++;for(;j[2*et+Ue]>tt;)et--}j[2*ne+Ue]===tt?vt(X,j,ne,et):(et++,vt(X,j,et,de)),et<=ie&&(ne=et+1),ie<=et&&(de=et-1)}}function vt(X,j,ie,ne){be(X,ie,ne),be(j,2*ie,2*ne),be(j,2*ie+1,2*ne+1)}function be(X,j,ie){const ne=X[j];X[j]=X[ie],X[ie]=ne}function At(X,j,ie,ne){const de=X-ie,Ue=j-ne;return de*de+Ue*Ue}Je.exports=ye,Je.exports.fromVectorTileJs=ye,Je.exports.fromGeojsonVt=function(X,j){j=j||{};var ie={};for(var ne in X)ie[ne]=new le(X[ne].features,j),ie[ne].name=ne,ie[ne].version=j.version,ie[ne].extent=j.extent;return ye({layers:ie})},Je.exports.GeoJSONWrapper=le;const ut=X=>X[0],Nt=X=>X[1];class Gt{constructor(j,ie=ut,ne=Nt,de=64,Ue=Float64Array){this.nodeSize=de,this.points=j;const tt=j.length<65536?Uint16Array:Uint32Array,He=this.ids=new tt(j.length),et=this.coords=new Ue(2*j.length);for(let pt=0;pt<j.length;pt++)He[pt]=pt,et[2*pt]=ie(j[pt]),et[2*pt+1]=ne(j[pt]);Ke(He,et,de,0,He.length-1,0)}range(j,ie,ne,de){return function(Ue,tt,He,et,pt,Lt,jt){const Wt=[0,Ue.length-1,0],ki=[];let bi,Oi;for(;Wt.length;){const Yi=Wt.pop(),tn=Wt.pop(),rr=Wt.pop();if(tn-rr<=jt){for(let sr=rr;sr<=tn;sr++)bi=tt[2*sr],Oi=tt[2*sr+1],bi>=He&&bi<=pt&&Oi>=et&&Oi<=Lt&&ki.push(Ue[sr]);continue}const yn=Math.floor((rr+tn)/2);bi=tt[2*yn],Oi=tt[2*yn+1],bi>=He&&bi<=pt&&Oi>=et&&Oi<=Lt&&ki.push(Ue[yn]);const Yt=(Yi+1)%2;(Yi===0?He<=bi:et<=Oi)&&(Wt.push(rr),Wt.push(yn-1),Wt.push(Yt)),(Yi===0?pt>=bi:Lt>=Oi)&&(Wt.push(yn+1),Wt.push(tn),Wt.push(Yt))}return ki}(this.ids,this.coords,j,ie,ne,de,this.nodeSize)}within(j,ie,ne){return function(de,Ue,tt,He,et,pt){const Lt=[0,de.length-1,0],jt=[],Wt=et*et;for(;Lt.length;){const ki=Lt.pop(),bi=Lt.pop(),Oi=Lt.pop();if(bi-Oi<=pt){for(let Yt=Oi;Yt<=bi;Yt++)At(Ue[2*Yt],Ue[2*Yt+1],tt,He)<=Wt&&jt.push(de[Yt]);continue}const Yi=Math.floor((Oi+bi)/2),tn=Ue[2*Yi],rr=Ue[2*Yi+1];At(tn,rr,tt,He)<=Wt&&jt.push(de[Yi]);const yn=(ki+1)%2;(ki===0?tt-et<=tn:He-et<=rr)&&(Lt.push(Oi),Lt.push(Yi-1),Lt.push(yn)),(ki===0?tt+et>=tn:He+et>=rr)&&(Lt.push(Yi+1),Lt.push(bi),Lt.push(yn))}return jt}(this.ids,this.coords,j,ie,ne,this.nodeSize)}}const Qt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:X=>X},Ct=Math.fround||(Ft=new Float32Array(1),X=>(Ft[0]=+X,Ft[0]));var Ft;class Xt{constructor(j){this.options=yt(Object.create(Qt),j),this.trees=new Array(this.options.maxZoom+1)}load(j){const{log:ie,minZoom:ne,maxZoom:de,nodeSize:Ue}=this.options;ie&&console.time("total time");const tt=`prepare ${j.length} points`;ie&&console.time(tt),this.points=j;let He=[];for(let et=0;et<j.length;et++)j[et].geometry&&He.push(fi(j[et],et));this.trees[de+1]=new Gt(He,rt,ti,Ue,Float32Array),ie&&console.timeEnd(tt);for(let et=de;et>=ne;et--){const pt=+Date.now();He=this._cluster(He,et),this.trees[et]=new Gt(He,rt,ti,Ue,Float32Array),ie&&console.log("z%d: %d clusters in %dms",et,He.length,+Date.now()-pt)}return ie&&console.timeEnd("total time"),this}getClusters(j,ie){let ne=((j[0]+180)%360+360)%360-180;const de=Math.max(-90,Math.min(90,j[1]));let Ue=j[2]===180?180:((j[2]+180)%360+360)%360-180;const tt=Math.max(-90,Math.min(90,j[3]));if(j[2]-j[0]>=360)ne=-180,Ue=180;else if(ne>Ue){const Lt=this.getClusters([ne,de,180,tt],ie),jt=this.getClusters([-180,de,Ue,tt],ie);return Lt.concat(jt)}const He=this.trees[this._limitZoom(ie)],et=He.range(zi(ne),Gn(tt),zi(Ue),Gn(de)),pt=[];for(const Lt of et){const jt=He.points[Lt];pt.push(jt.numPoints?Gi(jt):this.points[jt.index])}return pt}getChildren(j){const ie=this._getOriginId(j),ne=this._getOriginZoom(j),de="No cluster with the specified id.",Ue=this.trees[ne];if(!Ue)throw new Error(de);const tt=Ue.points[ie];if(!tt)throw new Error(de);const He=this.options.radius/(this.options.extent*Math.pow(2,ne-1)),et=Ue.within(tt.x,tt.y,He),pt=[];for(const Lt of et){const jt=Ue.points[Lt];jt.parentId===j&&pt.push(jt.numPoints?Gi(jt):this.points[jt.index])}if(pt.length===0)throw new Error(de);return pt}getLeaves(j,ie,ne){const de=[];return this._appendLeaves(de,j,ie=ie||10,ne=ne||0,0),de}getTile(j,ie,ne){const de=this.trees[this._limitZoom(j)],Ue=Math.pow(2,j),{extent:tt,radius:He}=this.options,et=He/tt,pt=(ne-et)/Ue,Lt=(ne+1+et)/Ue,jt={features:[]};return this._addTileFeatures(de.range((ie-et)/Ue,pt,(ie+1+et)/Ue,Lt),de.points,ie,ne,Ue,jt),ie===0&&this._addTileFeatures(de.range(1-et/Ue,pt,1,Lt),de.points,Ue,ne,Ue,jt),ie===Ue-1&&this._addTileFeatures(de.range(0,pt,et/Ue,Lt),de.points,-1,ne,Ue,jt),jt.features.length?jt:null}getClusterExpansionZoom(j){let ie=this._getOriginZoom(j)-1;for(;ie<=this.options.maxZoom;){const ne=this.getChildren(j);if(ie++,ne.length!==1)break;j=ne[0].properties.cluster_id}return ie}_appendLeaves(j,ie,ne,de,Ue){const tt=this.getChildren(ie);for(const He of tt){const et=He.properties;if(et&&et.cluster?Ue+et.point_count<=de?Ue+=et.point_count:Ue=this._appendLeaves(j,et.cluster_id,ne,de,Ue):Ue<de?Ue++:j.push(He),j.length===ne)break}return Ue}_addTileFeatures(j,ie,ne,de,Ue,tt){for(const He of j){const et=ie[He],pt=et.numPoints;let Lt,jt,Wt;if(pt)Lt=wn(et),jt=et.x,Wt=et.y;else{const Oi=this.points[et.index];Lt=Oi.properties,jt=zi(Oi.geometry.coordinates[0]),Wt=Gn(Oi.geometry.coordinates[1])}const ki={type:1,geometry:[[Math.round(this.options.extent*(jt*Ue-ne)),Math.round(this.options.extent*(Wt*Ue-de))]],tags:Lt};let bi;pt?bi=et.id:this.options.generateId?bi=et.index:this.points[et.index].id&&(bi=this.points[et.index].id),bi!==void 0&&(ki.id=bi),tt.features.push(ki)}}_limitZoom(j){return Math.max(this.options.minZoom,Math.min(Math.floor(+j),this.options.maxZoom+1))}_cluster(j,ie){const ne=[],{radius:de,extent:Ue,reduce:tt,minPoints:He}=this.options,et=de/(Ue*Math.pow(2,ie));for(let pt=0;pt<j.length;pt++){const Lt=j[pt];if(Lt.zoom<=ie)continue;Lt.zoom=ie;const jt=this.trees[ie+1],Wt=jt.within(Lt.x,Lt.y,et),ki=Lt.numPoints||1;let bi=ki;for(const Oi of Wt){const Yi=jt.points[Oi];Yi.zoom>ie&&(bi+=Yi.numPoints||1)}if(bi>ki&&bi>=He){let Oi=Lt.x*ki,Yi=Lt.y*ki,tn=tt&&ki>1?this._map(Lt,!0):null;const rr=(pt<<5)+(ie+1)+this.points.length;for(const yn of Wt){const Yt=jt.points[yn];if(Yt.zoom<=ie)continue;Yt.zoom=ie;const sr=Yt.numPoints||1;Oi+=Yt.x*sr,Yi+=Yt.y*sr,Yt.parentId=rr,tt&&(tn||(tn=this._map(Lt,!0)),tt(tn,this._map(Yt)))}Lt.parentId=rr,ne.push(_i(Oi/bi,Yi/bi,rr,bi,tn))}else if(ne.push(Lt),bi>1)for(const Oi of Wt){const Yi=jt.points[Oi];Yi.zoom<=ie||(Yi.zoom=ie,ne.push(Yi))}}return ne}_getOriginId(j){return j-this.points.length>>5}_getOriginZoom(j){return(j-this.points.length)%32}_map(j,ie){if(j.numPoints)return ie?yt({},j.properties):j.properties;const ne=this.points[j.index].properties,de=this.options.map(ne);return ie&&de===ne?yt({},de):de}}function _i(X,j,ie,ne,de){return{x:Ct(X),y:Ct(j),zoom:1/0,id:ie,parentId:-1,numPoints:ne,properties:de}}function fi(X,j){const[ie,ne]=X.geometry.coordinates;return{x:Ct(zi(ie)),y:Ct(Gn(ne)),zoom:1/0,index:j,parentId:-1}}function Gi(X){return{type:"Feature",id:X.id,properties:wn(X),geometry:{type:"Point",coordinates:[(j=X.x,360*(j-.5)),kn(X.y)]}};var j}function wn(X){const j=X.numPoints,ie=j>=1e4?`${Math.round(j/1e3)}k`:j>=1e3?Math.round(j/100)/10+"k":j;return yt(yt({},X.properties),{cluster:!0,cluster_id:X.id,point_count:j,point_count_abbreviated:ie})}function zi(X){return X/360+.5}function Gn(X){const j=Math.sin(X*Math.PI/180),ie=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return ie<0?0:ie>1?1:ie}function kn(X){const j=(180-360*X)*Math.PI/180;return 360*Math.atan(Math.exp(j))/Math.PI-90}function yt(X,j){for(const ie in j)X[ie]=j[ie];return X}function rt(X){return X.x}function ti(X){return X.y}function Ni(X,j,ie,ne){for(var de,Ue=ne,tt=ie-j>>1,He=ie-j,et=X[j],pt=X[j+1],Lt=X[ie],jt=X[ie+1],Wt=j+3;Wt<ie;Wt+=3){var ki=qi(X[Wt],X[Wt+1],et,pt,Lt,jt);if(ki>Ue)de=Wt,Ue=ki;else if(ki===Ue){var bi=Math.abs(Wt-tt);bi<He&&(de=Wt,He=bi)}}Ue>ne&&(de-j>3&&Ni(X,j,de,ne),X[de+2]=Ue,ie-de>3&&Ni(X,de,ie,ne))}function qi(X,j,ie,ne,de,Ue){var tt=de-ie,He=Ue-ne;if(tt!==0||He!==0){var et=((X-ie)*tt+(j-ne)*He)/(tt*tt+He*He);et>1?(ie=de,ne=Ue):et>0&&(ie+=tt*et,ne+=He*et)}return(tt=X-ie)*tt+(He=j-ne)*He}function en(X,j,ie,ne){var de={id:X===void 0?null:X,type:j,geometry:ie,tags:ne,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ue){var tt=Ue.geometry,He=Ue.type;if(He==="Point"||He==="MultiPoint"||He==="LineString")$t(Ue,tt);else if(He==="Polygon"||He==="MultiLineString")for(var et=0;et<tt.length;et++)$t(Ue,tt[et]);else if(He==="MultiPolygon")for(et=0;et<tt.length;et++)for(var pt=0;pt<tt[et].length;pt++)$t(Ue,tt[et][pt])}(de),de}function $t(X,j){for(var ie=0;ie<j.length;ie+=3)X.minX=Math.min(X.minX,j[ie]),X.minY=Math.min(X.minY,j[ie+1]),X.maxX=Math.max(X.maxX,j[ie]),X.maxY=Math.max(X.maxY,j[ie+1])}function at(X,j,ie,ne){if(j.geometry){var de=j.geometry.coordinates,Ue=j.geometry.type,tt=Math.pow(ie.tolerance/((1<<ie.maxZoom)*ie.extent),2),He=[],et=j.id;if(ie.promoteId?et=j.properties[ie.promoteId]:ie.generateId&&(et=ne||0),Ue==="Point")ii(de,He);else if(Ue==="MultiPoint")for(var pt=0;pt<de.length;pt++)ii(de[pt],He);else if(Ue==="LineString")hn(de,He,tt,!1);else if(Ue==="MultiLineString"){if(ie.lineMetrics){for(pt=0;pt<de.length;pt++)hn(de[pt],He=[],tt,!1),X.push(en(et,"LineString",He,j.properties));return}Xi(de,He,tt,!1)}else if(Ue==="Polygon")Xi(de,He,tt,!0);else{if(Ue!=="MultiPolygon"){if(Ue==="GeometryCollection"){for(pt=0;pt<j.geometry.geometries.length;pt++)at(X,{id:et,geometry:j.geometry.geometries[pt],properties:j.properties},ie,ne);return}throw new Error("Input data is not a valid GeoJSON object.")}for(pt=0;pt<de.length;pt++){var Lt=[];Xi(de[pt],Lt,tt,!0),He.push(Lt)}}X.push(en(et,Ue,He,j.properties))}}function ii(X,j){j.push(on(X[0])),j.push(Cn(X[1])),j.push(0)}function hn(X,j,ie,ne){for(var de,Ue,tt=0,He=0;He<X.length;He++){var et=on(X[He][0]),pt=Cn(X[He][1]);j.push(et),j.push(pt),j.push(0),He>0&&(tt+=ne?(de*pt-et*Ue)/2:Math.sqrt(Math.pow(et-de,2)+Math.pow(pt-Ue,2))),de=et,Ue=pt}var Lt=j.length-3;j[2]=1,Ni(j,0,Lt,ie),j[Lt+2]=1,j.size=Math.abs(tt),j.start=0,j.end=j.size}function Xi(X,j,ie,ne){for(var de=0;de<X.length;de++){var Ue=[];hn(X[de],Ue,ie,ne),j.push(Ue)}}function on(X){return X/360+.5}function Cn(X){var j=Math.sin(X*Math.PI/180),ie=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return ie<0?0:ie>1?1:ie}function Tn(X,j,ie,ne,de,Ue,tt,He){if(ne/=j,Ue>=(ie/=j)&&tt<ne)return X;if(tt<ie||Ue>=ne)return null;for(var et=[],pt=0;pt<X.length;pt++){var Lt=X[pt],jt=Lt.geometry,Wt=Lt.type,ki=de===0?Lt.minX:Lt.minY,bi=de===0?Lt.maxX:Lt.maxY;if(ki>=ie&&bi<ne)et.push(Lt);else if(!(bi<ie||ki>=ne)){var Oi=[];if(Wt==="Point"||Wt==="MultiPoint")nr(jt,Oi,ie,ne,de);else if(Wt==="LineString")Ii(jt,Oi,ie,ne,de,!1,He.lineMetrics);else if(Wt==="MultiLineString")Ot(jt,Oi,ie,ne,de,!1);else if(Wt==="Polygon")Ot(jt,Oi,ie,ne,de,!0);else if(Wt==="MultiPolygon")for(var Yi=0;Yi<jt.length;Yi++){var tn=[];Ot(jt[Yi],tn,ie,ne,de,!0),tn.length&&Oi.push(tn)}if(Oi.length){if(He.lineMetrics&&Wt==="LineString"){for(Yi=0;Yi<Oi.length;Yi++)et.push(en(Lt.id,Wt,Oi[Yi],Lt.tags));continue}Wt!=="LineString"&&Wt!=="MultiLineString"||(Oi.length===1?(Wt="LineString",Oi=Oi[0]):Wt="MultiLineString"),Wt!=="Point"&&Wt!=="MultiPoint"||(Wt=Oi.length===3?"Point":"MultiPoint"),et.push(en(Lt.id,Wt,Oi,Lt.tags))}}}return et.length?et:null}function nr(X,j,ie,ne,de){for(var Ue=0;Ue<X.length;Ue+=3){var tt=X[Ue+de];tt>=ie&&tt<=ne&&(j.push(X[Ue]),j.push(X[Ue+1]),j.push(X[Ue+2]))}}function Ii(X,j,ie,ne,de,Ue,tt){for(var He,et,pt=bn(X),Lt=de===0?Wi:Ui,jt=X.start,Wt=0;Wt<X.length-3;Wt+=3){var ki=X[Wt],bi=X[Wt+1],Oi=X[Wt+2],Yi=X[Wt+3],tn=X[Wt+4],rr=de===0?ki:bi,yn=de===0?Yi:tn,Yt=!1;tt&&(He=Math.sqrt(Math.pow(ki-Yi,2)+Math.pow(bi-tn,2))),rr<ie?yn>ie&&(et=Lt(pt,ki,bi,Yi,tn,ie),tt&&(pt.start=jt+He*et)):rr>ne?yn<ne&&(et=Lt(pt,ki,bi,Yi,tn,ne),tt&&(pt.start=jt+He*et)):wi(pt,ki,bi,Oi),yn<ie&&rr>=ie&&(et=Lt(pt,ki,bi,Yi,tn,ie),Yt=!0),yn>ne&&rr<=ne&&(et=Lt(pt,ki,bi,Yi,tn,ne),Yt=!0),!Ue&&Yt&&(tt&&(pt.end=jt+He*et),j.push(pt),pt=bn(X)),tt&&(jt+=He)}var sr=X.length-3;ki=X[sr],bi=X[sr+1],Oi=X[sr+2],(rr=de===0?ki:bi)>=ie&&rr<=ne&&wi(pt,ki,bi,Oi),sr=pt.length-3,Ue&&sr>=3&&(pt[sr]!==pt[0]||pt[sr+1]!==pt[1])&&wi(pt,pt[0],pt[1],pt[2]),pt.length&&j.push(pt)}function bn(X){var j=[];return j.size=X.size,j.start=X.start,j.end=X.end,j}function Ot(X,j,ie,ne,de,Ue){for(var tt=0;tt<X.length;tt++)Ii(X[tt],j,ie,ne,de,Ue,!1)}function wi(X,j,ie,ne){X.push(j),X.push(ie),X.push(ne)}function Wi(X,j,ie,ne,de,Ue){var tt=(Ue-j)/(ne-j);return X.push(Ue),X.push(ie+(de-ie)*tt),X.push(1),tt}function Ui(X,j,ie,ne,de,Ue){var tt=(Ue-ie)/(de-ie);return X.push(j+(ne-j)*tt),X.push(Ue),X.push(1),tt}function Pn(X,j){for(var ie=[],ne=0;ne<X.length;ne++){var de,Ue=X[ne],tt=Ue.type;if(tt==="Point"||tt==="MultiPoint"||tt==="LineString")de=qn(Ue.geometry,j);else if(tt==="MultiLineString"||tt==="Polygon"){de=[];for(var He=0;He<Ue.geometry.length;He++)de.push(qn(Ue.geometry[He],j))}else if(tt==="MultiPolygon")for(de=[],He=0;He<Ue.geometry.length;He++){for(var et=[],pt=0;pt<Ue.geometry[He].length;pt++)et.push(qn(Ue.geometry[He][pt],j));de.push(et)}ie.push(en(Ue.id,tt,de,Ue.tags))}return ie}function qn(X,j){var ie=[];ie.size=X.size,X.start!==void 0&&(ie.start=X.start,ie.end=X.end);for(var ne=0;ne<X.length;ne+=3)ie.push(X[ne]+j,X[ne+1],X[ne+2]);return ie}function Hr(X,j){if(X.transformed)return X;var ie,ne,de,Ue=1<<X.z,tt=X.x,He=X.y;for(ie=0;ie<X.features.length;ie++){var et=X.features[ie],pt=et.geometry,Lt=et.type;if(et.geometry=[],Lt===1)for(ne=0;ne<pt.length;ne+=2)et.geometry.push(fr(pt[ne],pt[ne+1],j,Ue,tt,He));else for(ne=0;ne<pt.length;ne++){var jt=[];for(de=0;de<pt[ne].length;de+=2)jt.push(fr(pt[ne][de],pt[ne][de+1],j,Ue,tt,He));et.geometry.push(jt)}}return X.transformed=!0,X}function fr(X,j,ie,ne,de,Ue){return[Math.round(ie*(X*ne-de)),Math.round(ie*(j*ne-Ue))]}function kr(X,j,ie,ne,de){for(var Ue=j===de.maxZoom?0:de.tolerance/((1<<j)*de.extent),tt={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:ie,y:ne,z:j,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},He=0;He<X.length;He++){tt.numFeatures++,Qn(tt,X[He],Ue,de);var et=X[He].minX,pt=X[He].minY,Lt=X[He].maxX,jt=X[He].maxY;et<tt.minX&&(tt.minX=et),pt<tt.minY&&(tt.minY=pt),Lt>tt.maxX&&(tt.maxX=Lt),jt>tt.maxY&&(tt.maxY=jt)}return tt}function Qn(X,j,ie,ne){var de=j.geometry,Ue=j.type,tt=[];if(Ue==="Point"||Ue==="MultiPoint")for(var He=0;He<de.length;He+=3)tt.push(de[He]),tt.push(de[He+1]),X.numPoints++,X.numSimplified++;else if(Ue==="LineString")Rs(tt,de,X,ie,!1,!1);else if(Ue==="MultiLineString"||Ue==="Polygon")for(He=0;He<de.length;He++)Rs(tt,de[He],X,ie,Ue==="Polygon",He===0);else if(Ue==="MultiPolygon")for(var et=0;et<de.length;et++){var pt=de[et];for(He=0;He<pt.length;He++)Rs(tt,pt[He],X,ie,!0,He===0)}if(tt.length){var Lt=j.tags||null;if(Ue==="LineString"&&ne.lineMetrics){for(var jt in Lt={},j.tags)Lt[jt]=j.tags[jt];Lt.mapbox_clip_start=de.start/de.size,Lt.mapbox_clip_end=de.end/de.size}var Wt={geometry:tt,type:Ue==="Polygon"||Ue==="MultiPolygon"?3:Ue==="LineString"||Ue==="MultiLineString"?2:1,tags:Lt};j.id!==null&&(Wt.id=j.id),X.features.push(Wt)}}function Rs(X,j,ie,ne,de,Ue){var tt=ne*ne;if(ne>0&&j.size<(de?tt:ne))ie.numPoints+=j.length/3;else{for(var He=[],et=0;et<j.length;et+=3)(ne===0||j[et+2]>tt)&&(ie.numSimplified++,He.push(j[et]),He.push(j[et+1])),ie.numPoints++;de&&function(pt,Lt){for(var jt=0,Wt=0,ki=pt.length,bi=ki-2;Wt<ki;bi=Wt,Wt+=2)jt+=(pt[Wt]-pt[bi])*(pt[Wt+1]+pt[bi+1]);if(jt>0===Lt)for(Wt=0,ki=pt.length;Wt<ki/2;Wt+=2){var Oi=pt[Wt],Yi=pt[Wt+1];pt[Wt]=pt[ki-2-Wt],pt[Wt+1]=pt[ki-1-Wt],pt[ki-2-Wt]=Oi,pt[ki-1-Wt]=Yi}}(He,Ue),X.push(He)}}function ot(X,j){var ie=(j=this.options=function(de,Ue){for(var tt in Ue)de[tt]=Ue[tt];return de}(Object.create(this.options),j)).debug;if(ie&&console.time("preprocess data"),j.maxZoom<0||j.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(j.promoteId&&j.generateId)throw new Error("promoteId and generateId cannot be used together.");var ne=function(de,Ue){var tt=[];if(de.type==="FeatureCollection")for(var He=0;He<de.features.length;He++)at(tt,de.features[He],Ue,He);else at(tt,de.type==="Feature"?de:{geometry:de},Ue);return tt}(X,j);this.tiles={},this.tileCoords=[],ie&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",j.indexMaxZoom,j.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=function(de,Ue){var tt=Ue.buffer/Ue.extent,He=de,et=Tn(de,1,-1-tt,tt,0,-1,2,Ue),pt=Tn(de,1,1-tt,2+tt,0,-1,2,Ue);return(et||pt)&&(He=Tn(de,1,-tt,1+tt,0,-1,2,Ue)||[],et&&(He=Pn(et,1).concat(He)),pt&&(He=He.concat(Pn(pt,-1)))),He}(ne,j),ne.length&&this.splitTile(ne,0,0,0),ie&&(ne.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)))}function Ee(X,j,ie){return 32*((1<<X)*ie+j)+X}function Pe(X,j){const ie=X.tileID.canonical;if(!this._geoJSONIndex)return j(null,null);const ne=this._geoJSONIndex.getTile(ie.z,ie.x,ie.y);if(!ne)return j(null,null);const de=new De(ne.features);let Ue=Je.exports(de);Ue.byteOffset===0&&Ue.byteLength===Ue.buffer.byteLength||(Ue=new Uint8Array(Ue)),j(null,{vectorTile:de,rawData:Ue.buffer})}ot.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ot.prototype.splitTile=function(X,j,ie,ne,de,Ue,tt){for(var He=[X,j,ie,ne],et=this.options,pt=et.debug;He.length;){ne=He.pop(),ie=He.pop(),j=He.pop(),X=He.pop();var Lt=1<<j,jt=Ee(j,ie,ne),Wt=this.tiles[jt];if(!Wt&&(pt>1&&console.time("creation"),Wt=this.tiles[jt]=kr(X,j,ie,ne,et),this.tileCoords.push({z:j,x:ie,y:ne}),pt)){pt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",j,ie,ne,Wt.numFeatures,Wt.numPoints,Wt.numSimplified),console.timeEnd("creation"));var ki="z"+j;this.stats[ki]=(this.stats[ki]||0)+1,this.total++}if(Wt.source=X,de){if(j===et.maxZoom||j===de)continue;var bi=1<<de-j;if(ie!==Math.floor(Ue/bi)||ne!==Math.floor(tt/bi))continue}else if(j===et.indexMaxZoom||Wt.numPoints<=et.indexMaxPoints)continue;if(Wt.source=null,X.length!==0){pt>1&&console.time("clipping");var Oi,Yi,tn,rr,yn,Yt,sr=.5*et.buffer/et.extent,Yn=.5-sr,Wr=.5+sr,mr=1+sr;Oi=Yi=tn=rr=null,yn=Tn(X,Lt,ie-sr,ie+Wr,0,Wt.minX,Wt.maxX,et),Yt=Tn(X,Lt,ie+Yn,ie+mr,0,Wt.minX,Wt.maxX,et),X=null,yn&&(Oi=Tn(yn,Lt,ne-sr,ne+Wr,1,Wt.minY,Wt.maxY,et),Yi=Tn(yn,Lt,ne+Yn,ne+mr,1,Wt.minY,Wt.maxY,et),yn=null),Yt&&(tn=Tn(Yt,Lt,ne-sr,ne+Wr,1,Wt.minY,Wt.maxY,et),rr=Tn(Yt,Lt,ne+Yn,ne+mr,1,Wt.minY,Wt.maxY,et),Yt=null),pt>1&&console.timeEnd("clipping"),He.push(Oi||[],j+1,2*ie,2*ne),He.push(Yi||[],j+1,2*ie,2*ne+1),He.push(tn||[],j+1,2*ie+1,2*ne),He.push(rr||[],j+1,2*ie+1,2*ne+1)}}},ot.prototype.getTile=function(X,j,ie){var ne=this.options,de=ne.extent,Ue=ne.debug;if(X<0||X>24)return null;var tt=1<<X,He=Ee(X,j=(j%tt+tt)%tt,ie);if(this.tiles[He])return Hr(this.tiles[He],de);Ue>1&&console.log("drilling down to z%d-%d-%d",X,j,ie);for(var et,pt=X,Lt=j,jt=ie;!et&&pt>0;)pt--,Lt=Math.floor(Lt/2),jt=Math.floor(jt/2),et=this.tiles[Ee(pt,Lt,jt)];return et&&et.source?(Ue>1&&console.log("found parent tile z%d-%d-%d",pt,Lt,jt),Ue>1&&console.time("drilling down"),this.splitTile(et.source,pt,Lt,jt,X,j,ie),Ue>1&&console.timeEnd("drilling down"),this.tiles[He]?Hr(this.tiles[He],de):null):null};class ct extends Y{constructor(j,ie,ne,de){super(j,ie,ne,Pe),de&&(this.loadGeoJSON=de)}loadData(j,ie){var ne;(ne=this._pendingRequest)===null||ne===void 0||ne.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const de=!!(j&&j.request&&j.request.collectResourceTiming)&&new i.RequestPerformance(j.request);this._pendingCallback=ie,this._pendingRequest=this.loadGeoJSON(j,(Ue,tt)=>{if(delete this._pendingCallback,delete this._pendingRequest,Ue||!tt)return ie(Ue);if(typeof tt!="object")return ie(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));{ae(tt,!0);try{if(j.filter){const et=i.createExpression(j.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(et.result==="error")throw new Error(et.value.map(Lt=>`${Lt.key}: ${Lt.message}`).join(", "));tt={type:"FeatureCollection",features:tt.features.filter(Lt=>et.value.evaluate({zoom:0},Lt))}}this._geoJSONIndex=j.cluster?new Xt(function({superclusterOptions:et,clusterProperties:pt}){if(!pt||!et)return et;const Lt={},jt={},Wt={accumulated:null,zoom:0},ki={properties:null},bi=Object.keys(pt);for(const Oi of bi){const[Yi,tn]=pt[Oi],rr=i.createExpression(tn),yn=i.createExpression(typeof Yi=="string"?[Yi,["accumulated"],["get",Oi]]:Yi);Lt[Oi]=rr.value,jt[Oi]=yn.value}return et.map=Oi=>{ki.properties=Oi;const Yi={};for(const tn of bi)Yi[tn]=Lt[tn].evaluate(Wt,ki);return Yi},et.reduce=(Oi,Yi)=>{ki.properties=Yi;for(const tn of bi)Wt.accumulated=Oi[tn],Oi[tn]=jt[tn].evaluate(Wt,ki)},et}(j)).load(tt.features):function(et,pt){return new ot(et,pt)}(tt,j.geojsonVtOptions)}catch(et){return ie(et)}this.loaded={};const He={};if(de){const et=de.finish();et&&(He.resourceTiming={},He.resourceTiming[j.source]=JSON.parse(JSON.stringify(et)))}ie(null,He)}})}reloadTile(j,ie){const ne=this.loaded;return ne&&ne[j.uid]?super.reloadTile(j,ie):this.loadTile(j,ie)}loadGeoJSON(j,ie){if(j.request)return i.getJSON(j.request,ie);if(typeof j.data=="string")try{ie(null,JSON.parse(j.data))}catch{ie(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`))}else ie(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(j,ie){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),ie()}getClusterExpansionZoom(j,ie){try{ie(null,this._geoJSONIndex.getClusterExpansionZoom(j.clusterId))}catch(ne){ie(ne)}}getClusterChildren(j,ie){try{ie(null,this._geoJSONIndex.getChildren(j.clusterId))}catch(ne){ie(ne)}}getClusterLeaves(j,ie){try{ie(null,this._geoJSONIndex.getLeaves(j.clusterId,j.limit,j.offset))}catch(ne){ie(ne)}}}class wt{constructor(j){this.self=j,this.actor=new i.Actor(j,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Y,geojson:ct},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(ie,ne)=>{if(this.workerSourceTypes[ie])throw new Error(`Worker source with name "${ie}" already registered.`);this.workerSourceTypes[ie]=ne},this.self.registerRTLTextPlugin=ie=>{if(i.plugin.isParsed())throw new Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=ie.applyArabicShaping,i.plugin.processBidirectionalText=ie.processBidirectionalText,i.plugin.processStyledBidirectionalText=ie.processStyledBidirectionalText}}setReferrer(j,ie){this.referrer=ie}setImages(j,ie,ne){this.availableImages[j]=ie;for(const de in this.workerSources[j]){const Ue=this.workerSources[j][de];for(const tt in Ue)Ue[tt].availableImages=ie}ne()}setLayers(j,ie,ne){this.getLayerIndex(j).replace(ie),ne()}updateLayers(j,ie,ne){this.getLayerIndex(j).update(ie.layers,ie.removedIds),ne()}loadTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).loadTile(ie,ne)}loadDEMTile(j,ie,ne){this.getDEMWorkerSource(j,ie.source).loadTile(ie,ne)}reloadTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).reloadTile(ie,ne)}abortTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).abortTile(ie,ne)}removeTile(j,ie,ne){this.getWorkerSource(j,ie.type,ie.source).removeTile(ie,ne)}removeDEMTile(j,ie){this.getDEMWorkerSource(j,ie.source).removeTile(ie)}removeSource(j,ie,ne){if(!this.workerSources[j]||!this.workerSources[j][ie.type]||!this.workerSources[j][ie.type][ie.source])return;const de=this.workerSources[j][ie.type][ie.source];delete this.workerSources[j][ie.type][ie.source],de.removeSource!==void 0?de.removeSource(ie,ne):ne()}loadWorkerSource(j,ie,ne){try{this.self.importScripts(ie.url),ne()}catch(de){ne(de.toString())}}syncRTLPluginState(j,ie,ne){try{i.plugin.setState(ie);const de=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&de!=null){this.self.importScripts(de);const Ue=i.plugin.isParsed();ne(Ue?void 0:new Error(`RTL Text Plugin failed to import scripts from ${de}`),Ue)}}catch(de){ne(de.toString())}}getAvailableImages(j){let ie=this.availableImages[j];return ie||(ie=[]),ie}getLayerIndex(j){let ie=this.layerIndexes[j];return ie||(ie=this.layerIndexes[j]=new R),ie}getWorkerSource(j,ie,ne){if(this.workerSources[j]||(this.workerSources[j]={}),this.workerSources[j][ie]||(this.workerSources[j][ie]={}),!this.workerSources[j][ie][ne]){const de={send:(Ue,tt,He)=>{this.actor.send(Ue,tt,He,j)}};this.workerSources[j][ie][ne]=new this.workerSourceTypes[ie](de,this.getLayerIndex(j),this.getAvailableImages(j))}return this.workerSources[j][ie][ne]}getDEMWorkerSource(j,ie){return this.demWorkerSources[j]||(this.demWorkerSources[j]={}),this.demWorkerSources[j][ie]||(this.demWorkerSources[j][ie]=new B),this.demWorkerSources[j][ie]}enforceCacheSizeLimit(j,ie){i.enforceCacheSizeLimit(ie)}}return i.isWorker()&&(self.worker=new wt(self)),wt}),p(["./shared"],function(i){var C=D;function D(M){return!function(h){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var T,F,O=new Blob([""],{type:"text/javascript"}),K=URL.createObjectURL(O);try{F=new Worker(K),T=!0}catch{T=!1}return F&&F.terminate(),URL.revokeObjectURL(K),T}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var T=document.createElement("canvas");T.width=T.height=1;var F=T.getContext("2d");if(!F)return!1;var O=F.getImageData(0,0,1,1);return O&&O.width===T.width}()?(R[_=h&&h.failIfMajorPerformanceCaveat]===void 0&&(R[_]=function(T){var F,O=function(K){var oe=document.createElement("canvas"),ue=Object.create(D.webGLContextAttributes);return ue.failIfMajorPerformanceCaveat=K,oe.getContext("webgl",ue)||oe.getContext("experimental-webgl",ue)}(T);if(!O)return!1;try{F=O.createShader(O.VERTEX_SHADER)}catch{return!1}return!(!F||O.isContextLost())&&(O.shaderSource(F,"void main() {}"),O.compileShader(F),O.getShaderParameter(F,O.COMPILE_STATUS)===!0)}(_)),R[_]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var _}(M)}var R={};function Q(M,h){if(Array.isArray(M)){if(!Array.isArray(h)||M.length!==h.length)return!1;for(let _=0;_<M.length;_++)if(!Q(M[_],h[_]))return!1;return!0}if(typeof M=="object"&&M!==null&&h!==null){if(typeof h!="object"||Object.keys(M).length!==Object.keys(h).length)return!1;for(const _ in M)if(!Q(M[_],h[_]))return!1;return!0}return M===h}D.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class z{static testProp(h){if(!z.docStyle)return h[0];for(let _=0;_<h.length;_++)if(h[_]in z.docStyle)return h[_];return h[0]}static create(h,_,T){const F=window.document.createElement(h);return _!==void 0&&(F.className=_),T&&T.appendChild(F),F}static createNS(h,_){return window.document.createElementNS(h,_)}static disableDrag(){z.docStyle&&z.selectProp&&(z.userSelect=z.docStyle[z.selectProp],z.docStyle[z.selectProp]="none")}static enableDrag(){z.docStyle&&z.selectProp&&(z.docStyle[z.selectProp]=z.userSelect)}static setTransform(h,_){h.style[z.transformProp]=_}static addEventListener(h,_,T,F={}){h.addEventListener(_,T,"passive"in F?F:F.capture)}static removeEventListener(h,_,T,F={}){h.removeEventListener(_,T,"passive"in F?F:F.capture)}static suppressClickInternal(h){h.preventDefault(),h.stopPropagation(),window.removeEventListener("click",z.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",z.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",z.suppressClickInternal,!0)},0)}static mousePos(h,_){const T=h.getBoundingClientRect();return new i.pointGeometry(_.clientX-T.left-h.clientLeft,_.clientY-T.top-h.clientTop)}static touchPos(h,_){const T=h.getBoundingClientRect(),F=[];for(let O=0;O<_.length;O++)F.push(new i.pointGeometry(_[O].clientX-T.left-h.clientLeft,_[O].clientY-T.top-h.clientTop));return F}static mouseButton(h){return h.button}static remove(h){h.parentNode&&h.parentNode.removeChild(h)}}z.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,z.selectProp=z.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),z.transformProp=z.testProp(["transform","WebkitTransform"]);class G{constructor(h){this._transformRequestFn=h}transformRequest(h,_){return this._transformRequestFn&&this._transformRequestFn(h,_)||{url:h}}normalizeSpriteURL(h,_,T){const F=function(O){const K=O.match(J);if(!K)throw new Error(`Unable to parse URL "${O}"`);return{protocol:K[1],authority:K[2],path:K[3]||"/",params:K[4]?K[4].split("&"):[]}}(h);return F.path+=`${_}${T}`,function(O){const K=O.params.length?`?${O.params.join("&")}`:"";return`${O.protocol}://${O.authority}${O.path}${K}`}(F)}setTransformRequest(h){this._transformRequestFn=h}}const J=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Y{constructor(h,_,T,F){this.context=h,this.format=T,this.texture=h.gl.createTexture(),this.update(_,F)}update(h,_,T){const{width:F,height:O}=h,K=!(this.size&&this.size[0]===F&&this.size[1]===O||T),{context:oe}=this,{gl:ue}=oe;if(this.useMipmap=Boolean(_&&_.useMipmap),ue.bindTexture(ue.TEXTURE_2D,this.texture),oe.pixelStoreUnpackFlipY.set(!1),oe.pixelStoreUnpack.set(1),oe.pixelStoreUnpackPremultiplyAlpha.set(this.format===ue.RGBA&&(!_||_.premultiply!==!1)),K)this.size=[F,O],h instanceof HTMLImageElement||h instanceof HTMLCanvasElement||h instanceof HTMLVideoElement||h instanceof ImageData||i.isImageBitmap(h)?ue.texImage2D(ue.TEXTURE_2D,0,this.format,this.format,ue.UNSIGNED_BYTE,h):ue.texImage2D(ue.TEXTURE_2D,0,this.format,F,O,0,this.format,ue.UNSIGNED_BYTE,h.data);else{const{x:ve,y:Te}=T||{x:0,y:0};h instanceof HTMLImageElement||h instanceof HTMLCanvasElement||h instanceof HTMLVideoElement||h instanceof ImageData||i.isImageBitmap(h)?ue.texSubImage2D(ue.TEXTURE_2D,0,ve,Te,ue.RGBA,ue.UNSIGNED_BYTE,h):ue.texSubImage2D(ue.TEXTURE_2D,0,ve,Te,F,O,ue.RGBA,ue.UNSIGNED_BYTE,h.data)}this.useMipmap&&this.isSizePowerOfTwo()&&ue.generateMipmap(ue.TEXTURE_2D)}bind(h,_,T){const{context:F}=this,{gl:O}=F;O.bindTexture(O.TEXTURE_2D,this.texture),T!==O.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(T=O.LINEAR),h!==this.filter&&(O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,h),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,T||h),this.filter=h),_!==this.wrap&&(O.texParameteri(O.TEXTURE_2D,O.TEXTURE_WRAP_S,_),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_WRAP_T,_),this.wrap=_)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:h}=this.context;h.deleteTexture(this.texture),this.texture=null}}function B(M){const{userImage:h}=M;return!!(h&&h.render&&h.render())&&(M.data.replace(new Uint8Array(h.data.buffer)),!0)}class ae extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(h){if(this.loaded!==h&&(this.loaded=h,h)){for(const{ids:_,callback:T}of this.requestors)this._notify(_,T);this.requestors=[]}}getImage(h){return this.images[h]}addImage(h,_){if(this.images[h])throw new Error(`Image id ${h} already exist, use updateImage instead`);this._validate(h,_)&&(this.images[h]=_)}_validate(h,_){let T=!0;return this._validateStretch(_.stretchX,_.data&&_.data.width)||(this.fire(new i.ErrorEvent(new Error(`Image "${h}" has invalid "stretchX" value`))),T=!1),this._validateStretch(_.stretchY,_.data&&_.data.height)||(this.fire(new i.ErrorEvent(new Error(`Image "${h}" has invalid "stretchY" value`))),T=!1),this._validateContent(_.content,_)||(this.fire(new i.ErrorEvent(new Error(`Image "${h}" has invalid "content" value`))),T=!1),T}_validateStretch(h,_){if(!h)return!0;let T=0;for(const F of h){if(F[0]<T||F[1]<F[0]||_<F[1])return!1;T=F[1]}return!0}_validateContent(h,_){return!(h&&(h.length!==4||h[0]<0||_.data.width<h[0]||h[1]<0||_.data.height<h[1]||h[2]<0||_.data.width<h[2]||h[3]<0||_.data.height<h[3]||h[2]<h[0]||h[3]<h[1]))}updateImage(h,_){const T=this.images[h];if(T.data.width!==_.data.width||T.data.height!==_.data.height)throw new Error(`size mismatch between old image (${T.data.width}x${T.data.height}) and new image (${_.data.width}x${_.data.height}).`);_.version=T.version+1,this.images[h]=_,this.updatedImages[h]=!0}removeImage(h){const _=this.images[h];delete this.images[h],delete this.patterns[h],_.userImage&&_.userImage.onRemove&&_.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(h,_){let T=!0;if(!this.isLoaded())for(const F of h)this.images[F]||(T=!1);this.isLoaded()||T?this._notify(h,_):this.requestors.push({ids:h,callback:_})}_notify(h,_){const T={};for(const F of h){this.images[F]||this.fire(new i.Event("styleimagemissing",{id:F}));const O=this.images[F];O?T[F]={data:O.data.clone(),pixelRatio:O.pixelRatio,sdf:O.sdf,version:O.version,stretchX:O.stretchX,stretchY:O.stretchY,content:O.content,hasRenderCallback:Boolean(O.userImage&&O.userImage.render)}:i.warnOnce(`Image "${F}" 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.`)}_(null,T)}getPixelSize(){const{width:h,height:_}=this.atlasImage;return{width:h,height:_}}getPattern(h){const _=this.patterns[h],T=this.getImage(h);if(!T)return null;if(_&&_.position.version===T.version)return _.position;if(_)_.position.version=T.version;else{const F={w:T.data.width+2,h:T.data.height+2,x:0,y:0},O=new i.ImagePosition(F,T);this.patterns[h]={bin:F,position:O}}return this._updatePatternAtlas(),this.patterns[h].position}bind(h){const _=h.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Y(h,this.atlasImage,_.RGBA),this.atlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE)}_updatePatternAtlas(){const h=[];for(const O in this.patterns)h.push(this.patterns[O].bin);const{w:_,h:T}=i.potpack(h),F=this.atlasImage;F.resize({width:_||1,height:T||1});for(const O in this.patterns){const{bin:K}=this.patterns[O],oe=K.x+1,ue=K.y+1,ve=this.images[O].data,Te=ve.width,ze=ve.height;i.RGBAImage.copy(ve,F,{x:0,y:0},{x:oe,y:ue},{width:Te,height:ze}),i.RGBAImage.copy(ve,F,{x:0,y:ze-1},{x:oe,y:ue-1},{width:Te,height:1}),i.RGBAImage.copy(ve,F,{x:0,y:0},{x:oe,y:ue+ze},{width:Te,height:1}),i.RGBAImage.copy(ve,F,{x:Te-1,y:0},{x:oe-1,y:ue},{width:1,height:ze}),i.RGBAImage.copy(ve,F,{x:0,y:0},{x:oe+Te,y:ue},{width:1,height:ze})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(h){for(const _ of h){if(this.callbackDispatchedThisFrame[_])continue;this.callbackDispatchedThisFrame[_]=!0;const T=this.images[_];T||i.warnOnce(`Image with ID: "${_}" was not found`),B(T)&&this.updateImage(_,T)}}}const ce=1e20;function Ae(M,h,_,T,F,O,K,oe,ue){for(let ve=h;ve<h+T;ve++)we(M,_*O+ve,O,F,K,oe,ue);for(let ve=_;ve<_+F;ve++)we(M,ve*O+h,1,T,K,oe,ue)}function we(M,h,_,T,F,O,K){O[0]=0,K[0]=-ce,K[1]=ce,F[0]=M[h];for(let oe=1,ue=0,ve=0;oe<T;oe++){F[oe]=M[h+oe*_];const Te=oe*oe;do{const ze=O[ue];ve=(F[oe]-F[ze]+Te-ze*ze)/(oe-ze)/2}while(ve<=K[ue]&&--ue>-1);ue++,O[ue]=oe,K[ue]=ve,K[ue+1]=ce}for(let oe=0,ue=0;oe<T;oe++){for(;K[ue+1]<oe;)ue++;const ve=O[ue],Te=oe-ve;M[h+oe*_]=F[ve]+Te*Te}}class me{constructor(h,_){this.requestManager=h,this.localIdeographFontFamily=_,this.entries={}}setURL(h){this.url=h}getGlyphs(h,_){const T=[];for(const F in h)for(const O of h[F])T.push({stack:F,id:O});i.asyncAll(T,({stack:F,id:O},K)=>{let oe=this.entries[F];oe||(oe=this.entries[F]={glyphs:{},requests:{},ranges:{}});let ue=oe.glyphs[O];if(ue!==void 0)return void K(null,{stack:F,id:O,glyph:ue});if(ue=this._tinySDF(oe,F,O),ue)return oe.glyphs[O]=ue,void K(null,{stack:F,id:O,glyph:ue});const ve=Math.floor(O/256);if(256*ve>65535)return void K(new Error("glyphs > 65535 not supported"));if(oe.ranges[ve])return void K(null,{stack:F,id:O,glyph:ue});let Te=oe.requests[ve];Te||(Te=oe.requests[ve]=[],me.loadGlyphRange(F,ve,this.url,this.requestManager,(ze,je)=>{if(je){for(const bt in je)this._doesCharSupportLocalGlyph(+bt)||(oe.glyphs[+bt]=je[+bt]);oe.ranges[ve]=!0}for(const bt of Te)bt(ze,je);delete oe.requests[ve]})),Te.push((ze,je)=>{ze?K(ze):je&&K(null,{stack:F,id:O,glyph:je[O]||null})})},(F,O)=>{if(F)_(F);else if(O){const K={};for(const{stack:oe,id:ue,glyph:ve}of O)(K[oe]||(K[oe]={}))[ue]=ve&&{id:ve.id,bitmap:ve.bitmap.clone(),metrics:ve.metrics};_(null,K)}})}_doesCharSupportLocalGlyph(h){return!!this.localIdeographFontFamily&&(i.unicodeBlockLookup["CJK Unified Ideographs"](h)||i.unicodeBlockLookup["Hangul Syllables"](h)||i.unicodeBlockLookup.Hiragana(h)||i.unicodeBlockLookup.Katakana(h))}_tinySDF(h,_,T){const F=this.localIdeographFontFamily;if(!F||!this._doesCharSupportLocalGlyph(T))return;let O=h.tinySDF;if(!O){let oe="400";/bold/i.test(_)?oe="900":/medium/i.test(_)?oe="500":/light/i.test(_)&&(oe="200"),O=h.tinySDF=new me.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:F,fontWeight:oe})}const K=O.draw(String.fromCharCode(T));return{id:T,bitmap:new i.AlphaImage({width:K.width||30,height:K.height||30},K.data),metrics:{width:K.glyphWidth||24,height:K.glyphHeight||24,left:K.glyphLeft||0,top:K.glyphTop-27||-8,advance:K.glyphAdvance||24}}}}me.loadGlyphRange=function(M,h,_,T,F){const O=256*h,K=O+255,oe=T.transformRequest(_.replace("{fontstack}",M).replace("{range}",`${O}-${K}`),i.ResourceType.Glyphs);i.getArrayBuffer(oe,(ue,ve)=>{if(ue)F(ue);else if(ve){const Te={};for(const ze of i.parseGlyphPbf(ve))Te[ze.id]=ze;F(null,Te)}})},me.TinySDF=class{constructor({fontSize:M=24,buffer:h=3,radius:_=8,cutoff:T=.25,fontFamily:F="sans-serif",fontWeight:O="normal",fontStyle:K="normal"}={}){this.buffer=h,this.cutoff=T,this.radius=_;const oe=this.size=M+4*h,ue=this._createCanvas(oe),ve=this.ctx=ue.getContext("2d",{willReadFrequently:!0});ve.font=`${K} ${O} ${M}px ${F}`,ve.textBaseline="alphabetic",ve.textAlign="left",ve.fillStyle="black",this.gridOuter=new Float64Array(oe*oe),this.gridInner=new Float64Array(oe*oe),this.f=new Float64Array(oe),this.z=new Float64Array(oe+1),this.v=new Uint16Array(oe)}_createCanvas(M){const h=document.createElement("canvas");return h.width=h.height=M,h}draw(M){const{width:h,actualBoundingBoxAscent:_,actualBoundingBoxDescent:T,actualBoundingBoxLeft:F,actualBoundingBoxRight:O}=this.ctx.measureText(M),K=Math.ceil(_),oe=Math.min(this.size-this.buffer,Math.ceil(O-F)),ue=Math.min(this.size-this.buffer,K+Math.ceil(T)),ve=oe+2*this.buffer,Te=ue+2*this.buffer,ze=Math.max(ve*Te,0),je=new Uint8ClampedArray(ze),bt={data:je,width:ve,height:Te,glyphWidth:oe,glyphHeight:ue,glyphTop:K,glyphLeft:0,glyphAdvance:h};if(oe===0||ue===0)return bt;const{ctx:mt,buffer:gt,gridInner:Vt,gridOuter:Zt}=this;mt.clearRect(gt,gt,oe,ue),mt.fillText(M,gt,gt+K);const ni=mt.getImageData(gt,gt,oe,ue);Zt.fill(ce,0,ze),Vt.fill(0,0,ze);for(let St=0;St<ue;St++)for(let zt=0;zt<oe;zt++){const ai=ni.data[4*(St*oe+zt)+3]/255;if(ai===0)continue;const Ei=(St+gt)*ve+zt+gt;if(ai===1)Zt[Ei]=0,Vt[Ei]=ce;else{const Bi=.5-ai;Zt[Ei]=Bi>0?Bi*Bi:0,Vt[Ei]=Bi<0?Bi*Bi:0}}Ae(Zt,0,0,ve,Te,ve,this.f,this.v,this.z),Ae(Vt,gt,gt,oe,ue,ve,this.f,this.v,this.z);for(let St=0;St<ze;St++){const zt=Math.sqrt(Zt[St])-Math.sqrt(Vt[St]);je[St]=Math.round(255-255*(zt/this.radius+this.cutoff))}return bt}};const De=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new class{constructor(){this.specification=i.spec.light.position}possiblyEvaluate(M,h){return i.sphericalToCartesian(M.expression.evaluate(h))}interpolate(M,h,_){return{x:i.number(M.x,h.x,_),y:i.number(M.y,h.y,_),z:i.number(M.z,h.z,_)}}},color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),Je="-transition";class Fe extends i.Evented{constructor(h){super(),this._transitionable=new i.Transitionable(De),this.setLight(h),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(h,_={}){if(!this._validate(i.validateLight,h,_))for(const T in h){const F=h[T];T.endsWith(Je)?this._transitionable.setTransition(T.slice(0,-Je.length),F):this._transitionable.setValue(T,F)}}updateTransitions(h){this._transitioning=this._transitionable.transitioned(h,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(h){this.properties=this._transitioning.possiblyEvaluate(h)}_validate(h,_,T){return(!T||T.validate!==!1)&&i.emitValidationErrors(this,h.call(i.validateStyle,i.extend({value:_,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}class Ge{constructor(h,_){this.width=h,this.height=_,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(h,_){const T=h.join(",")+String(_);return this.dashEntry[T]||(this.dashEntry[T]=this.addDash(h,_)),this.dashEntry[T]}getDashRanges(h,_,T){const F=[];let O=h.length%2==1?-h[h.length-1]*T:0,K=h[0]*T,oe=!0;F.push({left:O,right:K,isDash:oe,zeroLength:h[0]===0});let ue=h[0];for(let ve=1;ve<h.length;ve++){oe=!oe;const Te=h[ve];O=ue*T,ue+=Te,K=ue*T,F.push({left:O,right:K,isDash:oe,zeroLength:Te===0})}return F}addRoundDash(h,_,T){const F=_/2;for(let O=-T;O<=T;O++){const K=this.width*(this.nextRow+T+O);let oe=0,ue=h[oe];for(let ve=0;ve<this.width;ve++){ve/ue.right>1&&(ue=h[++oe]);const Te=Math.abs(ve-ue.left),ze=Math.abs(ve-ue.right),je=Math.min(Te,ze);let bt;const mt=O/T*(F+1);if(ue.isDash){const gt=F-Math.abs(mt);bt=Math.sqrt(je*je+gt*gt)}else bt=F-Math.sqrt(je*je+mt*mt);this.data[K+ve]=Math.max(0,Math.min(255,bt+128))}}}addRegularDash(h){for(let oe=h.length-1;oe>=0;--oe){const ue=h[oe],ve=h[oe+1];ue.zeroLength?h.splice(oe,1):ve&&ve.isDash===ue.isDash&&(ve.left=ue.left,h.splice(oe,1))}const _=h[0],T=h[h.length-1];_.isDash===T.isDash&&(_.left=T.left-this.width,T.right=_.right+this.width);const F=this.width*this.nextRow;let O=0,K=h[O];for(let oe=0;oe<this.width;oe++){oe/K.right>1&&(K=h[++O]);const ue=Math.abs(oe-K.left),ve=Math.abs(oe-K.right),Te=Math.min(ue,ve);this.data[F+oe]=Math.max(0,Math.min(255,(K.isDash?Te:-Te)+128))}}addDash(h,_){const T=_?7:0,F=2*T+1;if(this.nextRow+F>this.height)return i.warnOnce("LineAtlas out of space"),null;let O=0;for(let oe=0;oe<h.length;oe++)O+=h[oe];if(O!==0){const oe=this.width/O,ue=this.getDashRanges(h,this.width,oe);_?this.addRoundDash(ue,oe,T):this.addRegularDash(ue)}const K={y:(this.nextRow+T+.5)/this.height,height:2*T/this.height,width:O};return this.nextRow+=F,this.dirty=!0,K}bind(h){const _=h.gl;this.texture?(_.bindTexture(_.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,_.texSubImage2D(_.TEXTURE_2D,0,0,0,this.width,this.height,_.ALPHA,_.UNSIGNED_BYTE,this.data))):(this.texture=_.createTexture(),_.bindTexture(_.TEXTURE_2D,this.texture),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.REPEAT),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.REPEAT),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR),_.texImage2D(_.TEXTURE_2D,0,_.ALPHA,this.width,this.height,0,_.ALPHA,_.UNSIGNED_BYTE,this.data))}}class Et{constructor(h,_){this.workerPool=h,this.actors=[],this.currentActor=0,this.id=i.uniqueId();const T=this.workerPool.acquire(this.id);for(let F=0;F<T.length;F++){const O=new Et.Actor(T[F],_,this.id);O.name=`Worker ${F}`,this.actors.push(O)}if(!this.actors.length)throw new Error("No actors found")}broadcast(h,_,T){i.asyncAll(this.actors,(F,O)=>{F.send(h,_,O)},T=T||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(h=>{h.remove()}),this.actors=[],this.workerPool.release(this.id)}}function li(M,h,_){const T=function(F,O){if(F)return _(F);if(O){const K=i.pick(i.extend(O,M),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);O.vector_layers&&(K.vectorLayers=O.vector_layers,K.vectorLayerIds=K.vectorLayers.map(oe=>oe.id)),_(null,K)}};return M.url?i.getJSON(h.transformRequest(M.url,i.ResourceType.Source),T):i.exported.frame(()=>T(null,M))}Et.Actor=i.Actor;class xi{constructor(h,_,T){this.bounds=i.LngLatBounds.convert(this.validateBounds(h)),this.minzoom=_||0,this.maxzoom=T||24}validateBounds(h){return Array.isArray(h)&&h.length===4?[Math.max(-180,h[0]),Math.max(-90,h[1]),Math.min(180,h[2]),Math.min(90,h[3])]:[-180,-90,180,90]}contains(h){const _=Math.pow(2,h.z),T=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*_),F=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*_),O=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*_),K=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*_);return h.x>=T&&h.x<O&&h.y>=F&&h.y<K}}class te extends i.Evented{constructor(h,_,T,F){if(super(),this.id=h,this.dispatcher=T,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(_,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},_),this._collectResourceTiming=_.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(F)}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=li(this._options,this.map._requestManager,(h,_)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),h?this.fire(new i.ErrorEvent(h)):_&&(i.extend(this,_),_.bounds&&(this.tileBounds=new xi(_.bounds,this.minzoom,this.maxzoom)),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)}onAdd(h){this.map=h,this.load()}setSourceProperty(h){this._tileJSONRequest&&this._tileJSONRequest.cancel(),h(),this.load()}setTiles(h){return this.setSourceProperty(()=>{this._options.tiles=h}),this}setUrl(h){return this.setSourceProperty(()=>{this.url=h,this._options.url=h}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(h,_){const T=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),F={request:this.map._requestManager.transformRequest(T,i.ResourceType.Tile),uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,tileSize:this.tileSize*h.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function O(K,oe){return delete h.request,h.aborted?_(null):K&&K.status!==404?_(K):(oe&&oe.resourceTiming&&(h.resourceTiming=oe.resourceTiming),this.map._refreshExpiredTiles&&oe&&h.setExpiryData(oe),h.loadVectorData(oe,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),_(null),void(h.reloadCallback&&(this.loadTile(h,h.reloadCallback),h.reloadCallback=null)))}F.request.collectResourceTiming=this._collectResourceTiming,h.actor&&h.state!=="expired"?h.state==="loading"?h.reloadCallback=_:h.request=h.actor.send("reloadTile",F,O.bind(this)):(h.actor=this.dispatcher.getActor(),h.request=h.actor.send("loadTile",F,O.bind(this)))}abortTile(h){h.request&&(h.request.cancel(),delete h.request),h.actor&&h.actor.send("abortTile",{uid:h.uid,type:this.type,source:this.id},void 0)}unloadTile(h){h.unloadVectorData(),h.actor&&h.actor.send("removeTile",{uid:h.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class le extends i.Evented{constructor(h,_,T,F){super(),this.id=h,this.dispatcher=T,this.setEventedParent(F),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},_),i.extend(this,i.pick(_,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=li(this._options,this.map._requestManager,(h,_)=>{this._tileJSONRequest=null,this._loaded=!0,h?this.fire(new i.ErrorEvent(h)):_&&(i.extend(this,_),_.bounds&&(this.tileBounds=new xi(_.bounds,this.minzoom,this.maxzoom)),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(h){this.map=h,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)}loadTile(h,_){const T=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);h.request=i.getImage(this.map._requestManager.transformRequest(T,i.ResourceType.Tile),(F,O,K)=>{if(delete h.request,h.aborted)h.state="unloaded",_(null);else if(F)h.state="errored",_(F);else if(O){this.map._refreshExpiredTiles&&h.setExpiryData(K);const oe=this.map.painter.context,ue=oe.gl;h.texture=this.map.painter.getTileTexture(O.width),h.texture?h.texture.update(O,{useMipmap:!0}):(h.texture=new Y(oe,O,ue.RGBA,{useMipmap:!0}),h.texture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE,ue.LINEAR_MIPMAP_NEAREST),oe.extTextureFilterAnisotropic&&ue.texParameterf(ue.TEXTURE_2D,oe.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,oe.extTextureFilterAnisotropicMax)),h.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),_(null)}})}abortTile(h,_){h.request&&(h.request.cancel(),delete h.request),_()}unloadTile(h,_){h.texture&&this.map.painter.saveTileTexture(h.texture),_()}hasTransition(){return!1}}let ye;class xe extends le{constructor(h,_,T,F){super(h,_,T,F),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},_),this.encoding=_.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(h,_){const T=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function F(O,K){O&&(h.state="errored",_(O)),K&&(h.dem=K,h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0,h.state="loaded",_(null))}h.request=i.getImage(this.map._requestManager.transformRequest(T,i.ResourceType.Tile),function(O,K){if(delete h.request,h.aborted)h.state="unloaded",_(null);else if(O)h.state="errored",_(O);else if(K){this.map._refreshExpiredTiles&&h.setExpiryData(K),delete K.cacheControl,delete K.expires;const oe=i.isImageBitmap(K)&&(ye==null&&(ye=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ye)?K:i.exported.getImageData(K,1),ue={uid:h.uid,coord:h.tileID,source:this.id,rawImageData:oe,encoding:this.encoding};h.actor&&h.state!=="expired"||(h.actor=this.dispatcher.getActor(),h.actor.send("loadDEMTile",ue,F.bind(this)))}}.bind(this)),h.neighboringTiles=this._getNeighboringTiles(h.tileID)}_getNeighboringTiles(h){const _=h.canonical,T=Math.pow(2,_.z),F=(_.x-1+T)%T,O=_.x===0?h.wrap-1:h.wrap,K=(_.x+1+T)%T,oe=_.x+1===T?h.wrap+1:h.wrap,ue={};return ue[new i.OverscaledTileID(h.overscaledZ,O,_.z,F,_.y).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,oe,_.z,K,_.y).key]={backfilled:!1},_.y>0&&(ue[new i.OverscaledTileID(h.overscaledZ,O,_.z,F,_.y-1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,h.wrap,_.z,_.x,_.y-1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,oe,_.z,K,_.y-1).key]={backfilled:!1}),_.y+1<T&&(ue[new i.OverscaledTileID(h.overscaledZ,O,_.z,F,_.y+1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,h.wrap,_.z,_.x,_.y+1).key]={backfilled:!1},ue[new i.OverscaledTileID(h.overscaledZ,oe,_.z,K,_.y+1).key]={backfilled:!1}),ue}unloadTile(h){h.demTexture&&this.map.painter.saveTileTexture(h.demTexture),h.fbo&&(h.fbo.destroy(),delete h.fbo),h.dem&&delete h.dem,delete h.neighboringTiles,h.state="unloaded",h.actor&&h.actor.send("removeDEMTile",{uid:h.uid,source:this.id})}}class Re extends i.Evented{constructor(h,_,T,F){super(),this.id=h,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=T.getActor(),this.setEventedParent(F),this._data=_.data,this._options=i.extend({},_),this._collectResourceTiming=_.collectResourceTiming,_.maxzoom!==void 0&&(this.maxzoom=_.maxzoom),_.type&&(this.type=_.type),_.attribution&&(this.attribution=_.attribution),this.promoteId=_.promoteId;const O=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:_.cluster||!1,geojsonVtOptions:{buffer:(_.buffer!==void 0?_.buffer:128)*O,tolerance:(_.tolerance!==void 0?_.tolerance:.375)*O,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:_.lineMetrics||!1,generateId:_.generateId||!1},superclusterOptions:{maxZoom:_.clusterMaxZoom!==void 0?_.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,_.clusterMinPoints||2),extent:i.EXTENT,radius:(_.clusterRadius||50)*O,log:!1,generateId:_.generateId||!1},clusterProperties:_.clusterProperties,filter:_.filter},_.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(h){this.map=h,this.load()}setData(h){return this._data=h,this._updateWorkerData("content"),this}getClusterExpansionZoom(h,_){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:h,source:this.id},_),this}getClusterChildren(h,_){return this.actor.send("geojson.getClusterChildren",{clusterId:h,source:this.id},_),this}getClusterLeaves(h,_,T,F){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:h,limit:_,offset:T},F),this}_updateWorkerData(h){const _=i.extend({},this.workerOptions),T=this._data;typeof T=="string"?(_.request=this.map._requestManager.transformRequest(i.exported.resolveURL(T),i.ResourceType.Source),_.request.collectResourceTiming=this._collectResourceTiming):_.data=JSON.stringify(T),this._pendingLoads++,this.fire(new i.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,_,(F,O)=>{if(this._pendingLoads--,this._removed||O&&O.abandoned)return void this.fire(new i.Event("dataabort",{dataType:"source",sourceDataType:h}));let K=null;if(O&&O.resourceTiming&&O.resourceTiming[this.id]&&(K=O.resourceTiming[this.id].slice(0)),F)return void this.fire(new i.ErrorEvent(F));const oe={dataType:"source",sourceDataType:h};this._collectResourceTiming&&K&&K.length>0&&i.extend(oe,{resourceTiming:K}),this.fire(new i.Event("data",oe))})}loaded(){return this._pendingLoads===0}loadTile(h,_){const T=h.actor?"reloadTile":"loadTile";h.actor=this.actor;const F={type:this.type,uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};h.request=this.actor.send(T,F,(O,K)=>(delete h.request,h.unloadVectorData(),h.aborted?_(null):O?_(O):(h.loadVectorData(K,this.map.painter,T==="reloadTile"),_(null))))}abortTile(h){h.request&&(h.request.cancel(),delete h.request),h.aborted=!0}unloadTile(h){h.unloadVectorData(),this.actor.send("removeTile",{uid:h.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Oe=i.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class We extends i.Evented{constructor(h,_,T,F){super(),this.id=h,this.dispatcher=T,this.coordinates=_.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(F),this.options=_}load(h,_){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(T,F)=>{this._loaded=!0,T?this.fire(new i.ErrorEvent(T)):F&&(this.image=F,h&&(this.coordinates=h),_&&_(),this._finishLoading())})}loaded(){return this._loaded}updateImage(h){return this.image&&h.url?(this.options.url=h.url,this.load(h.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(h){this.map=h,this.load()}setCoordinates(h){this.coordinates=h;const _=h.map(i.MercatorCoordinate.fromLngLat);this.tileID=function(F){let O=1/0,K=1/0,oe=-1/0,ue=-1/0;for(const je of F)O=Math.min(O,je.x),K=Math.min(K,je.y),oe=Math.max(oe,je.x),ue=Math.max(ue,je.y);const ve=Math.max(oe-O,ue-K),Te=Math.max(0,Math.floor(-Math.log(ve)/Math.LN2)),ze=Math.pow(2,Te);return new i.CanonicalTileID(Te,Math.floor((O+oe)/2*ze),Math.floor((K+ue)/2*ze))}(_),this.minzoom=this.maxzoom=this.tileID.z;const T=_.map(F=>this.tileID.getTilePoint(F)._round());return this._boundsArray=new i.RasterBoundsArray,this._boundsArray.emplaceBack(T[0].x,T[0].y,0,0),this._boundsArray.emplaceBack(T[1].x,T[1].y,i.EXTENT,0),this._boundsArray.emplaceBack(T[3].x,T[3].y,0,i.EXTENT),this._boundsArray.emplaceBack(T[2].x,T[2].y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const h=this.map.painter.context,_=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,Oe.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Y(h,this.image,_.RGBA),this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE));for(const T in this.tiles){const F=this.tiles[T];F.state!=="loaded"&&(F.state="loaded",F.texture=this.texture)}}loadTile(h,_){this.tileID&&this.tileID.equals(h.tileID.canonical)?(this.tiles[String(h.tileID.wrap)]=h,h.buckets={},_(null)):(h.state="errored",_(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Ve extends We{constructor(h,_,T,F){super(h,_,T,F),this.roundZoom=!0,this.type="video",this.options=_}load(){this._loaded=!1;const h=this.options;this.urls=[];for(const _ of h.urls)this.urls.push(this.map._requestManager.transformRequest(_,i.ResourceType.Source).url);i.getVideo(this.urls,(_,T)=>{this._loaded=!0,_?this.fire(new i.ErrorEvent(_)):T&&(this.video=T,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(h){if(this.video){const _=this.video.seekable;h<_.start(0)||h>_.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${_.start(0)} and ${_.end(0)}-second mark.`))):this.video.currentTime=h}}getVideo(){return this.video}onAdd(h){this.map||(this.map=h,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const h=this.map.painter.context,_=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,Oe.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE),_.texSubImage2D(_.TEXTURE_2D,0,0,0,_.RGBA,_.UNSIGNED_BYTE,this.video)):(this.texture=new Y(h,this.video,_.RGBA),this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE));for(const T in this.tiles){const F=this.tiles[T];F.state!=="loaded"&&(F.state="loaded",F.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Qe extends We{constructor(h,_,T,F){super(h,_,T,F),_.coordinates?Array.isArray(_.coordinates)&&_.coordinates.length===4&&!_.coordinates.some(O=>!Array.isArray(O)||O.length!==2||O.some(K=>typeof K!="number"))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'missing required property "coordinates"'))),_.animate&&typeof _.animate!="boolean"&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'optional "animate" property must be a boolean value'))),_.canvas?typeof _.canvas=="string"||_.canvas instanceof HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${h}`,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 i.ErrorEvent(new i.ValidationError(`sources.${h}`,null,'missing required property "canvas"'))),this.options=_,this.animate=_.animate===void 0||_.animate}load(){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 i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(h){this.map=h,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let h=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,h=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,h=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const _=this.map.painter.context,T=_.gl;this.boundsBuffer||(this.boundsBuffer=_.createVertexBuffer(this._boundsArray,Oe.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(h||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Y(_,this.canvas,T.RGBA,{premultiply:!0});for(const F in this.tiles){const O=this.tiles[F];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const h of[this.canvas.width,this.canvas.height])if(isNaN(h)||h<=0)return!0;return!1}}const Se={vector:te,raster:le,"raster-dem":xe,geojson:Re,video:Ve,image:We,canvas:Qe};function Ke(M,h){const _=i.create();return i.translate(_,_,[1,1,0]),i.scale(_,_,[.5*M.width,.5*M.height,1]),i.multiply(_,_,M.calculatePosMatrix(h.toUnwrapped()))}function nt(M,h,_,T,F,O){const K=function(ze,je,bt){if(ze)for(const mt of ze){const gt=je[mt];if(gt&&gt.source===bt&&gt.type==="fill-extrusion")return!0}else for(const mt in je){const gt=je[mt];if(gt.source===bt&&gt.type==="fill-extrusion")return!0}return!1}(F&&F.layers,h,M.id),oe=O.maxPitchScaleFactor(),ue=M.tilesIn(T,oe,K);ue.sort(vt);const ve=[];for(const ze of ue)ve.push({wrappedTileID:ze.tileID.wrapped().key,queryResults:ze.tile.queryRenderedFeatures(h,_,M._state,ze.queryGeometry,ze.cameraQueryGeometry,ze.scale,F,O,oe,Ke(M.transform,ze.tileID))});const Te=function(ze){const je={},bt={};for(const mt of ze){const gt=mt.queryResults,Vt=mt.wrappedTileID,Zt=bt[Vt]=bt[Vt]||{};for(const ni in gt){const St=gt[ni],zt=Zt[ni]=Zt[ni]||{},ai=je[ni]=je[ni]||[];for(const Ei of St)zt[Ei.featureIndex]||(zt[Ei.featureIndex]=!0,ai.push(Ei))}}return je}(ve);for(const ze in Te)Te[ze].forEach(je=>{const bt=je.feature,mt=M.getFeatureState(bt.layer["source-layer"],bt.id);bt.source=bt.layer.source,bt.layer["source-layer"]&&(bt.sourceLayer=bt.layer["source-layer"]),bt.state=mt});return Te}function vt(M,h){const _=M.tileID,T=h.tileID;return _.overscaledZ-T.overscaledZ||_.canonical.y-T.canonical.y||_.wrap-T.wrap||_.canonical.x-T.canonical.x}class be{constructor(h,_){this.tileID=h,this.uid=i.uniqueId(),this.uses=0,this.tileSize=_,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(h){const _=h+this.timeAdded;_<i.exported.now()||this.fadeEndTime&&_<this.fadeEndTime||(this.fadeEndTime=_)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(h){this.demTexture&&h.saveTileTexture(this.demTexture),this.textures.forEach(_=>h.saveTileTexture(_)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(h,_,T){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",h){h.featureIndex&&(this.latestFeatureIndex=h.featureIndex,h.rawTileData?(this.latestRawTileData=h.rawTileData,this.latestFeatureIndex.rawTileData=h.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=h.collisionBoxArray,this.buckets=function(F,O){const K={};if(!O)return K;for(const oe of F){const ue=oe.layerIds.map(ve=>O.getLayer(ve)).filter(Boolean);if(ue.length!==0){oe.layers=ue,oe.stateDependentLayerIds&&(oe.stateDependentLayers=oe.stateDependentLayerIds.map(ve=>ue.filter(Te=>Te.id===ve)[0]));for(const ve of ue)K[ve.id]=oe}}return K}(h.buckets,_.style),this.hasSymbolBuckets=!1;for(const F in this.buckets){const O=this.buckets[F];if(O instanceof i.SymbolBucket){if(this.hasSymbolBuckets=!0,!T)break;O.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const F in this.buckets){const O=this.buckets[F];if(O instanceof i.SymbolBucket&&O.hasRTLText){this.hasRTLText=!0,i.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const F in this.buckets){const O=this.buckets[F];this.queryPadding=Math.max(this.queryPadding,_.style.getLayer(F).queryRadius(O))}h.imageAtlas&&(this.imageAtlas=h.imageAtlas),h.glyphAtlasImage&&(this.glyphAtlasImage=h.glyphAtlasImage)}else this.collisionBoxArray=new i.CollisionBoxArray}unloadVectorData(){for(const h in this.buckets)this.buckets[h].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(h){return this.buckets[h.id]}upload(h){for(const T in this.buckets){const F=this.buckets[T];F.uploadPending()&&F.upload(h)}const _=h.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Y(h,this.imageAtlas.image,_.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Y(h,this.glyphAtlasImage,_.ALPHA),this.glyphAtlasImage=null)}prepare(h){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(h,this.imageAtlasTexture)}queryRenderedFeatures(h,_,T,F,O,K,oe,ue,ve,Te){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:F,cameraQueryGeometry:O,scale:K,tileSize:this.tileSize,pixelPosMatrix:Te,transform:ue,params:oe,queryPadding:this.queryPadding*ve},h,_,T):{}}querySourceFeatures(h,_){const T=this.latestFeatureIndex;if(!T||!T.rawTileData)return;const F=T.loadVTLayers(),O=_?_.sourceLayer:"",K=F._geojsonTileLayer||F[O];if(!K)return;const oe=i.createFilter(_&&_.filter),{z:ue,x:ve,y:Te}=this.tileID.canonical,ze={z:ue,x:ve,y:Te};for(let je=0;je<K.length;je++){const bt=K.feature(je);if(oe.needGeometry){const Vt=i.toEvaluationFeature(bt,!0);if(!oe.filter(new i.EvaluationParameters(this.tileID.overscaledZ),Vt,this.tileID.canonical))continue}else if(!oe.filter(new i.EvaluationParameters(this.tileID.overscaledZ),bt))continue;const mt=T.getId(bt,O),gt=new i.GeoJSONFeature(bt,ue,ve,Te,mt);gt.tile=ze,h.push(gt)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(h){const _=this.expirationTime;if(h.cacheControl){const T=i.parseCacheControl(h.cacheControl);T["max-age"]&&(this.expirationTime=Date.now()+1e3*T["max-age"])}else h.expires&&(this.expirationTime=new Date(h.expires).getTime());if(this.expirationTime){const T=Date.now();let F=!1;if(this.expirationTime>T)F=!1;else if(_)if(this.expirationTime<_)F=!0;else{const O=this.expirationTime-_;O?this.expirationTime=T+Math.max(O,3e4):F=!0}else F=!0;F?(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(h,_){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(h).length===0)return;const T=this.latestFeatureIndex.loadVTLayers();for(const F in this.buckets){if(!_.style.hasLayer(F))continue;const O=this.buckets[F],K=O.layers[0].sourceLayer||"_geojsonTileLayer",oe=T[K],ue=h[K];if(!oe||!ue||Object.keys(ue).length===0)continue;O.update(ue,oe,this.imageAtlas&&this.imageAtlas.patternPositions||{});const ve=_&&_.style&&_.style.getLayer(F);ve&&(this.queryPadding=Math.max(this.queryPadding,ve.queryRadius(O)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<i.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(h){this.symbolFadeHoldUntil=i.exported.now()+h}setDependencies(h,_){const T={};for(const F of _)T[F]=!0;this.dependencies[h]=T}hasDependency(h,_){for(const T of h){const F=this.dependencies[T];if(F){for(const O of _)if(F[O])return!0}}return!1}}class At{constructor(h,_){this.max=h,this.onRemove=_,this.reset()}reset(){for(const h in this.data)for(const _ of this.data[h])_.timeout&&clearTimeout(_.timeout),this.onRemove(_.value);return this.data={},this.order=[],this}add(h,_,T){const F=h.wrapped().key;this.data[F]===void 0&&(this.data[F]=[]);const O={value:_,timeout:void 0};if(T!==void 0&&(O.timeout=setTimeout(()=>{this.remove(h,O)},T)),this.data[F].push(O),this.order.push(F),this.order.length>this.max){const K=this._getAndRemoveByKey(this.order[0]);K&&this.onRemove(K)}return this}has(h){return h.wrapped().key in this.data}getAndRemove(h){return this.has(h)?this._getAndRemoveByKey(h.wrapped().key):null}_getAndRemoveByKey(h){const _=this.data[h].shift();return _.timeout&&clearTimeout(_.timeout),this.data[h].length===0&&delete this.data[h],this.order.splice(this.order.indexOf(h),1),_.value}getByKey(h){const _=this.data[h];return _?_[0].value:null}get(h){return this.has(h)?this.data[h.wrapped().key][0].value:null}remove(h,_){if(!this.has(h))return this;const T=h.wrapped().key,F=_===void 0?0:this.data[T].indexOf(_),O=this.data[T][F];return this.data[T].splice(F,1),O.timeout&&clearTimeout(O.timeout),this.data[T].length===0&&delete this.data[T],this.onRemove(O.value),this.order.splice(this.order.indexOf(T),1),this}setMaxSize(h){for(this.max=h;this.order.length>this.max;){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}filter(h){const _=[];for(const T in this.data)for(const F of this.data[T])h(F.value)||_.push(F);for(const T of _)this.remove(T.value.tileID,T)}}class ut{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(h,_,T){const F=String(_);if(this.stateChanges[h]=this.stateChanges[h]||{},this.stateChanges[h][F]=this.stateChanges[h][F]||{},i.extend(this.stateChanges[h][F],T),this.deletedStates[h]===null){this.deletedStates[h]={};for(const O in this.state[h])O!==F&&(this.deletedStates[h][O]=null)}else if(this.deletedStates[h]&&this.deletedStates[h][F]===null){this.deletedStates[h][F]={};for(const O in this.state[h][F])T[O]||(this.deletedStates[h][F][O]=null)}else for(const O in T)this.deletedStates[h]&&this.deletedStates[h][F]&&this.deletedStates[h][F][O]===null&&delete this.deletedStates[h][F][O]}removeFeatureState(h,_,T){if(this.deletedStates[h]===null)return;const F=String(_);if(this.deletedStates[h]=this.deletedStates[h]||{},T&&_!==void 0)this.deletedStates[h][F]!==null&&(this.deletedStates[h][F]=this.deletedStates[h][F]||{},this.deletedStates[h][F][T]=null);else if(_!==void 0)if(this.stateChanges[h]&&this.stateChanges[h][F])for(T in this.deletedStates[h][F]={},this.stateChanges[h][F])this.deletedStates[h][F][T]=null;else this.deletedStates[h][F]=null;else this.deletedStates[h]=null}getState(h,_){const T=String(_),F=i.extend({},(this.state[h]||{})[T],(this.stateChanges[h]||{})[T]);if(this.deletedStates[h]===null)return{};if(this.deletedStates[h]){const O=this.deletedStates[h][_];if(O===null)return{};for(const K in O)delete F[K]}return F}initializeTileState(h,_){h.setFeatureState(this.state,_)}coalesceChanges(h,_){const T={};for(const F in this.stateChanges){this.state[F]=this.state[F]||{};const O={};for(const K in this.stateChanges[F])this.state[F][K]||(this.state[F][K]={}),i.extend(this.state[F][K],this.stateChanges[F][K]),O[K]=this.state[F][K];T[F]=O}for(const F in this.deletedStates){this.state[F]=this.state[F]||{};const O={};if(this.deletedStates[F]===null)for(const K in this.state[F])O[K]={},this.state[F][K]={};else for(const K in this.deletedStates[F]){if(this.deletedStates[F][K]===null)this.state[F][K]={};else for(const oe of Object.keys(this.deletedStates[F][K]))delete this.state[F][K][oe];O[K]=this.state[F][K]}T[F]=T[F]||{},i.extend(T[F],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(T).length!==0)for(const F in h)h[F].setFeatureState(T,_)}}class Nt extends i.Evented{constructor(h,_,T){super(),this.id=h,this.dispatcher=T,this.on("data",F=>{F.dataType==="source"&&F.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&F.dataType==="source"&&F.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(F,O,K,oe){const ue=new Se[O.type](F,O,K,oe);if(ue.id!==F)throw new Error(`Expected Source id to be ${F} instead of ${ue.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],ue),ue}(h,_,T,this),this._tiles={},this._cache=new At(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ut}onAdd(h){this.map=h,this._maxTileCacheSize=h?h._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(h)}onRemove(h){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(h)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const h in this._tiles){const _=this._tiles[h];if(_.state!=="loaded"&&_.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const h=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,h&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(h,_){return this._source.loadTile(h,_)}_unloadTile(h){if(this._source.unloadTile)return this._source.unloadTile(h,()=>{})}_abortTile(h){this._source.abortTile&&this._source.abortTile(h,()=>{}),this._source.fire(new i.Event("dataabort",{tile:h,coord:h.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(h){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const _ in this._tiles){const T=this._tiles[_];T.upload(h),T.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(h=>h.tileID).sort(Gt).map(h=>h.key)}getRenderableIds(h){const _=[];for(const T in this._tiles)this._isIdRenderable(T,h)&&_.push(this._tiles[T]);return h?_.sort((T,F)=>{const O=T.tileID,K=F.tileID,oe=new i.pointGeometry(O.canonical.x,O.canonical.y)._rotate(this.transform.angle),ue=new i.pointGeometry(K.canonical.x,K.canonical.y)._rotate(this.transform.angle);return O.overscaledZ-K.overscaledZ||ue.y-oe.y||ue.x-oe.x}).map(T=>T.tileID.key):_.map(T=>T.tileID).sort(Gt).map(T=>T.key)}hasRenderableParent(h){const _=this.findLoadedParent(h,0);return!!_&&this._isIdRenderable(_.tileID.key)}_isIdRenderable(h,_){return this._tiles[h]&&this._tiles[h].hasData()&&!this._coveredTiles[h]&&(_||!this._tiles[h].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const h in this._tiles)this._tiles[h].state!=="errored"&&this._reloadTile(h,"reloading")}}_reloadTile(h,_){const T=this._tiles[h];T&&(T.state!=="loading"&&(T.state=_),this._loadTile(T,this._tileLoaded.bind(this,T,h,_)))}_tileLoaded(h,_,T,F){if(F)return h.state="errored",void(F.status!==404?this._source.fire(new i.ErrorEvent(F,{tile:h})):this.update(this.transform,this.terrain));h.timeAdded=i.exported.now(),T==="expired"&&(h.refreshedUponExpiration=!0),this._setTileReloadTimer(_,h),this.getSource().type==="raster-dem"&&h.dem&&this._backfillDEM(h),this._state.initializeTileState(h,this.map?this.map.painter:null),h.aborted||this._source.fire(new i.Event("data",{dataType:"source",tile:h,coord:h.tileID}))}_backfillDEM(h){const _=this.getRenderableIds();for(let F=0;F<_.length;F++){const O=_[F];if(h.neighboringTiles&&h.neighboringTiles[O]){const K=this.getTileByID(O);T(h,K),T(K,h)}}function T(F,O){F.needsHillshadePrepare=!0,F.needsTerrainPrepare=!0;let K=O.tileID.canonical.x-F.tileID.canonical.x;const oe=O.tileID.canonical.y-F.tileID.canonical.y,ue=Math.pow(2,F.tileID.canonical.z),ve=O.tileID.key;K===0&&oe===0||Math.abs(oe)>1||(Math.abs(K)>1&&(Math.abs(K+ue)===1?K+=ue:Math.abs(K-ue)===1&&(K-=ue)),O.dem&&F.dem&&(F.dem.backfillBorder(O.dem,K,oe),F.neighboringTiles&&F.neighboringTiles[ve]&&(F.neighboringTiles[ve].backfilled=!0)))}}getTile(h){return this.getTileByID(h.key)}getTileByID(h){return this._tiles[h]}_retainLoadedChildren(h,_,T,F){for(const O in this._tiles){let K=this._tiles[O];if(F[O]||!K.hasData()||K.tileID.overscaledZ<=_||K.tileID.overscaledZ>T)continue;let oe=K.tileID;for(;K&&K.tileID.overscaledZ>_+1;){const ve=K.tileID.scaledTo(K.tileID.overscaledZ-1);K=this._tiles[ve.key],K&&K.hasData()&&(oe=ve)}let ue=oe;for(;ue.overscaledZ>_;)if(ue=ue.scaledTo(ue.overscaledZ-1),h[ue.key]){F[oe.key]=oe;break}}}findLoadedParent(h,_){if(h.key in this._loadedParentTiles){const T=this._loadedParentTiles[h.key];return T&&T.tileID.overscaledZ>=_?T:null}for(let T=h.overscaledZ-1;T>=_;T--){const F=h.scaledTo(T),O=this._getLoadedTile(F);if(O)return O}}_getLoadedTile(h){const _=this._tiles[h.key];return _&&_.hasData()?_:this._cache.getByKey(h.wrapped().key)}updateCacheSize(h){const _=Math.ceil(h.width/this._source.tileSize)+1,T=Math.ceil(h.height/this._source.tileSize)+1,F=Math.floor(_*T*5),O=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,F):F;this._cache.setMaxSize(O)}handleWrapJump(h){const _=Math.round((h-(this._prevLng===void 0?h:this._prevLng))/360);if(this._prevLng=h,_){const T={};for(const F in this._tiles){const O=this._tiles[F];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+_),T[O.tileID.key]=O}this._tiles=T;for(const F in this._timers)clearTimeout(this._timers[F]),delete this._timers[F];for(const F in this._tiles)this._setTileReloadTimer(F,this._tiles[F])}}update(h,_){if(this.transform=h,this.terrain=_,!this._sourceLoaded||this._paused)return;let T;this.updateCacheSize(h),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?T=h.getVisibleUnwrappedCoordinates(this._source.tileID).map(ve=>new i.OverscaledTileID(ve.canonical.z,ve.wrap,ve.canonical.z,ve.canonical.x,ve.canonical.y)):(T=h.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:_}),this._source.hasTile&&(T=T.filter(ve=>this._source.hasTile(ve)))):T=[];const F=h.coveringZoomLevel(this._source),O=Math.max(F-Nt.maxOverzooming,this._source.minzoom),K=Math.max(F+Nt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const ve={};for(const Te of T)if(Te.canonical.z>this._source.minzoom){const ze=Te.scaledTo(Te.canonical.z-1);ve[ze.key]=ze;const je=Te.scaledTo(Math.max(this._source.minzoom,Math.min(Te.canonical.z,5)));ve[je.key]=je}T=T.concat(Object.values(ve))}const oe=this._updateRetainedTiles(T,F);if(Qt(this._source.type)){const ve={},Te={},ze=Object.keys(oe);for(const je of ze){const bt=oe[je],mt=this._tiles[je];if(!mt||mt.fadeEndTime&&mt.fadeEndTime<=i.exported.now())continue;const gt=this.findLoadedParent(bt,O);gt&&(this._addTile(gt.tileID),ve[gt.tileID.key]=gt.tileID),Te[je]=bt}this._retainLoadedChildren(Te,F,K,oe);for(const je in ve)oe[je]||(this._coveredTiles[je]=!0,oe[je]=ve[je]);if(_){const je={},bt={};for(const mt of T)this._tiles[mt.key].hasData()?je[mt.key]=mt:bt[mt.key]=mt;for(const mt in bt){const gt=bt[mt].children(this._source.maxzoom);this._tiles[gt[0].key]&&this._tiles[gt[1].key]&&this._tiles[gt[2].key]&&this._tiles[gt[3].key]&&(je[gt[0].key]=oe[gt[0].key]=gt[0],je[gt[1].key]=oe[gt[1].key]=gt[1],je[gt[2].key]=oe[gt[2].key]=gt[2],je[gt[3].key]=oe[gt[3].key]=gt[3],delete bt[mt])}for(const mt in bt){const gt=this.findLoadedParent(bt[mt],this._source.minzoom);if(gt){je[gt.tileID.key]=oe[gt.tileID.key]=gt.tileID;for(const Vt in je)je[Vt].isChildOf(gt.tileID)&&delete je[Vt]}}for(const mt in this._tiles)je[mt]||(this._coveredTiles[mt]=!0)}}for(const ve in oe)this._tiles[ve].clearFadeHold();const ue=i.keysDifference(this._tiles,oe);for(const ve of ue){const Te=this._tiles[ve];Te.hasSymbolBuckets&&!Te.holdingForFade()?Te.setHoldDuration(this.map._fadeDuration):Te.hasSymbolBuckets&&!Te.symbolFadeFinished()||this._removeTile(ve)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const h in this._tiles)this._tiles[h].holdingForFade()&&this._removeTile(h)}_updateRetainedTiles(h,_){const T={},F={},O=Math.max(_-Nt.maxOverzooming,this._source.minzoom),K=Math.max(_+Nt.maxUnderzooming,this._source.minzoom),oe={};for(const ue of h){const ve=this._addTile(ue);T[ue.key]=ue,ve.hasData()||_<this._source.maxzoom&&(oe[ue.key]=ue)}this._retainLoadedChildren(oe,_,K,T);for(const ue of h){let ve=this._tiles[ue.key];if(ve.hasData())continue;if(_+1>this._source.maxzoom){const ze=ue.children(this._source.maxzoom)[0],je=this.getTile(ze);if(je&&je.hasData()){T[ze.key]=ze;continue}}else{const ze=ue.children(this._source.maxzoom);if(T[ze[0].key]&&T[ze[1].key]&&T[ze[2].key]&&T[ze[3].key])continue}let Te=ve.wasRequested();for(let ze=ue.overscaledZ-1;ze>=O;--ze){const je=ue.scaledTo(ze);if(F[je.key]||(F[je.key]=!0,ve=this.getTile(je),!ve&&Te&&(ve=this._addTile(je)),ve&&(T[je.key]=je,Te=ve.wasRequested(),ve.hasData())))break}}return T}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const h in this._tiles){const _=[];let T,F=this._tiles[h].tileID;for(;F.overscaledZ>0;){if(F.key in this._loadedParentTiles){T=this._loadedParentTiles[F.key];break}_.push(F.key);const O=F.scaledTo(F.overscaledZ-1);if(T=this._getLoadedTile(O),T)break;F=O}for(const O of _)this._loadedParentTiles[O]=T}}_addTile(h){let _=this._tiles[h.key];if(_)return _;_=this._cache.getAndRemove(h),_&&(this._setTileReloadTimer(h.key,_),_.tileID=h,this._state.initializeTileState(_,this.map?this.map.painter:null),this._cacheTimers[h.key]&&(clearTimeout(this._cacheTimers[h.key]),delete this._cacheTimers[h.key],this._setTileReloadTimer(h.key,_)));const T=_;return _||(_=new be(h,this._source.tileSize*h.overscaleFactor()),this._loadTile(_,this._tileLoaded.bind(this,_,h.key,_.state))),_.uses++,this._tiles[h.key]=_,T||this._source.fire(new i.Event("dataloading",{tile:_,coord:_.tileID,dataType:"source"})),_}_setTileReloadTimer(h,_){h in this._timers&&(clearTimeout(this._timers[h]),delete this._timers[h]);const T=_.getExpiryTimeout();T&&(this._timers[h]=setTimeout(()=>{this._reloadTile(h,"expired"),delete this._timers[h]},T))}_removeTile(h){const _=this._tiles[h];_&&(_.uses--,delete this._tiles[h],this._timers[h]&&(clearTimeout(this._timers[h]),delete this._timers[h]),_.uses>0||(_.hasData()&&_.state!=="reloading"?this._cache.add(_.tileID,_,_.getExpiryTimeout()):(_.aborted=!0,this._abortTile(_),this._unloadTile(_))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const h in this._tiles)this._removeTile(h);this._cache.reset()}tilesIn(h,_,T){const F=[],O=this.transform;if(!O)return F;const K=T?O.getCameraQueryGeometry(h):h,oe=h.map(mt=>O.pointCoordinate(mt,this.terrain)),ue=K.map(mt=>O.pointCoordinate(mt,this.terrain)),ve=this.getIds();let Te=1/0,ze=1/0,je=-1/0,bt=-1/0;for(const mt of ue)Te=Math.min(Te,mt.x),ze=Math.min(ze,mt.y),je=Math.max(je,mt.x),bt=Math.max(bt,mt.y);for(let mt=0;mt<ve.length;mt++){const gt=this._tiles[ve[mt]];if(gt.holdingForFade())continue;const Vt=gt.tileID,Zt=Math.pow(2,O.zoom-gt.tileID.overscaledZ),ni=_*gt.queryPadding*i.EXTENT/gt.tileSize/Zt,St=[Vt.getTilePoint(new i.MercatorCoordinate(Te,ze)),Vt.getTilePoint(new i.MercatorCoordinate(je,bt))];if(St[0].x-ni<i.EXTENT&&St[0].y-ni<i.EXTENT&&St[1].x+ni>=0&&St[1].y+ni>=0){const zt=oe.map(Ei=>Vt.getTilePoint(Ei)),ai=ue.map(Ei=>Vt.getTilePoint(Ei));F.push({tile:gt,tileID:Vt,queryGeometry:zt,cameraQueryGeometry:ai,scale:Zt})}}return F}getVisibleCoordinates(h){const _=this.getRenderableIds(h).map(T=>this._tiles[T].tileID);for(const T of _)T.posMatrix=this.transform.calculatePosMatrix(T.toUnwrapped());return _}hasTransition(){if(this._source.hasTransition())return!0;if(Qt(this._source.type))for(const h in this._tiles){const _=this._tiles[h];if(_.fadeEndTime!==void 0&&_.fadeEndTime>=i.exported.now())return!0}return!1}setFeatureState(h,_,T){this._state.updateState(h=h||"_geojsonTileLayer",_,T)}removeFeatureState(h,_,T){this._state.removeFeatureState(h=h||"_geojsonTileLayer",_,T)}getFeatureState(h,_){return this._state.getState(h=h||"_geojsonTileLayer",_)}setDependencies(h,_,T){const F=this._tiles[h];F&&F.setDependencies(_,T)}reloadTilesForDependencies(h,_){for(const T in this._tiles)this._tiles[T].hasDependency(h,_)&&this._reloadTile(T,"reloading");this._cache.filter(T=>!T.hasDependency(h,_))}}function Gt(M,h){const _=Math.abs(2*M.wrap)-+(M.wrap<0),T=Math.abs(2*h.wrap)-+(h.wrap<0);return M.overscaledZ-h.overscaledZ||T-_||h.canonical.y-M.canonical.y||h.canonical.x-M.canonical.x}function Qt(M){return M==="raster"||M==="image"||M==="video"}Nt.maxOverzooming=10,Nt.maxUnderzooming=3;const Ct="mapboxgl_preloaded_worker_pool";class Ft{constructor(){this.active={}}acquire(h){if(!this.workers)for(this.workers=[];this.workers.length<Ft.workerCount;)this.workers.push(new Worker(xl.workerUrl));return this.active[h]=!0,this.workers.slice()}release(h){delete this.active[h],this.numActive()===0&&(this.workers.forEach(_=>{_.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ct]}numActive(){return Object.keys(this.active).length}}const Xt=Math.floor(i.exported.hardwareConcurrency/2);let _i;function fi(){return _i||(_i=new Ft),_i}function Gi(M,h){const _={};for(const T in M)T!=="ref"&&(_[T]=M[T]);return i.refProperties.forEach(T=>{T in h&&(_[T]=h[T])}),_}function wn(M){M=M.slice();const h=Object.create(null);for(let _=0;_<M.length;_++)h[M[_].id]=M[_];for(let _=0;_<M.length;_++)"ref"in M[_]&&(M[_]=Gi(M[_],h[M[_].ref]));return M}Ft.workerCount=Math.max(Math.min(Xt,6),1);const zi={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Gn(M,h,_){_.push({command:zi.addSource,args:[M,h[M]]})}function kn(M,h,_){h.push({command:zi.removeSource,args:[M]}),_[M]=!0}function yt(M,h,_,T){kn(M,_,T),Gn(M,h,_)}function rt(M,h,_){let T;for(T in M[_])if(Object.prototype.hasOwnProperty.call(M[_],T)&&T!=="data"&&!Q(M[_][T],h[_][T]))return!1;for(T in h[_])if(Object.prototype.hasOwnProperty.call(h[_],T)&&T!=="data"&&!Q(M[_][T],h[_][T]))return!1;return!0}function ti(M,h,_,T,F,O){let K;for(K in h=h||{},M=M||{})Object.prototype.hasOwnProperty.call(M,K)&&(Q(M[K],h[K])||_.push({command:O,args:[T,K,h[K],F]}));for(K in h)Object.prototype.hasOwnProperty.call(h,K)&&!Object.prototype.hasOwnProperty.call(M,K)&&(Q(M[K],h[K])||_.push({command:O,args:[T,K,h[K],F]}))}function Ni(M){return M.id}function qi(M,h){return M[h.id]=h,M}class en{constructor(h,_){this.reset(h,_)}reset(h,_){this.points=h||[],this._distances=[0];for(let T=1;T<this.points.length;T++)this._distances[T]=this._distances[T-1]+this.points[T].dist(this.points[T-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(_||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(h){if(this.points.length===1)return this.points[0];h=i.clamp(h,0,1);let _=1,T=this._distances[_];const F=h*this.paddedLength+this.padding;for(;T<F&&_<this._distances.length;)T=this._distances[++_];const O=_-1,K=this._distances[O],oe=T-K,ue=oe>0?(F-K)/oe:0;return this.points[O].mult(1-ue).add(this.points[_].mult(ue))}}function $t(M,h){let _=!0;return M==="always"||M!=="never"&&h!=="never"||(_=!1),_}class at{constructor(h,_,T){const F=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(h/T),this.yCellCount=Math.ceil(_/T);for(let K=0;K<this.xCellCount*this.yCellCount;K++)F.push([]),O.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=h,this.height=_,this.xScale=this.xCellCount/h,this.yScale=this.yCellCount/_,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(h,_,T,F,O){this._forEachCell(_,T,F,O,this._insertBoxCell,this.boxUid++),this.boxKeys.push(h),this.bboxes.push(_),this.bboxes.push(T),this.bboxes.push(F),this.bboxes.push(O)}insertCircle(h,_,T,F){this._forEachCell(_-F,T-F,_+F,T+F,this._insertCircleCell,this.circleUid++),this.circleKeys.push(h),this.circles.push(_),this.circles.push(T),this.circles.push(F)}_insertBoxCell(h,_,T,F,O,K){this.boxCells[O].push(K)}_insertCircleCell(h,_,T,F,O,K){this.circleCells[O].push(K)}_query(h,_,T,F,O,K,oe){if(T<0||h>this.width||F<0||_>this.height)return[];const ue=[];if(h<=0&&_<=0&&this.width<=T&&this.height<=F){if(O)return[{key:null,x1:h,y1:_,x2:T,y2:F}];for(let ve=0;ve<this.boxKeys.length;ve++)ue.push({key:this.boxKeys[ve],x1:this.bboxes[4*ve],y1:this.bboxes[4*ve+1],x2:this.bboxes[4*ve+2],y2:this.bboxes[4*ve+3]});for(let ve=0;ve<this.circleKeys.length;ve++){const Te=this.circles[3*ve],ze=this.circles[3*ve+1],je=this.circles[3*ve+2];ue.push({key:this.circleKeys[ve],x1:Te-je,y1:ze-je,x2:Te+je,y2:ze+je})}}else this._forEachCell(h,_,T,F,this._queryCell,ue,{hitTest:O,overlapMode:K,seenUids:{box:{},circle:{}}},oe);return ue}query(h,_,T,F){return this._query(h,_,T,F,!1,null)}hitTest(h,_,T,F,O,K){return this._query(h,_,T,F,!0,O,K).length>0}hitTestCircle(h,_,T,F,O){const K=h-T,oe=h+T,ue=_-T,ve=_+T;if(oe<0||K>this.width||ve<0||ue>this.height)return!1;const Te=[];return this._forEachCell(K,ue,oe,ve,this._queryCellCircle,Te,{hitTest:!0,overlapMode:F,circle:{x:h,y:_,radius:T},seenUids:{box:{},circle:{}}},O),Te.length>0}_queryCell(h,_,T,F,O,K,oe,ue){const{seenUids:ve,hitTest:Te,overlapMode:ze}=oe,je=this.boxCells[O];if(je!==null){const mt=this.bboxes;for(const gt of je)if(!ve.box[gt]){ve.box[gt]=!0;const Vt=4*gt,Zt=this.boxKeys[gt];if(h<=mt[Vt+2]&&_<=mt[Vt+3]&&T>=mt[Vt+0]&&F>=mt[Vt+1]&&(!ue||ue(Zt))&&(!Te||!$t(ze,Zt.overlapMode))&&(K.push({key:Zt,x1:mt[Vt],y1:mt[Vt+1],x2:mt[Vt+2],y2:mt[Vt+3]}),Te))return!0}}const bt=this.circleCells[O];if(bt!==null){const mt=this.circles;for(const gt of bt)if(!ve.circle[gt]){ve.circle[gt]=!0;const Vt=3*gt,Zt=this.circleKeys[gt];if(this._circleAndRectCollide(mt[Vt],mt[Vt+1],mt[Vt+2],h,_,T,F)&&(!ue||ue(Zt))&&(!Te||!$t(ze,Zt.overlapMode))){const ni=mt[Vt],St=mt[Vt+1],zt=mt[Vt+2];if(K.push({key:Zt,x1:ni-zt,y1:St-zt,x2:ni+zt,y2:St+zt}),Te)return!0}}}return!1}_queryCellCircle(h,_,T,F,O,K,oe,ue){const{circle:ve,seenUids:Te,overlapMode:ze}=oe,je=this.boxCells[O];if(je!==null){const mt=this.bboxes;for(const gt of je)if(!Te.box[gt]){Te.box[gt]=!0;const Vt=4*gt,Zt=this.boxKeys[gt];if(this._circleAndRectCollide(ve.x,ve.y,ve.radius,mt[Vt+0],mt[Vt+1],mt[Vt+2],mt[Vt+3])&&(!ue||ue(Zt))&&!$t(ze,Zt.overlapMode))return K.push(!0),!0}}const bt=this.circleCells[O];if(bt!==null){const mt=this.circles;for(const gt of bt)if(!Te.circle[gt]){Te.circle[gt]=!0;const Vt=3*gt,Zt=this.circleKeys[gt];if(this._circlesCollide(mt[Vt],mt[Vt+1],mt[Vt+2],ve.x,ve.y,ve.radius)&&(!ue||ue(Zt))&&!$t(ze,Zt.overlapMode))return K.push(!0),!0}}}_forEachCell(h,_,T,F,O,K,oe,ue){const ve=this._convertToXCellCoord(h),Te=this._convertToYCellCoord(_),ze=this._convertToXCellCoord(T),je=this._convertToYCellCoord(F);for(let bt=ve;bt<=ze;bt++)for(let mt=Te;mt<=je;mt++)if(O.call(this,h,_,T,F,this.xCellCount*mt+bt,K,oe,ue))return}_convertToXCellCoord(h){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(h*this.xScale)))}_convertToYCellCoord(h){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(h*this.yScale)))}_circlesCollide(h,_,T,F,O,K){const oe=F-h,ue=O-_,ve=T+K;return ve*ve>oe*oe+ue*ue}_circleAndRectCollide(h,_,T,F,O,K,oe){const ue=(K-F)/2,ve=Math.abs(h-(F+ue));if(ve>ue+T)return!1;const Te=(oe-O)/2,ze=Math.abs(_-(O+Te));if(ze>Te+T)return!1;if(ve<=ue||ze<=Te)return!0;const je=ve-ue,bt=ze-Te;return je*je+bt*bt<=T*T}}function ii(M,h,_,T,F){const O=i.create();return h?(i.scale(O,O,[1/F,1/F,1]),_||i.rotateZ(O,O,T.angle)):i.multiply(O,T.labelPlaneMatrix,M),O}function hn(M,h,_,T,F){if(h){const O=i.clone(M);return i.scale(O,O,[F,F,1]),_||i.rotateZ(O,O,-T.angle),O}return T.glCoordMatrix}function Xi(M,h,_){let T;_?(T=[M.x,M.y,_(M.x,M.y),1],i.transformMat4(T,T,h)):(T=[M.x,M.y,0,1],Pn(T,T,h));const F=T[3];return{point:new i.pointGeometry(T[0]/F,T[1]/F),signedDistanceFromCamera:F}}function on(M,h){return .5+M/h*.5}function Cn(M,h){const _=M[0]/M[3],T=M[1]/M[3];return _>=-h[0]&&_<=h[0]&&T>=-h[1]&&T<=h[1]}function Tn(M,h,_,T,F,O,K,oe,ue,ve){const Te=T?M.textSizeData:M.iconSizeData,ze=i.evaluateSizeForZoom(Te,_.transform.zoom),je=[256/_.width*2+1,256/_.height*2+1],bt=T?M.text.dynamicLayoutVertexArray:M.icon.dynamicLayoutVertexArray;bt.clear();const mt=M.lineVertexArray,gt=T?M.text.placedSymbolArray:M.icon.placedSymbolArray,Vt=_.transform.width/_.transform.height;let Zt=!1;for(let ni=0;ni<gt.length;ni++){const St=gt.get(ni);if(St.hidden||St.writingMode===i.WritingMode.vertical&&!Zt){Ui(St.numGlyphs,bt);continue}let zt;if(Zt=!1,ve?(zt=[St.anchorX,St.anchorY,ve(St.anchorX,St.anchorY),1],i.transformMat4(zt,zt,h)):(zt=[St.anchorX,St.anchorY,0,1],Pn(zt,zt,h)),!Cn(zt,je)){Ui(St.numGlyphs,bt);continue}const ai=on(_.transform.cameraToCenterDistance,zt[3]),Ei=i.evaluateSizeForFeature(Te,ze,St),Bi=K?Ei/ai:Ei*ai,Hi=new i.pointGeometry(St.anchorX,St.anchorY),vi=Xi(Hi,F,ve).point,xn={},cn=bn(St,Bi,!1,oe,h,F,O,M.glyphOffsetArray,mt,bt,vi,Hi,xn,Vt,ue,ve);Zt=cn.useVertical,(cn.notEnoughRoom||Zt||cn.needsFlipping&&bn(St,Bi,!0,oe,h,F,O,M.glyphOffsetArray,mt,bt,vi,Hi,xn,Vt,ue,ve).notEnoughRoom)&&Ui(St.numGlyphs,bt)}T?M.text.dynamicLayoutVertexBuffer.updateData(bt):M.icon.dynamicLayoutVertexBuffer.updateData(bt)}function nr(M,h,_,T,F,O,K,oe,ue,ve,Te,ze,je){const bt=oe.glyphStartIndex+oe.numGlyphs,mt=oe.lineStartIndex,gt=oe.lineStartIndex+oe.lineLength,Vt=h.getoffsetX(oe.glyphStartIndex),Zt=h.getoffsetX(bt-1),ni=wi(M*Vt,_,T,F,O,K,oe.segment,mt,gt,ue,ve,Te,ze,je);if(!ni)return null;const St=wi(M*Zt,_,T,F,O,K,oe.segment,mt,gt,ue,ve,Te,ze,je);return St?{first:ni,last:St}:null}function Ii(M,h,_,T){return M===i.WritingMode.horizontal&&Math.abs(_.y-h.y)>Math.abs(_.x-h.x)*T?{useVertical:!0}:(M===i.WritingMode.vertical?h.y<_.y:h.x>_.x)?{needsFlipping:!0}:null}function bn(M,h,_,T,F,O,K,oe,ue,ve,Te,ze,je,bt,mt,gt){const Vt=h/24,Zt=M.lineOffsetX*Vt,ni=M.lineOffsetY*Vt;let St;if(M.numGlyphs>1){const zt=M.glyphStartIndex+M.numGlyphs,ai=M.lineStartIndex,Ei=M.lineStartIndex+M.lineLength,Bi=nr(Vt,oe,Zt,ni,_,Te,ze,M,ue,O,je,mt,gt);if(!Bi)return{notEnoughRoom:!0};const Hi=Xi(Bi.first.point,K,gt).point,vi=Xi(Bi.last.point,K,gt).point;if(T&&!_){const xn=Ii(M.writingMode,Hi,vi,bt);if(xn)return xn}St=[Bi.first];for(let xn=M.glyphStartIndex+1;xn<zt-1;xn++)St.push(wi(Vt*oe.getoffsetX(xn),Zt,ni,_,Te,ze,M.segment,ai,Ei,ue,O,je,mt,gt));St.push(Bi.last)}else{if(T&&!_){const ai=Xi(ze,F,gt).point,Ei=M.lineStartIndex+M.segment+1,Bi=new i.pointGeometry(ue.getx(Ei),ue.gety(Ei)),Hi=Xi(Bi,F,gt),vi=Hi.signedDistanceFromCamera>0?Hi.point:Ot(ze,Bi,ai,1,F,gt),xn=Ii(M.writingMode,ai,vi,bt);if(xn)return xn}const zt=wi(Vt*oe.getoffsetX(M.glyphStartIndex),Zt,ni,_,Te,ze,M.segment,M.lineStartIndex,M.lineStartIndex+M.lineLength,ue,O,je,mt,gt);if(!zt)return{notEnoughRoom:!0};St=[zt]}for(const zt of St)i.addDynamicAttributes(ve,zt.point,zt.angle);return{}}function Ot(M,h,_,T,F,O){const K=Xi(M.add(M.sub(h)._unit()),F,O).point,oe=_.sub(K);return _.add(oe._mult(T/oe.mag()))}function wi(M,h,_,T,F,O,K,oe,ue,ve,Te,ze,je,bt){const mt=T?M-h:M+h;let gt=mt>0?1:-1,Vt=0;T&&(gt*=-1,Vt=Math.PI),gt<0&&(Vt+=Math.PI);let Zt=gt>0?oe+K:oe+K+1,ni=F,St=F,zt=0,ai=0;const Ei=Math.abs(mt),Bi=[];for(;zt+ai<=Ei;){if(Zt+=gt,Zt<oe||Zt>=ue)return null;if(St=ni,Bi.push(ni),ni=ze[Zt],ni===void 0){const Bn=new i.pointGeometry(ve.getx(Zt),ve.gety(Zt)),tr=Xi(Bn,Te,bt);if(tr.signedDistanceFromCamera>0)ni=ze[Zt]=tr.point;else{const ur=Zt-gt;ni=Ot(zt===0?O:new i.pointGeometry(ve.getx(ur),ve.gety(ur)),Bn,St,Ei-zt+1,Te,bt)}}zt+=ai,ai=St.dist(ni)}const Hi=(Ei-zt)/ai,vi=ni.sub(St),xn=vi.mult(Hi)._add(St);xn._add(vi._unit()._perp()._mult(_*gt));const cn=Vt+Math.atan2(ni.y-St.y,ni.x-St.x);return Bi.push(xn),{point:xn,angle:je?cn:0,path:Bi}}const Wi=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ui(M,h){for(let _=0;_<M;_++){const T=h.length;h.resize(T+4),h.float32.set(Wi,3*T)}}function Pn(M,h,_){const T=h[0],F=h[1];return M[0]=_[0]*T+_[4]*F+_[12],M[1]=_[1]*T+_[5]*F+_[13],M[3]=_[3]*T+_[7]*F+_[15],M}const qn=100;class Hr{constructor(h,_=new at(h.width+200,h.height+200,25),T=new at(h.width+200,h.height+200,25)){this.transform=h,this.grid=_,this.ignoredGrid=T,this.pitchfactor=Math.cos(h._pitch)*h.cameraToCenterDistance,this.screenRightBoundary=h.width+qn,this.screenBottomBoundary=h.height+qn,this.gridRightBoundary=h.width+200,this.gridBottomBoundary=h.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(h,_,T,F,O,K){const oe=this.projectAndGetPerspectiveRatio(F,h.anchorPointX,h.anchorPointY,K),ue=T*oe.perspectiveRatio,ve=h.x1*ue+oe.point.x,Te=h.y1*ue+oe.point.y,ze=h.x2*ue+oe.point.x,je=h.y2*ue+oe.point.y;return!this.isInsideGrid(ve,Te,ze,je)||_!=="always"&&this.grid.hitTest(ve,Te,ze,je,_,O)||oe.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[ve,Te,ze,je],offscreen:this.isOffscreen(ve,Te,ze,je)}}placeCollisionCircles(h,_,T,F,O,K,oe,ue,ve,Te,ze,je,bt,mt){const gt=[],Vt=new i.pointGeometry(_.anchorX,_.anchorY),Zt=Xi(Vt,K,mt),ni=on(this.transform.cameraToCenterDistance,Zt.signedDistanceFromCamera),St=(Te?O/ni:O*ni)/i.ONE_EM,zt=Xi(Vt,oe,mt).point,ai=nr(St,F,_.lineOffsetX*St,_.lineOffsetY*St,!1,zt,Vt,_,T,oe,{},!1,mt);let Ei=!1,Bi=!1,Hi=!0;if(ai){const vi=.5*je*ni+bt,xn=new i.pointGeometry(-100,-100),cn=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Bn=new en,tr=ai.first,ur=ai.last;let Un=[];for(let Cr=tr.path.length-1;Cr>=1;Cr--)Un.push(tr.path[Cr]);for(let Cr=1;Cr<ur.path.length;Cr++)Un.push(ur.path[Cr]);const Lr=2.5*vi;if(ue){const Cr=Un.map(Er=>Xi(Er,ue,mt));Un=Cr.some(Er=>Er.signedDistanceFromCamera<=0)?[]:Cr.map(Er=>Er.point)}let Rr=[];if(Un.length>0){const Cr=Un[0].clone(),Er=Un[0].clone();for(let Gr=1;Gr<Un.length;Gr++)Cr.x=Math.min(Cr.x,Un[Gr].x),Cr.y=Math.min(Cr.y,Un[Gr].y),Er.x=Math.max(Er.x,Un[Gr].x),Er.y=Math.max(Er.y,Un[Gr].y);Rr=Cr.x>=xn.x&&Er.x<=cn.x&&Cr.y>=xn.y&&Er.y<=cn.y?[Un]:Er.x<xn.x||Cr.x>cn.x||Er.y<xn.y||Cr.y>cn.y?[]:i.clipLine([Un],xn.x,xn.y,cn.x,cn.y)}for(const Cr of Rr){Bn.reset(Cr,.25*vi);let Er=0;Er=Bn.length<=.5*vi?1:Math.ceil(Bn.paddedLength/Lr)+1;for(let Gr=0;Gr<Er;Gr++){const js=Gr/Math.max(Er-1,1),wa=Bn.lerp(js),ua=wa.x+qn,ba=wa.y+qn;gt.push(ua,ba,vi,0);const Wa=ua-vi,Wo=ba-vi,mo=ua+vi,Ba=ba+vi;if(Hi=Hi&&this.isOffscreen(Wa,Wo,mo,Ba),Bi=Bi||this.isInsideGrid(Wa,Wo,mo,Ba),h!=="always"&&this.grid.hitTestCircle(ua,ba,vi,h,ze)&&(Ei=!0,!ve))return{circles:[],offscreen:!1,collisionDetected:Ei}}}}return{circles:!ve&&Ei||!Bi||ni<this.perspectiveRatioCutoff?[]:gt,offscreen:Hi,collisionDetected:Ei}}queryRenderedSymbols(h){if(h.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const _=[];let T=1/0,F=1/0,O=-1/0,K=-1/0;for(const Te of h){const ze=new i.pointGeometry(Te.x+qn,Te.y+qn);T=Math.min(T,ze.x),F=Math.min(F,ze.y),O=Math.max(O,ze.x),K=Math.max(K,ze.y),_.push(ze)}const oe=this.grid.query(T,F,O,K).concat(this.ignoredGrid.query(T,F,O,K)),ue={},ve={};for(const Te of oe){const ze=Te.key;if(ue[ze.bucketInstanceId]===void 0&&(ue[ze.bucketInstanceId]={}),ue[ze.bucketInstanceId][ze.featureIndex])continue;const je=[new i.pointGeometry(Te.x1,Te.y1),new i.pointGeometry(Te.x2,Te.y1),new i.pointGeometry(Te.x2,Te.y2),new i.pointGeometry(Te.x1,Te.y2)];i.polygonIntersectsPolygon(_,je)&&(ue[ze.bucketInstanceId][ze.featureIndex]=!0,ve[ze.bucketInstanceId]===void 0&&(ve[ze.bucketInstanceId]=[]),ve[ze.bucketInstanceId].push(ze.featureIndex))}return ve}insertCollisionBox(h,_,T,F,O,K){(T?this.ignoredGrid:this.grid).insert({bucketInstanceId:F,featureIndex:O,collisionGroupID:K,overlapMode:_},h[0],h[1],h[2],h[3])}insertCollisionCircles(h,_,T,F,O,K){const oe=T?this.ignoredGrid:this.grid,ue={bucketInstanceId:F,featureIndex:O,collisionGroupID:K,overlapMode:_};for(let ve=0;ve<h.length;ve+=4)oe.insertCircle(ue,h[ve],h[ve+1],h[ve+2])}projectAndGetPerspectiveRatio(h,_,T,F){let O;return F?(O=[_,T,F(_,T),1],i.transformMat4(O,O,h)):(O=[_,T,0,1],Pn(O,O,h)),{point:new i.pointGeometry((O[0]/O[3]+1)/2*this.transform.width+qn,(-O[1]/O[3]+1)/2*this.transform.height+qn),perspectiveRatio:.5+this.transform.cameraToCenterDistance/O[3]*.5}}isOffscreen(h,_,T,F){return T<qn||h>=this.screenRightBoundary||F<qn||_>this.screenBottomBoundary}isInsideGrid(h,_,T,F){return T>=0&&h<this.gridRightBoundary&&F>=0&&_<this.gridBottomBoundary}getViewportMatrix(){const h=i.identity([]);return i.translate(h,h,[-100,-100,0]),h}}function fr(M,h,_){return h*(i.EXTENT/(M.tileSize*Math.pow(2,_-M.tileID.overscaledZ)))}class kr{constructor(h,_,T,F){this.opacity=h?Math.max(0,Math.min(1,h.opacity+(h.placed?_:-_))):F&&T?1:0,this.placed=T}isHidden(){return this.opacity===0&&!this.placed}}class Qn{constructor(h,_,T,F,O){this.text=new kr(h?h.text:null,_,T,O),this.icon=new kr(h?h.icon:null,_,F,O)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Rs{constructor(h,_,T){this.text=h,this.icon=_,this.skipFade=T}}class ot{constructor(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}}class Ee{constructor(h,_,T,F,O){this.bucketInstanceId=h,this.featureIndex=_,this.sourceLayerIndex=T,this.bucketIndex=F,this.tileID=O}}class Pe{constructor(h){this.crossSourceCollisions=h,this.maxGroupID=0,this.collisionGroups={}}get(h){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[h]){const _=++this.maxGroupID;this.collisionGroups[h]={ID:_,predicate:T=>T.collisionGroupID===_}}return this.collisionGroups[h]}}function ct(M,h,_,T,F){const{horizontalAlign:O,verticalAlign:K}=i.getAnchorAlignment(M),oe=-(O-.5)*h,ue=-(K-.5)*_,ve=i.evaluateVariableOffset(M,T);return new i.pointGeometry(oe+ve[0]*F,ue+ve[1]*F)}function wt(M,h,_,T,F,O){const{x1:K,x2:oe,y1:ue,y2:ve,anchorPointX:Te,anchorPointY:ze}=M,je=new i.pointGeometry(h,_);return T&&je._rotate(F?O:-O),{x1:K+je.x,y1:ue+je.y,x2:oe+je.x,y2:ve+je.y,anchorPointX:Te,anchorPointY:ze}}class X{constructor(h,_,T,F,O){this.transform=h.clone(),this.terrain=_,this.collisionIndex=new Hr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=T,this.retainedQueryData={},this.collisionGroups=new Pe(F),this.collisionCircleArrays={},this.prevPlacement=O,O&&(O.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(h,_,T,F){const O=T.getBucket(_),K=T.latestFeatureIndex;if(!O||!K||_.id!==O.layerIds[0])return;const oe=T.collisionBoxArray,ue=O.layers[0].layout,ve=Math.pow(2,this.transform.zoom-T.tileID.overscaledZ),Te=T.tileSize/i.EXTENT,ze=this.transform.calculatePosMatrix(T.tileID.toUnwrapped()),je=ue.get("text-pitch-alignment")==="map",bt=ue.get("text-rotation-alignment")==="map",mt=fr(T,1,this.transform.zoom),gt=ii(ze,je,bt,this.transform,mt);let Vt=null;if(je){const ni=hn(ze,je,bt,this.transform,mt);Vt=i.multiply([],this.transform.labelPlaneMatrix,ni)}this.retainedQueryData[O.bucketInstanceId]=new Ee(O.bucketInstanceId,K,O.sourceLayerIndex,O.index,T.tileID);const Zt={bucket:O,layout:ue,posMatrix:ze,textLabelPlaneMatrix:gt,labelToScreenMatrix:Vt,scale:ve,textPixelRatio:Te,holdingForFade:T.holdingForFade(),collisionBoxArray:oe,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(O.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(O.sourceID)};if(F)for(const ni of O.sortKeyRanges){const{sortKey:St,symbolInstanceStart:zt,symbolInstanceEnd:ai}=ni;h.push({sortKey:St,symbolInstanceStart:zt,symbolInstanceEnd:ai,parameters:Zt})}else h.push({symbolInstanceStart:0,symbolInstanceEnd:O.symbolInstances.length,parameters:Zt})}attemptAnchorPlacement(h,_,T,F,O,K,oe,ue,ve,Te,ze,je,bt,mt,gt,Vt){const Zt=[je.textOffset0,je.textOffset1],ni=ct(h,T,F,Zt,O),St=this.collisionIndex.placeCollisionBox(wt(_,ni.x,ni.y,K,oe,this.transform.angle),ze,ue,ve,Te.predicate,Vt);if((!gt||this.collisionIndex.placeCollisionBox(wt(gt,ni.x,ni.y,K,oe,this.transform.angle),ze,ue,ve,Te.predicate,Vt).box.length!==0)&&St.box.length>0){let zt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[je.crossTileID]&&this.prevPlacement.placements[je.crossTileID]&&this.prevPlacement.placements[je.crossTileID].text&&(zt=this.prevPlacement.variableOffsets[je.crossTileID].anchor),je.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[je.crossTileID]={textOffset:Zt,width:T,height:F,anchor:h,textBoxScale:O,prevAnchor:zt},this.markUsedJustification(bt,h,je,mt),bt.allowVerticalPlacement&&(this.markUsedOrientation(bt,mt,je),this.placedOrientations[je.crossTileID]=mt),{shift:ni,placedGlyphBoxes:St}}}placeLayerBucketPart(h,_,T){const{bucket:F,layout:O,posMatrix:K,textLabelPlaneMatrix:oe,labelToScreenMatrix:ue,textPixelRatio:ve,holdingForFade:Te,collisionBoxArray:ze,partiallyEvaluatedTextSize:je,collisionGroup:bt}=h.parameters,mt=O.get("text-optional"),gt=O.get("icon-optional"),Vt=i.getOverlapMode(O,"text-overlap","text-allow-overlap"),Zt=Vt==="always",ni=i.getOverlapMode(O,"icon-overlap","icon-allow-overlap"),St=ni==="always",zt=O.get("text-rotation-alignment")==="map",ai=O.get("text-pitch-alignment")==="map",Ei=O.get("icon-text-fit")!=="none",Bi=O.get("symbol-z-order")==="viewport-y",Hi=Zt&&(St||!F.hasIconData()||gt),vi=St&&(Zt||!F.hasTextData()||mt);!F.collisionArrays&&ze&&F.deserializeCollisionBoxes(ze);const xn=(cn,Bn)=>{if(_[cn.crossTileID])return;if(Te)return void(this.placements[cn.crossTileID]=new Rs(!1,!1,!1));let tr=!1,ur=!1,Un=!0,Lr=null,Rr={box:null,offscreen:null},Cr={box:null,offscreen:null},Er=null,Gr=null,js=null,wa=0,ua=0,ba=0;Bn.textFeatureIndex?wa=Bn.textFeatureIndex:cn.useRuntimeCollisionCircles&&(wa=cn.featureIndex),Bn.verticalTextFeatureIndex&&(ua=Bn.verticalTextFeatureIndex);const Wa=this.retainedQueryData[F.bucketInstanceId].tileID,Wo=this.terrain?(x,a)=>this.terrain.getElevation(Wa,x,a):null;for(const x of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const a=Bn[x];a&&(a.elevation=Wo?Wo(a.anchorPointX,a.anchorPointY):0)}const mo=Bn.textBox;if(mo){const x=m=>{let b=i.WritingMode.horizontal;if(F.allowVerticalPlacement&&!m&&this.prevPlacement){const S=this.prevPlacement.placedOrientations[cn.crossTileID];S&&(this.placedOrientations[cn.crossTileID]=S,b=S,this.markUsedOrientation(F,b,cn))}return b},a=(m,b)=>{if(F.allowVerticalPlacement&&cn.numVerticalGlyphVertices>0&&Bn.verticalTextBox){for(const S of F.writingModes)if(S===i.WritingMode.vertical?(Rr=b(),Cr=Rr):Rr=m(),Rr&&Rr.box&&Rr.box.length)break}else Rr=m()};if(O.get("text-variable-anchor")){let m=O.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[cn.crossTileID]){const P=this.prevPlacement.variableOffsets[cn.crossTileID];m.indexOf(P.anchor)>0&&(m=m.filter(H=>H!==P.anchor),m.unshift(P.anchor))}const b=(P,H,W)=>{const ee=P.x2-P.x1,pe=P.y2-P.y1,fe=cn.textBoxScale,Me=Ei&&ni==="never"?H:null;let Ne={box:[],offscreen:!1};const st=Vt!=="never"?2*m.length:m.length;for(let it=0;it<st;++it){const lt=this.attemptAnchorPlacement(m[it%m.length],P,ee,pe,fe,zt,ai,ve,K,bt,it>=m.length?Vt:"never",cn,F,W,Me,Wo);if(lt&&(Ne=lt.placedGlyphBoxes,Ne&&Ne.box&&Ne.box.length)){tr=!0,Lr=lt.shift;break}}return Ne};a(()=>b(mo,Bn.iconBox,i.WritingMode.horizontal),()=>{const P=Bn.verticalTextBox;return F.allowVerticalPlacement&&!(Rr&&Rr.box&&Rr.box.length)&&cn.numVerticalGlyphVertices>0&&P?b(P,Bn.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),Rr&&(tr=Rr.box,Un=Rr.offscreen);const S=x(Rr&&Rr.box);if(!tr&&this.prevPlacement){const P=this.prevPlacement.variableOffsets[cn.crossTileID];P&&(this.variableOffsets[cn.crossTileID]=P,this.markUsedJustification(F,P.anchor,cn,S))}}else{const m=(b,S)=>{const P=this.collisionIndex.placeCollisionBox(b,Vt,ve,K,bt.predicate,Wo);return P&&P.box&&P.box.length&&(this.markUsedOrientation(F,S,cn),this.placedOrientations[cn.crossTileID]=S),P};a(()=>m(mo,i.WritingMode.horizontal),()=>{const b=Bn.verticalTextBox;return F.allowVerticalPlacement&&cn.numVerticalGlyphVertices>0&&b?m(b,i.WritingMode.vertical):{box:null,offscreen:null}}),x(Rr&&Rr.box&&Rr.box.length)}}if(Er=Rr,tr=Er&&Er.box&&Er.box.length>0,Un=Er&&Er.offscreen,cn.useRuntimeCollisionCircles){const x=F.text.placedSymbolArray.get(cn.centerJustifiedTextSymbolIndex),a=i.evaluateSizeForFeature(F.textSizeData,je,x),m=O.get("text-padding");Gr=this.collisionIndex.placeCollisionCircles(Vt,x,F.lineVertexArray,F.glyphOffsetArray,a,K,oe,ue,T,ai,bt.predicate,cn.collisionCircleDiameter,m,Wo),Gr.circles.length&&Gr.collisionDetected&&!T&&i.warnOnce("Collisions detected, but collision boxes are not shown"),tr=Zt||Gr.circles.length>0&&!Gr.collisionDetected,Un=Un&&Gr.offscreen}if(Bn.iconFeatureIndex&&(ba=Bn.iconFeatureIndex),Bn.iconBox){const x=a=>{const m=Ei&&Lr?wt(a,Lr.x,Lr.y,zt,ai,this.transform.angle):a;return this.collisionIndex.placeCollisionBox(m,ni,ve,K,bt.predicate,Wo)};Cr&&Cr.box&&Cr.box.length&&Bn.verticalIconBox?(js=x(Bn.verticalIconBox),ur=js.box.length>0):(js=x(Bn.iconBox),ur=js.box.length>0),Un=Un&&js.offscreen}const Ba=mt||cn.numHorizontalGlyphVertices===0&&cn.numVerticalGlyphVertices===0,$l=gt||cn.numIconVertices===0;if(Ba||$l?$l?Ba||(ur=ur&&tr):tr=ur&&tr:ur=tr=ur&&tr,tr&&Er&&Er.box&&this.collisionIndex.insertCollisionBox(Er.box,Vt,O.get("text-ignore-placement"),F.bucketInstanceId,Cr&&Cr.box&&ua?ua:wa,bt.ID),ur&&js&&this.collisionIndex.insertCollisionBox(js.box,ni,O.get("icon-ignore-placement"),F.bucketInstanceId,ba,bt.ID),Gr&&(tr&&this.collisionIndex.insertCollisionCircles(Gr.circles,Vt,O.get("text-ignore-placement"),F.bucketInstanceId,wa,bt.ID),T)){const x=F.bucketInstanceId;let a=this.collisionCircleArrays[x];a===void 0&&(a=this.collisionCircleArrays[x]=new ot);for(let m=0;m<Gr.circles.length;m+=4)a.circles.push(Gr.circles[m+0]),a.circles.push(Gr.circles[m+1]),a.circles.push(Gr.circles[m+2]),a.circles.push(Gr.collisionDetected?1:0)}if(cn.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(F.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[cn.crossTileID]=new Rs(tr||Hi,ur||vi,Un||F.justReloaded),_[cn.crossTileID]=!0};if(Bi){if(h.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const cn=F.getSortedSymbolIndexes(this.transform.angle);for(let Bn=cn.length-1;Bn>=0;--Bn){const tr=cn[Bn];xn(F.symbolInstances.get(tr),F.collisionArrays[tr])}}else for(let cn=h.symbolInstanceStart;cn<h.symbolInstanceEnd;cn++)xn(F.symbolInstances.get(cn),F.collisionArrays[cn]);if(T&&F.bucketInstanceId in this.collisionCircleArrays){const cn=this.collisionCircleArrays[F.bucketInstanceId];i.invert(cn.invProjMatrix,K),cn.viewportMatrix=this.collisionIndex.getViewportMatrix()}F.justReloaded=!1}markUsedJustification(h,_,T,F){let O;O=F===i.WritingMode.vertical?T.verticalPlacedTextSymbolIndex:{left:T.leftJustifiedTextSymbolIndex,center:T.centerJustifiedTextSymbolIndex,right:T.rightJustifiedTextSymbolIndex}[i.getAnchorJustification(_)];const K=[T.leftJustifiedTextSymbolIndex,T.centerJustifiedTextSymbolIndex,T.rightJustifiedTextSymbolIndex,T.verticalPlacedTextSymbolIndex];for(const oe of K)oe>=0&&(h.text.placedSymbolArray.get(oe).crossTileID=O>=0&&oe!==O?0:T.crossTileID)}markUsedOrientation(h,_,T){const F=_===i.WritingMode.horizontal||_===i.WritingMode.horizontalOnly?_:0,O=_===i.WritingMode.vertical?_:0,K=[T.leftJustifiedTextSymbolIndex,T.centerJustifiedTextSymbolIndex,T.rightJustifiedTextSymbolIndex];for(const oe of K)h.text.placedSymbolArray.get(oe).placedOrientation=F;T.verticalPlacedTextSymbolIndex&&(h.text.placedSymbolArray.get(T.verticalPlacedTextSymbolIndex).placedOrientation=O)}commit(h){this.commitTime=h,this.zoomAtLastRecencyCheck=this.transform.zoom;const _=this.prevPlacement;let T=!1;this.prevZoomAdjustment=_?_.zoomAdjustment(this.transform.zoom):0;const F=_?_.symbolFadeChange(h):1,O=_?_.opacities:{},K=_?_.variableOffsets:{},oe=_?_.placedOrientations:{};for(const ue in this.placements){const ve=this.placements[ue],Te=O[ue];Te?(this.opacities[ue]=new Qn(Te,F,ve.text,ve.icon),T=T||ve.text!==Te.text.placed||ve.icon!==Te.icon.placed):(this.opacities[ue]=new Qn(null,F,ve.text,ve.icon,ve.skipFade),T=T||ve.text||ve.icon)}for(const ue in O){const ve=O[ue];if(!this.opacities[ue]){const Te=new Qn(ve,F,!1,!1);Te.isHidden()||(this.opacities[ue]=Te,T=T||ve.text.placed||ve.icon.placed)}}for(const ue in K)this.variableOffsets[ue]||!this.opacities[ue]||this.opacities[ue].isHidden()||(this.variableOffsets[ue]=K[ue]);for(const ue in oe)this.placedOrientations[ue]||!this.opacities[ue]||this.opacities[ue].isHidden()||(this.placedOrientations[ue]=oe[ue]);if(_&&_.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");T?this.lastPlacementChangeTime=h:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=_?_.lastPlacementChangeTime:h)}updateLayerOpacities(h,_){const T={};for(const F of _){const O=F.getBucket(h);O&&F.latestFeatureIndex&&h.id===O.layerIds[0]&&this.updateBucketOpacities(O,T,F.collisionBoxArray)}}updateBucketOpacities(h,_,T){h.hasTextData()&&h.text.opacityVertexArray.clear(),h.hasIconData()&&h.icon.opacityVertexArray.clear(),h.hasIconCollisionBoxData()&&h.iconCollisionBox.collisionVertexArray.clear(),h.hasTextCollisionBoxData()&&h.textCollisionBox.collisionVertexArray.clear();const F=h.layers[0].layout,O=new Qn(null,0,!1,!1,!0),K=F.get("text-allow-overlap"),oe=F.get("icon-allow-overlap"),ue=F.get("text-variable-anchor"),ve=F.get("text-rotation-alignment")==="map",Te=F.get("text-pitch-alignment")==="map",ze=F.get("icon-text-fit")!=="none",je=new Qn(null,0,K&&(oe||!h.hasIconData()||F.get("icon-optional")),oe&&(K||!h.hasTextData()||F.get("text-optional")),!0);!h.collisionArrays&&T&&(h.hasIconCollisionBoxData()||h.hasTextCollisionBoxData())&&h.deserializeCollisionBoxes(T);const bt=(mt,gt,Vt)=>{for(let Zt=0;Zt<gt/4;Zt++)mt.opacityVertexArray.emplaceBack(Vt)};for(let mt=0;mt<h.symbolInstances.length;mt++){const gt=h.symbolInstances.get(mt),{numHorizontalGlyphVertices:Vt,numVerticalGlyphVertices:Zt,crossTileID:ni}=gt;let St=this.opacities[ni];_[ni]?St=O:St||(St=je,this.opacities[ni]=St),_[ni]=!0;const zt=gt.numIconVertices>0,ai=this.placedOrientations[gt.crossTileID],Ei=ai===i.WritingMode.vertical,Bi=ai===i.WritingMode.horizontal||ai===i.WritingMode.horizontalOnly;if(Vt>0||Zt>0){const Hi=pt(St.text);bt(h.text,Vt,Ei?Lt:Hi),bt(h.text,Zt,Bi?Lt:Hi);const vi=St.text.isHidden();[gt.rightJustifiedTextSymbolIndex,gt.centerJustifiedTextSymbolIndex,gt.leftJustifiedTextSymbolIndex].forEach(Bn=>{Bn>=0&&(h.text.placedSymbolArray.get(Bn).hidden=vi||Ei?1:0)}),gt.verticalPlacedTextSymbolIndex>=0&&(h.text.placedSymbolArray.get(gt.verticalPlacedTextSymbolIndex).hidden=vi||Bi?1:0);const xn=this.variableOffsets[gt.crossTileID];xn&&this.markUsedJustification(h,xn.anchor,gt,ai);const cn=this.placedOrientations[gt.crossTileID];cn&&(this.markUsedJustification(h,"left",gt,cn),this.markUsedOrientation(h,cn,gt))}if(zt){const Hi=pt(St.icon),vi=!(ze&&gt.verticalPlacedIconSymbolIndex&&Ei);gt.placedIconSymbolIndex>=0&&(bt(h.icon,gt.numIconVertices,vi?Hi:Lt),h.icon.placedSymbolArray.get(gt.placedIconSymbolIndex).hidden=St.icon.isHidden()),gt.verticalPlacedIconSymbolIndex>=0&&(bt(h.icon,gt.numVerticalIconVertices,vi?Lt:Hi),h.icon.placedSymbolArray.get(gt.verticalPlacedIconSymbolIndex).hidden=St.icon.isHidden())}if(h.hasIconCollisionBoxData()||h.hasTextCollisionBoxData()){const Hi=h.collisionArrays[mt];if(Hi){let vi=new i.pointGeometry(0,0);if(Hi.textBox||Hi.verticalTextBox){let cn=!0;if(ue){const Bn=this.variableOffsets[ni];Bn?(vi=ct(Bn.anchor,Bn.width,Bn.height,Bn.textOffset,Bn.textBoxScale),ve&&vi._rotate(Te?this.transform.angle:-this.transform.angle)):cn=!1}Hi.textBox&&j(h.textCollisionBox.collisionVertexArray,St.text.placed,!cn||Ei,vi.x,vi.y),Hi.verticalTextBox&&j(h.textCollisionBox.collisionVertexArray,St.text.placed,!cn||Bi,vi.x,vi.y)}const xn=Boolean(!Bi&&Hi.verticalIconBox);Hi.iconBox&&j(h.iconCollisionBox.collisionVertexArray,St.icon.placed,xn,ze?vi.x:0,ze?vi.y:0),Hi.verticalIconBox&&j(h.iconCollisionBox.collisionVertexArray,St.icon.placed,!xn,ze?vi.x:0,ze?vi.y:0)}}}if(h.sortFeatures(this.transform.angle),this.retainedQueryData[h.bucketInstanceId]&&(this.retainedQueryData[h.bucketInstanceId].featureSortOrder=h.featureSortOrder),h.hasTextData()&&h.text.opacityVertexBuffer&&h.text.opacityVertexBuffer.updateData(h.text.opacityVertexArray),h.hasIconData()&&h.icon.opacityVertexBuffer&&h.icon.opacityVertexBuffer.updateData(h.icon.opacityVertexArray),h.hasIconCollisionBoxData()&&h.iconCollisionBox.collisionVertexBuffer&&h.iconCollisionBox.collisionVertexBuffer.updateData(h.iconCollisionBox.collisionVertexArray),h.hasTextCollisionBoxData()&&h.textCollisionBox.collisionVertexBuffer&&h.textCollisionBox.collisionVertexBuffer.updateData(h.textCollisionBox.collisionVertexArray),h.text.opacityVertexArray.length!==h.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${h.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${h.text.layoutVertexArray.length}) / 4`);if(h.icon.opacityVertexArray.length!==h.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${h.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${h.icon.layoutVertexArray.length}) / 4`);if(h.bucketInstanceId in this.collisionCircleArrays){const mt=this.collisionCircleArrays[h.bucketInstanceId];h.placementInvProjMatrix=mt.invProjMatrix,h.placementViewportMatrix=mt.viewportMatrix,h.collisionCircleArray=mt.circles,delete this.collisionCircleArrays[h.bucketInstanceId]}}symbolFadeChange(h){return this.fadeDuration===0?1:(h-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(h){return Math.max(0,(this.transform.zoom-h)/1.5)}hasTransitions(h){return this.stale||h-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(h,_){const T=this.zoomAtLastRecencyCheck===_?1-this.zoomAdjustment(_):1;return this.zoomAtLastRecencyCheck=_,this.commitTime+this.fadeDuration*T>h}setStale(){this.stale=!0}}function j(M,h,_,T,F){M.emplaceBack(h?1:0,_?1:0,T||0,F||0),M.emplaceBack(h?1:0,_?1:0,T||0,F||0),M.emplaceBack(h?1:0,_?1:0,T||0,F||0),M.emplaceBack(h?1:0,_?1:0,T||0,F||0)}const ie=Math.pow(2,25),ne=Math.pow(2,24),de=Math.pow(2,17),Ue=Math.pow(2,16),tt=Math.pow(2,9),He=Math.pow(2,8),et=Math.pow(2,1);function pt(M){if(M.opacity===0&&!M.placed)return 0;if(M.opacity===1&&M.placed)return 4294967295;const h=M.placed?1:0,_=Math.floor(127*M.opacity);return _*ie+h*ne+_*de+h*Ue+_*tt+h*He+_*et+h}const Lt=0;class jt{constructor(h){this._sortAcrossTiles=h.layout.get("symbol-z-order")!=="viewport-y"&&!h.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(h,_,T,F,O){const K=this._bucketParts;for(;this._currentTileIndex<h.length;)if(_.getBucketParts(K,F,h[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,O())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,K.sort((oe,ue)=>oe.sortKey-ue.sortKey));this._currentPartIndex<K.length;)if(_.placeLayerBucketPart(K[this._currentPartIndex],this._seenCrossTileIDs,T),this._currentPartIndex++,O())return!0;return!1}}class Wt{constructor(h,_,T,F,O,K,oe,ue){this.placement=new X(h,_,K,oe,ue),this._currentPlacementIndex=T.length-1,this._forceFullPlacement=F,this._showCollisionBoxes=O,this._done=!1}isDone(){return this._done}continuePlacement(h,_,T){const F=i.exported.now(),O=()=>{const K=i.exported.now()-F;return!this._forceFullPlacement&&K>2};for(;this._currentPlacementIndex>=0;){const K=_[h[this._currentPlacementIndex]],oe=this.placement.collisionIndex.transform.zoom;if(K.type==="symbol"&&(!K.minzoom||K.minzoom<=oe)&&(!K.maxzoom||K.maxzoom>oe)){if(this._inProgressLayer||(this._inProgressLayer=new jt(K)),this._inProgressLayer.continuePlacement(T[K.source],this.placement,this._showCollisionBoxes,K,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(h){return this.placement.commit(h),this.placement}}const ki=512/i.EXTENT/2;class bi{constructor(h,_,T){this.tileID=h,this.indexedSymbolInstances={},this.bucketInstanceId=T;for(let F=0;F<_.length;F++){const O=_.get(F),K=O.key;this.indexedSymbolInstances[K]||(this.indexedSymbolInstances[K]=[]),this.indexedSymbolInstances[K].push({crossTileID:O.crossTileID,coord:this.getScaledCoordinates(O,h)})}}getScaledCoordinates(h,_){const T=ki/Math.pow(2,_.canonical.z-this.tileID.canonical.z);return{x:Math.floor((_.canonical.x*i.EXTENT+h.anchorX)*T),y:Math.floor((_.canonical.y*i.EXTENT+h.anchorY)*T)}}findMatches(h,_,T){const F=this.tileID.canonical.z<_.canonical.z?1:Math.pow(2,this.tileID.canonical.z-_.canonical.z);for(let O=0;O<h.length;O++){const K=h.get(O);if(K.crossTileID)continue;const oe=this.indexedSymbolInstances[K.key];if(!oe)continue;const ue=this.getScaledCoordinates(K,_);for(const ve of oe)if(Math.abs(ve.coord.x-ue.x)<=F&&Math.abs(ve.coord.y-ue.y)<=F&&!T[ve.crossTileID]){T[ve.crossTileID]=!0,K.crossTileID=ve.crossTileID;break}}}}class Oi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(h){const _=Math.round((h-this.lng)/360);if(_!==0)for(const T in this.indexes){const F=this.indexes[T],O={};for(const K in F){const oe=F[K];oe.tileID=oe.tileID.unwrapTo(oe.tileID.wrap+_),O[oe.tileID.key]=oe}this.indexes[T]=O}this.lng=h}addBucket(h,_,T){if(this.indexes[h.overscaledZ]&&this.indexes[h.overscaledZ][h.key]){if(this.indexes[h.overscaledZ][h.key].bucketInstanceId===_.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(h.overscaledZ,this.indexes[h.overscaledZ][h.key])}for(let O=0;O<_.symbolInstances.length;O++)_.symbolInstances.get(O).crossTileID=0;this.usedCrossTileIDs[h.overscaledZ]||(this.usedCrossTileIDs[h.overscaledZ]={});const F=this.usedCrossTileIDs[h.overscaledZ];for(const O in this.indexes){const K=this.indexes[O];if(Number(O)>h.overscaledZ)for(const oe in K){const ue=K[oe];ue.tileID.isChildOf(h)&&ue.findMatches(_.symbolInstances,h,F)}else{const oe=K[h.scaledTo(Number(O)).key];oe&&oe.findMatches(_.symbolInstances,h,F)}}for(let O=0;O<_.symbolInstances.length;O++){const K=_.symbolInstances.get(O);K.crossTileID||(K.crossTileID=T.generate(),F[K.crossTileID]=!0)}return this.indexes[h.overscaledZ]===void 0&&(this.indexes[h.overscaledZ]={}),this.indexes[h.overscaledZ][h.key]=new bi(h,_.symbolInstances,_.bucketInstanceId),!0}removeBucketCrossTileIDs(h,_){for(const T in _.indexedSymbolInstances)for(const F of _.indexedSymbolInstances[T])delete this.usedCrossTileIDs[h][F.crossTileID]}removeStaleBuckets(h){let _=!1;for(const T in this.indexes){const F=this.indexes[T];for(const O in F)h[F[O].bucketInstanceId]||(this.removeBucketCrossTileIDs(T,F[O]),delete F[O],_=!0)}return _}}class tn{constructor(){this.layerIndexes={},this.crossTileIDs=new Oi,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(h,_,T){let F=this.layerIndexes[h.id];F===void 0&&(F=this.layerIndexes[h.id]=new Yi);let O=!1;const K={};F.handleWrapJump(T);for(const oe of _){const ue=oe.getBucket(h);ue&&h.id===ue.layerIds[0]&&(ue.bucketInstanceId||(ue.bucketInstanceId=++this.maxBucketInstanceId),F.addBucket(oe.tileID,ue,this.crossTileIDs)&&(O=!0),K[ue.bucketInstanceId]=!0)}return F.removeStaleBuckets(K)&&(O=!0),O}pruneUnusedLayers(h){const _={};h.forEach(T=>{_[T]=!0});for(const T in this.layerIndexes)_[T]||delete this.layerIndexes[T]}}var rr=i.createLayout([{name:"a_pos",type:"Int16",components:2}]);class yn extends i.Evented{constructor(h){super(),this.sourceCache=h,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=h._cache.max,h.usedForTerrain=!0,h.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const h in this._tiles){const _=this._tiles[h];_.textures.forEach(T=>T.destroy()),_.textures=[]}}update(h,_){this.sourceCache.update(h,_),this._renderableTilesKeys=[];for(const T of h.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:_}))this._renderableTilesKeys.push(T.key),this._tiles[T.key]||(T.posMatrix=new Float64Array(16),i.ortho(T.posMatrix,0,i.EXTENT,0,i.EXTENT,0,1),this._tiles[T.key]=new be(T,this.tileSize))}removeOutdated(h){const _={};this.renderHistory=this.renderHistory.filter((T,F)=>this.renderHistory.indexOf(T)===F).slice(0,this.renderHistorySize);for(const T of this._renderableTilesKeys)_[T]=!0;for(const T of this.renderHistory)_[T]=!0;for(const T in this._tiles)_[T]||(this._tiles[T].clearTextures(h),delete this._tiles[T])}getRenderableTiles(){return this._renderableTilesKeys.map(h=>this.getTileByID(h))}getTileByID(h){return this._tiles[h]}getTerrainCoords(h){const _={};for(const T of this._renderableTilesKeys){const F=this._tiles[T].tileID;if(F.canonical.equals(h.canonical)){const O=h.clone();O.posMatrix=new Float64Array(16),i.ortho(O.posMatrix,0,i.EXTENT,0,i.EXTENT,0,1),_[T]=O}else if(F.canonical.isChildOf(h.canonical)){const O=h.clone();O.posMatrix=new Float64Array(16);const K=F.canonical.z-h.canonical.z,oe=F.canonical.x-(F.canonical.x>>K<<K),ue=F.canonical.y-(F.canonical.y>>K<<K),ve=i.EXTENT>>K;i.ortho(O.posMatrix,0,ve,0,ve,0,1),i.translate(O.posMatrix,O.posMatrix,[-oe*ve,-ue*ve,0]),_[T]=O}else if(h.canonical.isChildOf(F.canonical)){const O=h.clone();O.posMatrix=new Float64Array(16);const K=h.canonical.z-F.canonical.z,oe=h.canonical.x-(h.canonical.x>>K<<K),ue=h.canonical.y-(h.canonical.y>>K<<K),ve=i.EXTENT>>K;i.ortho(O.posMatrix,0,i.EXTENT,0,i.EXTENT,0,1),i.translate(O.posMatrix,O.posMatrix,[oe*ve,ue*ve,0]),i.scale(O.posMatrix,O.posMatrix,[1/2**K,1/2**K,0]),_[T]=O}}return _}getSourceTile(h,_){const T=this.sourceCache._source;let F=h.overscaledZ-this.deltaZoom;if(F>T.maxzoom&&(F=T.maxzoom),F<T.minzoom)return null;this._sourceTileCache[h.key]||(this._sourceTileCache[h.key]=h.scaledTo(F).key);let O=this.sourceCache.getTileByID(this._sourceTileCache[h.key]);if((!O||!O.dem)&&_)for(;F>=T.minzoom&&(!O||!O.dem);)O=this.sourceCache.getTileByID(h.scaledTo(F--).key);return O}tilesAfterTime(h=Date.now()){return Object.values(this._tiles).filter(_=>_.timeLoaded>=h)}}class Yt{constructor(h,_,T){this.style=h,this.sourceCache=new yn(_),this.options=T,this.exaggeration=typeof T.exaggeration=="number"?T.exaggeration:1,this.elevationOffset=typeof T.elevationOffset=="number"?T.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(h,_,T,F=i.EXTENT){if(!(_>=0&&_<F&&T>=0&&T<F))return this.elevationOffset;let O=0;const K=this.getTerrainData(h);if(K.tile&&K.tile.dem){const oe=i.transformMat4$1([],[_/F*i.EXTENT,T/F*i.EXTENT],K.u_terrain_matrix),ue=[oe[0]*K.tile.dem.dim,oe[1]*K.tile.dem.dim],ve=[Math.floor(ue[0]),Math.floor(ue[1])],Te=K.tile.dem.get(ve[0],ve[1]),ze=K.tile.dem.get(ve[0],ve[1]+1),je=K.tile.dem.get(ve[0]+1,ve[1]),bt=K.tile.dem.get(ve[0]+1,ve[1]+1);O=i.number(i.number(Te,ze,ue[0]-ve[0]),i.number(je,bt,ue[0]-ve[0]),ue[1]-ve[1])}return O}rememberForRerender(h,_){for(const T in this.sourceCache._tiles){const F=this.sourceCache._tiles[T];(F.tileID.equals(_)||F.tileID.isChildOf(_))&&(h===this.sourceCache.sourceCache.id&&(F.timeLoaded=Date.now()),this._rerender[h]=this._rerender[h]||{},this._rerender[h][F.tileID.key]=!0)}}needsRerender(h,_){return this._rerender[h]&&this._rerender[h][_.key]}clearRerenderCache(){this._rerender={}}getElevation(h,_,T,F=i.EXTENT){return(this.getDEMElevation(h,_,T,F)+this.elevationOffset)*this.exaggeration}getTerrainData(h){if(!this._emptyDemTexture){const F=this.style.map.painter.context,O=new i.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Y(F,O,F.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Y(F,new i.RGBAImage({width:1,height:1}),F.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(F.gl.NEAREST,F.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.identity([])}const _=this.sourceCache.getSourceTile(h,!0);if(_&&_.dem&&(!_.demTexture||_.needsTerrainPrepare)){const F=this.style.map.painter.context;_.demTexture=this.style.map.painter.getTileTexture(_.dem.stride),_.demTexture?_.demTexture.update(_.dem.getPixels(),{premultiply:!1}):_.demTexture=new Y(F,_.dem.getPixels(),F.gl.RGBA,{premultiply:!1}),_.demTexture.bind(F.gl.NEAREST,F.gl.CLAMP_TO_EDGE),_.needsTerrainPrepare=!1}const T=_&&_+_.tileID.key+h.key;if(T&&!this._demMatrixCache[T]){const F=this.sourceCache.sourceCache._source.maxzoom;let O=h.canonical.z-_.tileID.canonical.z;h.overscaledZ>h.canonical.z&&(h.canonical.z>=F?O=h.canonical.z-F:i.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const K=h.canonical.x-(h.canonical.x>>O<<O),oe=h.canonical.y-(h.canonical.y>>O<<O),ue=i.fromScaling(new Float64Array(16),[1/(i.EXTENT<<O),1/(i.EXTENT<<O),0]);i.translate(ue,ue,[K*i.EXTENT,oe*i.EXTENT,0]),this._demMatrixCache[h.key]={matrix:ue,coord:h}}return{u_depth:2,u_terrain:3,u_terrain_dim:_&&_.dem&&_.dem.dim||1,u_terrain_matrix:T?this._demMatrixCache[h.key].matrix:this._emptyDemMatrix,u_terrain_unpack:_&&_.dem&&_.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(_&&_.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:_}}getRTTFramebuffer(){const h=this.style.map.painter;if(!this._rttFramebuffer){const _=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=h.context.createFramebuffer(_,_,!0),this._rttFramebuffer.depthAttachment.set(h.context.createRenderbuffer(h.context.gl.DEPTH_COMPONENT16,_,_))}return this._rttFramebuffer}getFramebuffer(h){const _=this.style.map.painter,T=_.width/devicePixelRatio,F=_.height/devicePixelRatio;return!this._fbo||this._fbo.width===T&&this._fbo.height===F||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Y(_.context,{width:T,height:F,data:null},_.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(_.context.gl.NEAREST,_.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Y(_.context,{width:T,height:F,data:null},_.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(_.context.gl.NEAREST,_.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=_.context.createFramebuffer(T,F,!0),this._fbo.depthAttachment.set(_.context.createRenderbuffer(_.context.gl.DEPTH_COMPONENT16,T,F))),this._fbo.colorAttachment.set(h==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const h=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const _=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let O=0,K=0;O<this._coordsTextureSize;O++)for(let oe=0;oe<this._coordsTextureSize;oe++,K+=4)_[K+0]=255&oe,_[K+1]=255&O,_[K+2]=oe>>8<<4|O>>8,_[K+3]=0;const T=new i.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(_.buffer)),F=new Y(h,T,h.gl.RGBA,{premultiply:!1});return F.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),this._coordsTexture=F,F}pointCoordinate(h){const _=new Uint8Array(4),T=this.style.map.painter,F=T.context,O=F.gl;F.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),O.readPixels(h.x,T.height/devicePixelRatio-h.y-1,1,1,O.RGBA,O.UNSIGNED_BYTE,_),F.bindFramebuffer.set(null);const K=_[0]+(_[2]>>4<<8),oe=_[1]+((15&_[2])<<8),ue=this.coordsIndex[255-_[3]],ve=ue&&this.sourceCache.getTileByID(ue);if(!ve)return null;const Te=this._coordsTextureSize,ze=(1<<ve.tileID.canonical.z)*Te;return new i.MercatorCoordinate((ve.tileID.canonical.x*Te+K)/ze,(ve.tileID.canonical.y*Te+oe)/ze,this.getElevation(ve.tileID,K,oe,Te))}getTerrainMesh(){if(this._mesh)return this._mesh;const h=this.style.map.painter.context,_=new i.PosArray,T=new i.TriangleIndexArray,F=this.meshSize,O=i.EXTENT/F,K=F*F;for(let oe=0;oe<=F;oe++)for(let ue=0;ue<=F;ue++)_.emplaceBack(ue*O,oe*O);for(let oe=0;oe<K;oe+=F+1)for(let ue=0;ue<F;ue++)T.emplaceBack(ue+oe,F+ue+oe+1,F+ue+oe+2),T.emplaceBack(ue+oe,F+ue+oe+2,ue+oe+1);return this._mesh={indexBuffer:h.createIndexBuffer(T),vertexBuffer:h.createVertexBuffer(_,rr.members),segments:i.SegmentVector.simpleSegment(0,0,_.length,T.length)},this._mesh}getMinMaxElevation(h){const _=this.getTerrainData(h).tile,T={minElevation:null,maxElevation:null};return _&&_.dem&&(T.minElevation=(_.dem.min+this.elevationOffset)*this.exaggeration,T.maxElevation=(_.dem.max+this.elevationOffset)*this.exaggeration),T}}const sr=(M,h)=>i.emitValidationErrors(M,h&&h.filter(_=>_.identifier!=="source.canvas")),Yn=i.pick(zi,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Wr=i.pick(zi,["setCenter","setZoom","setBearing","setPitch"]),mr=function(){const M={},h=i.spec.$version;for(const _ in i.spec.$root){const T=i.spec.$root[_];if(T.required){let F=null;F=_==="version"?h:T.type==="array"?[]:{},F!=null&&(M[_]=F)}}return M}();class Mr extends i.Evented{constructor(h,_={}){super(),this.map=h,this.dispatcher=new Et(fi(),this),this.imageManager=new ae,this.imageManager.setEventedParent(this),this.glyphManager=new me(h._requestManager,_.localIdeographFontFamily),this.lineAtlas=new Ge(256,512),this.crossTileSymbolIndex=new tn,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const T=this;this._rtlTextPluginCallback=Mr.registerForPluginStateChange(F=>{T.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:F.pluginStatus,pluginURL:F.pluginURL},(O,K)=>{if(i.triggerPluginCompletionEvent(O),K&&K.every(oe=>oe))for(const oe in T.sourceCaches)T.sourceCaches[oe].reload()})}),this.on("data",F=>{if(F.dataType!=="source"||F.sourceDataType!=="metadata")return;const O=this.sourceCaches[F.sourceId];if(!O)return;const K=O.getSource();if(K&&K.vectorLayerIds)for(const oe in this._layers){const ue=this._layers[oe];ue.source===K.id&&this._validateLayer(ue)}})}loadURL(h,_={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const T=typeof _.validate!="boolean"||_.validate,F=this.map._requestManager.transformRequest(h,i.ResourceType.Style);this._request=i.getJSON(F,(O,K)=>{this._request=null,O?this.fire(new i.ErrorEvent(O)):K&&this._load(K,T)})}loadJSON(h,_={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(h,_.validate!==!1)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(mr,!1)}_load(h,_){if(_&&sr(this,i.validateStyle(h)))return;this._loaded=!0,this.stylesheet=h;for(const F in h.sources)this.addSource(F,h.sources[F],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs);const T=wn(this.stylesheet.layers);this._order=T.map(F=>F.id),this._layers={},this._serializedLayers={};for(let F of T)F=i.createStyleLayer(F),F.setEventedParent(this,{layer:{id:F.id}}),this._layers[F.id]=F,this._serializedLayers[F.id]=F.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Fe(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}_loadSprite(h){this._spriteRequest=function(_,T,F,O){let K,oe,ue;const ve=F>1?"@2x":"";let Te=i.getJSON(T.transformRequest(T.normalizeSpriteURL(_,ve,".json"),i.ResourceType.SpriteJSON),(bt,mt)=>{Te=null,ue||(ue=bt,K=mt,je())}),ze=i.getImage(T.transformRequest(T.normalizeSpriteURL(_,ve,".png"),i.ResourceType.SpriteImage),(bt,mt)=>{ze=null,ue||(ue=bt,oe=mt,je())});function je(){if(ue)O(ue);else if(K&&oe){const bt=i.exported.getImageData(oe),mt={};for(const gt in K){const{width:Vt,height:Zt,x:ni,y:St,sdf:zt,pixelRatio:ai,stretchX:Ei,stretchY:Bi,content:Hi}=K[gt],vi=new i.RGBAImage({width:Vt,height:Zt});i.RGBAImage.copy(bt,vi,{x:ni,y:St},{x:0,y:0},{width:Vt,height:Zt}),mt[gt]={data:vi,pixelRatio:ai,sdf:zt,stretchX:Ei,stretchY:Bi,content:Hi}}O(null,mt)}}return{cancel(){Te&&(Te.cancel(),Te=null),ze&&(ze.cancel(),ze=null)}}}(h,this.map._requestManager,this.map.getPixelRatio(),(_,T)=>{if(this._spriteRequest=null,_)this.fire(new i.ErrorEvent(_));else if(T)for(const F in T)this.imageManager.addImage(F,T[F]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(h){const _=this.sourceCaches[h.source];if(!_)return;const T=h.sourceLayer;if(!T)return;const F=_.getSource();(F.type==="geojson"||F.vectorLayerIds&&F.vectorLayerIds.indexOf(T)===-1)&&this.fire(new i.ErrorEvent(new Error(`Source layer "${T}" does not exist on source "${F.id}" as specified by style layer "${h.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const h in this.sourceCaches)if(!this.sourceCaches[h].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(h){const _=[];for(const T of h){const F=this._layers[T];F.type!=="custom"&&_.push(F.serialize())}return _}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const h in this.sourceCaches)if(this.sourceCaches[h].hasTransition())return!0;for(const h in this._layers)if(this._layers[h].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(h){if(!this._loaded)return;const _=this._changed;if(this._changed){const F=Object.keys(this._updatedLayers),O=Object.keys(this._removedLayers);(F.length||O.length)&&this._updateWorkerLayers(F,O);for(const K in this._updatedSources){const oe=this._updatedSources[K];if(oe==="reload")this._reloadSource(K);else{if(oe!=="clear")throw new Error(`Invalid action ${oe}`);this._clearSource(K)}}this._updateTilesForChangedImages();for(const K in this._updatedPaintProps)this._layers[K].updateTransitions(h);this.light.updateTransitions(h),this._resetUpdates()}const T={};for(const F in this.sourceCaches){const O=this.sourceCaches[F];T[F]=O.used,O.used=!1}for(const F of this._order){const O=this._layers[F];O.recalculate(h,this._availableImages),!O.isHidden(h.zoom)&&O.source&&(this.sourceCaches[O.source].used=!0)}for(const F in T){const O=this.sourceCaches[F];T[F]!==O.used&&O.fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:F}))}this.light.recalculate(h),this.z=h.zoom,_&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const h=Object.keys(this._changedImages);if(h.length){for(const _ in this.sourceCaches)this.sourceCaches[_].reloadTilesForDependencies(["icons","patterns"],h);this._changedImages={}}}_updateWorkerLayers(h,_){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(h),removedIds:_})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(h){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),h){const _=this.sourceCaches[h.source];if(!_)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain=new Yt(this,_,h),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=T=>{T.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=T=>{T.tile&&(T.sourceId===h.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(T.sourceId,T.tile.tileID)):T.source.type==="geojson"&&this.terrain.rememberForRerender(T.sourceId,T.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new i.Event("terrain",{terrain:h}))}setState(h){if(this._checkLoaded(),sr(this,i.validateStyle(h)))return!1;(h=i.clone$1(h)).layers=wn(h.layers);const _=function(F,O){if(!F)return[{command:zi.setStyle,args:[O]}];let K=[];try{if(!Q(F.version,O.version))return[{command:zi.setStyle,args:[O]}];Q(F.center,O.center)||K.push({command:zi.setCenter,args:[O.center]}),Q(F.zoom,O.zoom)||K.push({command:zi.setZoom,args:[O.zoom]}),Q(F.bearing,O.bearing)||K.push({command:zi.setBearing,args:[O.bearing]}),Q(F.pitch,O.pitch)||K.push({command:zi.setPitch,args:[O.pitch]}),Q(F.sprite,O.sprite)||K.push({command:zi.setSprite,args:[O.sprite]}),Q(F.glyphs,O.glyphs)||K.push({command:zi.setGlyphs,args:[O.glyphs]}),Q(F.transition,O.transition)||K.push({command:zi.setTransition,args:[O.transition]}),Q(F.light,O.light)||K.push({command:zi.setLight,args:[O.light]});const oe={},ue=[];(function(Te,ze,je,bt){let mt;for(mt in ze=ze||{},Te=Te||{})Object.prototype.hasOwnProperty.call(Te,mt)&&(Object.prototype.hasOwnProperty.call(ze,mt)||kn(mt,je,bt));for(mt in ze)Object.prototype.hasOwnProperty.call(ze,mt)&&(Object.prototype.hasOwnProperty.call(Te,mt)?Q(Te[mt],ze[mt])||(Te[mt].type==="geojson"&&ze[mt].type==="geojson"&&rt(Te,ze,mt)?je.push({command:zi.setGeoJSONSourceData,args:[mt,ze[mt].data]}):yt(mt,ze,je,bt)):Gn(mt,ze,je))})(F.sources,O.sources,ue,oe);const ve=[];F.layers&&F.layers.forEach(Te=>{oe[Te.source]?K.push({command:zi.removeLayer,args:[Te.id]}):ve.push(Te)}),K=K.concat(ue),function(Te,ze,je){ze=ze||[];const bt=(Te=Te||[]).map(Ni),mt=ze.map(Ni),gt=Te.reduce(qi,{}),Vt=ze.reduce(qi,{}),Zt=bt.slice(),ni=Object.create(null);let St,zt,ai,Ei,Bi,Hi,vi;for(St=0,zt=0;St<bt.length;St++)ai=bt[St],Object.prototype.hasOwnProperty.call(Vt,ai)?zt++:(je.push({command:zi.removeLayer,args:[ai]}),Zt.splice(Zt.indexOf(ai,zt),1));for(St=0,zt=0;St<mt.length;St++)ai=mt[mt.length-1-St],Zt[Zt.length-1-St]!==ai&&(Object.prototype.hasOwnProperty.call(gt,ai)?(je.push({command:zi.removeLayer,args:[ai]}),Zt.splice(Zt.lastIndexOf(ai,Zt.length-zt),1)):zt++,Hi=Zt[Zt.length-St],je.push({command:zi.addLayer,args:[Vt[ai],Hi]}),Zt.splice(Zt.length-St,0,ai),ni[ai]=!0);for(St=0;St<mt.length;St++)if(ai=mt[St],Ei=gt[ai],Bi=Vt[ai],!ni[ai]&&!Q(Ei,Bi))if(Q(Ei.source,Bi.source)&&Q(Ei["source-layer"],Bi["source-layer"])&&Q(Ei.type,Bi.type)){for(vi in ti(Ei.layout,Bi.layout,je,ai,null,zi.setLayoutProperty),ti(Ei.paint,Bi.paint,je,ai,null,zi.setPaintProperty),Q(Ei.filter,Bi.filter)||je.push({command:zi.setFilter,args:[ai,Bi.filter]}),Q(Ei.minzoom,Bi.minzoom)&&Q(Ei.maxzoom,Bi.maxzoom)||je.push({command:zi.setLayerZoomRange,args:[ai,Bi.minzoom,Bi.maxzoom]}),Ei)Object.prototype.hasOwnProperty.call(Ei,vi)&&vi!=="layout"&&vi!=="paint"&&vi!=="filter"&&vi!=="metadata"&&vi!=="minzoom"&&vi!=="maxzoom"&&(vi.indexOf("paint.")===0?ti(Ei[vi],Bi[vi],je,ai,vi.slice(6),zi.setPaintProperty):Q(Ei[vi],Bi[vi])||je.push({command:zi.setLayerProperty,args:[ai,vi,Bi[vi]]}));for(vi in Bi)Object.prototype.hasOwnProperty.call(Bi,vi)&&!Object.prototype.hasOwnProperty.call(Ei,vi)&&vi!=="layout"&&vi!=="paint"&&vi!=="filter"&&vi!=="metadata"&&vi!=="minzoom"&&vi!=="maxzoom"&&(vi.indexOf("paint.")===0?ti(Ei[vi],Bi[vi],je,ai,vi.slice(6),zi.setPaintProperty):Q(Ei[vi],Bi[vi])||je.push({command:zi.setLayerProperty,args:[ai,vi,Bi[vi]]}))}else je.push({command:zi.removeLayer,args:[ai]}),Hi=Zt[Zt.lastIndexOf(ai)+1],je.push({command:zi.addLayer,args:[Bi,Hi]})}(ve,O.layers,K)}catch(oe){console.warn("Unable to compute style diff:",oe),K=[{command:zi.setStyle,args:[O]}]}return K}(this.serialize(),h).filter(F=>!(F.command in Wr));if(_.length===0)return!1;const T=_.filter(F=>!(F.command in Yn));if(T.length>0)throw new Error(`Unimplemented: ${T.map(F=>F.command).join(", ")}.`);return _.forEach(F=>{F.command!=="setTransition"&&this[F.command].apply(this,F.args)}),this.stylesheet=h,!0}addImage(h,_){if(this.getImage(h))return this.fire(new i.ErrorEvent(new Error(`An image named "${h}" already exists.`)));this.imageManager.addImage(h,_),this._afterImageUpdated(h)}updateImage(h,_){this.imageManager.updateImage(h,_)}getImage(h){return this.imageManager.getImage(h)}removeImage(h){if(!this.getImage(h))return this.fire(new i.ErrorEvent(new Error(`An image named "${h}" does not exist.`)));this.imageManager.removeImage(h),this._afterImageUpdated(h)}_afterImageUpdated(h){this._availableImages=this.imageManager.listImages(),this._changedImages[h]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(h,_,T={}){if(this._checkLoaded(),this.sourceCaches[h]!==void 0)throw new Error(`Source "${h}" already exists.`);if(!_.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(_).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(_.type)>=0&&this._validate(i.validateStyle.source,`sources.${h}`,_,null,T))return;this.map&&this.map._collectResourceTiming&&(_.collectResourceTiming=!0);const F=this.sourceCaches[h]=new Nt(h,_,this.dispatcher);F.style=this,F.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:F.serialize(),sourceId:h})),F.onAdd(this.map),this._changed=!0}removeSource(h){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error("There is no source with this ID");for(const T in this._layers)if(this._layers[T].source===h)return this.fire(new i.ErrorEvent(new Error(`Source "${h}" cannot be removed while layer "${T}" is using it.`)));const _=this.sourceCaches[h];delete this.sourceCaches[h],delete this._updatedSources[h],_.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:h})),_.setEventedParent(null),_.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(h,_){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error(`There is no source with this ID=${h}`);const T=this.sourceCaches[h].getSource();if(T.type!=="geojson")throw new Error(`geojsonSource.type is ${T.type}, which is !== 'geojson`);T.setData(_),this._changed=!0}getSource(h){return this.sourceCaches[h]&&this.sourceCaches[h].getSource()}addLayer(h,_,T={}){this._checkLoaded();const F=h.id;if(this.getLayer(F))return void this.fire(new i.ErrorEvent(new Error(`Layer "${F}" already exists on this map.`)));let O;if(h.type==="custom"){if(sr(this,i.validateCustomStyleLayer(h)))return;O=i.createStyleLayer(h)}else{if(typeof h.source=="object"&&(this.addSource(F,h.source),h=i.clone$1(h),h=i.extend(h,{source:F})),this._validate(i.validateStyle.layer,`layers.${F}`,h,{arrayIndex:-1},T))return;O=i.createStyleLayer(h),this._validateLayer(O),O.setEventedParent(this,{layer:{id:F}}),this._serializedLayers[O.id]=O.serialize()}const K=_?this._order.indexOf(_):this._order.length;if(_&&K===-1)this.fire(new i.ErrorEvent(new Error(`Cannot add layer "${F}" before non-existing layer "${_}".`)));else{if(this._order.splice(K,0,F),this._layerOrderChanged=!0,this._layers[F]=O,this._removedLayers[F]&&O.source&&O.type!=="custom"){const oe=this._removedLayers[F];delete this._removedLayers[F],oe.type!==O.type?this._updatedSources[O.source]="clear":(this._updatedSources[O.source]="reload",this.sourceCaches[O.source].pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map)}}moveLayer(h,_){if(this._checkLoaded(),this._changed=!0,!this._layers[h])return void this.fire(new i.ErrorEvent(new Error(`The layer '${h}' does not exist in the map's style and cannot be moved.`)));if(h===_)return;const T=this._order.indexOf(h);this._order.splice(T,1);const F=_?this._order.indexOf(_):this._order.length;_&&F===-1?this.fire(new i.ErrorEvent(new Error(`Cannot move layer "${h}" before non-existing layer "${_}".`))):(this._order.splice(F,0,h),this._layerOrderChanged=!0)}removeLayer(h){this._checkLoaded();const _=this._layers[h];if(!_)return void this.fire(new i.ErrorEvent(new Error(`Cannot remove non-existing layer "${h}".`)));_.setEventedParent(null);const T=this._order.indexOf(h);this._order.splice(T,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[h]=_,delete this._layers[h],delete this._serializedLayers[h],delete this._updatedLayers[h],delete this._updatedPaintProps[h],_.onRemove&&_.onRemove(this.map)}getLayer(h){return this._layers[h]}hasLayer(h){return h in this._layers}setLayerZoomRange(h,_,T){this._checkLoaded();const F=this.getLayer(h);F?F.minzoom===_&&F.maxzoom===T||(_!=null&&(F.minzoom=_),T!=null&&(F.maxzoom=T),this._updateLayer(F)):this.fire(new i.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${h}".`)))}setFilter(h,_,T={}){this._checkLoaded();const F=this.getLayer(h);if(F){if(!Q(F.filter,_))return _==null?(F.filter=void 0,void this._updateLayer(F)):void(this._validate(i.validateStyle.filter,`layers.${F.id}.filter`,_,null,T)||(F.filter=i.clone$1(_),this._updateLayer(F)))}else this.fire(new i.ErrorEvent(new Error(`Cannot filter non-existing layer "${h}".`)))}getFilter(h){return i.clone$1(this.getLayer(h).filter)}setLayoutProperty(h,_,T,F={}){this._checkLoaded();const O=this.getLayer(h);O?Q(O.getLayoutProperty(_),T)||(O.setLayoutProperty(_,T,F),this._updateLayer(O)):this.fire(new i.ErrorEvent(new Error(`Cannot style non-existing layer "${h}".`)))}getLayoutProperty(h,_){const T=this.getLayer(h);if(T)return T.getLayoutProperty(_);this.fire(new i.ErrorEvent(new Error(`Cannot get style of non-existing layer "${h}".`)))}setPaintProperty(h,_,T,F={}){this._checkLoaded();const O=this.getLayer(h);O?Q(O.getPaintProperty(_),T)||(O.setPaintProperty(_,T,F)&&this._updateLayer(O),this._changed=!0,this._updatedPaintProps[h]=!0):this.fire(new i.ErrorEvent(new Error(`Cannot style non-existing layer "${h}".`)))}getPaintProperty(h,_){return this.getLayer(h).getPaintProperty(_)}setFeatureState(h,_){this._checkLoaded();const T=h.source,F=h.sourceLayer,O=this.sourceCaches[T];if(O===void 0)return void this.fire(new i.ErrorEvent(new Error(`The source '${T}' does not exist in the map's style.`)));const K=O.getSource().type;K==="geojson"&&F?this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):K!=="vector"||F?(h.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),O.setFeatureState(F,h.id,_)):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(h,_){this._checkLoaded();const T=h.source,F=this.sourceCaches[T];if(F===void 0)return void this.fire(new i.ErrorEvent(new Error(`The source '${T}' does not exist in the map's style.`)));const O=F.getSource().type,K=O==="vector"?h.sourceLayer:void 0;O!=="vector"||K?_&&typeof h.id!="string"&&typeof h.id!="number"?this.fire(new i.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):F.removeFeatureState(K,h.id,_):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(h){this._checkLoaded();const _=h.source,T=h.sourceLayer,F=this.sourceCaches[_];if(F!==void 0)return F.getSource().type!=="vector"||T?(h.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),F.getFeatureState(T,h.id)):void this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new i.ErrorEvent(new Error(`The source '${_}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:i.mapObject(this.sourceCaches,h=>h.serialize()),layers:this._serializeLayers(this._order)},h=>h!==void 0)}_updateLayer(h){this._updatedLayers[h.id]=!0,h.source&&!this._updatedSources[h.source]&&this.sourceCaches[h.source].getSource().type!=="raster"&&(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(h){const _=K=>this._layers[K].type==="fill-extrusion",T={},F=[];for(let K=this._order.length-1;K>=0;K--){const oe=this._order[K];if(_(oe)){T[oe]=K;for(const ue of h){const ve=ue[oe];if(ve)for(const Te of ve)F.push(Te)}}}F.sort((K,oe)=>oe.intersectionZ-K.intersectionZ);const O=[];for(let K=this._order.length-1;K>=0;K--){const oe=this._order[K];if(_(oe))for(let ue=F.length-1;ue>=0;ue--){const ve=F[ue].feature;if(T[ve.layer.id]<K)break;O.push(ve),F.pop()}else for(const ue of h){const ve=ue[oe];if(ve)for(const Te of ve)O.push(Te.feature)}}return O}queryRenderedFeatures(h,_,T){_&&_.filter&&this._validate(i.validateStyle.filter,"queryRenderedFeatures.filter",_.filter,null,_);const F={};if(_&&_.layers){if(!Array.isArray(_.layers))return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const K of _.layers){const oe=this._layers[K];if(!oe)return this.fire(new i.ErrorEvent(new Error(`The layer '${K}' does not exist in the map's style and cannot be queried for features.`))),[];F[oe.source]=!0}}const O=[];_.availableImages=this._availableImages;for(const K in this.sourceCaches)_.layers&&!F[K]||O.push(nt(this.sourceCaches[K],this._layers,this._serializedLayers,h,_,T));return this.placement&&O.push(function(K,oe,ue,ve,Te,ze,je){const bt={},mt=ze.queryRenderedSymbols(ve),gt=[];for(const Vt of Object.keys(mt).map(Number))gt.push(je[Vt]);gt.sort(vt);for(const Vt of gt){const Zt=Vt.featureIndex.lookupSymbolFeatures(mt[Vt.bucketInstanceId],oe,Vt.bucketIndex,Vt.sourceLayerIndex,Te.filter,Te.layers,Te.availableImages,K);for(const ni in Zt){const St=bt[ni]=bt[ni]||[],zt=Zt[ni];zt.sort((ai,Ei)=>{const Bi=Vt.featureSortOrder;if(Bi){const Hi=Bi.indexOf(ai.featureIndex);return Bi.indexOf(Ei.featureIndex)-Hi}return Ei.featureIndex-ai.featureIndex});for(const ai of zt)St.push(ai)}}for(const Vt in bt)bt[Vt].forEach(Zt=>{const ni=Zt.feature,St=ue[K[Vt].source].getFeatureState(ni.layer["source-layer"],ni.id);ni.source=ni.layer.source,ni.layer["source-layer"]&&(ni.sourceLayer=ni.layer["source-layer"]),ni.state=St});return bt}(this._layers,this._serializedLayers,this.sourceCaches,h,_,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(O)}querySourceFeatures(h,_){_&&_.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",_.filter,null,_);const T=this.sourceCaches[h];return T?function(F,O){const K=F.getRenderableIds().map(ve=>F.getTileByID(ve)),oe=[],ue={};for(let ve=0;ve<K.length;ve++){const Te=K[ve],ze=Te.tileID.canonical.key;ue[ze]||(ue[ze]=!0,Te.querySourceFeatures(oe,O))}return oe}(T,_):[]}addSourceType(h,_,T){return Mr.getSourceType(h)?T(new Error(`A source type called "${h}" already exists.`)):(Mr.setSourceType(h,_),_.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:h,url:_.workerSourceURL},T):T(null,null))}getLight(){return this.light.getLight()}setLight(h,_={}){this._checkLoaded();const T=this.light.getLight();let F=!1;for(const K in h)if(!Q(h[K],T[K])){F=!0;break}if(!F)return;const O={now:i.exported.now(),transition:i.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(h,_),this.light.updateTransitions(O)}_validate(h,_,T,F,O={}){return(!O||O.validate!==!1)&&sr(this,h.call(i.validateStyle,i.extend({key:_,style:this.serialize(),value:T,styleSpec:i.spec},F)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const h in this._layers)this._layers[h].setEventedParent(null);for(const h in this.sourceCaches){const _=this.sourceCaches[h];_.setEventedParent(null),_.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(h){this.sourceCaches[h].clearTiles()}_reloadSource(h){this.sourceCaches[h].resume(),this.sourceCaches[h].reload()}_updateSources(h){for(const _ in this.sourceCaches)this.sourceCaches[_].update(h,this.terrain)}_generateCollisionBoxes(){for(const h in this.sourceCaches)this._reloadSource(h)}_updatePlacement(h,_,T,F,O=!1){let K=!1,oe=!1;const ue={};for(const ve of this._order){const Te=this._layers[ve];if(Te.type!=="symbol")continue;if(!ue[Te.source]){const je=this.sourceCaches[Te.source];ue[Te.source]=je.getRenderableIds(!0).map(bt=>je.getTileByID(bt)).sort((bt,mt)=>mt.tileID.overscaledZ-bt.tileID.overscaledZ||(bt.tileID.isLessThan(mt.tileID)?-1:1))}const ze=this.crossTileSymbolIndex.addLayer(Te,ue[Te.source],h.center.lng);K=K||ze}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((O=O||this._layerOrderChanged||T===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),h.zoom))&&(this.pauseablePlacement=new Wt(h,this.terrain,this._order,O,_,T,F,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ue),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),oe=!0),K&&this.pauseablePlacement.placement.setStale()),oe||K)for(const ve of this._order){const Te=this._layers[ve];Te.type==="symbol"&&this.placement.updateLayerOpacities(Te,ue[Te.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const h in this.sourceCaches)this.sourceCaches[h].releaseSymbolFadeTiles()}getImages(h,_,T){this.imageManager.getImages(_.icons,T),this._updateTilesForChangedImages();const F=this.sourceCaches[_.source];F&&F.setDependencies(_.tileID.key,_.type,_.icons)}getGlyphs(h,_,T){this.glyphManager.getGlyphs(_.stacks,T)}getResource(h,_,T){return i.makeRequest(_,T)}}Mr.getSourceType=function(M){return Se[M]},Mr.setSourceType=function(M,h){Se[M]=h},Mr.registerForPluginStateChange=i.registerForPluginStateChange;var Oo="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const zs={prelude:or(`#ifdef GL_ES
  22. precision mediump float;
  23. #else
  24. #if !defined(lowp)
  25. #define lowp
  26. #endif
  27. #if !defined(mediump)
  28. #define mediump
  29. #endif
  30. #if !defined(highp)
  31. #define highp
  32. #endif
  33. #endif`,`#ifdef GL_ES
  34. precision highp float;
  35. #else
  36. #if !defined(lowp)
  37. #define lowp
  38. #endif
  39. #if !defined(mediump)
  40. #define mediump
  41. #endif
  42. #if !defined(highp)
  43. #define highp
  44. #endif
  45. #endif
  46. vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
  47. );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
  48. #ifdef TERRAIN3D
  49. uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
  50. #endif
  51. const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
  52. #ifdef TERRAIN3D
  53. highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
  54. #else
  55. return 1.0;
  56. #endif
  57. }float calculate_visibility(vec4 pos) {
  58. #ifdef TERRAIN3D
  59. vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
  60. #else
  61. return 1.0;
  62. #endif
  63. }float ele(vec2 pos) {
  64. #ifdef TERRAIN3D
  65. vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
  66. #else
  67. return 0.0;
  68. #endif
  69. }float get_elevation(vec2 pos) {
  70. #ifdef TERRAIN3D
  71. vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;
  72. #else
  73. return 0.0;
  74. #endif
  75. }`),background:or(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
  76. #ifdef OVERDRAW_INSPECTOR
  77. gl_FragColor=vec4(1.0);
  78. #endif
  79. }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:or(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
  80. #ifdef OVERDRAW_INSPECTOR
  81. gl_FragColor=vec4(1.0);
  82. #endif
  83. }`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:or(`varying vec3 v_data;varying float v_visibility;
  84. #pragma mapbox: define highp vec4 color
  85. #pragma mapbox: define mediump float radius
  86. #pragma mapbox: define lowp float blur
  87. #pragma mapbox: define lowp float opacity
  88. #pragma mapbox: define highp vec4 stroke_color
  89. #pragma mapbox: define mediump float stroke_width
  90. #pragma mapbox: define lowp float stroke_opacity
  91. void main() {
  92. #pragma mapbox: initialize highp vec4 color
  93. #pragma mapbox: initialize mediump float radius
  94. #pragma mapbox: initialize lowp float blur
  95. #pragma mapbox: initialize lowp float opacity
  96. #pragma mapbox: initialize highp vec4 stroke_color
  97. #pragma mapbox: initialize mediump float stroke_width
  98. #pragma mapbox: initialize lowp float stroke_opacity
  99. vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
  100. #ifdef OVERDRAW_INSPECTOR
  101. gl_FragColor=vec4(1.0);
  102. #endif
  103. }`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
  104. #pragma mapbox: define highp vec4 color
  105. #pragma mapbox: define mediump float radius
  106. #pragma mapbox: define lowp float blur
  107. #pragma mapbox: define lowp float opacity
  108. #pragma mapbox: define highp vec4 stroke_color
  109. #pragma mapbox: define mediump float stroke_width
  110. #pragma mapbox: define lowp float stroke_opacity
  111. void main(void) {
  112. #pragma mapbox: initialize highp vec4 color
  113. #pragma mapbox: initialize mediump float radius
  114. #pragma mapbox: initialize lowp float blur
  115. #pragma mapbox: initialize lowp float opacity
  116. #pragma mapbox: initialize highp vec4 stroke_color
  117. #pragma mapbox: initialize mediump float stroke_width
  118. #pragma mapbox: initialize lowp float stroke_opacity
  119. vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:or("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:or(`uniform highp float u_intensity;varying vec2 v_extrude;
  120. #pragma mapbox: define highp float weight
  121. #define GAUSS_COEF 0.3989422804014327
  122. void main() {
  123. #pragma mapbox: initialize highp float weight
  124. float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
  125. #ifdef OVERDRAW_INSPECTOR
  126. gl_FragColor=vec4(1.0);
  127. #endif
  128. }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
  129. #pragma mapbox: define highp float weight
  130. #pragma mapbox: define mediump float radius
  131. const highp float ZERO=1.0/255.0/16.0;
  132. #define GAUSS_COEF 0.3989422804014327
  133. void main(void) {
  134. #pragma mapbox: initialize highp float weight
  135. #pragma mapbox: initialize mediump float radius
  136. vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:or(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
  137. #ifdef OVERDRAW_INSPECTOR
  138. gl_FragColor=vec4(0.0);
  139. #endif
  140. }`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:or("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:or("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:or("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:or(`#pragma mapbox: define highp vec4 color
  141. #pragma mapbox: define lowp float opacity
  142. void main() {
  143. #pragma mapbox: initialize highp vec4 color
  144. #pragma mapbox: initialize lowp float opacity
  145. gl_FragColor=color*opacity;
  146. #ifdef OVERDRAW_INSPECTOR
  147. gl_FragColor=vec4(1.0);
  148. #endif
  149. }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
  150. #pragma mapbox: define highp vec4 color
  151. #pragma mapbox: define lowp float opacity
  152. void main() {
  153. #pragma mapbox: initialize highp vec4 color
  154. #pragma mapbox: initialize lowp float opacity
  155. gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:or(`varying vec2 v_pos;
  156. #pragma mapbox: define highp vec4 outline_color
  157. #pragma mapbox: define lowp float opacity
  158. void main() {
  159. #pragma mapbox: initialize highp vec4 outline_color
  160. #pragma mapbox: initialize lowp float opacity
  161. float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
  162. #ifdef OVERDRAW_INSPECTOR
  163. gl_FragColor=vec4(1.0);
  164. #endif
  165. }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
  166. #pragma mapbox: define highp vec4 outline_color
  167. #pragma mapbox: define lowp float opacity
  168. void main() {
  169. #pragma mapbox: initialize highp vec4 outline_color
  170. #pragma mapbox: initialize lowp float opacity
  171. gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:or(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
  172. #pragma mapbox: define lowp float opacity
  173. #pragma mapbox: define lowp vec4 pattern_from
  174. #pragma mapbox: define lowp vec4 pattern_to
  175. void main() {
  176. #pragma mapbox: initialize lowp float opacity
  177. #pragma mapbox: initialize mediump vec4 pattern_from
  178. #pragma mapbox: initialize mediump vec4 pattern_to
  179. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
  180. #ifdef OVERDRAW_INSPECTOR
  181. gl_FragColor=vec4(1.0);
  182. #endif
  183. }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
  184. #pragma mapbox: define lowp float opacity
  185. #pragma mapbox: define lowp vec4 pattern_from
  186. #pragma mapbox: define lowp vec4 pattern_to
  187. #pragma mapbox: define lowp float pixel_ratio_from
  188. #pragma mapbox: define lowp float pixel_ratio_to
  189. void main() {
  190. #pragma mapbox: initialize lowp float opacity
  191. #pragma mapbox: initialize mediump vec4 pattern_from
  192. #pragma mapbox: initialize mediump vec4 pattern_to
  193. #pragma mapbox: initialize lowp float pixel_ratio_from
  194. #pragma mapbox: initialize lowp float pixel_ratio_to
  195. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:or(`#ifdef GL_ES
  196. precision highp float;
  197. #endif
  198. uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
  199. #pragma mapbox: define lowp float opacity
  200. #pragma mapbox: define lowp vec4 pattern_from
  201. #pragma mapbox: define lowp vec4 pattern_to
  202. void main() {
  203. #pragma mapbox: initialize lowp float opacity
  204. #pragma mapbox: initialize mediump vec4 pattern_from
  205. #pragma mapbox: initialize mediump vec4 pattern_to
  206. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
  207. #ifdef OVERDRAW_INSPECTOR
  208. gl_FragColor=vec4(1.0);
  209. #endif
  210. }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
  211. #pragma mapbox: define lowp float opacity
  212. #pragma mapbox: define lowp vec4 pattern_from
  213. #pragma mapbox: define lowp vec4 pattern_to
  214. #pragma mapbox: define lowp float pixel_ratio_from
  215. #pragma mapbox: define lowp float pixel_ratio_to
  216. void main() {
  217. #pragma mapbox: initialize lowp float opacity
  218. #pragma mapbox: initialize mediump vec4 pattern_from
  219. #pragma mapbox: initialize mediump vec4 pattern_to
  220. #pragma mapbox: initialize lowp float pixel_ratio_from
  221. #pragma mapbox: initialize lowp float pixel_ratio_to
  222. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:or(`varying vec4 v_color;void main() {gl_FragColor=v_color;
  223. #ifdef OVERDRAW_INSPECTOR
  224. gl_FragColor=vec4(1.0);
  225. #endif
  226. }`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
  227. #ifdef TERRAIN3D
  228. attribute vec2 a_centroid;
  229. #endif
  230. varying vec4 v_color;
  231. #pragma mapbox: define highp float base
  232. #pragma mapbox: define highp float height
  233. #pragma mapbox: define highp vec4 color
  234. void main() {
  235. #pragma mapbox: initialize highp float base
  236. #pragma mapbox: initialize highp float height
  237. #pragma mapbox: initialize highp vec4 color
  238. vec3 normal=a_normal_ed.xyz;
  239. #ifdef TERRAIN3D
  240. float baseDelta=10.0;float ele=get_elevation(a_centroid);
  241. #else
  242. float baseDelta=0.0;float ele=0.0;
  243. #endif
  244. base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:or(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
  245. #pragma mapbox: define lowp float base
  246. #pragma mapbox: define lowp float height
  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
  251. void main() {
  252. #pragma mapbox: initialize lowp float base
  253. #pragma mapbox: initialize lowp float height
  254. #pragma mapbox: initialize mediump vec4 pattern_from
  255. #pragma mapbox: initialize mediump vec4 pattern_to
  256. #pragma mapbox: initialize lowp float pixel_ratio_from
  257. #pragma mapbox: initialize lowp float pixel_ratio_to
  258. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
  259. #ifdef OVERDRAW_INSPECTOR
  260. gl_FragColor=vec4(1.0);
  261. #endif
  262. }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
  263. #ifdef TERRAIN3D
  264. attribute vec2 a_centroid;
  265. #endif
  266. varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
  267. #pragma mapbox: define lowp float base
  268. #pragma mapbox: define lowp float height
  269. #pragma mapbox: define lowp vec4 pattern_from
  270. #pragma mapbox: define lowp vec4 pattern_to
  271. #pragma mapbox: define lowp float pixel_ratio_from
  272. #pragma mapbox: define lowp float pixel_ratio_to
  273. void main() {
  274. #pragma mapbox: initialize lowp float base
  275. #pragma mapbox: initialize lowp float height
  276. #pragma mapbox: initialize mediump vec4 pattern_from
  277. #pragma mapbox: initialize mediump vec4 pattern_to
  278. #pragma mapbox: initialize lowp float pixel_ratio_from
  279. #pragma mapbox: initialize lowp float pixel_ratio_to
  280. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
  281. #ifdef TERRAIN3D
  282. float baseDelta=10.0;float ele=get_elevation(a_centroid);
  283. #else
  284. float baseDelta=0.0;float ele=0.0;
  285. #endif
  286. base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
  287. ? a_pos
  288. : vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:or(`#ifdef GL_ES
  289. precision highp float;
  290. #endif
  291. uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
  292. #ifdef OVERDRAW_INSPECTOR
  293. gl_FragColor=vec4(1.0);
  294. #endif
  295. }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:or(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
  296. #define PI 3.141592653589793
  297. void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
  298. #ifdef OVERDRAW_INSPECTOR
  299. gl_FragColor=vec4(1.0);
  300. #endif
  301. }`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:or(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
  302. #pragma mapbox: define highp vec4 color
  303. #pragma mapbox: define lowp float blur
  304. #pragma mapbox: define lowp float opacity
  305. void main() {
  306. #pragma mapbox: initialize highp vec4 color
  307. #pragma mapbox: initialize lowp float blur
  308. #pragma mapbox: initialize lowp float opacity
  309. float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
  310. #ifdef OVERDRAW_INSPECTOR
  311. gl_FragColor=vec4(1.0);
  312. #endif
  313. }`,`
  314. #define scale 0.015873016
  315. attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
  316. #pragma mapbox: define highp vec4 color
  317. #pragma mapbox: define lowp float blur
  318. #pragma mapbox: define lowp float opacity
  319. #pragma mapbox: define mediump float gapwidth
  320. #pragma mapbox: define lowp float offset
  321. #pragma mapbox: define mediump float width
  322. void main() {
  323. #pragma mapbox: initialize highp vec4 color
  324. #pragma mapbox: initialize lowp float blur
  325. #pragma mapbox: initialize lowp float opacity
  326. #pragma mapbox: initialize mediump float gapwidth
  327. #pragma mapbox: initialize lowp float offset
  328. #pragma mapbox: initialize mediump float width
  329. float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
  330. #ifdef TERRAIN3D
  331. v_gamma_scale=1.0;
  332. #else
  333. float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
  334. #endif
  335. v_width2=vec2(outset,inset);}`),lineGradient:or(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
  336. #pragma mapbox: define lowp float blur
  337. #pragma mapbox: define lowp float opacity
  338. void main() {
  339. #pragma mapbox: initialize lowp float blur
  340. #pragma mapbox: initialize lowp float opacity
  341. float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
  342. #ifdef OVERDRAW_INSPECTOR
  343. gl_FragColor=vec4(1.0);
  344. #endif
  345. }`,`
  346. #define scale 0.015873016
  347. attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
  348. #pragma mapbox: define lowp float blur
  349. #pragma mapbox: define lowp float opacity
  350. #pragma mapbox: define mediump float gapwidth
  351. #pragma mapbox: define lowp float offset
  352. #pragma mapbox: define mediump float width
  353. void main() {
  354. #pragma mapbox: initialize lowp float blur
  355. #pragma mapbox: initialize lowp float opacity
  356. #pragma mapbox: initialize mediump float gapwidth
  357. #pragma mapbox: initialize lowp float offset
  358. #pragma mapbox: initialize mediump float width
  359. float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
  360. #ifdef TERRAIN3D
  361. v_gamma_scale=1.0;
  362. #else
  363. float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
  364. #endif
  365. v_width2=vec2(outset,inset);}`),linePattern:or(`#ifdef GL_ES
  366. precision highp float;
  367. #endif
  368. uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
  369. #pragma mapbox: define lowp vec4 pattern_from
  370. #pragma mapbox: define lowp vec4 pattern_to
  371. #pragma mapbox: define lowp float pixel_ratio_from
  372. #pragma mapbox: define lowp float pixel_ratio_to
  373. #pragma mapbox: define lowp float blur
  374. #pragma mapbox: define lowp float opacity
  375. void main() {
  376. #pragma mapbox: initialize mediump vec4 pattern_from
  377. #pragma mapbox: initialize mediump vec4 pattern_to
  378. #pragma mapbox: initialize lowp float pixel_ratio_from
  379. #pragma mapbox: initialize lowp float pixel_ratio_to
  380. #pragma mapbox: initialize lowp float blur
  381. #pragma mapbox: initialize lowp float opacity
  382. vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
  383. #ifdef OVERDRAW_INSPECTOR
  384. gl_FragColor=vec4(1.0);
  385. #endif
  386. }`,`
  387. #define scale 0.015873016
  388. #define LINE_DISTANCE_SCALE 2.0
  389. attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
  390. #pragma mapbox: define lowp float blur
  391. #pragma mapbox: define lowp float opacity
  392. #pragma mapbox: define lowp float offset
  393. #pragma mapbox: define mediump float gapwidth
  394. #pragma mapbox: define mediump float width
  395. #pragma mapbox: define lowp float floorwidth
  396. #pragma mapbox: define lowp vec4 pattern_from
  397. #pragma mapbox: define lowp vec4 pattern_to
  398. #pragma mapbox: define lowp float pixel_ratio_from
  399. #pragma mapbox: define lowp float pixel_ratio_to
  400. void main() {
  401. #pragma mapbox: initialize lowp float blur
  402. #pragma mapbox: initialize lowp float opacity
  403. #pragma mapbox: initialize lowp float offset
  404. #pragma mapbox: initialize mediump float gapwidth
  405. #pragma mapbox: initialize mediump float width
  406. #pragma mapbox: initialize lowp float floorwidth
  407. #pragma mapbox: initialize mediump vec4 pattern_from
  408. #pragma mapbox: initialize mediump vec4 pattern_to
  409. #pragma mapbox: initialize lowp float pixel_ratio_from
  410. #pragma mapbox: initialize lowp float pixel_ratio_to
  411. float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
  412. #ifdef TERRAIN3D
  413. v_gamma_scale=1.0;
  414. #else
  415. float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
  416. #endif
  417. v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:or(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
  418. #pragma mapbox: define highp vec4 color
  419. #pragma mapbox: define lowp float blur
  420. #pragma mapbox: define lowp float opacity
  421. #pragma mapbox: define mediump float width
  422. #pragma mapbox: define lowp float floorwidth
  423. void 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 width
  428. #pragma mapbox: initialize lowp float floorwidth
  429. float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
  430. #ifdef OVERDRAW_INSPECTOR
  431. gl_FragColor=vec4(1.0);
  432. #endif
  433. }`,`
  434. #define scale 0.015873016
  435. #define LINE_DISTANCE_SCALE 2.0
  436. attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
  437. #pragma mapbox: define highp vec4 color
  438. #pragma mapbox: define lowp float blur
  439. #pragma mapbox: define lowp float opacity
  440. #pragma mapbox: define mediump float gapwidth
  441. #pragma mapbox: define lowp float offset
  442. #pragma mapbox: define mediump float width
  443. #pragma mapbox: define lowp float floorwidth
  444. void main() {
  445. #pragma mapbox: initialize highp vec4 color
  446. #pragma mapbox: initialize lowp float blur
  447. #pragma mapbox: initialize lowp float opacity
  448. #pragma mapbox: initialize mediump float gapwidth
  449. #pragma mapbox: initialize lowp float offset
  450. #pragma mapbox: initialize mediump float width
  451. #pragma mapbox: initialize lowp float floorwidth
  452. float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
  453. #ifdef TERRAIN3D
  454. v_gamma_scale=1.0;
  455. #else
  456. float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
  457. #endif
  458. v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:or(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
  459. #ifdef OVERDRAW_INSPECTOR
  460. gl_FragColor=vec4(1.0);
  461. #endif
  462. }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:or(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
  463. #pragma mapbox: define lowp float opacity
  464. void main() {
  465. #pragma mapbox: initialize lowp float opacity
  466. lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
  467. #ifdef OVERDRAW_INSPECTOR
  468. gl_FragColor=vec4(1.0);
  469. #endif
  470. }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
  471. #pragma mapbox: define lowp float opacity
  472. void main() {
  473. #pragma mapbox: initialize lowp float opacity
  474. vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
  475. camera_to_anchor_distance/u_camera_to_center_distance :
  476. u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:or(`#define SDF_PX 8.0
  477. uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
  478. #pragma mapbox: define highp vec4 fill_color
  479. #pragma mapbox: define highp vec4 halo_color
  480. #pragma mapbox: define lowp float opacity
  481. #pragma mapbox: define lowp float halo_width
  482. #pragma mapbox: define lowp float halo_blur
  483. void main() {
  484. #pragma mapbox: initialize highp vec4 fill_color
  485. #pragma mapbox: initialize highp vec4 halo_color
  486. #pragma mapbox: initialize lowp float opacity
  487. #pragma mapbox: initialize lowp float halo_width
  488. #pragma mapbox: initialize lowp float halo_blur
  489. float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
  490. #ifdef OVERDRAW_INSPECTOR
  491. gl_FragColor=vec4(1.0);
  492. #endif
  493. }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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;varying vec2 v_data0;varying vec3 v_data1;
  494. #pragma mapbox: define highp vec4 fill_color
  495. #pragma mapbox: define highp vec4 halo_color
  496. #pragma mapbox: define lowp float opacity
  497. #pragma mapbox: define lowp float halo_width
  498. #pragma mapbox: define lowp float halo_blur
  499. void main() {
  500. #pragma mapbox: initialize highp vec4 fill_color
  501. #pragma mapbox: initialize highp vec4 halo_color
  502. #pragma mapbox: initialize lowp float opacity
  503. #pragma mapbox: initialize lowp float halo_width
  504. #pragma mapbox: initialize lowp float halo_blur
  505. vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
  506. camera_to_anchor_distance/u_camera_to_center_distance :
  507. u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:or(`#define SDF_PX 8.0
  508. #define SDF 1.0
  509. #define ICON 0.0
  510. uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
  511. #pragma mapbox: define highp vec4 fill_color
  512. #pragma mapbox: define highp vec4 halo_color
  513. #pragma mapbox: define lowp float opacity
  514. #pragma mapbox: define lowp float halo_width
  515. #pragma mapbox: define lowp float halo_blur
  516. void main() {
  517. #pragma mapbox: initialize highp vec4 fill_color
  518. #pragma mapbox: initialize highp vec4 halo_color
  519. #pragma mapbox: initialize lowp float opacity
  520. #pragma mapbox: initialize lowp float halo_width
  521. #pragma mapbox: initialize lowp float halo_blur
  522. float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
  523. #ifdef OVERDRAW_INSPECTOR
  524. gl_FragColor=vec4(1.0);
  525. #endif
  526. return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
  527. #ifdef OVERDRAW_INSPECTOR
  528. gl_FragColor=vec4(1.0);
  529. #endif
  530. }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
  531. #pragma mapbox: define highp vec4 fill_color
  532. #pragma mapbox: define highp vec4 halo_color
  533. #pragma mapbox: define lowp float opacity
  534. #pragma mapbox: define lowp float halo_width
  535. #pragma mapbox: define lowp float halo_blur
  536. void main() {
  537. #pragma mapbox: initialize highp vec4 fill_color
  538. #pragma mapbox: initialize highp vec4 halo_color
  539. #pragma mapbox: initialize lowp float opacity
  540. #pragma mapbox: initialize lowp float halo_width
  541. #pragma mapbox: initialize lowp float halo_blur
  542. vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
  543. camera_to_anchor_distance/u_camera_to_center_distance :
  544. u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:or("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Oo),terrainDepth:or("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Oo),terrainCoords:or("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Oo)};function or(M,h){const _=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,T=h.match(/attribute ([\w]+) ([\w]+)/g),F=M.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),O=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),K=O?O.concat(F):F,oe={};return{fragmentSource:M=M.replace(_,(ue,ve,Te,ze,je)=>(oe[je]=!0,ve==="define"?`
  545. #ifndef HAS_UNIFORM_u_${je}
  546. varying ${Te} ${ze} ${je};
  547. #else
  548. uniform ${Te} ${ze} u_${je};
  549. #endif
  550. `:`
  551. #ifdef HAS_UNIFORM_u_${je}
  552. ${Te} ${ze} ${je} = u_${je};
  553. #endif
  554. `)),vertexSource:h=h.replace(_,(ue,ve,Te,ze,je)=>{const bt=ze==="float"?"vec2":"vec4",mt=je.match(/color/)?"color":bt;return oe[je]?ve==="define"?`
  555. #ifndef HAS_UNIFORM_u_${je}
  556. uniform lowp float u_${je}_t;
  557. attribute ${Te} ${bt} a_${je};
  558. varying ${Te} ${ze} ${je};
  559. #else
  560. uniform ${Te} ${ze} u_${je};
  561. #endif
  562. `:mt==="vec4"?`
  563. #ifndef HAS_UNIFORM_u_${je}
  564. ${je} = a_${je};
  565. #else
  566. ${Te} ${ze} ${je} = u_${je};
  567. #endif
  568. `:`
  569. #ifndef HAS_UNIFORM_u_${je}
  570. ${je} = unpack_mix_${mt}(a_${je}, u_${je}_t);
  571. #else
  572. ${Te} ${ze} ${je} = u_${je};
  573. #endif
  574. `:ve==="define"?`
  575. #ifndef HAS_UNIFORM_u_${je}
  576. uniform lowp float u_${je}_t;
  577. attribute ${Te} ${bt} a_${je};
  578. #else
  579. uniform ${Te} ${ze} u_${je};
  580. #endif
  581. `:mt==="vec4"?`
  582. #ifndef HAS_UNIFORM_u_${je}
  583. ${Te} ${ze} ${je} = a_${je};
  584. #else
  585. ${Te} ${ze} ${je} = u_${je};
  586. #endif
  587. `:`
  588. #ifndef HAS_UNIFORM_u_${je}
  589. ${Te} ${ze} ${je} = unpack_mix_${mt}(a_${je}, u_${je}_t);
  590. #else
  591. ${Te} ${ze} ${je} = u_${je};
  592. #endif
  593. `}),staticAttributes:T,staticUniforms:K}}class rn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(h,_,T,F,O,K,oe,ue,ve){this.context=h;let Te=this.boundPaintVertexBuffers.length!==F.length;for(let ze=0;!Te&&ze<F.length;ze++)this.boundPaintVertexBuffers[ze]!==F[ze]&&(Te=!0);h.extVertexArrayObject&&this.vao&&this.boundProgram===_&&this.boundLayoutVertexBuffer===T&&!Te&&this.boundIndexBuffer===O&&this.boundVertexOffset===K&&this.boundDynamicVertexBuffer===oe&&this.boundDynamicVertexBuffer2===ue&&this.boundDynamicVertexBuffer3===ve?(h.bindVertexArrayOES.set(this.vao),oe&&oe.bind(),O&&O.dynamicDraw&&O.bind(),ue&&ue.bind(),ve&&ve.bind()):this.freshBind(_,T,F,O,K,oe,ue,ve)}freshBind(h,_,T,F,O,K,oe,ue){let ve;const Te=h.numAttributes,ze=this.context,je=ze.gl;if(ze.extVertexArrayObject)this.vao&&this.destroy(),this.vao=ze.extVertexArrayObject.createVertexArrayOES(),ze.bindVertexArrayOES.set(this.vao),ve=0,this.boundProgram=h,this.boundLayoutVertexBuffer=_,this.boundPaintVertexBuffers=T,this.boundIndexBuffer=F,this.boundVertexOffset=O,this.boundDynamicVertexBuffer=K,this.boundDynamicVertexBuffer2=oe,this.boundDynamicVertexBuffer3=ue;else{ve=ze.currentNumAttributes||0;for(let bt=Te;bt<ve;bt++)je.disableVertexAttribArray(bt)}_.enableAttributes(je,h);for(const bt of T)bt.enableAttributes(je,h);K&&K.enableAttributes(je,h),oe&&oe.enableAttributes(je,h),ue&&ue.enableAttributes(je,h),_.bind(),_.setVertexAttribPointers(je,h,O);for(const bt of T)bt.bind(),bt.setVertexAttribPointers(je,h,O);K&&(K.bind(),K.setVertexAttribPointers(je,h,O)),F&&F.bind(),oe&&(oe.bind(),oe.setVertexAttribPointers(je,h,O)),ue&&(ue.bind(),ue.setVertexAttribPointers(je,h,O)),ze.currentNumAttributes=Te}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function cr(M){const h=[];for(let _=0;_<M.length;_++){if(M[_]===null)continue;const T=M[_].split(" ");h.push(T.pop())}return h}class Ar{constructor(h,_,T,F,O,K,oe){const ue=h.gl;this.program=ue.createProgram();const ve=cr(T.staticAttributes),Te=F?F.getBinderAttributes():[],ze=ve.concat(Te),je=zs.prelude.staticUniforms?cr(zs.prelude.staticUniforms):[],bt=T.staticUniforms?cr(T.staticUniforms):[],mt=F?F.getBinderUniforms():[],gt=je.concat(bt).concat(mt),Vt=[];for(const Bi of gt)Vt.indexOf(Bi)<0&&Vt.push(Bi);const Zt=F?F.defines():[];K&&Zt.push("#define OVERDRAW_INSPECTOR;"),oe&&Zt.push("#define TERRAIN3D;");const ni=Zt.concat(zs.prelude.fragmentSource,T.fragmentSource).join(`
  594. `),St=Zt.concat(zs.prelude.vertexSource,T.vertexSource).join(`
  595. `),zt=ue.createShader(ue.FRAGMENT_SHADER);if(ue.isContextLost())return void(this.failedToCreate=!0);ue.shaderSource(zt,ni),ue.compileShader(zt),ue.attachShader(this.program,zt);const ai=ue.createShader(ue.VERTEX_SHADER);if(ue.isContextLost())return void(this.failedToCreate=!0);ue.shaderSource(ai,St),ue.compileShader(ai),ue.attachShader(this.program,ai),this.attributes={};const Ei={};this.numAttributes=ze.length;for(let Bi=0;Bi<this.numAttributes;Bi++)ze[Bi]&&(ue.bindAttribLocation(this.program,Bi,ze[Bi]),this.attributes[ze[Bi]]=Bi);ue.linkProgram(this.program),ue.deleteShader(ai),ue.deleteShader(zt);for(let Bi=0;Bi<Vt.length;Bi++){const Hi=Vt[Bi];if(Hi&&!Ei[Hi]){const vi=ue.getUniformLocation(this.program,Hi);vi&&(Ei[Hi]=vi)}}this.fixedUniforms=O(h,Ei),this.terrainUniforms=((Bi,Hi)=>({u_depth:new i.Uniform1i(Bi,Hi.u_depth),u_terrain:new i.Uniform1i(Bi,Hi.u_terrain),u_terrain_dim:new i.Uniform1f(Bi,Hi.u_terrain_dim),u_terrain_matrix:new i.UniformMatrix4f(Bi,Hi.u_terrain_matrix),u_terrain_unpack:new i.Uniform4f(Bi,Hi.u_terrain_unpack),u_terrain_offset:new i.Uniform1f(Bi,Hi.u_terrain_offset),u_terrain_exaggeration:new i.Uniform1f(Bi,Hi.u_terrain_exaggeration)}))(h,Ei),this.binderUniforms=F?F.getUniforms(h,Ei):[]}draw(h,_,T,F,O,K,oe,ue,ve,Te,ze,je,bt,mt,gt,Vt,Zt,ni){const St=h.gl;if(this.failedToCreate)return;if(h.program.set(this.program),h.setDepthMode(T),h.setStencilMode(F),h.setColorMode(O),h.setCullFace(K),ue){h.activeTexture.set(St.TEXTURE2),St.bindTexture(St.TEXTURE_2D,ue.depthTexture),h.activeTexture.set(St.TEXTURE3),St.bindTexture(St.TEXTURE_2D,ue.texture);for(const ai in this.terrainUniforms)this.terrainUniforms[ai].set(ue[ai])}for(const ai in this.fixedUniforms)this.fixedUniforms[ai].set(oe[ai]);gt&&gt.setUniforms(h,this.binderUniforms,bt,{zoom:mt});let zt=0;switch(_){case St.LINES:zt=2;break;case St.TRIANGLES:zt=3;break;case St.LINE_STRIP:zt=1}for(const ai of je.get()){const Ei=ai.vaos||(ai.vaos={});(Ei[ve]||(Ei[ve]=new rn)).bind(h,this,Te,gt?gt.getPaintVertexBuffers():[],ze,ai.vertexOffset,Vt,Zt,ni),St.drawElements(_,ai.primitiveLength*zt,St.UNSIGNED_SHORT,ai.primitiveOffset*zt*2)}}}function aa(M,h,_){const T=1/fr(_,1,h.transform.tileZoom),F=Math.pow(2,_.tileID.overscaledZ),O=_.tileSize*Math.pow(2,h.transform.tileZoom)/F,K=O*(_.tileID.canonical.x+_.tileID.wrap*F),oe=O*_.tileID.canonical.y;return{u_image:0,u_texsize:_.imageAtlasTexture.size,u_scale:[T,M.fromScale,M.toScale],u_fade:M.t,u_pixel_coord_upper:[K>>16,oe>>16],u_pixel_coord_lower:[65535&K,65535&oe]}}const al=(M,h,_,T)=>{const F=h.style.light,O=F.properties.get("position"),K=[O.x,O.y,O.z],oe=i.create$1();F.properties.get("anchor")==="viewport"&&i.fromRotation(oe,-h.transform.angle),i.transformMat3(K,K,oe);const ue=F.properties.get("color");return{u_matrix:M,u_lightpos:K,u_lightintensity:F.properties.get("intensity"),u_lightcolor:[ue.r,ue.g,ue.b],u_vertical_gradient:+_,u_opacity:T}},dr=(M,h,_,T,F,O,K)=>i.extend(al(M,h,_,T),aa(O,h,K),{u_height_factor:-Math.pow(2,F.overscaledZ)/K.tileSize/8}),Ul=M=>({u_matrix:M}),Rl=(M,h,_,T)=>i.extend(Ul(M),aa(_,h,T)),ll=(M,h)=>({u_matrix:M,u_world:h}),qs=(M,h,_,T,F)=>i.extend(Rl(M,h,_,T),{u_world:F}),cs=(M,h,_,T)=>{const F=M.transform;let O,K;if(T.paint.get("circle-pitch-alignment")==="map"){const oe=fr(_,1,F.zoom);O=!0,K=[oe,oe]}else O=!1,K=F.pixelsToGLUnits;return{u_camera_to_center_distance:F.cameraToCenterDistance,u_scale_with_map:+(T.paint.get("circle-pitch-scale")==="map"),u_matrix:M.translatePosMatrix(h.posMatrix,_,T.paint.get("circle-translate"),T.paint.get("circle-translate-anchor")),u_pitch_with_map:+O,u_device_pixel_ratio:M.pixelRatio,u_extrude_scale:K}},ho=(M,h,_)=>{const T=fr(_,1,h.zoom),F=Math.pow(2,h.zoom-_.tileID.overscaledZ),O=_.tileID.overscaleFactor();return{u_matrix:M,u_camera_to_center_distance:h.cameraToCenterDistance,u_pixels_to_tile_units:T,u_extrude_scale:[h.pixelsToGLUnits[0]/(T*F),h.pixelsToGLUnits[1]/(T*F)],u_overscale_factor:O}},cl=(M,h,_=1)=>({u_matrix:M,u_color:h,u_overlay:0,u_overlay_scale:_}),Oa=M=>({u_matrix:M}),zl=(M,h,_,T)=>({u_matrix:M,u_extrude_scale:fr(h,1,_),u_intensity:T});function kl(M,h){const _=Math.pow(2,h.canonical.z),T=h.canonical.y;return[new i.MercatorCoordinate(0,T/_).toLngLat().lat,new i.MercatorCoordinate(0,(T+1)/_).toLngLat().lat]}const Ol=(M,h,_,T)=>{const F=M.transform;return{u_matrix:Ys(M,h,_,T),u_ratio:1/fr(h,1,F.zoom),u_device_pixel_ratio:M.pixelRatio,u_units_to_pixels:[1/F.pixelsToGLUnits[0],1/F.pixelsToGLUnits[1]]}},Na=(M,h,_,T,F)=>i.extend(Ol(M,h,_,F),{u_image:0,u_image_height:T}),Nl=(M,h,_,T,F)=>{const O=M.transform,K=is(h,O);return{u_matrix:Ys(M,h,_,F),u_texsize:h.imageAtlasTexture.size,u_ratio:1/fr(h,1,O.zoom),u_device_pixel_ratio:M.pixelRatio,u_image:0,u_scale:[K,T.fromScale,T.toScale],u_fade:T.t,u_units_to_pixels:[1/O.pixelsToGLUnits[0],1/O.pixelsToGLUnits[1]]}},Ql=(M,h,_,T,F,O)=>{const K=M.lineAtlas,oe=is(h,M.transform),ue=_.layout.get("line-cap")==="round",ve=K.getDash(T.from,ue),Te=K.getDash(T.to,ue),ze=ve.width*F.fromScale,je=Te.width*F.toScale;return i.extend(Ol(M,h,_,O),{u_patternscale_a:[oe/ze,-ve.height/2],u_patternscale_b:[oe/je,-Te.height/2],u_sdfgamma:K.width/(256*Math.min(ze,je)*M.pixelRatio)/2,u_image:0,u_tex_y_a:ve.y,u_tex_y_b:Te.y,u_mix:F.t})};function is(M,h){return 1/fr(M,1,h.tileZoom)}function Ys(M,h,_,T){return M.translatePosMatrix(T?T.posMatrix:h.tileID.posMatrix,h,_.paint.get("line-translate"),_.paint.get("line-translate-anchor"))}const ps=(M,h,_,T,F)=>{return{u_matrix:M,u_tl_parent:h,u_scale_parent:_,u_buffer_scale:1,u_fade_t:T.mix,u_opacity:T.opacity*F.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:F.paint.get("raster-brightness-min"),u_brightness_high:F.paint.get("raster-brightness-max"),u_saturation_factor:(K=F.paint.get("raster-saturation"),K>0?1-1/(1.001-K):-K),u_contrast_factor:(O=F.paint.get("raster-contrast"),O>0?1/(1-O):1+O),u_spin_weights:Rc(F.paint.get("raster-hue-rotate"))};var O,K};function Rc(M){M*=Math.PI/180;const h=Math.sin(M),_=Math.cos(M);return[(2*_+1)/3,(-Math.sqrt(3)*h-_+1)/3,(Math.sqrt(3)*h-_+1)/3]}const Eh=(M,h,_,T,F,O,K,oe,ue,ve)=>{const Te=F.transform;return{u_is_size_zoom_constant:+(M==="constant"||M==="source"),u_is_size_feature_constant:+(M==="constant"||M==="camera"),u_size_t:h?h.uSizeT:0,u_size:h?h.uSize:0,u_camera_to_center_distance:Te.cameraToCenterDistance,u_pitch:Te.pitch/360*2*Math.PI,u_rotate_symbol:+_,u_aspect_ratio:Te.width/Te.height,u_fade_change:F.options.fadeDuration?F.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:K,u_coord_matrix:oe,u_is_text:+ue,u_pitch_with_map:+T,u_texsize:ve,u_texture:0}},ks=(M,h,_,T,F,O,K,oe,ue,ve,Te)=>{const ze=F.transform;return i.extend(Eh(M,h,_,T,F,O,K,oe,ue,ve),{u_gamma_scale:T?Math.cos(ze._pitch)*ze.cameraToCenterDistance:1,u_device_pixel_ratio:F.pixelRatio,u_is_halo:+Te})},No=(M,h,_,T,F,O,K,oe,ue,ve)=>i.extend(ks(M,h,_,T,F,O,K,oe,!0,ue,!0),{u_texsize_icon:ve,u_texture_icon:1}),JA=(M,h,_)=>({u_matrix:M,u_opacity:h,u_color:_}),fu=(M,h,_,T,F,O)=>i.extend(function(K,oe,ue,ve){const Te=ue.imageManager.getPattern(K.from.toString()),ze=ue.imageManager.getPattern(K.to.toString()),{width:je,height:bt}=ue.imageManager.getPixelSize(),mt=Math.pow(2,ve.tileID.overscaledZ),gt=ve.tileSize*Math.pow(2,ue.transform.tileZoom)/mt,Vt=gt*(ve.tileID.canonical.x+ve.tileID.wrap*mt),Zt=gt*ve.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Te.tl,u_pattern_br_a:Te.br,u_pattern_tl_b:ze.tl,u_pattern_br_b:ze.br,u_texsize:[je,bt],u_mix:oe.t,u_pattern_size_a:Te.displaySize,u_pattern_size_b:ze.displaySize,u_scale_a:oe.fromScale,u_scale_b:oe.toScale,u_tile_units_to_pixels:1/fr(ve,1,ue.transform.tileZoom),u_pixel_coord_upper:[Vt>>16,Zt>>16],u_pixel_coord_lower:[65535&Vt,65535&Zt]}}(T,O,_,F),{u_matrix:M,u_opacity:h}),Bs={fillExtrusion:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_lightpos:new i.Uniform3f(M,h.u_lightpos),u_lightintensity:new i.Uniform1f(M,h.u_lightintensity),u_lightcolor:new i.Uniform3f(M,h.u_lightcolor),u_vertical_gradient:new i.Uniform1f(M,h.u_vertical_gradient),u_opacity:new i.Uniform1f(M,h.u_opacity)}),fillExtrusionPattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_lightpos:new i.Uniform3f(M,h.u_lightpos),u_lightintensity:new i.Uniform1f(M,h.u_lightintensity),u_lightcolor:new i.Uniform3f(M,h.u_lightcolor),u_vertical_gradient:new i.Uniform1f(M,h.u_vertical_gradient),u_height_factor:new i.Uniform1f(M,h.u_height_factor),u_image:new i.Uniform1i(M,h.u_image),u_texsize:new i.Uniform2f(M,h.u_texsize),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade),u_opacity:new i.Uniform1f(M,h.u_opacity)}),fill:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),fillPattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_image:new i.Uniform1i(M,h.u_image),u_texsize:new i.Uniform2f(M,h.u_texsize),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade)}),fillOutline:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_world:new i.Uniform2f(M,h.u_world)}),fillOutlinePattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_world:new i.Uniform2f(M,h.u_world),u_image:new i.Uniform1i(M,h.u_image),u_texsize:new i.Uniform2f(M,h.u_texsize),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade)}),circle:(M,h)=>({u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_scale_with_map:new i.Uniform1i(M,h.u_scale_with_map),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_extrude_scale:new i.Uniform2f(M,h.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),collisionBox:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pixels_to_tile_units:new i.Uniform1f(M,h.u_pixels_to_tile_units),u_extrude_scale:new i.Uniform2f(M,h.u_extrude_scale),u_overscale_factor:new i.Uniform1f(M,h.u_overscale_factor)}),collisionCircle:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_inv_matrix:new i.UniformMatrix4f(M,h.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(M,h.u_viewport_size)}),debug:(M,h)=>({u_color:new i.UniformColor(M,h.u_color),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_overlay:new i.Uniform1i(M,h.u_overlay),u_overlay_scale:new i.Uniform1f(M,h.u_overlay_scale)}),clippingMask:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),heatmap:(M,h)=>({u_extrude_scale:new i.Uniform1f(M,h.u_extrude_scale),u_intensity:new i.Uniform1f(M,h.u_intensity),u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),heatmapTexture:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_world:new i.Uniform2f(M,h.u_world),u_image:new i.Uniform1i(M,h.u_image),u_color_ramp:new i.Uniform1i(M,h.u_color_ramp),u_opacity:new i.Uniform1f(M,h.u_opacity)}),hillshade:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_image:new i.Uniform1i(M,h.u_image),u_latrange:new i.Uniform2f(M,h.u_latrange),u_light:new i.Uniform2f(M,h.u_light),u_shadow:new i.UniformColor(M,h.u_shadow),u_highlight:new i.UniformColor(M,h.u_highlight),u_accent:new i.UniformColor(M,h.u_accent)}),hillshadePrepare:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_image:new i.Uniform1i(M,h.u_image),u_dimension:new i.Uniform2f(M,h.u_dimension),u_zoom:new i.Uniform1f(M,h.u_zoom),u_unpack:new i.Uniform4f(M,h.u_unpack)}),line:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels)}),lineGradient:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels),u_image:new i.Uniform1i(M,h.u_image),u_image_height:new i.Uniform1f(M,h.u_image_height)}),linePattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_texsize:new i.Uniform2f(M,h.u_texsize),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_image:new i.Uniform1i(M,h.u_image),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels),u_scale:new i.Uniform3f(M,h.u_scale),u_fade:new i.Uniform1f(M,h.u_fade)}),lineSDF:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_ratio:new i.Uniform1f(M,h.u_ratio),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(M,h.u_units_to_pixels),u_patternscale_a:new i.Uniform2f(M,h.u_patternscale_a),u_patternscale_b:new i.Uniform2f(M,h.u_patternscale_b),u_sdfgamma:new i.Uniform1f(M,h.u_sdfgamma),u_image:new i.Uniform1i(M,h.u_image),u_tex_y_a:new i.Uniform1f(M,h.u_tex_y_a),u_tex_y_b:new i.Uniform1f(M,h.u_tex_y_b),u_mix:new i.Uniform1f(M,h.u_mix)}),raster:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_tl_parent:new i.Uniform2f(M,h.u_tl_parent),u_scale_parent:new i.Uniform1f(M,h.u_scale_parent),u_buffer_scale:new i.Uniform1f(M,h.u_buffer_scale),u_fade_t:new i.Uniform1f(M,h.u_fade_t),u_opacity:new i.Uniform1f(M,h.u_opacity),u_image0:new i.Uniform1i(M,h.u_image0),u_image1:new i.Uniform1i(M,h.u_image1),u_brightness_low:new i.Uniform1f(M,h.u_brightness_low),u_brightness_high:new i.Uniform1f(M,h.u_brightness_high),u_saturation_factor:new i.Uniform1f(M,h.u_saturation_factor),u_contrast_factor:new i.Uniform1f(M,h.u_contrast_factor),u_spin_weights:new i.Uniform3f(M,h.u_spin_weights)}),symbolIcon:(M,h)=>({u_is_size_zoom_constant:new i.Uniform1i(M,h.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(M,h.u_is_size_feature_constant),u_size_t:new i.Uniform1f(M,h.u_size_t),u_size:new i.Uniform1f(M,h.u_size),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pitch:new i.Uniform1f(M,h.u_pitch),u_rotate_symbol:new i.Uniform1i(M,h.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(M,h.u_aspect_ratio),u_fade_change:new i.Uniform1f(M,h.u_fade_change),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(M,h.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(M,h.u_coord_matrix),u_is_text:new i.Uniform1i(M,h.u_is_text),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_texsize:new i.Uniform2f(M,h.u_texsize),u_texture:new i.Uniform1i(M,h.u_texture)}),symbolSDF:(M,h)=>({u_is_size_zoom_constant:new i.Uniform1i(M,h.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(M,h.u_is_size_feature_constant),u_size_t:new i.Uniform1f(M,h.u_size_t),u_size:new i.Uniform1f(M,h.u_size),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pitch:new i.Uniform1f(M,h.u_pitch),u_rotate_symbol:new i.Uniform1i(M,h.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(M,h.u_aspect_ratio),u_fade_change:new i.Uniform1f(M,h.u_fade_change),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(M,h.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(M,h.u_coord_matrix),u_is_text:new i.Uniform1i(M,h.u_is_text),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_texsize:new i.Uniform2f(M,h.u_texsize),u_texture:new i.Uniform1i(M,h.u_texture),u_gamma_scale:new i.Uniform1f(M,h.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(M,h.u_is_halo)}),symbolTextAndIcon:(M,h)=>({u_is_size_zoom_constant:new i.Uniform1i(M,h.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(M,h.u_is_size_feature_constant),u_size_t:new i.Uniform1f(M,h.u_size_t),u_size:new i.Uniform1f(M,h.u_size),u_camera_to_center_distance:new i.Uniform1f(M,h.u_camera_to_center_distance),u_pitch:new i.Uniform1f(M,h.u_pitch),u_rotate_symbol:new i.Uniform1i(M,h.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(M,h.u_aspect_ratio),u_fade_change:new i.Uniform1f(M,h.u_fade_change),u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(M,h.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(M,h.u_coord_matrix),u_is_text:new i.Uniform1i(M,h.u_is_text),u_pitch_with_map:new i.Uniform1i(M,h.u_pitch_with_map),u_texsize:new i.Uniform2f(M,h.u_texsize),u_texsize_icon:new i.Uniform2f(M,h.u_texsize_icon),u_texture:new i.Uniform1i(M,h.u_texture),u_texture_icon:new i.Uniform1i(M,h.u_texture_icon),u_gamma_scale:new i.Uniform1f(M,h.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(M,h.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(M,h.u_is_halo)}),background:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_opacity:new i.Uniform1f(M,h.u_opacity),u_color:new i.UniformColor(M,h.u_color)}),backgroundPattern:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_opacity:new i.Uniform1f(M,h.u_opacity),u_image:new i.Uniform1i(M,h.u_image),u_pattern_tl_a:new i.Uniform2f(M,h.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(M,h.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(M,h.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(M,h.u_pattern_br_b),u_texsize:new i.Uniform2f(M,h.u_texsize),u_mix:new i.Uniform1f(M,h.u_mix),u_pattern_size_a:new i.Uniform2f(M,h.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(M,h.u_pattern_size_b),u_scale_a:new i.Uniform1f(M,h.u_scale_a),u_scale_b:new i.Uniform1f(M,h.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(M,h.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(M,h.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(M,h.u_tile_units_to_pixels)}),terrain:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_texture:new i.Uniform1i(M,h.u_texture)}),terrainDepth:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix)}),terrainCoords:(M,h)=>({u_matrix:new i.UniformMatrix4f(M,h.u_matrix),u_texture:new i.Uniform1i(M,h.u_texture),u_terrain_coords_id:new i.Uniform1f(M,h.u_terrain_coords_id)})};class sc{constructor(h,_,T){this.context=h;const F=h.gl;this.buffer=F.createBuffer(),this.dynamicDraw=Boolean(T),this.context.unbindVAO(),h.bindElementBuffer.set(this.buffer),F.bufferData(F.ELEMENT_ARRAY_BUFFER,_.arrayBuffer,this.dynamicDraw?F.DYNAMIC_DRAW:F.STATIC_DRAW),this.dynamicDraw||delete _.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(h){const _=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),_.bufferSubData(_.ELEMENT_ARRAY_BUFFER,0,h.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Th={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class oc{constructor(h,_,T,F){this.length=_.length,this.attributes=T,this.itemSize=_.bytesPerElement,this.dynamicDraw=F,this.context=h;const O=h.gl;this.buffer=O.createBuffer(),h.bindVertexBuffer.set(this.buffer),O.bufferData(O.ARRAY_BUFFER,_.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||delete _.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(h){if(h.length!==this.length)throw new Error(`Length of new data is ${h.length}, which doesn't match current length of ${this.length}`);const _=this.context.gl;this.bind(),_.bufferSubData(_.ARRAY_BUFFER,0,h.arrayBuffer)}enableAttributes(h,_){for(let T=0;T<this.attributes.length;T++){const F=_.attributes[this.attributes[T].name];F!==void 0&&h.enableVertexAttribArray(F)}}setVertexAttribPointers(h,_,T){for(let F=0;F<this.attributes.length;F++){const O=this.attributes[F],K=_.attributes[O.name];K!==void 0&&h.vertexAttribPointer(K,O.components,h[Th[O.type]],!1,this.itemSize,O.offset+this.itemSize*(T||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class er{constructor(h){this.gl=h.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(h){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ac extends er{getDefault(){return i.Color.transparent}set(h){const _=this.current;(h.r!==_.r||h.g!==_.g||h.b!==_.b||h.a!==_.a||this.dirty)&&(this.gl.clearColor(h.r,h.g,h.b,h.a),this.current=h,this.dirty=!1)}}class Ju extends er{getDefault(){return 1}set(h){(h!==this.current||this.dirty)&&(this.gl.clearDepth(h),this.current=h,this.dirty=!1)}}class Qo extends er{getDefault(){return 0}set(h){(h!==this.current||this.dirty)&&(this.gl.clearStencil(h),this.current=h,this.dirty=!1)}}class hl extends er{getDefault(){return[!0,!0,!0,!0]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||h[2]!==_[2]||h[3]!==_[3]||this.dirty)&&(this.gl.colorMask(h[0],h[1],h[2],h[3]),this.current=h,this.dirty=!1)}}class Sh extends er{getDefault(){return!0}set(h){(h!==this.current||this.dirty)&&(this.gl.depthMask(h),this.current=h,this.dirty=!1)}}class Vo extends er{getDefault(){return 255}set(h){(h!==this.current||this.dirty)&&(this.gl.stencilMask(h),this.current=h,this.dirty=!1)}}class Mh extends er{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(h){const _=this.current;(h.func!==_.func||h.ref!==_.ref||h.mask!==_.mask||this.dirty)&&(this.gl.stencilFunc(h.func,h.ref,h.mask),this.current=h,this.dirty=!1)}}class Qa extends er{getDefault(){const h=this.gl;return[h.KEEP,h.KEEP,h.KEEP]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||h[2]!==_[2]||this.dirty)&&(this.gl.stencilOp(h[0],h[1],h[2]),this.current=h,this.dirty=!1)}}class lc extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.STENCIL_TEST):_.disable(_.STENCIL_TEST),this.current=h,this.dirty=!1}}class mu extends er{getDefault(){return[0,1]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||this.dirty)&&(this.gl.depthRange(h[0],h[1]),this.current=h,this.dirty=!1)}}class Vl extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.DEPTH_TEST):_.disable(_.DEPTH_TEST),this.current=h,this.dirty=!1}}class ya extends er{getDefault(){return this.gl.LESS}set(h){(h!==this.current||this.dirty)&&(this.gl.depthFunc(h),this.current=h,this.dirty=!1)}}class zc extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.BLEND):_.disable(_.BLEND),this.current=h,this.dirty=!1}}class Ws extends er{getDefault(){const h=this.gl;return[h.ONE,h.ZERO]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||this.dirty)&&(this.gl.blendFunc(h[0],h[1]),this.current=h,this.dirty=!1)}}class cc extends er{getDefault(){return i.Color.transparent}set(h){const _=this.current;(h.r!==_.r||h.g!==_.g||h.b!==_.b||h.a!==_.a||this.dirty)&&(this.gl.blendColor(h.r,h.g,h.b,h.a),this.current=h,this.dirty=!1)}}class kc extends er{getDefault(){return this.gl.FUNC_ADD}set(h){(h!==this.current||this.dirty)&&(this.gl.blendEquation(h),this.current=h,this.dirty=!1)}}class eA extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;h?_.enable(_.CULL_FACE):_.disable(_.CULL_FACE),this.current=h,this.dirty=!1}}class hc extends er{getDefault(){return this.gl.BACK}set(h){(h!==this.current||this.dirty)&&(this.gl.cullFace(h),this.current=h,this.dirty=!1)}}class gu extends er{getDefault(){return this.gl.CCW}set(h){(h!==this.current||this.dirty)&&(this.gl.frontFace(h),this.current=h,this.dirty=!1)}}class ed extends er{getDefault(){return null}set(h){(h!==this.current||this.dirty)&&(this.gl.useProgram(h),this.current=h,this.dirty=!1)}}class _u extends er{getDefault(){return this.gl.TEXTURE0}set(h){(h!==this.current||this.dirty)&&(this.gl.activeTexture(h),this.current=h,this.dirty=!1)}}class Ih extends er{getDefault(){const h=this.gl;return[0,0,h.drawingBufferWidth,h.drawingBufferHeight]}set(h){const _=this.current;(h[0]!==_[0]||h[1]!==_[1]||h[2]!==_[2]||h[3]!==_[3]||this.dirty)&&(this.gl.viewport(h[0],h[1],h[2],h[3]),this.current=h,this.dirty=!1)}}class tA extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindFramebuffer(_.FRAMEBUFFER,h),this.current=h,this.dirty=!1}}class td extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindRenderbuffer(_.RENDERBUFFER,h),this.current=h,this.dirty=!1}}class uc extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindTexture(_.TEXTURE_2D,h),this.current=h,this.dirty=!1}}class Oc extends er{getDefault(){return null}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.bindBuffer(_.ARRAY_BUFFER,h),this.current=h,this.dirty=!1}}class ul extends er{getDefault(){return null}set(h){const _=this.gl;_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,h),this.current=h,this.dirty=!1}}class Ir extends er{constructor(h){super(h),this.vao=h.extVertexArrayObject}getDefault(){return null}set(h){this.vao&&(h!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(h),this.current=h,this.dirty=!1)}}class Ac extends er{getDefault(){return 4}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.pixelStorei(_.UNPACK_ALIGNMENT,h),this.current=h,this.dirty=!1}}class Nc extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),this.current=h,this.dirty=!1}}class yu extends er{getDefault(){return!1}set(h){if(h===this.current&&!this.dirty)return;const _=this.gl;_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,h),this.current=h,this.dirty=!1}}class Al extends er{constructor(h,_){super(h),this.context=h,this.parent=_}getDefault(){return null}}class Va extends Al{setDirty(){this.dirty=!0}set(h){if(h===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const _=this.gl;_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,h,0),this.current=h,this.dirty=!1}}class Qc extends Al{set(h){if(h===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const _=this.gl;_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_ATTACHMENT,_.RENDERBUFFER,h),this.current=h,this.dirty=!1}}class dl{constructor(h,_,T,F){this.context=h,this.width=_,this.height=T;const O=h.gl,K=this.framebuffer=O.createFramebuffer();if(this.colorAttachment=new Va(h,K),F&&(this.depthAttachment=new Qc(h,K)),O.checkFramebufferStatus(O.FRAMEBUFFER)!==O.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const h=this.context.gl,_=this.colorAttachment.get();if(_&&h.deleteTexture(_),this.depthAttachment){const T=this.depthAttachment.get();T&&h.deleteRenderbuffer(T)}h.deleteFramebuffer(this.framebuffer)}}class qr{constructor(h,_,T){this.blendFunction=h,this.blendColor=_,this.mask=T}}qr.Replace=[1,0],qr.disabled=new qr(qr.Replace,i.Color.transparent,[!1,!1,!1,!1]),qr.unblended=new qr(qr.Replace,i.Color.transparent,[!0,!0,!0,!0]),qr.alphaBlended=new qr([1,771],i.Color.transparent,[!0,!0,!0,!0]);class Fh{constructor(h){this.gl=h,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new ac(this),this.clearDepth=new Ju(this),this.clearStencil=new Qo(this),this.colorMask=new hl(this),this.depthMask=new Sh(this),this.stencilMask=new Vo(this),this.stencilFunc=new Mh(this),this.stencilOp=new Qa(this),this.stencilTest=new lc(this),this.depthRange=new mu(this),this.depthTest=new Vl(this),this.depthFunc=new ya(this),this.blend=new zc(this),this.blendFunc=new Ws(this),this.blendColor=new cc(this),this.blendEquation=new kc(this),this.cullFace=new eA(this),this.cullFaceSide=new hc(this),this.frontFace=new gu(this),this.program=new ed(this),this.activeTexture=new _u(this),this.viewport=new Ih(this),this.bindFramebuffer=new tA(this),this.bindRenderbuffer=new td(this),this.bindTexture=new uc(this),this.bindVertexBuffer=new Oc(this),this.bindElementBuffer=new ul(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ir(this),this.pixelStoreUnpack=new Ac(this),this.pixelStoreUnpackPremultiplyAlpha=new Nc(this),this.pixelStoreUnpackFlipY=new yu(this),this.extTextureFilterAnisotropic=h.getExtension("EXT_texture_filter_anisotropic")||h.getExtension("MOZ_EXT_texture_filter_anisotropic")||h.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=h.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=h.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(h.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=h.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=h.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=h.getParameter(h.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(h,_){return new sc(this,h,_)}createVertexBuffer(h,_,T){return new oc(this,h,_,T)}createRenderbuffer(h,_,T){const F=this.gl,O=F.createRenderbuffer();return this.bindRenderbuffer.set(O),F.renderbufferStorage(F.RENDERBUFFER,h,_,T),this.bindRenderbuffer.set(null),O}createFramebuffer(h,_,T){return new dl(this,h,_,T)}clear({color:h,depth:_}){const T=this.gl;let F=0;h&&(F|=T.COLOR_BUFFER_BIT,this.clearColor.set(h),this.colorMask.set([!0,!0,!0,!0])),_!==void 0&&(F|=T.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(_),this.depthMask.set(!0)),T.clear(F)}setCullFace(h){h.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(h.mode),this.frontFace.set(h.frontFace))}setDepthMode(h){h.func!==this.gl.ALWAYS||h.mask?(this.depthTest.set(!0),this.depthFunc.set(h.func),this.depthMask.set(h.mask),this.depthRange.set(h.range)):this.depthTest.set(!1)}setStencilMode(h){h.test.func!==this.gl.ALWAYS||h.mask?(this.stencilTest.set(!0),this.stencilMask.set(h.mask),this.stencilOp.set([h.fail,h.depthFail,h.pass]),this.stencilFunc.set({func:h.test.func,ref:h.ref,mask:h.test.mask})):this.stencilTest.set(!1)}setColorMode(h){Q(h.blendFunction,qr.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(h.blendFunction),this.blendColor.set(h.blendColor)),this.colorMask.set(h.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class hr{constructor(h,_,T){this.func=h,this.mask=_,this.range=T}}hr.ReadOnly=!1,hr.ReadWrite=!0,hr.disabled=new hr(519,hr.ReadOnly,[0,1]);const Br=7680;class jr{constructor(h,_,T,F,O,K){this.test=h,this.ref=_,this.mask=T,this.fail=F,this.depthFail=O,this.pass=K}}jr.disabled=new jr({func:519,mask:0},0,0,Br,Br,Br);class $r{constructor(h,_,T){this.enable=h,this.mode=_,this.frontFace=T}}let Hl;function gr(M,h,_,T,F,O,K){const oe=M.context,ue=oe.gl,ve=M.useProgram("collisionBox"),Te=[];let ze=0,je=0;for(let St=0;St<T.length;St++){const zt=T[St],ai=h.getTile(zt),Ei=ai.getBucket(_);if(!Ei)continue;let Bi=zt.posMatrix;F[0]===0&&F[1]===0||(Bi=M.translatePosMatrix(zt.posMatrix,ai,F,O));const Hi=K?Ei.textCollisionBox:Ei.iconCollisionBox,vi=Ei.collisionCircleArray;if(vi.length>0){const xn=i.create(),cn=Bi;i.mul(xn,Ei.placementInvProjMatrix,M.transform.glCoordMatrix),i.mul(xn,xn,Ei.placementViewportMatrix),Te.push({circleArray:vi,circleOffset:je,transform:cn,invTransform:xn,coord:zt}),ze+=vi.length/4,je=ze}Hi&&ve.draw(oe,ue.LINES,hr.disabled,jr.disabled,M.colorModeForRenderPass(),$r.disabled,ho(Bi,M.transform,ai),M.style.terrain&&M.style.terrain.getTerrainData(zt),_.id,Hi.layoutVertexBuffer,Hi.indexBuffer,Hi.segments,null,M.transform.zoom,null,null,Hi.collisionVertexBuffer)}if(!K||!Te.length)return;const bt=M.useProgram("collisionCircle"),mt=new i.CollisionCircleLayoutArray;mt.resize(4*ze),mt._trim();let gt=0;for(const St of Te)for(let zt=0;zt<St.circleArray.length/4;zt++){const ai=4*zt,Ei=St.circleArray[ai+0],Bi=St.circleArray[ai+1],Hi=St.circleArray[ai+2],vi=St.circleArray[ai+3];mt.emplace(gt++,Ei,Bi,Hi,vi,0),mt.emplace(gt++,Ei,Bi,Hi,vi,1),mt.emplace(gt++,Ei,Bi,Hi,vi,2),mt.emplace(gt++,Ei,Bi,Hi,vi,3)}(!Hl||Hl.length<2*ze)&&(Hl=function(St){const zt=2*St,ai=new i.QuadTriangleArray;ai.resize(zt),ai._trim();for(let Ei=0;Ei<zt;Ei++){const Bi=6*Ei;ai.uint16[Bi+0]=4*Ei+0,ai.uint16[Bi+1]=4*Ei+1,ai.uint16[Bi+2]=4*Ei+2,ai.uint16[Bi+3]=4*Ei+2,ai.uint16[Bi+4]=4*Ei+3,ai.uint16[Bi+5]=4*Ei+0}return ai}(ze));const Vt=oe.createIndexBuffer(Hl,!0),Zt=oe.createVertexBuffer(mt,i.collisionCircleLayout.members,!0);for(const St of Te){const zt={u_matrix:St.transform,u_inv_matrix:St.invTransform,u_camera_to_center_distance:(ni=M.transform).cameraToCenterDistance,u_viewport_size:[ni.width,ni.height]};bt.draw(oe,ue.TRIANGLES,hr.disabled,jr.disabled,M.colorModeForRenderPass(),$r.disabled,zt,M.style.terrain&&M.style.terrain.getTerrainData(St.coord),_.id,Zt,Vt,i.SegmentVector.simpleSegment(0,2*St.circleOffset,St.circleArray.length,St.circleArray.length/2),null,M.transform.zoom,null,null,null)}var ni;Zt.destroy(),Vt.destroy()}$r.disabled=new $r(!1,1029,2305),$r.backCCW=new $r(!0,1029,2305);const xu=i.identity(new Float32Array(16));function iA(M,h,_,T,F,O){const{horizontalAlign:K,verticalAlign:oe}=i.getAnchorAlignment(M),ue=-(K-.5)*h,ve=-(oe-.5)*_,Te=i.evaluateVariableOffset(M,T);return new i.pointGeometry((ue/F+Te[0])*O,(ve/F+Te[1])*O)}function nA(M,h,_,T,F,O,K,oe,ue,ve,Te){const ze=M.text.placedSymbolArray,je=M.text.dynamicLayoutVertexArray,bt=M.icon.dynamicLayoutVertexArray,mt={};je.clear();for(let gt=0;gt<ze.length;gt++){const Vt=ze.get(gt),Zt=M.allowVerticalPlacement&&!Vt.placedOrientation,ni=Vt.hidden||!Vt.crossTileID||Zt?null:T[Vt.crossTileID];if(ni){const St=new i.pointGeometry(Vt.anchorX,Vt.anchorY),zt=Xi(St,_?K:O,Te),ai=on(F.cameraToCenterDistance,zt.signedDistanceFromCamera);let Ei=i.evaluateSizeForFeature(M.textSizeData,ue,Vt)*ai/i.ONE_EM;_&&(Ei*=M.tilePixelRatio/oe);const{width:Bi,height:Hi,anchor:vi,textOffset:xn,textBoxScale:cn}=ni,Bn=iA(vi,Bi,Hi,xn,cn,Ei),tr=_?Xi(St.add(Bn),O,Te).point:zt.point.add(h?Bn.rotate(-F.angle):Bn),ur=M.allowVerticalPlacement&&Vt.placedOrientation===i.WritingMode.vertical?Math.PI/2:0;for(let Un=0;Un<Vt.numGlyphs;Un++)i.addDynamicAttributes(je,tr,ur);ve&&Vt.associatedIconIndex>=0&&(mt[Vt.associatedIconIndex]={shiftedAnchor:tr,angle:ur})}else Ui(Vt.numGlyphs,je)}if(ve){bt.clear();const gt=M.icon.placedSymbolArray;for(let Vt=0;Vt<gt.length;Vt++){const Zt=gt.get(Vt);if(Zt.hidden)Ui(Zt.numGlyphs,bt);else{const ni=mt[Vt];if(ni)for(let St=0;St<Zt.numGlyphs;St++)i.addDynamicAttributes(bt,ni.shiftedAnchor,ni.angle);else Ui(Zt.numGlyphs,bt)}}M.icon.dynamicLayoutVertexBuffer.updateData(bt)}M.text.dynamicLayoutVertexBuffer.updateData(je)}function rA(M,h,_){return _.iconsInText&&h?"symbolTextAndIcon":M?"symbolSDF":"symbolIcon"}function dc(M,h,_,T,F,O,K,oe,ue,ve,Te,ze){const je=M.context,bt=je.gl,mt=M.transform,gt=oe==="map",Vt=ue==="map",Zt=oe!=="viewport"&&_.layout.get("symbol-placement")!=="point",ni=gt&&!Vt&&!Zt,St=!_.layout.get("symbol-sort-key").isConstant();let zt=!1;const ai=M.depthModeForSublayer(0,hr.ReadOnly),Ei=_.layout.get("text-variable-anchor"),Bi=[];for(const Hi of T){const vi=h.getTile(Hi),xn=vi.getBucket(_);if(!xn)continue;const cn=F?xn.text:xn.icon;if(!cn||!cn.segments.get().length)continue;const Bn=cn.programConfigurations.get(_.id),tr=F||xn.sdfIcons,ur=F?xn.textSizeData:xn.iconSizeData,Un=Vt||mt.pitch!==0,Lr=M.useProgram(rA(tr,F,xn),Bn),Rr=i.evaluateSizeForZoom(ur,mt.zoom),Cr=M.style.terrain&&M.style.terrain.getTerrainData(Hi);let Er,Gr,js,wa,ua=[0,0],ba=null;if(F){if(Gr=vi.glyphAtlasTexture,js=bt.LINEAR,Er=vi.glyphAtlasTexture.size,xn.iconsInText){ua=vi.imageAtlasTexture.size,ba=vi.imageAtlasTexture;const H=ur.kind==="composite"||ur.kind==="camera";wa=Un||M.options.rotating||M.options.zooming||H?bt.LINEAR:bt.NEAREST}}else{const H=_.layout.get("icon-size").constantOr(0)!==1||xn.iconsNeedLinear;Gr=vi.imageAtlasTexture,js=tr||M.options.rotating||M.options.zooming||H||Un?bt.LINEAR:bt.NEAREST,Er=vi.imageAtlasTexture.size}const Wa=fr(vi,1,M.transform.zoom),Wo=ii(Hi.posMatrix,Vt,gt,M.transform,Wa),mo=hn(Hi.posMatrix,Vt,gt,M.transform,Wa),Ba=Ei&&xn.hasTextData(),$l=_.layout.get("icon-text-fit")!=="none"&&Ba&&xn.hasIconData();if(Zt){const H=M.style.terrain?(ee,pe)=>M.style.terrain.getElevation(Hi,ee,pe):null,W=_.layout.get("text-rotation-alignment")==="map";Tn(xn,Hi.posMatrix,M,F,Wo,mo,Vt,ve,W,H)}const x=M.translatePosMatrix(Hi.posMatrix,vi,O,K),a=Zt||F&&Ei||$l?xu:Wo,m=M.translatePosMatrix(mo,vi,O,K,!0),b=tr&&_.paint.get(F?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let S;S=tr?xn.iconsInText?No(ur.kind,Rr,ni,Vt,M,x,a,m,Er,ua):ks(ur.kind,Rr,ni,Vt,M,x,a,m,F,Er,!0):Eh(ur.kind,Rr,ni,Vt,M,x,a,m,F,Er);const P={program:Lr,buffers:cn,uniformValues:S,atlasTexture:Gr,atlasTextureIcon:ba,atlasInterpolation:js,atlasInterpolationIcon:wa,isSDF:tr,hasHalo:b};if(St&&xn.canOverlap){zt=!0;const H=cn.segments.get();for(const W of H)Bi.push({segments:new i.SegmentVector([W]),sortKey:W.sortKey,state:P,terrainData:Cr})}else Bi.push({segments:cn.segments,sortKey:0,state:P,terrainData:Cr})}zt&&Bi.sort((Hi,vi)=>Hi.sortKey-vi.sortKey);for(const Hi of Bi){const vi=Hi.state;if(je.activeTexture.set(bt.TEXTURE0),vi.atlasTexture.bind(vi.atlasInterpolation,bt.CLAMP_TO_EDGE),vi.atlasTextureIcon&&(je.activeTexture.set(bt.TEXTURE1),vi.atlasTextureIcon&&vi.atlasTextureIcon.bind(vi.atlasInterpolationIcon,bt.CLAMP_TO_EDGE)),vi.isSDF){const xn=vi.uniformValues;vi.hasHalo&&(xn.u_is_halo=1,Vc(vi.buffers,Hi.segments,_,M,vi.program,ai,Te,ze,xn,Hi.terrainData)),xn.u_is_halo=0}Vc(vi.buffers,Hi.segments,_,M,vi.program,ai,Te,ze,vi.uniformValues,Hi.terrainData)}}function Vc(M,h,_,T,F,O,K,oe,ue,ve){const Te=T.context;F.draw(Te,Te.gl.TRIANGLES,O,K,oe,$r.disabled,ue,ve,_.id,M.layoutVertexBuffer,M.indexBuffer,h,_.paint,T.transform.zoom,M.programConfigurations.get(_.id),M.dynamicLayoutVertexBuffer,M.opacityVertexBuffer)}function Hc(M,h,_,T,F,O,K){const oe=M.context.gl,ue=_.paint.get("fill-pattern"),ve=ue&&ue.constantOr(1),Te=_.getCrossfadeParameters();let ze,je,bt,mt,gt;K?(je=ve&&!_.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",ze=oe.LINES):(je=ve?"fillPattern":"fill",ze=oe.TRIANGLES);for(const Vt of T){const Zt=h.getTile(Vt);if(ve&&!Zt.patternsLoaded())continue;const ni=Zt.getBucket(_);if(!ni)continue;const St=ni.programConfigurations.get(_.id),zt=M.useProgram(je,St),ai=M.style.terrain&&M.style.terrain.getTerrainData(Vt);ve&&(M.context.activeTexture.set(oe.TEXTURE0),Zt.imageAtlasTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),St.updatePaintBuffers(Te));const Ei=ue.constantOr(null);if(Ei&&Zt.imageAtlas){const vi=Zt.imageAtlas,xn=vi.patternPositions[Ei.to.toString()],cn=vi.patternPositions[Ei.from.toString()];xn&&cn&&St.setConstantPatternPositions(xn,cn)}const Bi=ai?Vt:null,Hi=M.translatePosMatrix(Bi?Bi.posMatrix:Vt.posMatrix,Zt,_.paint.get("fill-translate"),_.paint.get("fill-translate-anchor"));if(K){mt=ni.indexBuffer2,gt=ni.segments2;const vi=[oe.drawingBufferWidth,oe.drawingBufferHeight];bt=je==="fillOutlinePattern"&&ve?qs(Hi,M,Te,Zt,vi):ll(Hi,vi)}else mt=ni.indexBuffer,gt=ni.segments,bt=ve?Rl(Hi,M,Te,Zt):Ul(Hi);zt.draw(M.context,ze,F,M.stencilModeForClipping(Vt),O,$r.disabled,bt,ai,_.id,ni.layoutVertexBuffer,mt,gt,_.paint,M.transform.zoom,St)}}function Lh(M,h,_,T,F,O,K){const oe=M.context,ue=oe.gl,ve=_.paint.get("fill-extrusion-pattern"),Te=ve.constantOr(1),ze=_.getCrossfadeParameters(),je=_.paint.get("fill-extrusion-opacity");for(const bt of T){const mt=h.getTile(bt),gt=mt.getBucket(_);if(!gt)continue;const Vt=M.style.terrain&&M.style.terrain.getTerrainData(bt),Zt=gt.programConfigurations.get(_.id),ni=M.useProgram(Te?"fillExtrusionPattern":"fillExtrusion",Zt);Te&&(M.context.activeTexture.set(ue.TEXTURE0),mt.imageAtlasTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE),Zt.updatePaintBuffers(ze));const St=ve.constantOr(null);if(St&&mt.imageAtlas){const Bi=mt.imageAtlas,Hi=Bi.patternPositions[St.to.toString()],vi=Bi.patternPositions[St.from.toString()];Hi&&vi&&Zt.setConstantPatternPositions(Hi,vi)}const zt=M.translatePosMatrix(bt.posMatrix,mt,_.paint.get("fill-extrusion-translate"),_.paint.get("fill-extrusion-translate-anchor")),ai=_.paint.get("fill-extrusion-vertical-gradient"),Ei=Te?dr(zt,M,ai,je,bt,ze,mt):al(zt,M,ai,je);ni.draw(oe,oe.gl.TRIANGLES,F,O,K,$r.backCCW,Ei,Vt,_.id,gt.layoutVertexBuffer,gt.indexBuffer,gt.segments,_.paint,M.transform.zoom,Zt,M.style.terrain&&gt.centroidVertexBuffer)}}function Gc(M,h,_,T,F,O,K){const oe=M.context,ue=oe.gl,ve=_.fbo;if(!ve)return;const Te=M.useProgram("hillshade"),ze=M.style.terrain&&M.style.terrain.getTerrainData(h);oe.activeTexture.set(ue.TEXTURE0),ue.bindTexture(ue.TEXTURE_2D,ve.colorAttachment.get()),Te.draw(oe,ue.TRIANGLES,F,O,K,$r.disabled,((je,bt,mt,gt)=>{const Vt=mt.paint.get("hillshade-shadow-color"),Zt=mt.paint.get("hillshade-highlight-color"),ni=mt.paint.get("hillshade-accent-color");let St=mt.paint.get("hillshade-illumination-direction")*(Math.PI/180);mt.paint.get("hillshade-illumination-anchor")==="viewport"&&(St-=je.transform.angle);const zt=!je.options.moving;return{u_matrix:gt?gt.posMatrix:je.transform.calculatePosMatrix(bt.tileID.toUnwrapped(),zt),u_image:0,u_latrange:kl(0,bt.tileID),u_light:[mt.paint.get("hillshade-exaggeration"),St],u_shadow:Vt,u_highlight:Zt,u_accent:ni}})(M,_,T,ze?h:null),ze,T.id,M.rasterBoundsBuffer,M.quadTriangleIndexBuffer,M.rasterBoundsSegments)}function Dh(M,h,_,T,F,O){const K=M.context,oe=K.gl,ue=h.dem;if(ue&&ue.data){const ve=ue.dim,Te=ue.stride,ze=ue.getPixels();if(K.activeTexture.set(oe.TEXTURE1),K.pixelStoreUnpackPremultiplyAlpha.set(!1),h.demTexture=h.demTexture||M.getTileTexture(Te),h.demTexture){const bt=h.demTexture;bt.update(ze,{premultiply:!1}),bt.bind(oe.NEAREST,oe.CLAMP_TO_EDGE)}else h.demTexture=new Y(K,ze,oe.RGBA,{premultiply:!1}),h.demTexture.bind(oe.NEAREST,oe.CLAMP_TO_EDGE);K.activeTexture.set(oe.TEXTURE0);let je=h.fbo;if(!je){const bt=new Y(K,{width:ve,height:ve,data:null},oe.RGBA);bt.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),je=h.fbo=K.createFramebuffer(ve,ve,!0),je.colorAttachment.set(bt.texture)}K.bindFramebuffer.set(je.framebuffer),K.viewport.set([0,0,ve,ve]),M.useProgram("hillshadePrepare").draw(K,oe.TRIANGLES,T,F,O,$r.disabled,((bt,mt)=>{const gt=mt.stride,Vt=i.create();return i.ortho(Vt,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(Vt,Vt,[0,-i.EXTENT,0]),{u_matrix:Vt,u_image:1,u_dimension:[gt,gt],u_zoom:bt.overscaledZ,u_unpack:mt.getUnpackVector()}})(h.tileID,ue),null,_.id,M.rasterBoundsBuffer,M.quadTriangleIndexBuffer,M.rasterBoundsSegments),h.needsHillshadePrepare=!1}}function Wc(M,h,_,T,F,O){const K=T.paint.get("raster-fade-duration");if(!O&&K>0){const oe=i.exported.now(),ue=(oe-M.timeAdded)/K,ve=h?(oe-h.timeAdded)/K:-1,Te=_.getSource(),ze=F.coveringZoomLevel({tileSize:Te.tileSize,roundZoom:Te.roundZoom}),je=!h||Math.abs(h.tileID.overscaledZ-ze)>Math.abs(M.tileID.overscaledZ-ze),bt=je&&M.refreshedUponExpiration?1:i.clamp(je?ue:1-ve,0,1);return M.refreshedUponExpiration&&ue>=1&&(M.refreshedUponExpiration=!1),h?{opacity:1,mix:1-bt}:{opacity:bt,mix:0}}return{opacity:1,mix:0}}const jc=new i.Color(1,0,0,1),la=new i.Color(0,1,0,1),sA=new i.Color(0,0,1,1),oA=new i.Color(1,0,1,1),Kc=new i.Color(0,1,1,1);function ca(M,h,_,T){pl(M,0,h+_/2,M.transform.width,_,T)}function $c(M,h,_,T){pl(M,h-_/2,0,_,M.transform.height,T)}function pl(M,h,_,T,F,O){const K=M.context,oe=K.gl;oe.enable(oe.SCISSOR_TEST),oe.scissor(h*M.pixelRatio,_*M.pixelRatio,T*M.pixelRatio,F*M.pixelRatio),K.clear({color:O}),oe.disable(oe.SCISSOR_TEST)}function aA(M,h,_){const T=M.context,F=T.gl,O=_.posMatrix,K=M.useProgram("debug"),oe=hr.disabled,ue=jr.disabled,ve=M.colorModeForRenderPass(),Te="$debug",ze=M.style.terrain&&M.style.terrain.getTerrainData(_);T.activeTexture.set(F.TEXTURE0),M.emptyTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE);const je=h.getTileByID(_.key).latestRawTileData,bt=Math.floor((je&&je.byteLength||0)/1024),mt=h.getTile(_).tileSize,gt=512/Math.min(mt,512)*(_.overscaledZ/M.transform.zoom)*.5;let Vt=_.canonical.toString();_.overscaledZ!==_.canonical.z&&(Vt+=` => ${_.overscaledZ}`),function(Zt,ni){Zt.initDebugOverlayCanvas();const St=Zt.debugOverlayCanvas,zt=Zt.context.gl,ai=Zt.debugOverlayCanvas.getContext("2d");ai.clearRect(0,0,St.width,St.height),ai.shadowColor="white",ai.shadowBlur=2,ai.lineWidth=1.5,ai.strokeStyle="white",ai.textBaseline="top",ai.font="bold 36px Open Sans, sans-serif",ai.fillText(ni,5,5),ai.strokeText(ni,5,5),Zt.debugOverlayTexture.update(St),Zt.debugOverlayTexture.bind(zt.LINEAR,zt.CLAMP_TO_EDGE)}(M,`${Vt} ${bt}kB`),K.draw(T,F.TRIANGLES,oe,ue,qr.alphaBlended,$r.disabled,cl(O,i.Color.transparent,gt),null,Te,M.debugBuffer,M.quadTriangleIndexBuffer,M.debugSegments),K.draw(T,F.LINE_STRIP,oe,ue,ve,$r.disabled,cl(O,i.Color.red),ze,Te,M.debugBuffer,M.tileBorderIndexBuffer,M.debugSegments)}function Ho(M,h,_){const T=M.context,F=T.gl,O=M.colorModeForRenderPass(),K=new hr(F.LEQUAL,hr.ReadWrite,M.depthRangeFor3D),oe=M.useProgram("terrain"),ue=h.getTerrainMesh(),ve=h.getTerrainData(_.tileID);T.bindFramebuffer.set(null),T.viewport.set([0,0,M.width,M.height]),T.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,h.getRTTFramebuffer().colorAttachment.get());const Te=M.transform.calculatePosMatrix(_.tileID.toUnwrapped());oe.draw(T,F.TRIANGLES,K,jr.disabled,O,$r.backCCW,{u_matrix:Te,u_texture:0},ve,"terrain",ue.vertexBuffer,ue.indexBuffer,ue.segments)}function Ph(M,h,_,T){const F=M.context,O=_.tileSize*h.qualityFactor;_.textures[T]||(_.textures[T]=M.getTileTexture(O)||new Y(F,{width:O,height:O,data:null},F.gl.RGBA),_.textures[T].bind(F.gl.LINEAR,F.gl.CLAMP_TO_EDGE),T===0&&h.sourceCache.renderHistory.unshift(_.tileID.key));const K=h.getRTTFramebuffer();K.colorAttachment.set(_.textures[T].texture),F.bindFramebuffer.set(K.framebuffer),F.viewport.set([0,0,O,O])}class vu{constructor(h){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=h,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=h.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const h=this.painter.style,_=h.terrain;for(const T in h.sourceCaches){this._coordsDescendingInv[T]={};const F=h.sourceCaches[T].getVisibleCoordinates();for(const O of F){const K=_.sourceCache.getTerrainCoords(O);for(const oe in K)this._coordsDescendingInv[T][oe]||(this._coordsDescendingInv[T][oe]=[]),this._coordsDescendingInv[T][oe].push(K[oe])}}for(const T of h._order){const F=h._layers[T],O=F.source;if(this._renderToTexture[F.type]&&!this._coordsDescendingInvStr[O]){this._coordsDescendingInvStr[O]={};for(const K in this._coordsDescendingInv[O])this._coordsDescendingInvStr[O][K]=this._coordsDescendingInv[O][K].map(oe=>oe.key).sort().join()}}return this._renderableTiles.forEach(T=>{for(const F in this._coordsDescendingInvStr){const O=this._coordsDescendingInvStr[F][T.tileID.key];O&&O!==T.textureCoords[F]&&T.clearTextures(this.painter),_.needsRerender(F,T.tileID)&&T.clearTextures(this.painter)}this._rerender[T.tileID.key]=!T.textures.length}),_.clearRerenderCache(),_.sourceCache.removeOutdated(this.painter),this}renderLayer(h){const _=h.type,T=this.painter,F=T.style._order,O=T.currentLayer,K=O+1===F.length;if(this._renderToTexture[_]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=_,this._stacks[this._stacks.length-1].push(F[O]),!K))return!0;if(this._renderToTexture[this._prevType]||_==="hillshade"||this._renderToTexture[_]&&K){this._prevType=_;const oe=this._stacks.length-1,ue=this._stacks[oe]||[];for(const ve of this._renderableTiles){if(Ph(T,T.style.terrain,ve,oe),this._rerender[ve.tileID.key]){T.context.clear({color:i.Color.transparent});for(let Te=0;Te<ue.length;Te++){const ze=T.style._layers[ue[Te]],je=ze.source?this._coordsDescendingInv[ze.source][ve.tileID.key]:[ve.tileID];T._renderTileClippingMasks(ze,je),T.renderLayer(T,T.style.sourceCaches[ze.source],ze,je),ze.source&&(ve.textureCoords[ze.source]=this._coordsDescendingInvStr[ze.source][ve.tileID.key])}}Ho(T,T.style.terrain,ve)}if(_==="hillshade"){this._stacks.push([F[O]]);for(const ve of this._renderableTiles){const Te=this._coordsDescendingInv[h.source][ve.tileID.key];Ph(T,T.style.terrain,ve,this._stacks.length-1),T.context.clear({color:i.Color.transparent}),T._renderTileClippingMasks(h,Te),T.renderLayer(T,T.style.sourceCaches[h.source],h,Te),Ho(T,T.style.terrain,ve)}return!0}return this._renderToTexture[_]}return!1}}const Gl={symbol:function(M,h,_,T,F){if(M.renderPass!=="translucent")return;const O=jr.disabled,K=M.colorModeForRenderPass();_.layout.get("text-variable-anchor")&&function(oe,ue,ve,Te,ze,je,bt){const mt=ue.transform,gt=ze==="map",Vt=je==="map";for(const Zt of oe){const ni=Te.getTile(Zt),St=ni.getBucket(ve);if(!St||!St.text||!St.text.segments.get().length)continue;const zt=i.evaluateSizeForZoom(St.textSizeData,mt.zoom),ai=fr(ni,1,ue.transform.zoom),Ei=ii(Zt.posMatrix,Vt,gt,ue.transform,ai),Bi=ve.layout.get("icon-text-fit")!=="none"&&St.hasIconData();if(zt){const Hi=Math.pow(2,mt.zoom-ni.tileID.overscaledZ);nA(St,gt,Vt,bt,mt,Ei,Zt.posMatrix,Hi,zt,Bi,ue.style.terrain?(vi,xn)=>ue.style.terrain.getElevation(Zt,vi,xn):null)}}}(T,M,_,h,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),F),_.paint.get("icon-opacity").constantOr(1)!==0&&dc(M,h,_,T,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),O,K),_.paint.get("text-opacity").constantOr(1)!==0&&dc(M,h,_,T,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),O,K),h.map.showCollisionBoxes&&(gr(M,h,_,T,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),!0),gr(M,h,_,T,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),!1))},circle:function(M,h,_,T){if(M.renderPass!=="translucent")return;const F=_.paint.get("circle-opacity"),O=_.paint.get("circle-stroke-width"),K=_.paint.get("circle-stroke-opacity"),oe=!_.layout.get("circle-sort-key").isConstant();if(F.constantOr(1)===0&&(O.constantOr(1)===0||K.constantOr(1)===0))return;const ue=M.context,ve=ue.gl,Te=M.depthModeForSublayer(0,hr.ReadOnly),ze=jr.disabled,je=M.colorModeForRenderPass(),bt=[];for(let mt=0;mt<T.length;mt++){const gt=T[mt],Vt=h.getTile(gt),Zt=Vt.getBucket(_);if(!Zt)continue;const ni=Zt.programConfigurations.get(_.id),St=M.useProgram("circle",ni),zt=Zt.layoutVertexBuffer,ai=Zt.indexBuffer,Ei=M.style.terrain&&M.style.terrain.getTerrainData(gt),Bi={programConfiguration:ni,program:St,layoutVertexBuffer:zt,indexBuffer:ai,uniformValues:cs(M,gt,Vt,_),terrainData:Ei};if(oe){const Hi=Zt.segments.get();for(const vi of Hi)bt.push({segments:new i.SegmentVector([vi]),sortKey:vi.sortKey,state:Bi})}else bt.push({segments:Zt.segments,sortKey:0,state:Bi})}oe&&bt.sort((mt,gt)=>mt.sortKey-gt.sortKey);for(const mt of bt){const{programConfiguration:gt,program:Vt,layoutVertexBuffer:Zt,indexBuffer:ni,uniformValues:St,terrainData:zt}=mt.state;Vt.draw(ue,ve.TRIANGLES,Te,ze,je,$r.disabled,St,zt,_.id,Zt,ni,mt.segments,_.paint,M.transform.zoom,gt)}},heatmap:function(M,h,_,T){if(_.paint.get("heatmap-opacity")!==0)if(M.renderPass==="offscreen"){const F=M.context,O=F.gl,K=jr.disabled,oe=new qr([O.ONE,O.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(ue,ve,Te){const ze=ue.gl;ue.activeTexture.set(ze.TEXTURE1),ue.viewport.set([0,0,ve.width/4,ve.height/4]);let je=Te.heatmapFbo;if(je)ze.bindTexture(ze.TEXTURE_2D,je.colorAttachment.get()),ue.bindFramebuffer.set(je.framebuffer);else{const bt=ze.createTexture();ze.bindTexture(ze.TEXTURE_2D,bt),ze.texParameteri(ze.TEXTURE_2D,ze.TEXTURE_WRAP_S,ze.CLAMP_TO_EDGE),ze.texParameteri(ze.TEXTURE_2D,ze.TEXTURE_WRAP_T,ze.CLAMP_TO_EDGE),ze.texParameteri(ze.TEXTURE_2D,ze.TEXTURE_MIN_FILTER,ze.LINEAR),ze.texParameteri(ze.TEXTURE_2D,ze.TEXTURE_MAG_FILTER,ze.LINEAR),je=Te.heatmapFbo=ue.createFramebuffer(ve.width/4,ve.height/4,!1),function(mt,gt,Vt,Zt){const ni=mt.gl;ni.texImage2D(ni.TEXTURE_2D,0,ni.RGBA,gt.width/4,gt.height/4,0,ni.RGBA,mt.extRenderToTextureHalfFloat?mt.extTextureHalfFloat.HALF_FLOAT_OES:ni.UNSIGNED_BYTE,null),Zt.colorAttachment.set(Vt)}(ue,ve,bt,je)}})(F,M,_),F.clear({color:i.Color.transparent});for(let ue=0;ue<T.length;ue++){const ve=T[ue];if(h.hasRenderableParent(ve))continue;const Te=h.getTile(ve),ze=Te.getBucket(_);if(!ze)continue;const je=ze.programConfigurations.get(_.id),bt=M.useProgram("heatmap",je),{zoom:mt}=M.transform;bt.draw(F,O.TRIANGLES,hr.disabled,K,oe,$r.disabled,zl(ve.posMatrix,Te,mt,_.paint.get("heatmap-intensity")),null,_.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segments,_.paint,M.transform.zoom,je)}F.viewport.set([0,0,M.width,M.height])}else M.renderPass==="translucent"&&(M.context.setColorMode(M.colorModeForRenderPass()),function(F,O){const K=F.context,oe=K.gl,ue=O.heatmapFbo;if(!ue)return;K.activeTexture.set(oe.TEXTURE0),oe.bindTexture(oe.TEXTURE_2D,ue.colorAttachment.get()),K.activeTexture.set(oe.TEXTURE1);let ve=O.colorRampTexture;ve||(ve=O.colorRampTexture=new Y(K,O.colorRamp,oe.RGBA)),ve.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),F.useProgram("heatmapTexture").draw(K,oe.TRIANGLES,hr.disabled,jr.disabled,F.colorModeForRenderPass(),$r.disabled,((Te,ze,je,bt)=>{const mt=i.create();i.ortho(mt,0,Te.width,Te.height,0,0,1);const gt=Te.context.gl;return{u_matrix:mt,u_world:[gt.drawingBufferWidth,gt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ze.paint.get("heatmap-opacity")}})(F,O),null,O.id,F.viewportBuffer,F.quadTriangleIndexBuffer,F.viewportSegments,O.paint,F.transform.zoom)}(M,_))},line:function(M,h,_,T){if(M.renderPass!=="translucent")return;const F=_.paint.get("line-opacity"),O=_.paint.get("line-width");if(F.constantOr(1)===0||O.constantOr(1)===0)return;const K=M.depthModeForSublayer(0,hr.ReadOnly),oe=M.colorModeForRenderPass(),ue=_.paint.get("line-dasharray"),ve=_.paint.get("line-pattern"),Te=ve.constantOr(1),ze=_.paint.get("line-gradient"),je=_.getCrossfadeParameters(),bt=Te?"linePattern":ue?"lineSDF":ze?"lineGradient":"line",mt=M.context,gt=mt.gl;let Vt=!0;for(const Zt of T){const ni=h.getTile(Zt);if(Te&&!ni.patternsLoaded())continue;const St=ni.getBucket(_);if(!St)continue;const zt=St.programConfigurations.get(_.id),ai=M.context.program.get(),Ei=M.useProgram(bt,zt),Bi=Vt||Ei.program!==ai,Hi=M.style.terrain&&M.style.terrain.getTerrainData(Zt),vi=ve.constantOr(null);if(vi&&ni.imageAtlas){const Bn=ni.imageAtlas,tr=Bn.patternPositions[vi.to.toString()],ur=Bn.patternPositions[vi.from.toString()];tr&&ur&&zt.setConstantPatternPositions(tr,ur)}const xn=Hi?Zt:null,cn=Te?Nl(M,ni,_,je,xn):ue?Ql(M,ni,_,ue,je,xn):ze?Na(M,ni,_,St.lineClipsArray.length,xn):Ol(M,ni,_,xn);if(Te)mt.activeTexture.set(gt.TEXTURE0),ni.imageAtlasTexture.bind(gt.LINEAR,gt.CLAMP_TO_EDGE),zt.updatePaintBuffers(je);else if(ue&&(Bi||M.lineAtlas.dirty))mt.activeTexture.set(gt.TEXTURE0),M.lineAtlas.bind(mt);else if(ze){const Bn=St.gradients[_.id];let tr=Bn.texture;if(_.gradientVersion!==Bn.version){let ur=256;if(_.stepInterpolant){const Un=h.getSource().maxzoom,Lr=Zt.canonical.z===Un?Math.ceil(1<<M.transform.maxZoom-Zt.canonical.z):1;ur=i.clamp(i.nextPowerOfTwo(St.maxLineLength/i.EXTENT*1024*Lr),256,mt.maxTextureSize)}Bn.gradient=i.renderColorRamp({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:ur,image:Bn.gradient||void 0,clips:St.lineClipsArray}),Bn.texture?Bn.texture.update(Bn.gradient):Bn.texture=new Y(mt,Bn.gradient,gt.RGBA),Bn.version=_.gradientVersion,tr=Bn.texture}mt.activeTexture.set(gt.TEXTURE0),tr.bind(_.stepInterpolant?gt.NEAREST:gt.LINEAR,gt.CLAMP_TO_EDGE)}Ei.draw(mt,gt.TRIANGLES,K,M.stencilModeForClipping(Zt),oe,$r.disabled,cn,Hi,_.id,St.layoutVertexBuffer,St.indexBuffer,St.segments,_.paint,M.transform.zoom,zt,St.layoutVertexBuffer2),Vt=!1}},fill:function(M,h,_,T){const F=_.paint.get("fill-color"),O=_.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const K=M.colorModeForRenderPass(),oe=_.paint.get("fill-pattern"),ue=M.opaquePassEnabledForLayer()&&!oe.constantOr(1)&&F.constantOr(i.Color.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(M.renderPass===ue){const ve=M.depthModeForSublayer(1,M.renderPass==="opaque"?hr.ReadWrite:hr.ReadOnly);Hc(M,h,_,T,ve,K,!1)}if(M.renderPass==="translucent"&&_.paint.get("fill-antialias")){const ve=M.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,hr.ReadOnly);Hc(M,h,_,T,ve,K,!0)}},"fill-extrusion":function(M,h,_,T){const F=_.paint.get("fill-extrusion-opacity");if(F!==0&&M.renderPass==="translucent"){const O=new hr(M.context.gl.LEQUAL,hr.ReadWrite,M.depthRangeFor3D);if(F!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))Lh(M,h,_,T,O,jr.disabled,qr.disabled),Lh(M,h,_,T,O,M.stencilModeFor3D(),M.colorModeForRenderPass());else{const K=M.colorModeForRenderPass();Lh(M,h,_,T,O,jr.disabled,K)}}},hillshade:function(M,h,_,T){if(M.renderPass!=="offscreen"&&M.renderPass!=="translucent")return;const F=M.context,O=M.depthModeForSublayer(0,hr.ReadOnly),K=M.colorModeForRenderPass(),[oe,ue]=M.renderPass==="translucent"?M.stencilConfigForOverlap(T):[{},T];for(const ve of ue){const Te=h.getTile(ve);Te.needsHillshadePrepare!==void 0&&Te.needsHillshadePrepare&&M.renderPass==="offscreen"?Dh(M,Te,_,O,jr.disabled,K):M.renderPass==="translucent"&&Gc(M,ve,Te,_,O,oe[ve.overscaledZ],K)}F.viewport.set([0,0,M.width,M.height])},raster:function(M,h,_,T){if(M.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!T.length)return;const F=M.context,O=F.gl,K=h.getSource(),oe=M.useProgram("raster"),ue=M.colorModeForRenderPass(),[ve,Te]=K instanceof We?[{},T]:M.stencilConfigForOverlap(T),ze=Te[Te.length-1].overscaledZ,je=!M.options.moving;for(const bt of Te){const mt=M.depthModeForSublayer(bt.overscaledZ-ze,_.paint.get("raster-opacity")===1?hr.ReadWrite:hr.ReadOnly,O.LESS),gt=h.getTile(bt);gt.registerFadeDuration(_.paint.get("raster-fade-duration"));const Vt=h.findLoadedParent(bt,0),Zt=Wc(gt,Vt,h,_,M.transform,M.style.terrain);let ni,St;const zt=_.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;F.activeTexture.set(O.TEXTURE0),gt.texture.bind(zt,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),F.activeTexture.set(O.TEXTURE1),Vt?(Vt.texture.bind(zt,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),ni=Math.pow(2,Vt.tileID.overscaledZ-gt.tileID.overscaledZ),St=[gt.tileID.canonical.x*ni%1,gt.tileID.canonical.y*ni%1]):gt.texture.bind(zt,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST);const ai=M.style.terrain&&M.style.terrain.getTerrainData(bt),Ei=ai?bt:null,Bi=Ei?Ei.posMatrix:M.transform.calculatePosMatrix(bt.toUnwrapped(),je),Hi=ps(Bi,St||[0,0],ni||1,Zt,_);K instanceof We?oe.draw(F,O.TRIANGLES,mt,jr.disabled,ue,$r.disabled,Hi,ai,_.id,K.boundsBuffer,M.quadTriangleIndexBuffer,K.boundsSegments):oe.draw(F,O.TRIANGLES,mt,ve[bt.overscaledZ],ue,$r.disabled,Hi,ai,_.id,M.rasterBoundsBuffer,M.quadTriangleIndexBuffer,M.rasterBoundsSegments)}},background:function(M,h,_,T){const F=_.paint.get("background-color"),O=_.paint.get("background-opacity");if(O===0)return;const K=M.context,oe=K.gl,ue=M.transform,ve=ue.tileSize,Te=_.paint.get("background-pattern");if(M.isPatternMissing(Te))return;const ze=!Te&&F.a===1&&O===1&&M.opaquePassEnabledForLayer()?"opaque":"translucent";if(M.renderPass!==ze)return;const je=jr.disabled,bt=M.depthModeForSublayer(0,ze==="opaque"?hr.ReadWrite:hr.ReadOnly),mt=M.colorModeForRenderPass(),gt=M.useProgram(Te?"backgroundPattern":"background"),Vt=T||ue.coveringTiles({tileSize:ve,terrain:M.style.terrain});Te&&(K.activeTexture.set(oe.TEXTURE0),M.imageManager.bind(M.context));const Zt=_.getCrossfadeParameters();for(const ni of Vt){const St=T?ni.posMatrix:M.transform.calculatePosMatrix(ni.toUnwrapped()),zt=Te?fu(St,O,M,Te,{tileID:ni,tileSize:ve},Zt):JA(St,O,F),ai=M.style.terrain&&M.style.terrain.getTerrainData(ni);gt.draw(K,oe.TRIANGLES,bt,je,mt,$r.disabled,zt,ai,_.id,M.tileExtentBuffer,M.quadTriangleIndexBuffer,M.tileExtentSegments)}},debug:function(M,h,_){for(let T=0;T<_.length;T++)aA(M,h,_[T])},custom:function(M,h,_){const T=M.context,F=_.implementation;if(M.renderPass==="offscreen"){const O=F.prerender;O&&(M.setCustomLayerDefaults(),T.setColorMode(M.colorModeForRenderPass()),O.call(F,T.gl,M.transform.customLayerMatrix()),T.setDirty(),M.setBaseState())}else if(M.renderPass==="translucent"){M.setCustomLayerDefaults(),T.setColorMode(M.colorModeForRenderPass()),T.setStencilMode(jr.disabled);const O=F.renderingMode==="3d"?new hr(M.context.gl.LEQUAL,hr.ReadWrite,M.depthRangeFor3D):M.depthModeForSublayer(0,hr.ReadOnly);T.setDepthMode(O),F.render(T.gl,M.transform.customLayerMatrix()),T.setDirty(),M.setBaseState(),T.bindFramebuffer.set(null)}}};class wu{constructor(h,_){this.context=new Fh(h),this.transform=_,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.create(),renderTime:0},this.setup(),this.numSublayers=Nt.maxUnderzooming+Nt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new tn,this.gpuTimers={}}resize(h,_,T){if(this.width=h*T,this.height=_*T,this.pixelRatio=T,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const F of this.style._order)this.style._layers[F].resize()}setup(){const h=this.context,_=new i.PosArray;_.emplaceBack(0,0),_.emplaceBack(i.EXTENT,0),_.emplaceBack(0,i.EXTENT),_.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=h.createVertexBuffer(_,rr.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const T=new i.PosArray;T.emplaceBack(0,0),T.emplaceBack(i.EXTENT,0),T.emplaceBack(0,i.EXTENT),T.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=h.createVertexBuffer(T,rr.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const F=new i.RasterBoundsArray;F.emplaceBack(0,0,0,0),F.emplaceBack(i.EXTENT,0,i.EXTENT,0),F.emplaceBack(0,i.EXTENT,0,i.EXTENT),F.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.rasterBoundsBuffer=h.createVertexBuffer(F,Oe.members),this.rasterBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const O=new i.PosArray;O.emplaceBack(0,0),O.emplaceBack(1,0),O.emplaceBack(0,1),O.emplaceBack(1,1),this.viewportBuffer=h.createVertexBuffer(O,rr.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const K=new i.LineStripIndexArray;K.emplaceBack(0),K.emplaceBack(1),K.emplaceBack(3),K.emplaceBack(2),K.emplaceBack(0),this.tileBorderIndexBuffer=h.createIndexBuffer(K);const oe=new i.TriangleIndexArray;oe.emplaceBack(0,1,2),oe.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=h.createIndexBuffer(oe),this.emptyTexture=new Y(h,{width:1,height:1,data:new Uint8Array([0,0,0,0])},h.gl.RGBA);const ue=this.context.gl;this.stencilClearMode=new jr({func:ue.ALWAYS,mask:0},0,255,ue.ZERO,ue.ZERO,ue.ZERO)}clearStencil(){const h=this.context,_=h.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const T=i.create();i.ortho(T,0,this.width,this.height,0,0,1),i.scale(T,T,[_.drawingBufferWidth,_.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(h,_.TRIANGLES,hr.disabled,this.stencilClearMode,qr.disabled,$r.disabled,Oa(T),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(h,_){if(this.currentStencilSource===h.source||!h.isTileClipped()||!_||!_.length)return;this.currentStencilSource=h.source;const T=this.context,F=T.gl;this.nextStencilID+_.length>256&&this.clearStencil(),T.setColorMode(qr.disabled),T.setDepthMode(hr.disabled);const O=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const K of _){const oe=this._tileClippingMaskIDs[K.key]=this.nextStencilID++,ue=this.style.terrain&&this.style.terrain.getTerrainData(K);O.draw(T,F.TRIANGLES,hr.disabled,new jr({func:F.ALWAYS,mask:0},oe,255,F.KEEP,F.KEEP,F.REPLACE),qr.disabled,$r.disabled,Oa(K.posMatrix),ue,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const h=this.nextStencilID++,_=this.context.gl;return new jr({func:_.NOTEQUAL,mask:255},h,255,_.KEEP,_.KEEP,_.REPLACE)}stencilModeForClipping(h){const _=this.context.gl;return new jr({func:_.EQUAL,mask:255},this._tileClippingMaskIDs[h.key],0,_.KEEP,_.KEEP,_.REPLACE)}stencilConfigForOverlap(h){const _=this.context.gl,T=h.sort((K,oe)=>oe.overscaledZ-K.overscaledZ),F=T[T.length-1].overscaledZ,O=T[0].overscaledZ-F+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const K={};for(let oe=0;oe<O;oe++)K[oe+F]=new jr({func:_.GEQUAL,mask:255},oe+this.nextStencilID,255,_.KEEP,_.KEEP,_.REPLACE);return this.nextStencilID+=O,[K,T]}return[{[F]:jr.disabled},T]}colorModeForRenderPass(){const h=this.context.gl;return this._showOverdrawInspector?new qr([h.CONSTANT_COLOR,h.ONE],new i.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?qr.unblended:qr.alphaBlended}depthModeForSublayer(h,_,T){if(!this.opaquePassEnabledForLayer())return hr.disabled;const F=1-((1+this.currentLayer)*this.numSublayers+h)*this.depthEpsilon;return new hr(T||this.context.gl.LEQUAL,_,[F,F])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(h,_){this.style=h,this.options=_,this.lineAtlas=h.lineAtlas,this.imageManager=h.imageManager,this.glyphManager=h.glyphManager,this.symbolFadeChange=h.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();const T=this.style._order,F=this.style.sourceCaches,O=this.style.terrain&&new vu(this);for(const ve in F){const Te=F[ve];Te.used&&Te.prepare(this.context)}const K={},oe={},ue={};for(const ve in F){const Te=F[ve];K[ve]=Te.getVisibleCoordinates(),oe[ve]=K[ve].slice().reverse(),ue[ve]=Te.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let ve=0;ve<T.length;ve++)if(this.style._layers[T[ve]].is3D()){this.opaquePassCutoff=ve;break}if(O){this.opaquePassCutoff=0;const ve=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!i.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||ve.length)&&(i.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(Te,ze){const je=Te.context,bt=je.gl,mt=qr.unblended,gt=new hr(bt.LEQUAL,hr.ReadWrite,[0,1]),Vt=ze.getTerrainMesh(),Zt=ze.sourceCache.getRenderableTiles(),ni=Te.useProgram("terrainDepth");je.bindFramebuffer.set(ze.getFramebuffer("depth").framebuffer),je.viewport.set([0,0,Te.width/devicePixelRatio,Te.height/devicePixelRatio]),je.clear({color:i.Color.transparent,depth:1});for(const St of Zt){const zt=ze.getTerrainData(St.tileID),ai=Te.transform.calculatePosMatrix(St.tileID.toUnwrapped());ni.draw(je,bt.TRIANGLES,gt,jr.disabled,mt,$r.backCCW,{u_matrix:ai},zt,"terrain",Vt.vertexBuffer,Vt.indexBuffer,Vt.segments)}je.bindFramebuffer.set(null),je.viewport.set([0,0,Te.width,Te.height])}(this,this.style.terrain),function(Te,ze){const je=Te.context,bt=je.gl,mt=qr.unblended,gt=new hr(bt.LEQUAL,hr.ReadWrite,[0,1]),Vt=ze.getTerrainMesh(),Zt=ze.getCoordsTexture(),ni=ze.sourceCache.getRenderableTiles(),St=Te.useProgram("terrainCoords");je.bindFramebuffer.set(ze.getFramebuffer("coords").framebuffer),je.viewport.set([0,0,Te.width/devicePixelRatio,Te.height/devicePixelRatio]),je.clear({color:i.Color.transparent,depth:1}),ze.coordsIndex=[];for(const zt of ni){const ai=ze.getTerrainData(zt.tileID);je.activeTexture.set(bt.TEXTURE0),bt.bindTexture(bt.TEXTURE_2D,Zt.texture);const Ei=Te.transform.calculatePosMatrix(zt.tileID.toUnwrapped());St.draw(je,bt.TRIANGLES,gt,jr.disabled,mt,$r.backCCW,{u_matrix:Ei,u_terrain_coords_id:(255-ze.coordsIndex.length)/255,u_texture:0},ai,"terrain",Vt.vertexBuffer,Vt.indexBuffer,Vt.segments),ze.coordsIndex.push(zt.tileID.key)}je.bindFramebuffer.set(null),je.viewport.set([0,0,Te.width,Te.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const ve of T){const Te=this.style._layers[ve];if(!Te.hasOffscreenPass()||Te.isHidden(this.transform.zoom))continue;const ze=oe[Te.source];(Te.type==="custom"||ze.length)&&this.renderLayer(this,F[Te.source],Te,ze)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:_.showOverdrawInspector?i.Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=_.showOverdrawInspector,this.depthRangeFor3D=[0,1-(h._order.length+2)*this.numSublayers*this.depthEpsilon],!O)for(this.renderPass="opaque",this.currentLayer=T.length-1;this.currentLayer>=0;this.currentLayer--){const ve=this.style._layers[T[this.currentLayer]],Te=F[ve.source],ze=K[ve.source];this._renderTileClippingMasks(ve,ze),this.renderLayer(this,Te,ve,ze)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<T.length;this.currentLayer++){const ve=this.style._layers[T[this.currentLayer]],Te=F[ve.source];if(O&&O.renderLayer(ve))continue;const ze=(ve.type==="symbol"?ue:oe)[ve.source];this._renderTileClippingMasks(ve,K[ve.source]),this.renderLayer(this,Te,ve,ze)}if(this.options.showTileBoundaries){let ve,Te;Object.values(this.style._layers).forEach(ze=>{ze.source&&!ze.isHidden(this.transform.zoom)&&(ze.source!==(Te&&Te.id)&&(Te=this.style.sourceCaches[ze.source]),(!ve||ve.getSource().maxzoom<Te.getSource().maxzoom)&&(ve=Te))}),ve&&Gl.debug(this,ve,ve.getVisibleCoordinates())}this.options.showPadding&&function(ve){const Te=ve.transform.padding;ca(ve,ve.transform.height-(Te.top||0),3,jc),ca(ve,Te.bottom||0,3,la),$c(ve,Te.left||0,3,sA),$c(ve,ve.transform.width-(Te.right||0),3,oA);const ze=ve.transform.centerPoint;(function(je,bt,mt,gt){pl(je,bt-1,mt-10,2,20,gt),pl(je,bt-10,mt-1,20,2,gt)})(ve,ze.x,ve.transform.height-ze.y,Kc)}(this),this.context.setDefault()}renderLayer(h,_,T,F){T.isHidden(this.transform.zoom)||(T.type==="background"||T.type==="custom"||(F||[]).length)&&(this.id=T.id,this.gpuTimingStart(T),Gl[T.type](h,_,T,F,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(h){if(!this.options.gpuTiming)return;const _=this.context.extTimerQuery;let T=this.gpuTimers[h.id];T||(T=this.gpuTimers[h.id]={calls:0,cpuTime:0,query:_.createQueryEXT()}),T.calls++,_.beginQueryEXT(_.TIME_ELAPSED_EXT,T.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const h=this.context.extTimerQuery;h.endQueryEXT(h.TIME_ELAPSED_EXT)}collectGpuTimers(){const h=this.gpuTimers;return this.gpuTimers={},h}queryGpuTimers(h){const _={};for(const T in h){const F=h[T],O=this.context.extTimerQuery,K=O.getQueryObjectEXT(F.query,O.QUERY_RESULT_EXT)/1e6;O.deleteQueryEXT(F.query),_[T]=K}return _}translatePosMatrix(h,_,T,F,O){if(!T[0]&&!T[1])return h;const K=O?F==="map"?this.transform.angle:0:F==="viewport"?-this.transform.angle:0;if(K){const ve=Math.sin(K),Te=Math.cos(K);T=[T[0]*Te-T[1]*ve,T[0]*ve+T[1]*Te]}const oe=[O?T[0]:fr(_,T[0],this.transform.zoom),O?T[1]:fr(_,T[1],this.transform.zoom),0],ue=new Float32Array(16);return i.translate(ue,h,oe),ue}saveTileTexture(h){const _=this._tileTextures[h.size[0]];_?_.push(h):this._tileTextures[h.size[0]]=[h]}getTileTexture(h){const _=this._tileTextures[h];return _&&_.length>0?_.pop():null}isPatternMissing(h){if(!h)return!1;if(!h.from||!h.to)return!0;const _=this.imageManager.getPattern(h.from.toString()),T=this.imageManager.getPattern(h.to.toString());return!_||!T}useProgram(h,_){this.cache=this.cache||{};const T=h+(_?_.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[T]||(this.cache[T]=new Ar(this.context,h,zs[h],_,Bs[h],this._showOverdrawInspector,this.style.terrain)),this.cache[T]}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 h=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(h.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Y(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Zc{constructor(h,_){this.points=h,this.planes=_}static fromInvProjectionMatrix(h,_,T){const F=Math.pow(2,T),O=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(oe=>{const ue=1/(oe=i.transformMat4([],oe,h))[3]/_*F;return i.mul$1(oe,oe,[ue,ue,1/oe[3],ue])}),K=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(oe=>{const ue=i.sub([],O[oe[0]],O[oe[1]]),ve=i.sub([],O[oe[2]],O[oe[1]]),Te=i.normalize([],i.cross([],ue,ve)),ze=-i.dot(Te,O[oe[1]]);return Te.concat(ze)});return new Zc(O,K)}}class Xc{constructor(h,_){this.min=h,this.max=_,this.center=i.scale$1([],i.add([],this.min,this.max),.5)}quadrant(h){const _=[h%2==0,h<2],T=i.clone$2(this.min),F=i.clone$2(this.max);for(let O=0;O<_.length;O++)T[O]=_[O]?this.min[O]:this.center[O],F[O]=_[O]?this.center[O]:this.max[O];return F[2]=this.max[2],new Xc(T,F)}distanceX(h){return Math.max(Math.min(this.max[0],h[0]),this.min[0])-h[0]}distanceY(h){return Math.max(Math.min(this.max[1],h[1]),this.min[1])-h[1]}intersects(h){const _=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let T=!0;for(let F=0;F<h.planes.length;F++){const O=h.planes[F];let K=0;for(let oe=0;oe<_.length;oe++)i.dot$1(O,_[oe])>=0&&K++;if(K===0)return 0;K!==_.length&&(T=!1)}if(T)return 2;for(let F=0;F<3;F++){let O=Number.MAX_VALUE,K=-Number.MAX_VALUE;for(let oe=0;oe<h.points.length;oe++){const ue=h.points[oe][F]-this.min[F];O=Math.min(O,ue),K=Math.max(K,ue)}if(K<0||O>this.max[F]-this.min[F])return 0}return 1}}class fl{constructor(h=0,_=0,T=0,F=0){if(isNaN(h)||h<0||isNaN(_)||_<0||isNaN(T)||T<0||isNaN(F)||F<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=h,this.bottom=_,this.left=T,this.right=F}interpolate(h,_,T){return _.top!=null&&h.top!=null&&(this.top=i.number(h.top,_.top,T)),_.bottom!=null&&h.bottom!=null&&(this.bottom=i.number(h.bottom,_.bottom,T)),_.left!=null&&h.left!=null&&(this.left=i.number(h.left,_.left,T)),_.right!=null&&h.right!=null&&(this.right=i.number(h.right,_.right,T)),this}getCenter(h,_){const T=i.clamp((this.left+h-this.right)/2,0,h),F=i.clamp((this.top+_-this.bottom)/2,0,_);return new i.pointGeometry(T,F)}equals(h){return this.top===h.top&&this.bottom===h.bottom&&this.left===h.left&&this.right===h.right}clone(){return new fl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class qc{constructor(h,_,T,F,O){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=O===void 0||!!O,this._minZoom=h||0,this._maxZoom=_||22,this._minPitch=T==null?0:T,this._maxPitch=F==null?60:F,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new fl,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const h=new qc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return h.tileSize=this.tileSize,h.latRange=this.latRange,h.width=this.width,h.height=this.height,h._center=this._center,h._elevation=this._elevation,h.zoom=this.zoom,h.angle=this.angle,h._fov=this._fov,h._pitch=this._pitch,h._unmodified=this._unmodified,h._edgeInsets=this._edgeInsets.clone(),h._calcMatrices(),h}get minZoom(){return this._minZoom}set minZoom(h){this._minZoom!==h&&(this._minZoom=h,this.zoom=Math.max(this.zoom,h))}get maxZoom(){return this._maxZoom}set maxZoom(h){this._maxZoom!==h&&(this._maxZoom=h,this.zoom=Math.min(this.zoom,h))}get minPitch(){return this._minPitch}set minPitch(h){this._minPitch!==h&&(this._minPitch=h,this.pitch=Math.max(this.pitch,h))}get maxPitch(){return this._maxPitch}set maxPitch(h){this._maxPitch!==h&&(this._maxPitch=h,this.pitch=Math.min(this.pitch,h))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(h){h===void 0?h=!0:h===null&&(h=!1),this._renderWorldCopies=h}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(h){const _=-i.wrap(h,-180,180)*Math.PI/180;var T;this.angle!==_&&(this._unmodified=!1,this.angle=_,this._calcMatrices(),this.rotationMatrix=(T=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(T[1]=0,T[2]=0),T[0]=1,T[3]=1,T),function(F,O,K){var oe=O[0],ue=O[1],ve=O[2],Te=O[3],ze=Math.sin(K),je=Math.cos(K);F[0]=oe*je+ve*ze,F[1]=ue*je+Te*ze,F[2]=oe*-ze+ve*je,F[3]=ue*-ze+Te*je}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(h){const _=i.clamp(h,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==_&&(this._unmodified=!1,this._pitch=_,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(h){h=Math.max(.01,Math.min(60,h)),this._fov!==h&&(this._unmodified=!1,this._fov=h/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(h){const _=Math.min(Math.max(h,this.minZoom),this.maxZoom);this._zoom!==_&&(this._unmodified=!1,this._zoom=_,this.scale=this.zoomScale(_),this.tileZoom=Math.floor(_),this.zoomFraction=_-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(h){h.lat===this._center.lat&&h.lng===this._center.lng||(this._unmodified=!1,this._center=h,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(h){h!==this._elevation&&(this._elevation=h,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(h){this._edgeInsets.equals(h)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,h,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(h){return this._edgeInsets.equals(h)}interpolatePadding(h,_,T){this._unmodified=!1,this._edgeInsets.interpolate(h,_,T),this._constrain(),this._calcMatrices()}coveringZoomLevel(h){const _=(h.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/h.tileSize));return Math.max(0,_)}getVisibleUnwrappedCoordinates(h){const _=[new i.UnwrappedTileID(0,h)];if(this._renderWorldCopies){const T=this.pointCoordinate(new i.pointGeometry(0,0)),F=this.pointCoordinate(new i.pointGeometry(this.width,0)),O=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),K=this.pointCoordinate(new i.pointGeometry(0,this.height)),oe=Math.floor(Math.min(T.x,F.x,O.x,K.x)),ue=Math.floor(Math.max(T.x,F.x,O.x,K.x)),ve=1;for(let Te=oe-ve;Te<=ue+ve;Te++)Te!==0&&_.push(new i.UnwrappedTileID(Te,h))}return _}coveringTiles(h){var _,T;let F=this.coveringZoomLevel(h);const O=F;if(h.minzoom!==void 0&&F<h.minzoom)return[];h.maxzoom!==void 0&&F>h.maxzoom&&(F=h.maxzoom);const K=this.pointCoordinate(this.getCameraPoint()),oe=i.MercatorCoordinate.fromLngLat(this.center),ue=Math.pow(2,F),ve=[ue*K.x,ue*K.y,0],Te=[ue*oe.x,ue*oe.y,0],ze=Zc.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,F);let je=h.minzoom||0;!h.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(je=F);const bt=h.terrain?2/Math.min(this.tileSize,h.tileSize)*this.tileSize:3,mt=St=>({aabb:new Xc([St*ue,0,0],[(St+1)*ue,ue,0]),zoom:0,x:0,y:0,wrap:St,fullyVisible:!1}),gt=[],Vt=[],Zt=F,ni=h.reparseOverscaled?O:F;if(this._renderWorldCopies)for(let St=1;St<=3;St++)gt.push(mt(-St)),gt.push(mt(St));for(gt.push(mt(0));gt.length>0;){const St=gt.pop(),zt=St.x,ai=St.y;let Ei=St.fullyVisible;if(!Ei){const Bn=St.aabb.intersects(ze);if(Bn===0)continue;Ei=Bn===2}const Bi=h.terrain?ve:Te,Hi=St.aabb.distanceX(Bi),vi=St.aabb.distanceY(Bi),xn=Math.max(Math.abs(Hi),Math.abs(vi)),cn=bt+(1<<Zt-St.zoom)-2;if(St.zoom===Zt||xn>cn&&St.zoom>=je){const Bn=Zt-St.zoom,tr=ve[0]-.5-(zt<<Bn),ur=ve[1]-.5-(ai<<Bn);Vt.push({tileID:new i.OverscaledTileID(St.zoom===Zt?ni:St.zoom,St.wrap,St.zoom,zt,ai),distanceSq:i.sqrLen([Te[0]-.5-zt,Te[1]-.5-ai]),tileDistanceToCamera:Math.sqrt(tr*tr+ur*ur)})}else for(let Bn=0;Bn<4;Bn++){const tr=(zt<<1)+Bn%2,ur=(ai<<1)+(Bn>>1),Un=St.zoom+1;let Lr=St.aabb.quadrant(Bn);if(h.terrain){const Rr=new i.OverscaledTileID(Un,St.wrap,Un,tr,ur),Cr=h.terrain.getMinMaxElevation(Rr),Er=(_=Cr.minElevation)!==null&&_!==void 0?_:this.elevation,Gr=(T=Cr.maxElevation)!==null&&T!==void 0?T:this.elevation;Lr=new Xc([Lr.min[0],Lr.min[1],Er],[Lr.max[0],Lr.max[1],Gr])}gt.push({aabb:Lr,zoom:Un,x:tr,y:ur,wrap:St.wrap,fullyVisible:Ei})}}return Vt.sort((St,zt)=>St.distanceSq-zt.distanceSq).map(St=>St.tileID)}resize(h,_){this.width=h,this.height=_,this.pixelsToGLUnits=[2/h,-2/_],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(h){return Math.pow(2,h)}scaleZoom(h){return Math.log(h)/Math.LN2}project(h){const _=i.clamp(h.lat,-this.maxValidLatitude,this.maxValidLatitude);return new i.pointGeometry(i.mercatorXfromLng(h.lng)*this.worldSize,i.mercatorYfromLat(_)*this.worldSize)}unproject(h){return new i.MercatorCoordinate(h.x/this.worldSize,h.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(h){this.freezeElevation||(this.elevation=h?this.getElevation(this._center,h):0)}getElevation(h,_){const T=i.MercatorCoordinate.fromLngLat(h),F=(1<<this.tileZoom)*i.EXTENT,O=T.x*F,K=T.y*F,oe=Math.floor(O/i.EXTENT),ue=Math.floor(K/i.EXTENT),ve=new i.OverscaledTileID(this.tileZoom,0,this.tileZoom,oe,ue);return _.getElevation(ve,O%i.EXTENT,K%i.EXTENT,i.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(h){const _=this.pointLocation(this.centerPoint,h),T=this.getElevation(_,h);if(!(this.elevation-T))return;const F=this.getCameraPosition(),O=i.MercatorCoordinate.fromLngLat(F.lngLat,F.altitude),K=i.MercatorCoordinate.fromLngLat(_,T),oe=O.x-K.x,ue=O.y-K.y,ve=O.z-K.z,Te=Math.sqrt(oe*oe+ue*ue+ve*ve),ze=this.scaleZoom(this.cameraToCenterDistance/Te/this.tileSize);this._elevation=T,this._center=_,this.zoom=ze}setLocationAtPoint(h,_){const T=this.pointCoordinate(_),F=this.pointCoordinate(this.centerPoint),O=this.locationCoordinate(h),K=new i.MercatorCoordinate(O.x-(T.x-F.x),O.y-(T.y-F.y));this.center=this.coordinateLocation(K),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(h,_){return _?this.coordinatePoint(this.locationCoordinate(h),this.getElevation(h,_),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(h))}pointLocation(h,_){return this.coordinateLocation(this.pointCoordinate(h,_))}locationCoordinate(h){return i.MercatorCoordinate.fromLngLat(h)}coordinateLocation(h){return h&&h.toLngLat()}pointCoordinate(h,_){if(_){const je=_.pointCoordinate(h);if(je!=null)return je}const T=[h.x,h.y,0,1],F=[h.x,h.y,1,1];i.transformMat4(T,T,this.pixelMatrixInverse),i.transformMat4(F,F,this.pixelMatrixInverse);const O=T[3],K=F[3],oe=T[1]/O,ue=F[1]/K,ve=T[2]/O,Te=F[2]/K,ze=ve===Te?0:(0-ve)/(Te-ve);return new i.MercatorCoordinate(i.number(T[0]/O,F[0]/K,ze)/this.worldSize,i.number(oe,ue,ze)/this.worldSize)}coordinatePoint(h,_=0,T=this.pixelMatrix){const F=[h.x*this.worldSize,h.y*this.worldSize,_,1];return i.transformMat4(F,F,T),new i.pointGeometry(F[0]/F[3],F[1]/F[3])}getBounds(){const h=Math.max(0,this.height/2-this.getHorizon());return new i.LngLatBounds().extend(this.pointLocation(new i.pointGeometry(0,h))).extend(this.pointLocation(new i.pointGeometry(this.width,h))).extend(this.pointLocation(new i.pointGeometry(this.width,this.height))).extend(this.pointLocation(new i.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new i.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(h){h?(this.lngRange=[h.getWest(),h.getEast()],this.latRange=[h.getSouth(),h.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(h,_=!1){const T=h.key,F=_?this._alignedPosMatrixCache:this._posMatrixCache;if(F[T])return F[T];const O=h.canonical,K=this.worldSize/this.zoomScale(O.z),oe=O.x+Math.pow(2,O.z)*h.wrap,ue=i.identity(new Float64Array(16));return i.translate(ue,ue,[oe*K,O.y*K,0]),i.scale(ue,ue,[K/i.EXTENT,K/i.EXTENT,1]),i.multiply(ue,_?this.alignedProjMatrix:this.projMatrix,ue),F[T]=new Float32Array(ue),F[T]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let h,_,T,F,O=-90,K=90,oe=-180,ue=180;const ve=this.size,Te=this._unmodified;if(this.latRange){const bt=this.latRange;O=i.mercatorYfromLat(bt[1])*this.worldSize,K=i.mercatorYfromLat(bt[0])*this.worldSize,h=K-O<ve.y?ve.y/(K-O):0}if(this.lngRange){const bt=this.lngRange;oe=i.wrap(i.mercatorXfromLng(bt[0])*this.worldSize,0,this.worldSize),ue=i.wrap(i.mercatorXfromLng(bt[1])*this.worldSize,0,this.worldSize),ue<oe&&(ue+=this.worldSize),_=ue-oe<ve.x?ve.x/(ue-oe):0}const ze=this.point,je=Math.max(_||0,h||0);if(je)return this.center=this.unproject(new i.pointGeometry(_?(ue+oe)/2:ze.x,h?(K+O)/2:ze.y)),this.zoom+=this.scaleZoom(je),this._unmodified=Te,void(this._constraining=!1);if(this.latRange){const bt=ze.y,mt=ve.y/2;bt-mt<O&&(F=O+mt),bt+mt>K&&(F=K-mt)}if(this.lngRange){const bt=(oe+ue)/2,mt=i.wrap(ze.x,bt-this.worldSize/2,bt+this.worldSize/2),gt=ve.x/2;mt-gt<oe&&(T=oe+gt),mt+gt>ue&&(T=ue-gt)}T===void 0&&F===void 0||(this.center=this.unproject(new i.pointGeometry(T!==void 0?T:ze.x,F!==void 0?F:ze.y)).wrap()),this._unmodified=Te,this._constraining=!1}_calcMatrices(){if(!this.height)return;const h=this.centerOffset,_=this.point.x,T=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=i.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let F=i.identity(new Float64Array(16));i.scale(F,F,[this.width/2,-this.height/2,1]),i.translate(F,F,[1,-1,0]),this.labelPlaneMatrix=F,F=i.identity(new Float64Array(16)),i.scale(F,F,[1,-1,1]),i.translate(F,F,[-1,-1,0]),i.scale(F,F,[2/this.width,2/this.height,1]),this.glCoordMatrix=F,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const O=Math.PI/2+this._pitch,K=this._fov*(.5+h.y/this.height),oe=Math.sin(K)*this.cameraToSeaLevelDistance/Math.sin(i.clamp(Math.PI-O-K,.01,Math.PI-.01)),ue=this.getHorizon(),ve=2*Math.atan(ue/this.cameraToCenterDistance)*(.5+h.y/(2*ue)),Te=Math.sin(ve)*this.cameraToSeaLevelDistance/Math.sin(i.clamp(Math.PI-O-ve,.01,Math.PI-.01)),ze=Math.cos(Math.PI/2-this._pitch)*oe+this.cameraToSeaLevelDistance,je=Math.cos(Math.PI/2-this._pitch)*Te+this.cameraToSeaLevelDistance,bt=1.01*Math.min(ze,je),mt=this.height/50;F=new Float64Array(16),i.perspective(F,this._fov,this.width/this.height,mt,bt),F[8]=2*-h.x/this.width,F[9]=2*h.y/this.height,i.scale(F,F,[1,-1,1]),i.translate(F,F,[0,0,-this.cameraToCenterDistance]),i.rotateX(F,F,this._pitch),i.rotateZ(F,F,this.angle),i.translate(F,F,[-_,-T,0]),this.mercatorMatrix=i.scale([],F,[this.worldSize,this.worldSize,this.worldSize]),i.scale(F,F,[1,1,this._pixelPerMeter]),this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,F),i.translate(F,F,[0,0,-this.elevation]),this.projMatrix=F,this.invProjMatrix=i.invert([],F),this.pixelMatrix3D=i.multiply(new Float64Array(16),this.labelPlaneMatrix,F);const gt=this.width%2/2,Vt=this.height%2/2,Zt=Math.cos(this.angle),ni=Math.sin(this.angle),St=_-Math.round(_)+Zt*gt+ni*Vt,zt=T-Math.round(T)+Zt*Vt+ni*gt,ai=new Float64Array(F);if(i.translate(ai,ai,[St>.5?St-1:St,zt>.5?zt-1:zt,0]),this.alignedProjMatrix=ai,F=i.invert(new Float64Array(16),this.pixelMatrix),!F)throw new Error("failed to invert matrix");this.pixelMatrixInverse=F,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const h=this.pointCoordinate(new i.pointGeometry(0,0)),_=[h.x*this.worldSize,h.y*this.worldSize,0,1];return i.transformMat4(_,_,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const h=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,h))}getCameraQueryGeometry(h){const _=this.getCameraPoint();if(h.length===1)return[h[0],_];{let T=_.x,F=_.y,O=_.x,K=_.y;for(const oe of h)T=Math.min(T,oe.x),F=Math.min(F,oe.y),O=Math.max(O,oe.x),K=Math.max(K,oe.y);return[new i.pointGeometry(T,F),new i.pointGeometry(O,F),new i.pointGeometry(O,K),new i.pointGeometry(T,K),new i.pointGeometry(T,F)]}}}class Uh{constructor(h){this._hashName=h&&encodeURIComponent(h),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(_,T){let F=!1,O=null;const K=()=>{O=null,F&&(_(),O=setTimeout(K,300),F=!1)};return()=>(F=!0,O||K(),O)}(this._updateHashUnthrottled.bind(this))}addTo(h){return this._map=h,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()),delete this._map,this}getHashString(h){const _=this._map.getCenter(),T=Math.round(100*this._map.getZoom())/100,F=Math.ceil((T*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,F),K=Math.round(_.lng*O)/O,oe=Math.round(_.lat*O)/O,ue=this._map.getBearing(),ve=this._map.getPitch();let Te="";if(Te+=h?`/${K}/${oe}/${T}`:`${T}/${oe}/${K}`,(ue||ve)&&(Te+="/"+Math.round(10*ue)/10),ve&&(Te+=`/${Math.round(ve)}`),this._hashName){const ze=this._hashName;let je=!1;const bt=window.location.hash.slice(1).split("&").map(mt=>{const gt=mt.split("=")[0];return gt===ze?(je=!0,`${gt}=${Te}`):mt}).filter(mt=>mt);return je||bt.push(`${ze}=${Te}`),`#${bt.join("&")}`}return`#${Te}`}_getCurrentHash(){const h=window.location.hash.replace("#","");if(this._hashName){let _;return h.split("&").map(T=>T.split("=")).forEach(T=>{T[0]===this._hashName&&(_=T)}),(_&&_[1]||"").split("/")}return h.split("/")}_onHashChange(){const h=this._getCurrentHash();if(h.length>=3&&!h.some(_=>isNaN(_))){const _=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:_,pitch:+(h[4]||0)}),!0}return!1}_updateHashUnthrottled(){const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}}}const Rh={linearity:.3,easing:i.bezier(0,0,.3,1)},bu=i.extend({deceleration:2500,maxSpeed:1400},Rh),id=i.extend({deceleration:20,maxSpeed:1400},Rh),pc=i.extend({deceleration:1e3,maxSpeed:360},Rh),fc=i.extend({deceleration:1e3,maxSpeed:90},Rh);class Yc{constructor(h){this._map=h,this.clear()}clear(){this._inertiaBuffer=[]}record(h){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:h})}_drainInertiaBuffer(){const h=this._inertiaBuffer,_=i.exported.now();for(;h.length>0&&_-h[0].time>160;)h.shift()}_onMoveEnd(h){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const _={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)_.zoom+=O.zoomDelta||0,_.bearing+=O.bearingDelta||0,_.pitch+=O.pitchDelta||0,O.panDelta&&_.pan._add(O.panDelta),O.around&&(_.around=O.around),O.pinchAround&&(_.pinchAround=O.pinchAround);const T=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,F={};if(_.pan.mag()){const O=Jc(_.pan.mag(),T,i.extend({},bu,h||{}));F.offset=_.pan.mult(O.amount/_.pan.mag()),F.center=this._map.transform.center,zh(F,O)}if(_.zoom){const O=Jc(_.zoom,T,id);F.zoom=this._map.transform.zoom+O.amount,zh(F,O)}if(_.bearing){const O=Jc(_.bearing,T,pc);F.bearing=this._map.transform.bearing+i.clamp(O.amount,-179,179),zh(F,O)}if(_.pitch){const O=Jc(_.pitch,T,fc);F.pitch=this._map.transform.pitch+O.amount,zh(F,O)}if(F.zoom||F.bearing){const O=_.pinchAround===void 0?_.around:_.pinchAround;F.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),i.extend(F,{noMoveStart:!0})}}function zh(M,h){(!M.duration||M.duration<h.duration)&&(M.duration=h.duration,M.easing=h.easing)}function Jc(M,h,_){const{maxSpeed:T,linearity:F,deceleration:O}=_,K=i.clamp(M*F/(h/1e3),-T,T),oe=Math.abs(K)/(O*F);return{easing:_.easing,duration:1e3*oe,amount:K*(oe/2)}}class So extends i.Event{constructor(h,_,T,F={}){const O=z.mousePos(_.getCanvasContainer(),T),K=_.unproject(O);super(h,i.extend({point:O,lngLat:K,originalEvent:T},F)),this._defaultPrevented=!1,this.target=_}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class xa extends i.Event{constructor(h,_,T){const F=h==="touchend"?T.changedTouches:T.touches,O=z.touchPos(_.getCanvasContainer(),F),K=O.map(ue=>_.unproject(ue)),oe=O.reduce((ue,ve,Te,ze)=>ue.add(ve.div(ze.length)),new i.pointGeometry(0,0));super(h,{points:O,point:oe,lngLats:K,lngLat:_.unproject(oe),originalEvent:T}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Mo extends i.Event{constructor(h,_,T){super(h,{originalEvent:T}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class nd{constructor(h,_){this._map=h,this._clickTolerance=_.clickTolerance}reset(){delete this._mousedownPos}wheel(h){return this._firePreventable(new Mo(h.type,this._map,h))}mousedown(h,_){return this._mousedownPos=_,this._firePreventable(new So(h.type,this._map,h))}mouseup(h){this._map.fire(new So(h.type,this._map,h))}click(h,_){this._mousedownPos&&this._mousedownPos.dist(_)>=this._clickTolerance||this._map.fire(new So(h.type,this._map,h))}dblclick(h){return this._firePreventable(new So(h.type,this._map,h))}mouseover(h){this._map.fire(new So(h.type,this._map,h))}mouseout(h){this._map.fire(new So(h.type,this._map,h))}touchstart(h){return this._firePreventable(new xa(h.type,this._map,h))}touchmove(h){this._map.fire(new xa(h.type,this._map,h))}touchend(h){this._map.fire(new xa(h.type,this._map,h))}touchcancel(h){this._map.fire(new xa(h.type,this._map,h))}_firePreventable(h){if(this._map.fire(h),h.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ha{constructor(h){this._map=h}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(h){this._map.fire(new So(h.type,this._map,h))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new So("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(h){this._delayContextMenu?this._contextMenuEvent=h:this._ignoreContextMenu||this._map.fire(new So(h.type,this._map,h)),this._map.listens("contextmenu")&&h.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rd{constructor(h,_){this._map=h,this._el=h.getCanvasContainer(),this._container=h.getContainer(),this._clickTolerance=_.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(h,_){this.isEnabled()&&h.shiftKey&&h.button===0&&(z.disableDrag(),this._startPos=this._lastPos=_,this._active=!0)}mousemoveWindow(h,_){if(!this._active)return;const T=_;if(this._lastPos.equals(T)||!this._box&&T.dist(this._startPos)<this._clickTolerance)return;const F=this._startPos;this._lastPos=T,this._box||(this._box=z.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",h));const O=Math.min(F.x,T.x),K=Math.max(F.x,T.x),oe=Math.min(F.y,T.y),ue=Math.max(F.y,T.y);z.setTransform(this._box,`translate(${O}px,${oe}px)`),this._box.style.width=K-O+"px",this._box.style.height=ue-oe+"px"}mouseupWindow(h,_){if(!this._active||h.button!==0)return;const T=this._startPos,F=_;if(this.reset(),z.suppressClick(),T.x!==F.x||T.y!==F.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:h})),{cameraAnimation:O=>O.fitScreenCoordinates(T,F,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",h)}keydown(h){this._active&&h.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",h))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(z.remove(this._box),this._box=null),z.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(h,_){return this._map.fire(new i.Event(h,{originalEvent:_}))}}function ml(M,h){if(M.length!==h.length)throw new Error(`The number of touches and points are not equal - touches ${M.length}, points ${h.length}`);const _={};for(let T=0;T<M.length;T++)_[M[T].identifier]=h[T];return _}class kh{constructor(h){this.reset(),this.numTouches=h.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(h,_,T){(this.centroid||T.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=h.timeStamp),T.length===this.numTouches&&(this.centroid=function(F){const O=new i.pointGeometry(0,0);for(const K of F)O._add(K);return O.div(F.length)}(_),this.touches=ml(T,_)))}touchmove(h,_,T){if(this.aborted||!this.centroid)return;const F=ml(T,_);for(const O in this.touches){const K=this.touches[O],oe=F[O];(!oe||oe.dist(K)>30)&&(this.aborted=!0)}}touchend(h,_,T){if((!this.centroid||h.timeStamp-this.startTime>500)&&(this.aborted=!0),T.length===0){const F=!this.aborted&&this.centroid;if(this.reset(),F)return F}}}class Oh{constructor(h){this.singleTap=new kh(h),this.numTaps=h.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(h,_,T){this.singleTap.touchstart(h,_,T)}touchmove(h,_,T){this.singleTap.touchmove(h,_,T)}touchend(h,_,T){const F=this.singleTap.touchend(h,_,T);if(F){const O=h.timeStamp-this.lastTime<500,K=!this.lastTap||this.lastTap.dist(F)<30;if(O&&K||this.reset(),this.count++,this.lastTime=h.timeStamp,this.lastTap=F,this.count===this.numTaps)return this.reset(),F}}}class lA{constructor(){this._zoomIn=new Oh({numTouches:1,numTaps:2}),this._zoomOut=new Oh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(h,_,T){this._zoomIn.touchstart(h,_,T),this._zoomOut.touchstart(h,_,T)}touchmove(h,_,T){this._zoomIn.touchmove(h,_,T),this._zoomOut.touchmove(h,_,T)}touchend(h,_,T){const F=this._zoomIn.touchend(h,_,T),O=this._zoomOut.touchend(h,_,T);return F?(this._active=!0,h.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:K=>K.easeTo({duration:300,zoom:K.getZoom()+1,around:K.unproject(F)},{originalEvent:h})}):O?(this._active=!0,h.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:K=>K.easeTo({duration:300,zoom:K.getZoom()-1,around:K.unproject(O)},{originalEvent:h})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const sd={0:1,2:2};class Nh{constructor(h){this.reset(),this._clickTolerance=h.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(h,_){return!1}_move(h,_){return{}}mousedown(h,_){if(this._lastPoint)return;const T=z.mouseButton(h);this._correctButton(h,T)&&(this._lastPoint=_,this._eventButton=T)}mousemoveWindow(h,_){const T=this._lastPoint;if(T){if(h.preventDefault(),function(F,O){const K=sd[O];return F.buttons===void 0||(F.buttons&K)!==K}(h,this._eventButton))this.reset();else if(this._moved||!(_.dist(T)<this._clickTolerance))return this._moved=!0,this._lastPoint=_,this._move(T,_)}}mouseupWindow(h){this._lastPoint&&z.mouseButton(h)===this._eventButton&&(this._moved&&z.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mc extends Nh{mousedown(h,_){super.mousedown(h,_),this._lastPoint&&(this._active=!0)}_correctButton(h,_){return _===0&&!h.ctrlKey}_move(h,_){return{around:_,panDelta:_.sub(h)}}}class ha extends Nh{_correctButton(h,_){return _===0&&h.ctrlKey||_===2}_move(h,_){const T=.8*(_.x-h.x);if(T)return this._active=!0,{bearingDelta:T}}contextmenu(h){h.preventDefault()}}class pn extends Nh{_correctButton(h,_){return _===0&&h.ctrlKey||_===2}_move(h,_){const T=-.5*(_.y-h.y);if(T)return this._active=!0,{pitchDelta:T}}contextmenu(h){h.preventDefault()}}class eh{constructor(h,_){this._minTouches=h.cooperativeGestures?2:1,this._clickTolerance=h.clickTolerance||1,this._map=_,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(h,_,T){return this._calculateTransform(h,_,T)}touchmove(h,_,T){if(this._map._cooperativeGestures&&(this._minTouches===2&&T.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(h,!1,T.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(T.length<this._minTouches))return h.preventDefault(),this._calculateTransform(h,_,T)}touchend(h,_,T){this._calculateTransform(h,_,T),this._active&&T.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(h,_,T){T.length>0&&(this._active=!0);const F=ml(T,_),O=new i.pointGeometry(0,0),K=new i.pointGeometry(0,0);let oe=0;for(const ve in F){const Te=F[ve],ze=this._touches[ve];ze&&(O._add(Te),K._add(Te.sub(ze)),oe++,F[ve]=Te)}if(this._touches=F,oe<this._minTouches||!K.mag())return;const ue=K.div(oe);return this._sum._add(ue),this._sum.mag()<this._clickTolerance?void 0:{around:O.div(oe),panDelta:ue}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wl{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(h){}_move(h,_,T){return{}}touchstart(h,_,T){this._firstTwoTouches||T.length<2||(this._firstTwoTouches=[T[0].identifier,T[1].identifier],this._start([_[0],_[1]]))}touchmove(h,_,T){if(!this._firstTwoTouches)return;h.preventDefault();const[F,O]=this._firstTwoTouches,K=Os(T,_,F),oe=Os(T,_,O);if(!K||!oe)return;const ue=this._aroundCenter?null:K.add(oe).div(2);return this._move([K,oe],ue,h)}touchend(h,_,T){if(!this._firstTwoTouches)return;const[F,O]=this._firstTwoTouches,K=Os(T,_,F),oe=Os(T,_,O);K&&oe||(this._active&&z.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(h){this._enabled=!0,this._aroundCenter=!!h&&h.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Os(M,h,_){for(let T=0;T<M.length;T++)if(M[T].identifier===_)return h[T]}function gl(M,h){return Math.log(M/h)/Math.LN2}class un extends Wl{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(h){this._startDistance=this._distance=h[0].dist(h[1])}_move(h,_){const T=this._distance;if(this._distance=h[0].dist(h[1]),this._active||!(Math.abs(gl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:gl(this._distance,T),pinchAround:_}}}function th(M,h){return 180*M.angleWith(h)/Math.PI}class Ur extends Wl{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(h){this._startVector=this._vector=h[0].sub(h[1]),this._minDiameter=h[0].dist(h[1])}_move(h,_){const T=this._vector;if(this._vector=h[0].sub(h[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:th(this._vector,T),pinchAround:_}}_isBelowThreshold(h){this._minDiameter=Math.min(this._minDiameter,h.mag());const _=25/(Math.PI*this._minDiameter)*360,T=th(h,this._startVector);return Math.abs(T)<_}}function gc(M){return Math.abs(M.y)>Math.abs(M.x)}class cA extends Wl{constructor(h){super(),this._map=h}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(h,_,T){super.touchstart(h,_,T),this._currentTouchCount=T.length}_start(h){this._lastPoints=h,gc(h[0].sub(h[1]))&&(this._valid=!1)}_move(h,_,T){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const F=h[0].sub(this._lastPoints[0]),O=h[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(F,O,T.timeStamp),this._valid?(this._lastPoints=h,this._active=!0,{pitchDelta:(F.y+O.y)/2*-.5}):void 0}gestureBeginsVertically(h,_,T){if(this._valid!==void 0)return this._valid;const F=h.mag()>=2,O=_.mag()>=2;if(!F&&!O)return;if(!F||!O)return this._firstMove===void 0&&(this._firstMove=T),T-this._firstMove<100&&void 0;const K=h.y>0==_.y>0;return gc(h)&&gc(_)&&K}}const Qh={panStep:100,bearingStep:15,pitchStep:10};class _c{constructor(){const h=Qh;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(h){if(h.altKey||h.ctrlKey||h.metaKey)return;let _=0,T=0,F=0,O=0,K=0;switch(h.keyCode){case 61:case 107:case 171:case 187:_=1;break;case 189:case 109:case 173:_=-1;break;case 37:h.shiftKey?T=-1:(h.preventDefault(),O=-1);break;case 39:h.shiftKey?T=1:(h.preventDefault(),O=1);break;case 38:h.shiftKey?F=1:(h.preventDefault(),K=-1);break;case 40:h.shiftKey?F=-1:(h.preventDefault(),K=1);break;default:return}return this._rotationDisabled&&(T=0,F=0),{cameraAnimation:oe=>{const ue=oe.getZoom();oe.easeTo({duration:300,easeId:"keyboardHandler",easing:hA,zoom:_?Math.round(ue)+_*(h.shiftKey?2:1):ue,bearing:oe.getBearing()+T*this._bearingStep,pitch:oe.getPitch()+F*this._pitchStep,offset:[-O*this._panStep,-K*this._panStep],center:oe.getCenter()},{originalEvent:h})}}}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 hA(M){return M*(2-M)}const uA=4.000244140625;class Vh{constructor(h,_){this._map=h,this._el=h.getCanvasContainer(),this._handler=_,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout"],this)}setZoomRate(h){this._defaultZoomRate=h}setWheelZoomRate(h){this._wheelZoomRate=h}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(h){this.isEnabled()||(this._enabled=!0,this._aroundCenter=h&&h.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(h){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;h.preventDefault()}let _=h.deltaMode===WheelEvent.DOM_DELTA_LINE?40*h.deltaY:h.deltaY;const T=i.exported.now(),F=T-(this._lastWheelEventTime||0);this._lastWheelEventTime=T,_!==0&&_%uA==0?this._type="wheel":_!==0&&Math.abs(_)<4?this._type="trackpad":F>400?(this._type=null,this._lastValue=_,this._timeout=setTimeout(this._onTimeout,40,h)):this._type||(this._type=Math.abs(F*_)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,_+=this._lastValue)),h.shiftKey&&_&&(_/=4),this._type&&(this._lastWheelEvent=h,this._delta-=_,this._active||this._start(h)),h.preventDefault()}_onTimeout(h){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(h)}_start(h){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const _=z.mousePos(this._el,h);this._around=i.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(_)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const h=this._map.transform;if(this._delta!==0){const oe=this._type==="wheel"&&Math.abs(this._delta)>uA?this._wheelZoomRate:this._defaultZoomRate;let ue=2/(1+Math.exp(-Math.abs(this._delta*oe)));this._delta<0&&ue!==0&&(ue=1/ue);const ve=typeof this._targetZoom=="number"?h.zoomScale(this._targetZoom):h.scale;this._targetZoom=Math.min(h.maxZoom,Math.max(h.minZoom,h.scaleZoom(ve*ue))),this._type==="wheel"&&(this._startZoom=h.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const _=typeof this._targetZoom=="number"?this._targetZoom:h.zoom,T=this._startZoom,F=this._easing;let O,K=!1;if(this._type==="wheel"&&T&&F){const oe=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),ue=F(oe);O=i.number(T,_,ue),oe<1?this._frameId||(this._frameId=!0):K=!0}else O=_,K=!0;return this._active=!0,K&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!K,zoomDelta:O-h.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(h){let _=i.ease;if(this._prevEase){const T=this._prevEase,F=(i.exported.now()-T.start)/T.duration,O=T.easing(F+.01)-T.easing(F),K=.27/Math.sqrt(O*O+1e-4)*.01,oe=Math.sqrt(.0729-K*K);_=i.bezier(K,oe,.25,1)}return this._prevEase={start:i.exported.now(),duration:h,easing:_},_}reset(){this._active=!1}}class Hh{constructor(h,_){this._clickZoom=h,this._tapZoom=_}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 ih{constructor(){this.reset()}reset(){this._active=!1}dblclick(h,_){return h.preventDefault(),{cameraAnimation:T=>{T.easeTo({duration:300,zoom:T.getZoom()+(h.shiftKey?-1:1),around:T.unproject(_)},{originalEvent:h})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yc{constructor(){this._tap=new Oh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(h,_,T){this._swipePoint||(this._tapTime&&h.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?T.length>0&&(this._swipePoint=_[0],this._swipeTouch=T[0].identifier):this._tap.touchstart(h,_,T))}touchmove(h,_,T){if(this._tapTime){if(this._swipePoint){if(T[0].identifier!==this._swipeTouch)return;const F=_[0],O=F.y-this._swipePoint.y;return this._swipePoint=F,h.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(h,_,T)}touchend(h,_,T){this._tapTime?this._swipePoint&&T.length===0&&this.reset():this._tap.touchend(h,_,T)&&(this._tapTime=h.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ms{constructor(h,_,T){this._el=h,this._mousePan=_,this._touchPan=T}enable(h){this._inertiaOptions=h||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class fo{constructor(h,_,T){this._pitchWithRotate=h.pitchWithRotate,this._mouseRotate=_,this._mousePitch=T}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Gh{constructor(h,_,T,F){this._el=h,this._touchZoom=_,this._touchRotate=T,this._tapDragZoom=F,this._rotationDisabled=!1,this._enabled=!0}enable(h){this._touchZoom.enable(h),this._rotationDisabled||this._touchRotate.enable(h),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const jl=M=>M.zoom||M.drag||M.pitch||M.rotate;class Kl extends i.Event{}function _l(M){return M.panDelta&&M.panDelta.mag()||M.zoomDelta||M.bearingDelta||M.pitchDelta}class An{constructor(h,_){this._map=h,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Yc(h),this._bearingSnap=_.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(_),i.bindAll(["handleEvent","handleWindowEvent"],this);const T=this._el;this._listeners=[[T,"touchstart",{passive:!0}],[T,"touchmove",{passive:!1}],[T,"touchend",void 0],[T,"touchcancel",void 0],[T,"mousedown",void 0],[T,"mousemove",void 0],[T,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[T,"mouseover",void 0],[T,"mouseout",void 0],[T,"dblclick",void 0],[T,"click",void 0],[T,"keydown",{capture:!1}],[T,"keyup",void 0],[T,"wheel",{passive:!1}],[T,"contextmenu",void 0],[window,"blur",void 0]];for(const[F,O,K]of this._listeners)z.addEventListener(F,O,F===document?this.handleWindowEvent:this.handleEvent,K)}destroy(){for(const[h,_,T]of this._listeners)z.removeEventListener(h,_,h===document?this.handleWindowEvent:this.handleEvent,T)}_addDefaultHandlers(h){const _=this._map,T=_.getCanvasContainer();this._add("mapEvent",new nd(_,h));const F=_.boxZoom=new rd(_,h);this._add("boxZoom",F);const O=new lA,K=new ih;_.doubleClickZoom=new Hh(K,O),this._add("tapZoom",O),this._add("clickZoom",K);const oe=new yc;this._add("tapDragZoom",oe);const ue=_.touchPitch=new cA(_);this._add("touchPitch",ue);const ve=new ha(h),Te=new pn(h);_.dragRotate=new fo(h,ve,Te),this._add("mouseRotate",ve,["mousePitch"]),this._add("mousePitch",Te,["mouseRotate"]);const ze=new mc(h),je=new eh(h,_);_.dragPan=new Ms(T,ze,je),this._add("mousePan",ze),this._add("touchPan",je,["touchZoom","touchRotate"]);const bt=new Ur,mt=new un;_.touchZoomRotate=new Gh(T,mt,bt,oe),this._add("touchRotate",bt,["touchPan","touchZoom"]),this._add("touchZoom",mt,["touchPan","touchRotate"]);const gt=_.scrollZoom=new Vh(_,this);this._add("scrollZoom",gt,["mousePan"]);const Vt=_.keyboard=new _c;this._add("keyboard",Vt),this._add("blockableMapEvent",new Ha(_));for(const Zt of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])h.interactive&&h[Zt]&&_[Zt].enable(h[Zt])}_add(h,_,T){this._handlers.push({handlerName:h,handler:_,allowed:T}),this._handlersById[h]=_}stop(h){if(!this._updatingCamera){for(const{handler:_}of this._handlers)_.reset();this._inertia.clear(),this._fireEvents({},{},h),this._changes=[]}}isActive(){for(const{handler:h}of this._handlers)if(h.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(jl(this._eventsInProgress))||this.isZooming()}_blockedByActive(h,_,T){for(const F in h)if(F!==T&&(!_||_.indexOf(F)<0))return!0;return!1}handleWindowEvent(h){this.handleEvent(h,`${h.type}Window`)}_getMapTouches(h){const _=[];for(const T of h)this._el.contains(T.target)&&_.push(T);return _}handleEvent(h,_){if(h.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const T=h.type==="renderFrame"?void 0:h,F={needsRenderFrame:!1},O={},K={},oe=h.touches,ue=oe?this._getMapTouches(oe):void 0,ve=ue?z.touchPos(this._el,ue):z.mousePos(this._el,h);for(const{handlerName:je,handler:bt,allowed:mt}of this._handlers){if(!bt.isEnabled())continue;let gt;this._blockedByActive(K,mt,je)?bt.reset():bt[_||h.type]&&(gt=bt[_||h.type](h,ve,ue),this.mergeHandlerResult(F,O,gt,je,T),gt&&gt.needsRenderFrame&&this._triggerRenderFrame()),(gt||bt.isActive())&&(K[je]=bt)}const Te={};for(const je in this._previousActiveHandlers)K[je]||(Te[je]=T);this._previousActiveHandlers=K,(Object.keys(Te).length||_l(F))&&(this._changes.push([F,O,Te]),this._triggerRenderFrame()),(Object.keys(K).length||_l(F))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ze}=F;ze&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ze(this._map))}mergeHandlerResult(h,_,T,F,O){if(!T)return;i.extend(h,T);const K={handlerName:F,originalEvent:T.originalEvent||O};T.zoomDelta!==void 0&&(_.zoom=K),T.panDelta!==void 0&&(_.drag=K),T.pitchDelta!==void 0&&(_.pitch=K),T.bearingDelta!==void 0&&(_.rotate=K)}_applyChanges(){const h={},_={},T={};for(const[F,O,K]of this._changes)F.panDelta&&(h.panDelta=(h.panDelta||new i.pointGeometry(0,0))._add(F.panDelta)),F.zoomDelta&&(h.zoomDelta=(h.zoomDelta||0)+F.zoomDelta),F.bearingDelta&&(h.bearingDelta=(h.bearingDelta||0)+F.bearingDelta),F.pitchDelta&&(h.pitchDelta=(h.pitchDelta||0)+F.pitchDelta),F.around!==void 0&&(h.around=F.around),F.pinchAround!==void 0&&(h.pinchAround=F.pinchAround),F.noInertia&&(h.noInertia=F.noInertia),i.extend(_,O),i.extend(T,K);this._updateMapTransform(h,_,T),this._changes=[]}_updateMapTransform(h,_,T){const F=this._map,O=F.transform,K=F.style&&F.style.terrain;if(!(_l(h)||K&&this._drag))return this._fireEvents(_,T,!0);let{panDelta:oe,zoomDelta:ue,bearingDelta:ve,pitchDelta:Te,around:ze,pinchAround:je}=h;je!==void 0&&(ze=je),F._stop(!0),ze=ze||F.transform.centerPoint;const bt=O.pointLocation(oe?ze.sub(oe):ze);ve&&(O.bearing+=ve),Te&&(O.pitch+=Te),ue&&(O.zoom+=ue),K?_.drag&&!this._drag?(this._drag={center:O.centerPoint,lngLat:O.pointLocation(ze),point:ze,handlerName:_.drag.handlerName},F.fire(new i.Event("freezeElevation",{freeze:!0}))):this._drag&&T[this._drag.handlerName]?(F.fire(new i.Event("freezeElevation",{freeze:!1})),this._drag=null):_.drag&&this._drag&&(O.center=O.pointLocation(O.centerPoint.sub(oe))):O.setLocationAtPoint(bt,ze),this._map._update(),h.noInertia||this._inertia.record(h),this._fireEvents(_,T,!0)}_fireEvents(h,_,T){const F=jl(this._eventsInProgress),O=jl(h),K={};for(const Te in h){const{originalEvent:ze}=h[Te];this._eventsInProgress[Te]||(K[`${Te}start`]=ze),this._eventsInProgress[Te]=h[Te]}!F&&O&&this._fireEvent("movestart",O.originalEvent);for(const Te in K)this._fireEvent(Te,K[Te]);O&&this._fireEvent("move",O.originalEvent);for(const Te in h){const{originalEvent:ze}=h[Te];this._fireEvent(Te,ze)}const oe={};let ue;for(const Te in this._eventsInProgress){const{handlerName:ze,originalEvent:je}=this._eventsInProgress[Te];this._handlersById[ze].isActive()||(delete this._eventsInProgress[Te],ue=_[ze]||je,oe[`${Te}end`]=ue)}for(const Te in oe)this._fireEvent(Te,oe[Te]);const ve=jl(this._eventsInProgress);if(T&&(F||O)&&!ve){this._updatingCamera=!0;const Te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ze=je=>je!==0&&-this._bearingSnap<je&&je<this._bearingSnap;Te?(ze(Te.bearing||this._map.getBearing())&&(Te.bearing=0),this._map.easeTo(Te,{originalEvent:ue})):(this._map.fire(new i.Event("moveend",{originalEvent:ue})),ze(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(h,_){this._map.fire(new i.Event(h,_?{originalEvent:_}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(h=>{delete this._frameId,this.handleEvent(new Kl("renderFrame",{timeStamp:h})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const xs={extend:(M,...h)=>i.extend(M,...h),run(M){M()},logToElement(M,h=!1,_="log"){const T=window.document.getElementById(_);T&&(h&&(T.innerHTML=""),T.innerHTML+=`<br>${M}`)}};class Zr extends i.Evented{constructor(h,_){super(),this._moving=!1,this._zooming=!1,this.transform=h,this._bearingSnap=_.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(h,_){return this.jumpTo({center:h},_)}panBy(h,_,T){return h=i.pointGeometry.convert(h).mult(-1),this.panTo(this.transform.center,i.extend({offset:h},_),T)}panTo(h,_,T){return this.easeTo(i.extend({center:h},_),T)}getZoom(){return this.transform.zoom}setZoom(h,_){return this.jumpTo({zoom:h},_),this}zoomTo(h,_,T){return this.easeTo(i.extend({zoom:h},_),T)}zoomIn(h,_){return this.zoomTo(this.getZoom()+1,h,_),this}zoomOut(h,_){return this.zoomTo(this.getZoom()-1,h,_),this}getBearing(){return this.transform.bearing}setBearing(h,_){return this.jumpTo({bearing:h},_),this}getPadding(){return this.transform.padding}setPadding(h,_){return this.jumpTo({padding:h},_),this}rotateTo(h,_,T){return this.easeTo(i.extend({bearing:h},_),T)}resetNorth(h,_){return this.rotateTo(0,i.extend({duration:1e3},h),_),this}resetNorthPitch(h,_){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},h),_),this}snapToNorth(h,_){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(h,_):this}getPitch(){return this.transform.pitch}setPitch(h,_){return this.jumpTo({pitch:h},_),this}cameraForBounds(h,_){h=i.LngLatBounds.convert(h);const T=_&&_.bearing||0;return this._cameraForBoxAndBearing(h.getNorthWest(),h.getSouthEast(),T,_)}_cameraForBoxAndBearing(h,_,T,F){const O={top:0,bottom:0,right:0,left:0};if(typeof(F=i.extend({padding:O,offset:[0,0],maxZoom:this.transform.maxZoom},F)).padding=="number"){const ai=F.padding;F.padding={top:ai,bottom:ai,right:ai,left:ai}}F.padding=i.extend(O,F.padding);const K=this.transform,oe=K.padding,ue=K.project(i.LngLat.convert(h)),ve=K.project(i.LngLat.convert(_)),Te=ue.rotate(-T*Math.PI/180),ze=ve.rotate(-T*Math.PI/180),je=new i.pointGeometry(Math.max(Te.x,ze.x),Math.max(Te.y,ze.y)),bt=new i.pointGeometry(Math.min(Te.x,ze.x),Math.min(Te.y,ze.y)),mt=je.sub(bt),gt=(K.width-(oe.left+oe.right+F.padding.left+F.padding.right))/mt.x,Vt=(K.height-(oe.top+oe.bottom+F.padding.top+F.padding.bottom))/mt.y;if(Vt<0||gt<0)return void i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Zt=Math.min(K.scaleZoom(K.scale*Math.min(gt,Vt)),F.maxZoom),ni=i.pointGeometry.convert(F.offset),St=new i.pointGeometry((F.padding.left-F.padding.right)/2,(F.padding.top-F.padding.bottom)/2).rotate(T*Math.PI/180),zt=ni.add(St).mult(K.scale/K.zoomScale(Zt));return{center:K.unproject(ue.add(ve).div(2).sub(zt)),zoom:Zt,bearing:T}}fitBounds(h,_,T){return this._fitInternal(this.cameraForBounds(h,_),_,T)}fitScreenCoordinates(h,_,T,F,O){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.pointGeometry.convert(h)),this.transform.pointLocation(i.pointGeometry.convert(_)),T,F),F,O)}_fitInternal(h,_,T){return h?(delete(_=i.extend(h,_)).padding,_.linear?this.easeTo(_,T):this.flyTo(_,T)):this}jumpTo(h,_){this.stop();const T=this.transform;let F=!1,O=!1,K=!1;return"zoom"in h&&T.zoom!==+h.zoom&&(F=!0,T.zoom=+h.zoom),h.center!==void 0&&(T.center=i.LngLat.convert(h.center)),"bearing"in h&&T.bearing!==+h.bearing&&(O=!0,T.bearing=+h.bearing),"pitch"in h&&T.pitch!==+h.pitch&&(K=!0,T.pitch=+h.pitch),h.padding==null||T.isPaddingEqual(h.padding)||(T.padding=h.padding),this.fire(new i.Event("movestart",_)).fire(new i.Event("move",_)),F&&this.fire(new i.Event("zoomstart",_)).fire(new i.Event("zoom",_)).fire(new i.Event("zoomend",_)),O&&this.fire(new i.Event("rotatestart",_)).fire(new i.Event("rotate",_)).fire(new i.Event("rotateend",_)),K&&this.fire(new i.Event("pitchstart",_)).fire(new i.Event("pitch",_)).fire(new i.Event("pitchend",_)),this.fire(new i.Event("moveend",_))}calculateCameraOptionsFromTo(h,_,T,F=0){const O=i.MercatorCoordinate.fromLngLat(h,_),K=i.MercatorCoordinate.fromLngLat(T,F),oe=K.x-O.x,ue=K.y-O.y,ve=K.z-O.z,Te=Math.hypot(oe,ue,ve);if(Te===0)throw new Error("Can't calculate camera options with same From and To");const ze=Math.hypot(oe,ue),je=this.transform.scaleZoom(this.transform.cameraToCenterDistance/Te/this.transform.tileSize),bt=180*Math.atan2(oe,-ue)/Math.PI;let mt=180*Math.acos(ze/Te)/Math.PI;return mt=ve<0?90-mt:90+mt,{center:K.toLngLat(),zoom:je,pitch:mt,bearing:bt}}easeTo(h,_){this._stop(!1,h.easeId),((h=i.extend({offset:[0,0],duration:500,easing:i.ease},h)).animate===!1||!h.essential&&i.exported.prefersReducedMotion)&&(h.duration=0);const T=this.transform,F=this.getZoom(),O=this.getBearing(),K=this.getPitch(),oe=this.getPadding(),ue="zoom"in h?+h.zoom:F,ve="bearing"in h?this._normalizeBearing(h.bearing,O):O,Te="pitch"in h?+h.pitch:K,ze="padding"in h?h.padding:T.padding,je=i.pointGeometry.convert(h.offset);let bt=T.centerPoint.add(je);const mt=T.pointLocation(bt),gt=i.LngLat.convert(h.center||mt);this._normalizeCenter(gt);const Vt=T.project(mt),Zt=T.project(gt).sub(Vt),ni=T.zoomScale(ue-F);let St,zt;h.around&&(St=i.LngLat.convert(h.around),zt=T.locationPoint(St));const ai={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ue!==F,this._rotating=this._rotating||O!==ve,this._pitching=this._pitching||Te!==K,this._padding=!T.isPaddingEqual(ze),this._easeId=h.easeId,this._prepareEase(_,h.noMoveStart,ai),this._ease(Ei=>{if(this._zooming&&(T.zoom=i.number(F,ue,Ei)),this._rotating&&(T.bearing=i.number(O,ve,Ei)),this._pitching&&(T.pitch=i.number(K,Te,Ei)),this._padding&&(T.interpolatePadding(oe,ze,Ei),bt=T.centerPoint.add(je)),St)T.setLocationAtPoint(St,zt);else{const Bi=T.zoomScale(T.zoom-F),Hi=ue>F?Math.min(2,ni):Math.max(.5,ni),vi=Math.pow(Hi,1-Ei),xn=T.unproject(Vt.add(Zt.mult(Ei*vi)).mult(Bi));T.setLocationAtPoint(T.renderWorldCopies?xn.wrap():xn,bt)}this._fireMoveEvents(_)},Ei=>{this._afterEase(_,Ei)},h),this}_prepareEase(h,_,T={}){this._moving=!0,this.fire(new i.Event("freezeElevation",{freeze:!0})),_||T.moving||this.fire(new i.Event("movestart",h)),this._zooming&&!T.zooming&&this.fire(new i.Event("zoomstart",h)),this._rotating&&!T.rotating&&this.fire(new i.Event("rotatestart",h)),this._pitching&&!T.pitching&&this.fire(new i.Event("pitchstart",h))}_fireMoveEvents(h){this.fire(new i.Event("move",h)),this._zooming&&this.fire(new i.Event("zoom",h)),this._rotating&&this.fire(new i.Event("rotate",h)),this._pitching&&this.fire(new i.Event("pitch",h))}_afterEase(h,_){if(this._easeId&&_&&this._easeId===_)return;delete this._easeId,this.fire(new i.Event("freezeElevation",{freeze:!1}));const T=this._zooming,F=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,T&&this.fire(new i.Event("zoomend",h)),F&&this.fire(new i.Event("rotateend",h)),O&&this.fire(new i.Event("pitchend",h)),this.fire(new i.Event("moveend",h))}flyTo(h,_){if(!h.essential&&i.exported.prefersReducedMotion){const Un=i.pick(h,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Un,_)}this.stop(),h=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},h);const T=this.transform,F=this.getZoom(),O=this.getBearing(),K=this.getPitch(),oe=this.getPadding(),ue="zoom"in h?i.clamp(+h.zoom,T.minZoom,T.maxZoom):F,ve="bearing"in h?this._normalizeBearing(h.bearing,O):O,Te="pitch"in h?+h.pitch:K,ze="padding"in h?h.padding:T.padding,je=T.zoomScale(ue-F),bt=i.pointGeometry.convert(h.offset);let mt=T.centerPoint.add(bt);const gt=T.pointLocation(mt),Vt=i.LngLat.convert(h.center||gt);this._normalizeCenter(Vt);const Zt=T.project(gt),ni=T.project(Vt).sub(Zt);let St=h.curve;const zt=Math.max(T.width,T.height),ai=zt/je,Ei=ni.mag();if("minZoom"in h){const Un=i.clamp(Math.min(h.minZoom,F,ue),T.minZoom,T.maxZoom),Lr=zt/T.zoomScale(Un-F);St=Math.sqrt(Lr/Ei*2)}const Bi=St*St;function Hi(Un){const Lr=(ai*ai-zt*zt+(Un?-1:1)*Bi*Bi*Ei*Ei)/(2*(Un?ai:zt)*Bi*Ei);return Math.log(Math.sqrt(Lr*Lr+1)-Lr)}function vi(Un){return(Math.exp(Un)-Math.exp(-Un))/2}function xn(Un){return(Math.exp(Un)+Math.exp(-Un))/2}const cn=Hi(0);let Bn=function(Un){return xn(cn)/xn(cn+St*Un)},tr=function(Un){return zt*((xn(cn)*(vi(Lr=cn+St*Un)/xn(Lr))-vi(cn))/Bi)/Ei;var Lr},ur=(Hi(1)-cn)/St;if(Math.abs(Ei)<1e-6||!isFinite(ur)){if(Math.abs(zt-ai)<1e-6)return this.easeTo(h,_);const Un=ai<zt?-1:1;ur=Math.abs(Math.log(ai/zt))/St,tr=function(){return 0},Bn=function(Lr){return Math.exp(Un*St*Lr)}}return h.duration="duration"in h?+h.duration:1e3*ur/("screenSpeed"in h?+h.screenSpeed/St:+h.speed),h.maxDuration&&h.duration>h.maxDuration&&(h.duration=0),this._zooming=!0,this._rotating=O!==ve,this._pitching=Te!==K,this._padding=!T.isPaddingEqual(ze),this._prepareEase(_,!1),this._ease(Un=>{const Lr=Un*ur,Rr=1/Bn(Lr);T.zoom=Un===1?ue:F+T.scaleZoom(Rr),this._rotating&&(T.bearing=i.number(O,ve,Un)),this._pitching&&(T.pitch=i.number(K,Te,Un)),this._padding&&(T.interpolatePadding(oe,ze,Un),mt=T.centerPoint.add(bt));const Cr=Un===1?Vt:T.unproject(Zt.add(ni.mult(tr(Lr))).mult(Rr));T.setLocationAtPoint(T.renderWorldCopies?Cr.wrap():Cr,mt),this._fireMoveEvents(_)},()=>this._afterEase(_),h),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(h,_){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const T=this._onEaseEnd;delete this._onEaseEnd,T.call(this,_)}if(!h){const T=this.handlers;T&&T.stop(!1)}return this}_ease(h,_,T){T.animate===!1||T.duration===0?(h(1),_()):(this._easeStart=i.exported.now(),this._easeOptions=T,this._onEaseFrame=h,this._onEaseEnd=_,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const h=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(h)),h<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(h,_){h=i.wrap(h,-180,180);const T=Math.abs(h-_);return Math.abs(h-360-_)<T&&(h-=360),Math.abs(h+360-_)<T&&(h+=360),h}_normalizeCenter(h){const _=this.transform;if(!_.renderWorldCopies||_.lngRange)return;const T=h.lng-_.center.lng;h.lng+=T>180?-360:T<-180?360:0}}class nh{constructor(h={}){this.options=h,i.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(h){return this._map=h,this._compact=this.options&&this.options.compact,this._container=z.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=z.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=z.create("div","maplibregl-ctrl-attrib-inner mapboxgl-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(){z.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(h,_){const T=this._map._getUIString(`AttributionControl.${_}`);h.title=T,h.setAttribute("aria-label",T)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(h){!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let h=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?h=h.concat(this.options.customAttribution.map(F=>typeof F!="string"?"":F)):typeof this.options.customAttribution=="string"&&h.push(this.options.customAttribution)),this._map.style.stylesheet){const F=this._map.style.stylesheet;this.styleOwner=F.owner,this.styleId=F.id}const _=this._map.style.sourceCaches;for(const F in _){const O=_[F];if(O.used||O.usedForTerrain){const K=O.getSource();K.attribution&&h.indexOf(K.attribution)<0&&h.push(K.attribution)}}h=h.filter(F=>String(F).trim()),h.sort((F,O)=>F.length-O.length),h=h.filter((F,O)=>{for(let K=O+1;K<h.length;K++)if(h[K].indexOf(F)>=0)return!1;return!0});const T=h.join(" | ");T!==this._attribHTML&&(this._attribHTML=T,h.length?(this._innerContainer.innerHTML=T,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Wh{constructor(h={}){this.options=h,i.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(h){this._map=h,this._compact=this.options&&this.options.compact,this._container=z.create("div","maplibregl-ctrl mapboxgl-ctrl");const _=z.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return _.target="_blank",_.rel="noopener nofollow",_.href="https://maplibre.org/",_.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),_.setAttribute("rel","noopener nofollow"),this._container.appendChild(_),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){z.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const h=this._container.children;if(h.length){const _=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&_.classList.add("maplibregl-compact","mapboxgl-compact"):_.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class xc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(h){const _=++this._id;return this._queue.push({callback:h,id:_,cancelled:!1}),_}remove(h){const _=this._currentlyRunning,T=_?this._queue.concat(_):this._queue;for(const F of T)if(F.id===h)return void(F.cancelled=!0)}run(h=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const _=this._currentlyRunning=this._queue;this._queue=[];for(const T of _)if(!T.cancelled&&(T.callback(h),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const AA={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},jh={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},rh={showCompass:!0,showZoom:!0,visualizePitch:!1};class uo{constructor(h,_,T=!1){this._clickTolerance=10,this.element=_,this.mouseRotate=new ha({clickTolerance:h.dragRotate._mouseRotate._clickTolerance}),this.map=h,T&&(this.mousePitch=new pn({clickTolerance:h.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),z.addEventListener(_,"mousedown",this.mousedown),z.addEventListener(_,"touchstart",this.touchstart,{passive:!1}),z.addEventListener(_,"touchmove",this.touchmove),z.addEventListener(_,"touchend",this.touchend),z.addEventListener(_,"touchcancel",this.reset)}down(h,_){this.mouseRotate.mousedown(h,_),this.mousePitch&&this.mousePitch.mousedown(h,_),z.disableDrag()}move(h,_){const T=this.map,F=this.mouseRotate.mousemoveWindow(h,_);if(F&&F.bearingDelta&&T.setBearing(T.getBearing()+F.bearingDelta),this.mousePitch){const O=this.mousePitch.mousemoveWindow(h,_);O&&O.pitchDelta&&T.setPitch(T.getPitch()+O.pitchDelta)}}off(){const h=this.element;z.removeEventListener(h,"mousedown",this.mousedown),z.removeEventListener(h,"touchstart",this.touchstart,{passive:!1}),z.removeEventListener(h,"touchmove",this.touchmove),z.removeEventListener(h,"touchend",this.touchend),z.removeEventListener(h,"touchcancel",this.reset),this.offTemp()}offTemp(){z.enableDrag(),z.removeEventListener(window,"mousemove",this.mousemove),z.removeEventListener(window,"mouseup",this.mouseup)}mousedown(h){this.down(i.extend({},h,{ctrlKey:!0,preventDefault:()=>h.preventDefault()}),z.mousePos(this.element,h)),z.addEventListener(window,"mousemove",this.mousemove),z.addEventListener(window,"mouseup",this.mouseup)}mousemove(h){this.move(h,z.mousePos(this.element,h))}mouseup(h){this.mouseRotate.mouseupWindow(h),this.mousePitch&&this.mousePitch.mouseupWindow(h),this.offTemp()}touchstart(h){h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=z.touchPos(this.element,h.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>h.preventDefault()},this._startPos))}touchmove(h){h.targetTouches.length!==1?this.reset():(this._lastPos=z.touchPos(this.element,h.targetTouches)[0],this.move({preventDefault:()=>h.preventDefault()},this._lastPos))}touchend(h){h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Js(M,h,_){if(M=new i.LngLat(M.lng,M.lat),h){const T=new i.LngLat(M.lng-360,M.lat),F=new i.LngLat(M.lng+360,M.lat),O=_.locationPoint(M).distSqr(h);_.locationPoint(T).distSqr(h)<O?M=T:_.locationPoint(F).distSqr(h)<O&&(M=F)}for(;Math.abs(M.lng-_.center.lng)>180;){const T=_.locationPoint(M);if(T.x>=0&&T.y>=0&&T.x<=_.width&&T.y<=_.height)break;M.lng>_.center.lng?M.lng-=360:M.lng+=360}return M}const Fn={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 Vn(M,h,_){const T=M.classList;for(const F in Fn)T.remove(`maplibregl-${_}-anchor-${F}`,`mapboxgl-${_}-anchor-${F}`);T.add(`maplibregl-${_}-anchor-${h}`,`mapboxgl-${_}-anchor-${h}`)}class sh extends i.Evented{constructor(h,_){if(super(),(h instanceof HTMLElement||_)&&(h=i.extend({element:h},_)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=h&&h.anchor||"center",this._color=h&&h.color||"#3FB1CE",this._scale=h&&h.scale||1,this._draggable=h&&h.draggable||!1,this._clickTolerance=h&&h.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=h&&h.rotation||0,this._rotationAlignment=h&&h.rotationAlignment||"auto",this._pitchAlignment=h&&h.pitchAlignment&&h.pitchAlignment!=="auto"?h.pitchAlignment:this._rotationAlignment,h&&h.element)this._element=h.element,this._offset=i.pointGeometry.convert(h&&h.offset||[0,0]);else{this._defaultMarker=!0,this._element=z.create("div"),this._element.setAttribute("aria-label","Map marker");const T=z.createNS("http://www.w3.org/2000/svg","svg"),F=41,O=27;T.setAttributeNS(null,"display","block"),T.setAttributeNS(null,"height",`${F}px`),T.setAttributeNS(null,"width",`${O}px`),T.setAttributeNS(null,"viewBox",`0 0 ${O} ${F}`);const K=z.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"stroke","none"),K.setAttributeNS(null,"stroke-width","1"),K.setAttributeNS(null,"fill","none"),K.setAttributeNS(null,"fill-rule","evenodd");const oe=z.createNS("http://www.w3.org/2000/svg","g");oe.setAttributeNS(null,"fill-rule","nonzero");const ue=z.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(3.0, 29.0)"),ue.setAttributeNS(null,"fill","#000000");const ve=[{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 ni of ve){const St=z.createNS("http://www.w3.org/2000/svg","ellipse");St.setAttributeNS(null,"opacity","0.04"),St.setAttributeNS(null,"cx","10.5"),St.setAttributeNS(null,"cy","5.80029008"),St.setAttributeNS(null,"rx",ni.rx),St.setAttributeNS(null,"ry",ni.ry),ue.appendChild(St)}const Te=z.createNS("http://www.w3.org/2000/svg","g");Te.setAttributeNS(null,"fill",this._color);const ze=z.createNS("http://www.w3.org/2000/svg","path");ze.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"),Te.appendChild(ze);const je=z.createNS("http://www.w3.org/2000/svg","g");je.setAttributeNS(null,"opacity","0.25"),je.setAttributeNS(null,"fill","#000000");const bt=z.createNS("http://www.w3.org/2000/svg","path");bt.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"),je.appendChild(bt);const mt=z.createNS("http://www.w3.org/2000/svg","g");mt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),mt.setAttributeNS(null,"fill","#FFFFFF");const gt=z.createNS("http://www.w3.org/2000/svg","g");gt.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Vt=z.createNS("http://www.w3.org/2000/svg","circle");Vt.setAttributeNS(null,"fill","#000000"),Vt.setAttributeNS(null,"opacity","0.25"),Vt.setAttributeNS(null,"cx","5.5"),Vt.setAttributeNS(null,"cy","5.5"),Vt.setAttributeNS(null,"r","5.4999962");const Zt=z.createNS("http://www.w3.org/2000/svg","circle");Zt.setAttributeNS(null,"fill","#FFFFFF"),Zt.setAttributeNS(null,"cx","5.5"),Zt.setAttributeNS(null,"cy","5.5"),Zt.setAttributeNS(null,"r","5.4999962"),gt.appendChild(Vt),gt.appendChild(Zt),oe.appendChild(ue),oe.appendChild(Te),oe.appendChild(je),oe.appendChild(mt),oe.appendChild(gt),T.appendChild(oe),T.setAttributeNS(null,"height",F*this._scale+"px"),T.setAttributeNS(null,"width",O*this._scale+"px"),this._element.appendChild(T),this._offset=i.pointGeometry.convert(h&&h.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",T=>{T.preventDefault()}),this._element.addEventListener("mousedown",T=>{T.preventDefault()}),Vn(this._element,this._anchor,"marker"),this._popup=null}addTo(h){return this.remove(),this._map=h,h.getCanvasContainer().appendChild(this._element),h.on("move",this._update),h.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),z.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=i.LngLat.convert(h),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(h){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),h){if(!("offset"in h.options)){const F=Math.sqrt(Math.pow(13.5,2)/2);h.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[F,-1*(38.1-13.5+F)],"bottom-right":[-F,-1*(38.1-13.5+F)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=h,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(h){const _=h.code,T=h.charCode||h.keyCode;_!=="Space"&&_!=="Enter"&&T!==32&&T!==13||this.togglePopup()}_onMapClick(h){const _=h.originalEvent.target,T=this._element;this._popup&&(_===T||T.contains(_))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const h=this._popup;return h?(h.isOpen()?h.remove():h.addTo(this._map),this):this}_update(h){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Js(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let T="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?T="rotateX(0deg)":this._pitchAlignment==="map"&&(T=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),z.setTransform(this._element,`${Fn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${T} ${_}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const F=this._map.unproject(this._pos),O=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=F.distanceTo(this._lngLat)>20*O?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(h){return this._offset=i.pointGeometry.convert(h),this._update(),this}_onMove(h){if(!this._isDragging){const _=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=_}this._isDragging&&(this._pos=h.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 i.Event("dragstart"))),this.fire(new i.Event("drag")))}_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 i.Event("dragend")),this._state="inactive"}_addDragHandler(h){this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.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))}setDraggable(h){return this._draggable=!!h,this._map&&(h?(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(h){return this._rotation=h||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(h){return this._rotationAlignment=h||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(h){return this._pitchAlignment=h&&h!=="auto"?h:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const dA={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let yl,Cs=0,Ga=!1;const Go={maxWidth:100,unit:"metric"};function pA(M,h,_){const T=_&&_.maxWidth||100,F=M._container.clientHeight/2,O=M.unproject([0,F]),K=M.unproject([T,F]),oe=O.distanceTo(K);if(_&&_.unit==="imperial"){const ue=3.2808*oe;ue>5280?va(h,T,ue/5280,M._getUIString("ScaleControl.Miles")):va(h,T,ue,M._getUIString("ScaleControl.Feet"))}else _&&_.unit==="nautical"?va(h,T,oe/1852,M._getUIString("ScaleControl.NauticalMiles")):oe>=1e3?va(h,T,oe/1e3,M._getUIString("ScaleControl.Kilometers")):va(h,T,oe,M._getUIString("ScaleControl.Meters"))}function va(M,h,_,T){const F=function(O){const K=Math.pow(10,`${Math.floor(O)}`.length-1);let oe=O/K;return oe=oe>=10?10:oe>=5?5:oe>=3?3:oe>=2?2:oe>=1?1:function(ue){const ve=Math.pow(10,Math.ceil(-Math.log(ue)/Math.LN10));return Math.round(ue*ve)/ve}(oe),K*oe}(_);M.style.width=h*(F/_)+"px",M.innerHTML=`${F}&nbsp;${T}`}const hs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Is=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Kh(M){if(M){if(typeof M=="number"){const h=Math.round(Math.sqrt(.5*Math.pow(M,2)));return{center:new i.pointGeometry(0,0),top:new i.pointGeometry(0,M),"top-left":new i.pointGeometry(h,h),"top-right":new i.pointGeometry(-h,h),bottom:new i.pointGeometry(0,-M),"bottom-left":new i.pointGeometry(h,-h),"bottom-right":new i.pointGeometry(-h,-h),left:new i.pointGeometry(M,0),right:new i.pointGeometry(-M,0)}}if(M instanceof i.pointGeometry||Array.isArray(M)){const h=i.pointGeometry.convert(M);return{center:h,top:h,"top-left":h,"top-right":h,bottom:h,"bottom-left":h,"bottom-right":h,left:h,right:h}}return{center:i.pointGeometry.convert(M.center||[0,0]),top:i.pointGeometry.convert(M.top||[0,0]),"top-left":i.pointGeometry.convert(M["top-left"]||[0,0]),"top-right":i.pointGeometry.convert(M["top-right"]||[0,0]),bottom:i.pointGeometry.convert(M.bottom||[0,0]),"bottom-left":i.pointGeometry.convert(M["bottom-left"]||[0,0]),"bottom-right":i.pointGeometry.convert(M["bottom-right"]||[0,0]),left:i.pointGeometry.convert(M.left||[0,0]),right:i.pointGeometry.convert(M.right||[0,0])}}return Kh(new i.pointGeometry(0,0))}const xl={supported:C,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends Zr{constructor(M){var h;if(i.PerformanceUtils.mark(i.PerformanceMarkers.create),(M=i.extend({},jh,M)).minZoom!=null&&M.maxZoom!=null&&M.minZoom>M.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(M.minPitch!=null&&M.maxPitch!=null&&M.minPitch>M.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(M.minPitch!=null&&M.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(M.maxPitch!=null&&M.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new qc(M.minZoom,M.maxZoom,M.minPitch,M.maxPitch,M.renderWorldCopies),{bearingSnap:M.bearingSnap}),this._interactive=M.interactive,this._cooperativeGestures=M.cooperativeGestures,this._maxTileCacheSize=M.maxTileCacheSize,this._failIfMajorPerformanceCaveat=M.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=M.preserveDrawingBuffer,this._antialias=M.antialias,this._trackResize=M.trackResize,this._bearingSnap=M.bearingSnap,this._refreshExpiredTiles=M.refreshExpiredTiles,this._fadeDuration=M.fadeDuration,this._crossSourceCollisions=M.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=M.collectResourceTiming,this._renderTaskQueue=new xc,this._controls=[],this._mapId=i.uniqueId(),this._locale=i.extend({},AA,M.locale),this._clickTolerance=M.clickTolerance,this._pixelRatio=(h=M.pixelRatio)!==null&&h!==void 0?h:devicePixelRatio,this._requestManager=new G(M.transformRequest),typeof M.container=="string"){if(this._container=document.getElementById(M.container),!this._container)throw new Error(`Container '${M.container}' not found.`)}else{if(!(M.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=M.container}if(M.maxBounds&&this.setMaxBounds(M.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new An(this,M),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=M.hash&&new Uh(typeof M.hash=="string"&&M.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:M.center,zoom:M.zoom,bearing:M.bearing,pitch:M.pitch}),M.bounds&&(this.resize(),this.fitBounds(M.bounds,i.extend({},M.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=M.localIdeographFontFamily,M.style&&this.setStyle(M.style,{localIdeographFontFamily:M.localIdeographFontFamily}),M.attributionControl&&this.addControl(new nh({customAttribution:M.customAttribution})),M.maplibreLogo&&this.addControl(new Wh,M.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new i.Event(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new i.Event(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new i.Event("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(M,h){if(h===void 0&&(h=M.getDefaultPosition?M.getDefaultPosition():"top-right"),!M||!M.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const _=M.onAdd(this);this._controls.push(M);const T=this._controlPositions[h];return h.indexOf("bottom")!==-1?T.insertBefore(_,T.firstChild):T.appendChild(_),this}removeControl(M){if(!M||!M.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const h=this._controls.indexOf(M);return h>-1&&this._controls.splice(h,1),M.onRemove(this),this}hasControl(M){return this._controls.indexOf(M)>-1}calculateCameraOptionsFromTo(M,h,_,T){return T==null&&this.style.terrain&&(T=this.transform.getElevation(_,this.style.terrain)),super.calculateCameraOptionsFromTo(M,h,_,T)}resize(M){const h=this._containerDimensions(),_=h[0],T=h[1];this._resizeCanvas(_,T,this.getPixelRatio()),this.transform.resize(_,T),this.painter.resize(_,T,this.getPixelRatio());const F=!this._moving;return F&&(this.stop(),this.fire(new i.Event("movestart",M)).fire(new i.Event("move",M))),this.fire(new i.Event("resize",M)),F&&this.fire(new i.Event("moveend",M)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(M){const[h,_]=this._containerDimensions();this._pixelRatio=M,this._resizeCanvas(h,_,M),this.painter.resize(h,_,M)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(M){return this.transform.setMaxBounds(i.LngLatBounds.convert(M)),this._update()}setMinZoom(M){if((M=M==null?-2:M)>=-2&&M<=this.transform.maxZoom)return this.transform.minZoom=M,this._update(),this.getZoom()<M&&this.setZoom(M),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(M){if((M=M==null?22:M)>=this.transform.minZoom)return this.transform.maxZoom=M,this._update(),this.getZoom()>M&&this.setZoom(M),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(M){if((M=M==null?0:M)<0)throw new Error("minPitch must be greater than or equal to 0");if(M>=0&&M<=this.transform.maxPitch)return this.transform.minPitch=M,this._update(),this.getPitch()<M&&this.setPitch(M),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(M){if((M=M==null?60:M)>85)throw new Error("maxPitch must be less than or equal to 85");if(M>=this.transform.minPitch)return this.transform.maxPitch=M,this._update(),this.getPitch()>M&&this.setPitch(M),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(M){return this.transform.renderWorldCopies=M,this._update()}project(M){return this.transform.locationPoint(i.LngLat.convert(M),this.style&&this.style.terrain)}unproject(M){return this.transform.pointLocation(i.pointGeometry.convert(M),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(M,h,_){if(M==="mouseenter"||M==="mouseover"){let T=!1;return{layer:h,listener:_,delegates:{mousemove:O=>{const K=this.getLayer(h)?this.queryRenderedFeatures(O.point,{layers:[h]}):[];K.length?T||(T=!0,_.call(this,new So(M,this,O.originalEvent,{features:K}))):T=!1},mouseout:()=>{T=!1}}}}if(M==="mouseleave"||M==="mouseout"){let T=!1;return{layer:h,listener:_,delegates:{mousemove:K=>{(this.getLayer(h)?this.queryRenderedFeatures(K.point,{layers:[h]}):[]).length?T=!0:T&&(T=!1,_.call(this,new So(M,this,K.originalEvent)))},mouseout:K=>{T&&(T=!1,_.call(this,new So(M,this,K.originalEvent)))}}}}{const T=F=>{const O=this.getLayer(h)?this.queryRenderedFeatures(F.point,{layers:[h]}):[];O.length&&(F.features=O,_.call(this,F),delete F.features)};return{layer:h,listener:_,delegates:{[M]:T}}}}on(M,h,_){if(_===void 0)return super.on(M,h);const T=this._createDelegatedListener(M,h,_);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[M]=this._delegatedListeners[M]||[],this._delegatedListeners[M].push(T);for(const F in T.delegates)this.on(F,T.delegates[F]);return this}once(M,h,_){if(_===void 0)return super.once(M,h);const T=this._createDelegatedListener(M,h,_);for(const F in T.delegates)this.once(F,T.delegates[F]);return this}off(M,h,_){return _===void 0?super.off(M,h):(this._delegatedListeners&&this._delegatedListeners[M]&&(T=>{const F=this._delegatedListeners[M];for(let O=0;O<F.length;O++){const K=F[O];if(K.layer===h&&K.listener===_){for(const oe in K.delegates)this.off(oe,K.delegates[oe]);return F.splice(O,1),this}}})(),this)}queryRenderedFeatures(M,h){if(!this.style)return[];let _;if(h!==void 0||M===void 0||M instanceof i.pointGeometry||Array.isArray(M)||(h=M,M=void 0),h=h||{},(M=M||[[0,0],[this.transform.width,this.transform.height]])instanceof i.pointGeometry||typeof M[0]=="number")_=[i.pointGeometry.convert(M)];else{const T=i.pointGeometry.convert(M[0]),F=i.pointGeometry.convert(M[1]);_=[T,new i.pointGeometry(F.x,T.y),F,new i.pointGeometry(T.x,F.y),T]}return this.style.queryRenderedFeatures(_,h,this.transform)}querySourceFeatures(M,h){return this.style.querySourceFeatures(M,h)}setStyle(M,h){return(h=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},h)).diff!==!1&&h.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&M?(this._diffStyle(M,h),this):(this._localIdeographFontFamily=h.localIdeographFontFamily,this._updateStyle(M,h))}setTransformRequest(M){return this._requestManager.setTransformRequest(M),this}_getUIString(M){const h=this._locale[M];if(h==null)throw new Error(`Missing UI string '${M}'`);return h}_updateStyle(M,h){return this.style&&(this.style.setEventedParent(null),this.style._remove()),M?(this.style=new Mr(this,h||{}),this.style.setEventedParent(this,{style:this.style}),typeof M=="string"?this.style.loadURL(M):this.style.loadJSON(M),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Mr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(M,h){if(typeof M=="string"){const _=this._requestManager.transformRequest(M,i.ResourceType.Style);i.getJSON(_,(T,F)=>{T?this.fire(new i.ErrorEvent(T)):F&&this._updateDiff(F,h)})}else typeof M=="object"&&this._updateDiff(M,h)}_updateDiff(M,h){try{this.style.setState(M)&&this._update(!0)}catch(_){i.warnOnce(`Unable to perform style diff: ${_.message||_.error||_}. Rebuilding the style from scratch.`),this._updateStyle(M,h)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")}addSource(M,h){return this._lazyInitEmptyStyle(),this.style.addSource(M,h),this._update(!0)}isSourceLoaded(M){const h=this.style&&this.style.sourceCaches[M];if(h!==void 0)return h.loaded();this.fire(new i.ErrorEvent(new Error(`There is no source with ID '${M}'`)))}setTerrain(M){return this.style.setTerrain(M),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const M=this.style&&this.style.sourceCaches;for(const h in M){const _=M[h]._tiles;for(const T in _){const F=_[T];if(F.state!=="loaded"&&F.state!=="errored")return!1}}return!0}addSourceType(M,h,_){return this._lazyInitEmptyStyle(),this.style.addSourceType(M,h,_)}removeSource(M){return this.style.removeSource(M),this._update(!0)}getSource(M){return this.style.getSource(M)}addImage(M,h,{pixelRatio:_=1,sdf:T=!1,stretchX:F,stretchY:O,content:K}={}){if(this._lazyInitEmptyStyle(),h instanceof HTMLImageElement||i.isImageBitmap(h)){const{width:oe,height:ue,data:ve}=i.exported.getImageData(h);this.style.addImage(M,{data:new i.RGBAImage({width:oe,height:ue},ve),pixelRatio:_,stretchX:F,stretchY:O,content:K,sdf:T,version:0})}else{if(h.width===void 0||h.height===void 0)return this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:oe,height:ue,data:ve}=h,Te=h;this.style.addImage(M,{data:new i.RGBAImage({width:oe,height:ue},new Uint8Array(ve)),pixelRatio:_,stretchX:F,stretchY:O,content:K,sdf:T,version:0,userImage:Te}),Te.onAdd&&Te.onAdd(this,M)}}}updateImage(M,h){const _=this.style.getImage(M);if(!_)return this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const T=h instanceof HTMLImageElement||i.isImageBitmap(h)?i.exported.getImageData(h):h,{width:F,height:O,data:K}=T;if(F===void 0||O===void 0)return this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(F!==_.data.width||O!==_.data.height)return this.fire(new i.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const oe=!(h instanceof HTMLImageElement||i.isImageBitmap(h));_.data.replace(K,oe),this.style.updateImage(M,_)}hasImage(M){return M?!!this.style.getImage(M):(this.fire(new i.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(M){this.style.removeImage(M)}loadImage(M,h){i.getImage(this._requestManager.transformRequest(M,i.ResourceType.Image),h)}listImages(){return this.style.listImages()}addLayer(M,h){return this._lazyInitEmptyStyle(),this.style.addLayer(M,h),this._update(!0)}moveLayer(M,h){return this.style.moveLayer(M,h),this._update(!0)}removeLayer(M){return this.style.removeLayer(M),this._update(!0)}getLayer(M){return this.style.getLayer(M)}setLayerZoomRange(M,h,_){return this.style.setLayerZoomRange(M,h,_),this._update(!0)}setFilter(M,h,_={}){return this.style.setFilter(M,h,_),this._update(!0)}getFilter(M){return this.style.getFilter(M)}setPaintProperty(M,h,_,T={}){return this.style.setPaintProperty(M,h,_,T),this._update(!0)}getPaintProperty(M,h){return this.style.getPaintProperty(M,h)}setLayoutProperty(M,h,_,T={}){return this.style.setLayoutProperty(M,h,_,T),this._update(!0)}getLayoutProperty(M,h){return this.style.getLayoutProperty(M,h)}setLight(M,h={}){return this._lazyInitEmptyStyle(),this.style.setLight(M,h),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(M,h){return this.style.setFeatureState(M,h),this._update()}removeFeatureState(M,h){return this.style.removeFeatureState(M,h),this._update()}getFeatureState(M){return this.style.getFeatureState(M)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let M=0,h=0;return this._container&&(M=this._container.clientWidth||400,h=this._container.clientHeight||300),[M,h]}_setupContainer(){const M=this._container;M.classList.add("maplibregl-map","mapboxgl-map");const h=this._canvasContainer=z.create("div","maplibregl-canvas-container mapboxgl-canvas-container",M);this._interactive&&h.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=z.create("canvas","maplibregl-canvas mapboxgl-canvas",h),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const _=this._containerDimensions();this._resizeCanvas(_[0],_[1],this.getPixelRatio());const T=this._controlContainer=z.create("div","maplibregl-control-container mapboxgl-control-container",M),F=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(O=>{F[O]=z.create("div",`maplibregl-ctrl-${O} mapboxgl-ctrl-${O}`,T)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const M=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=z.create("div","maplibregl-cooperative-gesture-screen",M);let h="Control",_=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(_=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",h="Meta"),this._cooperativeGesturesScreen.innerHTML=`
  596. <div class="maplibregl-desktop-message">${_}</div>
  597. <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
  598. `,document.addEventListener("keydown",T=>{T.key===h&&(this._metaPress=!0)}),document.addEventListener("keyup",T=>{T.key===h&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",T=>{this._onCooperativeGesture(T,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(M,h,_){this._canvas.width=_*M,this._canvas.height=_*h,this._canvas.style.width=`${M}px`,this._canvas.style.height=`${h}px`}_setupPainter(){const M=i.extend({},C.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),h=this._canvas.getContext("webgl",M)||this._canvas.getContext("experimental-webgl",M);h?(this.painter=new wu(h,this.transform),i.exported$1.testSupport(h)):this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(M){M.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:M}))}_contextRestored(M){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:M}))}_onMapScroll(M){if(M.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(M,h,_){return!h&&_<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(M){return this.style?(this._styleDirty=this._styleDirty||M,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(M){return this._update(),this._renderTaskQueue.add(M)}_cancelRenderFrame(M){this._renderTaskQueue.remove(M)}_render(M){let h,_=0;const T=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(h=T.createQueryEXT(),T.beginQueryEXT(T.TIME_ELAPSED_EXT,h),_=i.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(M),this._removed)return;let F=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const K=this.transform.zoom,oe=i.exported.now();this.style.zoomHistory.update(K,oe);const ue=new i.EvaluationParameters(K,{now:oe,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),ve=ue.crossFadingFactor();ve===1&&ve===this._crossFadingFactor||(F=!0,this._crossFadingFactor=ve),this.style.update(ue)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.PerformanceUtils.mark(i.PerformanceMarkers.load),this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||F)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const K=i.exported.now()-_;T.endQueryEXT(T.TIME_ELAPSED_EXT,h),setTimeout(()=>{const oe=T.getQueryObjectEXT(h,T.QUERY_RESULT_EXT)/1e6;T.deleteQueryEXT(h),this.fire(new i.Event("gpu-timing-frame",{cpuTime:K,gpuTime:oe}))},50)}if(this.listens("gpu-timing-layer")){const K=this.painter.collectGpuTimers();setTimeout(()=>{const oe=this.painter.queryGpuTimers(K);this.fire(new i.Event("gpu-timing-layer",{layerTimes:oe}))},50)}const O=this._sourcesDirty||this._styleDirty||this._placementDirty;return O||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.Event("idle")),!this._loaded||this._fullyLoaded||O||(this._fullyLoaded=!0,i.PerformanceUtils.mark(i.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const h of this._controls)h.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const M=this.painter.context.gl.getExtension("WEBGL_lose_context");M&&M.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),z.remove(this._canvasContainer),z.remove(this._controlContainer),this._cooperativeGestures&&z.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),i.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new i.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=i.exported.frame(M=>{i.PerformanceUtils.frame(M),this._frame=null,this._render(M)}))}_onWindowOnline(){this._update()}_onWindowResize(M){this._trackResize&&this.resize({originalEvent:M})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(M){this._showTileBoundaries!==M&&(this._showTileBoundaries=M,this._update())}get showPadding(){return!!this._showPadding}set showPadding(M){this._showPadding!==M&&(this._showPadding=M,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(M){this._showCollisionBoxes!==M&&(this._showCollisionBoxes=M,M?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(M){this._showOverdrawInspector!==M&&(this._showOverdrawInspector=M,this._update())}get repaint(){return!!this._repaint}set repaint(M){this._repaint!==M&&(this._repaint=M,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(M){this._vertices=M,this._update()}_setCacheLimits(M,h){i.setCacheLimits(M,h)}get version(){return"2.4.0"}},NavigationControl:class{constructor(M){this.options=i.extend({},rh,M),this._container=z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",h=>h.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",h=>this._map.zoomIn({},{originalEvent:h})),z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",h=>this._map.zoomOut({},{originalEvent:h})),z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",h=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:h}):this._map.resetNorth({},{originalEvent:h})}),this._compassIcon=z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const M=this._map.getZoom(),h=M===this._map.getMaxZoom(),_=M===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=_,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",_.toString())}_rotateCompassArrow(){const M=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=M}onAdd(M){return this._map=M,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new uo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){z.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(M,h){const _=z.create("button",M,this._container);return _.type="button",_.addEventListener("click",h),_}_setButtonTitle(M,h){const _=this._map._getUIString(`NavigationControl.${h}`);M.title=_,M.setAttribute("aria-label",_)}},GeolocateControl:class extends i.Evented{constructor(M){super(),this.options=i.extend({},dA,M),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(M){var h;return this._map=M,this._container=z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),h=this._setupUI,yl!==void 0?h(yl):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(_=>{yl=_.state!=="denied",h(yl)}):(yl=!!window.navigator.geolocation,h(yl)),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(),z.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Cs=0,Ga=!1}_isOutOfMapMaxBounds(M){const h=this._map.getMaxBounds(),_=M.coords;return h&&(_.longitude<h.getWest()||_.longitude>h.getEast()||_.latitude<h.getSouth()||_.latitude>h.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(M){if(this._map){if(this._isOutOfMapMaxBounds(M))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",M)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=M,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(M),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(M),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",M)),this._finish()}}_updateCamera(M){const h=new i.LngLat(M.coords.longitude,M.coords.latitude),_=M.coords.accuracy,T=this._map.getBearing(),F=i.extend({bearing:T},this.options.fitBoundsOptions);this._map.fitBounds(h.toBounds(_),F,{geolocateSource:!0})}_updateMarker(M){if(M){const h=new i.LngLat(M.coords.longitude,M.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=M.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const M=this._map._container.clientHeight/2,h=this._map.unproject([0,M]),_=this._map.unproject([1,M]),T=h.distanceTo(_),F=Math.ceil(2*this._accuracy/T);this._circleElement.style.width=`${F}px`,this._circleElement.style.height=`${F}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(M){if(this._map){if(this.options.trackUserLocation)if(M.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(M.code===3&&Ga)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",M)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(M){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=z.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",M===!1){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=z.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new sh(this._dotElement),this._circleElement=z.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new sh({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Cs--,Ga=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-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 M;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Cs++,Cs>1?(M={maximumAge:6e5,timeout:0},Ga=!0):(M=this.options.positionOptions,Ga=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,M)}}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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:nh,LogoControl:Wh,ScaleControl:class{constructor(M){this.options=i.extend({},Go,M),i.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){pA(this._map,this._container,this.options)}onAdd(M){return this._map=M,this._container=z.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",M.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){z.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(M){this.options.unit=M,pA(this._map,this._container,this.options)}},FullscreenControl:class{constructor(M){this._fullscreen=!1,M&&M.container&&(M.container instanceof HTMLElement?this._container=M.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"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(M){return this._map=M,this._container||(this._container=this._map.getContainer()),this._controlContainer=z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){z.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const M=this._fullscreenButton=z.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",M).setAttribute("aria-hidden","true"),M.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const M=this._getTitle();this._fullscreenButton.setAttribute("aria-label",M),this._fullscreenButton.title=M}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(M){this.options=M,i.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(M){return this._map=M,this._container=z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=z.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),z.create("span","maplibregl-ctrl-icon mapboxgl-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(){z.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends i.Evented{constructor(M){super(),this.options=i.extend(Object.create(hs),M),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(M){return this._map&&this.remove(),this._map=M,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&z.remove(this._content),this._container&&(z.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(M){return this._lngLat=i.LngLat.convert(M),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(M){return this.setDOMContent(document.createTextNode(M))}setHTML(M){const h=document.createDocumentFragment(),_=document.createElement("body");let T;for(_.innerHTML=M;T=_.firstChild,T;)h.appendChild(T);return this.setDOMContent(h)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(M){return this.options.maxWidth=M,this._update(),this}setDOMContent(M){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=z.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(M),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(M){this._container&&this._container.classList.add(M)}removeClassName(M){this._container&&this._container.classList.remove(M)}setOffset(M){return this.options.offset=M,this._update(),this}toggleClassName(M){if(this._container)return this._container.classList.toggle(M)}_createCloseButton(){this.options.closeButton&&(this._closeButton=z.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(M){this._update(M.point)}_onMouseMove(M){this._update(M.point)}_onDrag(M){this._update(M.point)}_update(M){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=z.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=z.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(O=>this._container.classList.add(O)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Js(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!M))return;const h=this._pos=this._trackPointer&&M?M:this._map.project(this._lngLat);let _=this.options.anchor;const T=Kh(this.options.offset);if(!_){const O=this._container.offsetWidth,K=this._container.offsetHeight;let oe;oe=h.y+T.bottom.y<K?["top"]:h.y>this._map.transform.height-K?["bottom"]:[],h.x<O/2?oe.push("left"):h.x>this._map.transform.width-O/2&&oe.push("right"),_=oe.length===0?"bottom":oe.join("-")}const F=h.add(T[_]).round();z.setTransform(this._container,`${Fn[_]} translate(${F.x}px,${F.y}px)`),Vn(this._container,_,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const M=this._container.querySelector(Is);M&&M.focus()}_onClose(){this.remove()}},Marker:sh,Style:Mr,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,Evented:i.Evented,AJAXError:i.AJAXError,config:i.config,CanvasSource:Qe,GeoJSONSource:Re,ImageSource:We,RasterDEMTileSource:xe,RasterTileSource:le,VectorTileSource:te,VideoSource:Ve,prewarm:function(){fi().acquire(Ct)},clearPrewarmedResources:function(){const M=_i;M&&(M.isPreloaded()&&M.numActive()===1?(M.release(Ct),_i=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Ft.workerCount},set workerCount(M){Ft.workerCount=M},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(M){i.config.MAX_PARALLEL_IMAGE_REQUESTS=M},clearStorage(M){i.clearTileCache(M)},workerUrl:"",addProtocol(M,h){i.config.REGISTERED_PROTOCOLS[M]=h},removeProtocol(M){delete i.config.REGISTERED_PROTOCOLS[M]}};return xs.extend(xl,{isSafari:i.isSafari,getPerformanceMetrics:i.PerformanceUtils.getPerformanceMetrics}),xl});var y=c;return y})})(Ml);const wR=Ml.exports,bR=SS({__proto__:null,default:wR},[Ml.exports]);var S_={Linear:{None:function(u){return u}},Quadratic:{In:function(u){return u*u},Out:function(u){return u*(2-u)},InOut:function(u){return(u*=2)<1?.5*u*u:-.5*(--u*(u-2)-1)}},Cubic:{In:function(u){return u*u*u},Out:function(u){return--u*u*u+1},InOut:function(u){return(u*=2)<1?.5*u*u*u:.5*((u-=2)*u*u+2)}},Quartic:{In:function(u){return u*u*u*u},Out:function(u){return 1- --u*u*u*u},InOut:function(u){return(u*=2)<1?.5*u*u*u*u:-.5*((u-=2)*u*u*u-2)}},Quintic:{In:function(u){return u*u*u*u*u},Out:function(u){return--u*u*u*u*u+1},InOut:function(u){return(u*=2)<1?.5*u*u*u*u*u:.5*((u-=2)*u*u*u*u+2)}},Sinusoidal:{In:function(u){return 1-Math.cos(u*Math.PI/2)},Out:function(u){return Math.sin(u*Math.PI/2)},InOut:function(u){return .5*(1-Math.cos(Math.PI*u))}},Exponential:{In:function(u){return u===0?0:Math.pow(1024,u-1)},Out:function(u){return u===1?1:1-Math.pow(2,-10*u)},InOut:function(u){return u===0?0:u===1?1:(u*=2)<1?.5*Math.pow(1024,u-1):.5*(-Math.pow(2,-10*(u-1))+2)}},Circular:{In:function(u){return 1-Math.sqrt(1-u*u)},Out:function(u){return Math.sqrt(1- --u*u)},InOut:function(u){return(u*=2)<1?-.5*(Math.sqrt(1-u*u)-1):.5*(Math.sqrt(1-(u-=2)*u)+1)}},Elastic:{In:function(u){return u===0?0:u===1?1:-Math.pow(2,10*(u-1))*Math.sin((u-1.1)*5*Math.PI)},Out:function(u){return u===0?0:u===1?1:Math.pow(2,-10*u)*Math.sin((u-.1)*5*Math.PI)+1},InOut:function(u){return u===0?0:u===1?1:(u*=2,u<1?-.5*Math.pow(2,10*(u-1))*Math.sin((u-1.1)*5*Math.PI):.5*Math.pow(2,-10*(u-1))*Math.sin((u-1.1)*5*Math.PI)+1)}},Back:{In:function(u){var e=1.70158;return u*u*((e+1)*u-e)},Out:function(u){var e=1.70158;return--u*u*((e+1)*u+e)+1},InOut:function(u){var e=2.5949095;return(u*=2)<1?.5*(u*u*((e+1)*u-e)):.5*((u-=2)*u*((e+1)*u+e)+2)}},Bounce:{In:function(u){return 1-S_.Bounce.Out(1-u)},Out:function(u){return u<1/2.75?7.5625*u*u:u<2/2.75?7.5625*(u-=1.5/2.75)*u+.75:u<2.5/2.75?7.5625*(u-=2.25/2.75)*u+.9375:7.5625*(u-=2.625/2.75)*u+.984375},InOut:function(u){return u<.5?S_.Bounce.In(u*2)*.5:S_.Bounce.Out(u*2-1)*.5+.5}}},x_;typeof self>"u"&&typeof process<"u"&&process.hrtime?x_=function(){var u=process.hrtime();return u[0]*1e3+u[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?x_=self.performance.now.bind(self.performance):Date.now!==void 0?x_=Date.now:x_=function(){return new Date().getTime()};var Xp=x_,UM=function(){function u(){this._tweens={},this._tweensAddedDuringUpdate={}}return u.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},u.prototype.removeAll=function(){this._tweens={}},u.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},u.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},u.prototype.update=function(e,t){e===void 0&&(e=Xp()),t===void 0&&(t=!1);var r=Object.keys(this._tweens);if(r.length===0)return!1;for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var c=0;c<r.length;c++){var p=this._tweens[r[c]],y=!t;p&&p.update(e,y)===!1&&!t&&delete this._tweens[r[c]]}r=Object.keys(this._tweensAddedDuringUpdate)}return!0},u}(),Lm={Linear:function(u,e){var t=u.length-1,r=t*e,c=Math.floor(r),p=Lm.Utils.Linear;return e<0?p(u[0],u[1],r):e>1?p(u[t],u[t-1],t-r):p(u[c],u[c+1>t?t:c+1],r-c)},Bezier:function(u,e){for(var t=0,r=u.length-1,c=Math.pow,p=Lm.Utils.Bernstein,y=0;y<=r;y++)t+=c(1-e,r-y)*c(e,y)*u[y]*p(r,y);return t},CatmullRom:function(u,e){var t=u.length-1,r=t*e,c=Math.floor(r),p=Lm.Utils.CatmullRom;return u[0]===u[t]?(e<0&&(c=Math.floor(r=t*(1+e))),p(u[(c-1+t)%t],u[c],u[(c+1)%t],u[(c+2)%t],r-c)):e<0?u[0]-(p(u[0],u[0],u[1],u[1],-r)-u[0]):e>1?u[t]-(p(u[t],u[t],u[t-1],u[t-1],r-t)-u[t]):p(u[c?c-1:0],u[c],u[t<c+1?t:c+1],u[t<c+2?t:c+2],r-c)},Utils:{Linear:function(u,e,t){return(e-u)*t+u},Bernstein:function(u,e){var t=Lm.Utils.Factorial;return t(u)/t(e)/t(u-e)},Factorial:function(){var u=[1];return function(e){var t=1;if(u[e])return u[e];for(var r=e;r>1;r--)t*=r;return u[e]=t,t}}(),CatmullRom:function(u,e,t,r,c){var p=(t-u)*.5,y=(r-e)*.5,i=c*c,C=c*i;return(2*e-2*t+p+y)*C+(-3*e+3*t-2*p-y)*i+p*c+e}}},F2=function(){function u(){}return u.nextId=function(){return u._nextId++},u._nextId=0,u}(),RM=new UM,BR=function(){function u(e,t){t===void 0&&(t=RM),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=S_.Linear.None,this._interpolationFunction=Lm.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=F2.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return u.prototype.getId=function(){return this._id},u.prototype.isPlaying=function(){return this._isPlaying},u.prototype.isPaused=function(){return this._isPaused},u.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),t!==void 0&&(this._duration=t),this},u.prototype.duration=function(e){return this._duration=e,this},u.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var t in this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?Xp()+parseFloat(e):e:Xp(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},u.prototype._setupProperties=function(e,t,r,c){for(var p in r){var y=e[p],i=Array.isArray(y),C=i?"array":typeof y,D=!i&&Array.isArray(r[p]);if(!(C==="undefined"||C==="function")){if(D){var R=r[p];if(R.length===0)continue;R=R.map(this._handleRelativeValue.bind(this,y)),r[p]=[y].concat(R)}if((C==="object"||i)&&y&&!D){t[p]=i?[]:{};for(var Q in y)t[p][Q]=y[Q];c[p]=i?[]:{},this._setupProperties(y,t[p],r[p],c[p])}else typeof t[p]>"u"&&(t[p]=y),i||(t[p]*=1),D?c[p]=r[p].slice().reverse():c[p]=t[p]||0}}},u.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},u.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},u.prototype.pause=function(e){return e===void 0&&(e=Xp()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},u.prototype.resume=function(e){return e===void 0&&(e=Xp()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},u.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},u.prototype.group=function(e){return this._group=e,this},u.prototype.delay=function(e){return this._delayTime=e,this},u.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},u.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},u.prototype.yoyo=function(e){return this._yoyo=e,this},u.prototype.easing=function(e){return this._easingFunction=e,this},u.prototype.interpolation=function(e){return this._interpolationFunction=e,this},u.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},u.prototype.onStart=function(e){return this._onStartCallback=e,this},u.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},u.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},u.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},u.prototype.onStop=function(e){return this._onStopCallback=e,this},u.prototype.update=function(e,t){if(e===void 0&&(e=Xp()),t===void 0&&(t=!0),this._isPaused)return!0;var r,c,p=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>p)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),c=(e-this._startTime)/this._duration,c=this._duration===0||c>1?1:c;var y=this._easingFunction(c);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,y),this._onUpdateCallback&&this._onUpdateCallback(this._object,c),c===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(r in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[r]=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var i=0,C=this._chainedTweens.length;i<C;i++)this._chainedTweens[i].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},u.prototype._updateProperties=function(e,t,r,c){for(var p in r)if(t[p]!==void 0){var y=t[p]||0,i=r[p],C=Array.isArray(e[p]),D=Array.isArray(i),R=!C&&D;R?e[p]=this._interpolationFunction(i,c):typeof i=="object"&&i?this._updateProperties(e[p],y,i,c):(i=this._handleRelativeValue(y,i),typeof i=="number"&&(e[p]=y+(i-y)*c))}},u.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},u.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],r=this._valuesEnd[e];typeof r=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(r):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},u}(),CR="18.6.4",ER=F2.nextId,ju=RM,TR=ju.getAll.bind(ju),SR=ju.removeAll.bind(ju),MR=ju.add.bind(ju),IR=ju.remove.bind(ju),FR=ju.update.bind(ju),k_={Easing:S_,Group:UM,Interpolation:Lm,now:Xp,Sequence:F2,nextId:ER,Tween:BR,VERSION:CR,getAll:TR,removeAll:SR,add:MR,remove:IR,update:FR};/**
  599. * @license
  600. * Copyright 2010-2023 Three.js Authors
  601. * SPDX-License-Identifier: MIT
  602. */const zv="149",jp={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Kp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},zM=0,Fb=1,kM=2,LR=3,DR=0,L2=1,OM=2,Dm=3,uu=0,rc=1,ga=2,PR=2,KA=0,hf=1,hv=2,Lb=3,Db=4,NM=5,qp=100,QM=101,VM=102,Pb=103,Ub=104,HM=200,GM=201,WM=202,jM=203,D2=204,P2=205,KM=206,$M=207,ZM=208,XM=209,qM=210,YM=0,JM=1,eI=2,uv=3,tI=4,iI=5,nI=6,rI=7,ly=0,sI=1,oI=2,Hu=0,U2=1,aI=2,lI=3,cI=4,hI=5,kv=300,rp=301,sp=302,O_=303,N_=304,qm=306,HA=1e3,nl=1001,Q_=1002,Co=1003,Av=1004,UR=1004,M_=1005,RR=1005,Xs=1006,R2=1007,zR=1007,op=1008,kR=1008,ap=1009,uI=1010,AI=1011,z2=1012,dI=1013,Xd=1014,GA=1015,Gm=1016,pI=1017,fI=1018,uf=1020,mI=1021,Dl=1023,gI=1024,_I=1025,ep=1026,ff=1027,yI=1028,xI=1029,vI=1030,wI=1031,bI=1033,Gx=33776,Wx=33777,jx=33778,Kx=33779,Rb=35840,zb=35841,kb=35842,Ob=35843,BI=36196,Nb=37492,Qb=37496,Vb=37808,Hb=37809,Gb=37810,Wb=37811,jb=37812,Kb=37813,$b=37814,Zb=37815,Xb=37816,qb=37817,Yb=37818,Jb=37819,e2=37820,t2=37821,$x=36492,CI=36283,i2=36284,n2=36285,r2=36286,EI=2200,TI=2201,SI=2202,V_=2300,H_=2301,Zx=2302,rf=2400,sf=2401,G_=2402,Ov=2500,k2=2501,OR=0,NR=1,QR=2,lp=3e3,Ts=3001,MI=3200,II=3201,cp=0,FI=1,VR="",cu="srgb",Wm="srgb-linear",HR=0,Xx=7680,GR=7681,WR=7682,jR=7683,KR=34055,$R=34056,ZR=5386,XR=512,qR=513,YR=514,JR=515,ez=516,tz=517,iz=518,LI=519,W_=35044,nz=35048,rz=35040,sz=35045,oz=35049,az=35041,lz=35046,cz=35050,hz=35042,uz="100",s2="300 es",dv=1035;class Xu{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const c=this._listeners[e];if(c!==void 0){const p=c.indexOf(t);p!==-1&&c.splice(p,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const c=r.slice(0);for(let p=0,y=c.length;p<y;p++)c[p].call(this,e);e.target=null}}}const Ja=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let zE=1234567;const Af=Math.PI/180,j_=180/Math.PI;function Pc(){const u=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Ja[u&255]+Ja[u>>8&255]+Ja[u>>16&255]+Ja[u>>24&255]+"-"+Ja[e&255]+Ja[e>>8&255]+"-"+Ja[e>>16&15|64]+Ja[e>>24&255]+"-"+Ja[t&63|128]+Ja[t>>8&255]+"-"+Ja[t>>16&255]+Ja[t>>24&255]+Ja[r&255]+Ja[r>>8&255]+Ja[r>>16&255]+Ja[r>>24&255]).toLowerCase()}function Eo(u,e,t){return Math.max(e,Math.min(t,u))}function O2(u,e){return(u%e+e)%e}function Az(u,e,t,r,c){return r+(u-e)*(c-r)/(t-e)}function dz(u,e,t){return u!==e?(t-u)/(e-u):0}function I_(u,e,t){return(1-t)*u+t*e}function pz(u,e,t,r){return I_(u,e,1-Math.exp(-t*r))}function fz(u,e=1){return e-Math.abs(O2(u,e*2)-e)}function mz(u,e,t){return u<=e?0:u>=t?1:(u=(u-e)/(t-e),u*u*(3-2*u))}function gz(u,e,t){return u<=e?0:u>=t?1:(u=(u-e)/(t-e),u*u*u*(u*(u*6-15)+10))}function _z(u,e){return u+Math.floor(Math.random()*(e-u+1))}function yz(u,e){return u+Math.random()*(e-u)}function xz(u){return u*(.5-Math.random())}function vz(u){u!==void 0&&(zE=u);let e=zE+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function wz(u){return u*Af}function bz(u){return u*j_}function o2(u){return(u&u-1)===0&&u!==0}function DI(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function pv(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function Bz(u,e,t,r,c){const p=Math.cos,y=Math.sin,i=p(t/2),C=y(t/2),D=p((e+r)/2),R=y((e+r)/2),Q=p((e-r)/2),z=y((e-r)/2),G=p((r-e)/2),J=y((r-e)/2);switch(c){case"XYX":u.set(i*R,C*Q,C*z,i*D);break;case"YZY":u.set(C*z,i*R,C*Q,i*D);break;case"ZXZ":u.set(C*Q,C*z,i*R,i*D);break;case"XZX":u.set(i*R,C*J,C*G,i*D);break;case"YXY":u.set(C*G,i*R,C*J,i*D);break;case"ZYZ":u.set(C*J,C*G,i*R,i*D);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+c)}}function WA(u,e){switch(e.constructor){case Float32Array:return u;case Uint16Array:return u/65535;case Uint8Array:return u/255;case Int16Array:return Math.max(u/32767,-1);case Int8Array:return Math.max(u/127,-1);default:throw new Error("Invalid component type.")}}function Us(u,e){switch(e.constructor){case Float32Array:return u;case Uint16Array:return Math.round(u*65535);case Uint8Array:return Math.round(u*255);case Int16Array:return Math.round(u*32767);case Int8Array:return Math.round(u*127);default:throw new Error("Invalid component type.")}}var PI=Object.freeze({__proto__:null,DEG2RAD:Af,RAD2DEG:j_,ceilPowerOfTwo:DI,clamp:Eo,damp:pz,degToRad:wz,denormalize:WA,euclideanModulo:O2,floorPowerOfTwo:pv,generateUUID:Pc,inverseLerp:dz,isPowerOfTwo:o2,lerp:I_,mapLinear:Az,normalize:Us,pingpong:fz,radToDeg:bz,randFloat:yz,randFloatSpread:xz,randInt:_z,seededRandom:vz,setQuaternionFromProperEuler:Bz,smootherstep:gz,smoothstep:mz});class Di{constructor(e=0,t=0){Di.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,c=e.elements;return this.x=c[0]*t+c[3]*r+c[6],this.y=c[1]*t+c[4]*r+c[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),c=Math.sin(t),p=this.x-e.x,y=this.y-e.y;return this.x=p*r-y*c+e.x,this.y=p*c+y*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Pl{constructor(){Pl.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,c,p,y,i,C,D){const R=this.elements;return R[0]=e,R[1]=c,R[2]=i,R[3]=t,R[4]=p,R[5]=C,R[6]=r,R[7]=y,R[8]=D,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,c=t.elements,p=this.elements,y=r[0],i=r[3],C=r[6],D=r[1],R=r[4],Q=r[7],z=r[2],G=r[5],J=r[8],Y=c[0],B=c[3],ae=c[6],ce=c[1],Ae=c[4],we=c[7],me=c[2],De=c[5],Je=c[8];return p[0]=y*Y+i*ce+C*me,p[3]=y*B+i*Ae+C*De,p[6]=y*ae+i*we+C*Je,p[1]=D*Y+R*ce+Q*me,p[4]=D*B+R*Ae+Q*De,p[7]=D*ae+R*we+Q*Je,p[2]=z*Y+G*ce+J*me,p[5]=z*B+G*Ae+J*De,p[8]=z*ae+G*we+J*Je,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],c=e[2],p=e[3],y=e[4],i=e[5],C=e[6],D=e[7],R=e[8];return t*y*R-t*i*D-r*p*R+r*i*C+c*p*D-c*y*C}invert(){const e=this.elements,t=e[0],r=e[1],c=e[2],p=e[3],y=e[4],i=e[5],C=e[6],D=e[7],R=e[8],Q=R*y-i*D,z=i*C-R*p,G=D*p-y*C,J=t*Q+r*z+c*G;if(J===0)return this.set(0,0,0,0,0,0,0,0,0);const Y=1/J;return e[0]=Q*Y,e[1]=(c*D-R*r)*Y,e[2]=(i*r-c*y)*Y,e[3]=z*Y,e[4]=(R*t-c*C)*Y,e[5]=(c*p-i*t)*Y,e[6]=G*Y,e[7]=(r*C-D*t)*Y,e[8]=(y*t-r*p)*Y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,c,p,y,i){const C=Math.cos(p),D=Math.sin(p);return this.set(r*C,r*D,-r*(C*y+D*i)+y+e,-c*D,c*C,-c*(-D*y+C*i)+i+t,0,0,1),this}scale(e,t){return this.premultiply(yw.makeScale(e,t)),this}rotate(e){return this.premultiply(yw.makeRotation(-e)),this}translate(e,t){return this.premultiply(yw.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let c=0;c<9;c++)if(t[c]!==r[c])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const yw=new Pl;function UI(u){for(let e=u.length-1;e>=0;--e)if(u[e]>=65535)return!0;return!1}const Cz={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Pm(u,e){return new Cz[u](e)}function K_(u){return document.createElementNS("http://www.w3.org/1999/xhtml",u)}function df(u){return u<.04045?u*.0773993808:Math.pow(u*.9478672986+.0521327014,2.4)}function qx(u){return u<.0031308?u*12.92:1.055*Math.pow(u,.41666)-.055}const xw={[cu]:{[Wm]:df},[Wm]:{[cu]:qx}},el={legacyMode:!0,get workingColorSpace(){return Wm},set workingColorSpace(u){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(u,e,t){if(this.legacyMode||e===t||!e||!t)return u;if(xw[e]&&xw[e][t]!==void 0){const r=xw[e][t];return u.r=r(u.r),u.g=r(u.g),u.b=r(u.b),u}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(u,e){return this.convert(u,this.workingColorSpace,e)},toWorkingColorSpace:function(u,e){return this.convert(u,e,this.workingColorSpace)}},RI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ia={r:0,g:0,b:0},su={h:0,s:0,l:0},X0={h:0,s:0,l:0};function vw(u,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?u+(e-u)*6*t:t<1/2?e:t<2/3?u+(e-u)*6*(2/3-t):u}function q0(u,e){return e.r=u.r,e.g=u.g,e.b=u.b,e}class Dn{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=cu){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,el.toWorkingColorSpace(this,t),this}setRGB(e,t,r,c=el.workingColorSpace){return this.r=e,this.g=t,this.b=r,el.toWorkingColorSpace(this,c),this}setHSL(e,t,r,c=el.workingColorSpace){if(e=O2(e,1),t=Eo(t,0,1),r=Eo(r,0,1),t===0)this.r=this.g=this.b=r;else{const p=r<=.5?r*(1+t):r+t-r*t,y=2*r-p;this.r=vw(y,p,e+1/3),this.g=vw(y,p,e),this.b=vw(y,p,e-1/3)}return el.toWorkingColorSpace(this,c),this}setStyle(e,t=cu){function r(p){p!==void 0&&parseFloat(p)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let c;if(c=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let p;const y=c[1],i=c[2];switch(y){case"rgb":case"rgba":if(p=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(p[1],10))/255,this.g=Math.min(255,parseInt(p[2],10))/255,this.b=Math.min(255,parseInt(p[3],10))/255,el.toWorkingColorSpace(this,t),r(p[4]),this;if(p=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(p[1],10))/100,this.g=Math.min(100,parseInt(p[2],10))/100,this.b=Math.min(100,parseInt(p[3],10))/100,el.toWorkingColorSpace(this,t),r(p[4]),this;break;case"hsl":case"hsla":if(p=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const C=parseFloat(p[1])/360,D=parseFloat(p[2])/100,R=parseFloat(p[3])/100;return r(p[4]),this.setHSL(C,D,R,t)}break}}else if(c=/^\#([A-Fa-f\d]+)$/.exec(e)){const p=c[1],y=p.length;if(y===3)return this.r=parseInt(p.charAt(0)+p.charAt(0),16)/255,this.g=parseInt(p.charAt(1)+p.charAt(1),16)/255,this.b=parseInt(p.charAt(2)+p.charAt(2),16)/255,el.toWorkingColorSpace(this,t),this;if(y===6)return this.r=parseInt(p.charAt(0)+p.charAt(1),16)/255,this.g=parseInt(p.charAt(2)+p.charAt(3),16)/255,this.b=parseInt(p.charAt(4)+p.charAt(5),16)/255,el.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=cu){const r=RI[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=df(e.r),this.g=df(e.g),this.b=df(e.b),this}copyLinearToSRGB(e){return this.r=qx(e.r),this.g=qx(e.g),this.b=qx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cu){return el.fromWorkingColorSpace(q0(this,ia),e),Eo(ia.r*255,0,255)<<16^Eo(ia.g*255,0,255)<<8^Eo(ia.b*255,0,255)<<0}getHexString(e=cu){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=el.workingColorSpace){el.fromWorkingColorSpace(q0(this,ia),t);const r=ia.r,c=ia.g,p=ia.b,y=Math.max(r,c,p),i=Math.min(r,c,p);let C,D;const R=(i+y)/2;if(i===y)C=0,D=0;else{const Q=y-i;switch(D=R<=.5?Q/(y+i):Q/(2-y-i),y){case r:C=(c-p)/Q+(c<p?6:0);break;case c:C=(p-r)/Q+2;break;case p:C=(r-c)/Q+4;break}C/=6}return e.h=C,e.s=D,e.l=R,e}getRGB(e,t=el.workingColorSpace){return el.fromWorkingColorSpace(q0(this,ia),t),e.r=ia.r,e.g=ia.g,e.b=ia.b,e}getStyle(e=cu){return el.fromWorkingColorSpace(q0(this,ia),e),e!==cu?`color(${e} ${ia.r} ${ia.g} ${ia.b})`:`rgb(${ia.r*255|0},${ia.g*255|0},${ia.b*255|0})`}offsetHSL(e,t,r){return this.getHSL(su),su.h+=e,su.s+=t,su.l+=r,this.setHSL(su.h,su.s,su.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(su),e.getHSL(X0);const r=I_(su.h,X0.h,t),c=I_(su.s,X0.s,t),p=I_(su.l,X0.l,t);return this.setHSL(r,c,p),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Dn.NAMES=RI;let lm;class N2{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{lm===void 0&&(lm=K_("canvas")),lm.width=e.width,lm.height=e.height;const r=lm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=lm}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=K_("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const c=r.getImageData(0,0,e.width,e.height),p=c.data;for(let y=0;y<p.length;y++)p[y]=df(p[y]/255)*255;return r.putImageData(c,0,0),t}else if(e.data){const t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(df(t[r]/255)*255):t[r]=df(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class of{constructor(e=null){this.isSource=!0,this.uuid=Pc(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},c=this.data;if(c!==null){let p;if(Array.isArray(c)){p=[];for(let y=0,i=c.length;y<i;y++)c[y].isDataTexture?p.push(ww(c[y].image)):p.push(ww(c[y]))}else p=ww(c);r.url=p}return t||(e.images[this.uuid]=r),r}}function ww(u){return typeof HTMLImageElement<"u"&&u instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&u instanceof ImageBitmap?N2.getDataURL(u):u.data?{data:Array.from(u.data),width:u.width,height:u.height,type:u.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Ez=0;class To extends Xu{constructor(e=To.DEFAULT_IMAGE,t=To.DEFAULT_MAPPING,r=nl,c=nl,p=Xs,y=op,i=Dl,C=ap,D=To.DEFAULT_ANISOTROPY,R=lp){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ez++}),this.uuid=Pc(),this.name="",this.source=new of(e),this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=c,this.magFilter=p,this.minFilter=y,this.anisotropy=D,this.format=i,this.internalFormat=null,this.type=C,this.offset=new Di(0,0),this.repeat=new Di(1,1),this.center=new Di(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pl,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=R,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==kv)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case HA:e.x=e.x-Math.floor(e.x);break;case nl:e.x=e.x<0?0:1;break;case Q_:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case HA:e.y=e.y-Math.floor(e.y);break;case nl:e.y=e.y<0?0:1;break;case Q_:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}To.DEFAULT_IMAGE=null;To.DEFAULT_MAPPING=kv;To.DEFAULT_ANISOTROPY=1;class as{constructor(e=0,t=0,r=0,c=1){as.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=c}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,c){return this.x=e,this.y=t,this.z=r,this.w=c,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,c=this.z,p=this.w,y=e.elements;return this.x=y[0]*t+y[4]*r+y[8]*c+y[12]*p,this.y=y[1]*t+y[5]*r+y[9]*c+y[13]*p,this.z=y[2]*t+y[6]*r+y[10]*c+y[14]*p,this.w=y[3]*t+y[7]*r+y[11]*c+y[15]*p,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,c,p;const C=e.elements,D=C[0],R=C[4],Q=C[8],z=C[1],G=C[5],J=C[9],Y=C[2],B=C[6],ae=C[10];if(Math.abs(R-z)<.01&&Math.abs(Q-Y)<.01&&Math.abs(J-B)<.01){if(Math.abs(R+z)<.1&&Math.abs(Q+Y)<.1&&Math.abs(J+B)<.1&&Math.abs(D+G+ae-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const Ae=(D+1)/2,we=(G+1)/2,me=(ae+1)/2,De=(R+z)/4,Je=(Q+Y)/4,Fe=(J+B)/4;return Ae>we&&Ae>me?Ae<.01?(r=0,c=.707106781,p=.707106781):(r=Math.sqrt(Ae),c=De/r,p=Je/r):we>me?we<.01?(r=.707106781,c=0,p=.707106781):(c=Math.sqrt(we),r=De/c,p=Fe/c):me<.01?(r=.707106781,c=.707106781,p=0):(p=Math.sqrt(me),r=Je/p,c=Fe/p),this.set(r,c,p,t),this}let ce=Math.sqrt((B-J)*(B-J)+(Q-Y)*(Q-Y)+(z-R)*(z-R));return Math.abs(ce)<.001&&(ce=1),this.x=(B-J)/ce,this.y=(Q-Y)/ce,this.z=(z-R)/ce,this.w=Math.acos((D+G+ae-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class rl extends Xu{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new as(0,0,e,t),this.scissorTest=!1,this.viewport=new as(0,0,e,t);const c={width:e,height:t,depth:1};this.texture=new To(c,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:Xs,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new of(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Nv extends To{constructor(e=null,t=1,r=1,c=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:c},this.magFilter=Co,this.minFilter=Co,this.wrapR=nl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Tz extends rl{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new Nv(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class Q2 extends To{constructor(e=null,t=1,r=1,c=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:c},this.magFilter=Co,this.minFilter=Co,this.wrapR=nl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Sz extends rl{constructor(e=1,t=1,r=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new Q2(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class Mz extends rl{constructor(e=1,t=1,r=1,c={}){super(e,t,c),this.isWebGLMultipleRenderTargets=!0;const p=this.texture;this.texture=[];for(let y=0;y<r;y++)this.texture[y]=p.clone(),this.texture[y].isRenderTargetTexture=!0}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let c=0,p=this.texture.length;c<p;c++)this.texture[c].image.width=e,this.texture[c].image.height=t,this.texture[c].image.depth=r;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class sl{constructor(e=0,t=0,r=0,c=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=c}static slerpFlat(e,t,r,c,p,y,i){let C=r[c+0],D=r[c+1],R=r[c+2],Q=r[c+3];const z=p[y+0],G=p[y+1],J=p[y+2],Y=p[y+3];if(i===0){e[t+0]=C,e[t+1]=D,e[t+2]=R,e[t+3]=Q;return}if(i===1){e[t+0]=z,e[t+1]=G,e[t+2]=J,e[t+3]=Y;return}if(Q!==Y||C!==z||D!==G||R!==J){let B=1-i;const ae=C*z+D*G+R*J+Q*Y,ce=ae>=0?1:-1,Ae=1-ae*ae;if(Ae>Number.EPSILON){const me=Math.sqrt(Ae),De=Math.atan2(me,ae*ce);B=Math.sin(B*De)/me,i=Math.sin(i*De)/me}const we=i*ce;if(C=C*B+z*we,D=D*B+G*we,R=R*B+J*we,Q=Q*B+Y*we,B===1-i){const me=1/Math.sqrt(C*C+D*D+R*R+Q*Q);C*=me,D*=me,R*=me,Q*=me}}e[t]=C,e[t+1]=D,e[t+2]=R,e[t+3]=Q}static multiplyQuaternionsFlat(e,t,r,c,p,y){const i=r[c],C=r[c+1],D=r[c+2],R=r[c+3],Q=p[y],z=p[y+1],G=p[y+2],J=p[y+3];return e[t]=i*J+R*Q+C*G-D*z,e[t+1]=C*J+R*z+D*Q-i*G,e[t+2]=D*J+R*G+i*z-C*Q,e[t+3]=R*J-i*Q-C*z-D*G,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,c){return this._x=e,this._y=t,this._z=r,this._w=c,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,c=e._y,p=e._z,y=e._order,i=Math.cos,C=Math.sin,D=i(r/2),R=i(c/2),Q=i(p/2),z=C(r/2),G=C(c/2),J=C(p/2);switch(y){case"XYZ":this._x=z*R*Q+D*G*J,this._y=D*G*Q-z*R*J,this._z=D*R*J+z*G*Q,this._w=D*R*Q-z*G*J;break;case"YXZ":this._x=z*R*Q+D*G*J,this._y=D*G*Q-z*R*J,this._z=D*R*J-z*G*Q,this._w=D*R*Q+z*G*J;break;case"ZXY":this._x=z*R*Q-D*G*J,this._y=D*G*Q+z*R*J,this._z=D*R*J+z*G*Q,this._w=D*R*Q-z*G*J;break;case"ZYX":this._x=z*R*Q-D*G*J,this._y=D*G*Q+z*R*J,this._z=D*R*J-z*G*Q,this._w=D*R*Q+z*G*J;break;case"YZX":this._x=z*R*Q+D*G*J,this._y=D*G*Q+z*R*J,this._z=D*R*J-z*G*Q,this._w=D*R*Q-z*G*J;break;case"XZY":this._x=z*R*Q-D*G*J,this._y=D*G*Q-z*R*J,this._z=D*R*J+z*G*Q,this._w=D*R*Q+z*G*J;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+y)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,c=Math.sin(r);return this._x=e.x*c,this._y=e.y*c,this._z=e.z*c,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],c=t[4],p=t[8],y=t[1],i=t[5],C=t[9],D=t[2],R=t[6],Q=t[10],z=r+i+Q;if(z>0){const G=.5/Math.sqrt(z+1);this._w=.25/G,this._x=(R-C)*G,this._y=(p-D)*G,this._z=(y-c)*G}else if(r>i&&r>Q){const G=2*Math.sqrt(1+r-i-Q);this._w=(R-C)/G,this._x=.25*G,this._y=(c+y)/G,this._z=(p+D)/G}else if(i>Q){const G=2*Math.sqrt(1+i-r-Q);this._w=(p-D)/G,this._x=(c+y)/G,this._y=.25*G,this._z=(C+R)/G}else{const G=2*Math.sqrt(1+Q-r-i);this._w=(y-c)/G,this._x=(p+D)/G,this._y=(C+R)/G,this._z=.25*G}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Eo(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const c=Math.min(1,t/r);return this.slerp(e,c),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,c=e._y,p=e._z,y=e._w,i=t._x,C=t._y,D=t._z,R=t._w;return this._x=r*R+y*i+c*D-p*C,this._y=c*R+y*C+p*i-r*D,this._z=p*R+y*D+r*C-c*i,this._w=y*R-r*i-c*C-p*D,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,c=this._y,p=this._z,y=this._w;let i=y*e._w+r*e._x+c*e._y+p*e._z;if(i<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,i=-i):this.copy(e),i>=1)return this._w=y,this._x=r,this._y=c,this._z=p,this;const C=1-i*i;if(C<=Number.EPSILON){const G=1-t;return this._w=G*y+t*this._w,this._x=G*r+t*this._x,this._y=G*c+t*this._y,this._z=G*p+t*this._z,this.normalize(),this._onChangeCallback(),this}const D=Math.sqrt(C),R=Math.atan2(D,i),Q=Math.sin((1-t)*R)/D,z=Math.sin(t*R)/D;return this._w=y*Q+this._w*z,this._x=r*Q+this._x*z,this._y=c*Q+this._y*z,this._z=p*Q+this._z*z,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),c=2*Math.PI*Math.random(),p=2*Math.PI*Math.random();return this.set(t*Math.cos(c),r*Math.sin(p),r*Math.cos(p),t*Math.sin(c))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ft{constructor(e=0,t=0,r=0){ft.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(kE.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(kE.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,c=this.z,p=e.elements;return this.x=p[0]*t+p[3]*r+p[6]*c,this.y=p[1]*t+p[4]*r+p[7]*c,this.z=p[2]*t+p[5]*r+p[8]*c,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,c=this.z,p=e.elements,y=1/(p[3]*t+p[7]*r+p[11]*c+p[15]);return this.x=(p[0]*t+p[4]*r+p[8]*c+p[12])*y,this.y=(p[1]*t+p[5]*r+p[9]*c+p[13])*y,this.z=(p[2]*t+p[6]*r+p[10]*c+p[14])*y,this}applyQuaternion(e){const t=this.x,r=this.y,c=this.z,p=e.x,y=e.y,i=e.z,C=e.w,D=C*t+y*c-i*r,R=C*r+i*t-p*c,Q=C*c+p*r-y*t,z=-p*t-y*r-i*c;return this.x=D*C+z*-p+R*-i-Q*-y,this.y=R*C+z*-y+Q*-p-D*-i,this.z=Q*C+z*-i+D*-y-R*-p,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,c=this.z,p=e.elements;return this.x=p[0]*t+p[4]*r+p[8]*c,this.y=p[1]*t+p[5]*r+p[9]*c,this.z=p[2]*t+p[6]*r+p[10]*c,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,c=e.y,p=e.z,y=t.x,i=t.y,C=t.z;return this.x=c*C-p*i,this.y=p*y-r*C,this.z=r*i-c*y,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return bw.copy(this).projectOnVector(e),this.sub(bw)}reflect(e){return this.sub(bw.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(Eo(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,c=this.z-e.z;return t*t+r*r+c*c}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const c=Math.sin(t)*e;return this.x=c*Math.sin(r),this.y=Math.cos(t)*e,this.z=c*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),c=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=c,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const bw=new ft,kE=new sl;class qu{constructor(e=new ft(1/0,1/0,1/0),t=new ft(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,r=1/0,c=1/0,p=-1/0,y=-1/0,i=-1/0;for(let C=0,D=e.length;C<D;C+=3){const R=e[C],Q=e[C+1],z=e[C+2];R<t&&(t=R),Q<r&&(r=Q),z<c&&(c=z),R>p&&(p=R),Q>y&&(y=Q),z>i&&(i=z)}return this.min.set(t,r,c),this.max.set(p,y,i),this}setFromBufferAttribute(e){let t=1/0,r=1/0,c=1/0,p=-1/0,y=-1/0,i=-1/0;for(let C=0,D=e.count;C<D;C++){const R=e.getX(C),Q=e.getY(C),z=e.getZ(C);R<t&&(t=R),Q<r&&(r=Q),z<c&&(c=z),R>p&&(p=R),Q>y&&(y=Q),z>i&&(i=z)}return this.min.set(t,r,c),this.max.set(p,y,i),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=kp.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0)if(t&&r.attributes!=null&&r.attributes.position!==void 0){const p=r.attributes.position;for(let y=0,i=p.count;y<i;y++)kp.fromBufferAttribute(p,y).applyMatrix4(e.matrixWorld),this.expandByPoint(kp)}else r.boundingBox===null&&r.computeBoundingBox(),Bw.copy(r.boundingBox),Bw.applyMatrix4(e.matrixWorld),this.union(Bw);const c=e.children;for(let p=0,y=c.length;p<y;p++)this.expandByObject(c[p],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,kp),kp.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(t_),Y0.subVectors(this.max,t_),cm.subVectors(e.a,t_),hm.subVectors(e.b,t_),um.subVectors(e.c,t_),Rd.subVectors(hm,cm),zd.subVectors(um,hm),Op.subVectors(cm,um);let t=[0,-Rd.z,Rd.y,0,-zd.z,zd.y,0,-Op.z,Op.y,Rd.z,0,-Rd.x,zd.z,0,-zd.x,Op.z,0,-Op.x,-Rd.y,Rd.x,0,-zd.y,zd.x,0,-Op.y,Op.x,0];return!Cw(t,cm,hm,um,Y0)||(t=[1,0,0,0,1,0,0,0,1],!Cw(t,cm,hm,um,Y0))?!1:(J0.crossVectors(Rd,zd),t=[J0.x,J0.y,J0.z],Cw(t,cm,hm,um,Y0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return kp.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(kp).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(RA[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),RA[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),RA[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),RA[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),RA[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),RA[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),RA[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),RA[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(RA),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const RA=[new ft,new ft,new ft,new ft,new ft,new ft,new ft,new ft],kp=new ft,Bw=new qu,cm=new ft,hm=new ft,um=new ft,Rd=new ft,zd=new ft,Op=new ft,t_=new ft,Y0=new ft,J0=new ft,Np=new ft;function Cw(u,e,t,r,c){for(let p=0,y=u.length-3;p<=y;p+=3){Np.fromArray(u,p);const i=c.x*Math.abs(Np.x)+c.y*Math.abs(Np.y)+c.z*Math.abs(Np.z),C=e.dot(Np),D=t.dot(Np),R=r.dot(Np);if(Math.max(-Math.max(C,D,R),Math.min(C,D,R))>i)return!1}return!0}const Iz=new qu,i_=new ft,Ew=new ft;class XA{constructor(e=new ft,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):Iz.setFromPoints(e).getCenter(r);let c=0;for(let p=0,y=e.length;p<y;p++)c=Math.max(c,r.distanceToSquared(e[p]));return this.radius=Math.sqrt(c),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;i_.subVectors(e,this.center);const t=i_.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),c=(r-this.radius)*.5;this.center.addScaledVector(i_,c/r),this.radius+=c}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Ew.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(i_.copy(e.center).add(Ew)),this.expandByPoint(i_.copy(e.center).sub(Ew))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const zA=new ft,Tw=new ft,ex=new ft,kd=new ft,Sw=new ft,tx=new ft,Mw=new ft;class cy{constructor(e=new ft,t=new ft(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,zA)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=zA.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(zA.copy(this.direction).multiplyScalar(t).add(this.origin),zA.distanceToSquared(e))}distanceSqToSegment(e,t,r,c){Tw.copy(e).add(t).multiplyScalar(.5),ex.copy(t).sub(e).normalize(),kd.copy(this.origin).sub(Tw);const p=e.distanceTo(t)*.5,y=-this.direction.dot(ex),i=kd.dot(this.direction),C=-kd.dot(ex),D=kd.lengthSq(),R=Math.abs(1-y*y);let Q,z,G,J;if(R>0)if(Q=y*C-i,z=y*i-C,J=p*R,Q>=0)if(z>=-J)if(z<=J){const Y=1/R;Q*=Y,z*=Y,G=Q*(Q+y*z+2*i)+z*(y*Q+z+2*C)+D}else z=p,Q=Math.max(0,-(y*z+i)),G=-Q*Q+z*(z+2*C)+D;else z=-p,Q=Math.max(0,-(y*z+i)),G=-Q*Q+z*(z+2*C)+D;else z<=-J?(Q=Math.max(0,-(-y*p+i)),z=Q>0?-p:Math.min(Math.max(-p,-C),p),G=-Q*Q+z*(z+2*C)+D):z<=J?(Q=0,z=Math.min(Math.max(-p,-C),p),G=z*(z+2*C)+D):(Q=Math.max(0,-(y*p+i)),z=Q>0?p:Math.min(Math.max(-p,-C),p),G=-Q*Q+z*(z+2*C)+D);else z=y>0?-p:p,Q=Math.max(0,-(y*z+i)),G=-Q*Q+z*(z+2*C)+D;return r&&r.copy(this.direction).multiplyScalar(Q).add(this.origin),c&&c.copy(ex).multiplyScalar(z).add(Tw),G}intersectSphere(e,t){zA.subVectors(e.center,this.origin);const r=zA.dot(this.direction),c=zA.dot(zA)-r*r,p=e.radius*e.radius;if(c>p)return null;const y=Math.sqrt(p-c),i=r-y,C=r+y;return i<0&&C<0?null:i<0?this.at(C,t):this.at(i,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,c,p,y,i,C;const D=1/this.direction.x,R=1/this.direction.y,Q=1/this.direction.z,z=this.origin;return D>=0?(r=(e.min.x-z.x)*D,c=(e.max.x-z.x)*D):(r=(e.max.x-z.x)*D,c=(e.min.x-z.x)*D),R>=0?(p=(e.min.y-z.y)*R,y=(e.max.y-z.y)*R):(p=(e.max.y-z.y)*R,y=(e.min.y-z.y)*R),r>y||p>c||((p>r||isNaN(r))&&(r=p),(y<c||isNaN(c))&&(c=y),Q>=0?(i=(e.min.z-z.z)*Q,C=(e.max.z-z.z)*Q):(i=(e.max.z-z.z)*Q,C=(e.min.z-z.z)*Q),r>C||i>c)||((i>r||r!==r)&&(r=i),(C<c||c!==c)&&(c=C),c<0)?null:this.at(r>=0?r:c,t)}intersectsBox(e){return this.intersectBox(e,zA)!==null}intersectTriangle(e,t,r,c,p){Sw.subVectors(t,e),tx.subVectors(r,e),Mw.crossVectors(Sw,tx);let y=this.direction.dot(Mw),i;if(y>0){if(c)return null;i=1}else if(y<0)i=-1,y=-y;else return null;kd.subVectors(this.origin,e);const C=i*this.direction.dot(tx.crossVectors(kd,tx));if(C<0)return null;const D=i*this.direction.dot(Sw.cross(kd));if(D<0||C+D>y)return null;const R=-i*kd.dot(Mw);return R<0?null:this.at(R/y,p)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ar{constructor(){ar.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,c,p,y,i,C,D,R,Q,z,G,J,Y,B){const ae=this.elements;return ae[0]=e,ae[4]=t,ae[8]=r,ae[12]=c,ae[1]=p,ae[5]=y,ae[9]=i,ae[13]=C,ae[2]=D,ae[6]=R,ae[10]=Q,ae[14]=z,ae[3]=G,ae[7]=J,ae[11]=Y,ae[15]=B,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ar().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,c=1/Am.setFromMatrixColumn(e,0).length(),p=1/Am.setFromMatrixColumn(e,1).length(),y=1/Am.setFromMatrixColumn(e,2).length();return t[0]=r[0]*c,t[1]=r[1]*c,t[2]=r[2]*c,t[3]=0,t[4]=r[4]*p,t[5]=r[5]*p,t[6]=r[6]*p,t[7]=0,t[8]=r[8]*y,t[9]=r[9]*y,t[10]=r[10]*y,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,c=e.y,p=e.z,y=Math.cos(r),i=Math.sin(r),C=Math.cos(c),D=Math.sin(c),R=Math.cos(p),Q=Math.sin(p);if(e.order==="XYZ"){const z=y*R,G=y*Q,J=i*R,Y=i*Q;t[0]=C*R,t[4]=-C*Q,t[8]=D,t[1]=G+J*D,t[5]=z-Y*D,t[9]=-i*C,t[2]=Y-z*D,t[6]=J+G*D,t[10]=y*C}else if(e.order==="YXZ"){const z=C*R,G=C*Q,J=D*R,Y=D*Q;t[0]=z+Y*i,t[4]=J*i-G,t[8]=y*D,t[1]=y*Q,t[5]=y*R,t[9]=-i,t[2]=G*i-J,t[6]=Y+z*i,t[10]=y*C}else if(e.order==="ZXY"){const z=C*R,G=C*Q,J=D*R,Y=D*Q;t[0]=z-Y*i,t[4]=-y*Q,t[8]=J+G*i,t[1]=G+J*i,t[5]=y*R,t[9]=Y-z*i,t[2]=-y*D,t[6]=i,t[10]=y*C}else if(e.order==="ZYX"){const z=y*R,G=y*Q,J=i*R,Y=i*Q;t[0]=C*R,t[4]=J*D-G,t[8]=z*D+Y,t[1]=C*Q,t[5]=Y*D+z,t[9]=G*D-J,t[2]=-D,t[6]=i*C,t[10]=y*C}else if(e.order==="YZX"){const z=y*C,G=y*D,J=i*C,Y=i*D;t[0]=C*R,t[4]=Y-z*Q,t[8]=J*Q+G,t[1]=Q,t[5]=y*R,t[9]=-i*R,t[2]=-D*R,t[6]=G*Q+J,t[10]=z-Y*Q}else if(e.order==="XZY"){const z=y*C,G=y*D,J=i*C,Y=i*D;t[0]=C*R,t[4]=-Q,t[8]=D*R,t[1]=z*Q+Y,t[5]=y*R,t[9]=G*Q-J,t[2]=J*Q-G,t[6]=i*R,t[10]=Y*Q+z}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Fz,e,Lz)}lookAt(e,t,r){const c=this.elements;return Sc.subVectors(e,t),Sc.lengthSq()===0&&(Sc.z=1),Sc.normalize(),Od.crossVectors(r,Sc),Od.lengthSq()===0&&(Math.abs(r.z)===1?Sc.x+=1e-4:Sc.z+=1e-4,Sc.normalize(),Od.crossVectors(r,Sc)),Od.normalize(),ix.crossVectors(Sc,Od),c[0]=Od.x,c[4]=ix.x,c[8]=Sc.x,c[1]=Od.y,c[5]=ix.y,c[9]=Sc.y,c[2]=Od.z,c[6]=ix.z,c[10]=Sc.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,c=t.elements,p=this.elements,y=r[0],i=r[4],C=r[8],D=r[12],R=r[1],Q=r[5],z=r[9],G=r[13],J=r[2],Y=r[6],B=r[10],ae=r[14],ce=r[3],Ae=r[7],we=r[11],me=r[15],De=c[0],Je=c[4],Fe=c[8],Ge=c[12],Et=c[1],li=c[5],xi=c[9],te=c[13],le=c[2],ye=c[6],xe=c[10],Re=c[14],Oe=c[3],We=c[7],Ve=c[11],Qe=c[15];return p[0]=y*De+i*Et+C*le+D*Oe,p[4]=y*Je+i*li+C*ye+D*We,p[8]=y*Fe+i*xi+C*xe+D*Ve,p[12]=y*Ge+i*te+C*Re+D*Qe,p[1]=R*De+Q*Et+z*le+G*Oe,p[5]=R*Je+Q*li+z*ye+G*We,p[9]=R*Fe+Q*xi+z*xe+G*Ve,p[13]=R*Ge+Q*te+z*Re+G*Qe,p[2]=J*De+Y*Et+B*le+ae*Oe,p[6]=J*Je+Y*li+B*ye+ae*We,p[10]=J*Fe+Y*xi+B*xe+ae*Ve,p[14]=J*Ge+Y*te+B*Re+ae*Qe,p[3]=ce*De+Ae*Et+we*le+me*Oe,p[7]=ce*Je+Ae*li+we*ye+me*We,p[11]=ce*Fe+Ae*xi+we*xe+me*Ve,p[15]=ce*Ge+Ae*te+we*Re+me*Qe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],c=e[8],p=e[12],y=e[1],i=e[5],C=e[9],D=e[13],R=e[2],Q=e[6],z=e[10],G=e[14],J=e[3],Y=e[7],B=e[11],ae=e[15];return J*(+p*C*Q-c*D*Q-p*i*z+r*D*z+c*i*G-r*C*G)+Y*(+t*C*G-t*D*z+p*y*z-c*y*G+c*D*R-p*C*R)+B*(+t*D*Q-t*i*G-p*y*Q+r*y*G+p*i*R-r*D*R)+ae*(-c*i*R-t*C*Q+t*i*z+c*y*Q-r*y*z+r*C*R)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const c=this.elements;return e.isVector3?(c[12]=e.x,c[13]=e.y,c[14]=e.z):(c[12]=e,c[13]=t,c[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],c=e[2],p=e[3],y=e[4],i=e[5],C=e[6],D=e[7],R=e[8],Q=e[9],z=e[10],G=e[11],J=e[12],Y=e[13],B=e[14],ae=e[15],ce=Q*B*D-Y*z*D+Y*C*G-i*B*G-Q*C*ae+i*z*ae,Ae=J*z*D-R*B*D-J*C*G+y*B*G+R*C*ae-y*z*ae,we=R*Y*D-J*Q*D+J*i*G-y*Y*G-R*i*ae+y*Q*ae,me=J*Q*C-R*Y*C-J*i*z+y*Y*z+R*i*B-y*Q*B,De=t*ce+r*Ae+c*we+p*me;if(De===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Je=1/De;return e[0]=ce*Je,e[1]=(Y*z*p-Q*B*p-Y*c*G+r*B*G+Q*c*ae-r*z*ae)*Je,e[2]=(i*B*p-Y*C*p+Y*c*D-r*B*D-i*c*ae+r*C*ae)*Je,e[3]=(Q*C*p-i*z*p-Q*c*D+r*z*D+i*c*G-r*C*G)*Je,e[4]=Ae*Je,e[5]=(R*B*p-J*z*p+J*c*G-t*B*G-R*c*ae+t*z*ae)*Je,e[6]=(J*C*p-y*B*p-J*c*D+t*B*D+y*c*ae-t*C*ae)*Je,e[7]=(y*z*p-R*C*p+R*c*D-t*z*D-y*c*G+t*C*G)*Je,e[8]=we*Je,e[9]=(J*Q*p-R*Y*p-J*r*G+t*Y*G+R*r*ae-t*Q*ae)*Je,e[10]=(y*Y*p-J*i*p+J*r*D-t*Y*D-y*r*ae+t*i*ae)*Je,e[11]=(R*i*p-y*Q*p-R*r*D+t*Q*D+y*r*G-t*i*G)*Je,e[12]=me*Je,e[13]=(R*Y*c-J*Q*c+J*r*z-t*Y*z-R*r*B+t*Q*B)*Je,e[14]=(J*i*c-y*Y*c-J*r*C+t*Y*C+y*r*B-t*i*B)*Je,e[15]=(y*Q*c-R*i*c+R*r*C-t*Q*C-y*r*z+t*i*z)*Je,this}scale(e){const t=this.elements,r=e.x,c=e.y,p=e.z;return t[0]*=r,t[4]*=c,t[8]*=p,t[1]*=r,t[5]*=c,t[9]*=p,t[2]*=r,t[6]*=c,t[10]*=p,t[3]*=r,t[7]*=c,t[11]*=p,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],c=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,c))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),c=Math.sin(t),p=1-r,y=e.x,i=e.y,C=e.z,D=p*y,R=p*i;return this.set(D*y+r,D*i-c*C,D*C+c*i,0,D*i+c*C,R*i+r,R*C-c*y,0,D*C-c*i,R*C+c*y,p*C*C+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,c,p,y){return this.set(1,r,p,0,e,1,y,0,t,c,1,0,0,0,0,1),this}compose(e,t,r){const c=this.elements,p=t._x,y=t._y,i=t._z,C=t._w,D=p+p,R=y+y,Q=i+i,z=p*D,G=p*R,J=p*Q,Y=y*R,B=y*Q,ae=i*Q,ce=C*D,Ae=C*R,we=C*Q,me=r.x,De=r.y,Je=r.z;return c[0]=(1-(Y+ae))*me,c[1]=(G+we)*me,c[2]=(J-Ae)*me,c[3]=0,c[4]=(G-we)*De,c[5]=(1-(z+ae))*De,c[6]=(B+ce)*De,c[7]=0,c[8]=(J+Ae)*Je,c[9]=(B-ce)*Je,c[10]=(1-(z+Y))*Je,c[11]=0,c[12]=e.x,c[13]=e.y,c[14]=e.z,c[15]=1,this}decompose(e,t,r){const c=this.elements;let p=Am.set(c[0],c[1],c[2]).length();const y=Am.set(c[4],c[5],c[6]).length(),i=Am.set(c[8],c[9],c[10]).length();this.determinant()<0&&(p=-p),e.x=c[12],e.y=c[13],e.z=c[14],ou.copy(this);const D=1/p,R=1/y,Q=1/i;return ou.elements[0]*=D,ou.elements[1]*=D,ou.elements[2]*=D,ou.elements[4]*=R,ou.elements[5]*=R,ou.elements[6]*=R,ou.elements[8]*=Q,ou.elements[9]*=Q,ou.elements[10]*=Q,t.setFromRotationMatrix(ou),r.x=p,r.y=y,r.z=i,this}makePerspective(e,t,r,c,p,y){const i=this.elements,C=2*p/(t-e),D=2*p/(r-c),R=(t+e)/(t-e),Q=(r+c)/(r-c),z=-(y+p)/(y-p),G=-2*y*p/(y-p);return i[0]=C,i[4]=0,i[8]=R,i[12]=0,i[1]=0,i[5]=D,i[9]=Q,i[13]=0,i[2]=0,i[6]=0,i[10]=z,i[14]=G,i[3]=0,i[7]=0,i[11]=-1,i[15]=0,this}makeOrthographic(e,t,r,c,p,y){const i=this.elements,C=1/(t-e),D=1/(r-c),R=1/(y-p),Q=(t+e)*C,z=(r+c)*D,G=(y+p)*R;return i[0]=2*C,i[4]=0,i[8]=0,i[12]=-Q,i[1]=0,i[5]=2*D,i[9]=0,i[13]=-z,i[2]=0,i[6]=0,i[10]=-2*R,i[14]=-G,i[3]=0,i[7]=0,i[11]=0,i[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let c=0;c<16;c++)if(t[c]!==r[c])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const Am=new ft,ou=new ar,Fz=new ft(0,0,0),Lz=new ft(1,1,1),Od=new ft,ix=new ft,Sc=new ft,OE=new ar,NE=new sl;class hy{constructor(e=0,t=0,r=0,c=hy.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=c}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,c=this._order){return this._x=e,this._y=t,this._z=r,this._order=c,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const c=e.elements,p=c[0],y=c[4],i=c[8],C=c[1],D=c[5],R=c[9],Q=c[2],z=c[6],G=c[10];switch(t){case"XYZ":this._y=Math.asin(Eo(i,-1,1)),Math.abs(i)<.9999999?(this._x=Math.atan2(-R,G),this._z=Math.atan2(-y,p)):(this._x=Math.atan2(z,D),this._z=0);break;case"YXZ":this._x=Math.asin(-Eo(R,-1,1)),Math.abs(R)<.9999999?(this._y=Math.atan2(i,G),this._z=Math.atan2(C,D)):(this._y=Math.atan2(-Q,p),this._z=0);break;case"ZXY":this._x=Math.asin(Eo(z,-1,1)),Math.abs(z)<.9999999?(this._y=Math.atan2(-Q,G),this._z=Math.atan2(-y,D)):(this._y=0,this._z=Math.atan2(C,p));break;case"ZYX":this._y=Math.asin(-Eo(Q,-1,1)),Math.abs(Q)<.9999999?(this._x=Math.atan2(z,G),this._z=Math.atan2(C,p)):(this._x=0,this._z=Math.atan2(-y,D));break;case"YZX":this._z=Math.asin(Eo(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(-R,D),this._y=Math.atan2(-Q,p)):(this._x=0,this._y=Math.atan2(i,G));break;case"XZY":this._z=Math.asin(-Eo(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(z,D),this._y=Math.atan2(i,p)):(this._x=Math.atan2(-R,G),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return OE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(OE,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return NE.setFromEuler(this),this.setFromQuaternion(NE,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}hy.DEFAULT_ORDER="XYZ";class uy{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Dz=0;const QE=new ft,dm=new sl,kA=new ar,nx=new ft,n_=new ft,Pz=new ft,Uz=new sl,VE=new ft(1,0,0),HE=new ft(0,1,0),GE=new ft(0,0,1),Rz={type:"added"},WE={type:"removed"};class ls extends Xu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Dz++}),this.uuid=Pc(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ls.DEFAULT_UP.clone();const e=new ft,t=new hy,r=new sl,c=new ft(1,1,1);function p(){r.setFromEuler(t,!1)}function y(){t.setFromQuaternion(r,void 0,!1)}t._onChange(p),r._onChange(y),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:c},modelViewMatrix:{value:new ar},normalMatrix:{value:new Pl}}),this.matrix=new ar,this.matrixWorld=new ar,this.matrixAutoUpdate=ls.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=ls.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new uy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return dm.setFromAxisAngle(e,t),this.quaternion.multiply(dm),this}rotateOnWorldAxis(e,t){return dm.setFromAxisAngle(e,t),this.quaternion.premultiply(dm),this}rotateX(e){return this.rotateOnAxis(VE,e)}rotateY(e){return this.rotateOnAxis(HE,e)}rotateZ(e){return this.rotateOnAxis(GE,e)}translateOnAxis(e,t){return QE.copy(e).applyQuaternion(this.quaternion),this.position.add(QE.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(VE,e)}translateY(e){return this.translateOnAxis(HE,e)}translateZ(e){return this.translateOnAxis(GE,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(kA.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?nx.copy(e):nx.set(e,t,r);const c=this.parent;this.updateWorldMatrix(!0,!1),n_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?kA.lookAt(n_,nx,this.up):kA.lookAt(nx,n_,this.up),this.quaternion.setFromRotationMatrix(kA),c&&(kA.extractRotation(c.matrixWorld),dm.setFromRotationMatrix(kA),this.quaternion.premultiply(dm.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Rz)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(WE)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(WE)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),kA.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),kA.multiply(e.parent.matrixWorld)),e.applyMatrix4(kA),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,c=this.children.length;r<c;r++){const y=this.children[r].getObjectByProperty(e,t);if(y!==void 0)return y}}getObjectsByProperty(e,t){let r=[];this[e]===t&&r.push(this);for(let c=0,p=this.children.length;c<p;c++){const y=this.children[c].getObjectsByProperty(e,t);y.length>0&&(r=r.concat(y))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n_,e,Pz),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n_,Uz,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,c=t.length;r<c;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let r=0,c=t.length;r<c;r++)t[r].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let r=0,c=t.length;r<c;r++){const p=t[r];(p.matrixWorldAutoUpdate===!0||e===!0)&&p.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const r=this.parent;if(e===!0&&r!==null&&r.matrixWorldAutoUpdate===!0&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const c=this.children;for(let p=0,y=c.length;p<y;p++){const i=c[p];i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const c={};c.uuid=this.uuid,c.type=this.type,this.name!==""&&(c.name=this.name),this.castShadow===!0&&(c.castShadow=!0),this.receiveShadow===!0&&(c.receiveShadow=!0),this.visible===!1&&(c.visible=!1),this.frustumCulled===!1&&(c.frustumCulled=!1),this.renderOrder!==0&&(c.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(c.userData=this.userData),c.layers=this.layers.mask,c.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(c.matrixAutoUpdate=!1),this.isInstancedMesh&&(c.type="InstancedMesh",c.count=this.count,c.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(c.instanceColor=this.instanceColor.toJSON()));function p(i,C){return i[C.uuid]===void 0&&(i[C.uuid]=C.toJSON(e)),C.uuid}if(this.isScene)this.background&&(this.background.isColor?c.background=this.background.toJSON():this.background.isTexture&&(c.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(c.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){c.geometry=p(e.geometries,this.geometry);const i=this.geometry.parameters;if(i!==void 0&&i.shapes!==void 0){const C=i.shapes;if(Array.isArray(C))for(let D=0,R=C.length;D<R;D++){const Q=C[D];p(e.shapes,Q)}else p(e.shapes,C)}}if(this.isSkinnedMesh&&(c.bindMode=this.bindMode,c.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(p(e.skeletons,this.skeleton),c.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const i=[];for(let C=0,D=this.material.length;C<D;C++)i.push(p(e.materials,this.material[C]));c.material=i}else c.material=p(e.materials,this.material);if(this.children.length>0){c.children=[];for(let i=0;i<this.children.length;i++)c.children.push(this.children[i].toJSON(e).object)}if(this.animations.length>0){c.animations=[];for(let i=0;i<this.animations.length;i++){const C=this.animations[i];c.animations.push(p(e.animations,C))}}if(t){const i=y(e.geometries),C=y(e.materials),D=y(e.textures),R=y(e.images),Q=y(e.shapes),z=y(e.skeletons),G=y(e.animations),J=y(e.nodes);i.length>0&&(r.geometries=i),C.length>0&&(r.materials=C),D.length>0&&(r.textures=D),R.length>0&&(r.images=R),Q.length>0&&(r.shapes=Q),z.length>0&&(r.skeletons=z),G.length>0&&(r.animations=G),J.length>0&&(r.nodes=J)}return r.object=c,r;function y(i){const C=[];for(const D in i){const R=i[D];delete R.metadata,C.push(R)}return C}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r<e.children.length;r++){const c=e.children[r];this.add(c.clone())}return this}}ls.DEFAULT_UP=new ft(0,1,0);ls.DEFAULT_MATRIX_AUTO_UPDATE=!0;ls.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const au=new ft,OA=new ft,Iw=new ft,NA=new ft,pm=new ft,fm=new ft,jE=new ft,Fw=new ft,Lw=new ft,Dw=new ft;class wh{constructor(e=new ft,t=new ft,r=new ft){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,c){c.subVectors(r,t),au.subVectors(e,t),c.cross(au);const p=c.lengthSq();return p>0?c.multiplyScalar(1/Math.sqrt(p)):c.set(0,0,0)}static getBarycoord(e,t,r,c,p){au.subVectors(c,t),OA.subVectors(r,t),Iw.subVectors(e,t);const y=au.dot(au),i=au.dot(OA),C=au.dot(Iw),D=OA.dot(OA),R=OA.dot(Iw),Q=y*D-i*i;if(Q===0)return p.set(-2,-1,-1);const z=1/Q,G=(D*C-i*R)*z,J=(y*R-i*C)*z;return p.set(1-G-J,J,G)}static containsPoint(e,t,r,c){return this.getBarycoord(e,t,r,c,NA),NA.x>=0&&NA.y>=0&&NA.x+NA.y<=1}static getUV(e,t,r,c,p,y,i,C){return this.getBarycoord(e,t,r,c,NA),C.set(0,0),C.addScaledVector(p,NA.x),C.addScaledVector(y,NA.y),C.addScaledVector(i,NA.z),C}static isFrontFacing(e,t,r,c){return au.subVectors(r,t),OA.subVectors(e,t),au.cross(OA).dot(c)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,c){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[c]),this}setFromAttributeAndIndices(e,t,r,c){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,c),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return au.subVectors(this.c,this.b),OA.subVectors(this.a,this.b),au.cross(OA).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return wh.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return wh.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,c,p){return wh.getUV(e,this.a,this.b,this.c,t,r,c,p)}containsPoint(e){return wh.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wh.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,c=this.b,p=this.c;let y,i;pm.subVectors(c,r),fm.subVectors(p,r),Fw.subVectors(e,r);const C=pm.dot(Fw),D=fm.dot(Fw);if(C<=0&&D<=0)return t.copy(r);Lw.subVectors(e,c);const R=pm.dot(Lw),Q=fm.dot(Lw);if(R>=0&&Q<=R)return t.copy(c);const z=C*Q-R*D;if(z<=0&&C>=0&&R<=0)return y=C/(C-R),t.copy(r).addScaledVector(pm,y);Dw.subVectors(e,p);const G=pm.dot(Dw),J=fm.dot(Dw);if(J>=0&&G<=J)return t.copy(p);const Y=G*D-C*J;if(Y<=0&&D>=0&&J<=0)return i=D/(D-J),t.copy(r).addScaledVector(fm,i);const B=R*J-G*Q;if(B<=0&&Q-R>=0&&G-J>=0)return jE.subVectors(p,c),i=(Q-R)/(Q-R+(G-J)),t.copy(c).addScaledVector(jE,i);const ae=1/(B+Y+z);return y=Y*ae,i=z*ae,t.copy(r).addScaledVector(pm,y).addScaledVector(fm,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let zz=0;class ol extends Xu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zz++}),this.uuid=Pc(),this.name="",this.type="Material",this.blending=hf,this.side=uu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=D2,this.blendDst=P2,this.blendEquation=qp,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=uv,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=LI,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Xx,this.stencilZFail=Xx,this.stencilZPass=Xx,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const c=this[t];if(c===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}c&&c.isColor?c.set(r):c&&c.isVector3&&r&&r.isVector3?c.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==hf&&(r.blending=this.blending),this.side!==uu&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(r.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function c(p){const y=[];for(const i in p){const C=p[i];delete C.metadata,y.push(C)}return y}if(t){const p=c(e.textures),y=c(e.images);p.length>0&&(r.textures=p),y.length>0&&(r.images=y)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const c=t.length;r=new Array(c);for(let p=0;p!==c;++p)r[p]=t[p].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class za extends ol{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Dn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ly,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ro=new ft,rx=new Di;class As{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=W_,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let c=0,p=this.itemSize;c<p;c++)this.array[e+c]=t.array[r+c];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)rx.fromBufferAttribute(this,t),rx.applyMatrix3(e),this.setXY(t,rx.x,rx.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.applyMatrix3(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.applyMatrix4(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.applyNormalMatrix(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Ro.fromBufferAttribute(this,t),Ro.transformDirection(e),this.setXYZ(t,Ro.x,Ro.y,Ro.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=WA(t,this.array)),t}setX(e,t){return this.normalized&&(t=Us(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=WA(t,this.array)),t}setY(e,t){return this.normalized&&(t=Us(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=WA(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Us(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=WA(t,this.array)),t}setW(e,t){return this.normalized&&(t=Us(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=Us(t,this.array),r=Us(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,c){return e*=this.itemSize,this.normalized&&(t=Us(t,this.array),r=Us(r,this.array),c=Us(c,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=c,this}setXYZW(e,t,r,c,p){return e*=this.itemSize,this.normalized&&(t=Us(t,this.array),r=Us(r,this.array),c=Us(c,this.array),p=Us(p,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=c,this.array[e+3]=p,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==W_&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class kz extends As{constructor(e,t,r){super(new Int8Array(e),t,r)}}class Oz extends As{constructor(e,t,r){super(new Uint8Array(e),t,r)}}class Nz extends As{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}}class Qz extends As{constructor(e,t,r){super(new Int16Array(e),t,r)}}class V2 extends As{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class Vz extends As{constructor(e,t,r){super(new Int32Array(e),t,r)}}class H2 extends As{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class Hz extends As{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}}class jn extends As{constructor(e,t,r){super(new Float32Array(e),t,r)}}class Gz extends As{constructor(e,t,r){super(new Float64Array(e),t,r)}}let Wz=0;const _h=new ar,Pw=new ls,mm=new ft,Mc=new qu,r_=new qu,fa=new ft;class br extends Xu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Wz++}),this.uuid=Pc(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(UI(e)?H2:V2)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const p=new Pl().getNormalMatrix(e);r.applyNormalMatrix(p),r.needsUpdate=!0}const c=this.attributes.tangent;return c!==void 0&&(c.transformDirection(e),c.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return _h.makeRotationFromQuaternion(e),this.applyMatrix4(_h),this}rotateX(e){return _h.makeRotationX(e),this.applyMatrix4(_h),this}rotateY(e){return _h.makeRotationY(e),this.applyMatrix4(_h),this}rotateZ(e){return _h.makeRotationZ(e),this.applyMatrix4(_h),this}translate(e,t,r){return _h.makeTranslation(e,t,r),this.applyMatrix4(_h),this}scale(e,t,r){return _h.makeScale(e,t,r),this.applyMatrix4(_h),this}lookAt(e){return Pw.lookAt(e),Pw.updateMatrix(),this.applyMatrix4(Pw.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(mm).negate(),this.translate(mm.x,mm.y,mm.z),this}setFromPoints(e){const t=[];for(let r=0,c=e.length;r<c;r++){const p=e[r];t.push(p.x,p.y,p.z||0)}return this.setAttribute("position",new jn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qu);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new ft(-1/0,-1/0,-1/0),new ft(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,c=t.length;r<c;r++){const p=t[r];Mc.setFromBufferAttribute(p),this.morphTargetsRelative?(fa.addVectors(this.boundingBox.min,Mc.min),this.boundingBox.expandByPoint(fa),fa.addVectors(this.boundingBox.max,Mc.max),this.boundingBox.expandByPoint(fa)):(this.boundingBox.expandByPoint(Mc.min),this.boundingBox.expandByPoint(Mc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new XA);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new ft,1/0);return}if(e){const r=this.boundingSphere.center;if(Mc.setFromBufferAttribute(e),t)for(let p=0,y=t.length;p<y;p++){const i=t[p];r_.setFromBufferAttribute(i),this.morphTargetsRelative?(fa.addVectors(Mc.min,r_.min),Mc.expandByPoint(fa),fa.addVectors(Mc.max,r_.max),Mc.expandByPoint(fa)):(Mc.expandByPoint(r_.min),Mc.expandByPoint(r_.max))}Mc.getCenter(r);let c=0;for(let p=0,y=e.count;p<y;p++)fa.fromBufferAttribute(e,p),c=Math.max(c,r.distanceToSquared(fa));if(t)for(let p=0,y=t.length;p<y;p++){const i=t[p],C=this.morphTargetsRelative;for(let D=0,R=i.count;D<R;D++)fa.fromBufferAttribute(i,D),C&&(mm.fromBufferAttribute(e,D),fa.add(mm)),c=Math.max(c,r.distanceToSquared(fa))}this.boundingSphere.radius=Math.sqrt(c),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=e.array,c=t.position.array,p=t.normal.array,y=t.uv.array,i=c.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new As(new Float32Array(4*i),4));const C=this.getAttribute("tangent").array,D=[],R=[];for(let Et=0;Et<i;Et++)D[Et]=new ft,R[Et]=new ft;const Q=new ft,z=new ft,G=new ft,J=new Di,Y=new Di,B=new Di,ae=new ft,ce=new ft;function Ae(Et,li,xi){Q.fromArray(c,Et*3),z.fromArray(c,li*3),G.fromArray(c,xi*3),J.fromArray(y,Et*2),Y.fromArray(y,li*2),B.fromArray(y,xi*2),z.sub(Q),G.sub(Q),Y.sub(J),B.sub(J);const te=1/(Y.x*B.y-B.x*Y.y);!isFinite(te)||(ae.copy(z).multiplyScalar(B.y).addScaledVector(G,-Y.y).multiplyScalar(te),ce.copy(G).multiplyScalar(Y.x).addScaledVector(z,-B.x).multiplyScalar(te),D[Et].add(ae),D[li].add(ae),D[xi].add(ae),R[Et].add(ce),R[li].add(ce),R[xi].add(ce))}let we=this.groups;we.length===0&&(we=[{start:0,count:r.length}]);for(let Et=0,li=we.length;Et<li;++Et){const xi=we[Et],te=xi.start,le=xi.count;for(let ye=te,xe=te+le;ye<xe;ye+=3)Ae(r[ye+0],r[ye+1],r[ye+2])}const me=new ft,De=new ft,Je=new ft,Fe=new ft;function Ge(Et){Je.fromArray(p,Et*3),Fe.copy(Je);const li=D[Et];me.copy(li),me.sub(Je.multiplyScalar(Je.dot(li))).normalize(),De.crossVectors(Fe,li);const te=De.dot(R[Et])<0?-1:1;C[Et*4]=me.x,C[Et*4+1]=me.y,C[Et*4+2]=me.z,C[Et*4+3]=te}for(let Et=0,li=we.length;Et<li;++Et){const xi=we[Et],te=xi.start,le=xi.count;for(let ye=te,xe=te+le;ye<xe;ye+=3)Ge(r[ye+0]),Ge(r[ye+1]),Ge(r[ye+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new As(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let z=0,G=r.count;z<G;z++)r.setXYZ(z,0,0,0);const c=new ft,p=new ft,y=new ft,i=new ft,C=new ft,D=new ft,R=new ft,Q=new ft;if(e)for(let z=0,G=e.count;z<G;z+=3){const J=e.getX(z+0),Y=e.getX(z+1),B=e.getX(z+2);c.fromBufferAttribute(t,J),p.fromBufferAttribute(t,Y),y.fromBufferAttribute(t,B),R.subVectors(y,p),Q.subVectors(c,p),R.cross(Q),i.fromBufferAttribute(r,J),C.fromBufferAttribute(r,Y),D.fromBufferAttribute(r,B),i.add(R),C.add(R),D.add(R),r.setXYZ(J,i.x,i.y,i.z),r.setXYZ(Y,C.x,C.y,C.z),r.setXYZ(B,D.x,D.y,D.z)}else for(let z=0,G=t.count;z<G;z+=3)c.fromBufferAttribute(t,z+0),p.fromBufferAttribute(t,z+1),y.fromBufferAttribute(t,z+2),R.subVectors(y,p),Q.subVectors(c,p),R.cross(Q),r.setXYZ(z+0,R.x,R.y,R.z),r.setXYZ(z+1,R.x,R.y,R.z),r.setXYZ(z+2,R.x,R.y,R.z);this.normalizeNormals(),r.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)fa.fromBufferAttribute(e,t),fa.normalize(),e.setXYZ(t,fa.x,fa.y,fa.z)}toNonIndexed(){function e(i,C){const D=i.array,R=i.itemSize,Q=i.normalized,z=new D.constructor(C.length*R);let G=0,J=0;for(let Y=0,B=C.length;Y<B;Y++){i.isInterleavedBufferAttribute?G=C[Y]*i.data.stride+i.offset:G=C[Y]*R;for(let ae=0;ae<R;ae++)z[J++]=D[G++]}return new As(z,R,Q)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new br,r=this.index.array,c=this.attributes;for(const i in c){const C=c[i],D=e(C,r);t.setAttribute(i,D)}const p=this.morphAttributes;for(const i in p){const C=[],D=p[i];for(let R=0,Q=D.length;R<Q;R++){const z=D[R],G=e(z,r);C.push(G)}t.morphAttributes[i]=C}t.morphTargetsRelative=this.morphTargetsRelative;const y=this.groups;for(let i=0,C=y.length;i<C;i++){const D=y[i];t.addGroup(D.start,D.count,D.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const C=this.parameters;for(const D in C)C[D]!==void 0&&(e[D]=C[D]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const C in r){const D=r[C];e.data.attributes[C]=D.toJSON(e.data)}const c={};let p=!1;for(const C in this.morphAttributes){const D=this.morphAttributes[C],R=[];for(let Q=0,z=D.length;Q<z;Q++){const G=D[Q];R.push(G.toJSON(e.data))}R.length>0&&(c[C]=R,p=!0)}p&&(e.data.morphAttributes=c,e.data.morphTargetsRelative=this.morphTargetsRelative);const y=this.groups;y.length>0&&(e.data.groups=JSON.parse(JSON.stringify(y)));const i=this.boundingSphere;return i!==null&&(e.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const c=e.attributes;for(const D in c){const R=c[D];this.setAttribute(D,R.clone(t))}const p=e.morphAttributes;for(const D in p){const R=[],Q=p[D];for(let z=0,G=Q.length;z<G;z++)R.push(Q[z].clone(t));this.morphAttributes[D]=R}this.morphTargetsRelative=e.morphTargetsRelative;const y=e.groups;for(let D=0,R=y.length;D<R;D++){const Q=y[D];this.addGroup(Q.start,Q.count,Q.materialIndex)}const i=e.boundingBox;i!==null&&(this.boundingBox=i.clone());const C=e.boundingSphere;return C!==null&&(this.boundingSphere=C.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const KE=new ar,gm=new cy,Uw=new XA,s_=new ft,o_=new ft,a_=new ft,Rw=new ft,sx=new ft,ox=new Di,ax=new Di,lx=new Di,zw=new ft,cx=new ft;class us extends ls{constructor(e=new br,t=new za){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const c=t[r[0]];if(c!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let p=0,y=c.length;p<y;p++){const i=c[p].name||String(p);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=p}}}}getVertexPosition(e,t){const r=this.geometry,c=r.attributes.position,p=r.morphAttributes.position,y=r.morphTargetsRelative;t.fromBufferAttribute(c,e);const i=this.morphTargetInfluences;if(p&&i){sx.set(0,0,0);for(let C=0,D=p.length;C<D;C++){const R=i[C],Q=p[C];R!==0&&(Rw.fromBufferAttribute(Q,e),y?sx.addScaledVector(Rw,R):sx.addScaledVector(Rw.sub(t),R))}t.add(sx)}return this.isSkinnedMesh&&this.boneTransform(e,t),t}raycast(e,t){const r=this.geometry,c=this.material,p=this.matrixWorld;if(c===void 0||(r.boundingSphere===null&&r.computeBoundingSphere(),Uw.copy(r.boundingSphere),Uw.applyMatrix4(p),e.ray.intersectsSphere(Uw)===!1)||(KE.copy(p).invert(),gm.copy(e.ray).applyMatrix4(KE),r.boundingBox!==null&&gm.intersectsBox(r.boundingBox)===!1))return;let y;const i=r.index,C=r.attributes.position,D=r.attributes.uv,R=r.attributes.uv2,Q=r.groups,z=r.drawRange;if(i!==null)if(Array.isArray(c))for(let G=0,J=Q.length;G<J;G++){const Y=Q[G],B=c[Y.materialIndex],ae=Math.max(Y.start,z.start),ce=Math.min(i.count,Math.min(Y.start+Y.count,z.start+z.count));for(let Ae=ae,we=ce;Ae<we;Ae+=3){const me=i.getX(Ae),De=i.getX(Ae+1),Je=i.getX(Ae+2);y=hx(this,B,e,gm,D,R,me,De,Je),y&&(y.faceIndex=Math.floor(Ae/3),y.face.materialIndex=Y.materialIndex,t.push(y))}}else{const G=Math.max(0,z.start),J=Math.min(i.count,z.start+z.count);for(let Y=G,B=J;Y<B;Y+=3){const ae=i.getX(Y),ce=i.getX(Y+1),Ae=i.getX(Y+2);y=hx(this,c,e,gm,D,R,ae,ce,Ae),y&&(y.faceIndex=Math.floor(Y/3),t.push(y))}}else if(C!==void 0)if(Array.isArray(c))for(let G=0,J=Q.length;G<J;G++){const Y=Q[G],B=c[Y.materialIndex],ae=Math.max(Y.start,z.start),ce=Math.min(C.count,Math.min(Y.start+Y.count,z.start+z.count));for(let Ae=ae,we=ce;Ae<we;Ae+=3){const me=Ae,De=Ae+1,Je=Ae+2;y=hx(this,B,e,gm,D,R,me,De,Je),y&&(y.faceIndex=Math.floor(Ae/3),y.face.materialIndex=Y.materialIndex,t.push(y))}}else{const G=Math.max(0,z.start),J=Math.min(C.count,z.start+z.count);for(let Y=G,B=J;Y<B;Y+=3){const ae=Y,ce=Y+1,Ae=Y+2;y=hx(this,c,e,gm,D,R,ae,ce,Ae),y&&(y.faceIndex=Math.floor(Y/3),t.push(y))}}}}function jz(u,e,t,r,c,p,y,i){let C;if(e.side===rc?C=r.intersectTriangle(y,p,c,!0,i):C=r.intersectTriangle(c,p,y,e.side===uu,i),C===null)return null;cx.copy(i),cx.applyMatrix4(u.matrixWorld);const D=t.ray.origin.distanceTo(cx);return D<t.near||D>t.far?null:{distance:D,point:cx.clone(),object:u}}function hx(u,e,t,r,c,p,y,i,C){u.getVertexPosition(y,s_),u.getVertexPosition(i,o_),u.getVertexPosition(C,a_);const D=jz(u,e,t,r,s_,o_,a_,zw);if(D){c&&(ox.fromBufferAttribute(c,y),ax.fromBufferAttribute(c,i),lx.fromBufferAttribute(c,C),D.uv=wh.getUV(zw,s_,o_,a_,ox,ax,lx,new Di)),p&&(ox.fromBufferAttribute(p,y),ax.fromBufferAttribute(p,i),lx.fromBufferAttribute(p,C),D.uv2=wh.getUV(zw,s_,o_,a_,ox,ax,lx,new Di));const R={a:y,b:i,c:C,normal:new ft,materialIndex:0};wh.getNormal(s_,o_,a_,R.normal),D.face=R}return D}class qA extends br{constructor(e=1,t=1,r=1,c=1,p=1,y=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:c,heightSegments:p,depthSegments:y};const i=this;c=Math.floor(c),p=Math.floor(p),y=Math.floor(y);const C=[],D=[],R=[],Q=[];let z=0,G=0;J("z","y","x",-1,-1,r,t,e,y,p,0),J("z","y","x",1,-1,r,t,-e,y,p,1),J("x","z","y",1,1,e,r,t,c,y,2),J("x","z","y",1,-1,e,r,-t,c,y,3),J("x","y","z",1,-1,e,t,r,c,p,4),J("x","y","z",-1,-1,e,t,-r,c,p,5),this.setIndex(C),this.setAttribute("position",new jn(D,3)),this.setAttribute("normal",new jn(R,3)),this.setAttribute("uv",new jn(Q,2));function J(Y,B,ae,ce,Ae,we,me,De,Je,Fe,Ge){const Et=we/Je,li=me/Fe,xi=we/2,te=me/2,le=De/2,ye=Je+1,xe=Fe+1;let Re=0,Oe=0;const We=new ft;for(let Ve=0;Ve<xe;Ve++){const Qe=Ve*li-te;for(let Se=0;Se<ye;Se++){const Ke=Se*Et-xi;We[Y]=Ke*ce,We[B]=Qe*Ae,We[ae]=le,D.push(We.x,We.y,We.z),We[Y]=0,We[B]=0,We[ae]=De>0?1:-1,R.push(We.x,We.y,We.z),Q.push(Se/Je),Q.push(1-Ve/Fe),Re+=1}}for(let Ve=0;Ve<Fe;Ve++)for(let Qe=0;Qe<Je;Qe++){const Se=z+Qe+ye*Ve,Ke=z+Qe+ye*(Ve+1),nt=z+(Qe+1)+ye*(Ve+1),vt=z+(Qe+1)+ye*Ve;C.push(Se,Ke,vt),C.push(Ke,nt,vt),Oe+=6}i.addGroup(G,Oe,Ge),G+=Oe,z+=Re}}static fromJSON(e){return new qA(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function jm(u){const e={};for(const t in u){e[t]={};for(const r in u[t]){const c=u[t][r];c&&(c.isColor||c.isMatrix3||c.isMatrix4||c.isVector2||c.isVector3||c.isVector4||c.isTexture||c.isQuaternion)?e[t][r]=c.clone():Array.isArray(c)?e[t][r]=c.slice():e[t][r]=c}}return e}function Sl(u){const e={};for(let t=0;t<u.length;t++){const r=jm(u[t]);for(const c in r)e[c]=r[c]}return e}function Kz(u){const e=[];for(let t=0;t<u.length;t++)e.push(u[t].clone());return e}function zI(u){return u.getRenderTarget()===null&&u.outputEncoding===Ts?cu:Wm}const mf={clone:jm,merge:Sl};var $z=`void main() {
  603. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  604. }`,Zz=`void main() {
  605. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  606. }`;class ko extends ol{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$z,this.fragmentShader=Zz,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=jm(e.uniforms),this.uniformsGroups=Kz(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const c in this.uniforms){const y=this.uniforms[c].value;y&&y.isTexture?t.uniforms[c]={type:"t",value:y.toJSON(e).uuid}:y&&y.isColor?t.uniforms[c]={type:"c",value:y.getHex()}:y&&y.isVector2?t.uniforms[c]={type:"v2",value:y.toArray()}:y&&y.isVector3?t.uniforms[c]={type:"v3",value:y.toArray()}:y&&y.isVector4?t.uniforms[c]={type:"v4",value:y.toArray()}:y&&y.isMatrix3?t.uniforms[c]={type:"m3",value:y.toArray()}:y&&y.isMatrix4?t.uniforms[c]={type:"m4",value:y.toArray()}:t.uniforms[c]={value:y}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const r={};for(const c in this.extensions)this.extensions[c]===!0&&(r[c]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Qv extends ls{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ar,this.projectionMatrix=new ar,this.projectionMatrixInverse=new ar}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class _a extends Qv{constructor(e=50,t=1,r=.1,c=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=c,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=j_*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Af*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return j_*2*Math.atan(Math.tan(Af*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,c,p,y){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=c,this.view.width=p,this.view.height=y,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Af*.5*this.fov)/this.zoom,r=2*t,c=this.aspect*r,p=-.5*c;const y=this.view;if(this.view!==null&&this.view.enabled){const C=y.fullWidth,D=y.fullHeight;p+=y.offsetX*c/C,t-=y.offsetY*r/D,c*=y.width/C,r*=y.height/D}const i=this.filmOffset;i!==0&&(p+=e*i/this.getFilmWidth()),this.projectionMatrix.makePerspective(p,p+c,t,t-r,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const _m=-90,ym=1;class kI extends ls{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const c=new _a(_m,ym,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(1,0,0),this.add(c);const p=new _a(_m,ym,e,t);p.layers=this.layers,p.up.set(0,1,0),p.lookAt(-1,0,0),this.add(p);const y=new _a(_m,ym,e,t);y.layers=this.layers,y.up.set(0,0,-1),y.lookAt(0,1,0),this.add(y);const i=new _a(_m,ym,e,t);i.layers=this.layers,i.up.set(0,0,1),i.lookAt(0,-1,0),this.add(i);const C=new _a(_m,ym,e,t);C.layers=this.layers,C.up.set(0,1,0),C.lookAt(0,0,1),this.add(C);const D=new _a(_m,ym,e,t);D.layers=this.layers,D.up.set(0,1,0),D.lookAt(0,0,-1),this.add(D)}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget,[c,p,y,i,C,D]=this.children,R=e.getRenderTarget(),Q=e.toneMapping,z=e.xr.enabled;e.toneMapping=Hu,e.xr.enabled=!1;const G=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,c),e.setRenderTarget(r,1),e.render(t,p),e.setRenderTarget(r,2),e.render(t,y),e.setRenderTarget(r,3),e.render(t,i),e.setRenderTarget(r,4),e.render(t,C),r.texture.generateMipmaps=G,e.setRenderTarget(r,5),e.render(t,D),e.setRenderTarget(R),e.toneMapping=Q,e.xr.enabled=z,r.texture.needsPMREMUpdate=!0}}class Ay extends To{constructor(e,t,r,c,p,y,i,C,D,R){e=e!==void 0?e:[],t=t!==void 0?t:rp,super(e,t,r,c,p,y,i,C,D,R),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class OI extends rl{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},c=[r,r,r,r,r,r];this.texture=new Ay(c,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Xs}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
  607. varying vec3 vWorldDirection;
  608. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  609. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  610. }
  611. void main() {
  612. vWorldDirection = transformDirection( position, modelMatrix );
  613. #include <begin_vertex>
  614. #include <project_vertex>
  615. }
  616. `,fragmentShader:`
  617. uniform sampler2D tEquirect;
  618. varying vec3 vWorldDirection;
  619. #include <common>
  620. void main() {
  621. vec3 direction = normalize( vWorldDirection );
  622. vec2 sampleUV = equirectUv( direction );
  623. gl_FragColor = texture2D( tEquirect, sampleUV );
  624. }
  625. `},c=new qA(5,5,5),p=new ko({name:"CubemapFromEquirect",uniforms:jm(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:rc,blending:KA});p.uniforms.tEquirect.value=t;const y=new us(c,p),i=t.minFilter;return t.minFilter===op&&(t.minFilter=Xs),new kI(1,10,this).update(e,y),t.minFilter=i,y.geometry.dispose(),y.material.dispose(),this}clear(e,t,r,c){const p=e.getRenderTarget();for(let y=0;y<6;y++)e.setRenderTarget(this,y),e.clear(t,r,c);e.setRenderTarget(p)}}const kw=new ft,Xz=new ft,qz=new Pl;class jd{constructor(e=new ft(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,c){return this.normal.set(e,t,r),this.constant=c,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const c=kw.subVectors(r,t).cross(Xz.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(c,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const r=e.delta(kw),c=this.normal.dot(r);if(c===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const p=-(e.start.dot(this.normal)+this.constant)/c;return p<0||p>1?null:t.copy(r).multiplyScalar(p).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||qz.getNormalMatrix(e),c=this.coplanarPoint(kw).applyMatrix4(e),p=this.normal.applyMatrix3(r).normalize();return this.constant=-c.dot(p),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const xm=new XA,ux=new ft;class Vv{constructor(e=new jd,t=new jd,r=new jd,c=new jd,p=new jd,y=new jd){this.planes=[e,t,r,c,p,y]}set(e,t,r,c,p,y){const i=this.planes;return i[0].copy(e),i[1].copy(t),i[2].copy(r),i[3].copy(c),i[4].copy(p),i[5].copy(y),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){const t=this.planes,r=e.elements,c=r[0],p=r[1],y=r[2],i=r[3],C=r[4],D=r[5],R=r[6],Q=r[7],z=r[8],G=r[9],J=r[10],Y=r[11],B=r[12],ae=r[13],ce=r[14],Ae=r[15];return t[0].setComponents(i-c,Q-C,Y-z,Ae-B).normalize(),t[1].setComponents(i+c,Q+C,Y+z,Ae+B).normalize(),t[2].setComponents(i+p,Q+D,Y+G,Ae+ae).normalize(),t[3].setComponents(i-p,Q-D,Y-G,Ae-ae).normalize(),t[4].setComponents(i-y,Q-R,Y-J,Ae-ce).normalize(),t[5].setComponents(i+y,Q+R,Y+J,Ae+ce).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),xm.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(xm)}intersectsSprite(e){return xm.center.set(0,0,0),xm.radius=.7071067811865476,xm.applyMatrix4(e.matrixWorld),this.intersectsSphere(xm)}intersectsSphere(e){const t=this.planes,r=e.center,c=-e.radius;for(let p=0;p<6;p++)if(t[p].distanceToPoint(r)<c)return!1;return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const c=t[r];if(ux.x=c.normal.x>0?e.max.x:e.min.x,ux.y=c.normal.y>0?e.max.y:e.min.y,ux.z=c.normal.z>0?e.max.z:e.min.z,c.distanceToPoint(ux)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function NI(){let u=null,e=!1,t=null,r=null;function c(p,y){t(p,y),r=u.requestAnimationFrame(c)}return{start:function(){e!==!0&&t!==null&&(r=u.requestAnimationFrame(c),e=!0)},stop:function(){u.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(p){t=p},setContext:function(p){u=p}}}function Yz(u,e){const t=e.isWebGL2,r=new WeakMap;function c(D,R){const Q=D.array,z=D.usage,G=u.createBuffer();u.bindBuffer(R,G),u.bufferData(R,Q,z),D.onUploadCallback();let J;if(Q instanceof Float32Array)J=5126;else if(Q instanceof Uint16Array)if(D.isFloat16BufferAttribute)if(t)J=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else J=5123;else if(Q instanceof Int16Array)J=5122;else if(Q instanceof Uint32Array)J=5125;else if(Q instanceof Int32Array)J=5124;else if(Q instanceof Int8Array)J=5120;else if(Q instanceof Uint8Array)J=5121;else if(Q instanceof Uint8ClampedArray)J=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+Q);return{buffer:G,type:J,bytesPerElement:Q.BYTES_PER_ELEMENT,version:D.version}}function p(D,R,Q){const z=R.array,G=R.updateRange;u.bindBuffer(Q,D),G.count===-1?u.bufferSubData(Q,0,z):(t?u.bufferSubData(Q,G.offset*z.BYTES_PER_ELEMENT,z,G.offset,G.count):u.bufferSubData(Q,G.offset*z.BYTES_PER_ELEMENT,z.subarray(G.offset,G.offset+G.count)),G.count=-1),R.onUploadCallback()}function y(D){return D.isInterleavedBufferAttribute&&(D=D.data),r.get(D)}function i(D){D.isInterleavedBufferAttribute&&(D=D.data);const R=r.get(D);R&&(u.deleteBuffer(R.buffer),r.delete(D))}function C(D,R){if(D.isGLBufferAttribute){const z=r.get(D);(!z||z.version<D.version)&&r.set(D,{buffer:D.buffer,type:D.type,bytesPerElement:D.elementSize,version:D.version});return}D.isInterleavedBufferAttribute&&(D=D.data);const Q=r.get(D);Q===void 0?r.set(D,c(D,R)):Q.version<D.version&&(p(Q.buffer,D,R),Q.version=D.version)}return{get:y,remove:i,update:C}}class xf extends br{constructor(e=1,t=1,r=1,c=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:c};const p=e/2,y=t/2,i=Math.floor(r),C=Math.floor(c),D=i+1,R=C+1,Q=e/i,z=t/C,G=[],J=[],Y=[],B=[];for(let ae=0;ae<R;ae++){const ce=ae*z-y;for(let Ae=0;Ae<D;Ae++){const we=Ae*Q-p;J.push(we,-ce,0),Y.push(0,0,1),B.push(Ae/i),B.push(1-ae/C)}}for(let ae=0;ae<C;ae++)for(let ce=0;ce<i;ce++){const Ae=ce+D*ae,we=ce+D*(ae+1),me=ce+1+D*(ae+1),De=ce+1+D*ae;G.push(Ae,we,De),G.push(we,me,De)}this.setIndex(G),this.setAttribute("position",new jn(J,3)),this.setAttribute("normal",new jn(Y,3)),this.setAttribute("uv",new jn(B,2))}static fromJSON(e){return new xf(e.width,e.height,e.widthSegments,e.heightSegments)}}var Jz=`#ifdef USE_ALPHAMAP
  626. diffuseColor.a *= texture2D( alphaMap, vUv ).g;
  627. #endif`,ek=`#ifdef USE_ALPHAMAP
  628. uniform sampler2D alphaMap;
  629. #endif`,tk=`#ifdef USE_ALPHATEST
  630. if ( diffuseColor.a < alphaTest ) discard;
  631. #endif`,ik=`#ifdef USE_ALPHATEST
  632. uniform float alphaTest;
  633. #endif`,nk=`#ifdef USE_AOMAP
  634. float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
  635. reflectedLight.indirectDiffuse *= ambientOcclusion;
  636. #if defined( USE_ENVMAP ) && defined( STANDARD )
  637. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  638. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  639. #endif
  640. #endif`,rk=`#ifdef USE_AOMAP
  641. uniform sampler2D aoMap;
  642. uniform float aoMapIntensity;
  643. #endif`,sk="vec3 transformed = vec3( position );",ok=`vec3 objectNormal = vec3( normal );
  644. #ifdef USE_TANGENT
  645. vec3 objectTangent = vec3( tangent.xyz );
  646. #endif`,ak=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  647. return RECIPROCAL_PI * diffuseColor;
  648. }
  649. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  650. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  651. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  652. }
  653. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  654. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  655. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  656. }
  657. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  658. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  659. float x2 = x * x;
  660. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  661. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  662. }
  663. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  664. float a2 = pow2( alpha );
  665. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  666. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  667. return 0.5 / max( gv + gl, EPSILON );
  668. }
  669. float D_GGX( const in float alpha, const in float dotNH ) {
  670. float a2 = pow2( alpha );
  671. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  672. return RECIPROCAL_PI * a2 / pow2( denom );
  673. }
  674. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
  675. float alpha = pow2( roughness );
  676. vec3 halfDir = normalize( lightDir + viewDir );
  677. float dotNL = saturate( dot( normal, lightDir ) );
  678. float dotNV = saturate( dot( normal, viewDir ) );
  679. float dotNH = saturate( dot( normal, halfDir ) );
  680. float dotVH = saturate( dot( viewDir, halfDir ) );
  681. vec3 F = F_Schlick( f0, f90, dotVH );
  682. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  683. float D = D_GGX( alpha, dotNH );
  684. return F * ( V * D );
  685. }
  686. #ifdef USE_IRIDESCENCE
  687. vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
  688. float alpha = pow2( roughness );
  689. vec3 halfDir = normalize( lightDir + viewDir );
  690. float dotNL = saturate( dot( normal, lightDir ) );
  691. float dotNV = saturate( dot( normal, viewDir ) );
  692. float dotNH = saturate( dot( normal, halfDir ) );
  693. float dotVH = saturate( dot( viewDir, halfDir ) );
  694. vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
  695. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  696. float D = D_GGX( alpha, dotNH );
  697. return F * ( V * D );
  698. }
  699. #endif
  700. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  701. const float LUT_SIZE = 64.0;
  702. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  703. const float LUT_BIAS = 0.5 / LUT_SIZE;
  704. float dotNV = saturate( dot( N, V ) );
  705. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  706. uv = uv * LUT_SCALE + LUT_BIAS;
  707. return uv;
  708. }
  709. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  710. float l = length( f );
  711. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  712. }
  713. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  714. float x = dot( v1, v2 );
  715. float y = abs( x );
  716. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  717. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  718. float v = a / b;
  719. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  720. return cross( v1, v2 ) * theta_sintheta;
  721. }
  722. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  723. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  724. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  725. vec3 lightNormal = cross( v1, v2 );
  726. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  727. vec3 T1, T2;
  728. T1 = normalize( V - N * dot( V, N ) );
  729. T2 = - cross( N, T1 );
  730. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  731. vec3 coords[ 4 ];
  732. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  733. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  734. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  735. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  736. coords[ 0 ] = normalize( coords[ 0 ] );
  737. coords[ 1 ] = normalize( coords[ 1 ] );
  738. coords[ 2 ] = normalize( coords[ 2 ] );
  739. coords[ 3 ] = normalize( coords[ 3 ] );
  740. vec3 vectorFormFactor = vec3( 0.0 );
  741. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  742. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  743. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  744. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  745. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  746. return vec3( result );
  747. }
  748. float G_BlinnPhong_Implicit( ) {
  749. return 0.25;
  750. }
  751. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  752. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  753. }
  754. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  755. vec3 halfDir = normalize( lightDir + viewDir );
  756. float dotNH = saturate( dot( normal, halfDir ) );
  757. float dotVH = saturate( dot( viewDir, halfDir ) );
  758. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  759. float G = G_BlinnPhong_Implicit( );
  760. float D = D_BlinnPhong( shininess, dotNH );
  761. return F * ( G * D );
  762. }
  763. #if defined( USE_SHEEN )
  764. float D_Charlie( float roughness, float dotNH ) {
  765. float alpha = pow2( roughness );
  766. float invAlpha = 1.0 / alpha;
  767. float cos2h = dotNH * dotNH;
  768. float sin2h = max( 1.0 - cos2h, 0.0078125 );
  769. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  770. }
  771. float V_Neubelt( float dotNV, float dotNL ) {
  772. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  773. }
  774. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  775. vec3 halfDir = normalize( lightDir + viewDir );
  776. float dotNL = saturate( dot( normal, lightDir ) );
  777. float dotNV = saturate( dot( normal, viewDir ) );
  778. float dotNH = saturate( dot( normal, halfDir ) );
  779. float D = D_Charlie( sheenRoughness, dotNH );
  780. float V = V_Neubelt( dotNV, dotNL );
  781. return sheenColor * ( D * V );
  782. }
  783. #endif`,lk=`#ifdef USE_IRIDESCENCE
  784. const mat3 XYZ_TO_REC709 = mat3(
  785. 3.2404542, -0.9692660, 0.0556434,
  786. -1.5371385, 1.8760108, -0.2040259,
  787. -0.4985314, 0.0415560, 1.0572252
  788. );
  789. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  790. vec3 sqrtF0 = sqrt( fresnel0 );
  791. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  792. }
  793. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  794. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  795. }
  796. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  797. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  798. }
  799. vec3 evalSensitivity( float OPD, vec3 shift ) {
  800. float phase = 2.0 * PI * OPD * 1.0e-9;
  801. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  802. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  803. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  804. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  805. xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
  806. xyz /= 1.0685e-7;
  807. vec3 rgb = XYZ_TO_REC709 * xyz;
  808. return rgb;
  809. }
  810. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  811. vec3 I;
  812. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  813. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  814. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  815. if ( cosTheta2Sq < 0.0 ) {
  816. return vec3( 1.0 );
  817. }
  818. float cosTheta2 = sqrt( cosTheta2Sq );
  819. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  820. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  821. float R21 = R12;
  822. float T121 = 1.0 - R12;
  823. float phi12 = 0.0;
  824. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  825. float phi21 = PI - phi12;
  826. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  827. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  828. vec3 phi23 = vec3( 0.0 );
  829. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  830. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  831. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  832. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  833. vec3 phi = vec3( phi21 ) + phi23;
  834. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  835. vec3 r123 = sqrt( R123 );
  836. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  837. vec3 C0 = R12 + Rs;
  838. I = C0;
  839. vec3 Cm = Rs - T121;
  840. for ( int m = 1; m <= 2; ++ m ) {
  841. Cm *= r123;
  842. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  843. I += Cm * Sm;
  844. }
  845. return max( I, vec3( 0.0 ) );
  846. }
  847. #endif`,ck=`#ifdef USE_BUMPMAP
  848. uniform sampler2D bumpMap;
  849. uniform float bumpScale;
  850. vec2 dHdxy_fwd() {
  851. vec2 dSTdx = dFdx( vUv );
  852. vec2 dSTdy = dFdy( vUv );
  853. float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
  854. float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
  855. float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
  856. return vec2( dBx, dBy );
  857. }
  858. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  859. vec3 vSigmaX = dFdx( surf_pos.xyz );
  860. vec3 vSigmaY = dFdy( surf_pos.xyz );
  861. vec3 vN = surf_norm;
  862. vec3 R1 = cross( vSigmaY, vN );
  863. vec3 R2 = cross( vN, vSigmaX );
  864. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  865. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  866. return normalize( abs( fDet ) * surf_norm - vGrad );
  867. }
  868. #endif`,hk=`#if NUM_CLIPPING_PLANES > 0
  869. vec4 plane;
  870. #pragma unroll_loop_start
  871. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  872. plane = clippingPlanes[ i ];
  873. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  874. }
  875. #pragma unroll_loop_end
  876. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  877. bool clipped = true;
  878. #pragma unroll_loop_start
  879. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  880. plane = clippingPlanes[ i ];
  881. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  882. }
  883. #pragma unroll_loop_end
  884. if ( clipped ) discard;
  885. #endif
  886. #endif`,uk=`#if NUM_CLIPPING_PLANES > 0
  887. varying vec3 vClipPosition;
  888. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  889. #endif`,Ak=`#if NUM_CLIPPING_PLANES > 0
  890. varying vec3 vClipPosition;
  891. #endif`,dk=`#if NUM_CLIPPING_PLANES > 0
  892. vClipPosition = - mvPosition.xyz;
  893. #endif`,pk=`#if defined( USE_COLOR_ALPHA )
  894. diffuseColor *= vColor;
  895. #elif defined( USE_COLOR )
  896. diffuseColor.rgb *= vColor;
  897. #endif`,fk=`#if defined( USE_COLOR_ALPHA )
  898. varying vec4 vColor;
  899. #elif defined( USE_COLOR )
  900. varying vec3 vColor;
  901. #endif`,mk=`#if defined( USE_COLOR_ALPHA )
  902. varying vec4 vColor;
  903. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  904. varying vec3 vColor;
  905. #endif`,gk=`#if defined( USE_COLOR_ALPHA )
  906. vColor = vec4( 1.0 );
  907. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  908. vColor = vec3( 1.0 );
  909. #endif
  910. #ifdef USE_COLOR
  911. vColor *= color;
  912. #endif
  913. #ifdef USE_INSTANCING_COLOR
  914. vColor.xyz *= instanceColor.xyz;
  915. #endif`,_k=`#define PI 3.141592653589793
  916. #define PI2 6.283185307179586
  917. #define PI_HALF 1.5707963267948966
  918. #define RECIPROCAL_PI 0.3183098861837907
  919. #define RECIPROCAL_PI2 0.15915494309189535
  920. #define EPSILON 1e-6
  921. #ifndef saturate
  922. #define saturate( a ) clamp( a, 0.0, 1.0 )
  923. #endif
  924. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  925. float pow2( const in float x ) { return x*x; }
  926. vec3 pow2( const in vec3 x ) { return x*x; }
  927. float pow3( const in float x ) { return x*x*x; }
  928. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  929. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  930. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  931. highp float rand( const in vec2 uv ) {
  932. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  933. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  934. return fract( sin( sn ) * c );
  935. }
  936. #ifdef HIGH_PRECISION
  937. float precisionSafeLength( vec3 v ) { return length( v ); }
  938. #else
  939. float precisionSafeLength( vec3 v ) {
  940. float maxComponent = max3( abs( v ) );
  941. return length( v / maxComponent ) * maxComponent;
  942. }
  943. #endif
  944. struct IncidentLight {
  945. vec3 color;
  946. vec3 direction;
  947. bool visible;
  948. };
  949. struct ReflectedLight {
  950. vec3 directDiffuse;
  951. vec3 directSpecular;
  952. vec3 indirectDiffuse;
  953. vec3 indirectSpecular;
  954. };
  955. struct GeometricContext {
  956. vec3 position;
  957. vec3 normal;
  958. vec3 viewDir;
  959. #ifdef USE_CLEARCOAT
  960. vec3 clearcoatNormal;
  961. #endif
  962. };
  963. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  964. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  965. }
  966. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  967. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  968. }
  969. mat3 transposeMat3( const in mat3 m ) {
  970. mat3 tmp;
  971. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  972. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  973. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  974. return tmp;
  975. }
  976. float luminance( const in vec3 rgb ) {
  977. const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
  978. return dot( weights, rgb );
  979. }
  980. bool isPerspectiveMatrix( mat4 m ) {
  981. return m[ 2 ][ 3 ] == - 1.0;
  982. }
  983. vec2 equirectUv( in vec3 dir ) {
  984. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  985. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  986. return vec2( u, v );
  987. }`,yk=`#ifdef ENVMAP_TYPE_CUBE_UV
  988. #define cubeUV_minMipLevel 4.0
  989. #define cubeUV_minTileSize 16.0
  990. float getFace( vec3 direction ) {
  991. vec3 absDirection = abs( direction );
  992. float face = - 1.0;
  993. if ( absDirection.x > absDirection.z ) {
  994. if ( absDirection.x > absDirection.y )
  995. face = direction.x > 0.0 ? 0.0 : 3.0;
  996. else
  997. face = direction.y > 0.0 ? 1.0 : 4.0;
  998. } else {
  999. if ( absDirection.z > absDirection.y )
  1000. face = direction.z > 0.0 ? 2.0 : 5.0;
  1001. else
  1002. face = direction.y > 0.0 ? 1.0 : 4.0;
  1003. }
  1004. return face;
  1005. }
  1006. vec2 getUV( vec3 direction, float face ) {
  1007. vec2 uv;
  1008. if ( face == 0.0 ) {
  1009. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  1010. } else if ( face == 1.0 ) {
  1011. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  1012. } else if ( face == 2.0 ) {
  1013. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  1014. } else if ( face == 3.0 ) {
  1015. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  1016. } else if ( face == 4.0 ) {
  1017. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  1018. } else {
  1019. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  1020. }
  1021. return 0.5 * ( uv + 1.0 );
  1022. }
  1023. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  1024. float face = getFace( direction );
  1025. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  1026. mipInt = max( mipInt, cubeUV_minMipLevel );
  1027. float faceSize = exp2( mipInt );
  1028. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
  1029. if ( face > 2.0 ) {
  1030. uv.y += faceSize;
  1031. face -= 3.0;
  1032. }
  1033. uv.x += face * faceSize;
  1034. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  1035. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  1036. uv.x *= CUBEUV_TEXEL_WIDTH;
  1037. uv.y *= CUBEUV_TEXEL_HEIGHT;
  1038. #ifdef texture2DGradEXT
  1039. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  1040. #else
  1041. return texture2D( envMap, uv ).rgb;
  1042. #endif
  1043. }
  1044. #define cubeUV_r0 1.0
  1045. #define cubeUV_v0 0.339
  1046. #define cubeUV_m0 - 2.0
  1047. #define cubeUV_r1 0.8
  1048. #define cubeUV_v1 0.276
  1049. #define cubeUV_m1 - 1.0
  1050. #define cubeUV_r4 0.4
  1051. #define cubeUV_v4 0.046
  1052. #define cubeUV_m4 2.0
  1053. #define cubeUV_r5 0.305
  1054. #define cubeUV_v5 0.016
  1055. #define cubeUV_m5 3.0
  1056. #define cubeUV_r6 0.21
  1057. #define cubeUV_v6 0.0038
  1058. #define cubeUV_m6 4.0
  1059. float roughnessToMip( float roughness ) {
  1060. float mip = 0.0;
  1061. if ( roughness >= cubeUV_r1 ) {
  1062. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  1063. } else if ( roughness >= cubeUV_r4 ) {
  1064. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  1065. } else if ( roughness >= cubeUV_r5 ) {
  1066. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  1067. } else if ( roughness >= cubeUV_r6 ) {
  1068. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  1069. } else {
  1070. mip = - 2.0 * log2( 1.16 * roughness ); }
  1071. return mip;
  1072. }
  1073. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  1074. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  1075. float mipF = fract( mip );
  1076. float mipInt = floor( mip );
  1077. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  1078. if ( mipF == 0.0 ) {
  1079. return vec4( color0, 1.0 );
  1080. } else {
  1081. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  1082. return vec4( mix( color0, color1, mipF ), 1.0 );
  1083. }
  1084. }
  1085. #endif`,xk=`vec3 transformedNormal = objectNormal;
  1086. #ifdef USE_INSTANCING
  1087. mat3 m = mat3( instanceMatrix );
  1088. transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
  1089. transformedNormal = m * transformedNormal;
  1090. #endif
  1091. transformedNormal = normalMatrix * transformedNormal;
  1092. #ifdef FLIP_SIDED
  1093. transformedNormal = - transformedNormal;
  1094. #endif
  1095. #ifdef USE_TANGENT
  1096. vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  1097. #ifdef FLIP_SIDED
  1098. transformedTangent = - transformedTangent;
  1099. #endif
  1100. #endif`,vk=`#ifdef USE_DISPLACEMENTMAP
  1101. uniform sampler2D displacementMap;
  1102. uniform float displacementScale;
  1103. uniform float displacementBias;
  1104. #endif`,wk=`#ifdef USE_DISPLACEMENTMAP
  1105. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
  1106. #endif`,bk=`#ifdef USE_EMISSIVEMAP
  1107. vec4 emissiveColor = texture2D( emissiveMap, vUv );
  1108. totalEmissiveRadiance *= emissiveColor.rgb;
  1109. #endif`,Bk=`#ifdef USE_EMISSIVEMAP
  1110. uniform sampler2D emissiveMap;
  1111. #endif`,Ck="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ek=`vec4 LinearToLinear( in vec4 value ) {
  1112. return value;
  1113. }
  1114. vec4 LinearTosRGB( in vec4 value ) {
  1115. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
  1116. }`,Tk=`#ifdef USE_ENVMAP
  1117. #ifdef ENV_WORLDPOS
  1118. vec3 cameraToFrag;
  1119. if ( isOrthographic ) {
  1120. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  1121. } else {
  1122. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  1123. }
  1124. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  1125. #ifdef ENVMAP_MODE_REFLECTION
  1126. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  1127. #else
  1128. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  1129. #endif
  1130. #else
  1131. vec3 reflectVec = vReflect;
  1132. #endif
  1133. #ifdef ENVMAP_TYPE_CUBE
  1134. vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  1135. #else
  1136. vec4 envColor = vec4( 0.0 );
  1137. #endif
  1138. #ifdef ENVMAP_BLENDING_MULTIPLY
  1139. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  1140. #elif defined( ENVMAP_BLENDING_MIX )
  1141. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  1142. #elif defined( ENVMAP_BLENDING_ADD )
  1143. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  1144. #endif
  1145. #endif`,Sk=`#ifdef USE_ENVMAP
  1146. uniform float envMapIntensity;
  1147. uniform float flipEnvMap;
  1148. #ifdef ENVMAP_TYPE_CUBE
  1149. uniform samplerCube envMap;
  1150. #else
  1151. uniform sampler2D envMap;
  1152. #endif
  1153. #endif`,Mk=`#ifdef USE_ENVMAP
  1154. uniform float reflectivity;
  1155. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  1156. #define ENV_WORLDPOS
  1157. #endif
  1158. #ifdef ENV_WORLDPOS
  1159. varying vec3 vWorldPosition;
  1160. uniform float refractionRatio;
  1161. #else
  1162. varying vec3 vReflect;
  1163. #endif
  1164. #endif`,Ik=`#ifdef USE_ENVMAP
  1165. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  1166. #define ENV_WORLDPOS
  1167. #endif
  1168. #ifdef ENV_WORLDPOS
  1169. varying vec3 vWorldPosition;
  1170. #else
  1171. varying vec3 vReflect;
  1172. uniform float refractionRatio;
  1173. #endif
  1174. #endif`,Fk=`#ifdef USE_ENVMAP
  1175. #ifdef ENV_WORLDPOS
  1176. vWorldPosition = worldPosition.xyz;
  1177. #else
  1178. vec3 cameraToVertex;
  1179. if ( isOrthographic ) {
  1180. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  1181. } else {
  1182. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  1183. }
  1184. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  1185. #ifdef ENVMAP_MODE_REFLECTION
  1186. vReflect = reflect( cameraToVertex, worldNormal );
  1187. #else
  1188. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  1189. #endif
  1190. #endif
  1191. #endif`,Lk=`#ifdef USE_FOG
  1192. vFogDepth = - mvPosition.z;
  1193. #endif`,Dk=`#ifdef USE_FOG
  1194. varying float vFogDepth;
  1195. #endif`,Pk=`#ifdef USE_FOG
  1196. #ifdef FOG_EXP2
  1197. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  1198. #else
  1199. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  1200. #endif
  1201. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  1202. #endif`,Uk=`#ifdef USE_FOG
  1203. uniform vec3 fogColor;
  1204. varying float vFogDepth;
  1205. #ifdef FOG_EXP2
  1206. uniform float fogDensity;
  1207. #else
  1208. uniform float fogNear;
  1209. uniform float fogFar;
  1210. #endif
  1211. #endif`,Rk=`#ifdef USE_GRADIENTMAP
  1212. uniform sampler2D gradientMap;
  1213. #endif
  1214. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  1215. float dotNL = dot( normal, lightDirection );
  1216. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  1217. #ifdef USE_GRADIENTMAP
  1218. return vec3( texture2D( gradientMap, coord ).r );
  1219. #else
  1220. vec2 fw = fwidth( coord ) * 0.5;
  1221. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  1222. #endif
  1223. }`,zk=`#ifdef USE_LIGHTMAP
  1224. vec4 lightMapTexel = texture2D( lightMap, vUv2 );
  1225. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  1226. reflectedLight.indirectDiffuse += lightMapIrradiance;
  1227. #endif`,kk=`#ifdef USE_LIGHTMAP
  1228. uniform sampler2D lightMap;
  1229. uniform float lightMapIntensity;
  1230. #endif`,Ok=`LambertMaterial material;
  1231. material.diffuseColor = diffuseColor.rgb;
  1232. material.specularStrength = specularStrength;`,Nk=`varying vec3 vViewPosition;
  1233. struct LambertMaterial {
  1234. vec3 diffuseColor;
  1235. float specularStrength;
  1236. };
  1237. void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  1238. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  1239. vec3 irradiance = dotNL * directLight.color;
  1240. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1241. }
  1242. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  1243. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1244. }
  1245. #define RE_Direct RE_Direct_Lambert
  1246. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Qk=`uniform bool receiveShadow;
  1247. uniform vec3 ambientLightColor;
  1248. uniform vec3 lightProbe[ 9 ];
  1249. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  1250. float x = normal.x, y = normal.y, z = normal.z;
  1251. vec3 result = shCoefficients[ 0 ] * 0.886227;
  1252. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  1253. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  1254. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  1255. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  1256. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  1257. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  1258. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  1259. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  1260. return result;
  1261. }
  1262. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  1263. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  1264. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  1265. return irradiance;
  1266. }
  1267. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  1268. vec3 irradiance = ambientLightColor;
  1269. return irradiance;
  1270. }
  1271. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  1272. #if defined ( PHYSICALLY_CORRECT_LIGHTS )
  1273. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  1274. if ( cutoffDistance > 0.0 ) {
  1275. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  1276. }
  1277. return distanceFalloff;
  1278. #else
  1279. if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  1280. return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
  1281. }
  1282. return 1.0;
  1283. #endif
  1284. }
  1285. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  1286. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  1287. }
  1288. #if NUM_DIR_LIGHTS > 0
  1289. struct DirectionalLight {
  1290. vec3 direction;
  1291. vec3 color;
  1292. };
  1293. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  1294. void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
  1295. light.color = directionalLight.color;
  1296. light.direction = directionalLight.direction;
  1297. light.visible = true;
  1298. }
  1299. #endif
  1300. #if NUM_POINT_LIGHTS > 0
  1301. struct PointLight {
  1302. vec3 position;
  1303. vec3 color;
  1304. float distance;
  1305. float decay;
  1306. };
  1307. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  1308. void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
  1309. vec3 lVector = pointLight.position - geometry.position;
  1310. light.direction = normalize( lVector );
  1311. float lightDistance = length( lVector );
  1312. light.color = pointLight.color;
  1313. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  1314. light.visible = ( light.color != vec3( 0.0 ) );
  1315. }
  1316. #endif
  1317. #if NUM_SPOT_LIGHTS > 0
  1318. struct SpotLight {
  1319. vec3 position;
  1320. vec3 direction;
  1321. vec3 color;
  1322. float distance;
  1323. float decay;
  1324. float coneCos;
  1325. float penumbraCos;
  1326. };
  1327. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  1328. void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
  1329. vec3 lVector = spotLight.position - geometry.position;
  1330. light.direction = normalize( lVector );
  1331. float angleCos = dot( light.direction, spotLight.direction );
  1332. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  1333. if ( spotAttenuation > 0.0 ) {
  1334. float lightDistance = length( lVector );
  1335. light.color = spotLight.color * spotAttenuation;
  1336. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  1337. light.visible = ( light.color != vec3( 0.0 ) );
  1338. } else {
  1339. light.color = vec3( 0.0 );
  1340. light.visible = false;
  1341. }
  1342. }
  1343. #endif
  1344. #if NUM_RECT_AREA_LIGHTS > 0
  1345. struct RectAreaLight {
  1346. vec3 color;
  1347. vec3 position;
  1348. vec3 halfWidth;
  1349. vec3 halfHeight;
  1350. };
  1351. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  1352. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  1353. #endif
  1354. #if NUM_HEMI_LIGHTS > 0
  1355. struct HemisphereLight {
  1356. vec3 direction;
  1357. vec3 skyColor;
  1358. vec3 groundColor;
  1359. };
  1360. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  1361. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  1362. float dotNL = dot( normal, hemiLight.direction );
  1363. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  1364. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  1365. return irradiance;
  1366. }
  1367. #endif`,Vk=`#if defined( USE_ENVMAP )
  1368. vec3 getIBLIrradiance( const in vec3 normal ) {
  1369. #if defined( ENVMAP_TYPE_CUBE_UV )
  1370. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  1371. vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
  1372. return PI * envMapColor.rgb * envMapIntensity;
  1373. #else
  1374. return vec3( 0.0 );
  1375. #endif
  1376. }
  1377. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  1378. #if defined( ENVMAP_TYPE_CUBE_UV )
  1379. vec3 reflectVec = reflect( - viewDir, normal );
  1380. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  1381. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  1382. vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
  1383. return envMapColor.rgb * envMapIntensity;
  1384. #else
  1385. return vec3( 0.0 );
  1386. #endif
  1387. }
  1388. #endif`,Hk=`ToonMaterial material;
  1389. material.diffuseColor = diffuseColor.rgb;`,Gk=`varying vec3 vViewPosition;
  1390. struct ToonMaterial {
  1391. vec3 diffuseColor;
  1392. };
  1393. void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  1394. vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
  1395. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1396. }
  1397. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  1398. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1399. }
  1400. #define RE_Direct RE_Direct_Toon
  1401. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Wk=`BlinnPhongMaterial material;
  1402. material.diffuseColor = diffuseColor.rgb;
  1403. material.specularColor = specular;
  1404. material.specularShininess = shininess;
  1405. material.specularStrength = specularStrength;`,jk=`varying vec3 vViewPosition;
  1406. struct BlinnPhongMaterial {
  1407. vec3 diffuseColor;
  1408. vec3 specularColor;
  1409. float specularShininess;
  1410. float specularStrength;
  1411. };
  1412. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  1413. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  1414. vec3 irradiance = dotNL * directLight.color;
  1415. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1416. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
  1417. }
  1418. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  1419. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1420. }
  1421. #define RE_Direct RE_Direct_BlinnPhong
  1422. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Kk=`PhysicalMaterial material;
  1423. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  1424. vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
  1425. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  1426. material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
  1427. material.roughness = min( material.roughness, 1.0 );
  1428. #ifdef IOR
  1429. material.ior = ior;
  1430. #ifdef SPECULAR
  1431. float specularIntensityFactor = specularIntensity;
  1432. vec3 specularColorFactor = specularColor;
  1433. #ifdef USE_SPECULARINTENSITYMAP
  1434. specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
  1435. #endif
  1436. #ifdef USE_SPECULARCOLORMAP
  1437. specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
  1438. #endif
  1439. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  1440. #else
  1441. float specularIntensityFactor = 1.0;
  1442. vec3 specularColorFactor = vec3( 1.0 );
  1443. material.specularF90 = 1.0;
  1444. #endif
  1445. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  1446. #else
  1447. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  1448. material.specularF90 = 1.0;
  1449. #endif
  1450. #ifdef USE_CLEARCOAT
  1451. material.clearcoat = clearcoat;
  1452. material.clearcoatRoughness = clearcoatRoughness;
  1453. material.clearcoatF0 = vec3( 0.04 );
  1454. material.clearcoatF90 = 1.0;
  1455. #ifdef USE_CLEARCOATMAP
  1456. material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
  1457. #endif
  1458. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  1459. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
  1460. #endif
  1461. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  1462. material.clearcoatRoughness += geometryRoughness;
  1463. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  1464. #endif
  1465. #ifdef USE_IRIDESCENCE
  1466. material.iridescence = iridescence;
  1467. material.iridescenceIOR = iridescenceIOR;
  1468. #ifdef USE_IRIDESCENCEMAP
  1469. material.iridescence *= texture2D( iridescenceMap, vUv ).r;
  1470. #endif
  1471. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  1472. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
  1473. #else
  1474. material.iridescenceThickness = iridescenceThicknessMaximum;
  1475. #endif
  1476. #endif
  1477. #ifdef USE_SHEEN
  1478. material.sheenColor = sheenColor;
  1479. #ifdef USE_SHEENCOLORMAP
  1480. material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
  1481. #endif
  1482. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  1483. #ifdef USE_SHEENROUGHNESSMAP
  1484. material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
  1485. #endif
  1486. #endif`,$k=`struct PhysicalMaterial {
  1487. vec3 diffuseColor;
  1488. float roughness;
  1489. vec3 specularColor;
  1490. float specularF90;
  1491. #ifdef USE_CLEARCOAT
  1492. float clearcoat;
  1493. float clearcoatRoughness;
  1494. vec3 clearcoatF0;
  1495. float clearcoatF90;
  1496. #endif
  1497. #ifdef USE_IRIDESCENCE
  1498. float iridescence;
  1499. float iridescenceIOR;
  1500. float iridescenceThickness;
  1501. vec3 iridescenceFresnel;
  1502. vec3 iridescenceF0;
  1503. #endif
  1504. #ifdef USE_SHEEN
  1505. vec3 sheenColor;
  1506. float sheenRoughness;
  1507. #endif
  1508. #ifdef IOR
  1509. float ior;
  1510. #endif
  1511. #ifdef USE_TRANSMISSION
  1512. float transmission;
  1513. float transmissionAlpha;
  1514. float thickness;
  1515. float attenuationDistance;
  1516. vec3 attenuationColor;
  1517. #endif
  1518. };
  1519. vec3 clearcoatSpecular = vec3( 0.0 );
  1520. vec3 sheenSpecular = vec3( 0.0 );
  1521. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  1522. float dotNV = saturate( dot( normal, viewDir ) );
  1523. float r2 = roughness * roughness;
  1524. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  1525. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  1526. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  1527. return saturate( DG * RECIPROCAL_PI );
  1528. }
  1529. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  1530. float dotNV = saturate( dot( normal, viewDir ) );
  1531. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  1532. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  1533. vec4 r = roughness * c0 + c1;
  1534. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  1535. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  1536. return fab;
  1537. }
  1538. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  1539. vec2 fab = DFGApprox( normal, viewDir, roughness );
  1540. return specularColor * fab.x + specularF90 * fab.y;
  1541. }
  1542. #ifdef USE_IRIDESCENCE
  1543. void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  1544. #else
  1545. void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  1546. #endif
  1547. vec2 fab = DFGApprox( normal, viewDir, roughness );
  1548. #ifdef USE_IRIDESCENCE
  1549. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  1550. #else
  1551. vec3 Fr = specularColor;
  1552. #endif
  1553. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  1554. float Ess = fab.x + fab.y;
  1555. float Ems = 1.0 - Ess;
  1556. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  1557. singleScatter += FssEss;
  1558. multiScatter += Fms * Ems;
  1559. }
  1560. #if NUM_RECT_AREA_LIGHTS > 0
  1561. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1562. vec3 normal = geometry.normal;
  1563. vec3 viewDir = geometry.viewDir;
  1564. vec3 position = geometry.position;
  1565. vec3 lightPos = rectAreaLight.position;
  1566. vec3 halfWidth = rectAreaLight.halfWidth;
  1567. vec3 halfHeight = rectAreaLight.halfHeight;
  1568. vec3 lightColor = rectAreaLight.color;
  1569. float roughness = material.roughness;
  1570. vec3 rectCoords[ 4 ];
  1571. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  1572. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  1573. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  1574. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  1575. vec4 t1 = texture2D( ltc_1, uv );
  1576. vec4 t2 = texture2D( ltc_2, uv );
  1577. mat3 mInv = mat3(
  1578. vec3( t1.x, 0, t1.y ),
  1579. vec3( 0, 1, 0 ),
  1580. vec3( t1.z, 0, t1.w )
  1581. );
  1582. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  1583. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  1584. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  1585. }
  1586. #endif
  1587. void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1588. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  1589. vec3 irradiance = dotNL * directLight.color;
  1590. #ifdef USE_CLEARCOAT
  1591. float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
  1592. vec3 ccIrradiance = dotNLcc * directLight.color;
  1593. clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  1594. #endif
  1595. #ifdef USE_SHEEN
  1596. sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
  1597. #endif
  1598. #ifdef USE_IRIDESCENCE
  1599. reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
  1600. #else
  1601. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
  1602. #endif
  1603. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1604. }
  1605. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1606. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1607. }
  1608. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  1609. #ifdef USE_CLEARCOAT
  1610. clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  1611. #endif
  1612. #ifdef USE_SHEEN
  1613. sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
  1614. #endif
  1615. vec3 singleScattering = vec3( 0.0 );
  1616. vec3 multiScattering = vec3( 0.0 );
  1617. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  1618. #ifdef USE_IRIDESCENCE
  1619. computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  1620. #else
  1621. computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  1622. #endif
  1623. vec3 totalScattering = singleScattering + multiScattering;
  1624. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  1625. reflectedLight.indirectSpecular += radiance * singleScattering;
  1626. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  1627. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  1628. }
  1629. #define RE_Direct RE_Direct_Physical
  1630. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  1631. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  1632. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  1633. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  1634. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  1635. }`,Zk=`
  1636. GeometricContext geometry;
  1637. geometry.position = - vViewPosition;
  1638. geometry.normal = normal;
  1639. geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  1640. #ifdef USE_CLEARCOAT
  1641. geometry.clearcoatNormal = clearcoatNormal;
  1642. #endif
  1643. #ifdef USE_IRIDESCENCE
  1644. float dotNVi = saturate( dot( normal, geometry.viewDir ) );
  1645. if ( material.iridescenceThickness == 0.0 ) {
  1646. material.iridescence = 0.0;
  1647. } else {
  1648. material.iridescence = saturate( material.iridescence );
  1649. }
  1650. if ( material.iridescence > 0.0 ) {
  1651. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  1652. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  1653. }
  1654. #endif
  1655. IncidentLight directLight;
  1656. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  1657. PointLight pointLight;
  1658. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  1659. PointLightShadow pointLightShadow;
  1660. #endif
  1661. #pragma unroll_loop_start
  1662. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1663. pointLight = pointLights[ i ];
  1664. getPointLightInfo( pointLight, geometry, directLight );
  1665. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  1666. pointLightShadow = pointLightShadows[ i ];
  1667. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  1668. #endif
  1669. RE_Direct( directLight, geometry, material, reflectedLight );
  1670. }
  1671. #pragma unroll_loop_end
  1672. #endif
  1673. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  1674. SpotLight spotLight;
  1675. vec4 spotColor;
  1676. vec3 spotLightCoord;
  1677. bool inSpotLightMap;
  1678. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  1679. SpotLightShadow spotLightShadow;
  1680. #endif
  1681. #pragma unroll_loop_start
  1682. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1683. spotLight = spotLights[ i ];
  1684. getSpotLightInfo( spotLight, geometry, directLight );
  1685. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  1686. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  1687. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1688. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  1689. #else
  1690. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  1691. #endif
  1692. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  1693. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  1694. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  1695. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  1696. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  1697. #endif
  1698. #undef SPOT_LIGHT_MAP_INDEX
  1699. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1700. spotLightShadow = spotLightShadows[ i ];
  1701. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  1702. #endif
  1703. RE_Direct( directLight, geometry, material, reflectedLight );
  1704. }
  1705. #pragma unroll_loop_end
  1706. #endif
  1707. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  1708. DirectionalLight directionalLight;
  1709. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  1710. DirectionalLightShadow directionalLightShadow;
  1711. #endif
  1712. #pragma unroll_loop_start
  1713. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1714. directionalLight = directionalLights[ i ];
  1715. getDirectionalLightInfo( directionalLight, geometry, directLight );
  1716. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  1717. directionalLightShadow = directionalLightShadows[ i ];
  1718. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1719. #endif
  1720. RE_Direct( directLight, geometry, material, reflectedLight );
  1721. }
  1722. #pragma unroll_loop_end
  1723. #endif
  1724. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  1725. RectAreaLight rectAreaLight;
  1726. #pragma unroll_loop_start
  1727. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  1728. rectAreaLight = rectAreaLights[ i ];
  1729. RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
  1730. }
  1731. #pragma unroll_loop_end
  1732. #endif
  1733. #if defined( RE_IndirectDiffuse )
  1734. vec3 iblIrradiance = vec3( 0.0 );
  1735. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  1736. irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
  1737. #if ( NUM_HEMI_LIGHTS > 0 )
  1738. #pragma unroll_loop_start
  1739. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  1740. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
  1741. }
  1742. #pragma unroll_loop_end
  1743. #endif
  1744. #endif
  1745. #if defined( RE_IndirectSpecular )
  1746. vec3 radiance = vec3( 0.0 );
  1747. vec3 clearcoatRadiance = vec3( 0.0 );
  1748. #endif`,Xk=`#if defined( RE_IndirectDiffuse )
  1749. #ifdef USE_LIGHTMAP
  1750. vec4 lightMapTexel = texture2D( lightMap, vUv2 );
  1751. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  1752. irradiance += lightMapIrradiance;
  1753. #endif
  1754. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  1755. iblIrradiance += getIBLIrradiance( geometry.normal );
  1756. #endif
  1757. #endif
  1758. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  1759. radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
  1760. #ifdef USE_CLEARCOAT
  1761. clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
  1762. #endif
  1763. #endif`,qk=`#if defined( RE_IndirectDiffuse )
  1764. RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
  1765. #endif
  1766. #if defined( RE_IndirectSpecular )
  1767. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
  1768. #endif`,Yk=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  1769. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  1770. #endif`,Jk=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  1771. uniform float logDepthBufFC;
  1772. varying float vFragDepth;
  1773. varying float vIsPerspective;
  1774. #endif`,e5=`#ifdef USE_LOGDEPTHBUF
  1775. #ifdef USE_LOGDEPTHBUF_EXT
  1776. varying float vFragDepth;
  1777. varying float vIsPerspective;
  1778. #else
  1779. uniform float logDepthBufFC;
  1780. #endif
  1781. #endif`,t5=`#ifdef USE_LOGDEPTHBUF
  1782. #ifdef USE_LOGDEPTHBUF_EXT
  1783. vFragDepth = 1.0 + gl_Position.w;
  1784. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  1785. #else
  1786. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  1787. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  1788. gl_Position.z *= gl_Position.w;
  1789. }
  1790. #endif
  1791. #endif`,i5=`#ifdef USE_MAP
  1792. vec4 sampledDiffuseColor = texture2D( map, vUv );
  1793. #ifdef DECODE_VIDEO_TEXTURE
  1794. sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
  1795. #endif
  1796. diffuseColor *= sampledDiffuseColor;
  1797. #endif`,n5=`#ifdef USE_MAP
  1798. uniform sampler2D map;
  1799. #endif`,r5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1800. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  1801. #endif
  1802. #ifdef USE_MAP
  1803. diffuseColor *= texture2D( map, uv );
  1804. #endif
  1805. #ifdef USE_ALPHAMAP
  1806. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  1807. #endif`,s5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1808. uniform mat3 uvTransform;
  1809. #endif
  1810. #ifdef USE_MAP
  1811. uniform sampler2D map;
  1812. #endif
  1813. #ifdef USE_ALPHAMAP
  1814. uniform sampler2D alphaMap;
  1815. #endif`,o5=`float metalnessFactor = metalness;
  1816. #ifdef USE_METALNESSMAP
  1817. vec4 texelMetalness = texture2D( metalnessMap, vUv );
  1818. metalnessFactor *= texelMetalness.b;
  1819. #endif`,a5=`#ifdef USE_METALNESSMAP
  1820. uniform sampler2D metalnessMap;
  1821. #endif`,l5=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
  1822. vColor *= morphTargetBaseInfluence;
  1823. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1824. #if defined( USE_COLOR_ALPHA )
  1825. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  1826. #elif defined( USE_COLOR )
  1827. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  1828. #endif
  1829. }
  1830. #endif`,c5=`#ifdef USE_MORPHNORMALS
  1831. objectNormal *= morphTargetBaseInfluence;
  1832. #ifdef MORPHTARGETS_TEXTURE
  1833. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1834. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  1835. }
  1836. #else
  1837. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  1838. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  1839. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  1840. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  1841. #endif
  1842. #endif`,h5=`#ifdef USE_MORPHTARGETS
  1843. uniform float morphTargetBaseInfluence;
  1844. #ifdef MORPHTARGETS_TEXTURE
  1845. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  1846. uniform sampler2DArray morphTargetsTexture;
  1847. uniform ivec2 morphTargetsTextureSize;
  1848. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  1849. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  1850. int y = texelIndex / morphTargetsTextureSize.x;
  1851. int x = texelIndex - y * morphTargetsTextureSize.x;
  1852. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  1853. return texelFetch( morphTargetsTexture, morphUV, 0 );
  1854. }
  1855. #else
  1856. #ifndef USE_MORPHNORMALS
  1857. uniform float morphTargetInfluences[ 8 ];
  1858. #else
  1859. uniform float morphTargetInfluences[ 4 ];
  1860. #endif
  1861. #endif
  1862. #endif`,u5=`#ifdef USE_MORPHTARGETS
  1863. transformed *= morphTargetBaseInfluence;
  1864. #ifdef MORPHTARGETS_TEXTURE
  1865. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1866. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  1867. }
  1868. #else
  1869. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  1870. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  1871. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  1872. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  1873. #ifndef USE_MORPHNORMALS
  1874. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  1875. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  1876. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  1877. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  1878. #endif
  1879. #endif
  1880. #endif`,A5=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  1881. #ifdef FLAT_SHADED
  1882. vec3 fdx = dFdx( vViewPosition );
  1883. vec3 fdy = dFdy( vViewPosition );
  1884. vec3 normal = normalize( cross( fdx, fdy ) );
  1885. #else
  1886. vec3 normal = normalize( vNormal );
  1887. #ifdef DOUBLE_SIDED
  1888. normal = normal * faceDirection;
  1889. #endif
  1890. #ifdef USE_TANGENT
  1891. vec3 tangent = normalize( vTangent );
  1892. vec3 bitangent = normalize( vBitangent );
  1893. #ifdef DOUBLE_SIDED
  1894. tangent = tangent * faceDirection;
  1895. bitangent = bitangent * faceDirection;
  1896. #endif
  1897. #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
  1898. mat3 vTBN = mat3( tangent, bitangent, normal );
  1899. #endif
  1900. #endif
  1901. #endif
  1902. vec3 geometryNormal = normal;`,d5=`#ifdef OBJECTSPACE_NORMALMAP
  1903. normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
  1904. #ifdef FLIP_SIDED
  1905. normal = - normal;
  1906. #endif
  1907. #ifdef DOUBLE_SIDED
  1908. normal = normal * faceDirection;
  1909. #endif
  1910. normal = normalize( normalMatrix * normal );
  1911. #elif defined( TANGENTSPACE_NORMALMAP )
  1912. vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
  1913. mapN.xy *= normalScale;
  1914. #ifdef USE_TANGENT
  1915. normal = normalize( vTBN * mapN );
  1916. #else
  1917. normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
  1918. #endif
  1919. #elif defined( USE_BUMPMAP )
  1920. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  1921. #endif`,p5=`#ifndef FLAT_SHADED
  1922. varying vec3 vNormal;
  1923. #ifdef USE_TANGENT
  1924. varying vec3 vTangent;
  1925. varying vec3 vBitangent;
  1926. #endif
  1927. #endif`,f5=`#ifndef FLAT_SHADED
  1928. varying vec3 vNormal;
  1929. #ifdef USE_TANGENT
  1930. varying vec3 vTangent;
  1931. varying vec3 vBitangent;
  1932. #endif
  1933. #endif`,m5=`#ifndef FLAT_SHADED
  1934. vNormal = normalize( transformedNormal );
  1935. #ifdef USE_TANGENT
  1936. vTangent = normalize( transformedTangent );
  1937. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  1938. #endif
  1939. #endif`,g5=`#ifdef USE_NORMALMAP
  1940. uniform sampler2D normalMap;
  1941. uniform vec2 normalScale;
  1942. #endif
  1943. #ifdef OBJECTSPACE_NORMALMAP
  1944. uniform mat3 normalMatrix;
  1945. #endif
  1946. #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
  1947. vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
  1948. vec3 q0 = dFdx( eye_pos.xyz );
  1949. vec3 q1 = dFdy( eye_pos.xyz );
  1950. vec2 st0 = dFdx( vUv.st );
  1951. vec2 st1 = dFdy( vUv.st );
  1952. vec3 N = surf_norm;
  1953. vec3 q1perp = cross( q1, N );
  1954. vec3 q0perp = cross( N, q0 );
  1955. vec3 T = q1perp * st0.x + q0perp * st1.x;
  1956. vec3 B = q1perp * st0.y + q0perp * st1.y;
  1957. float det = max( dot( T, T ), dot( B, B ) );
  1958. float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
  1959. return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
  1960. }
  1961. #endif`,_5=`#ifdef USE_CLEARCOAT
  1962. vec3 clearcoatNormal = geometryNormal;
  1963. #endif`,y5=`#ifdef USE_CLEARCOAT_NORMALMAP
  1964. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
  1965. clearcoatMapN.xy *= clearcoatNormalScale;
  1966. #ifdef USE_TANGENT
  1967. clearcoatNormal = normalize( vTBN * clearcoatMapN );
  1968. #else
  1969. clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
  1970. #endif
  1971. #endif`,x5=`#ifdef USE_CLEARCOATMAP
  1972. uniform sampler2D clearcoatMap;
  1973. #endif
  1974. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  1975. uniform sampler2D clearcoatRoughnessMap;
  1976. #endif
  1977. #ifdef USE_CLEARCOAT_NORMALMAP
  1978. uniform sampler2D clearcoatNormalMap;
  1979. uniform vec2 clearcoatNormalScale;
  1980. #endif`,v5=`#ifdef USE_IRIDESCENCEMAP
  1981. uniform sampler2D iridescenceMap;
  1982. #endif
  1983. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  1984. uniform sampler2D iridescenceThicknessMap;
  1985. #endif`,w5=`#ifdef OPAQUE
  1986. diffuseColor.a = 1.0;
  1987. #endif
  1988. #ifdef USE_TRANSMISSION
  1989. diffuseColor.a *= material.transmissionAlpha + 0.1;
  1990. #endif
  1991. gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,b5=`vec3 packNormalToRGB( const in vec3 normal ) {
  1992. return normalize( normal ) * 0.5 + 0.5;
  1993. }
  1994. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  1995. return 2.0 * rgb.xyz - 1.0;
  1996. }
  1997. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  1998. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  1999. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  2000. const float ShiftRight8 = 1. / 256.;
  2001. vec4 packDepthToRGBA( const in float v ) {
  2002. vec4 r = vec4( fract( v * PackFactors ), v );
  2003. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  2004. }
  2005. float unpackRGBAToDepth( const in vec4 v ) {
  2006. return dot( v, UnpackFactors );
  2007. }
  2008. vec2 packDepthToRG( in highp float v ) {
  2009. return packDepthToRGBA( v ).yx;
  2010. }
  2011. float unpackRGToDepth( const in highp vec2 v ) {
  2012. return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
  2013. }
  2014. vec4 pack2HalfToRGBA( vec2 v ) {
  2015. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  2016. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  2017. }
  2018. vec2 unpackRGBATo2Half( vec4 v ) {
  2019. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  2020. }
  2021. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  2022. return ( viewZ + near ) / ( near - far );
  2023. }
  2024. float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
  2025. return linearClipZ * ( near - far ) - near;
  2026. }
  2027. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  2028. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  2029. }
  2030. float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
  2031. return ( near * far ) / ( ( far - near ) * invClipZ - far );
  2032. }`,B5=`#ifdef PREMULTIPLIED_ALPHA
  2033. gl_FragColor.rgb *= gl_FragColor.a;
  2034. #endif`,C5=`vec4 mvPosition = vec4( transformed, 1.0 );
  2035. #ifdef USE_INSTANCING
  2036. mvPosition = instanceMatrix * mvPosition;
  2037. #endif
  2038. mvPosition = modelViewMatrix * mvPosition;
  2039. gl_Position = projectionMatrix * mvPosition;`,E5=`#ifdef DITHERING
  2040. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  2041. #endif`,T5=`#ifdef DITHERING
  2042. vec3 dithering( vec3 color ) {
  2043. float grid_position = rand( gl_FragCoord.xy );
  2044. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  2045. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  2046. return color + dither_shift_RGB;
  2047. }
  2048. #endif`,S5=`float roughnessFactor = roughness;
  2049. #ifdef USE_ROUGHNESSMAP
  2050. vec4 texelRoughness = texture2D( roughnessMap, vUv );
  2051. roughnessFactor *= texelRoughness.g;
  2052. #endif`,M5=`#ifdef USE_ROUGHNESSMAP
  2053. uniform sampler2D roughnessMap;
  2054. #endif`,I5=`#if NUM_SPOT_LIGHT_COORDS > 0
  2055. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  2056. #endif
  2057. #if NUM_SPOT_LIGHT_MAPS > 0
  2058. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  2059. #endif
  2060. #ifdef USE_SHADOWMAP
  2061. #if NUM_DIR_LIGHT_SHADOWS > 0
  2062. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  2063. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  2064. struct DirectionalLightShadow {
  2065. float shadowBias;
  2066. float shadowNormalBias;
  2067. float shadowRadius;
  2068. vec2 shadowMapSize;
  2069. };
  2070. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  2071. #endif
  2072. #if NUM_SPOT_LIGHT_SHADOWS > 0
  2073. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  2074. struct SpotLightShadow {
  2075. float shadowBias;
  2076. float shadowNormalBias;
  2077. float shadowRadius;
  2078. vec2 shadowMapSize;
  2079. };
  2080. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  2081. #endif
  2082. #if NUM_POINT_LIGHT_SHADOWS > 0
  2083. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  2084. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  2085. struct PointLightShadow {
  2086. float shadowBias;
  2087. float shadowNormalBias;
  2088. float shadowRadius;
  2089. vec2 shadowMapSize;
  2090. float shadowCameraNear;
  2091. float shadowCameraFar;
  2092. };
  2093. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  2094. #endif
  2095. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  2096. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  2097. }
  2098. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  2099. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  2100. }
  2101. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  2102. float occlusion = 1.0;
  2103. vec2 distribution = texture2DDistribution( shadow, uv );
  2104. float hard_shadow = step( compare , distribution.x );
  2105. if (hard_shadow != 1.0 ) {
  2106. float distance = compare - distribution.x ;
  2107. float variance = max( 0.00000, distribution.y * distribution.y );
  2108. float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
  2109. }
  2110. return occlusion;
  2111. }
  2112. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  2113. float shadow = 1.0;
  2114. shadowCoord.xyz /= shadowCoord.w;
  2115. shadowCoord.z += shadowBias;
  2116. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  2117. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  2118. if ( frustumTest ) {
  2119. #if defined( SHADOWMAP_TYPE_PCF )
  2120. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  2121. float dx0 = - texelSize.x * shadowRadius;
  2122. float dy0 = - texelSize.y * shadowRadius;
  2123. float dx1 = + texelSize.x * shadowRadius;
  2124. float dy1 = + texelSize.y * shadowRadius;
  2125. float dx2 = dx0 / 2.0;
  2126. float dy2 = dy0 / 2.0;
  2127. float dx3 = dx1 / 2.0;
  2128. float dy3 = dy1 / 2.0;
  2129. shadow = (
  2130. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  2131. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  2132. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  2133. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  2134. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  2135. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  2136. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  2137. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  2138. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  2139. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  2140. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  2141. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  2142. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  2143. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  2144. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  2145. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  2146. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  2147. ) * ( 1.0 / 17.0 );
  2148. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  2149. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  2150. float dx = texelSize.x;
  2151. float dy = texelSize.y;
  2152. vec2 uv = shadowCoord.xy;
  2153. vec2 f = fract( uv * shadowMapSize + 0.5 );
  2154. uv -= f * texelSize;
  2155. shadow = (
  2156. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  2157. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  2158. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  2159. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  2160. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  2161. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  2162. f.x ) +
  2163. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  2164. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  2165. f.x ) +
  2166. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  2167. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  2168. f.y ) +
  2169. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  2170. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  2171. f.y ) +
  2172. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  2173. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  2174. f.x ),
  2175. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  2176. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  2177. f.x ),
  2178. f.y )
  2179. ) * ( 1.0 / 9.0 );
  2180. #elif defined( SHADOWMAP_TYPE_VSM )
  2181. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  2182. #else
  2183. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  2184. #endif
  2185. }
  2186. return shadow;
  2187. }
  2188. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  2189. vec3 absV = abs( v );
  2190. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  2191. absV *= scaleToCube;
  2192. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  2193. vec2 planar = v.xy;
  2194. float almostATexel = 1.5 * texelSizeY;
  2195. float almostOne = 1.0 - almostATexel;
  2196. if ( absV.z >= almostOne ) {
  2197. if ( v.z > 0.0 )
  2198. planar.x = 4.0 - v.x;
  2199. } else if ( absV.x >= almostOne ) {
  2200. float signX = sign( v.x );
  2201. planar.x = v.z * signX + 2.0 * signX;
  2202. } else if ( absV.y >= almostOne ) {
  2203. float signY = sign( v.y );
  2204. planar.x = v.x + 2.0 * signY + 2.0;
  2205. planar.y = v.z * signY - 2.0;
  2206. }
  2207. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  2208. }
  2209. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  2210. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  2211. vec3 lightToPosition = shadowCoord.xyz;
  2212. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  2213. vec3 bd3D = normalize( lightToPosition );
  2214. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  2215. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  2216. return (
  2217. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  2218. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  2219. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  2220. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  2221. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  2222. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  2223. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  2224. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  2225. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  2226. ) * ( 1.0 / 9.0 );
  2227. #else
  2228. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  2229. #endif
  2230. }
  2231. #endif`,F5=`#if NUM_SPOT_LIGHT_COORDS > 0
  2232. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  2233. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  2234. #endif
  2235. #ifdef USE_SHADOWMAP
  2236. #if NUM_DIR_LIGHT_SHADOWS > 0
  2237. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  2238. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  2239. struct DirectionalLightShadow {
  2240. float shadowBias;
  2241. float shadowNormalBias;
  2242. float shadowRadius;
  2243. vec2 shadowMapSize;
  2244. };
  2245. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  2246. #endif
  2247. #if NUM_SPOT_LIGHT_SHADOWS > 0
  2248. struct SpotLightShadow {
  2249. float shadowBias;
  2250. float shadowNormalBias;
  2251. float shadowRadius;
  2252. vec2 shadowMapSize;
  2253. };
  2254. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  2255. #endif
  2256. #if NUM_POINT_LIGHT_SHADOWS > 0
  2257. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  2258. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  2259. struct PointLightShadow {
  2260. float shadowBias;
  2261. float shadowNormalBias;
  2262. float shadowRadius;
  2263. vec2 shadowMapSize;
  2264. float shadowCameraNear;
  2265. float shadowCameraFar;
  2266. };
  2267. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  2268. #endif
  2269. #endif`,L5=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  2270. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  2271. vec4 shadowWorldPosition;
  2272. #endif
  2273. #if defined( USE_SHADOWMAP )
  2274. #if NUM_DIR_LIGHT_SHADOWS > 0
  2275. #pragma unroll_loop_start
  2276. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  2277. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  2278. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  2279. }
  2280. #pragma unroll_loop_end
  2281. #endif
  2282. #if NUM_POINT_LIGHT_SHADOWS > 0
  2283. #pragma unroll_loop_start
  2284. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  2285. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  2286. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  2287. }
  2288. #pragma unroll_loop_end
  2289. #endif
  2290. #endif
  2291. #if NUM_SPOT_LIGHT_COORDS > 0
  2292. #pragma unroll_loop_start
  2293. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  2294. shadowWorldPosition = worldPosition;
  2295. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  2296. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  2297. #endif
  2298. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  2299. }
  2300. #pragma unroll_loop_end
  2301. #endif`,D5=`float getShadowMask() {
  2302. float shadow = 1.0;
  2303. #ifdef USE_SHADOWMAP
  2304. #if NUM_DIR_LIGHT_SHADOWS > 0
  2305. DirectionalLightShadow directionalLight;
  2306. #pragma unroll_loop_start
  2307. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  2308. directionalLight = directionalLightShadows[ i ];
  2309. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  2310. }
  2311. #pragma unroll_loop_end
  2312. #endif
  2313. #if NUM_SPOT_LIGHT_SHADOWS > 0
  2314. SpotLightShadow spotLight;
  2315. #pragma unroll_loop_start
  2316. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  2317. spotLight = spotLightShadows[ i ];
  2318. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  2319. }
  2320. #pragma unroll_loop_end
  2321. #endif
  2322. #if NUM_POINT_LIGHT_SHADOWS > 0
  2323. PointLightShadow pointLight;
  2324. #pragma unroll_loop_start
  2325. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  2326. pointLight = pointLightShadows[ i ];
  2327. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  2328. }
  2329. #pragma unroll_loop_end
  2330. #endif
  2331. #endif
  2332. return shadow;
  2333. }`,P5=`#ifdef USE_SKINNING
  2334. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  2335. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  2336. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  2337. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  2338. #endif`,U5=`#ifdef USE_SKINNING
  2339. uniform mat4 bindMatrix;
  2340. uniform mat4 bindMatrixInverse;
  2341. uniform highp sampler2D boneTexture;
  2342. uniform int boneTextureSize;
  2343. mat4 getBoneMatrix( const in float i ) {
  2344. float j = i * 4.0;
  2345. float x = mod( j, float( boneTextureSize ) );
  2346. float y = floor( j / float( boneTextureSize ) );
  2347. float dx = 1.0 / float( boneTextureSize );
  2348. float dy = 1.0 / float( boneTextureSize );
  2349. y = dy * ( y + 0.5 );
  2350. vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
  2351. vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
  2352. vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
  2353. vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
  2354. mat4 bone = mat4( v1, v2, v3, v4 );
  2355. return bone;
  2356. }
  2357. #endif`,R5=`#ifdef USE_SKINNING
  2358. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  2359. vec4 skinned = vec4( 0.0 );
  2360. skinned += boneMatX * skinVertex * skinWeight.x;
  2361. skinned += boneMatY * skinVertex * skinWeight.y;
  2362. skinned += boneMatZ * skinVertex * skinWeight.z;
  2363. skinned += boneMatW * skinVertex * skinWeight.w;
  2364. transformed = ( bindMatrixInverse * skinned ).xyz;
  2365. #endif`,z5=`#ifdef USE_SKINNING
  2366. mat4 skinMatrix = mat4( 0.0 );
  2367. skinMatrix += skinWeight.x * boneMatX;
  2368. skinMatrix += skinWeight.y * boneMatY;
  2369. skinMatrix += skinWeight.z * boneMatZ;
  2370. skinMatrix += skinWeight.w * boneMatW;
  2371. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  2372. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  2373. #ifdef USE_TANGENT
  2374. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  2375. #endif
  2376. #endif`,k5=`float specularStrength;
  2377. #ifdef USE_SPECULARMAP
  2378. vec4 texelSpecular = texture2D( specularMap, vUv );
  2379. specularStrength = texelSpecular.r;
  2380. #else
  2381. specularStrength = 1.0;
  2382. #endif`,O5=`#ifdef USE_SPECULARMAP
  2383. uniform sampler2D specularMap;
  2384. #endif`,N5=`#if defined( TONE_MAPPING )
  2385. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  2386. #endif`,Q5=`#ifndef saturate
  2387. #define saturate( a ) clamp( a, 0.0, 1.0 )
  2388. #endif
  2389. uniform float toneMappingExposure;
  2390. vec3 LinearToneMapping( vec3 color ) {
  2391. return toneMappingExposure * color;
  2392. }
  2393. vec3 ReinhardToneMapping( vec3 color ) {
  2394. color *= toneMappingExposure;
  2395. return saturate( color / ( vec3( 1.0 ) + color ) );
  2396. }
  2397. vec3 OptimizedCineonToneMapping( vec3 color ) {
  2398. color *= toneMappingExposure;
  2399. color = max( vec3( 0.0 ), color - 0.004 );
  2400. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  2401. }
  2402. vec3 RRTAndODTFit( vec3 v ) {
  2403. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  2404. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  2405. return a / b;
  2406. }
  2407. vec3 ACESFilmicToneMapping( vec3 color ) {
  2408. const mat3 ACESInputMat = mat3(
  2409. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  2410. vec3( 0.04823, 0.01566, 0.83777 )
  2411. );
  2412. const mat3 ACESOutputMat = mat3(
  2413. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  2414. vec3( -0.07367, -0.00605, 1.07602 )
  2415. );
  2416. color *= toneMappingExposure / 0.6;
  2417. color = ACESInputMat * color;
  2418. color = RRTAndODTFit( color );
  2419. color = ACESOutputMat * color;
  2420. return saturate( color );
  2421. }
  2422. vec3 CustomToneMapping( vec3 color ) { return color; }`,V5=`#ifdef USE_TRANSMISSION
  2423. material.transmission = transmission;
  2424. material.transmissionAlpha = 1.0;
  2425. material.thickness = thickness;
  2426. material.attenuationDistance = attenuationDistance;
  2427. material.attenuationColor = attenuationColor;
  2428. #ifdef USE_TRANSMISSIONMAP
  2429. material.transmission *= texture2D( transmissionMap, vUv ).r;
  2430. #endif
  2431. #ifdef USE_THICKNESSMAP
  2432. material.thickness *= texture2D( thicknessMap, vUv ).g;
  2433. #endif
  2434. vec3 pos = vWorldPosition;
  2435. vec3 v = normalize( cameraPosition - pos );
  2436. vec3 n = inverseTransformDirection( normal, viewMatrix );
  2437. vec4 transmission = getIBLVolumeRefraction(
  2438. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  2439. pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
  2440. material.attenuationColor, material.attenuationDistance );
  2441. material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
  2442. totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
  2443. #endif`,H5=`#ifdef USE_TRANSMISSION
  2444. uniform float transmission;
  2445. uniform float thickness;
  2446. uniform float attenuationDistance;
  2447. uniform vec3 attenuationColor;
  2448. #ifdef USE_TRANSMISSIONMAP
  2449. uniform sampler2D transmissionMap;
  2450. #endif
  2451. #ifdef USE_THICKNESSMAP
  2452. uniform sampler2D thicknessMap;
  2453. #endif
  2454. uniform vec2 transmissionSamplerSize;
  2455. uniform sampler2D transmissionSamplerMap;
  2456. uniform mat4 modelMatrix;
  2457. uniform mat4 projectionMatrix;
  2458. varying vec3 vWorldPosition;
  2459. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  2460. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  2461. vec3 modelScale;
  2462. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  2463. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  2464. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  2465. return normalize( refractionVector ) * thickness * modelScale;
  2466. }
  2467. float applyIorToRoughness( const in float roughness, const in float ior ) {
  2468. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  2469. }
  2470. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  2471. float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  2472. #ifdef texture2DLodEXT
  2473. return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
  2474. #else
  2475. return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
  2476. #endif
  2477. }
  2478. vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  2479. if ( isinf( attenuationDistance ) ) {
  2480. return radiance;
  2481. } else {
  2482. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  2483. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
  2484. }
  2485. }
  2486. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  2487. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  2488. const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
  2489. const in vec3 attenuationColor, const in float attenuationDistance ) {
  2490. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  2491. vec3 refractedRayExit = position + transmissionRay;
  2492. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  2493. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  2494. refractionCoords += 1.0;
  2495. refractionCoords /= 2.0;
  2496. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  2497. vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
  2498. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  2499. return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
  2500. }
  2501. #endif`,G5=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
  2502. varying vec2 vUv;
  2503. #endif`,W5=`#ifdef USE_UV
  2504. #ifdef UVS_VERTEX_ONLY
  2505. vec2 vUv;
  2506. #else
  2507. varying vec2 vUv;
  2508. #endif
  2509. uniform mat3 uvTransform;
  2510. #endif`,j5=`#ifdef USE_UV
  2511. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  2512. #endif`,K5=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  2513. varying vec2 vUv2;
  2514. #endif`,$5=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  2515. attribute vec2 uv2;
  2516. varying vec2 vUv2;
  2517. uniform mat3 uv2Transform;
  2518. #endif`,Z5=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  2519. vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
  2520. #endif`,X5=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  2521. vec4 worldPosition = vec4( transformed, 1.0 );
  2522. #ifdef USE_INSTANCING
  2523. worldPosition = instanceMatrix * worldPosition;
  2524. #endif
  2525. worldPosition = modelMatrix * worldPosition;
  2526. #endif`;const q5=`varying vec2 vUv;
  2527. uniform mat3 uvTransform;
  2528. void main() {
  2529. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  2530. gl_Position = vec4( position.xy, 1.0, 1.0 );
  2531. }`,Y5=`uniform sampler2D t2D;
  2532. uniform float backgroundIntensity;
  2533. varying vec2 vUv;
  2534. void main() {
  2535. vec4 texColor = texture2D( t2D, vUv );
  2536. #ifdef DECODE_VIDEO_TEXTURE
  2537. texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
  2538. #endif
  2539. texColor.rgb *= backgroundIntensity;
  2540. gl_FragColor = texColor;
  2541. #include <tonemapping_fragment>
  2542. #include <encodings_fragment>
  2543. }`,J5=`varying vec3 vWorldDirection;
  2544. #include <common>
  2545. void main() {
  2546. vWorldDirection = transformDirection( position, modelMatrix );
  2547. #include <begin_vertex>
  2548. #include <project_vertex>
  2549. gl_Position.z = gl_Position.w;
  2550. }`,eO=`#ifdef ENVMAP_TYPE_CUBE
  2551. uniform samplerCube envMap;
  2552. #elif defined( ENVMAP_TYPE_CUBE_UV )
  2553. uniform sampler2D envMap;
  2554. #endif
  2555. uniform float flipEnvMap;
  2556. uniform float backgroundBlurriness;
  2557. uniform float backgroundIntensity;
  2558. varying vec3 vWorldDirection;
  2559. #include <cube_uv_reflection_fragment>
  2560. void main() {
  2561. #ifdef ENVMAP_TYPE_CUBE
  2562. vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  2563. #elif defined( ENVMAP_TYPE_CUBE_UV )
  2564. vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
  2565. #else
  2566. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  2567. #endif
  2568. texColor.rgb *= backgroundIntensity;
  2569. gl_FragColor = texColor;
  2570. #include <tonemapping_fragment>
  2571. #include <encodings_fragment>
  2572. }`,tO=`varying vec3 vWorldDirection;
  2573. #include <common>
  2574. void main() {
  2575. vWorldDirection = transformDirection( position, modelMatrix );
  2576. #include <begin_vertex>
  2577. #include <project_vertex>
  2578. gl_Position.z = gl_Position.w;
  2579. }`,iO=`uniform samplerCube tCube;
  2580. uniform float tFlip;
  2581. uniform float opacity;
  2582. varying vec3 vWorldDirection;
  2583. void main() {
  2584. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  2585. gl_FragColor = texColor;
  2586. gl_FragColor.a *= opacity;
  2587. #include <tonemapping_fragment>
  2588. #include <encodings_fragment>
  2589. }`,nO=`#include <common>
  2590. #include <uv_pars_vertex>
  2591. #include <displacementmap_pars_vertex>
  2592. #include <morphtarget_pars_vertex>
  2593. #include <skinning_pars_vertex>
  2594. #include <logdepthbuf_pars_vertex>
  2595. #include <clipping_planes_pars_vertex>
  2596. varying vec2 vHighPrecisionZW;
  2597. void main() {
  2598. #include <uv_vertex>
  2599. #include <skinbase_vertex>
  2600. #ifdef USE_DISPLACEMENTMAP
  2601. #include <beginnormal_vertex>
  2602. #include <morphnormal_vertex>
  2603. #include <skinnormal_vertex>
  2604. #endif
  2605. #include <begin_vertex>
  2606. #include <morphtarget_vertex>
  2607. #include <skinning_vertex>
  2608. #include <displacementmap_vertex>
  2609. #include <project_vertex>
  2610. #include <logdepthbuf_vertex>
  2611. #include <clipping_planes_vertex>
  2612. vHighPrecisionZW = gl_Position.zw;
  2613. }`,rO=`#if DEPTH_PACKING == 3200
  2614. uniform float opacity;
  2615. #endif
  2616. #include <common>
  2617. #include <packing>
  2618. #include <uv_pars_fragment>
  2619. #include <map_pars_fragment>
  2620. #include <alphamap_pars_fragment>
  2621. #include <alphatest_pars_fragment>
  2622. #include <logdepthbuf_pars_fragment>
  2623. #include <clipping_planes_pars_fragment>
  2624. varying vec2 vHighPrecisionZW;
  2625. void main() {
  2626. #include <clipping_planes_fragment>
  2627. vec4 diffuseColor = vec4( 1.0 );
  2628. #if DEPTH_PACKING == 3200
  2629. diffuseColor.a = opacity;
  2630. #endif
  2631. #include <map_fragment>
  2632. #include <alphamap_fragment>
  2633. #include <alphatest_fragment>
  2634. #include <logdepthbuf_fragment>
  2635. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  2636. #if DEPTH_PACKING == 3200
  2637. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  2638. #elif DEPTH_PACKING == 3201
  2639. gl_FragColor = packDepthToRGBA( fragCoordZ );
  2640. #endif
  2641. }`,sO=`#define DISTANCE
  2642. varying vec3 vWorldPosition;
  2643. #include <common>
  2644. #include <uv_pars_vertex>
  2645. #include <displacementmap_pars_vertex>
  2646. #include <morphtarget_pars_vertex>
  2647. #include <skinning_pars_vertex>
  2648. #include <clipping_planes_pars_vertex>
  2649. void main() {
  2650. #include <uv_vertex>
  2651. #include <skinbase_vertex>
  2652. #ifdef USE_DISPLACEMENTMAP
  2653. #include <beginnormal_vertex>
  2654. #include <morphnormal_vertex>
  2655. #include <skinnormal_vertex>
  2656. #endif
  2657. #include <begin_vertex>
  2658. #include <morphtarget_vertex>
  2659. #include <skinning_vertex>
  2660. #include <displacementmap_vertex>
  2661. #include <project_vertex>
  2662. #include <worldpos_vertex>
  2663. #include <clipping_planes_vertex>
  2664. vWorldPosition = worldPosition.xyz;
  2665. }`,oO=`#define DISTANCE
  2666. uniform vec3 referencePosition;
  2667. uniform float nearDistance;
  2668. uniform float farDistance;
  2669. varying vec3 vWorldPosition;
  2670. #include <common>
  2671. #include <packing>
  2672. #include <uv_pars_fragment>
  2673. #include <map_pars_fragment>
  2674. #include <alphamap_pars_fragment>
  2675. #include <alphatest_pars_fragment>
  2676. #include <clipping_planes_pars_fragment>
  2677. void main () {
  2678. #include <clipping_planes_fragment>
  2679. vec4 diffuseColor = vec4( 1.0 );
  2680. #include <map_fragment>
  2681. #include <alphamap_fragment>
  2682. #include <alphatest_fragment>
  2683. float dist = length( vWorldPosition - referencePosition );
  2684. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  2685. dist = saturate( dist );
  2686. gl_FragColor = packDepthToRGBA( dist );
  2687. }`,aO=`varying vec3 vWorldDirection;
  2688. #include <common>
  2689. void main() {
  2690. vWorldDirection = transformDirection( position, modelMatrix );
  2691. #include <begin_vertex>
  2692. #include <project_vertex>
  2693. }`,lO=`uniform sampler2D tEquirect;
  2694. varying vec3 vWorldDirection;
  2695. #include <common>
  2696. void main() {
  2697. vec3 direction = normalize( vWorldDirection );
  2698. vec2 sampleUV = equirectUv( direction );
  2699. gl_FragColor = texture2D( tEquirect, sampleUV );
  2700. #include <tonemapping_fragment>
  2701. #include <encodings_fragment>
  2702. }`,cO=`uniform float scale;
  2703. attribute float lineDistance;
  2704. varying float vLineDistance;
  2705. #include <common>
  2706. #include <color_pars_vertex>
  2707. #include <fog_pars_vertex>
  2708. #include <morphtarget_pars_vertex>
  2709. #include <logdepthbuf_pars_vertex>
  2710. #include <clipping_planes_pars_vertex>
  2711. void main() {
  2712. vLineDistance = scale * lineDistance;
  2713. #include <color_vertex>
  2714. #include <morphcolor_vertex>
  2715. #include <begin_vertex>
  2716. #include <morphtarget_vertex>
  2717. #include <project_vertex>
  2718. #include <logdepthbuf_vertex>
  2719. #include <clipping_planes_vertex>
  2720. #include <fog_vertex>
  2721. }`,hO=`uniform vec3 diffuse;
  2722. uniform float opacity;
  2723. uniform float dashSize;
  2724. uniform float totalSize;
  2725. varying float vLineDistance;
  2726. #include <common>
  2727. #include <color_pars_fragment>
  2728. #include <fog_pars_fragment>
  2729. #include <logdepthbuf_pars_fragment>
  2730. #include <clipping_planes_pars_fragment>
  2731. void main() {
  2732. #include <clipping_planes_fragment>
  2733. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  2734. discard;
  2735. }
  2736. vec3 outgoingLight = vec3( 0.0 );
  2737. vec4 diffuseColor = vec4( diffuse, opacity );
  2738. #include <logdepthbuf_fragment>
  2739. #include <color_fragment>
  2740. outgoingLight = diffuseColor.rgb;
  2741. #include <output_fragment>
  2742. #include <tonemapping_fragment>
  2743. #include <encodings_fragment>
  2744. #include <fog_fragment>
  2745. #include <premultiplied_alpha_fragment>
  2746. }`,uO=`#include <common>
  2747. #include <uv_pars_vertex>
  2748. #include <uv2_pars_vertex>
  2749. #include <envmap_pars_vertex>
  2750. #include <color_pars_vertex>
  2751. #include <fog_pars_vertex>
  2752. #include <morphtarget_pars_vertex>
  2753. #include <skinning_pars_vertex>
  2754. #include <logdepthbuf_pars_vertex>
  2755. #include <clipping_planes_pars_vertex>
  2756. void main() {
  2757. #include <uv_vertex>
  2758. #include <uv2_vertex>
  2759. #include <color_vertex>
  2760. #include <morphcolor_vertex>
  2761. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  2762. #include <beginnormal_vertex>
  2763. #include <morphnormal_vertex>
  2764. #include <skinbase_vertex>
  2765. #include <skinnormal_vertex>
  2766. #include <defaultnormal_vertex>
  2767. #endif
  2768. #include <begin_vertex>
  2769. #include <morphtarget_vertex>
  2770. #include <skinning_vertex>
  2771. #include <project_vertex>
  2772. #include <logdepthbuf_vertex>
  2773. #include <clipping_planes_vertex>
  2774. #include <worldpos_vertex>
  2775. #include <envmap_vertex>
  2776. #include <fog_vertex>
  2777. }`,AO=`uniform vec3 diffuse;
  2778. uniform float opacity;
  2779. #ifndef FLAT_SHADED
  2780. varying vec3 vNormal;
  2781. #endif
  2782. #include <common>
  2783. #include <dithering_pars_fragment>
  2784. #include <color_pars_fragment>
  2785. #include <uv_pars_fragment>
  2786. #include <uv2_pars_fragment>
  2787. #include <map_pars_fragment>
  2788. #include <alphamap_pars_fragment>
  2789. #include <alphatest_pars_fragment>
  2790. #include <aomap_pars_fragment>
  2791. #include <lightmap_pars_fragment>
  2792. #include <envmap_common_pars_fragment>
  2793. #include <envmap_pars_fragment>
  2794. #include <fog_pars_fragment>
  2795. #include <specularmap_pars_fragment>
  2796. #include <logdepthbuf_pars_fragment>
  2797. #include <clipping_planes_pars_fragment>
  2798. void main() {
  2799. #include <clipping_planes_fragment>
  2800. vec4 diffuseColor = vec4( diffuse, opacity );
  2801. #include <logdepthbuf_fragment>
  2802. #include <map_fragment>
  2803. #include <color_fragment>
  2804. #include <alphamap_fragment>
  2805. #include <alphatest_fragment>
  2806. #include <specularmap_fragment>
  2807. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2808. #ifdef USE_LIGHTMAP
  2809. vec4 lightMapTexel = texture2D( lightMap, vUv2 );
  2810. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  2811. #else
  2812. reflectedLight.indirectDiffuse += vec3( 1.0 );
  2813. #endif
  2814. #include <aomap_fragment>
  2815. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  2816. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  2817. #include <envmap_fragment>
  2818. #include <output_fragment>
  2819. #include <tonemapping_fragment>
  2820. #include <encodings_fragment>
  2821. #include <fog_fragment>
  2822. #include <premultiplied_alpha_fragment>
  2823. #include <dithering_fragment>
  2824. }`,dO=`#define LAMBERT
  2825. varying vec3 vViewPosition;
  2826. #include <common>
  2827. #include <uv_pars_vertex>
  2828. #include <uv2_pars_vertex>
  2829. #include <displacementmap_pars_vertex>
  2830. #include <envmap_pars_vertex>
  2831. #include <color_pars_vertex>
  2832. #include <fog_pars_vertex>
  2833. #include <normal_pars_vertex>
  2834. #include <morphtarget_pars_vertex>
  2835. #include <skinning_pars_vertex>
  2836. #include <shadowmap_pars_vertex>
  2837. #include <logdepthbuf_pars_vertex>
  2838. #include <clipping_planes_pars_vertex>
  2839. void main() {
  2840. #include <uv_vertex>
  2841. #include <uv2_vertex>
  2842. #include <color_vertex>
  2843. #include <morphcolor_vertex>
  2844. #include <beginnormal_vertex>
  2845. #include <morphnormal_vertex>
  2846. #include <skinbase_vertex>
  2847. #include <skinnormal_vertex>
  2848. #include <defaultnormal_vertex>
  2849. #include <normal_vertex>
  2850. #include <begin_vertex>
  2851. #include <morphtarget_vertex>
  2852. #include <skinning_vertex>
  2853. #include <displacementmap_vertex>
  2854. #include <project_vertex>
  2855. #include <logdepthbuf_vertex>
  2856. #include <clipping_planes_vertex>
  2857. vViewPosition = - mvPosition.xyz;
  2858. #include <worldpos_vertex>
  2859. #include <envmap_vertex>
  2860. #include <shadowmap_vertex>
  2861. #include <fog_vertex>
  2862. }`,pO=`#define LAMBERT
  2863. uniform vec3 diffuse;
  2864. uniform vec3 emissive;
  2865. uniform float opacity;
  2866. #include <common>
  2867. #include <packing>
  2868. #include <dithering_pars_fragment>
  2869. #include <color_pars_fragment>
  2870. #include <uv_pars_fragment>
  2871. #include <uv2_pars_fragment>
  2872. #include <map_pars_fragment>
  2873. #include <alphamap_pars_fragment>
  2874. #include <alphatest_pars_fragment>
  2875. #include <aomap_pars_fragment>
  2876. #include <lightmap_pars_fragment>
  2877. #include <emissivemap_pars_fragment>
  2878. #include <envmap_common_pars_fragment>
  2879. #include <envmap_pars_fragment>
  2880. #include <fog_pars_fragment>
  2881. #include <bsdfs>
  2882. #include <lights_pars_begin>
  2883. #include <normal_pars_fragment>
  2884. #include <lights_lambert_pars_fragment>
  2885. #include <shadowmap_pars_fragment>
  2886. #include <bumpmap_pars_fragment>
  2887. #include <normalmap_pars_fragment>
  2888. #include <specularmap_pars_fragment>
  2889. #include <logdepthbuf_pars_fragment>
  2890. #include <clipping_planes_pars_fragment>
  2891. void main() {
  2892. #include <clipping_planes_fragment>
  2893. vec4 diffuseColor = vec4( diffuse, opacity );
  2894. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2895. vec3 totalEmissiveRadiance = emissive;
  2896. #include <logdepthbuf_fragment>
  2897. #include <map_fragment>
  2898. #include <color_fragment>
  2899. #include <alphamap_fragment>
  2900. #include <alphatest_fragment>
  2901. #include <specularmap_fragment>
  2902. #include <normal_fragment_begin>
  2903. #include <normal_fragment_maps>
  2904. #include <emissivemap_fragment>
  2905. #include <lights_lambert_fragment>
  2906. #include <lights_fragment_begin>
  2907. #include <lights_fragment_maps>
  2908. #include <lights_fragment_end>
  2909. #include <aomap_fragment>
  2910. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  2911. #include <envmap_fragment>
  2912. #include <output_fragment>
  2913. #include <tonemapping_fragment>
  2914. #include <encodings_fragment>
  2915. #include <fog_fragment>
  2916. #include <premultiplied_alpha_fragment>
  2917. #include <dithering_fragment>
  2918. }`,fO=`#define MATCAP
  2919. varying vec3 vViewPosition;
  2920. #include <common>
  2921. #include <uv_pars_vertex>
  2922. #include <color_pars_vertex>
  2923. #include <displacementmap_pars_vertex>
  2924. #include <fog_pars_vertex>
  2925. #include <normal_pars_vertex>
  2926. #include <morphtarget_pars_vertex>
  2927. #include <skinning_pars_vertex>
  2928. #include <logdepthbuf_pars_vertex>
  2929. #include <clipping_planes_pars_vertex>
  2930. void main() {
  2931. #include <uv_vertex>
  2932. #include <color_vertex>
  2933. #include <morphcolor_vertex>
  2934. #include <beginnormal_vertex>
  2935. #include <morphnormal_vertex>
  2936. #include <skinbase_vertex>
  2937. #include <skinnormal_vertex>
  2938. #include <defaultnormal_vertex>
  2939. #include <normal_vertex>
  2940. #include <begin_vertex>
  2941. #include <morphtarget_vertex>
  2942. #include <skinning_vertex>
  2943. #include <displacementmap_vertex>
  2944. #include <project_vertex>
  2945. #include <logdepthbuf_vertex>
  2946. #include <clipping_planes_vertex>
  2947. #include <fog_vertex>
  2948. vViewPosition = - mvPosition.xyz;
  2949. }`,mO=`#define MATCAP
  2950. uniform vec3 diffuse;
  2951. uniform float opacity;
  2952. uniform sampler2D matcap;
  2953. varying vec3 vViewPosition;
  2954. #include <common>
  2955. #include <dithering_pars_fragment>
  2956. #include <color_pars_fragment>
  2957. #include <uv_pars_fragment>
  2958. #include <map_pars_fragment>
  2959. #include <alphamap_pars_fragment>
  2960. #include <alphatest_pars_fragment>
  2961. #include <fog_pars_fragment>
  2962. #include <normal_pars_fragment>
  2963. #include <bumpmap_pars_fragment>
  2964. #include <normalmap_pars_fragment>
  2965. #include <logdepthbuf_pars_fragment>
  2966. #include <clipping_planes_pars_fragment>
  2967. void main() {
  2968. #include <clipping_planes_fragment>
  2969. vec4 diffuseColor = vec4( diffuse, opacity );
  2970. #include <logdepthbuf_fragment>
  2971. #include <map_fragment>
  2972. #include <color_fragment>
  2973. #include <alphamap_fragment>
  2974. #include <alphatest_fragment>
  2975. #include <normal_fragment_begin>
  2976. #include <normal_fragment_maps>
  2977. vec3 viewDir = normalize( vViewPosition );
  2978. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  2979. vec3 y = cross( viewDir, x );
  2980. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  2981. #ifdef USE_MATCAP
  2982. vec4 matcapColor = texture2D( matcap, uv );
  2983. #else
  2984. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
  2985. #endif
  2986. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  2987. #include <output_fragment>
  2988. #include <tonemapping_fragment>
  2989. #include <encodings_fragment>
  2990. #include <fog_fragment>
  2991. #include <premultiplied_alpha_fragment>
  2992. #include <dithering_fragment>
  2993. }`,gO=`#define NORMAL
  2994. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
  2995. varying vec3 vViewPosition;
  2996. #endif
  2997. #include <common>
  2998. #include <uv_pars_vertex>
  2999. #include <displacementmap_pars_vertex>
  3000. #include <normal_pars_vertex>
  3001. #include <morphtarget_pars_vertex>
  3002. #include <skinning_pars_vertex>
  3003. #include <logdepthbuf_pars_vertex>
  3004. #include <clipping_planes_pars_vertex>
  3005. void main() {
  3006. #include <uv_vertex>
  3007. #include <beginnormal_vertex>
  3008. #include <morphnormal_vertex>
  3009. #include <skinbase_vertex>
  3010. #include <skinnormal_vertex>
  3011. #include <defaultnormal_vertex>
  3012. #include <normal_vertex>
  3013. #include <begin_vertex>
  3014. #include <morphtarget_vertex>
  3015. #include <skinning_vertex>
  3016. #include <displacementmap_vertex>
  3017. #include <project_vertex>
  3018. #include <logdepthbuf_vertex>
  3019. #include <clipping_planes_vertex>
  3020. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
  3021. vViewPosition = - mvPosition.xyz;
  3022. #endif
  3023. }`,_O=`#define NORMAL
  3024. uniform float opacity;
  3025. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
  3026. varying vec3 vViewPosition;
  3027. #endif
  3028. #include <packing>
  3029. #include <uv_pars_fragment>
  3030. #include <normal_pars_fragment>
  3031. #include <bumpmap_pars_fragment>
  3032. #include <normalmap_pars_fragment>
  3033. #include <logdepthbuf_pars_fragment>
  3034. #include <clipping_planes_pars_fragment>
  3035. void main() {
  3036. #include <clipping_planes_fragment>
  3037. #include <logdepthbuf_fragment>
  3038. #include <normal_fragment_begin>
  3039. #include <normal_fragment_maps>
  3040. gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
  3041. #ifdef OPAQUE
  3042. gl_FragColor.a = 1.0;
  3043. #endif
  3044. }`,yO=`#define PHONG
  3045. varying vec3 vViewPosition;
  3046. #include <common>
  3047. #include <uv_pars_vertex>
  3048. #include <uv2_pars_vertex>
  3049. #include <displacementmap_pars_vertex>
  3050. #include <envmap_pars_vertex>
  3051. #include <color_pars_vertex>
  3052. #include <fog_pars_vertex>
  3053. #include <normal_pars_vertex>
  3054. #include <morphtarget_pars_vertex>
  3055. #include <skinning_pars_vertex>
  3056. #include <shadowmap_pars_vertex>
  3057. #include <logdepthbuf_pars_vertex>
  3058. #include <clipping_planes_pars_vertex>
  3059. void main() {
  3060. #include <uv_vertex>
  3061. #include <uv2_vertex>
  3062. #include <color_vertex>
  3063. #include <morphcolor_vertex>
  3064. #include <beginnormal_vertex>
  3065. #include <morphnormal_vertex>
  3066. #include <skinbase_vertex>
  3067. #include <skinnormal_vertex>
  3068. #include <defaultnormal_vertex>
  3069. #include <normal_vertex>
  3070. #include <begin_vertex>
  3071. #include <morphtarget_vertex>
  3072. #include <skinning_vertex>
  3073. #include <displacementmap_vertex>
  3074. #include <project_vertex>
  3075. #include <logdepthbuf_vertex>
  3076. #include <clipping_planes_vertex>
  3077. vViewPosition = - mvPosition.xyz;
  3078. #include <worldpos_vertex>
  3079. #include <envmap_vertex>
  3080. #include <shadowmap_vertex>
  3081. #include <fog_vertex>
  3082. }`,xO=`#define PHONG
  3083. uniform vec3 diffuse;
  3084. uniform vec3 emissive;
  3085. uniform vec3 specular;
  3086. uniform float shininess;
  3087. uniform float opacity;
  3088. #include <common>
  3089. #include <packing>
  3090. #include <dithering_pars_fragment>
  3091. #include <color_pars_fragment>
  3092. #include <uv_pars_fragment>
  3093. #include <uv2_pars_fragment>
  3094. #include <map_pars_fragment>
  3095. #include <alphamap_pars_fragment>
  3096. #include <alphatest_pars_fragment>
  3097. #include <aomap_pars_fragment>
  3098. #include <lightmap_pars_fragment>
  3099. #include <emissivemap_pars_fragment>
  3100. #include <envmap_common_pars_fragment>
  3101. #include <envmap_pars_fragment>
  3102. #include <fog_pars_fragment>
  3103. #include <bsdfs>
  3104. #include <lights_pars_begin>
  3105. #include <normal_pars_fragment>
  3106. #include <lights_phong_pars_fragment>
  3107. #include <shadowmap_pars_fragment>
  3108. #include <bumpmap_pars_fragment>
  3109. #include <normalmap_pars_fragment>
  3110. #include <specularmap_pars_fragment>
  3111. #include <logdepthbuf_pars_fragment>
  3112. #include <clipping_planes_pars_fragment>
  3113. void main() {
  3114. #include <clipping_planes_fragment>
  3115. vec4 diffuseColor = vec4( diffuse, opacity );
  3116. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3117. vec3 totalEmissiveRadiance = emissive;
  3118. #include <logdepthbuf_fragment>
  3119. #include <map_fragment>
  3120. #include <color_fragment>
  3121. #include <alphamap_fragment>
  3122. #include <alphatest_fragment>
  3123. #include <specularmap_fragment>
  3124. #include <normal_fragment_begin>
  3125. #include <normal_fragment_maps>
  3126. #include <emissivemap_fragment>
  3127. #include <lights_phong_fragment>
  3128. #include <lights_fragment_begin>
  3129. #include <lights_fragment_maps>
  3130. #include <lights_fragment_end>
  3131. #include <aomap_fragment>
  3132. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  3133. #include <envmap_fragment>
  3134. #include <output_fragment>
  3135. #include <tonemapping_fragment>
  3136. #include <encodings_fragment>
  3137. #include <fog_fragment>
  3138. #include <premultiplied_alpha_fragment>
  3139. #include <dithering_fragment>
  3140. }`,vO=`#define STANDARD
  3141. varying vec3 vViewPosition;
  3142. #ifdef USE_TRANSMISSION
  3143. varying vec3 vWorldPosition;
  3144. #endif
  3145. #include <common>
  3146. #include <uv_pars_vertex>
  3147. #include <uv2_pars_vertex>
  3148. #include <displacementmap_pars_vertex>
  3149. #include <color_pars_vertex>
  3150. #include <fog_pars_vertex>
  3151. #include <normal_pars_vertex>
  3152. #include <morphtarget_pars_vertex>
  3153. #include <skinning_pars_vertex>
  3154. #include <shadowmap_pars_vertex>
  3155. #include <logdepthbuf_pars_vertex>
  3156. #include <clipping_planes_pars_vertex>
  3157. void main() {
  3158. #include <uv_vertex>
  3159. #include <uv2_vertex>
  3160. #include <color_vertex>
  3161. #include <morphcolor_vertex>
  3162. #include <beginnormal_vertex>
  3163. #include <morphnormal_vertex>
  3164. #include <skinbase_vertex>
  3165. #include <skinnormal_vertex>
  3166. #include <defaultnormal_vertex>
  3167. #include <normal_vertex>
  3168. #include <begin_vertex>
  3169. #include <morphtarget_vertex>
  3170. #include <skinning_vertex>
  3171. #include <displacementmap_vertex>
  3172. #include <project_vertex>
  3173. #include <logdepthbuf_vertex>
  3174. #include <clipping_planes_vertex>
  3175. vViewPosition = - mvPosition.xyz;
  3176. #include <worldpos_vertex>
  3177. #include <shadowmap_vertex>
  3178. #include <fog_vertex>
  3179. #ifdef USE_TRANSMISSION
  3180. vWorldPosition = worldPosition.xyz;
  3181. #endif
  3182. }`,wO=`#define STANDARD
  3183. #ifdef PHYSICAL
  3184. #define IOR
  3185. #define SPECULAR
  3186. #endif
  3187. uniform vec3 diffuse;
  3188. uniform vec3 emissive;
  3189. uniform float roughness;
  3190. uniform float metalness;
  3191. uniform float opacity;
  3192. #ifdef IOR
  3193. uniform float ior;
  3194. #endif
  3195. #ifdef SPECULAR
  3196. uniform float specularIntensity;
  3197. uniform vec3 specularColor;
  3198. #ifdef USE_SPECULARINTENSITYMAP
  3199. uniform sampler2D specularIntensityMap;
  3200. #endif
  3201. #ifdef USE_SPECULARCOLORMAP
  3202. uniform sampler2D specularColorMap;
  3203. #endif
  3204. #endif
  3205. #ifdef USE_CLEARCOAT
  3206. uniform float clearcoat;
  3207. uniform float clearcoatRoughness;
  3208. #endif
  3209. #ifdef USE_IRIDESCENCE
  3210. uniform float iridescence;
  3211. uniform float iridescenceIOR;
  3212. uniform float iridescenceThicknessMinimum;
  3213. uniform float iridescenceThicknessMaximum;
  3214. #endif
  3215. #ifdef USE_SHEEN
  3216. uniform vec3 sheenColor;
  3217. uniform float sheenRoughness;
  3218. #ifdef USE_SHEENCOLORMAP
  3219. uniform sampler2D sheenColorMap;
  3220. #endif
  3221. #ifdef USE_SHEENROUGHNESSMAP
  3222. uniform sampler2D sheenRoughnessMap;
  3223. #endif
  3224. #endif
  3225. varying vec3 vViewPosition;
  3226. #include <common>
  3227. #include <packing>
  3228. #include <dithering_pars_fragment>
  3229. #include <color_pars_fragment>
  3230. #include <uv_pars_fragment>
  3231. #include <uv2_pars_fragment>
  3232. #include <map_pars_fragment>
  3233. #include <alphamap_pars_fragment>
  3234. #include <alphatest_pars_fragment>
  3235. #include <aomap_pars_fragment>
  3236. #include <lightmap_pars_fragment>
  3237. #include <emissivemap_pars_fragment>
  3238. #include <bsdfs>
  3239. #include <iridescence_fragment>
  3240. #include <cube_uv_reflection_fragment>
  3241. #include <envmap_common_pars_fragment>
  3242. #include <envmap_physical_pars_fragment>
  3243. #include <fog_pars_fragment>
  3244. #include <lights_pars_begin>
  3245. #include <normal_pars_fragment>
  3246. #include <lights_physical_pars_fragment>
  3247. #include <transmission_pars_fragment>
  3248. #include <shadowmap_pars_fragment>
  3249. #include <bumpmap_pars_fragment>
  3250. #include <normalmap_pars_fragment>
  3251. #include <clearcoat_pars_fragment>
  3252. #include <iridescence_pars_fragment>
  3253. #include <roughnessmap_pars_fragment>
  3254. #include <metalnessmap_pars_fragment>
  3255. #include <logdepthbuf_pars_fragment>
  3256. #include <clipping_planes_pars_fragment>
  3257. void main() {
  3258. #include <clipping_planes_fragment>
  3259. vec4 diffuseColor = vec4( diffuse, opacity );
  3260. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3261. vec3 totalEmissiveRadiance = emissive;
  3262. #include <logdepthbuf_fragment>
  3263. #include <map_fragment>
  3264. #include <color_fragment>
  3265. #include <alphamap_fragment>
  3266. #include <alphatest_fragment>
  3267. #include <roughnessmap_fragment>
  3268. #include <metalnessmap_fragment>
  3269. #include <normal_fragment_begin>
  3270. #include <normal_fragment_maps>
  3271. #include <clearcoat_normal_fragment_begin>
  3272. #include <clearcoat_normal_fragment_maps>
  3273. #include <emissivemap_fragment>
  3274. #include <lights_physical_fragment>
  3275. #include <lights_fragment_begin>
  3276. #include <lights_fragment_maps>
  3277. #include <lights_fragment_end>
  3278. #include <aomap_fragment>
  3279. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  3280. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  3281. #include <transmission_fragment>
  3282. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  3283. #ifdef USE_SHEEN
  3284. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  3285. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
  3286. #endif
  3287. #ifdef USE_CLEARCOAT
  3288. float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
  3289. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  3290. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
  3291. #endif
  3292. #include <output_fragment>
  3293. #include <tonemapping_fragment>
  3294. #include <encodings_fragment>
  3295. #include <fog_fragment>
  3296. #include <premultiplied_alpha_fragment>
  3297. #include <dithering_fragment>
  3298. }`,bO=`#define TOON
  3299. varying vec3 vViewPosition;
  3300. #include <common>
  3301. #include <uv_pars_vertex>
  3302. #include <uv2_pars_vertex>
  3303. #include <displacementmap_pars_vertex>
  3304. #include <color_pars_vertex>
  3305. #include <fog_pars_vertex>
  3306. #include <normal_pars_vertex>
  3307. #include <morphtarget_pars_vertex>
  3308. #include <skinning_pars_vertex>
  3309. #include <shadowmap_pars_vertex>
  3310. #include <logdepthbuf_pars_vertex>
  3311. #include <clipping_planes_pars_vertex>
  3312. void main() {
  3313. #include <uv_vertex>
  3314. #include <uv2_vertex>
  3315. #include <color_vertex>
  3316. #include <morphcolor_vertex>
  3317. #include <beginnormal_vertex>
  3318. #include <morphnormal_vertex>
  3319. #include <skinbase_vertex>
  3320. #include <skinnormal_vertex>
  3321. #include <defaultnormal_vertex>
  3322. #include <normal_vertex>
  3323. #include <begin_vertex>
  3324. #include <morphtarget_vertex>
  3325. #include <skinning_vertex>
  3326. #include <displacementmap_vertex>
  3327. #include <project_vertex>
  3328. #include <logdepthbuf_vertex>
  3329. #include <clipping_planes_vertex>
  3330. vViewPosition = - mvPosition.xyz;
  3331. #include <worldpos_vertex>
  3332. #include <shadowmap_vertex>
  3333. #include <fog_vertex>
  3334. }`,BO=`#define TOON
  3335. uniform vec3 diffuse;
  3336. uniform vec3 emissive;
  3337. uniform float opacity;
  3338. #include <common>
  3339. #include <packing>
  3340. #include <dithering_pars_fragment>
  3341. #include <color_pars_fragment>
  3342. #include <uv_pars_fragment>
  3343. #include <uv2_pars_fragment>
  3344. #include <map_pars_fragment>
  3345. #include <alphamap_pars_fragment>
  3346. #include <alphatest_pars_fragment>
  3347. #include <aomap_pars_fragment>
  3348. #include <lightmap_pars_fragment>
  3349. #include <emissivemap_pars_fragment>
  3350. #include <gradientmap_pars_fragment>
  3351. #include <fog_pars_fragment>
  3352. #include <bsdfs>
  3353. #include <lights_pars_begin>
  3354. #include <normal_pars_fragment>
  3355. #include <lights_toon_pars_fragment>
  3356. #include <shadowmap_pars_fragment>
  3357. #include <bumpmap_pars_fragment>
  3358. #include <normalmap_pars_fragment>
  3359. #include <logdepthbuf_pars_fragment>
  3360. #include <clipping_planes_pars_fragment>
  3361. void main() {
  3362. #include <clipping_planes_fragment>
  3363. vec4 diffuseColor = vec4( diffuse, opacity );
  3364. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3365. vec3 totalEmissiveRadiance = emissive;
  3366. #include <logdepthbuf_fragment>
  3367. #include <map_fragment>
  3368. #include <color_fragment>
  3369. #include <alphamap_fragment>
  3370. #include <alphatest_fragment>
  3371. #include <normal_fragment_begin>
  3372. #include <normal_fragment_maps>
  3373. #include <emissivemap_fragment>
  3374. #include <lights_toon_fragment>
  3375. #include <lights_fragment_begin>
  3376. #include <lights_fragment_maps>
  3377. #include <lights_fragment_end>
  3378. #include <aomap_fragment>
  3379. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  3380. #include <output_fragment>
  3381. #include <tonemapping_fragment>
  3382. #include <encodings_fragment>
  3383. #include <fog_fragment>
  3384. #include <premultiplied_alpha_fragment>
  3385. #include <dithering_fragment>
  3386. }`,CO=`uniform float size;
  3387. uniform float scale;
  3388. #include <common>
  3389. #include <color_pars_vertex>
  3390. #include <fog_pars_vertex>
  3391. #include <morphtarget_pars_vertex>
  3392. #include <logdepthbuf_pars_vertex>
  3393. #include <clipping_planes_pars_vertex>
  3394. void main() {
  3395. #include <color_vertex>
  3396. #include <morphcolor_vertex>
  3397. #include <begin_vertex>
  3398. #include <morphtarget_vertex>
  3399. #include <project_vertex>
  3400. gl_PointSize = size;
  3401. #ifdef USE_SIZEATTENUATION
  3402. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  3403. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  3404. #endif
  3405. #include <logdepthbuf_vertex>
  3406. #include <clipping_planes_vertex>
  3407. #include <worldpos_vertex>
  3408. #include <fog_vertex>
  3409. }`,EO=`uniform vec3 diffuse;
  3410. uniform float opacity;
  3411. #include <common>
  3412. #include <color_pars_fragment>
  3413. #include <map_particle_pars_fragment>
  3414. #include <alphatest_pars_fragment>
  3415. #include <fog_pars_fragment>
  3416. #include <logdepthbuf_pars_fragment>
  3417. #include <clipping_planes_pars_fragment>
  3418. void main() {
  3419. #include <clipping_planes_fragment>
  3420. vec3 outgoingLight = vec3( 0.0 );
  3421. vec4 diffuseColor = vec4( diffuse, opacity );
  3422. #include <logdepthbuf_fragment>
  3423. #include <map_particle_fragment>
  3424. #include <color_fragment>
  3425. #include <alphatest_fragment>
  3426. outgoingLight = diffuseColor.rgb;
  3427. #include <output_fragment>
  3428. #include <tonemapping_fragment>
  3429. #include <encodings_fragment>
  3430. #include <fog_fragment>
  3431. #include <premultiplied_alpha_fragment>
  3432. }`,TO=`#include <common>
  3433. #include <fog_pars_vertex>
  3434. #include <morphtarget_pars_vertex>
  3435. #include <skinning_pars_vertex>
  3436. #include <shadowmap_pars_vertex>
  3437. void main() {
  3438. #include <beginnormal_vertex>
  3439. #include <morphnormal_vertex>
  3440. #include <skinbase_vertex>
  3441. #include <skinnormal_vertex>
  3442. #include <defaultnormal_vertex>
  3443. #include <begin_vertex>
  3444. #include <morphtarget_vertex>
  3445. #include <skinning_vertex>
  3446. #include <project_vertex>
  3447. #include <worldpos_vertex>
  3448. #include <shadowmap_vertex>
  3449. #include <fog_vertex>
  3450. }`,SO=`uniform vec3 color;
  3451. uniform float opacity;
  3452. #include <common>
  3453. #include <packing>
  3454. #include <fog_pars_fragment>
  3455. #include <bsdfs>
  3456. #include <lights_pars_begin>
  3457. #include <shadowmap_pars_fragment>
  3458. #include <shadowmask_pars_fragment>
  3459. void main() {
  3460. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  3461. #include <tonemapping_fragment>
  3462. #include <encodings_fragment>
  3463. #include <fog_fragment>
  3464. }`,MO=`uniform float rotation;
  3465. uniform vec2 center;
  3466. #include <common>
  3467. #include <uv_pars_vertex>
  3468. #include <fog_pars_vertex>
  3469. #include <logdepthbuf_pars_vertex>
  3470. #include <clipping_planes_pars_vertex>
  3471. void main() {
  3472. #include <uv_vertex>
  3473. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  3474. vec2 scale;
  3475. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  3476. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  3477. #ifndef USE_SIZEATTENUATION
  3478. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  3479. if ( isPerspective ) scale *= - mvPosition.z;
  3480. #endif
  3481. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  3482. vec2 rotatedPosition;
  3483. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  3484. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  3485. mvPosition.xy += rotatedPosition;
  3486. gl_Position = projectionMatrix * mvPosition;
  3487. #include <logdepthbuf_vertex>
  3488. #include <clipping_planes_vertex>
  3489. #include <fog_vertex>
  3490. }`,IO=`uniform vec3 diffuse;
  3491. uniform float opacity;
  3492. #include <common>
  3493. #include <uv_pars_fragment>
  3494. #include <map_pars_fragment>
  3495. #include <alphamap_pars_fragment>
  3496. #include <alphatest_pars_fragment>
  3497. #include <fog_pars_fragment>
  3498. #include <logdepthbuf_pars_fragment>
  3499. #include <clipping_planes_pars_fragment>
  3500. void main() {
  3501. #include <clipping_planes_fragment>
  3502. vec3 outgoingLight = vec3( 0.0 );
  3503. vec4 diffuseColor = vec4( diffuse, opacity );
  3504. #include <logdepthbuf_fragment>
  3505. #include <map_fragment>
  3506. #include <alphamap_fragment>
  3507. #include <alphatest_fragment>
  3508. outgoingLight = diffuseColor.rgb;
  3509. #include <output_fragment>
  3510. #include <tonemapping_fragment>
  3511. #include <encodings_fragment>
  3512. #include <fog_fragment>
  3513. }`,zr={alphamap_fragment:Jz,alphamap_pars_fragment:ek,alphatest_fragment:tk,alphatest_pars_fragment:ik,aomap_fragment:nk,aomap_pars_fragment:rk,begin_vertex:sk,beginnormal_vertex:ok,bsdfs:ak,iridescence_fragment:lk,bumpmap_pars_fragment:ck,clipping_planes_fragment:hk,clipping_planes_pars_fragment:uk,clipping_planes_pars_vertex:Ak,clipping_planes_vertex:dk,color_fragment:pk,color_pars_fragment:fk,color_pars_vertex:mk,color_vertex:gk,common:_k,cube_uv_reflection_fragment:yk,defaultnormal_vertex:xk,displacementmap_pars_vertex:vk,displacementmap_vertex:wk,emissivemap_fragment:bk,emissivemap_pars_fragment:Bk,encodings_fragment:Ck,encodings_pars_fragment:Ek,envmap_fragment:Tk,envmap_common_pars_fragment:Sk,envmap_pars_fragment:Mk,envmap_pars_vertex:Ik,envmap_physical_pars_fragment:Vk,envmap_vertex:Fk,fog_vertex:Lk,fog_pars_vertex:Dk,fog_fragment:Pk,fog_pars_fragment:Uk,gradientmap_pars_fragment:Rk,lightmap_fragment:zk,lightmap_pars_fragment:kk,lights_lambert_fragment:Ok,lights_lambert_pars_fragment:Nk,lights_pars_begin:Qk,lights_toon_fragment:Hk,lights_toon_pars_fragment:Gk,lights_phong_fragment:Wk,lights_phong_pars_fragment:jk,lights_physical_fragment:Kk,lights_physical_pars_fragment:$k,lights_fragment_begin:Zk,lights_fragment_maps:Xk,lights_fragment_end:qk,logdepthbuf_fragment:Yk,logdepthbuf_pars_fragment:Jk,logdepthbuf_pars_vertex:e5,logdepthbuf_vertex:t5,map_fragment:i5,map_pars_fragment:n5,map_particle_fragment:r5,map_particle_pars_fragment:s5,metalnessmap_fragment:o5,metalnessmap_pars_fragment:a5,morphcolor_vertex:l5,morphnormal_vertex:c5,morphtarget_pars_vertex:h5,morphtarget_vertex:u5,normal_fragment_begin:A5,normal_fragment_maps:d5,normal_pars_fragment:p5,normal_pars_vertex:f5,normal_vertex:m5,normalmap_pars_fragment:g5,clearcoat_normal_fragment_begin:_5,clearcoat_normal_fragment_maps:y5,clearcoat_pars_fragment:x5,iridescence_pars_fragment:v5,output_fragment:w5,packing:b5,premultiplied_alpha_fragment:B5,project_vertex:C5,dithering_fragment:E5,dithering_pars_fragment:T5,roughnessmap_fragment:S5,roughnessmap_pars_fragment:M5,shadowmap_pars_fragment:I5,shadowmap_pars_vertex:F5,shadowmap_vertex:L5,shadowmask_pars_fragment:D5,skinbase_vertex:P5,skinning_pars_vertex:U5,skinning_vertex:R5,skinnormal_vertex:z5,specularmap_fragment:k5,specularmap_pars_fragment:O5,tonemapping_fragment:N5,tonemapping_pars_fragment:Q5,transmission_fragment:V5,transmission_pars_fragment:H5,uv_pars_fragment:G5,uv_pars_vertex:W5,uv_vertex:j5,uv2_pars_fragment:K5,uv2_pars_vertex:$5,uv2_vertex:Z5,worldpos_vertex:X5,background_vert:q5,background_frag:Y5,backgroundCube_vert:J5,backgroundCube_frag:eO,cube_vert:tO,cube_frag:iO,depth_vert:nO,depth_frag:rO,distanceRGBA_vert:sO,distanceRGBA_frag:oO,equirect_vert:aO,equirect_frag:lO,linedashed_vert:cO,linedashed_frag:hO,meshbasic_vert:uO,meshbasic_frag:AO,meshlambert_vert:dO,meshlambert_frag:pO,meshmatcap_vert:fO,meshmatcap_frag:mO,meshnormal_vert:gO,meshnormal_frag:_O,meshphong_vert:yO,meshphong_frag:xO,meshphysical_vert:vO,meshphysical_frag:wO,meshtoon_vert:bO,meshtoon_frag:BO,points_vert:CO,points_frag:EO,shadow_vert:TO,shadow_frag:SO,sprite_vert:MO,sprite_frag:IO},En={common:{diffuse:{value:new Dn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Pl},uv2Transform:{value:new Pl},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Di(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Dn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Dn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pl}},sprite:{diffuse:{value:new Dn(16777215)},opacity:{value:1},center:{value:new Di(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pl}}},Fl={basic:{uniforms:Sl([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.fog]),vertexShader:zr.meshbasic_vert,fragmentShader:zr.meshbasic_frag},lambert:{uniforms:Sl([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.fog,En.lights,{emissive:{value:new Dn(0)}}]),vertexShader:zr.meshlambert_vert,fragmentShader:zr.meshlambert_frag},phong:{uniforms:Sl([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.fog,En.lights,{emissive:{value:new Dn(0)},specular:{value:new Dn(1118481)},shininess:{value:30}}]),vertexShader:zr.meshphong_vert,fragmentShader:zr.meshphong_frag},standard:{uniforms:Sl([En.common,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.roughnessmap,En.metalnessmap,En.fog,En.lights,{emissive:{value:new Dn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:zr.meshphysical_vert,fragmentShader:zr.meshphysical_frag},toon:{uniforms:Sl([En.common,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.gradientmap,En.fog,En.lights,{emissive:{value:new Dn(0)}}]),vertexShader:zr.meshtoon_vert,fragmentShader:zr.meshtoon_frag},matcap:{uniforms:Sl([En.common,En.bumpmap,En.normalmap,En.displacementmap,En.fog,{matcap:{value:null}}]),vertexShader:zr.meshmatcap_vert,fragmentShader:zr.meshmatcap_frag},points:{uniforms:Sl([En.points,En.fog]),vertexShader:zr.points_vert,fragmentShader:zr.points_frag},dashed:{uniforms:Sl([En.common,En.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:zr.linedashed_vert,fragmentShader:zr.linedashed_frag},depth:{uniforms:Sl([En.common,En.displacementmap]),vertexShader:zr.depth_vert,fragmentShader:zr.depth_frag},normal:{uniforms:Sl([En.common,En.bumpmap,En.normalmap,En.displacementmap,{opacity:{value:1}}]),vertexShader:zr.meshnormal_vert,fragmentShader:zr.meshnormal_frag},sprite:{uniforms:Sl([En.sprite,En.fog]),vertexShader:zr.sprite_vert,fragmentShader:zr.sprite_frag},background:{uniforms:{uvTransform:{value:new Pl},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:zr.background_vert,fragmentShader:zr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:zr.backgroundCube_vert,fragmentShader:zr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:zr.cube_vert,fragmentShader:zr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:zr.equirect_vert,fragmentShader:zr.equirect_frag},distanceRGBA:{uniforms:Sl([En.common,En.displacementmap,{referencePosition:{value:new ft},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:zr.distanceRGBA_vert,fragmentShader:zr.distanceRGBA_frag},shadow:{uniforms:Sl([En.lights,En.fog,{color:{value:new Dn(0)},opacity:{value:1}}]),vertexShader:zr.shadow_vert,fragmentShader:zr.shadow_frag}};Fl.physical={uniforms:Sl([Fl.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Di(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Dn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Di},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Dn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Dn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:zr.meshphysical_vert,fragmentShader:zr.meshphysical_frag};const Ax={r:0,b:0,g:0};function FO(u,e,t,r,c,p,y){const i=new Dn(0);let C=p===!0?0:1,D,R,Q=null,z=0,G=null;function J(B,ae){let ce=!1,Ae=ae.isScene===!0?ae.background:null;Ae&&Ae.isTexture&&(Ae=(ae.backgroundBlurriness>0?t:e).get(Ae));const we=u.xr,me=we.getSession&&we.getSession();me&&me.environmentBlendMode==="additive"&&(Ae=null),Ae===null?Y(i,C):Ae&&Ae.isColor&&(Y(Ae,1),ce=!0),(u.autoClear||ce)&&u.clear(u.autoClearColor,u.autoClearDepth,u.autoClearStencil),Ae&&(Ae.isCubeTexture||Ae.mapping===qm)?(R===void 0&&(R=new us(new qA(1,1,1),new ko({name:"BackgroundCubeMaterial",uniforms:jm(Fl.backgroundCube.uniforms),vertexShader:Fl.backgroundCube.vertexShader,fragmentShader:Fl.backgroundCube.fragmentShader,side:rc,depthTest:!1,depthWrite:!1,fog:!1})),R.geometry.deleteAttribute("normal"),R.geometry.deleteAttribute("uv"),R.onBeforeRender=function(De,Je,Fe){this.matrixWorld.copyPosition(Fe.matrixWorld)},Object.defineProperty(R.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),c.update(R)),R.material.uniforms.envMap.value=Ae,R.material.uniforms.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1,R.material.uniforms.backgroundBlurriness.value=ae.backgroundBlurriness,R.material.uniforms.backgroundIntensity.value=ae.backgroundIntensity,R.material.toneMapped=Ae.encoding!==Ts,(Q!==Ae||z!==Ae.version||G!==u.toneMapping)&&(R.material.needsUpdate=!0,Q=Ae,z=Ae.version,G=u.toneMapping),R.layers.enableAll(),B.unshift(R,R.geometry,R.material,0,0,null)):Ae&&Ae.isTexture&&(D===void 0&&(D=new us(new xf(2,2),new ko({name:"BackgroundMaterial",uniforms:jm(Fl.background.uniforms),vertexShader:Fl.background.vertexShader,fragmentShader:Fl.background.fragmentShader,side:uu,depthTest:!1,depthWrite:!1,fog:!1})),D.geometry.deleteAttribute("normal"),Object.defineProperty(D.material,"map",{get:function(){return this.uniforms.t2D.value}}),c.update(D)),D.material.uniforms.t2D.value=Ae,D.material.uniforms.backgroundIntensity.value=ae.backgroundIntensity,D.material.toneMapped=Ae.encoding!==Ts,Ae.matrixAutoUpdate===!0&&Ae.updateMatrix(),D.material.uniforms.uvTransform.value.copy(Ae.matrix),(Q!==Ae||z!==Ae.version||G!==u.toneMapping)&&(D.material.needsUpdate=!0,Q=Ae,z=Ae.version,G=u.toneMapping),D.layers.enableAll(),B.unshift(D,D.geometry,D.material,0,0,null))}function Y(B,ae){B.getRGB(Ax,zI(u)),r.buffers.color.setClear(Ax.r,Ax.g,Ax.b,ae,y)}return{getClearColor:function(){return i},setClearColor:function(B,ae=1){i.set(B),C=ae,Y(i,C)},getClearAlpha:function(){return C},setClearAlpha:function(B){C=B,Y(i,C)},render:J}}function LO(u,e,t,r){const c=u.getParameter(34921),p=r.isWebGL2?null:e.get("OES_vertex_array_object"),y=r.isWebGL2||p!==null,i={},C=B(null);let D=C,R=!1;function Q(le,ye,xe,Re,Oe){let We=!1;if(y){const Ve=Y(Re,xe,ye);D!==Ve&&(D=Ve,G(D.object)),We=ae(le,Re,xe,Oe),We&&ce(le,Re,xe,Oe)}else{const Ve=ye.wireframe===!0;(D.geometry!==Re.id||D.program!==xe.id||D.wireframe!==Ve)&&(D.geometry=Re.id,D.program=xe.id,D.wireframe=Ve,We=!0)}Oe!==null&&t.update(Oe,34963),(We||R)&&(R=!1,Fe(le,ye,xe,Re),Oe!==null&&u.bindBuffer(34963,t.get(Oe).buffer))}function z(){return r.isWebGL2?u.createVertexArray():p.createVertexArrayOES()}function G(le){return r.isWebGL2?u.bindVertexArray(le):p.bindVertexArrayOES(le)}function J(le){return r.isWebGL2?u.deleteVertexArray(le):p.deleteVertexArrayOES(le)}function Y(le,ye,xe){const Re=xe.wireframe===!0;let Oe=i[le.id];Oe===void 0&&(Oe={},i[le.id]=Oe);let We=Oe[ye.id];We===void 0&&(We={},Oe[ye.id]=We);let Ve=We[Re];return Ve===void 0&&(Ve=B(z()),We[Re]=Ve),Ve}function B(le){const ye=[],xe=[],Re=[];for(let Oe=0;Oe<c;Oe++)ye[Oe]=0,xe[Oe]=0,Re[Oe]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:ye,enabledAttributes:xe,attributeDivisors:Re,object:le,attributes:{},index:null}}function ae(le,ye,xe,Re){const Oe=D.attributes,We=ye.attributes;let Ve=0;const Qe=xe.getAttributes();for(const Se in Qe)if(Qe[Se].location>=0){const nt=Oe[Se];let vt=We[Se];if(vt===void 0&&(Se==="instanceMatrix"&&le.instanceMatrix&&(vt=le.instanceMatrix),Se==="instanceColor"&&le.instanceColor&&(vt=le.instanceColor)),nt===void 0||nt.attribute!==vt||vt&&nt.data!==vt.data)return!0;Ve++}return D.attributesNum!==Ve||D.index!==Re}function ce(le,ye,xe,Re){const Oe={},We=ye.attributes;let Ve=0;const Qe=xe.getAttributes();for(const Se in Qe)if(Qe[Se].location>=0){let nt=We[Se];nt===void 0&&(Se==="instanceMatrix"&&le.instanceMatrix&&(nt=le.instanceMatrix),Se==="instanceColor"&&le.instanceColor&&(nt=le.instanceColor));const vt={};vt.attribute=nt,nt&&nt.data&&(vt.data=nt.data),Oe[Se]=vt,Ve++}D.attributes=Oe,D.attributesNum=Ve,D.index=Re}function Ae(){const le=D.newAttributes;for(let ye=0,xe=le.length;ye<xe;ye++)le[ye]=0}function we(le){me(le,0)}function me(le,ye){const xe=D.newAttributes,Re=D.enabledAttributes,Oe=D.attributeDivisors;xe[le]=1,Re[le]===0&&(u.enableVertexAttribArray(le),Re[le]=1),Oe[le]!==ye&&((r.isWebGL2?u:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](le,ye),Oe[le]=ye)}function De(){const le=D.newAttributes,ye=D.enabledAttributes;for(let xe=0,Re=ye.length;xe<Re;xe++)ye[xe]!==le[xe]&&(u.disableVertexAttribArray(xe),ye[xe]=0)}function Je(le,ye,xe,Re,Oe,We){r.isWebGL2===!0&&(xe===5124||xe===5125)?u.vertexAttribIPointer(le,ye,xe,Oe,We):u.vertexAttribPointer(le,ye,xe,Re,Oe,We)}function Fe(le,ye,xe,Re){if(r.isWebGL2===!1&&(le.isInstancedMesh||Re.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;Ae();const Oe=Re.attributes,We=xe.getAttributes(),Ve=ye.defaultAttributeValues;for(const Qe in We){const Se=We[Qe];if(Se.location>=0){let Ke=Oe[Qe];if(Ke===void 0&&(Qe==="instanceMatrix"&&le.instanceMatrix&&(Ke=le.instanceMatrix),Qe==="instanceColor"&&le.instanceColor&&(Ke=le.instanceColor)),Ke!==void 0){const nt=Ke.normalized,vt=Ke.itemSize,be=t.get(Ke);if(be===void 0)continue;const At=be.buffer,ut=be.type,Nt=be.bytesPerElement;if(Ke.isInterleavedBufferAttribute){const Gt=Ke.data,Qt=Gt.stride,Ct=Ke.offset;if(Gt.isInstancedInterleavedBuffer){for(let Ft=0;Ft<Se.locationSize;Ft++)me(Se.location+Ft,Gt.meshPerAttribute);le.isInstancedMesh!==!0&&Re._maxInstanceCount===void 0&&(Re._maxInstanceCount=Gt.meshPerAttribute*Gt.count)}else for(let Ft=0;Ft<Se.locationSize;Ft++)we(Se.location+Ft);u.bindBuffer(34962,At);for(let Ft=0;Ft<Se.locationSize;Ft++)Je(Se.location+Ft,vt/Se.locationSize,ut,nt,Qt*Nt,(Ct+vt/Se.locationSize*Ft)*Nt)}else{if(Ke.isInstancedBufferAttribute){for(let Gt=0;Gt<Se.locationSize;Gt++)me(Se.location+Gt,Ke.meshPerAttribute);le.isInstancedMesh!==!0&&Re._maxInstanceCount===void 0&&(Re._maxInstanceCount=Ke.meshPerAttribute*Ke.count)}else for(let Gt=0;Gt<Se.locationSize;Gt++)we(Se.location+Gt);u.bindBuffer(34962,At);for(let Gt=0;Gt<Se.locationSize;Gt++)Je(Se.location+Gt,vt/Se.locationSize,ut,nt,vt*Nt,vt/Se.locationSize*Gt*Nt)}}else if(Ve!==void 0){const nt=Ve[Qe];if(nt!==void 0)switch(nt.length){case 2:u.vertexAttrib2fv(Se.location,nt);break;case 3:u.vertexAttrib3fv(Se.location,nt);break;case 4:u.vertexAttrib4fv(Se.location,nt);break;default:u.vertexAttrib1fv(Se.location,nt)}}}}De()}function Ge(){xi();for(const le in i){const ye=i[le];for(const xe in ye){const Re=ye[xe];for(const Oe in Re)J(Re[Oe].object),delete Re[Oe];delete ye[xe]}delete i[le]}}function Et(le){if(i[le.id]===void 0)return;const ye=i[le.id];for(const xe in ye){const Re=ye[xe];for(const Oe in Re)J(Re[Oe].object),delete Re[Oe];delete ye[xe]}delete i[le.id]}function li(le){for(const ye in i){const xe=i[ye];if(xe[le.id]===void 0)continue;const Re=xe[le.id];for(const Oe in Re)J(Re[Oe].object),delete Re[Oe];delete xe[le.id]}}function xi(){te(),R=!0,D!==C&&(D=C,G(D.object))}function te(){C.geometry=null,C.program=null,C.wireframe=!1}return{setup:Q,reset:xi,resetDefaultState:te,dispose:Ge,releaseStatesOfGeometry:Et,releaseStatesOfProgram:li,initAttributes:Ae,enableAttribute:we,disableUnusedAttributes:De}}function DO(u,e,t,r){const c=r.isWebGL2;let p;function y(D){p=D}function i(D,R){u.drawArrays(p,D,R),t.update(R,p,1)}function C(D,R,Q){if(Q===0)return;let z,G;if(c)z=u,G="drawArraysInstanced";else if(z=e.get("ANGLE_instanced_arrays"),G="drawArraysInstancedANGLE",z===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}z[G](p,D,R,Q),t.update(R,p,Q)}this.setMode=y,this.render=i,this.renderInstances=C}function PO(u,e,t){let r;function c(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const Je=e.get("EXT_texture_filter_anisotropic");r=u.getParameter(Je.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function p(Je){if(Je==="highp"){if(u.getShaderPrecisionFormat(35633,36338).precision>0&&u.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";Je="mediump"}return Je==="mediump"&&u.getShaderPrecisionFormat(35633,36337).precision>0&&u.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const y=typeof WebGL2RenderingContext<"u"&&u instanceof WebGL2RenderingContext;let i=t.precision!==void 0?t.precision:"highp";const C=p(i);C!==i&&(console.warn("THREE.WebGLRenderer:",i,"not supported, using",C,"instead."),i=C);const D=y||e.has("WEBGL_draw_buffers"),R=t.logarithmicDepthBuffer===!0,Q=u.getParameter(34930),z=u.getParameter(35660),G=u.getParameter(3379),J=u.getParameter(34076),Y=u.getParameter(34921),B=u.getParameter(36347),ae=u.getParameter(36348),ce=u.getParameter(36349),Ae=z>0,we=y||e.has("OES_texture_float"),me=Ae&&we,De=y?u.getParameter(36183):0;return{isWebGL2:y,drawBuffers:D,getMaxAnisotropy:c,getMaxPrecision:p,precision:i,logarithmicDepthBuffer:R,maxTextures:Q,maxVertexTextures:z,maxTextureSize:G,maxCubemapSize:J,maxAttributes:Y,maxVertexUniforms:B,maxVaryings:ae,maxFragmentUniforms:ce,vertexTextures:Ae,floatFragmentTextures:we,floatVertexTextures:me,maxSamples:De}}function UO(u){const e=this;let t=null,r=0,c=!1,p=!1;const y=new jd,i=new Pl,C={value:null,needsUpdate:!1};this.uniform=C,this.numPlanes=0,this.numIntersection=0,this.init=function(Q,z){const G=Q.length!==0||z||r!==0||c;return c=z,r=Q.length,G},this.beginShadows=function(){p=!0,R(null)},this.endShadows=function(){p=!1},this.setGlobalState=function(Q,z){t=R(Q,z,0)},this.setState=function(Q,z,G){const J=Q.clippingPlanes,Y=Q.clipIntersection,B=Q.clipShadows,ae=u.get(Q);if(!c||J===null||J.length===0||p&&!B)p?R(null):D();else{const ce=p?0:r,Ae=ce*4;let we=ae.clippingState||null;C.value=we,we=R(J,z,Ae,G);for(let me=0;me!==Ae;++me)we[me]=t[me];ae.clippingState=we,this.numIntersection=Y?this.numPlanes:0,this.numPlanes+=ce}};function D(){C.value!==t&&(C.value=t,C.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function R(Q,z,G,J){const Y=Q!==null?Q.length:0;let B=null;if(Y!==0){if(B=C.value,J!==!0||B===null){const ae=G+Y*4,ce=z.matrixWorldInverse;i.getNormalMatrix(ce),(B===null||B.length<ae)&&(B=new Float32Array(ae));for(let Ae=0,we=G;Ae!==Y;++Ae,we+=4)y.copy(Q[Ae]).applyMatrix4(ce,i),y.normal.toArray(B,we),B[we+3]=y.constant}C.value=B,C.needsUpdate=!0}return e.numPlanes=Y,e.numIntersection=0,B}}function RO(u){let e=new WeakMap;function t(y,i){return i===O_?y.mapping=rp:i===N_&&(y.mapping=sp),y}function r(y){if(y&&y.isTexture&&y.isRenderTargetTexture===!1){const i=y.mapping;if(i===O_||i===N_)if(e.has(y)){const C=e.get(y).texture;return t(C,y.mapping)}else{const C=y.image;if(C&&C.height>0){const D=new OI(C.height/2);return D.fromEquirectangularTexture(u,y),e.set(y,D),y.addEventListener("dispose",c),t(D.texture,y.mapping)}else return null}}return y}function c(y){const i=y.target;i.removeEventListener("dispose",c);const C=e.get(i);C!==void 0&&(e.delete(i),C.dispose())}function p(){e=new WeakMap}return{get:r,dispose:p}}class dy extends Qv{constructor(e=-1,t=1,r=1,c=-1,p=.1,y=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=c,this.near=p,this.far=y,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,c,p,y){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=c,this.view.width=p,this.view.height=y,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,c=(this.top+this.bottom)/2;let p=r-e,y=r+e,i=c+t,C=c-t;if(this.view!==null&&this.view.enabled){const D=(this.right-this.left)/this.view.fullWidth/this.zoom,R=(this.top-this.bottom)/this.view.fullHeight/this.zoom;p+=D*this.view.offsetX,y=p+D*this.view.width,i-=R*this.view.offsetY,C=i-R*this.view.height}this.projectionMatrix.makeOrthographic(p,y,i,C,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Um=4,$E=[.125,.215,.35,.446,.526,.582],Yp=20,Ow=new dy,ZE=new Dn;let Nw=null;const $p=(1+Math.sqrt(5))/2,vm=1/$p,XE=[new ft(1,1,1),new ft(-1,1,1),new ft(1,1,-1),new ft(-1,1,-1),new ft(0,$p,vm),new ft(0,$p,-vm),new ft(vm,0,$p),new ft(-vm,0,$p),new ft($p,vm,0),new ft(-$p,vm,0)];class a2{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,c=100){Nw=this._renderer.getRenderTarget(),this._setSize(256);const p=this._allocateTargets();return p.depthBuffer=!0,this._sceneToCubeUV(e,r,c,p),t>0&&this._blur(p,0,0,t),this._applyPMREM(p),this._cleanup(p),p}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=JE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=YE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Nw),e.scissorTest=!1,dx(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===rp||e.mapping===sp?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Nw=this._renderer.getRenderTarget();const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:Xs,minFilter:Xs,generateMipmaps:!1,type:Gm,format:Dl,encoding:lp,depthBuffer:!1},c=qE(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=qE(e,t,r);const{_lodMax:p}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=zO(p)),this._blurMaterial=kO(p,e,t)}return c}_compileMaterial(e){const t=new us(this._lodPlanes[0],e);this._renderer.compile(t,Ow)}_sceneToCubeUV(e,t,r,c){const i=new _a(90,1,t,r),C=[1,-1,1,1,1,1],D=[1,1,1,-1,-1,-1],R=this._renderer,Q=R.autoClear,z=R.toneMapping;R.getClearColor(ZE),R.toneMapping=Hu,R.autoClear=!1;const G=new za({name:"PMREM.Background",side:rc,depthWrite:!1,depthTest:!1}),J=new us(new qA,G);let Y=!1;const B=e.background;B?B.isColor&&(G.color.copy(B),e.background=null,Y=!0):(G.color.copy(ZE),Y=!0);for(let ae=0;ae<6;ae++){const ce=ae%3;ce===0?(i.up.set(0,C[ae],0),i.lookAt(D[ae],0,0)):ce===1?(i.up.set(0,0,C[ae]),i.lookAt(0,D[ae],0)):(i.up.set(0,C[ae],0),i.lookAt(0,0,D[ae]));const Ae=this._cubeSize;dx(c,ce*Ae,ae>2?Ae:0,Ae,Ae),R.setRenderTarget(c),Y&&R.render(J,i),R.render(e,i)}J.geometry.dispose(),J.material.dispose(),R.toneMapping=z,R.autoClear=Q,e.background=B}_textureToCubeUV(e,t){const r=this._renderer,c=e.mapping===rp||e.mapping===sp;c?(this._cubemapMaterial===null&&(this._cubemapMaterial=JE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=YE());const p=c?this._cubemapMaterial:this._equirectMaterial,y=new us(this._lodPlanes[0],p),i=p.uniforms;i.envMap.value=e;const C=this._cubeSize;dx(t,0,0,3*C,2*C),r.setRenderTarget(t),r.render(y,Ow)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let c=1;c<this._lodPlanes.length;c++){const p=Math.sqrt(this._sigmas[c]*this._sigmas[c]-this._sigmas[c-1]*this._sigmas[c-1]),y=XE[(c-1)%XE.length];this._blur(e,c-1,c,p,y)}t.autoClear=r}_blur(e,t,r,c,p){const y=this._pingPongRenderTarget;this._halfBlur(e,y,t,r,c,"latitudinal",p),this._halfBlur(y,e,r,r,c,"longitudinal",p)}_halfBlur(e,t,r,c,p,y,i){const C=this._renderer,D=this._blurMaterial;y!=="latitudinal"&&y!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const R=3,Q=new us(this._lodPlanes[c],D),z=D.uniforms,G=this._sizeLods[r]-1,J=isFinite(p)?Math.PI/(2*G):2*Math.PI/(2*Yp-1),Y=p/J,B=isFinite(p)?1+Math.floor(R*Y):Yp;B>Yp&&console.warn(`sigmaRadians, ${p}, is too large and will clip, as it requested ${B} samples when the maximum is set to ${Yp}`);const ae=[];let ce=0;for(let Je=0;Je<Yp;++Je){const Fe=Je/Y,Ge=Math.exp(-Fe*Fe/2);ae.push(Ge),Je===0?ce+=Ge:Je<B&&(ce+=2*Ge)}for(let Je=0;Je<ae.length;Je++)ae[Je]=ae[Je]/ce;z.envMap.value=e.texture,z.samples.value=B,z.weights.value=ae,z.latitudinal.value=y==="latitudinal",i&&(z.poleAxis.value=i);const{_lodMax:Ae}=this;z.dTheta.value=J,z.mipInt.value=Ae-r;const we=this._sizeLods[c],me=3*we*(c>Ae-Um?c-Ae+Um:0),De=4*(this._cubeSize-we);dx(t,me,De,3*we,2*we),C.setRenderTarget(t),C.render(Q,Ow)}}function zO(u){const e=[],t=[],r=[];let c=u;const p=u-Um+1+$E.length;for(let y=0;y<p;y++){const i=Math.pow(2,c);t.push(i);let C=1/i;y>u-Um?C=$E[y-u+Um-1]:y===0&&(C=0),r.push(C);const D=1/(i-2),R=-D,Q=1+D,z=[R,R,Q,R,Q,Q,R,R,Q,Q,R,Q],G=6,J=6,Y=3,B=2,ae=1,ce=new Float32Array(Y*J*G),Ae=new Float32Array(B*J*G),we=new Float32Array(ae*J*G);for(let De=0;De<G;De++){const Je=De%3*2/3-1,Fe=De>2?0:-1,Ge=[Je,Fe,0,Je+2/3,Fe,0,Je+2/3,Fe+1,0,Je,Fe,0,Je+2/3,Fe+1,0,Je,Fe+1,0];ce.set(Ge,Y*J*De),Ae.set(z,B*J*De);const Et=[De,De,De,De,De,De];we.set(Et,ae*J*De)}const me=new br;me.setAttribute("position",new As(ce,Y)),me.setAttribute("uv",new As(Ae,B)),me.setAttribute("faceIndex",new As(we,ae)),e.push(me),c>Um&&c--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function qE(u,e,t){const r=new rl(u,e,t);return r.texture.mapping=qm,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function dx(u,e,t,r,c){u.viewport.set(e,t,r,c),u.scissor.set(e,t,r,c)}function kO(u,e,t){const r=new Float32Array(Yp),c=new ft(0,1,0);return new ko({name:"SphericalGaussianBlur",defines:{n:Yp,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${u}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:G2(),fragmentShader:`
  3514. precision mediump float;
  3515. precision mediump int;
  3516. varying vec3 vOutputDirection;
  3517. uniform sampler2D envMap;
  3518. uniform int samples;
  3519. uniform float weights[ n ];
  3520. uniform bool latitudinal;
  3521. uniform float dTheta;
  3522. uniform float mipInt;
  3523. uniform vec3 poleAxis;
  3524. #define ENVMAP_TYPE_CUBE_UV
  3525. #include <cube_uv_reflection_fragment>
  3526. vec3 getSample( float theta, vec3 axis ) {
  3527. float cosTheta = cos( theta );
  3528. // Rodrigues' axis-angle rotation
  3529. vec3 sampleDirection = vOutputDirection * cosTheta
  3530. + cross( axis, vOutputDirection ) * sin( theta )
  3531. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  3532. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  3533. }
  3534. void main() {
  3535. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  3536. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  3537. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  3538. }
  3539. axis = normalize( axis );
  3540. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  3541. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  3542. for ( int i = 1; i < n; i++ ) {
  3543. if ( i >= samples ) {
  3544. break;
  3545. }
  3546. float theta = dTheta * float( i );
  3547. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  3548. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  3549. }
  3550. }
  3551. `,blending:KA,depthTest:!1,depthWrite:!1})}function YE(){return new ko({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:G2(),fragmentShader:`
  3552. precision mediump float;
  3553. precision mediump int;
  3554. varying vec3 vOutputDirection;
  3555. uniform sampler2D envMap;
  3556. #include <common>
  3557. void main() {
  3558. vec3 outputDirection = normalize( vOutputDirection );
  3559. vec2 uv = equirectUv( outputDirection );
  3560. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  3561. }
  3562. `,blending:KA,depthTest:!1,depthWrite:!1})}function JE(){return new ko({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:G2(),fragmentShader:`
  3563. precision mediump float;
  3564. precision mediump int;
  3565. uniform float flipEnvMap;
  3566. varying vec3 vOutputDirection;
  3567. uniform samplerCube envMap;
  3568. void main() {
  3569. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  3570. }
  3571. `,blending:KA,depthTest:!1,depthWrite:!1})}function G2(){return`
  3572. precision mediump float;
  3573. precision mediump int;
  3574. attribute float faceIndex;
  3575. varying vec3 vOutputDirection;
  3576. // RH coordinate system; PMREM face-indexing convention
  3577. vec3 getDirection( vec2 uv, float face ) {
  3578. uv = 2.0 * uv - 1.0;
  3579. vec3 direction = vec3( uv, 1.0 );
  3580. if ( face == 0.0 ) {
  3581. direction = direction.zyx; // ( 1, v, u ) pos x
  3582. } else if ( face == 1.0 ) {
  3583. direction = direction.xzy;
  3584. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  3585. } else if ( face == 2.0 ) {
  3586. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  3587. } else if ( face == 3.0 ) {
  3588. direction = direction.zyx;
  3589. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  3590. } else if ( face == 4.0 ) {
  3591. direction = direction.xzy;
  3592. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  3593. } else if ( face == 5.0 ) {
  3594. direction.z *= -1.0; // ( u, v, -1 ) neg z
  3595. }
  3596. return direction;
  3597. }
  3598. void main() {
  3599. vOutputDirection = getDirection( uv, faceIndex );
  3600. gl_Position = vec4( position, 1.0 );
  3601. }
  3602. `}function OO(u){let e=new WeakMap,t=null;function r(i){if(i&&i.isTexture){const C=i.mapping,D=C===O_||C===N_,R=C===rp||C===sp;if(D||R)if(i.isRenderTargetTexture&&i.needsPMREMUpdate===!0){i.needsPMREMUpdate=!1;let Q=e.get(i);return t===null&&(t=new a2(u)),Q=D?t.fromEquirectangular(i,Q):t.fromCubemap(i,Q),e.set(i,Q),Q.texture}else{if(e.has(i))return e.get(i).texture;{const Q=i.image;if(D&&Q&&Q.height>0||R&&Q&&c(Q)){t===null&&(t=new a2(u));const z=D?t.fromEquirectangular(i):t.fromCubemap(i);return e.set(i,z),i.addEventListener("dispose",p),z.texture}else return null}}}return i}function c(i){let C=0;const D=6;for(let R=0;R<D;R++)i[R]!==void 0&&C++;return C===D}function p(i){const C=i.target;C.removeEventListener("dispose",p);const D=e.get(C);D!==void 0&&(e.delete(C),D.dispose())}function y(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:y}}function NO(u){const e={};function t(r){if(e[r]!==void 0)return e[r];let c;switch(r){case"WEBGL_depth_texture":c=u.getExtension("WEBGL_depth_texture")||u.getExtension("MOZ_WEBGL_depth_texture")||u.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":c=u.getExtension("EXT_texture_filter_anisotropic")||u.getExtension("MOZ_EXT_texture_filter_anisotropic")||u.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":c=u.getExtension("WEBGL_compressed_texture_s3tc")||u.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||u.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":c=u.getExtension("WEBGL_compressed_texture_pvrtc")||u.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:c=u.getExtension(r)}return e[r]=c,c}return{has:function(r){return t(r)!==null},init:function(r){r.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(r){const c=t(r);return c===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),c}}}function QO(u,e,t,r){const c={},p=new WeakMap;function y(Q){const z=Q.target;z.index!==null&&e.remove(z.index);for(const J in z.attributes)e.remove(z.attributes[J]);z.removeEventListener("dispose",y),delete c[z.id];const G=p.get(z);G&&(e.remove(G),p.delete(z)),r.releaseStatesOfGeometry(z),z.isInstancedBufferGeometry===!0&&delete z._maxInstanceCount,t.memory.geometries--}function i(Q,z){return c[z.id]===!0||(z.addEventListener("dispose",y),c[z.id]=!0,t.memory.geometries++),z}function C(Q){const z=Q.attributes;for(const J in z)e.update(z[J],34962);const G=Q.morphAttributes;for(const J in G){const Y=G[J];for(let B=0,ae=Y.length;B<ae;B++)e.update(Y[B],34962)}}function D(Q){const z=[],G=Q.index,J=Q.attributes.position;let Y=0;if(G!==null){const ce=G.array;Y=G.version;for(let Ae=0,we=ce.length;Ae<we;Ae+=3){const me=ce[Ae+0],De=ce[Ae+1],Je=ce[Ae+2];z.push(me,De,De,Je,Je,me)}}else{const ce=J.array;Y=J.version;for(let Ae=0,we=ce.length/3-1;Ae<we;Ae+=3){const me=Ae+0,De=Ae+1,Je=Ae+2;z.push(me,De,De,Je,Je,me)}}const B=new(UI(z)?H2:V2)(z,1);B.version=Y;const ae=p.get(Q);ae&&e.remove(ae),p.set(Q,B)}function R(Q){const z=p.get(Q);if(z){const G=Q.index;G!==null&&z.version<G.version&&D(Q)}else D(Q);return p.get(Q)}return{get:i,update:C,getWireframeAttribute:R}}function VO(u,e,t,r){const c=r.isWebGL2;let p;function y(z){p=z}let i,C;function D(z){i=z.type,C=z.bytesPerElement}function R(z,G){u.drawElements(p,G,i,z*C),t.update(G,p,1)}function Q(z,G,J){if(J===0)return;let Y,B;if(c)Y=u,B="drawElementsInstanced";else if(Y=e.get("ANGLE_instanced_arrays"),B="drawElementsInstancedANGLE",Y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}Y[B](p,G,i,z*C,J),t.update(G,p,J)}this.setMode=y,this.setIndex=D,this.render=R,this.renderInstances=Q}function HO(u){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(p,y,i){switch(t.calls++,y){case 4:t.triangles+=i*(p/3);break;case 1:t.lines+=i*(p/2);break;case 3:t.lines+=i*(p-1);break;case 2:t.lines+=i*p;break;case 0:t.points+=i*p;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",y);break}}function c(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:c,update:r}}function GO(u,e){return u[0]-e[0]}function WO(u,e){return Math.abs(e[1])-Math.abs(u[1])}function jO(u,e,t){const r={},c=new Float32Array(8),p=new WeakMap,y=new as,i=[];for(let D=0;D<8;D++)i[D]=[D,0];function C(D,R,Q,z){const G=D.morphTargetInfluences;if(e.isWebGL2===!0){const Y=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,B=Y!==void 0?Y.length:0;let ae=p.get(R);if(ae===void 0||ae.count!==B){let xe=function(){le.dispose(),p.delete(R),R.removeEventListener("dispose",xe)};var J=xe;ae!==void 0&&ae.texture.dispose();const we=R.morphAttributes.position!==void 0,me=R.morphAttributes.normal!==void 0,De=R.morphAttributes.color!==void 0,Je=R.morphAttributes.position||[],Fe=R.morphAttributes.normal||[],Ge=R.morphAttributes.color||[];let Et=0;we===!0&&(Et=1),me===!0&&(Et=2),De===!0&&(Et=3);let li=R.attributes.position.count*Et,xi=1;li>e.maxTextureSize&&(xi=Math.ceil(li/e.maxTextureSize),li=e.maxTextureSize);const te=new Float32Array(li*xi*4*B),le=new Nv(te,li,xi,B);le.type=GA,le.needsUpdate=!0;const ye=Et*4;for(let Re=0;Re<B;Re++){const Oe=Je[Re],We=Fe[Re],Ve=Ge[Re],Qe=li*xi*4*Re;for(let Se=0;Se<Oe.count;Se++){const Ke=Se*ye;we===!0&&(y.fromBufferAttribute(Oe,Se),te[Qe+Ke+0]=y.x,te[Qe+Ke+1]=y.y,te[Qe+Ke+2]=y.z,te[Qe+Ke+3]=0),me===!0&&(y.fromBufferAttribute(We,Se),te[Qe+Ke+4]=y.x,te[Qe+Ke+5]=y.y,te[Qe+Ke+6]=y.z,te[Qe+Ke+7]=0),De===!0&&(y.fromBufferAttribute(Ve,Se),te[Qe+Ke+8]=y.x,te[Qe+Ke+9]=y.y,te[Qe+Ke+10]=y.z,te[Qe+Ke+11]=Ve.itemSize===4?y.w:1)}}ae={count:B,texture:le,size:new Di(li,xi)},p.set(R,ae),R.addEventListener("dispose",xe)}let ce=0;for(let we=0;we<G.length;we++)ce+=G[we];const Ae=R.morphTargetsRelative?1:1-ce;z.getUniforms().setValue(u,"morphTargetBaseInfluence",Ae),z.getUniforms().setValue(u,"morphTargetInfluences",G),z.getUniforms().setValue(u,"morphTargetsTexture",ae.texture,t),z.getUniforms().setValue(u,"morphTargetsTextureSize",ae.size)}else{const Y=G===void 0?0:G.length;let B=r[R.id];if(B===void 0||B.length!==Y){B=[];for(let me=0;me<Y;me++)B[me]=[me,0];r[R.id]=B}for(let me=0;me<Y;me++){const De=B[me];De[0]=me,De[1]=G[me]}B.sort(WO);for(let me=0;me<8;me++)me<Y&&B[me][1]?(i[me][0]=B[me][0],i[me][1]=B[me][1]):(i[me][0]=Number.MAX_SAFE_INTEGER,i[me][1]=0);i.sort(GO);const ae=R.morphAttributes.position,ce=R.morphAttributes.normal;let Ae=0;for(let me=0;me<8;me++){const De=i[me],Je=De[0],Fe=De[1];Je!==Number.MAX_SAFE_INTEGER&&Fe?(ae&&R.getAttribute("morphTarget"+me)!==ae[Je]&&R.setAttribute("morphTarget"+me,ae[Je]),ce&&R.getAttribute("morphNormal"+me)!==ce[Je]&&R.setAttribute("morphNormal"+me,ce[Je]),c[me]=Fe,Ae+=Fe):(ae&&R.hasAttribute("morphTarget"+me)===!0&&R.deleteAttribute("morphTarget"+me),ce&&R.hasAttribute("morphNormal"+me)===!0&&R.deleteAttribute("morphNormal"+me),c[me]=0)}const we=R.morphTargetsRelative?1:1-Ae;z.getUniforms().setValue(u,"morphTargetBaseInfluence",we),z.getUniforms().setValue(u,"morphTargetInfluences",c)}}return{update:C}}function KO(u,e,t,r){let c=new WeakMap;function p(C){const D=r.render.frame,R=C.geometry,Q=e.get(C,R);return c.get(Q)!==D&&(e.update(Q),c.set(Q,D)),C.isInstancedMesh&&(C.hasEventListener("dispose",i)===!1&&C.addEventListener("dispose",i),t.update(C.instanceMatrix,34962),C.instanceColor!==null&&t.update(C.instanceColor,34962)),Q}function y(){c=new WeakMap}function i(C){const D=C.target;D.removeEventListener("dispose",i),t.remove(D.instanceMatrix),D.instanceColor!==null&&t.remove(D.instanceColor)}return{update:p,dispose:y}}const QI=new To,VI=new Nv,HI=new Q2,GI=new Ay,eT=[],tT=[],iT=new Float32Array(16),nT=new Float32Array(9),rT=new Float32Array(4);function Ym(u,e,t){const r=u[0];if(r<=0||r>0)return u;const c=e*t;let p=eT[c];if(p===void 0&&(p=new Float32Array(c),eT[c]=p),e!==0){r.toArray(p,0);for(let y=1,i=0;y!==e;++y)i+=t,u[y].toArray(p,i)}return p}function sa(u,e){if(u.length!==e.length)return!1;for(let t=0,r=u.length;t<r;t++)if(u[t]!==e[t])return!1;return!0}function oa(u,e){for(let t=0,r=e.length;t<r;t++)u[t]=e[t]}function Hv(u,e){let t=tT[e];t===void 0&&(t=new Int32Array(e),tT[e]=t);for(let r=0;r!==e;++r)t[r]=u.allocateTextureUnit();return t}function $O(u,e){const t=this.cache;t[0]!==e&&(u.uniform1f(this.addr,e),t[0]=e)}function ZO(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(u.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sa(t,e))return;u.uniform2fv(this.addr,e),oa(t,e)}}function XO(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(u.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(u.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(sa(t,e))return;u.uniform3fv(this.addr,e),oa(t,e)}}function qO(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(u.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sa(t,e))return;u.uniform4fv(this.addr,e),oa(t,e)}}function YO(u,e){const t=this.cache,r=e.elements;if(r===void 0){if(sa(t,e))return;u.uniformMatrix2fv(this.addr,!1,e),oa(t,e)}else{if(sa(t,r))return;rT.set(r),u.uniformMatrix2fv(this.addr,!1,rT),oa(t,r)}}function JO(u,e){const t=this.cache,r=e.elements;if(r===void 0){if(sa(t,e))return;u.uniformMatrix3fv(this.addr,!1,e),oa(t,e)}else{if(sa(t,r))return;nT.set(r),u.uniformMatrix3fv(this.addr,!1,nT),oa(t,r)}}function e6(u,e){const t=this.cache,r=e.elements;if(r===void 0){if(sa(t,e))return;u.uniformMatrix4fv(this.addr,!1,e),oa(t,e)}else{if(sa(t,r))return;iT.set(r),u.uniformMatrix4fv(this.addr,!1,iT),oa(t,r)}}function t6(u,e){const t=this.cache;t[0]!==e&&(u.uniform1i(this.addr,e),t[0]=e)}function i6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(u.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sa(t,e))return;u.uniform2iv(this.addr,e),oa(t,e)}}function n6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(u.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sa(t,e))return;u.uniform3iv(this.addr,e),oa(t,e)}}function r6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(u.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sa(t,e))return;u.uniform4iv(this.addr,e),oa(t,e)}}function s6(u,e){const t=this.cache;t[0]!==e&&(u.uniform1ui(this.addr,e),t[0]=e)}function o6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(u.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sa(t,e))return;u.uniform2uiv(this.addr,e),oa(t,e)}}function a6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(u.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sa(t,e))return;u.uniform3uiv(this.addr,e),oa(t,e)}}function l6(u,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(u.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sa(t,e))return;u.uniform4uiv(this.addr,e),oa(t,e)}}function c6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTexture2D(e||QI,c)}function h6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTexture3D(e||HI,c)}function u6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTextureCube(e||GI,c)}function A6(u,e,t){const r=this.cache,c=t.allocateTextureUnit();r[0]!==c&&(u.uniform1i(this.addr,c),r[0]=c),t.setTexture2DArray(e||VI,c)}function d6(u){switch(u){case 5126:return $O;case 35664:return ZO;case 35665:return XO;case 35666:return qO;case 35674:return YO;case 35675:return JO;case 35676:return e6;case 5124:case 35670:return t6;case 35667:case 35671:return i6;case 35668:case 35672:return n6;case 35669:case 35673:return r6;case 5125:return s6;case 36294:return o6;case 36295:return a6;case 36296:return l6;case 35678:case 36198:case 36298:case 36306:case 35682:return c6;case 35679:case 36299:case 36307:return h6;case 35680:case 36300:case 36308:case 36293:return u6;case 36289:case 36303:case 36311:case 36292:return A6}}function p6(u,e){u.uniform1fv(this.addr,e)}function f6(u,e){const t=Ym(e,this.size,2);u.uniform2fv(this.addr,t)}function m6(u,e){const t=Ym(e,this.size,3);u.uniform3fv(this.addr,t)}function g6(u,e){const t=Ym(e,this.size,4);u.uniform4fv(this.addr,t)}function _6(u,e){const t=Ym(e,this.size,4);u.uniformMatrix2fv(this.addr,!1,t)}function y6(u,e){const t=Ym(e,this.size,9);u.uniformMatrix3fv(this.addr,!1,t)}function x6(u,e){const t=Ym(e,this.size,16);u.uniformMatrix4fv(this.addr,!1,t)}function v6(u,e){u.uniform1iv(this.addr,e)}function w6(u,e){u.uniform2iv(this.addr,e)}function b6(u,e){u.uniform3iv(this.addr,e)}function B6(u,e){u.uniform4iv(this.addr,e)}function C6(u,e){u.uniform1uiv(this.addr,e)}function E6(u,e){u.uniform2uiv(this.addr,e)}function T6(u,e){u.uniform3uiv(this.addr,e)}function S6(u,e){u.uniform4uiv(this.addr,e)}function M6(u,e,t){const r=this.cache,c=e.length,p=Hv(t,c);sa(r,p)||(u.uniform1iv(this.addr,p),oa(r,p));for(let y=0;y!==c;++y)t.setTexture2D(e[y]||QI,p[y])}function I6(u,e,t){const r=this.cache,c=e.length,p=Hv(t,c);sa(r,p)||(u.uniform1iv(this.addr,p),oa(r,p));for(let y=0;y!==c;++y)t.setTexture3D(e[y]||HI,p[y])}function F6(u,e,t){const r=this.cache,c=e.length,p=Hv(t,c);sa(r,p)||(u.uniform1iv(this.addr,p),oa(r,p));for(let y=0;y!==c;++y)t.setTextureCube(e[y]||GI,p[y])}function L6(u,e,t){const r=this.cache,c=e.length,p=Hv(t,c);sa(r,p)||(u.uniform1iv(this.addr,p),oa(r,p));for(let y=0;y!==c;++y)t.setTexture2DArray(e[y]||VI,p[y])}function D6(u){switch(u){case 5126:return p6;case 35664:return f6;case 35665:return m6;case 35666:return g6;case 35674:return _6;case 35675:return y6;case 35676:return x6;case 5124:case 35670:return v6;case 35667:case 35671:return w6;case 35668:case 35672:return b6;case 35669:case 35673:return B6;case 5125:return C6;case 36294:return E6;case 36295:return T6;case 36296:return S6;case 35678:case 36198:case 36298:case 36306:case 35682:return M6;case 35679:case 36299:case 36307:return I6;case 35680:case 36300:case 36308:case 36293:return F6;case 36289:case 36303:case 36311:case 36292:return L6}}class P6{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=d6(t.type)}}class U6{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=D6(t.type)}}class R6{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const c=this.seq;for(let p=0,y=c.length;p!==y;++p){const i=c[p];i.setValue(e,t[i.id],r)}}}const Qw=/(\w+)(\])?(\[|\.)?/g;function sT(u,e){u.seq.push(e),u.map[e.id]=e}function z6(u,e,t){const r=u.name,c=r.length;for(Qw.lastIndex=0;;){const p=Qw.exec(r),y=Qw.lastIndex;let i=p[1];const C=p[2]==="]",D=p[3];if(C&&(i=i|0),D===void 0||D==="["&&y+2===c){sT(t,D===void 0?new P6(i,u,e):new U6(i,u,e));break}else{let Q=t.map[i];Q===void 0&&(Q=new R6(i),sT(t,Q)),t=Q}}}class Yx{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,35718);for(let c=0;c<r;++c){const p=e.getActiveUniform(t,c),y=e.getUniformLocation(t,p.name);z6(p,y,this)}}setValue(e,t,r,c){const p=this.map[t];p!==void 0&&p.setValue(e,r,c)}setOptional(e,t,r){const c=t[r];c!==void 0&&this.setValue(e,r,c)}static upload(e,t,r,c){for(let p=0,y=t.length;p!==y;++p){const i=t[p],C=r[i.id];C.needsUpdate!==!1&&i.setValue(e,C.value,c)}}static seqWithValue(e,t){const r=[];for(let c=0,p=e.length;c!==p;++c){const y=e[c];y.id in t&&r.push(y)}return r}}function oT(u,e,t){const r=u.createShader(e);return u.shaderSource(r,t),u.compileShader(r),r}let k6=0;function O6(u,e){const t=u.split(`
  3603. `),r=[],c=Math.max(e-6,0),p=Math.min(e+6,t.length);for(let y=c;y<p;y++){const i=y+1;r.push(`${i===e?">":" "} ${i}: ${t[y]}`)}return r.join(`
  3604. `)}function N6(u){switch(u){case lp:return["Linear","( value )"];case Ts:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",u),["Linear","( value )"]}}function aT(u,e,t){const r=u.getShaderParameter(e,35713),c=u.getShaderInfoLog(e).trim();if(r&&c==="")return"";const p=/ERROR: 0:(\d+)/.exec(c);if(p){const y=parseInt(p[1]);return t.toUpperCase()+`
  3605. `+c+`
  3606. `+O6(u.getShaderSource(e),y)}else return c}function Q6(u,e){const t=N6(e);return"vec4 "+u+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function V6(u,e){let t;switch(e){case U2:t="Linear";break;case aI:t="Reinhard";break;case lI:t="OptimizedCineon";break;case cI:t="ACESFilmic";break;case hI:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+u+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function H6(u){return[u.extensionDerivatives||!!u.envMapCubeUVHeight||u.bumpMap||u.tangentSpaceNormalMap||u.clearcoatNormalMap||u.flatShading||u.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(u.extensionFragDepth||u.logarithmicDepthBuffer)&&u.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",u.extensionDrawBuffers&&u.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(u.extensionShaderTextureLOD||u.envMap||u.transmission)&&u.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(v_).join(`
  3607. `)}function G6(u){const e=[];for(const t in u){const r=u[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(`
  3608. `)}function W6(u,e){const t={},r=u.getProgramParameter(e,35721);for(let c=0;c<r;c++){const p=u.getActiveAttrib(e,c),y=p.name;let i=1;p.type===35674&&(i=2),p.type===35675&&(i=3),p.type===35676&&(i=4),t[y]={type:p.type,location:u.getAttribLocation(e,y),locationSize:i}}return t}function v_(u){return u!==""}function lT(u,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return u.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function cT(u,e){return u.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const j6=/^[ \t]*#include +<([\w\d./]+)>/gm;function l2(u){return u.replace(j6,K6)}function K6(u,e){const t=zr[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return l2(t)}const $6=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function hT(u){return u.replace($6,Z6)}function Z6(u,e,t,r){let c="";for(let p=parseInt(e);p<parseInt(t);p++)c+=r.replace(/\[\s*i\s*\]/g,"[ "+p+" ]").replace(/UNROLLED_LOOP_INDEX/g,p);return c}function uT(u){let e="precision "+u.precision+` float;
  3609. precision `+u.precision+" int;";return u.precision==="highp"?e+=`
  3610. #define HIGH_PRECISION`:u.precision==="mediump"?e+=`
  3611. #define MEDIUM_PRECISION`:u.precision==="lowp"&&(e+=`
  3612. #define LOW_PRECISION`),e}function X6(u){let e="SHADOWMAP_TYPE_BASIC";return u.shadowMapType===L2?e="SHADOWMAP_TYPE_PCF":u.shadowMapType===OM?e="SHADOWMAP_TYPE_PCF_SOFT":u.shadowMapType===Dm&&(e="SHADOWMAP_TYPE_VSM"),e}function q6(u){let e="ENVMAP_TYPE_CUBE";if(u.envMap)switch(u.envMapMode){case rp:case sp:e="ENVMAP_TYPE_CUBE";break;case qm:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Y6(u){let e="ENVMAP_MODE_REFLECTION";if(u.envMap)switch(u.envMapMode){case sp:e="ENVMAP_MODE_REFRACTION";break}return e}function J6(u){let e="ENVMAP_BLENDING_NONE";if(u.envMap)switch(u.combine){case ly:e="ENVMAP_BLENDING_MULTIPLY";break;case sI:e="ENVMAP_BLENDING_MIX";break;case oI:e="ENVMAP_BLENDING_ADD";break}return e}function eN(u){const e=u.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:r,maxMip:t}}function tN(u,e,t,r){const c=u.getContext(),p=t.defines;let y=t.vertexShader,i=t.fragmentShader;const C=X6(t),D=q6(t),R=Y6(t),Q=J6(t),z=eN(t),G=t.isWebGL2?"":H6(t),J=G6(p),Y=c.createProgram();let B,ae,ce=t.glslVersion?"#version "+t.glslVersion+`
  3613. `:"";t.isRawShaderMaterial?(B=[J].filter(v_).join(`
  3614. `),B.length>0&&(B+=`
  3615. `),ae=[G,J].filter(v_).join(`
  3616. `),ae.length>0&&(ae+=`
  3617. `)):(B=[uT(t),"#define SHADER_NAME "+t.shaderName,J,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+R:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+C:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  3618. `].filter(v_).join(`
  3619. `),ae=[G,uT(t),"#define SHADER_NAME "+t.shaderName,J,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+D:"",t.envMap?"#define "+R:"",t.envMap?"#define "+Q:"",z?"#define CUBEUV_TEXEL_WIDTH "+z.texelWidth:"",z?"#define CUBEUV_TEXEL_HEIGHT "+z.texelHeight:"",z?"#define CUBEUV_MAX_MIP "+z.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+C:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Hu?"#define TONE_MAPPING":"",t.toneMapping!==Hu?zr.tonemapping_pars_fragment:"",t.toneMapping!==Hu?V6("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",zr.encodings_pars_fragment,Q6("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  3620. `].filter(v_).join(`
  3621. `)),y=l2(y),y=lT(y,t),y=cT(y,t),i=l2(i),i=lT(i,t),i=cT(i,t),y=hT(y),i=hT(i),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(ce=`#version 300 es
  3622. `,B=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  3623. `)+`
  3624. `+B,ae=["#define varying in",t.glslVersion===s2?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===s2?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
  3625. `)+`
  3626. `+ae);const Ae=ce+B+y,we=ce+ae+i,me=oT(c,35633,Ae),De=oT(c,35632,we);if(c.attachShader(Y,me),c.attachShader(Y,De),t.index0AttributeName!==void 0?c.bindAttribLocation(Y,0,t.index0AttributeName):t.morphTargets===!0&&c.bindAttribLocation(Y,0,"position"),c.linkProgram(Y),u.debug.checkShaderErrors){const Ge=c.getProgramInfoLog(Y).trim(),Et=c.getShaderInfoLog(me).trim(),li=c.getShaderInfoLog(De).trim();let xi=!0,te=!0;if(c.getProgramParameter(Y,35714)===!1){xi=!1;const le=aT(c,me,"vertex"),ye=aT(c,De,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(Y,35715)+`
  3627. Program Info Log: `+Ge+`
  3628. `+le+`
  3629. `+ye)}else Ge!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Ge):(Et===""||li==="")&&(te=!1);te&&(this.diagnostics={runnable:xi,programLog:Ge,vertexShader:{log:Et,prefix:B},fragmentShader:{log:li,prefix:ae}})}c.deleteShader(me),c.deleteShader(De);let Je;this.getUniforms=function(){return Je===void 0&&(Je=new Yx(c,Y)),Je};let Fe;return this.getAttributes=function(){return Fe===void 0&&(Fe=W6(c,Y)),Fe},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(Y),this.program=void 0},this.name=t.shaderName,this.id=k6++,this.cacheKey=e,this.usedTimes=1,this.program=Y,this.vertexShader=me,this.fragmentShader=De,this}let iN=0;class nN{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,c=this._getShaderStage(t),p=this._getShaderStage(r),y=this._getShaderCacheForMaterial(e);return y.has(c)===!1&&(y.add(c),c.usedTimes++),y.has(p)===!1&&(y.add(p),p.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new rN(e),t.set(e,r)),r}}class rN{constructor(e){this.id=iN++,this.code=e,this.usedTimes=0}}function sN(u,e,t,r,c,p,y){const i=new uy,C=new nN,D=[],R=c.isWebGL2,Q=c.logarithmicDepthBuffer,z=c.vertexTextures;let G=c.precision;const J={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function Y(Fe,Ge,Et,li,xi){const te=li.fog,le=xi.geometry,ye=Fe.isMeshStandardMaterial?li.environment:null,xe=(Fe.isMeshStandardMaterial?t:e).get(Fe.envMap||ye),Re=!!xe&&xe.mapping===qm?xe.image.height:null,Oe=J[Fe.type];Fe.precision!==null&&(G=c.getMaxPrecision(Fe.precision),G!==Fe.precision&&console.warn("THREE.WebGLProgram.getParameters:",Fe.precision,"not supported, using",G,"instead."));const We=le.morphAttributes.position||le.morphAttributes.normal||le.morphAttributes.color,Ve=We!==void 0?We.length:0;let Qe=0;le.morphAttributes.position!==void 0&&(Qe=1),le.morphAttributes.normal!==void 0&&(Qe=2),le.morphAttributes.color!==void 0&&(Qe=3);let Se,Ke,nt,vt;if(Oe){const Qt=Fl[Oe];Se=Qt.vertexShader,Ke=Qt.fragmentShader}else Se=Fe.vertexShader,Ke=Fe.fragmentShader,C.update(Fe),nt=C.getVertexShaderID(Fe),vt=C.getFragmentShaderID(Fe);const be=u.getRenderTarget(),At=Fe.alphaTest>0,ut=Fe.clearcoat>0,Nt=Fe.iridescence>0;return{isWebGL2:R,shaderID:Oe,shaderName:Fe.type,vertexShader:Se,fragmentShader:Ke,defines:Fe.defines,customVertexShaderID:nt,customFragmentShaderID:vt,isRawShaderMaterial:Fe.isRawShaderMaterial===!0,glslVersion:Fe.glslVersion,precision:G,instancing:xi.isInstancedMesh===!0,instancingColor:xi.isInstancedMesh===!0&&xi.instanceColor!==null,supportsVertexTextures:z,outputEncoding:be===null?u.outputEncoding:be.isXRRenderTarget===!0?be.texture.encoding:lp,map:!!Fe.map,matcap:!!Fe.matcap,envMap:!!xe,envMapMode:xe&&xe.mapping,envMapCubeUVHeight:Re,lightMap:!!Fe.lightMap,aoMap:!!Fe.aoMap,emissiveMap:!!Fe.emissiveMap,bumpMap:!!Fe.bumpMap,normalMap:!!Fe.normalMap,objectSpaceNormalMap:Fe.normalMapType===FI,tangentSpaceNormalMap:Fe.normalMapType===cp,decodeVideoTexture:!!Fe.map&&Fe.map.isVideoTexture===!0&&Fe.map.encoding===Ts,clearcoat:ut,clearcoatMap:ut&&!!Fe.clearcoatMap,clearcoatRoughnessMap:ut&&!!Fe.clearcoatRoughnessMap,clearcoatNormalMap:ut&&!!Fe.clearcoatNormalMap,iridescence:Nt,iridescenceMap:Nt&&!!Fe.iridescenceMap,iridescenceThicknessMap:Nt&&!!Fe.iridescenceThicknessMap,displacementMap:!!Fe.displacementMap,roughnessMap:!!Fe.roughnessMap,metalnessMap:!!Fe.metalnessMap,specularMap:!!Fe.specularMap,specularIntensityMap:!!Fe.specularIntensityMap,specularColorMap:!!Fe.specularColorMap,opaque:Fe.transparent===!1&&Fe.blending===hf,alphaMap:!!Fe.alphaMap,alphaTest:At,gradientMap:!!Fe.gradientMap,sheen:Fe.sheen>0,sheenColorMap:!!Fe.sheenColorMap,sheenRoughnessMap:!!Fe.sheenRoughnessMap,transmission:Fe.transmission>0,transmissionMap:!!Fe.transmissionMap,thicknessMap:!!Fe.thicknessMap,combine:Fe.combine,vertexTangents:!!Fe.normalMap&&!!le.attributes.tangent,vertexColors:Fe.vertexColors,vertexAlphas:Fe.vertexColors===!0&&!!le.attributes.color&&le.attributes.color.itemSize===4,vertexUvs:!!Fe.map||!!Fe.bumpMap||!!Fe.normalMap||!!Fe.specularMap||!!Fe.alphaMap||!!Fe.emissiveMap||!!Fe.roughnessMap||!!Fe.metalnessMap||!!Fe.clearcoatMap||!!Fe.clearcoatRoughnessMap||!!Fe.clearcoatNormalMap||!!Fe.iridescenceMap||!!Fe.iridescenceThicknessMap||!!Fe.displacementMap||!!Fe.transmissionMap||!!Fe.thicknessMap||!!Fe.specularIntensityMap||!!Fe.specularColorMap||!!Fe.sheenColorMap||!!Fe.sheenRoughnessMap,uvsVertexOnly:!(!!Fe.map||!!Fe.bumpMap||!!Fe.normalMap||!!Fe.specularMap||!!Fe.alphaMap||!!Fe.emissiveMap||!!Fe.roughnessMap||!!Fe.metalnessMap||!!Fe.clearcoatNormalMap||!!Fe.iridescenceMap||!!Fe.iridescenceThicknessMap||Fe.transmission>0||!!Fe.transmissionMap||!!Fe.thicknessMap||!!Fe.specularIntensityMap||!!Fe.specularColorMap||Fe.sheen>0||!!Fe.sheenColorMap||!!Fe.sheenRoughnessMap)&&!!Fe.displacementMap,fog:!!te,useFog:Fe.fog===!0,fogExp2:te&&te.isFogExp2,flatShading:!!Fe.flatShading,sizeAttenuation:Fe.sizeAttenuation,logarithmicDepthBuffer:Q,skinning:xi.isSkinnedMesh===!0,morphTargets:le.morphAttributes.position!==void 0,morphNormals:le.morphAttributes.normal!==void 0,morphColors:le.morphAttributes.color!==void 0,morphTargetsCount:Ve,morphTextureStride:Qe,numDirLights:Ge.directional.length,numPointLights:Ge.point.length,numSpotLights:Ge.spot.length,numSpotLightMaps:Ge.spotLightMap.length,numRectAreaLights:Ge.rectArea.length,numHemiLights:Ge.hemi.length,numDirLightShadows:Ge.directionalShadowMap.length,numPointLightShadows:Ge.pointShadowMap.length,numSpotLightShadows:Ge.spotShadowMap.length,numSpotLightShadowsWithMaps:Ge.numSpotLightShadowsWithMaps,numClippingPlanes:y.numPlanes,numClipIntersection:y.numIntersection,dithering:Fe.dithering,shadowMapEnabled:u.shadowMap.enabled&&Et.length>0,shadowMapType:u.shadowMap.type,toneMapping:Fe.toneMapped?u.toneMapping:Hu,physicallyCorrectLights:u.physicallyCorrectLights,premultipliedAlpha:Fe.premultipliedAlpha,doubleSided:Fe.side===ga,flipSided:Fe.side===rc,useDepthPacking:!!Fe.depthPacking,depthPacking:Fe.depthPacking||0,index0AttributeName:Fe.index0AttributeName,extensionDerivatives:Fe.extensions&&Fe.extensions.derivatives,extensionFragDepth:Fe.extensions&&Fe.extensions.fragDepth,extensionDrawBuffers:Fe.extensions&&Fe.extensions.drawBuffers,extensionShaderTextureLOD:Fe.extensions&&Fe.extensions.shaderTextureLOD,rendererExtensionFragDepth:R||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:R||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:R||r.has("EXT_shader_texture_lod"),customProgramCacheKey:Fe.customProgramCacheKey()}}function B(Fe){const Ge=[];if(Fe.shaderID?Ge.push(Fe.shaderID):(Ge.push(Fe.customVertexShaderID),Ge.push(Fe.customFragmentShaderID)),Fe.defines!==void 0)for(const Et in Fe.defines)Ge.push(Et),Ge.push(Fe.defines[Et]);return Fe.isRawShaderMaterial===!1&&(ae(Ge,Fe),ce(Ge,Fe),Ge.push(u.outputEncoding)),Ge.push(Fe.customProgramCacheKey),Ge.join()}function ae(Fe,Ge){Fe.push(Ge.precision),Fe.push(Ge.outputEncoding),Fe.push(Ge.envMapMode),Fe.push(Ge.envMapCubeUVHeight),Fe.push(Ge.combine),Fe.push(Ge.vertexUvs),Fe.push(Ge.fogExp2),Fe.push(Ge.sizeAttenuation),Fe.push(Ge.morphTargetsCount),Fe.push(Ge.morphAttributeCount),Fe.push(Ge.numDirLights),Fe.push(Ge.numPointLights),Fe.push(Ge.numSpotLights),Fe.push(Ge.numSpotLightMaps),Fe.push(Ge.numHemiLights),Fe.push(Ge.numRectAreaLights),Fe.push(Ge.numDirLightShadows),Fe.push(Ge.numPointLightShadows),Fe.push(Ge.numSpotLightShadows),Fe.push(Ge.numSpotLightShadowsWithMaps),Fe.push(Ge.shadowMapType),Fe.push(Ge.toneMapping),Fe.push(Ge.numClippingPlanes),Fe.push(Ge.numClipIntersection),Fe.push(Ge.depthPacking)}function ce(Fe,Ge){i.disableAll(),Ge.isWebGL2&&i.enable(0),Ge.supportsVertexTextures&&i.enable(1),Ge.instancing&&i.enable(2),Ge.instancingColor&&i.enable(3),Ge.map&&i.enable(4),Ge.matcap&&i.enable(5),Ge.envMap&&i.enable(6),Ge.lightMap&&i.enable(7),Ge.aoMap&&i.enable(8),Ge.emissiveMap&&i.enable(9),Ge.bumpMap&&i.enable(10),Ge.normalMap&&i.enable(11),Ge.objectSpaceNormalMap&&i.enable(12),Ge.tangentSpaceNormalMap&&i.enable(13),Ge.clearcoat&&i.enable(14),Ge.clearcoatMap&&i.enable(15),Ge.clearcoatRoughnessMap&&i.enable(16),Ge.clearcoatNormalMap&&i.enable(17),Ge.iridescence&&i.enable(18),Ge.iridescenceMap&&i.enable(19),Ge.iridescenceThicknessMap&&i.enable(20),Ge.displacementMap&&i.enable(21),Ge.specularMap&&i.enable(22),Ge.roughnessMap&&i.enable(23),Ge.metalnessMap&&i.enable(24),Ge.gradientMap&&i.enable(25),Ge.alphaMap&&i.enable(26),Ge.alphaTest&&i.enable(27),Ge.vertexColors&&i.enable(28),Ge.vertexAlphas&&i.enable(29),Ge.vertexUvs&&i.enable(30),Ge.vertexTangents&&i.enable(31),Ge.uvsVertexOnly&&i.enable(32),Fe.push(i.mask),i.disableAll(),Ge.fog&&i.enable(0),Ge.useFog&&i.enable(1),Ge.flatShading&&i.enable(2),Ge.logarithmicDepthBuffer&&i.enable(3),Ge.skinning&&i.enable(4),Ge.morphTargets&&i.enable(5),Ge.morphNormals&&i.enable(6),Ge.morphColors&&i.enable(7),Ge.premultipliedAlpha&&i.enable(8),Ge.shadowMapEnabled&&i.enable(9),Ge.physicallyCorrectLights&&i.enable(10),Ge.doubleSided&&i.enable(11),Ge.flipSided&&i.enable(12),Ge.useDepthPacking&&i.enable(13),Ge.dithering&&i.enable(14),Ge.specularIntensityMap&&i.enable(15),Ge.specularColorMap&&i.enable(16),Ge.transmission&&i.enable(17),Ge.transmissionMap&&i.enable(18),Ge.thicknessMap&&i.enable(19),Ge.sheen&&i.enable(20),Ge.sheenColorMap&&i.enable(21),Ge.sheenRoughnessMap&&i.enable(22),Ge.decodeVideoTexture&&i.enable(23),Ge.opaque&&i.enable(24),Fe.push(i.mask)}function Ae(Fe){const Ge=J[Fe.type];let Et;if(Ge){const li=Fl[Ge];Et=mf.clone(li.uniforms)}else Et=Fe.uniforms;return Et}function we(Fe,Ge){let Et;for(let li=0,xi=D.length;li<xi;li++){const te=D[li];if(te.cacheKey===Ge){Et=te,++Et.usedTimes;break}}return Et===void 0&&(Et=new tN(u,Ge,Fe,p),D.push(Et)),Et}function me(Fe){if(--Fe.usedTimes===0){const Ge=D.indexOf(Fe);D[Ge]=D[D.length-1],D.pop(),Fe.destroy()}}function De(Fe){C.remove(Fe)}function Je(){C.dispose()}return{getParameters:Y,getProgramCacheKey:B,getUniforms:Ae,acquireProgram:we,releaseProgram:me,releaseShaderCache:De,programs:D,dispose:Je}}function oN(){let u=new WeakMap;function e(p){let y=u.get(p);return y===void 0&&(y={},u.set(p,y)),y}function t(p){u.delete(p)}function r(p,y,i){u.get(p)[y]=i}function c(){u=new WeakMap}return{get:e,remove:t,update:r,dispose:c}}function aN(u,e){return u.groupOrder!==e.groupOrder?u.groupOrder-e.groupOrder:u.renderOrder!==e.renderOrder?u.renderOrder-e.renderOrder:u.material.id!==e.material.id?u.material.id-e.material.id:u.z!==e.z?u.z-e.z:u.id-e.id}function AT(u,e){return u.groupOrder!==e.groupOrder?u.groupOrder-e.groupOrder:u.renderOrder!==e.renderOrder?u.renderOrder-e.renderOrder:u.z!==e.z?e.z-u.z:u.id-e.id}function dT(){const u=[];let e=0;const t=[],r=[],c=[];function p(){e=0,t.length=0,r.length=0,c.length=0}function y(Q,z,G,J,Y,B){let ae=u[e];return ae===void 0?(ae={id:Q.id,object:Q,geometry:z,material:G,groupOrder:J,renderOrder:Q.renderOrder,z:Y,group:B},u[e]=ae):(ae.id=Q.id,ae.object=Q,ae.geometry=z,ae.material=G,ae.groupOrder=J,ae.renderOrder=Q.renderOrder,ae.z=Y,ae.group=B),e++,ae}function i(Q,z,G,J,Y,B){const ae=y(Q,z,G,J,Y,B);G.transmission>0?r.push(ae):G.transparent===!0?c.push(ae):t.push(ae)}function C(Q,z,G,J,Y,B){const ae=y(Q,z,G,J,Y,B);G.transmission>0?r.unshift(ae):G.transparent===!0?c.unshift(ae):t.unshift(ae)}function D(Q,z){t.length>1&&t.sort(Q||aN),r.length>1&&r.sort(z||AT),c.length>1&&c.sort(z||AT)}function R(){for(let Q=e,z=u.length;Q<z;Q++){const G=u[Q];if(G.id===null)break;G.id=null,G.object=null,G.geometry=null,G.material=null,G.group=null}}return{opaque:t,transmissive:r,transparent:c,init:p,push:i,unshift:C,finish:R,sort:D}}function lN(){let u=new WeakMap;function e(r,c){const p=u.get(r);let y;return p===void 0?(y=new dT,u.set(r,[y])):c>=p.length?(y=new dT,p.push(y)):y=p[c],y}function t(){u=new WeakMap}return{get:e,dispose:t}}function cN(){const u={};return{get:function(e){if(u[e.id]!==void 0)return u[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ft,color:new Dn};break;case"SpotLight":t={position:new ft,direction:new ft,color:new Dn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ft,color:new Dn,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ft,skyColor:new Dn,groundColor:new Dn};break;case"RectAreaLight":t={color:new Dn,position:new ft,halfWidth:new ft,halfHeight:new ft};break}return u[e.id]=t,t}}}function hN(){const u={};return{get:function(e){if(u[e.id]!==void 0)return u[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Di};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Di};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Di,shadowCameraNear:1,shadowCameraFar:1e3};break}return u[e.id]=t,t}}}let uN=0;function AN(u,e){return(e.castShadow?2:0)-(u.castShadow?2:0)+(e.map?1:0)-(u.map?1:0)}function dN(u,e){const t=new cN,r=hN(),c={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let R=0;R<9;R++)c.probe.push(new ft);const p=new ft,y=new ar,i=new ar;function C(R,Q){let z=0,G=0,J=0;for(let li=0;li<9;li++)c.probe[li].set(0,0,0);let Y=0,B=0,ae=0,ce=0,Ae=0,we=0,me=0,De=0,Je=0,Fe=0;R.sort(AN);const Ge=Q!==!0?Math.PI:1;for(let li=0,xi=R.length;li<xi;li++){const te=R[li],le=te.color,ye=te.intensity,xe=te.distance,Re=te.shadow&&te.shadow.map?te.shadow.map.texture:null;if(te.isAmbientLight)z+=le.r*ye*Ge,G+=le.g*ye*Ge,J+=le.b*ye*Ge;else if(te.isLightProbe)for(let Oe=0;Oe<9;Oe++)c.probe[Oe].addScaledVector(te.sh.coefficients[Oe],ye);else if(te.isDirectionalLight){const Oe=t.get(te);if(Oe.color.copy(te.color).multiplyScalar(te.intensity*Ge),te.castShadow){const We=te.shadow,Ve=r.get(te);Ve.shadowBias=We.bias,Ve.shadowNormalBias=We.normalBias,Ve.shadowRadius=We.radius,Ve.shadowMapSize=We.mapSize,c.directionalShadow[Y]=Ve,c.directionalShadowMap[Y]=Re,c.directionalShadowMatrix[Y]=te.shadow.matrix,we++}c.directional[Y]=Oe,Y++}else if(te.isSpotLight){const Oe=t.get(te);Oe.position.setFromMatrixPosition(te.matrixWorld),Oe.color.copy(le).multiplyScalar(ye*Ge),Oe.distance=xe,Oe.coneCos=Math.cos(te.angle),Oe.penumbraCos=Math.cos(te.angle*(1-te.penumbra)),Oe.decay=te.decay,c.spot[ae]=Oe;const We=te.shadow;if(te.map&&(c.spotLightMap[Je]=te.map,Je++,We.updateMatrices(te),te.castShadow&&Fe++),c.spotLightMatrix[ae]=We.matrix,te.castShadow){const Ve=r.get(te);Ve.shadowBias=We.bias,Ve.shadowNormalBias=We.normalBias,Ve.shadowRadius=We.radius,Ve.shadowMapSize=We.mapSize,c.spotShadow[ae]=Ve,c.spotShadowMap[ae]=Re,De++}ae++}else if(te.isRectAreaLight){const Oe=t.get(te);Oe.color.copy(le).multiplyScalar(ye),Oe.halfWidth.set(te.width*.5,0,0),Oe.halfHeight.set(0,te.height*.5,0),c.rectArea[ce]=Oe,ce++}else if(te.isPointLight){const Oe=t.get(te);if(Oe.color.copy(te.color).multiplyScalar(te.intensity*Ge),Oe.distance=te.distance,Oe.decay=te.decay,te.castShadow){const We=te.shadow,Ve=r.get(te);Ve.shadowBias=We.bias,Ve.shadowNormalBias=We.normalBias,Ve.shadowRadius=We.radius,Ve.shadowMapSize=We.mapSize,Ve.shadowCameraNear=We.camera.near,Ve.shadowCameraFar=We.camera.far,c.pointShadow[B]=Ve,c.pointShadowMap[B]=Re,c.pointShadowMatrix[B]=te.shadow.matrix,me++}c.point[B]=Oe,B++}else if(te.isHemisphereLight){const Oe=t.get(te);Oe.skyColor.copy(te.color).multiplyScalar(ye*Ge),Oe.groundColor.copy(te.groundColor).multiplyScalar(ye*Ge),c.hemi[Ae]=Oe,Ae++}}ce>0&&(e.isWebGL2||u.has("OES_texture_float_linear")===!0?(c.rectAreaLTC1=En.LTC_FLOAT_1,c.rectAreaLTC2=En.LTC_FLOAT_2):u.has("OES_texture_half_float_linear")===!0?(c.rectAreaLTC1=En.LTC_HALF_1,c.rectAreaLTC2=En.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),c.ambient[0]=z,c.ambient[1]=G,c.ambient[2]=J;const Et=c.hash;(Et.directionalLength!==Y||Et.pointLength!==B||Et.spotLength!==ae||Et.rectAreaLength!==ce||Et.hemiLength!==Ae||Et.numDirectionalShadows!==we||Et.numPointShadows!==me||Et.numSpotShadows!==De||Et.numSpotMaps!==Je)&&(c.directional.length=Y,c.spot.length=ae,c.rectArea.length=ce,c.point.length=B,c.hemi.length=Ae,c.directionalShadow.length=we,c.directionalShadowMap.length=we,c.pointShadow.length=me,c.pointShadowMap.length=me,c.spotShadow.length=De,c.spotShadowMap.length=De,c.directionalShadowMatrix.length=we,c.pointShadowMatrix.length=me,c.spotLightMatrix.length=De+Je-Fe,c.spotLightMap.length=Je,c.numSpotLightShadowsWithMaps=Fe,Et.directionalLength=Y,Et.pointLength=B,Et.spotLength=ae,Et.rectAreaLength=ce,Et.hemiLength=Ae,Et.numDirectionalShadows=we,Et.numPointShadows=me,Et.numSpotShadows=De,Et.numSpotMaps=Je,c.version=uN++)}function D(R,Q){let z=0,G=0,J=0,Y=0,B=0;const ae=Q.matrixWorldInverse;for(let ce=0,Ae=R.length;ce<Ae;ce++){const we=R[ce];if(we.isDirectionalLight){const me=c.directional[z];me.direction.setFromMatrixPosition(we.matrixWorld),p.setFromMatrixPosition(we.target.matrixWorld),me.direction.sub(p),me.direction.transformDirection(ae),z++}else if(we.isSpotLight){const me=c.spot[J];me.position.setFromMatrixPosition(we.matrixWorld),me.position.applyMatrix4(ae),me.direction.setFromMatrixPosition(we.matrixWorld),p.setFromMatrixPosition(we.target.matrixWorld),me.direction.sub(p),me.direction.transformDirection(ae),J++}else if(we.isRectAreaLight){const me=c.rectArea[Y];me.position.setFromMatrixPosition(we.matrixWorld),me.position.applyMatrix4(ae),i.identity(),y.copy(we.matrixWorld),y.premultiply(ae),i.extractRotation(y),me.halfWidth.set(we.width*.5,0,0),me.halfHeight.set(0,we.height*.5,0),me.halfWidth.applyMatrix4(i),me.halfHeight.applyMatrix4(i),Y++}else if(we.isPointLight){const me=c.point[G];me.position.setFromMatrixPosition(we.matrixWorld),me.position.applyMatrix4(ae),G++}else if(we.isHemisphereLight){const me=c.hemi[B];me.direction.setFromMatrixPosition(we.matrixWorld),me.direction.transformDirection(ae),B++}}}return{setup:C,setupView:D,state:c}}function pT(u,e){const t=new dN(u,e),r=[],c=[];function p(){r.length=0,c.length=0}function y(Q){r.push(Q)}function i(Q){c.push(Q)}function C(Q){t.setup(r,Q)}function D(Q){t.setupView(r,Q)}return{init:p,state:{lightsArray:r,shadowsArray:c,lights:t},setupLights:C,setupLightsView:D,pushLight:y,pushShadow:i}}function pN(u,e){let t=new WeakMap;function r(p,y=0){const i=t.get(p);let C;return i===void 0?(C=new pT(u,e),t.set(p,[C])):y>=i.length?(C=new pT(u,e),i.push(C)):C=i[y],C}function c(){t=new WeakMap}return{get:r,dispose:c}}class W2 extends ol{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=MI,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class j2 extends ol{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new ft,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const fN=`void main() {
  3630. gl_Position = vec4( position, 1.0 );
  3631. }`,mN=`uniform sampler2D shadow_pass;
  3632. uniform vec2 resolution;
  3633. uniform float radius;
  3634. #include <packing>
  3635. void main() {
  3636. const float samples = float( VSM_SAMPLES );
  3637. float mean = 0.0;
  3638. float squared_mean = 0.0;
  3639. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  3640. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  3641. for ( float i = 0.0; i < samples; i ++ ) {
  3642. float uvOffset = uvStart + i * uvStride;
  3643. #ifdef HORIZONTAL_PASS
  3644. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  3645. mean += distribution.x;
  3646. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  3647. #else
  3648. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  3649. mean += depth;
  3650. squared_mean += depth * depth;
  3651. #endif
  3652. }
  3653. mean = mean / samples;
  3654. squared_mean = squared_mean / samples;
  3655. float std_dev = sqrt( squared_mean - mean * mean );
  3656. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  3657. }`;function gN(u,e,t){let r=new Vv;const c=new Di,p=new Di,y=new as,i=new W2({depthPacking:II}),C=new j2,D={},R=t.maxTextureSize,Q={[uu]:rc,[rc]:uu,[ga]:ga},z=new ko({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Di},radius:{value:4}},vertexShader:fN,fragmentShader:mN}),G=z.clone();G.defines.HORIZONTAL_PASS=1;const J=new br;J.setAttribute("position",new As(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const Y=new us(J,z),B=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=L2,this.render=function(we,me,De){if(B.enabled===!1||B.autoUpdate===!1&&B.needsUpdate===!1||we.length===0)return;const Je=u.getRenderTarget(),Fe=u.getActiveCubeFace(),Ge=u.getActiveMipmapLevel(),Et=u.state;Et.setBlending(KA),Et.buffers.color.setClear(1,1,1,1),Et.buffers.depth.setTest(!0),Et.setScissorTest(!1);for(let li=0,xi=we.length;li<xi;li++){const te=we[li],le=te.shadow;if(le===void 0){console.warn("THREE.WebGLShadowMap:",te,"has no shadow.");continue}if(le.autoUpdate===!1&&le.needsUpdate===!1)continue;c.copy(le.mapSize);const ye=le.getFrameExtents();if(c.multiply(ye),p.copy(le.mapSize),(c.x>R||c.y>R)&&(c.x>R&&(p.x=Math.floor(R/ye.x),c.x=p.x*ye.x,le.mapSize.x=p.x),c.y>R&&(p.y=Math.floor(R/ye.y),c.y=p.y*ye.y,le.mapSize.y=p.y)),le.map===null){const Re=this.type!==Dm?{minFilter:Co,magFilter:Co}:{};le.map=new rl(c.x,c.y,Re),le.map.texture.name=te.name+".shadowMap",le.camera.updateProjectionMatrix()}u.setRenderTarget(le.map),u.clear();const xe=le.getViewportCount();for(let Re=0;Re<xe;Re++){const Oe=le.getViewport(Re);y.set(p.x*Oe.x,p.y*Oe.y,p.x*Oe.z,p.y*Oe.w),Et.viewport(y),le.updateMatrices(te,Re),r=le.getFrustum(),Ae(me,De,le.camera,te,this.type)}le.isPointLightShadow!==!0&&this.type===Dm&&ae(le,De),le.needsUpdate=!1}B.needsUpdate=!1,u.setRenderTarget(Je,Fe,Ge)};function ae(we,me){const De=e.update(Y);z.defines.VSM_SAMPLES!==we.blurSamples&&(z.defines.VSM_SAMPLES=we.blurSamples,G.defines.VSM_SAMPLES=we.blurSamples,z.needsUpdate=!0,G.needsUpdate=!0),we.mapPass===null&&(we.mapPass=new rl(c.x,c.y)),z.uniforms.shadow_pass.value=we.map.texture,z.uniforms.resolution.value=we.mapSize,z.uniforms.radius.value=we.radius,u.setRenderTarget(we.mapPass),u.clear(),u.renderBufferDirect(me,null,De,z,Y,null),G.uniforms.shadow_pass.value=we.mapPass.texture,G.uniforms.resolution.value=we.mapSize,G.uniforms.radius.value=we.radius,u.setRenderTarget(we.map),u.clear(),u.renderBufferDirect(me,null,De,G,Y,null)}function ce(we,me,De,Je,Fe,Ge){let Et=null;const li=De.isPointLight===!0?we.customDistanceMaterial:we.customDepthMaterial;if(li!==void 0)Et=li;else if(Et=De.isPointLight===!0?C:i,u.localClippingEnabled&&me.clipShadows===!0&&Array.isArray(me.clippingPlanes)&&me.clippingPlanes.length!==0||me.displacementMap&&me.displacementScale!==0||me.alphaMap&&me.alphaTest>0||me.map&&me.alphaTest>0){const xi=Et.uuid,te=me.uuid;let le=D[xi];le===void 0&&(le={},D[xi]=le);let ye=le[te];ye===void 0&&(ye=Et.clone(),le[te]=ye),Et=ye}return Et.visible=me.visible,Et.wireframe=me.wireframe,Ge===Dm?Et.side=me.shadowSide!==null?me.shadowSide:me.side:Et.side=me.shadowSide!==null?me.shadowSide:Q[me.side],Et.alphaMap=me.alphaMap,Et.alphaTest=me.alphaTest,Et.map=me.map,Et.clipShadows=me.clipShadows,Et.clippingPlanes=me.clippingPlanes,Et.clipIntersection=me.clipIntersection,Et.displacementMap=me.displacementMap,Et.displacementScale=me.displacementScale,Et.displacementBias=me.displacementBias,Et.wireframeLinewidth=me.wireframeLinewidth,Et.linewidth=me.linewidth,De.isPointLight===!0&&Et.isMeshDistanceMaterial===!0&&(Et.referencePosition.setFromMatrixPosition(De.matrixWorld),Et.nearDistance=Je,Et.farDistance=Fe),Et}function Ae(we,me,De,Je,Fe){if(we.visible===!1)return;if(we.layers.test(me.layers)&&(we.isMesh||we.isLine||we.isPoints)&&(we.castShadow||we.receiveShadow&&Fe===Dm)&&(!we.frustumCulled||r.intersectsObject(we))){we.modelViewMatrix.multiplyMatrices(De.matrixWorldInverse,we.matrixWorld);const li=e.update(we),xi=we.material;if(Array.isArray(xi)){const te=li.groups;for(let le=0,ye=te.length;le<ye;le++){const xe=te[le],Re=xi[xe.materialIndex];if(Re&&Re.visible){const Oe=ce(we,Re,Je,De.near,De.far,Fe);u.renderBufferDirect(De,null,li,Oe,we,xe)}}}else if(xi.visible){const te=ce(we,xi,Je,De.near,De.far,Fe);u.renderBufferDirect(De,null,li,te,we,null)}}const Et=we.children;for(let li=0,xi=Et.length;li<xi;li++)Ae(Et[li],me,De,Je,Fe)}}function _N(u,e,t){const r=t.isWebGL2;function c(){let Ot=!1;const wi=new as;let Wi=null;const Ui=new as(0,0,0,0);return{setMask:function(Pn){Wi!==Pn&&!Ot&&(u.colorMask(Pn,Pn,Pn,Pn),Wi=Pn)},setLocked:function(Pn){Ot=Pn},setClear:function(Pn,qn,Hr,fr,kr){kr===!0&&(Pn*=fr,qn*=fr,Hr*=fr),wi.set(Pn,qn,Hr,fr),Ui.equals(wi)===!1&&(u.clearColor(Pn,qn,Hr,fr),Ui.copy(wi))},reset:function(){Ot=!1,Wi=null,Ui.set(-1,0,0,0)}}}function p(){let Ot=!1,wi=null,Wi=null,Ui=null;return{setTest:function(Pn){Pn?At(2929):ut(2929)},setMask:function(Pn){wi!==Pn&&!Ot&&(u.depthMask(Pn),wi=Pn)},setFunc:function(Pn){if(Wi!==Pn){switch(Pn){case YM:u.depthFunc(512);break;case JM:u.depthFunc(519);break;case eI:u.depthFunc(513);break;case uv:u.depthFunc(515);break;case tI:u.depthFunc(514);break;case iI:u.depthFunc(518);break;case nI:u.depthFunc(516);break;case rI:u.depthFunc(517);break;default:u.depthFunc(515)}Wi=Pn}},setLocked:function(Pn){Ot=Pn},setClear:function(Pn){Ui!==Pn&&(u.clearDepth(Pn),Ui=Pn)},reset:function(){Ot=!1,wi=null,Wi=null,Ui=null}}}function y(){let Ot=!1,wi=null,Wi=null,Ui=null,Pn=null,qn=null,Hr=null,fr=null,kr=null;return{setTest:function(Qn){Ot||(Qn?At(2960):ut(2960))},setMask:function(Qn){wi!==Qn&&!Ot&&(u.stencilMask(Qn),wi=Qn)},setFunc:function(Qn,Rs,ot){(Wi!==Qn||Ui!==Rs||Pn!==ot)&&(u.stencilFunc(Qn,Rs,ot),Wi=Qn,Ui=Rs,Pn=ot)},setOp:function(Qn,Rs,ot){(qn!==Qn||Hr!==Rs||fr!==ot)&&(u.stencilOp(Qn,Rs,ot),qn=Qn,Hr=Rs,fr=ot)},setLocked:function(Qn){Ot=Qn},setClear:function(Qn){kr!==Qn&&(u.clearStencil(Qn),kr=Qn)},reset:function(){Ot=!1,wi=null,Wi=null,Ui=null,Pn=null,qn=null,Hr=null,fr=null,kr=null}}}const i=new c,C=new p,D=new y,R=new WeakMap,Q=new WeakMap;let z={},G={},J=new WeakMap,Y=[],B=null,ae=!1,ce=null,Ae=null,we=null,me=null,De=null,Je=null,Fe=null,Ge=!1,Et=null,li=null,xi=null,te=null,le=null;const ye=u.getParameter(35661);let xe=!1,Re=0;const Oe=u.getParameter(7938);Oe.indexOf("WebGL")!==-1?(Re=parseFloat(/^WebGL (\d)/.exec(Oe)[1]),xe=Re>=1):Oe.indexOf("OpenGL ES")!==-1&&(Re=parseFloat(/^OpenGL ES (\d)/.exec(Oe)[1]),xe=Re>=2);let We=null,Ve={};const Qe=u.getParameter(3088),Se=u.getParameter(2978),Ke=new as().fromArray(Qe),nt=new as().fromArray(Se);function vt(Ot,wi,Wi){const Ui=new Uint8Array(4),Pn=u.createTexture();u.bindTexture(Ot,Pn),u.texParameteri(Ot,10241,9728),u.texParameteri(Ot,10240,9728);for(let qn=0;qn<Wi;qn++)u.texImage2D(wi+qn,0,6408,1,1,0,6408,5121,Ui);return Pn}const be={};be[3553]=vt(3553,3553,1),be[34067]=vt(34067,34069,6),i.setClear(0,0,0,1),C.setClear(1),D.setClear(0),At(2929),C.setFunc(uv),fi(!1),Gi(Fb),At(2884),Xt(KA);function At(Ot){z[Ot]!==!0&&(u.enable(Ot),z[Ot]=!0)}function ut(Ot){z[Ot]!==!1&&(u.disable(Ot),z[Ot]=!1)}function Nt(Ot,wi){return G[Ot]!==wi?(u.bindFramebuffer(Ot,wi),G[Ot]=wi,r&&(Ot===36009&&(G[36160]=wi),Ot===36160&&(G[36009]=wi)),!0):!1}function Gt(Ot,wi){let Wi=Y,Ui=!1;if(Ot)if(Wi=J.get(wi),Wi===void 0&&(Wi=[],J.set(wi,Wi)),Ot.isWebGLMultipleRenderTargets){const Pn=Ot.texture;if(Wi.length!==Pn.length||Wi[0]!==36064){for(let qn=0,Hr=Pn.length;qn<Hr;qn++)Wi[qn]=36064+qn;Wi.length=Pn.length,Ui=!0}}else Wi[0]!==36064&&(Wi[0]=36064,Ui=!0);else Wi[0]!==1029&&(Wi[0]=1029,Ui=!0);Ui&&(t.isWebGL2?u.drawBuffers(Wi):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Wi))}function Qt(Ot){return B!==Ot?(u.useProgram(Ot),B=Ot,!0):!1}const Ct={[qp]:32774,[QM]:32778,[VM]:32779};if(r)Ct[Pb]=32775,Ct[Ub]=32776;else{const Ot=e.get("EXT_blend_minmax");Ot!==null&&(Ct[Pb]=Ot.MIN_EXT,Ct[Ub]=Ot.MAX_EXT)}const Ft={[HM]:0,[GM]:1,[WM]:768,[D2]:770,[qM]:776,[ZM]:774,[KM]:772,[jM]:769,[P2]:771,[XM]:775,[$M]:773};function Xt(Ot,wi,Wi,Ui,Pn,qn,Hr,fr){if(Ot===KA){ae===!0&&(ut(3042),ae=!1);return}if(ae===!1&&(At(3042),ae=!0),Ot!==NM){if(Ot!==ce||fr!==Ge){if((Ae!==qp||De!==qp)&&(u.blendEquation(32774),Ae=qp,De=qp),fr)switch(Ot){case hf:u.blendFuncSeparate(1,771,1,771);break;case hv:u.blendFunc(1,1);break;case Lb:u.blendFuncSeparate(0,769,0,1);break;case Db:u.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",Ot);break}else switch(Ot){case hf:u.blendFuncSeparate(770,771,1,771);break;case hv:u.blendFunc(770,1);break;case Lb:u.blendFuncSeparate(0,769,0,1);break;case Db:u.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",Ot);break}we=null,me=null,Je=null,Fe=null,ce=Ot,Ge=fr}return}Pn=Pn||wi,qn=qn||Wi,Hr=Hr||Ui,(wi!==Ae||Pn!==De)&&(u.blendEquationSeparate(Ct[wi],Ct[Pn]),Ae=wi,De=Pn),(Wi!==we||Ui!==me||qn!==Je||Hr!==Fe)&&(u.blendFuncSeparate(Ft[Wi],Ft[Ui],Ft[qn],Ft[Hr]),we=Wi,me=Ui,Je=qn,Fe=Hr),ce=Ot,Ge=!1}function _i(Ot,wi){Ot.side===ga?ut(2884):At(2884);let Wi=Ot.side===rc;wi&&(Wi=!Wi),fi(Wi),Ot.blending===hf&&Ot.transparent===!1?Xt(KA):Xt(Ot.blending,Ot.blendEquation,Ot.blendSrc,Ot.blendDst,Ot.blendEquationAlpha,Ot.blendSrcAlpha,Ot.blendDstAlpha,Ot.premultipliedAlpha),C.setFunc(Ot.depthFunc),C.setTest(Ot.depthTest),C.setMask(Ot.depthWrite),i.setMask(Ot.colorWrite);const Ui=Ot.stencilWrite;D.setTest(Ui),Ui&&(D.setMask(Ot.stencilWriteMask),D.setFunc(Ot.stencilFunc,Ot.stencilRef,Ot.stencilFuncMask),D.setOp(Ot.stencilFail,Ot.stencilZFail,Ot.stencilZPass)),zi(Ot.polygonOffset,Ot.polygonOffsetFactor,Ot.polygonOffsetUnits),Ot.alphaToCoverage===!0?At(32926):ut(32926)}function fi(Ot){Et!==Ot&&(Ot?u.frontFace(2304):u.frontFace(2305),Et=Ot)}function Gi(Ot){Ot!==zM?(At(2884),Ot!==li&&(Ot===Fb?u.cullFace(1029):Ot===kM?u.cullFace(1028):u.cullFace(1032))):ut(2884),li=Ot}function wn(Ot){Ot!==xi&&(xe&&u.lineWidth(Ot),xi=Ot)}function zi(Ot,wi,Wi){Ot?(At(32823),(te!==wi||le!==Wi)&&(u.polygonOffset(wi,Wi),te=wi,le=Wi)):ut(32823)}function Gn(Ot){Ot?At(3089):ut(3089)}function kn(Ot){Ot===void 0&&(Ot=33984+ye-1),We!==Ot&&(u.activeTexture(Ot),We=Ot)}function yt(Ot,wi,Wi){Wi===void 0&&(We===null?Wi=33984+ye-1:Wi=We);let Ui=Ve[Wi];Ui===void 0&&(Ui={type:void 0,texture:void 0},Ve[Wi]=Ui),(Ui.type!==Ot||Ui.texture!==wi)&&(We!==Wi&&(u.activeTexture(Wi),We=Wi),u.bindTexture(Ot,wi||be[Ot]),Ui.type=Ot,Ui.texture=wi)}function rt(){const Ot=Ve[We];Ot!==void 0&&Ot.type!==void 0&&(u.bindTexture(Ot.type,null),Ot.type=void 0,Ot.texture=void 0)}function ti(){try{u.compressedTexImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function Ni(){try{u.compressedTexImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function qi(){try{u.texSubImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function en(){try{u.texSubImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function $t(){try{u.compressedTexSubImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function at(){try{u.compressedTexSubImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function ii(){try{u.texStorage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function hn(){try{u.texStorage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function Xi(){try{u.texImage2D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function on(){try{u.texImage3D.apply(u,arguments)}catch(Ot){console.error("THREE.WebGLState:",Ot)}}function Cn(Ot){Ke.equals(Ot)===!1&&(u.scissor(Ot.x,Ot.y,Ot.z,Ot.w),Ke.copy(Ot))}function Tn(Ot){nt.equals(Ot)===!1&&(u.viewport(Ot.x,Ot.y,Ot.z,Ot.w),nt.copy(Ot))}function nr(Ot,wi){let Wi=Q.get(wi);Wi===void 0&&(Wi=new WeakMap,Q.set(wi,Wi));let Ui=Wi.get(Ot);Ui===void 0&&(Ui=u.getUniformBlockIndex(wi,Ot.name),Wi.set(Ot,Ui))}function Ii(Ot,wi){const Ui=Q.get(wi).get(Ot);R.get(wi)!==Ui&&(u.uniformBlockBinding(wi,Ui,Ot.__bindingPointIndex),R.set(wi,Ui))}function bn(){u.disable(3042),u.disable(2884),u.disable(2929),u.disable(32823),u.disable(3089),u.disable(2960),u.disable(32926),u.blendEquation(32774),u.blendFunc(1,0),u.blendFuncSeparate(1,0,1,0),u.colorMask(!0,!0,!0,!0),u.clearColor(0,0,0,0),u.depthMask(!0),u.depthFunc(513),u.clearDepth(1),u.stencilMask(4294967295),u.stencilFunc(519,0,4294967295),u.stencilOp(7680,7680,7680),u.clearStencil(0),u.cullFace(1029),u.frontFace(2305),u.polygonOffset(0,0),u.activeTexture(33984),u.bindFramebuffer(36160,null),r===!0&&(u.bindFramebuffer(36009,null),u.bindFramebuffer(36008,null)),u.useProgram(null),u.lineWidth(1),u.scissor(0,0,u.canvas.width,u.canvas.height),u.viewport(0,0,u.canvas.width,u.canvas.height),z={},We=null,Ve={},G={},J=new WeakMap,Y=[],B=null,ae=!1,ce=null,Ae=null,we=null,me=null,De=null,Je=null,Fe=null,Ge=!1,Et=null,li=null,xi=null,te=null,le=null,Ke.set(0,0,u.canvas.width,u.canvas.height),nt.set(0,0,u.canvas.width,u.canvas.height),i.reset(),C.reset(),D.reset()}return{buffers:{color:i,depth:C,stencil:D},enable:At,disable:ut,bindFramebuffer:Nt,drawBuffers:Gt,useProgram:Qt,setBlending:Xt,setMaterial:_i,setFlipSided:fi,setCullFace:Gi,setLineWidth:wn,setPolygonOffset:zi,setScissorTest:Gn,activeTexture:kn,bindTexture:yt,unbindTexture:rt,compressedTexImage2D:ti,compressedTexImage3D:Ni,texImage2D:Xi,texImage3D:on,updateUBOMapping:nr,uniformBlockBinding:Ii,texStorage2D:ii,texStorage3D:hn,texSubImage2D:qi,texSubImage3D:en,compressedTexSubImage2D:$t,compressedTexSubImage3D:at,scissor:Cn,viewport:Tn,reset:bn}}function yN(u,e,t,r,c,p,y){const i=c.isWebGL2,C=c.maxTextures,D=c.maxCubemapSize,R=c.maxTextureSize,Q=c.maxSamples,z=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,G=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),J=new WeakMap;let Y;const B=new WeakMap;let ae=!1;try{ae=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function ce(yt,rt){return ae?new OffscreenCanvas(yt,rt):K_("canvas")}function Ae(yt,rt,ti,Ni){let qi=1;if((yt.width>Ni||yt.height>Ni)&&(qi=Ni/Math.max(yt.width,yt.height)),qi<1||rt===!0)if(typeof HTMLImageElement<"u"&&yt instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&yt instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&yt instanceof ImageBitmap){const en=rt?pv:Math.floor,$t=en(qi*yt.width),at=en(qi*yt.height);Y===void 0&&(Y=ce($t,at));const ii=ti?ce($t,at):Y;return ii.width=$t,ii.height=at,ii.getContext("2d").drawImage(yt,0,0,$t,at),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+yt.width+"x"+yt.height+") to ("+$t+"x"+at+")."),ii}else return"data"in yt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+yt.width+"x"+yt.height+")."),yt;return yt}function we(yt){return o2(yt.width)&&o2(yt.height)}function me(yt){return i?!1:yt.wrapS!==nl||yt.wrapT!==nl||yt.minFilter!==Co&&yt.minFilter!==Xs}function De(yt,rt){return yt.generateMipmaps&&rt&&yt.minFilter!==Co&&yt.minFilter!==Xs}function Je(yt){u.generateMipmap(yt)}function Fe(yt,rt,ti,Ni,qi=!1){if(i===!1)return rt;if(yt!==null){if(u[yt]!==void 0)return u[yt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+yt+"'")}let en=rt;return rt===6403&&(ti===5126&&(en=33326),ti===5131&&(en=33325),ti===5121&&(en=33321)),rt===33319&&(ti===5126&&(en=33328),ti===5131&&(en=33327),ti===5121&&(en=33323)),rt===6408&&(ti===5126&&(en=34836),ti===5131&&(en=34842),ti===5121&&(en=Ni===Ts&&qi===!1?35907:32856),ti===32819&&(en=32854),ti===32820&&(en=32855)),(en===33325||en===33326||en===33327||en===33328||en===34842||en===34836)&&e.get("EXT_color_buffer_float"),en}function Ge(yt,rt,ti){return De(yt,ti)===!0||yt.isFramebufferTexture&&yt.minFilter!==Co&&yt.minFilter!==Xs?Math.log2(Math.max(rt.width,rt.height))+1:yt.mipmaps!==void 0&&yt.mipmaps.length>0?yt.mipmaps.length:yt.isCompressedTexture&&Array.isArray(yt.image)?rt.mipmaps.length:1}function Et(yt){return yt===Co||yt===Av||yt===M_?9728:9729}function li(yt){const rt=yt.target;rt.removeEventListener("dispose",li),te(rt),rt.isVideoTexture&&J.delete(rt)}function xi(yt){const rt=yt.target;rt.removeEventListener("dispose",xi),ye(rt)}function te(yt){const rt=r.get(yt);if(rt.__webglInit===void 0)return;const ti=yt.source,Ni=B.get(ti);if(Ni){const qi=Ni[rt.__cacheKey];qi.usedTimes--,qi.usedTimes===0&&le(yt),Object.keys(Ni).length===0&&B.delete(ti)}r.remove(yt)}function le(yt){const rt=r.get(yt);u.deleteTexture(rt.__webglTexture);const ti=yt.source,Ni=B.get(ti);delete Ni[rt.__cacheKey],y.memory.textures--}function ye(yt){const rt=yt.texture,ti=r.get(yt),Ni=r.get(rt);if(Ni.__webglTexture!==void 0&&(u.deleteTexture(Ni.__webglTexture),y.memory.textures--),yt.depthTexture&&yt.depthTexture.dispose(),yt.isWebGLCubeRenderTarget)for(let qi=0;qi<6;qi++)u.deleteFramebuffer(ti.__webglFramebuffer[qi]),ti.__webglDepthbuffer&&u.deleteRenderbuffer(ti.__webglDepthbuffer[qi]);else{if(u.deleteFramebuffer(ti.__webglFramebuffer),ti.__webglDepthbuffer&&u.deleteRenderbuffer(ti.__webglDepthbuffer),ti.__webglMultisampledFramebuffer&&u.deleteFramebuffer(ti.__webglMultisampledFramebuffer),ti.__webglColorRenderbuffer)for(let qi=0;qi<ti.__webglColorRenderbuffer.length;qi++)ti.__webglColorRenderbuffer[qi]&&u.deleteRenderbuffer(ti.__webglColorRenderbuffer[qi]);ti.__webglDepthRenderbuffer&&u.deleteRenderbuffer(ti.__webglDepthRenderbuffer)}if(yt.isWebGLMultipleRenderTargets)for(let qi=0,en=rt.length;qi<en;qi++){const $t=r.get(rt[qi]);$t.__webglTexture&&(u.deleteTexture($t.__webglTexture),y.memory.textures--),r.remove(rt[qi])}r.remove(rt),r.remove(yt)}let xe=0;function Re(){xe=0}function Oe(){const yt=xe;return yt>=C&&console.warn("THREE.WebGLTextures: Trying to use "+yt+" texture units while this GPU supports only "+C),xe+=1,yt}function We(yt){const rt=[];return rt.push(yt.wrapS),rt.push(yt.wrapT),rt.push(yt.wrapR||0),rt.push(yt.magFilter),rt.push(yt.minFilter),rt.push(yt.anisotropy),rt.push(yt.internalFormat),rt.push(yt.format),rt.push(yt.type),rt.push(yt.generateMipmaps),rt.push(yt.premultiplyAlpha),rt.push(yt.flipY),rt.push(yt.unpackAlignment),rt.push(yt.encoding),rt.join()}function Ve(yt,rt){const ti=r.get(yt);if(yt.isVideoTexture&&Gn(yt),yt.isRenderTargetTexture===!1&&yt.version>0&&ti.__version!==yt.version){const Ni=yt.image;if(Ni===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ni.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ut(ti,yt,rt);return}}t.bindTexture(3553,ti.__webglTexture,33984+rt)}function Qe(yt,rt){const ti=r.get(yt);if(yt.version>0&&ti.__version!==yt.version){ut(ti,yt,rt);return}t.bindTexture(35866,ti.__webglTexture,33984+rt)}function Se(yt,rt){const ti=r.get(yt);if(yt.version>0&&ti.__version!==yt.version){ut(ti,yt,rt);return}t.bindTexture(32879,ti.__webglTexture,33984+rt)}function Ke(yt,rt){const ti=r.get(yt);if(yt.version>0&&ti.__version!==yt.version){Nt(ti,yt,rt);return}t.bindTexture(34067,ti.__webglTexture,33984+rt)}const nt={[HA]:10497,[nl]:33071,[Q_]:33648},vt={[Co]:9728,[Av]:9984,[M_]:9986,[Xs]:9729,[R2]:9985,[op]:9987};function be(yt,rt,ti){if(ti?(u.texParameteri(yt,10242,nt[rt.wrapS]),u.texParameteri(yt,10243,nt[rt.wrapT]),(yt===32879||yt===35866)&&u.texParameteri(yt,32882,nt[rt.wrapR]),u.texParameteri(yt,10240,vt[rt.magFilter]),u.texParameteri(yt,10241,vt[rt.minFilter])):(u.texParameteri(yt,10242,33071),u.texParameteri(yt,10243,33071),(yt===32879||yt===35866)&&u.texParameteri(yt,32882,33071),(rt.wrapS!==nl||rt.wrapT!==nl)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),u.texParameteri(yt,10240,Et(rt.magFilter)),u.texParameteri(yt,10241,Et(rt.minFilter)),rt.minFilter!==Co&&rt.minFilter!==Xs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Ni=e.get("EXT_texture_filter_anisotropic");if(rt.magFilter===Co||rt.minFilter!==M_&&rt.minFilter!==op||rt.type===GA&&e.has("OES_texture_float_linear")===!1||i===!1&&rt.type===Gm&&e.has("OES_texture_half_float_linear")===!1)return;(rt.anisotropy>1||r.get(rt).__currentAnisotropy)&&(u.texParameterf(yt,Ni.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(rt.anisotropy,c.getMaxAnisotropy())),r.get(rt).__currentAnisotropy=rt.anisotropy)}}function At(yt,rt){let ti=!1;yt.__webglInit===void 0&&(yt.__webglInit=!0,rt.addEventListener("dispose",li));const Ni=rt.source;let qi=B.get(Ni);qi===void 0&&(qi={},B.set(Ni,qi));const en=We(rt);if(en!==yt.__cacheKey){qi[en]===void 0&&(qi[en]={texture:u.createTexture(),usedTimes:0},y.memory.textures++,ti=!0),qi[en].usedTimes++;const $t=qi[yt.__cacheKey];$t!==void 0&&(qi[yt.__cacheKey].usedTimes--,$t.usedTimes===0&&le(rt)),yt.__cacheKey=en,yt.__webglTexture=qi[en].texture}return ti}function ut(yt,rt,ti){let Ni=3553;(rt.isDataArrayTexture||rt.isCompressedArrayTexture)&&(Ni=35866),rt.isData3DTexture&&(Ni=32879);const qi=At(yt,rt),en=rt.source;t.bindTexture(Ni,yt.__webglTexture,33984+ti);const $t=r.get(en);if(en.version!==$t.__version||qi===!0){t.activeTexture(33984+ti),u.pixelStorei(37440,rt.flipY),u.pixelStorei(37441,rt.premultiplyAlpha),u.pixelStorei(3317,rt.unpackAlignment),u.pixelStorei(37443,0);const at=me(rt)&&we(rt.image)===!1;let ii=Ae(rt.image,at,!1,R);ii=kn(rt,ii);const hn=we(ii)||i,Xi=p.convert(rt.format,rt.encoding);let on=p.convert(rt.type),Cn=Fe(rt.internalFormat,Xi,on,rt.encoding,rt.isVideoTexture);be(Ni,rt,hn);let Tn;const nr=rt.mipmaps,Ii=i&&rt.isVideoTexture!==!0,bn=$t.__version===void 0||qi===!0,Ot=Ge(rt,ii,hn);if(rt.isDepthTexture)Cn=6402,i?rt.type===GA?Cn=36012:rt.type===Xd?Cn=33190:rt.type===uf?Cn=35056:Cn=33189:rt.type===GA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),rt.format===ep&&Cn===6402&&rt.type!==z2&&rt.type!==Xd&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),rt.type=Xd,on=p.convert(rt.type)),rt.format===ff&&Cn===6402&&(Cn=34041,rt.type!==uf&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),rt.type=uf,on=p.convert(rt.type))),bn&&(Ii?t.texStorage2D(3553,1,Cn,ii.width,ii.height):t.texImage2D(3553,0,Cn,ii.width,ii.height,0,Xi,on,null));else if(rt.isDataTexture)if(nr.length>0&&hn){Ii&&bn&&t.texStorage2D(3553,Ot,Cn,nr[0].width,nr[0].height);for(let wi=0,Wi=nr.length;wi<Wi;wi++)Tn=nr[wi],Ii?t.texSubImage2D(3553,wi,0,0,Tn.width,Tn.height,Xi,on,Tn.data):t.texImage2D(3553,wi,Cn,Tn.width,Tn.height,0,Xi,on,Tn.data);rt.generateMipmaps=!1}else Ii?(bn&&t.texStorage2D(3553,Ot,Cn,ii.width,ii.height),t.texSubImage2D(3553,0,0,0,ii.width,ii.height,Xi,on,ii.data)):t.texImage2D(3553,0,Cn,ii.width,ii.height,0,Xi,on,ii.data);else if(rt.isCompressedTexture)if(rt.isCompressedArrayTexture){Ii&&bn&&t.texStorage3D(35866,Ot,Cn,nr[0].width,nr[0].height,ii.depth);for(let wi=0,Wi=nr.length;wi<Wi;wi++)Tn=nr[wi],rt.format!==Dl?Xi!==null?Ii?t.compressedTexSubImage3D(35866,wi,0,0,0,Tn.width,Tn.height,ii.depth,Xi,Tn.data,0,0):t.compressedTexImage3D(35866,wi,Cn,Tn.width,Tn.height,ii.depth,0,Tn.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ii?t.texSubImage3D(35866,wi,0,0,0,Tn.width,Tn.height,ii.depth,Xi,on,Tn.data):t.texImage3D(35866,wi,Cn,Tn.width,Tn.height,ii.depth,0,Xi,on,Tn.data)}else{Ii&&bn&&t.texStorage2D(3553,Ot,Cn,nr[0].width,nr[0].height);for(let wi=0,Wi=nr.length;wi<Wi;wi++)Tn=nr[wi],rt.format!==Dl?Xi!==null?Ii?t.compressedTexSubImage2D(3553,wi,0,0,Tn.width,Tn.height,Xi,Tn.data):t.compressedTexImage2D(3553,wi,Cn,Tn.width,Tn.height,0,Tn.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ii?t.texSubImage2D(3553,wi,0,0,Tn.width,Tn.height,Xi,on,Tn.data):t.texImage2D(3553,wi,Cn,Tn.width,Tn.height,0,Xi,on,Tn.data)}else if(rt.isDataArrayTexture)Ii?(bn&&t.texStorage3D(35866,Ot,Cn,ii.width,ii.height,ii.depth),t.texSubImage3D(35866,0,0,0,0,ii.width,ii.height,ii.depth,Xi,on,ii.data)):t.texImage3D(35866,0,Cn,ii.width,ii.height,ii.depth,0,Xi,on,ii.data);else if(rt.isData3DTexture)Ii?(bn&&t.texStorage3D(32879,Ot,Cn,ii.width,ii.height,ii.depth),t.texSubImage3D(32879,0,0,0,0,ii.width,ii.height,ii.depth,Xi,on,ii.data)):t.texImage3D(32879,0,Cn,ii.width,ii.height,ii.depth,0,Xi,on,ii.data);else if(rt.isFramebufferTexture){if(bn)if(Ii)t.texStorage2D(3553,Ot,Cn,ii.width,ii.height);else{let wi=ii.width,Wi=ii.height;for(let Ui=0;Ui<Ot;Ui++)t.texImage2D(3553,Ui,Cn,wi,Wi,0,Xi,on,null),wi>>=1,Wi>>=1}}else if(nr.length>0&&hn){Ii&&bn&&t.texStorage2D(3553,Ot,Cn,nr[0].width,nr[0].height);for(let wi=0,Wi=nr.length;wi<Wi;wi++)Tn=nr[wi],Ii?t.texSubImage2D(3553,wi,0,0,Xi,on,Tn):t.texImage2D(3553,wi,Cn,Xi,on,Tn);rt.generateMipmaps=!1}else Ii?(bn&&t.texStorage2D(3553,Ot,Cn,ii.width,ii.height),t.texSubImage2D(3553,0,0,0,Xi,on,ii)):t.texImage2D(3553,0,Cn,Xi,on,ii);De(rt,hn)&&Je(Ni),$t.__version=en.version,rt.onUpdate&&rt.onUpdate(rt)}yt.__version=rt.version}function Nt(yt,rt,ti){if(rt.image.length!==6)return;const Ni=At(yt,rt),qi=rt.source;t.bindTexture(34067,yt.__webglTexture,33984+ti);const en=r.get(qi);if(qi.version!==en.__version||Ni===!0){t.activeTexture(33984+ti),u.pixelStorei(37440,rt.flipY),u.pixelStorei(37441,rt.premultiplyAlpha),u.pixelStorei(3317,rt.unpackAlignment),u.pixelStorei(37443,0);const $t=rt.isCompressedTexture||rt.image[0].isCompressedTexture,at=rt.image[0]&&rt.image[0].isDataTexture,ii=[];for(let wi=0;wi<6;wi++)!$t&&!at?ii[wi]=Ae(rt.image[wi],!1,!0,D):ii[wi]=at?rt.image[wi].image:rt.image[wi],ii[wi]=kn(rt,ii[wi]);const hn=ii[0],Xi=we(hn)||i,on=p.convert(rt.format,rt.encoding),Cn=p.convert(rt.type),Tn=Fe(rt.internalFormat,on,Cn,rt.encoding),nr=i&&rt.isVideoTexture!==!0,Ii=en.__version===void 0||Ni===!0;let bn=Ge(rt,hn,Xi);be(34067,rt,Xi);let Ot;if($t){nr&&Ii&&t.texStorage2D(34067,bn,Tn,hn.width,hn.height);for(let wi=0;wi<6;wi++){Ot=ii[wi].mipmaps;for(let Wi=0;Wi<Ot.length;Wi++){const Ui=Ot[Wi];rt.format!==Dl?on!==null?nr?t.compressedTexSubImage2D(34069+wi,Wi,0,0,Ui.width,Ui.height,on,Ui.data):t.compressedTexImage2D(34069+wi,Wi,Tn,Ui.width,Ui.height,0,Ui.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):nr?t.texSubImage2D(34069+wi,Wi,0,0,Ui.width,Ui.height,on,Cn,Ui.data):t.texImage2D(34069+wi,Wi,Tn,Ui.width,Ui.height,0,on,Cn,Ui.data)}}}else{Ot=rt.mipmaps,nr&&Ii&&(Ot.length>0&&bn++,t.texStorage2D(34067,bn,Tn,ii[0].width,ii[0].height));for(let wi=0;wi<6;wi++)if(at){nr?t.texSubImage2D(34069+wi,0,0,0,ii[wi].width,ii[wi].height,on,Cn,ii[wi].data):t.texImage2D(34069+wi,0,Tn,ii[wi].width,ii[wi].height,0,on,Cn,ii[wi].data);for(let Wi=0;Wi<Ot.length;Wi++){const Pn=Ot[Wi].image[wi].image;nr?t.texSubImage2D(34069+wi,Wi+1,0,0,Pn.width,Pn.height,on,Cn,Pn.data):t.texImage2D(34069+wi,Wi+1,Tn,Pn.width,Pn.height,0,on,Cn,Pn.data)}}else{nr?t.texSubImage2D(34069+wi,0,0,0,on,Cn,ii[wi]):t.texImage2D(34069+wi,0,Tn,on,Cn,ii[wi]);for(let Wi=0;Wi<Ot.length;Wi++){const Ui=Ot[Wi];nr?t.texSubImage2D(34069+wi,Wi+1,0,0,on,Cn,Ui.image[wi]):t.texImage2D(34069+wi,Wi+1,Tn,on,Cn,Ui.image[wi])}}}De(rt,Xi)&&Je(34067),en.__version=qi.version,rt.onUpdate&&rt.onUpdate(rt)}yt.__version=rt.version}function Gt(yt,rt,ti,Ni,qi){const en=p.convert(ti.format,ti.encoding),$t=p.convert(ti.type),at=Fe(ti.internalFormat,en,$t,ti.encoding);r.get(rt).__hasExternalTextures||(qi===32879||qi===35866?t.texImage3D(qi,0,at,rt.width,rt.height,rt.depth,0,en,$t,null):t.texImage2D(qi,0,at,rt.width,rt.height,0,en,$t,null)),t.bindFramebuffer(36160,yt),zi(rt)?z.framebufferTexture2DMultisampleEXT(36160,Ni,qi,r.get(ti).__webglTexture,0,wn(rt)):(qi===3553||qi>=34069&&qi<=34074)&&u.framebufferTexture2D(36160,Ni,qi,r.get(ti).__webglTexture,0),t.bindFramebuffer(36160,null)}function Qt(yt,rt,ti){if(u.bindRenderbuffer(36161,yt),rt.depthBuffer&&!rt.stencilBuffer){let Ni=33189;if(ti||zi(rt)){const qi=rt.depthTexture;qi&&qi.isDepthTexture&&(qi.type===GA?Ni=36012:qi.type===Xd&&(Ni=33190));const en=wn(rt);zi(rt)?z.renderbufferStorageMultisampleEXT(36161,en,Ni,rt.width,rt.height):u.renderbufferStorageMultisample(36161,en,Ni,rt.width,rt.height)}else u.renderbufferStorage(36161,Ni,rt.width,rt.height);u.framebufferRenderbuffer(36160,36096,36161,yt)}else if(rt.depthBuffer&&rt.stencilBuffer){const Ni=wn(rt);ti&&zi(rt)===!1?u.renderbufferStorageMultisample(36161,Ni,35056,rt.width,rt.height):zi(rt)?z.renderbufferStorageMultisampleEXT(36161,Ni,35056,rt.width,rt.height):u.renderbufferStorage(36161,34041,rt.width,rt.height),u.framebufferRenderbuffer(36160,33306,36161,yt)}else{const Ni=rt.isWebGLMultipleRenderTargets===!0?rt.texture:[rt.texture];for(let qi=0;qi<Ni.length;qi++){const en=Ni[qi],$t=p.convert(en.format,en.encoding),at=p.convert(en.type),ii=Fe(en.internalFormat,$t,at,en.encoding),hn=wn(rt);ti&&zi(rt)===!1?u.renderbufferStorageMultisample(36161,hn,ii,rt.width,rt.height):zi(rt)?z.renderbufferStorageMultisampleEXT(36161,hn,ii,rt.width,rt.height):u.renderbufferStorage(36161,ii,rt.width,rt.height)}}u.bindRenderbuffer(36161,null)}function Ct(yt,rt){if(rt&&rt.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,yt),!(rt.depthTexture&&rt.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(rt.depthTexture).__webglTexture||rt.depthTexture.image.width!==rt.width||rt.depthTexture.image.height!==rt.height)&&(rt.depthTexture.image.width=rt.width,rt.depthTexture.image.height=rt.height,rt.depthTexture.needsUpdate=!0),Ve(rt.depthTexture,0);const Ni=r.get(rt.depthTexture).__webglTexture,qi=wn(rt);if(rt.depthTexture.format===ep)zi(rt)?z.framebufferTexture2DMultisampleEXT(36160,36096,3553,Ni,0,qi):u.framebufferTexture2D(36160,36096,3553,Ni,0);else if(rt.depthTexture.format===ff)zi(rt)?z.framebufferTexture2DMultisampleEXT(36160,33306,3553,Ni,0,qi):u.framebufferTexture2D(36160,33306,3553,Ni,0);else throw new Error("Unknown depthTexture format")}function Ft(yt){const rt=r.get(yt),ti=yt.isWebGLCubeRenderTarget===!0;if(yt.depthTexture&&!rt.__autoAllocateDepthBuffer){if(ti)throw new Error("target.depthTexture not supported in Cube render targets");Ct(rt.__webglFramebuffer,yt)}else if(ti){rt.__webglDepthbuffer=[];for(let Ni=0;Ni<6;Ni++)t.bindFramebuffer(36160,rt.__webglFramebuffer[Ni]),rt.__webglDepthbuffer[Ni]=u.createRenderbuffer(),Qt(rt.__webglDepthbuffer[Ni],yt,!1)}else t.bindFramebuffer(36160,rt.__webglFramebuffer),rt.__webglDepthbuffer=u.createRenderbuffer(),Qt(rt.__webglDepthbuffer,yt,!1);t.bindFramebuffer(36160,null)}function Xt(yt,rt,ti){const Ni=r.get(yt);rt!==void 0&&Gt(Ni.__webglFramebuffer,yt,yt.texture,36064,3553),ti!==void 0&&Ft(yt)}function _i(yt){const rt=yt.texture,ti=r.get(yt),Ni=r.get(rt);yt.addEventListener("dispose",xi),yt.isWebGLMultipleRenderTargets!==!0&&(Ni.__webglTexture===void 0&&(Ni.__webglTexture=u.createTexture()),Ni.__version=rt.version,y.memory.textures++);const qi=yt.isWebGLCubeRenderTarget===!0,en=yt.isWebGLMultipleRenderTargets===!0,$t=we(yt)||i;if(qi){ti.__webglFramebuffer=[];for(let at=0;at<6;at++)ti.__webglFramebuffer[at]=u.createFramebuffer()}else{if(ti.__webglFramebuffer=u.createFramebuffer(),en)if(c.drawBuffers){const at=yt.texture;for(let ii=0,hn=at.length;ii<hn;ii++){const Xi=r.get(at[ii]);Xi.__webglTexture===void 0&&(Xi.__webglTexture=u.createTexture(),y.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(i&&yt.samples>0&&zi(yt)===!1){const at=en?rt:[rt];ti.__webglMultisampledFramebuffer=u.createFramebuffer(),ti.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ti.__webglMultisampledFramebuffer);for(let ii=0;ii<at.length;ii++){const hn=at[ii];ti.__webglColorRenderbuffer[ii]=u.createRenderbuffer(),u.bindRenderbuffer(36161,ti.__webglColorRenderbuffer[ii]);const Xi=p.convert(hn.format,hn.encoding),on=p.convert(hn.type),Cn=Fe(hn.internalFormat,Xi,on,hn.encoding,yt.isXRRenderTarget===!0),Tn=wn(yt);u.renderbufferStorageMultisample(36161,Tn,Cn,yt.width,yt.height),u.framebufferRenderbuffer(36160,36064+ii,36161,ti.__webglColorRenderbuffer[ii])}u.bindRenderbuffer(36161,null),yt.depthBuffer&&(ti.__webglDepthRenderbuffer=u.createRenderbuffer(),Qt(ti.__webglDepthRenderbuffer,yt,!0)),t.bindFramebuffer(36160,null)}}if(qi){t.bindTexture(34067,Ni.__webglTexture),be(34067,rt,$t);for(let at=0;at<6;at++)Gt(ti.__webglFramebuffer[at],yt,rt,36064,34069+at);De(rt,$t)&&Je(34067),t.unbindTexture()}else if(en){const at=yt.texture;for(let ii=0,hn=at.length;ii<hn;ii++){const Xi=at[ii],on=r.get(Xi);t.bindTexture(3553,on.__webglTexture),be(3553,Xi,$t),Gt(ti.__webglFramebuffer,yt,Xi,36064+ii,3553),De(Xi,$t)&&Je(3553)}t.unbindTexture()}else{let at=3553;(yt.isWebGL3DRenderTarget||yt.isWebGLArrayRenderTarget)&&(i?at=yt.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(at,Ni.__webglTexture),be(at,rt,$t),Gt(ti.__webglFramebuffer,yt,rt,36064,at),De(rt,$t)&&Je(at),t.unbindTexture()}yt.depthBuffer&&Ft(yt)}function fi(yt){const rt=we(yt)||i,ti=yt.isWebGLMultipleRenderTargets===!0?yt.texture:[yt.texture];for(let Ni=0,qi=ti.length;Ni<qi;Ni++){const en=ti[Ni];if(De(en,rt)){const $t=yt.isWebGLCubeRenderTarget?34067:3553,at=r.get(en).__webglTexture;t.bindTexture($t,at),Je($t),t.unbindTexture()}}}function Gi(yt){if(i&&yt.samples>0&&zi(yt)===!1){const rt=yt.isWebGLMultipleRenderTargets?yt.texture:[yt.texture],ti=yt.width,Ni=yt.height;let qi=16384;const en=[],$t=yt.stencilBuffer?33306:36096,at=r.get(yt),ii=yt.isWebGLMultipleRenderTargets===!0;if(ii)for(let hn=0;hn<rt.length;hn++)t.bindFramebuffer(36160,at.__webglMultisampledFramebuffer),u.framebufferRenderbuffer(36160,36064+hn,36161,null),t.bindFramebuffer(36160,at.__webglFramebuffer),u.framebufferTexture2D(36009,36064+hn,3553,null,0);t.bindFramebuffer(36008,at.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,at.__webglFramebuffer);for(let hn=0;hn<rt.length;hn++){en.push(36064+hn),yt.depthBuffer&&en.push($t);const Xi=at.__ignoreDepthValues!==void 0?at.__ignoreDepthValues:!1;if(Xi===!1&&(yt.depthBuffer&&(qi|=256),yt.stencilBuffer&&(qi|=1024)),ii&&u.framebufferRenderbuffer(36008,36064,36161,at.__webglColorRenderbuffer[hn]),Xi===!0&&(u.invalidateFramebuffer(36008,[$t]),u.invalidateFramebuffer(36009,[$t])),ii){const on=r.get(rt[hn]).__webglTexture;u.framebufferTexture2D(36009,36064,3553,on,0)}u.blitFramebuffer(0,0,ti,Ni,0,0,ti,Ni,qi,9728),G&&u.invalidateFramebuffer(36008,en)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),ii)for(let hn=0;hn<rt.length;hn++){t.bindFramebuffer(36160,at.__webglMultisampledFramebuffer),u.framebufferRenderbuffer(36160,36064+hn,36161,at.__webglColorRenderbuffer[hn]);const Xi=r.get(rt[hn]).__webglTexture;t.bindFramebuffer(36160,at.__webglFramebuffer),u.framebufferTexture2D(36009,36064+hn,3553,Xi,0)}t.bindFramebuffer(36009,at.__webglMultisampledFramebuffer)}}function wn(yt){return Math.min(Q,yt.samples)}function zi(yt){const rt=r.get(yt);return i&&yt.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&rt.__useRenderToTexture!==!1}function Gn(yt){const rt=y.render.frame;J.get(yt)!==rt&&(J.set(yt,rt),yt.update())}function kn(yt,rt){const ti=yt.encoding,Ni=yt.format,qi=yt.type;return yt.isCompressedTexture===!0||yt.isVideoTexture===!0||yt.format===dv||ti!==lp&&(ti===Ts?i===!1?e.has("EXT_sRGB")===!0&&Ni===Dl?(yt.format=dv,yt.minFilter=Xs,yt.generateMipmaps=!1):rt=N2.sRGBToLinear(rt):(Ni!==Dl||qi!==ap)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ti)),rt}this.allocateTextureUnit=Oe,this.resetTextureUnits=Re,this.setTexture2D=Ve,this.setTexture2DArray=Qe,this.setTexture3D=Se,this.setTextureCube=Ke,this.rebindTextures=Xt,this.setupRenderTarget=_i,this.updateRenderTargetMipmap=fi,this.updateMultisampleRenderTarget=Gi,this.setupDepthRenderbuffer=Ft,this.setupFrameBufferTexture=Gt,this.useMultisampledRTT=zi}function WI(u,e,t){const r=t.isWebGL2;function c(p,y=null){let i;if(p===ap)return 5121;if(p===pI)return 32819;if(p===fI)return 32820;if(p===uI)return 5120;if(p===AI)return 5122;if(p===z2)return 5123;if(p===dI)return 5124;if(p===Xd)return 5125;if(p===GA)return 5126;if(p===Gm)return r?5131:(i=e.get("OES_texture_half_float"),i!==null?i.HALF_FLOAT_OES:null);if(p===mI)return 6406;if(p===Dl)return 6408;if(p===gI)return 6409;if(p===_I)return 6410;if(p===ep)return 6402;if(p===ff)return 34041;if(p===dv)return i=e.get("EXT_sRGB"),i!==null?i.SRGB_ALPHA_EXT:null;if(p===yI)return 6403;if(p===xI)return 36244;if(p===vI)return 33319;if(p===wI)return 33320;if(p===bI)return 36249;if(p===Gx||p===Wx||p===jx||p===Kx)if(y===Ts)if(i=e.get("WEBGL_compressed_texture_s3tc_srgb"),i!==null){if(p===Gx)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(p===Wx)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(p===jx)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(p===Kx)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=e.get("WEBGL_compressed_texture_s3tc"),i!==null){if(p===Gx)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(p===Wx)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(p===jx)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p===Kx)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(p===Rb||p===zb||p===kb||p===Ob)if(i=e.get("WEBGL_compressed_texture_pvrtc"),i!==null){if(p===Rb)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(p===zb)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(p===kb)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(p===Ob)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(p===BI)return i=e.get("WEBGL_compressed_texture_etc1"),i!==null?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(p===Nb||p===Qb)if(i=e.get("WEBGL_compressed_texture_etc"),i!==null){if(p===Nb)return y===Ts?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(p===Qb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(p===Vb||p===Hb||p===Gb||p===Wb||p===jb||p===Kb||p===$b||p===Zb||p===Xb||p===qb||p===Yb||p===Jb||p===e2||p===t2)if(i=e.get("WEBGL_compressed_texture_astc"),i!==null){if(p===Vb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(p===Hb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(p===Gb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(p===Wb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(p===jb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(p===Kb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(p===$b)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(p===Zb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(p===Xb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(p===qb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(p===Yb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(p===Jb)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(p===e2)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(p===t2)return y===Ts?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(p===$x)if(i=e.get("EXT_texture_compression_bptc"),i!==null){if(p===$x)return y===Ts?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(p===CI||p===i2||p===n2||p===r2)if(i=e.get("EXT_texture_compression_rgtc"),i!==null){if(p===$x)return i.COMPRESSED_RED_RGTC1_EXT;if(p===i2)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(p===n2)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(p===r2)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return p===uf?r?34042:(i=e.get("WEBGL_depth_texture"),i!==null?i.UNSIGNED_INT_24_8_WEBGL:null):u[p]!==void 0?u[p]:null}return{convert:c}}class jI extends _a{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Hs extends ls{constructor(){super(),this.isGroup=!0,this.type="Group"}}const xN={type:"move"};class Vw{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Hs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Hs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ft,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ft),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Hs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ft,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ft),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let c=null,p=null,y=null;const i=this._targetRay,C=this._grip,D=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(D&&e.hand){y=!0;for(const Y of e.hand.values()){const B=t.getJointPose(Y,r),ae=this._getHandJoint(D,Y);B!==null&&(ae.matrix.fromArray(B.transform.matrix),ae.matrix.decompose(ae.position,ae.rotation,ae.scale),ae.jointRadius=B.radius),ae.visible=B!==null}const R=D.joints["index-finger-tip"],Q=D.joints["thumb-tip"],z=R.position.distanceTo(Q.position),G=.02,J=.005;D.inputState.pinching&&z>G+J?(D.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!D.inputState.pinching&&z<=G-J&&(D.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else C!==null&&e.gripSpace&&(p=t.getPose(e.gripSpace,r),p!==null&&(C.matrix.fromArray(p.transform.matrix),C.matrix.decompose(C.position,C.rotation,C.scale),p.linearVelocity?(C.hasLinearVelocity=!0,C.linearVelocity.copy(p.linearVelocity)):C.hasLinearVelocity=!1,p.angularVelocity?(C.hasAngularVelocity=!0,C.angularVelocity.copy(p.angularVelocity)):C.hasAngularVelocity=!1));i!==null&&(c=t.getPose(e.targetRaySpace,r),c===null&&p!==null&&(c=p),c!==null&&(i.matrix.fromArray(c.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),c.linearVelocity?(i.hasLinearVelocity=!0,i.linearVelocity.copy(c.linearVelocity)):i.hasLinearVelocity=!1,c.angularVelocity?(i.hasAngularVelocity=!0,i.angularVelocity.copy(c.angularVelocity)):i.hasAngularVelocity=!1,this.dispatchEvent(xN)))}return i!==null&&(i.visible=c!==null),C!==null&&(C.visible=p!==null),D!==null&&(D.visible=y!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Hs;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class KI extends To{constructor(e,t,r,c,p,y,i,C,D,R){if(R=R!==void 0?R:ep,R!==ep&&R!==ff)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&R===ep&&(r=Xd),r===void 0&&R===ff&&(r=uf),super(null,c,p,y,i,C,R,r,D),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=i!==void 0?i:Co,this.minFilter=C!==void 0?C:Co,this.flipY=!1,this.generateMipmaps=!1}}class vN extends Xu{constructor(e,t){super();const r=this;let c=null,p=1,y=null,i="local-floor",C=1,D=null,R=null,Q=null,z=null,G=null,J=null;const Y=t.getContextAttributes();let B=null,ae=null;const ce=[],Ae=[],we=new Set,me=new Map,De=new _a;De.layers.enable(1),De.viewport=new as;const Je=new _a;Je.layers.enable(2),Je.viewport=new as;const Fe=[De,Je],Ge=new jI;Ge.layers.enable(1),Ge.layers.enable(2);let Et=null,li=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Se){let Ke=ce[Se];return Ke===void 0&&(Ke=new Vw,ce[Se]=Ke),Ke.getTargetRaySpace()},this.getControllerGrip=function(Se){let Ke=ce[Se];return Ke===void 0&&(Ke=new Vw,ce[Se]=Ke),Ke.getGripSpace()},this.getHand=function(Se){let Ke=ce[Se];return Ke===void 0&&(Ke=new Vw,ce[Se]=Ke),Ke.getHandSpace()};function xi(Se){const Ke=Ae.indexOf(Se.inputSource);if(Ke===-1)return;const nt=ce[Ke];nt!==void 0&&nt.dispatchEvent({type:Se.type,data:Se.inputSource})}function te(){c.removeEventListener("select",xi),c.removeEventListener("selectstart",xi),c.removeEventListener("selectend",xi),c.removeEventListener("squeeze",xi),c.removeEventListener("squeezestart",xi),c.removeEventListener("squeezeend",xi),c.removeEventListener("end",te),c.removeEventListener("inputsourceschange",le);for(let Se=0;Se<ce.length;Se++){const Ke=Ae[Se];Ke!==null&&(Ae[Se]=null,ce[Se].disconnect(Ke))}Et=null,li=null,e.setRenderTarget(B),G=null,z=null,Q=null,c=null,ae=null,Qe.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Se){p=Se,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Se){i=Se,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return D||y},this.setReferenceSpace=function(Se){D=Se},this.getBaseLayer=function(){return z!==null?z:G},this.getBinding=function(){return Q},this.getFrame=function(){return J},this.getSession=function(){return c},this.setSession=async function(Se){if(c=Se,c!==null){if(B=e.getRenderTarget(),c.addEventListener("select",xi),c.addEventListener("selectstart",xi),c.addEventListener("selectend",xi),c.addEventListener("squeeze",xi),c.addEventListener("squeezestart",xi),c.addEventListener("squeezeend",xi),c.addEventListener("end",te),c.addEventListener("inputsourceschange",le),Y.xrCompatible!==!0&&await t.makeXRCompatible(),c.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const Ke={antialias:c.renderState.layers===void 0?Y.antialias:!0,alpha:Y.alpha,depth:Y.depth,stencil:Y.stencil,framebufferScaleFactor:p};G=new XRWebGLLayer(c,t,Ke),c.updateRenderState({baseLayer:G}),ae=new rl(G.framebufferWidth,G.framebufferHeight,{format:Dl,type:ap,encoding:e.outputEncoding,stencilBuffer:Y.stencil})}else{let Ke=null,nt=null,vt=null;Y.depth&&(vt=Y.stencil?35056:33190,Ke=Y.stencil?ff:ep,nt=Y.stencil?uf:Xd);const be={colorFormat:32856,depthFormat:vt,scaleFactor:p};Q=new XRWebGLBinding(c,t),z=Q.createProjectionLayer(be),c.updateRenderState({layers:[z]}),ae=new rl(z.textureWidth,z.textureHeight,{format:Dl,type:ap,depthTexture:new KI(z.textureWidth,z.textureHeight,nt,void 0,void 0,void 0,void 0,void 0,void 0,Ke),stencilBuffer:Y.stencil,encoding:e.outputEncoding,samples:Y.antialias?4:0});const At=e.properties.get(ae);At.__ignoreDepthValues=z.ignoreDepthValues}ae.isXRRenderTarget=!0,this.setFoveation(C),D=null,y=await c.requestReferenceSpace(i),Qe.setContext(c),Qe.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function le(Se){for(let Ke=0;Ke<Se.removed.length;Ke++){const nt=Se.removed[Ke],vt=Ae.indexOf(nt);vt>=0&&(Ae[vt]=null,ce[vt].disconnect(nt))}for(let Ke=0;Ke<Se.added.length;Ke++){const nt=Se.added[Ke];let vt=Ae.indexOf(nt);if(vt===-1){for(let At=0;At<ce.length;At++)if(At>=Ae.length){Ae.push(nt),vt=At;break}else if(Ae[At]===null){Ae[At]=nt,vt=At;break}if(vt===-1)break}const be=ce[vt];be&&be.connect(nt)}}const ye=new ft,xe=new ft;function Re(Se,Ke,nt){ye.setFromMatrixPosition(Ke.matrixWorld),xe.setFromMatrixPosition(nt.matrixWorld);const vt=ye.distanceTo(xe),be=Ke.projectionMatrix.elements,At=nt.projectionMatrix.elements,ut=be[14]/(be[10]-1),Nt=be[14]/(be[10]+1),Gt=(be[9]+1)/be[5],Qt=(be[9]-1)/be[5],Ct=(be[8]-1)/be[0],Ft=(At[8]+1)/At[0],Xt=ut*Ct,_i=ut*Ft,fi=vt/(-Ct+Ft),Gi=fi*-Ct;Ke.matrixWorld.decompose(Se.position,Se.quaternion,Se.scale),Se.translateX(Gi),Se.translateZ(fi),Se.matrixWorld.compose(Se.position,Se.quaternion,Se.scale),Se.matrixWorldInverse.copy(Se.matrixWorld).invert();const wn=ut+fi,zi=Nt+fi,Gn=Xt-Gi,kn=_i+(vt-Gi),yt=Gt*Nt/zi*wn,rt=Qt*Nt/zi*wn;Se.projectionMatrix.makePerspective(Gn,kn,yt,rt,wn,zi)}function Oe(Se,Ke){Ke===null?Se.matrixWorld.copy(Se.matrix):Se.matrixWorld.multiplyMatrices(Ke.matrixWorld,Se.matrix),Se.matrixWorldInverse.copy(Se.matrixWorld).invert()}this.updateCamera=function(Se){if(c===null)return;Ge.near=Je.near=De.near=Se.near,Ge.far=Je.far=De.far=Se.far,(Et!==Ge.near||li!==Ge.far)&&(c.updateRenderState({depthNear:Ge.near,depthFar:Ge.far}),Et=Ge.near,li=Ge.far);const Ke=Se.parent,nt=Ge.cameras;Oe(Ge,Ke);for(let be=0;be<nt.length;be++)Oe(nt[be],Ke);Ge.matrixWorld.decompose(Ge.position,Ge.quaternion,Ge.scale),Se.matrix.copy(Ge.matrix),Se.matrix.decompose(Se.position,Se.quaternion,Se.scale);const vt=Se.children;for(let be=0,At=vt.length;be<At;be++)vt[be].updateMatrixWorld(!0);nt.length===2?Re(Ge,De,Je):Ge.projectionMatrix.copy(De.projectionMatrix)},this.getCamera=function(){return Ge},this.getFoveation=function(){if(!(z===null&&G===null))return C},this.setFoveation=function(Se){C=Se,z!==null&&(z.fixedFoveation=Se),G!==null&&G.fixedFoveation!==void 0&&(G.fixedFoveation=Se)},this.getPlanes=function(){return we};let We=null;function Ve(Se,Ke){if(R=Ke.getViewerPose(D||y),J=Ke,R!==null){const nt=R.views;G!==null&&(e.setRenderTargetFramebuffer(ae,G.framebuffer),e.setRenderTarget(ae));let vt=!1;nt.length!==Ge.cameras.length&&(Ge.cameras.length=0,vt=!0);for(let be=0;be<nt.length;be++){const At=nt[be];let ut=null;if(G!==null)ut=G.getViewport(At);else{const Gt=Q.getViewSubImage(z,At);ut=Gt.viewport,be===0&&(e.setRenderTargetTextures(ae,Gt.colorTexture,z.ignoreDepthValues?void 0:Gt.depthStencilTexture),e.setRenderTarget(ae))}let Nt=Fe[be];Nt===void 0&&(Nt=new _a,Nt.layers.enable(be),Nt.viewport=new as,Fe[be]=Nt),Nt.matrix.fromArray(At.transform.matrix),Nt.projectionMatrix.fromArray(At.projectionMatrix),Nt.viewport.set(ut.x,ut.y,ut.width,ut.height),be===0&&Ge.matrix.copy(Nt.matrix),vt===!0&&Ge.cameras.push(Nt)}}for(let nt=0;nt<ce.length;nt++){const vt=Ae[nt],be=ce[nt];vt!==null&&be!==void 0&&be.update(vt,Ke,D||y)}if(We&&We(Se,Ke),Ke.detectedPlanes){r.dispatchEvent({type:"planesdetected",data:Ke.detectedPlanes});let nt=null;for(const vt of we)Ke.detectedPlanes.has(vt)||(nt===null&&(nt=[]),nt.push(vt));if(nt!==null)for(const vt of nt)we.delete(vt),me.delete(vt),r.dispatchEvent({type:"planeremoved",data:vt});for(const vt of Ke.detectedPlanes)if(!we.has(vt))we.add(vt),me.set(vt,Ke.lastChangedTime),r.dispatchEvent({type:"planeadded",data:vt});else{const be=me.get(vt);vt.lastChangedTime>be&&(me.set(vt,vt.lastChangedTime),r.dispatchEvent({type:"planechanged",data:vt}))}}J=null}const Qe=new NI;Qe.setAnimationLoop(Ve),this.setAnimationLoop=function(Se){We=Se},this.dispose=function(){}}}function wN(u,e){function t(Y,B){B.color.getRGB(Y.fogColor.value,zI(u)),B.isFog?(Y.fogNear.value=B.near,Y.fogFar.value=B.far):B.isFogExp2&&(Y.fogDensity.value=B.density)}function r(Y,B,ae,ce,Ae){B.isMeshBasicMaterial||B.isMeshLambertMaterial?c(Y,B):B.isMeshToonMaterial?(c(Y,B),R(Y,B)):B.isMeshPhongMaterial?(c(Y,B),D(Y,B)):B.isMeshStandardMaterial?(c(Y,B),Q(Y,B),B.isMeshPhysicalMaterial&&z(Y,B,Ae)):B.isMeshMatcapMaterial?(c(Y,B),G(Y,B)):B.isMeshDepthMaterial?c(Y,B):B.isMeshDistanceMaterial?(c(Y,B),J(Y,B)):B.isMeshNormalMaterial?c(Y,B):B.isLineBasicMaterial?(p(Y,B),B.isLineDashedMaterial&&y(Y,B)):B.isPointsMaterial?i(Y,B,ae,ce):B.isSpriteMaterial?C(Y,B):B.isShadowMaterial?(Y.color.value.copy(B.color),Y.opacity.value=B.opacity):B.isShaderMaterial&&(B.uniformsNeedUpdate=!1)}function c(Y,B){Y.opacity.value=B.opacity,B.color&&Y.diffuse.value.copy(B.color),B.emissive&&Y.emissive.value.copy(B.emissive).multiplyScalar(B.emissiveIntensity),B.map&&(Y.map.value=B.map),B.alphaMap&&(Y.alphaMap.value=B.alphaMap),B.bumpMap&&(Y.bumpMap.value=B.bumpMap,Y.bumpScale.value=B.bumpScale,B.side===rc&&(Y.bumpScale.value*=-1)),B.displacementMap&&(Y.displacementMap.value=B.displacementMap,Y.displacementScale.value=B.displacementScale,Y.displacementBias.value=B.displacementBias),B.emissiveMap&&(Y.emissiveMap.value=B.emissiveMap),B.normalMap&&(Y.normalMap.value=B.normalMap,Y.normalScale.value.copy(B.normalScale),B.side===rc&&Y.normalScale.value.negate()),B.specularMap&&(Y.specularMap.value=B.specularMap),B.alphaTest>0&&(Y.alphaTest.value=B.alphaTest);const ae=e.get(B).envMap;if(ae&&(Y.envMap.value=ae,Y.flipEnvMap.value=ae.isCubeTexture&&ae.isRenderTargetTexture===!1?-1:1,Y.reflectivity.value=B.reflectivity,Y.ior.value=B.ior,Y.refractionRatio.value=B.refractionRatio),B.lightMap){Y.lightMap.value=B.lightMap;const we=u.physicallyCorrectLights!==!0?Math.PI:1;Y.lightMapIntensity.value=B.lightMapIntensity*we}B.aoMap&&(Y.aoMap.value=B.aoMap,Y.aoMapIntensity.value=B.aoMapIntensity);let ce;B.map?ce=B.map:B.specularMap?ce=B.specularMap:B.displacementMap?ce=B.displacementMap:B.normalMap?ce=B.normalMap:B.bumpMap?ce=B.bumpMap:B.roughnessMap?ce=B.roughnessMap:B.metalnessMap?ce=B.metalnessMap:B.alphaMap?ce=B.alphaMap:B.emissiveMap?ce=B.emissiveMap:B.clearcoatMap?ce=B.clearcoatMap:B.clearcoatNormalMap?ce=B.clearcoatNormalMap:B.clearcoatRoughnessMap?ce=B.clearcoatRoughnessMap:B.iridescenceMap?ce=B.iridescenceMap:B.iridescenceThicknessMap?ce=B.iridescenceThicknessMap:B.specularIntensityMap?ce=B.specularIntensityMap:B.specularColorMap?ce=B.specularColorMap:B.transmissionMap?ce=B.transmissionMap:B.thicknessMap?ce=B.thicknessMap:B.sheenColorMap?ce=B.sheenColorMap:B.sheenRoughnessMap&&(ce=B.sheenRoughnessMap),ce!==void 0&&(ce.isWebGLRenderTarget&&(ce=ce.texture),ce.matrixAutoUpdate===!0&&ce.updateMatrix(),Y.uvTransform.value.copy(ce.matrix));let Ae;B.aoMap?Ae=B.aoMap:B.lightMap&&(Ae=B.lightMap),Ae!==void 0&&(Ae.isWebGLRenderTarget&&(Ae=Ae.texture),Ae.matrixAutoUpdate===!0&&Ae.updateMatrix(),Y.uv2Transform.value.copy(Ae.matrix))}function p(Y,B){Y.diffuse.value.copy(B.color),Y.opacity.value=B.opacity}function y(Y,B){Y.dashSize.value=B.dashSize,Y.totalSize.value=B.dashSize+B.gapSize,Y.scale.value=B.scale}function i(Y,B,ae,ce){Y.diffuse.value.copy(B.color),Y.opacity.value=B.opacity,Y.size.value=B.size*ae,Y.scale.value=ce*.5,B.map&&(Y.map.value=B.map),B.alphaMap&&(Y.alphaMap.value=B.alphaMap),B.alphaTest>0&&(Y.alphaTest.value=B.alphaTest);let Ae;B.map?Ae=B.map:B.alphaMap&&(Ae=B.alphaMap),Ae!==void 0&&(Ae.matrixAutoUpdate===!0&&Ae.updateMatrix(),Y.uvTransform.value.copy(Ae.matrix))}function C(Y,B){Y.diffuse.value.copy(B.color),Y.opacity.value=B.opacity,Y.rotation.value=B.rotation,B.map&&(Y.map.value=B.map),B.alphaMap&&(Y.alphaMap.value=B.alphaMap),B.alphaTest>0&&(Y.alphaTest.value=B.alphaTest);let ae;B.map?ae=B.map:B.alphaMap&&(ae=B.alphaMap),ae!==void 0&&(ae.matrixAutoUpdate===!0&&ae.updateMatrix(),Y.uvTransform.value.copy(ae.matrix))}function D(Y,B){Y.specular.value.copy(B.specular),Y.shininess.value=Math.max(B.shininess,1e-4)}function R(Y,B){B.gradientMap&&(Y.gradientMap.value=B.gradientMap)}function Q(Y,B){Y.roughness.value=B.roughness,Y.metalness.value=B.metalness,B.roughnessMap&&(Y.roughnessMap.value=B.roughnessMap),B.metalnessMap&&(Y.metalnessMap.value=B.metalnessMap),e.get(B).envMap&&(Y.envMapIntensity.value=B.envMapIntensity)}function z(Y,B,ae){Y.ior.value=B.ior,B.sheen>0&&(Y.sheenColor.value.copy(B.sheenColor).multiplyScalar(B.sheen),Y.sheenRoughness.value=B.sheenRoughness,B.sheenColorMap&&(Y.sheenColorMap.value=B.sheenColorMap),B.sheenRoughnessMap&&(Y.sheenRoughnessMap.value=B.sheenRoughnessMap)),B.clearcoat>0&&(Y.clearcoat.value=B.clearcoat,Y.clearcoatRoughness.value=B.clearcoatRoughness,B.clearcoatMap&&(Y.clearcoatMap.value=B.clearcoatMap),B.clearcoatRoughnessMap&&(Y.clearcoatRoughnessMap.value=B.clearcoatRoughnessMap),B.clearcoatNormalMap&&(Y.clearcoatNormalScale.value.copy(B.clearcoatNormalScale),Y.clearcoatNormalMap.value=B.clearcoatNormalMap,B.side===rc&&Y.clearcoatNormalScale.value.negate())),B.iridescence>0&&(Y.iridescence.value=B.iridescence,Y.iridescenceIOR.value=B.iridescenceIOR,Y.iridescenceThicknessMinimum.value=B.iridescenceThicknessRange[0],Y.iridescenceThicknessMaximum.value=B.iridescenceThicknessRange[1],B.iridescenceMap&&(Y.iridescenceMap.value=B.iridescenceMap),B.iridescenceThicknessMap&&(Y.iridescenceThicknessMap.value=B.iridescenceThicknessMap)),B.transmission>0&&(Y.transmission.value=B.transmission,Y.transmissionSamplerMap.value=ae.texture,Y.transmissionSamplerSize.value.set(ae.width,ae.height),B.transmissionMap&&(Y.transmissionMap.value=B.transmissionMap),Y.thickness.value=B.thickness,B.thicknessMap&&(Y.thicknessMap.value=B.thicknessMap),Y.attenuationDistance.value=B.attenuationDistance,Y.attenuationColor.value.copy(B.attenuationColor)),Y.specularIntensity.value=B.specularIntensity,Y.specularColor.value.copy(B.specularColor),B.specularIntensityMap&&(Y.specularIntensityMap.value=B.specularIntensityMap),B.specularColorMap&&(Y.specularColorMap.value=B.specularColorMap)}function G(Y,B){B.matcap&&(Y.matcap.value=B.matcap)}function J(Y,B){Y.referencePosition.value.copy(B.referencePosition),Y.nearDistance.value=B.nearDistance,Y.farDistance.value=B.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function bN(u,e,t,r){let c={},p={},y=[];const i=t.isWebGL2?u.getParameter(35375):0;function C(ce,Ae){const we=Ae.program;r.uniformBlockBinding(ce,we)}function D(ce,Ae){let we=c[ce.id];we===void 0&&(J(ce),we=R(ce),c[ce.id]=we,ce.addEventListener("dispose",B));const me=Ae.program;r.updateUBOMapping(ce,me);const De=e.render.frame;p[ce.id]!==De&&(z(ce),p[ce.id]=De)}function R(ce){const Ae=Q();ce.__bindingPointIndex=Ae;const we=u.createBuffer(),me=ce.__size,De=ce.usage;return u.bindBuffer(35345,we),u.bufferData(35345,me,De),u.bindBuffer(35345,null),u.bindBufferBase(35345,Ae,we),we}function Q(){for(let ce=0;ce<i;ce++)if(y.indexOf(ce)===-1)return y.push(ce),ce;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function z(ce){const Ae=c[ce.id],we=ce.uniforms,me=ce.__cache;u.bindBuffer(35345,Ae);for(let De=0,Je=we.length;De<Je;De++){const Fe=we[De];if(G(Fe,De,me)===!0){const Ge=Fe.__offset,Et=Array.isArray(Fe.value)?Fe.value:[Fe.value];let li=0;for(let xi=0;xi<Et.length;xi++){const te=Et[xi],le=Y(te);typeof te=="number"?(Fe.__data[0]=te,u.bufferSubData(35345,Ge+li,Fe.__data)):te.isMatrix3?(Fe.__data[0]=te.elements[0],Fe.__data[1]=te.elements[1],Fe.__data[2]=te.elements[2],Fe.__data[3]=te.elements[0],Fe.__data[4]=te.elements[3],Fe.__data[5]=te.elements[4],Fe.__data[6]=te.elements[5],Fe.__data[7]=te.elements[0],Fe.__data[8]=te.elements[6],Fe.__data[9]=te.elements[7],Fe.__data[10]=te.elements[8],Fe.__data[11]=te.elements[0]):(te.toArray(Fe.__data,li),li+=le.storage/Float32Array.BYTES_PER_ELEMENT)}u.bufferSubData(35345,Ge,Fe.__data)}}u.bindBuffer(35345,null)}function G(ce,Ae,we){const me=ce.value;if(we[Ae]===void 0){if(typeof me=="number")we[Ae]=me;else{const De=Array.isArray(me)?me:[me],Je=[];for(let Fe=0;Fe<De.length;Fe++)Je.push(De[Fe].clone());we[Ae]=Je}return!0}else if(typeof me=="number"){if(we[Ae]!==me)return we[Ae]=me,!0}else{const De=Array.isArray(we[Ae])?we[Ae]:[we[Ae]],Je=Array.isArray(me)?me:[me];for(let Fe=0;Fe<De.length;Fe++){const Ge=De[Fe];if(Ge.equals(Je[Fe])===!1)return Ge.copy(Je[Fe]),!0}}return!1}function J(ce){const Ae=ce.uniforms;let we=0;const me=16;let De=0;for(let Je=0,Fe=Ae.length;Je<Fe;Je++){const Ge=Ae[Je],Et={boundary:0,storage:0},li=Array.isArray(Ge.value)?Ge.value:[Ge.value];for(let xi=0,te=li.length;xi<te;xi++){const le=li[xi],ye=Y(le);Et.boundary+=ye.boundary,Et.storage+=ye.storage}if(Ge.__data=new Float32Array(Et.storage/Float32Array.BYTES_PER_ELEMENT),Ge.__offset=we,Je>0){De=we%me;const xi=me-De;De!==0&&xi-Et.boundary<0&&(we+=me-De,Ge.__offset=we)}we+=Et.storage}return De=we%me,De>0&&(we+=me-De),ce.__size=we,ce.__cache={},this}function Y(ce){const Ae={boundary:0,storage:0};return typeof ce=="number"?(Ae.boundary=4,Ae.storage=4):ce.isVector2?(Ae.boundary=8,Ae.storage=8):ce.isVector3||ce.isColor?(Ae.boundary=16,Ae.storage=12):ce.isVector4?(Ae.boundary=16,Ae.storage=16):ce.isMatrix3?(Ae.boundary=48,Ae.storage=48):ce.isMatrix4?(Ae.boundary=64,Ae.storage=64):ce.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",ce),Ae}function B(ce){const Ae=ce.target;Ae.removeEventListener("dispose",B);const we=y.indexOf(Ae.__bindingPointIndex);y.splice(we,1),u.deleteBuffer(c[Ae.id]),delete c[Ae.id],delete p[Ae.id]}function ae(){for(const ce in c)u.deleteBuffer(c[ce]);y=[],c={},p={}}return{bind:C,update:D,dispose:ae}}function BN(){const u=K_("canvas");return u.style.display="block",u}function fv(u={}){this.isWebGLRenderer=!0;const e=u.canvas!==void 0?u.canvas:BN(),t=u.context!==void 0?u.context:null,r=u.depth!==void 0?u.depth:!0,c=u.stencil!==void 0?u.stencil:!0,p=u.antialias!==void 0?u.antialias:!1,y=u.premultipliedAlpha!==void 0?u.premultipliedAlpha:!0,i=u.preserveDrawingBuffer!==void 0?u.preserveDrawingBuffer:!1,C=u.powerPreference!==void 0?u.powerPreference:"default",D=u.failIfMajorPerformanceCaveat!==void 0?u.failIfMajorPerformanceCaveat:!1;let R;t!==null?R=t.getContextAttributes().alpha:R=u.alpha!==void 0?u.alpha:!1;let Q=null,z=null;const G=[],J=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=lp,this.physicallyCorrectLights=!1,this.toneMapping=Hu,this.toneMappingExposure=1;const Y=this;let B=!1,ae=0,ce=0,Ae=null,we=-1,me=null;const De=new as,Je=new as;let Fe=null,Ge=e.width,Et=e.height,li=1,xi=null,te=null;const le=new as(0,0,Ge,Et),ye=new as(0,0,Ge,Et);let xe=!1;const Re=new Vv;let Oe=!1,We=!1,Ve=null;const Qe=new ar,Se=new Di,Ke=new ft,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function vt(){return Ae===null?li:1}let be=t;function At(X,j){for(let ie=0;ie<X.length;ie++){const ne=X[ie],de=e.getContext(ne,j);if(de!==null)return de}return null}try{const X={alpha:!0,depth:r,stencil:c,antialias:p,premultipliedAlpha:y,preserveDrawingBuffer:i,powerPreference:C,failIfMajorPerformanceCaveat:D};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${zv}`),e.addEventListener("webglcontextlost",Cn,!1),e.addEventListener("webglcontextrestored",Tn,!1),e.addEventListener("webglcontextcreationerror",nr,!1),be===null){const j=["webgl2","webgl","experimental-webgl"];if(Y.isWebGL1Renderer===!0&&j.shift(),be=At(j,X),be===null)throw At(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}be.getShaderPrecisionFormat===void 0&&(be.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(X){throw console.error("THREE.WebGLRenderer: "+X.message),X}let ut,Nt,Gt,Qt,Ct,Ft,Xt,_i,fi,Gi,wn,zi,Gn,kn,yt,rt,ti,Ni,qi,en,$t,at,ii,hn;function Xi(){ut=new NO(be),Nt=new PO(be,ut,u),ut.init(Nt),at=new WI(be,ut,Nt),Gt=new _N(be,ut,Nt),Qt=new HO,Ct=new oN,Ft=new yN(be,ut,Gt,Ct,Nt,at,Qt),Xt=new RO(Y),_i=new OO(Y),fi=new Yz(be,Nt),ii=new LO(be,ut,fi,Nt),Gi=new QO(be,fi,Qt,ii),wn=new KO(be,Gi,fi,Qt),qi=new jO(be,Nt,Ft),rt=new UO(Ct),zi=new sN(Y,Xt,_i,ut,Nt,ii,rt),Gn=new wN(Y,Ct),kn=new lN,yt=new pN(ut,Nt),Ni=new FO(Y,Xt,_i,Gt,wn,R,y),ti=new gN(Y,wn,Nt),hn=new bN(be,Qt,Nt,Gt),en=new DO(be,ut,Qt,Nt),$t=new VO(be,ut,Qt,Nt),Qt.programs=zi.programs,Y.capabilities=Nt,Y.extensions=ut,Y.properties=Ct,Y.renderLists=kn,Y.shadowMap=ti,Y.state=Gt,Y.info=Qt}Xi();const on=new vN(Y,be);this.xr=on,this.getContext=function(){return be},this.getContextAttributes=function(){return be.getContextAttributes()},this.forceContextLoss=function(){const X=ut.get("WEBGL_lose_context");X&&X.loseContext()},this.forceContextRestore=function(){const X=ut.get("WEBGL_lose_context");X&&X.restoreContext()},this.getPixelRatio=function(){return li},this.setPixelRatio=function(X){X!==void 0&&(li=X,this.setSize(Ge,Et,!1))},this.getSize=function(X){return X.set(Ge,Et)},this.setSize=function(X,j,ie){if(on.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Ge=X,Et=j,e.width=Math.floor(X*li),e.height=Math.floor(j*li),ie!==!1&&(e.style.width=X+"px",e.style.height=j+"px"),this.setViewport(0,0,X,j)},this.getDrawingBufferSize=function(X){return X.set(Ge*li,Et*li).floor()},this.setDrawingBufferSize=function(X,j,ie){Ge=X,Et=j,li=ie,e.width=Math.floor(X*ie),e.height=Math.floor(j*ie),this.setViewport(0,0,X,j)},this.getCurrentViewport=function(X){return X.copy(De)},this.getViewport=function(X){return X.copy(le)},this.setViewport=function(X,j,ie,ne){X.isVector4?le.set(X.x,X.y,X.z,X.w):le.set(X,j,ie,ne),Gt.viewport(De.copy(le).multiplyScalar(li).floor())},this.getScissor=function(X){return X.copy(ye)},this.setScissor=function(X,j,ie,ne){X.isVector4?ye.set(X.x,X.y,X.z,X.w):ye.set(X,j,ie,ne),Gt.scissor(Je.copy(ye).multiplyScalar(li).floor())},this.getScissorTest=function(){return xe},this.setScissorTest=function(X){Gt.setScissorTest(xe=X)},this.setOpaqueSort=function(X){xi=X},this.setTransparentSort=function(X){te=X},this.getClearColor=function(X){return X.copy(Ni.getClearColor())},this.setClearColor=function(){Ni.setClearColor.apply(Ni,arguments)},this.getClearAlpha=function(){return Ni.getClearAlpha()},this.setClearAlpha=function(){Ni.setClearAlpha.apply(Ni,arguments)},this.clear=function(X=!0,j=!0,ie=!0){let ne=0;X&&(ne|=16384),j&&(ne|=256),ie&&(ne|=1024),be.clear(ne)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Cn,!1),e.removeEventListener("webglcontextrestored",Tn,!1),e.removeEventListener("webglcontextcreationerror",nr,!1),kn.dispose(),yt.dispose(),Ct.dispose(),Xt.dispose(),_i.dispose(),wn.dispose(),ii.dispose(),hn.dispose(),zi.dispose(),on.dispose(),on.removeEventListener("sessionstart",Ui),on.removeEventListener("sessionend",Pn),Ve&&(Ve.dispose(),Ve=null),qn.stop()};function Cn(X){X.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),B=!0}function Tn(){console.log("THREE.WebGLRenderer: Context Restored."),B=!1;const X=Qt.autoReset,j=ti.enabled,ie=ti.autoUpdate,ne=ti.needsUpdate,de=ti.type;Xi(),Qt.autoReset=X,ti.enabled=j,ti.autoUpdate=ie,ti.needsUpdate=ne,ti.type=de}function nr(X){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",X.statusMessage)}function Ii(X){const j=X.target;j.removeEventListener("dispose",Ii),bn(j)}function bn(X){Ot(X),Ct.remove(X)}function Ot(X){const j=Ct.get(X).programs;j!==void 0&&(j.forEach(function(ie){zi.releaseProgram(ie)}),X.isShaderMaterial&&zi.releaseShaderCache(X))}this.renderBufferDirect=function(X,j,ie,ne,de,Ue){j===null&&(j=nt);const tt=de.isMesh&&de.matrixWorld.determinant()<0,He=Pe(X,j,ie,ne,de);Gt.setMaterial(ne,tt);let et=ie.index,pt=1;ne.wireframe===!0&&(et=Gi.getWireframeAttribute(ie),pt=2);const Lt=ie.drawRange,jt=ie.attributes.position;let Wt=Lt.start*pt,ki=(Lt.start+Lt.count)*pt;Ue!==null&&(Wt=Math.max(Wt,Ue.start*pt),ki=Math.min(ki,(Ue.start+Ue.count)*pt)),et!==null?(Wt=Math.max(Wt,0),ki=Math.min(ki,et.count)):jt!=null&&(Wt=Math.max(Wt,0),ki=Math.min(ki,jt.count));const bi=ki-Wt;if(bi<0||bi===1/0)return;ii.setup(de,ne,He,ie,et);let Oi,Yi=en;if(et!==null&&(Oi=fi.get(et),Yi=$t,Yi.setIndex(Oi)),de.isMesh)ne.wireframe===!0?(Gt.setLineWidth(ne.wireframeLinewidth*vt()),Yi.setMode(1)):Yi.setMode(4);else if(de.isLine){let tn=ne.linewidth;tn===void 0&&(tn=1),Gt.setLineWidth(tn*vt()),de.isLineSegments?Yi.setMode(1):de.isLineLoop?Yi.setMode(2):Yi.setMode(3)}else de.isPoints?Yi.setMode(0):de.isSprite&&Yi.setMode(4);if(de.isInstancedMesh)Yi.renderInstances(Wt,bi,de.count);else if(ie.isInstancedBufferGeometry){const tn=ie._maxInstanceCount!==void 0?ie._maxInstanceCount:1/0,rr=Math.min(ie.instanceCount,tn);Yi.renderInstances(Wt,bi,rr)}else Yi.render(Wt,bi)},this.compile=function(X,j){function ie(ne,de,Ue){ne.transparent===!0&&ne.side===ga&&ne.forceSinglePass===!1?(ne.side=rc,ne.needsUpdate=!0,ot(ne,de,Ue),ne.side=uu,ne.needsUpdate=!0,ot(ne,de,Ue),ne.side=ga):ot(ne,de,Ue)}z=yt.get(X),z.init(),J.push(z),X.traverseVisible(function(ne){ne.isLight&&ne.layers.test(j.layers)&&(z.pushLight(ne),ne.castShadow&&z.pushShadow(ne))}),z.setupLights(Y.physicallyCorrectLights),X.traverse(function(ne){const de=ne.material;if(de)if(Array.isArray(de))for(let Ue=0;Ue<de.length;Ue++){const tt=de[Ue];ie(tt,X,ne)}else ie(de,X,ne)}),J.pop(),z=null};let wi=null;function Wi(X){wi&&wi(X)}function Ui(){qn.stop()}function Pn(){qn.start()}const qn=new NI;qn.setAnimationLoop(Wi),typeof self<"u"&&qn.setContext(self),this.setAnimationLoop=function(X){wi=X,on.setAnimationLoop(X),X===null?qn.stop():qn.start()},on.addEventListener("sessionstart",Ui),on.addEventListener("sessionend",Pn),this.render=function(X,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;X.matrixWorldAutoUpdate===!0&&X.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),on.enabled===!0&&on.isPresenting===!0&&(on.cameraAutoUpdate===!0&&on.updateCamera(j),j=on.getCamera()),X.isScene===!0&&X.onBeforeRender(Y,X,j,Ae),z=yt.get(X,J.length),z.init(),J.push(z),Qe.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),Re.setFromProjectionMatrix(Qe),We=this.localClippingEnabled,Oe=rt.init(this.clippingPlanes,We),Q=kn.get(X,G.length),Q.init(),G.push(Q),Hr(X,j,0,Y.sortObjects),Q.finish(),Y.sortObjects===!0&&Q.sort(xi,te),Oe===!0&&rt.beginShadows();const ie=z.state.shadowsArray;if(ti.render(ie,X,j),Oe===!0&&rt.endShadows(),this.info.autoReset===!0&&this.info.reset(),Ni.render(Q,X),z.setupLights(Y.physicallyCorrectLights),j.isArrayCamera){const ne=j.cameras;for(let de=0,Ue=ne.length;de<Ue;de++){const tt=ne[de];fr(Q,X,tt,tt.viewport)}}else fr(Q,X,j);Ae!==null&&(Ft.updateMultisampleRenderTarget(Ae),Ft.updateRenderTargetMipmap(Ae)),X.isScene===!0&&X.onAfterRender(Y,X,j),ii.resetDefaultState(),we=-1,me=null,J.pop(),J.length>0?z=J[J.length-1]:z=null,G.pop(),G.length>0?Q=G[G.length-1]:Q=null};function Hr(X,j,ie,ne){if(X.visible===!1)return;if(X.layers.test(j.layers)){if(X.isGroup)ie=X.renderOrder;else if(X.isLOD)X.autoUpdate===!0&&X.update(j);else if(X.isLight)z.pushLight(X),X.castShadow&&z.pushShadow(X);else if(X.isSprite){if(!X.frustumCulled||Re.intersectsSprite(X)){ne&&Ke.setFromMatrixPosition(X.matrixWorld).applyMatrix4(Qe);const tt=wn.update(X),He=X.material;He.visible&&Q.push(X,tt,He,ie,Ke.z,null)}}else if((X.isMesh||X.isLine||X.isPoints)&&(X.isSkinnedMesh&&X.skeleton.frame!==Qt.render.frame&&(X.skeleton.update(),X.skeleton.frame=Qt.render.frame),!X.frustumCulled||Re.intersectsObject(X))){ne&&Ke.setFromMatrixPosition(X.matrixWorld).applyMatrix4(Qe);const tt=wn.update(X),He=X.material;if(Array.isArray(He)){const et=tt.groups;for(let pt=0,Lt=et.length;pt<Lt;pt++){const jt=et[pt],Wt=He[jt.materialIndex];Wt&&Wt.visible&&Q.push(X,tt,Wt,ie,Ke.z,jt)}}else He.visible&&Q.push(X,tt,He,ie,Ke.z,null)}}const Ue=X.children;for(let tt=0,He=Ue.length;tt<He;tt++)Hr(Ue[tt],j,ie,ne)}function fr(X,j,ie,ne){const de=X.opaque,Ue=X.transmissive,tt=X.transparent;z.setupLightsView(ie),Oe===!0&&rt.setGlobalState(Y.clippingPlanes,ie),Ue.length>0&&kr(de,j,ie),ne&&Gt.viewport(De.copy(ne)),de.length>0&&Qn(de,j,ie),Ue.length>0&&Qn(Ue,j,ie),tt.length>0&&Qn(tt,j,ie),Gt.buffers.depth.setTest(!0),Gt.buffers.depth.setMask(!0),Gt.buffers.color.setMask(!0),Gt.setPolygonOffset(!1)}function kr(X,j,ie){const ne=Nt.isWebGL2;Ve===null&&(Ve=new rl(1,1,{generateMipmaps:!0,type:ut.has("EXT_color_buffer_half_float")?Gm:ap,minFilter:op,samples:ne&&p===!0?4:0})),Y.getDrawingBufferSize(Se),ne?Ve.setSize(Se.x,Se.y):Ve.setSize(pv(Se.x),pv(Se.y));const de=Y.getRenderTarget();Y.setRenderTarget(Ve),Y.clear();const Ue=Y.toneMapping;Y.toneMapping=Hu,Qn(X,j,ie),Y.toneMapping=Ue,Ft.updateMultisampleRenderTarget(Ve),Ft.updateRenderTargetMipmap(Ve),Y.setRenderTarget(de)}function Qn(X,j,ie){const ne=j.isScene===!0?j.overrideMaterial:null;for(let de=0,Ue=X.length;de<Ue;de++){const tt=X[de],He=tt.object,et=tt.geometry,pt=ne===null?tt.material:ne,Lt=tt.group;He.layers.test(ie.layers)&&Rs(He,j,ie,et,pt,Lt)}}function Rs(X,j,ie,ne,de,Ue){X.onBeforeRender(Y,j,ie,ne,de,Ue),X.modelViewMatrix.multiplyMatrices(ie.matrixWorldInverse,X.matrixWorld),X.normalMatrix.getNormalMatrix(X.modelViewMatrix),de.onBeforeRender(Y,j,ie,ne,X,Ue),de.transparent===!0&&de.side===ga&&de.forceSinglePass===!1?(de.side=rc,de.needsUpdate=!0,Y.renderBufferDirect(ie,j,ne,de,X,Ue),de.side=uu,de.needsUpdate=!0,Y.renderBufferDirect(ie,j,ne,de,X,Ue),de.side=ga):Y.renderBufferDirect(ie,j,ne,de,X,Ue),X.onAfterRender(Y,j,ie,ne,de,Ue)}function ot(X,j,ie){j.isScene!==!0&&(j=nt);const ne=Ct.get(X),de=z.state.lights,Ue=z.state.shadowsArray,tt=de.state.version,He=zi.getParameters(X,de.state,Ue,j,ie),et=zi.getProgramCacheKey(He);let pt=ne.programs;ne.environment=X.isMeshStandardMaterial?j.environment:null,ne.fog=j.fog,ne.envMap=(X.isMeshStandardMaterial?_i:Xt).get(X.envMap||ne.environment),pt===void 0&&(X.addEventListener("dispose",Ii),pt=new Map,ne.programs=pt);let Lt=pt.get(et);if(Lt!==void 0){if(ne.currentProgram===Lt&&ne.lightsStateVersion===tt)return Ee(X,He),Lt}else He.uniforms=zi.getUniforms(X),X.onBuild(ie,He,Y),X.onBeforeCompile(He,Y),Lt=zi.acquireProgram(He,et),pt.set(et,Lt),ne.uniforms=He.uniforms;const jt=ne.uniforms;(!X.isShaderMaterial&&!X.isRawShaderMaterial||X.clipping===!0)&&(jt.clippingPlanes=rt.uniform),Ee(X,He),ne.needsLights=wt(X),ne.lightsStateVersion=tt,ne.needsLights&&(jt.ambientLightColor.value=de.state.ambient,jt.lightProbe.value=de.state.probe,jt.directionalLights.value=de.state.directional,jt.directionalLightShadows.value=de.state.directionalShadow,jt.spotLights.value=de.state.spot,jt.spotLightShadows.value=de.state.spotShadow,jt.rectAreaLights.value=de.state.rectArea,jt.ltc_1.value=de.state.rectAreaLTC1,jt.ltc_2.value=de.state.rectAreaLTC2,jt.pointLights.value=de.state.point,jt.pointLightShadows.value=de.state.pointShadow,jt.hemisphereLights.value=de.state.hemi,jt.directionalShadowMap.value=de.state.directionalShadowMap,jt.directionalShadowMatrix.value=de.state.directionalShadowMatrix,jt.spotShadowMap.value=de.state.spotShadowMap,jt.spotLightMatrix.value=de.state.spotLightMatrix,jt.spotLightMap.value=de.state.spotLightMap,jt.pointShadowMap.value=de.state.pointShadowMap,jt.pointShadowMatrix.value=de.state.pointShadowMatrix);const Wt=Lt.getUniforms(),ki=Yx.seqWithValue(Wt.seq,jt);return ne.currentProgram=Lt,ne.uniformsList=ki,Lt}function Ee(X,j){const ie=Ct.get(X);ie.outputEncoding=j.outputEncoding,ie.instancing=j.instancing,ie.skinning=j.skinning,ie.morphTargets=j.morphTargets,ie.morphNormals=j.morphNormals,ie.morphColors=j.morphColors,ie.morphTargetsCount=j.morphTargetsCount,ie.numClippingPlanes=j.numClippingPlanes,ie.numIntersection=j.numClipIntersection,ie.vertexAlphas=j.vertexAlphas,ie.vertexTangents=j.vertexTangents,ie.toneMapping=j.toneMapping}function Pe(X,j,ie,ne,de){j.isScene!==!0&&(j=nt),Ft.resetTextureUnits();const Ue=j.fog,tt=ne.isMeshStandardMaterial?j.environment:null,He=Ae===null?Y.outputEncoding:Ae.isXRRenderTarget===!0?Ae.texture.encoding:lp,et=(ne.isMeshStandardMaterial?_i:Xt).get(ne.envMap||tt),pt=ne.vertexColors===!0&&!!ie.attributes.color&&ie.attributes.color.itemSize===4,Lt=!!ne.normalMap&&!!ie.attributes.tangent,jt=!!ie.morphAttributes.position,Wt=!!ie.morphAttributes.normal,ki=!!ie.morphAttributes.color,bi=ne.toneMapped?Y.toneMapping:Hu,Oi=ie.morphAttributes.position||ie.morphAttributes.normal||ie.morphAttributes.color,Yi=Oi!==void 0?Oi.length:0,tn=Ct.get(ne),rr=z.state.lights;if(Oe===!0&&(We===!0||X!==me)){const zs=X===me&&ne.id===we;rt.setState(ne,X,zs)}let yn=!1;ne.version===tn.__version?(tn.needsLights&&tn.lightsStateVersion!==rr.state.version||tn.outputEncoding!==He||de.isInstancedMesh&&tn.instancing===!1||!de.isInstancedMesh&&tn.instancing===!0||de.isSkinnedMesh&&tn.skinning===!1||!de.isSkinnedMesh&&tn.skinning===!0||tn.envMap!==et||ne.fog===!0&&tn.fog!==Ue||tn.numClippingPlanes!==void 0&&(tn.numClippingPlanes!==rt.numPlanes||tn.numIntersection!==rt.numIntersection)||tn.vertexAlphas!==pt||tn.vertexTangents!==Lt||tn.morphTargets!==jt||tn.morphNormals!==Wt||tn.morphColors!==ki||tn.toneMapping!==bi||Nt.isWebGL2===!0&&tn.morphTargetsCount!==Yi)&&(yn=!0):(yn=!0,tn.__version=ne.version);let Yt=tn.currentProgram;yn===!0&&(Yt=ot(ne,j,de));let sr=!1,Yn=!1,Wr=!1;const mr=Yt.getUniforms(),Mr=tn.uniforms;if(Gt.useProgram(Yt.program)&&(sr=!0,Yn=!0,Wr=!0),ne.id!==we&&(we=ne.id,Yn=!0),sr||me!==X){if(mr.setValue(be,"projectionMatrix",X.projectionMatrix),Nt.logarithmicDepthBuffer&&mr.setValue(be,"logDepthBufFC",2/(Math.log(X.far+1)/Math.LN2)),me!==X&&(me=X,Yn=!0,Wr=!0),ne.isShaderMaterial||ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshStandardMaterial||ne.envMap){const zs=mr.map.cameraPosition;zs!==void 0&&zs.setValue(be,Ke.setFromMatrixPosition(X.matrixWorld))}(ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshLambertMaterial||ne.isMeshBasicMaterial||ne.isMeshStandardMaterial||ne.isShaderMaterial)&&mr.setValue(be,"isOrthographic",X.isOrthographicCamera===!0),(ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshLambertMaterial||ne.isMeshBasicMaterial||ne.isMeshStandardMaterial||ne.isShaderMaterial||ne.isShadowMaterial||de.isSkinnedMesh)&&mr.setValue(be,"viewMatrix",X.matrixWorldInverse)}if(de.isSkinnedMesh){mr.setOptional(be,de,"bindMatrix"),mr.setOptional(be,de,"bindMatrixInverse");const zs=de.skeleton;zs&&(Nt.floatVertexTextures?(zs.boneTexture===null&&zs.computeBoneTexture(),mr.setValue(be,"boneTexture",zs.boneTexture,Ft),mr.setValue(be,"boneTextureSize",zs.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Oo=ie.morphAttributes;if((Oo.position!==void 0||Oo.normal!==void 0||Oo.color!==void 0&&Nt.isWebGL2===!0)&&qi.update(de,ie,ne,Yt),(Yn||tn.receiveShadow!==de.receiveShadow)&&(tn.receiveShadow=de.receiveShadow,mr.setValue(be,"receiveShadow",de.receiveShadow)),ne.isMeshGouraudMaterial&&ne.envMap!==null&&(Mr.envMap.value=et,Mr.flipEnvMap.value=et.isCubeTexture&&et.isRenderTargetTexture===!1?-1:1),Yn&&(mr.setValue(be,"toneMappingExposure",Y.toneMappingExposure),tn.needsLights&&ct(Mr,Wr),Ue&&ne.fog===!0&&Gn.refreshFogUniforms(Mr,Ue),Gn.refreshMaterialUniforms(Mr,ne,li,Et,Ve),Yx.upload(be,tn.uniformsList,Mr,Ft)),ne.isShaderMaterial&&ne.uniformsNeedUpdate===!0&&(Yx.upload(be,tn.uniformsList,Mr,Ft),ne.uniformsNeedUpdate=!1),ne.isSpriteMaterial&&mr.setValue(be,"center",de.center),mr.setValue(be,"modelViewMatrix",de.modelViewMatrix),mr.setValue(be,"normalMatrix",de.normalMatrix),mr.setValue(be,"modelMatrix",de.matrixWorld),ne.isShaderMaterial||ne.isRawShaderMaterial){const zs=ne.uniformsGroups;for(let or=0,rn=zs.length;or<rn;or++)if(Nt.isWebGL2){const cr=zs[or];hn.update(cr,Yt),hn.bind(cr,Yt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Yt}function ct(X,j){X.ambientLightColor.needsUpdate=j,X.lightProbe.needsUpdate=j,X.directionalLights.needsUpdate=j,X.directionalLightShadows.needsUpdate=j,X.pointLights.needsUpdate=j,X.pointLightShadows.needsUpdate=j,X.spotLights.needsUpdate=j,X.spotLightShadows.needsUpdate=j,X.rectAreaLights.needsUpdate=j,X.hemisphereLights.needsUpdate=j}function wt(X){return X.isMeshLambertMaterial||X.isMeshToonMaterial||X.isMeshPhongMaterial||X.isMeshStandardMaterial||X.isShadowMaterial||X.isShaderMaterial&&X.lights===!0}this.getActiveCubeFace=function(){return ae},this.getActiveMipmapLevel=function(){return ce},this.getRenderTarget=function(){return Ae},this.setRenderTargetTextures=function(X,j,ie){Ct.get(X.texture).__webglTexture=j,Ct.get(X.depthTexture).__webglTexture=ie;const ne=Ct.get(X);ne.__hasExternalTextures=!0,ne.__hasExternalTextures&&(ne.__autoAllocateDepthBuffer=ie===void 0,ne.__autoAllocateDepthBuffer||ut.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ne.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(X,j){const ie=Ct.get(X);ie.__webglFramebuffer=j,ie.__useDefaultFramebuffer=j===void 0},this.setRenderTarget=function(X,j=0,ie=0){Ae=X,ae=j,ce=ie;let ne=!0,de=null,Ue=!1,tt=!1;if(X){const et=Ct.get(X);et.__useDefaultFramebuffer!==void 0?(Gt.bindFramebuffer(36160,null),ne=!1):et.__webglFramebuffer===void 0?Ft.setupRenderTarget(X):et.__hasExternalTextures&&Ft.rebindTextures(X,Ct.get(X.texture).__webglTexture,Ct.get(X.depthTexture).__webglTexture);const pt=X.texture;(pt.isData3DTexture||pt.isDataArrayTexture||pt.isCompressedArrayTexture)&&(tt=!0);const Lt=Ct.get(X).__webglFramebuffer;X.isWebGLCubeRenderTarget?(de=Lt[j],Ue=!0):Nt.isWebGL2&&X.samples>0&&Ft.useMultisampledRTT(X)===!1?de=Ct.get(X).__webglMultisampledFramebuffer:de=Lt,De.copy(X.viewport),Je.copy(X.scissor),Fe=X.scissorTest}else De.copy(le).multiplyScalar(li).floor(),Je.copy(ye).multiplyScalar(li).floor(),Fe=xe;if(Gt.bindFramebuffer(36160,de)&&Nt.drawBuffers&&ne&&Gt.drawBuffers(X,de),Gt.viewport(De),Gt.scissor(Je),Gt.setScissorTest(Fe),Ue){const et=Ct.get(X.texture);be.framebufferTexture2D(36160,36064,34069+j,et.__webglTexture,ie)}else if(tt){const et=Ct.get(X.texture),pt=j||0;be.framebufferTextureLayer(36160,36064,et.__webglTexture,ie||0,pt)}we=-1},this.readRenderTargetPixels=function(X,j,ie,ne,de,Ue,tt){if(!(X&&X.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let He=Ct.get(X).__webglFramebuffer;if(X.isWebGLCubeRenderTarget&&tt!==void 0&&(He=He[tt]),He){Gt.bindFramebuffer(36160,He);try{const et=X.texture,pt=et.format,Lt=et.type;if(pt!==Dl&&at.convert(pt)!==be.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const jt=Lt===Gm&&(ut.has("EXT_color_buffer_half_float")||Nt.isWebGL2&&ut.has("EXT_color_buffer_float"));if(Lt!==ap&&at.convert(Lt)!==be.getParameter(35738)&&!(Lt===GA&&(Nt.isWebGL2||ut.has("OES_texture_float")||ut.has("WEBGL_color_buffer_float")))&&!jt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=X.width-ne&&ie>=0&&ie<=X.height-de&&be.readPixels(j,ie,ne,de,at.convert(pt),at.convert(Lt),Ue)}finally{const et=Ae!==null?Ct.get(Ae).__webglFramebuffer:null;Gt.bindFramebuffer(36160,et)}}},this.copyFramebufferToTexture=function(X,j,ie=0){const ne=Math.pow(2,-ie),de=Math.floor(j.image.width*ne),Ue=Math.floor(j.image.height*ne);Ft.setTexture2D(j,0),be.copyTexSubImage2D(3553,ie,0,0,X.x,X.y,de,Ue),Gt.unbindTexture()},this.copyTextureToTexture=function(X,j,ie,ne=0){const de=j.image.width,Ue=j.image.height,tt=at.convert(ie.format),He=at.convert(ie.type);Ft.setTexture2D(ie,0),be.pixelStorei(37440,ie.flipY),be.pixelStorei(37441,ie.premultiplyAlpha),be.pixelStorei(3317,ie.unpackAlignment),j.isDataTexture?be.texSubImage2D(3553,ne,X.x,X.y,de,Ue,tt,He,j.image.data):j.isCompressedTexture?be.compressedTexSubImage2D(3553,ne,X.x,X.y,j.mipmaps[0].width,j.mipmaps[0].height,tt,j.mipmaps[0].data):be.texSubImage2D(3553,ne,X.x,X.y,tt,He,j.image),ne===0&&ie.generateMipmaps&&be.generateMipmap(3553),Gt.unbindTexture()},this.copyTextureToTexture3D=function(X,j,ie,ne,de=0){if(Y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ue=X.max.x-X.min.x+1,tt=X.max.y-X.min.y+1,He=X.max.z-X.min.z+1,et=at.convert(ne.format),pt=at.convert(ne.type);let Lt;if(ne.isData3DTexture)Ft.setTexture3D(ne,0),Lt=32879;else if(ne.isDataArrayTexture)Ft.setTexture2DArray(ne,0),Lt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}be.pixelStorei(37440,ne.flipY),be.pixelStorei(37441,ne.premultiplyAlpha),be.pixelStorei(3317,ne.unpackAlignment);const jt=be.getParameter(3314),Wt=be.getParameter(32878),ki=be.getParameter(3316),bi=be.getParameter(3315),Oi=be.getParameter(32877),Yi=ie.isCompressedTexture?ie.mipmaps[0]:ie.image;be.pixelStorei(3314,Yi.width),be.pixelStorei(32878,Yi.height),be.pixelStorei(3316,X.min.x),be.pixelStorei(3315,X.min.y),be.pixelStorei(32877,X.min.z),ie.isDataTexture||ie.isData3DTexture?be.texSubImage3D(Lt,de,j.x,j.y,j.z,Ue,tt,He,et,pt,Yi.data):ie.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),be.compressedTexSubImage3D(Lt,de,j.x,j.y,j.z,Ue,tt,He,et,Yi.data)):be.texSubImage3D(Lt,de,j.x,j.y,j.z,Ue,tt,He,et,pt,Yi),be.pixelStorei(3314,jt),be.pixelStorei(32878,Wt),be.pixelStorei(3316,ki),be.pixelStorei(3315,bi),be.pixelStorei(32877,Oi),de===0&&ne.generateMipmaps&&be.generateMipmap(Lt),Gt.unbindTexture()},this.initTexture=function(X){X.isCubeTexture?Ft.setTextureCube(X,0):X.isData3DTexture?Ft.setTexture3D(X,0):X.isDataArrayTexture||X.isCompressedArrayTexture?Ft.setTexture2DArray(X,0):Ft.setTexture2D(X,0),Gt.unbindTexture()},this.resetState=function(){ae=0,ce=0,Ae=null,Gt.reset(),ii.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class $I extends fv{}$I.prototype.isWebGL1Renderer=!0;class Gv{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Dn(e),this.density=t}clone(){return new Gv(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Wv{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Dn(e),this.near=t,this.far=r}clone(){return new Wv(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class K2 extends ls{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class jv{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=W_,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Pc()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let c=0,p=this.stride;c<p;c++)this.array[e+c]=t.array[r+c];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pc()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pc()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Tl=new ft;class Dc{constructor(e,t,r,c=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=c}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)Tl.fromBufferAttribute(this,t),Tl.applyMatrix4(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Tl.fromBufferAttribute(this,t),Tl.applyNormalMatrix(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Tl.fromBufferAttribute(this,t),Tl.transformDirection(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this}setX(e,t){return this.normalized&&(t=Us(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Us(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Us(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Us(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=WA(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=WA(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=WA(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=WA(t,this.array)),t}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Us(t,this.array),r=Us(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,c){return e=e*this.data.stride+this.offset,this.normalized&&(t=Us(t,this.array),r=Us(r,this.array),c=Us(c,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=c,this}setXYZW(e,t,r,c,p){return e=e*this.data.stride+this.offset,this.normalized&&(t=Us(t,this.array),r=Us(r,this.array),c=Us(c,this.array),p=Us(p,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=c,this.data.array[e+3]=p,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let r=0;r<this.count;r++){const c=r*this.data.stride+this.offset;for(let p=0;p<this.itemSize;p++)t.push(this.data.array[c+p])}return new As(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Dc(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let r=0;r<this.count;r++){const c=r*this.data.stride+this.offset;for(let p=0;p<this.itemSize;p++)t.push(this.data.array[c+p])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class py extends ol{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Dn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let wm;const l_=new ft,bm=new ft,Bm=new ft,Cm=new Di,c_=new Di,ZI=new ar,px=new ft,h_=new ft,fx=new ft,fT=new Di,Hw=new Di,mT=new Di;class $2 extends ls{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",wm===void 0){wm=new br;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new jv(t,5);wm.setIndex([0,1,2,0,2,3]),wm.setAttribute("position",new Dc(r,3,0,!1)),wm.setAttribute("uv",new Dc(r,2,3,!1))}this.geometry=wm,this.material=e!==void 0?e:new py,this.center=new Di(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),bm.setFromMatrixScale(this.matrixWorld),ZI.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Bm.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&bm.multiplyScalar(-Bm.z);const r=this.material.rotation;let c,p;r!==0&&(p=Math.cos(r),c=Math.sin(r));const y=this.center;mx(px.set(-.5,-.5,0),Bm,y,bm,c,p),mx(h_.set(.5,-.5,0),Bm,y,bm,c,p),mx(fx.set(.5,.5,0),Bm,y,bm,c,p),fT.set(0,0),Hw.set(1,0),mT.set(1,1);let i=e.ray.intersectTriangle(px,h_,fx,!1,l_);if(i===null&&(mx(h_.set(-.5,.5,0),Bm,y,bm,c,p),Hw.set(0,1),i=e.ray.intersectTriangle(px,fx,h_,!1,l_),i===null))return;const C=e.ray.origin.distanceTo(l_);C<e.near||C>e.far||t.push({distance:C,point:l_.clone(),uv:wh.getUV(l_,px,h_,fx,fT,Hw,mT,new Di),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function mx(u,e,t,r,c,p){Cm.subVectors(u,t).addScalar(.5).multiply(r),c!==void 0?(c_.x=p*Cm.x-c*Cm.y,c_.y=c*Cm.x+p*Cm.y):c_.copy(Cm),u.copy(e),u.x+=c_.x,u.y+=c_.y,u.applyMatrix4(ZI)}const gx=new ft,gT=new ft;class XI extends ls{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let r=0,c=t.length;r<c;r++){const p=t[r];this.addLevel(p.object.clone(),p.distance,p.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,r=0){t=Math.abs(t);const c=this.levels;let p;for(p=0;p<c.length&&!(t<c[p].distance);p++);return c.splice(p,0,{distance:t,hysteresis:r,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let r,c;for(r=1,c=t.length;r<c;r++){let p=t[r].distance;if(t[r].object.visible&&(p-=p*t[r].hysteresis),e<p)break}return t[r-1].object}return null}raycast(e,t){if(this.levels.length>0){gx.setFromMatrixPosition(this.matrixWorld);const c=e.ray.origin.distanceTo(gx);this.getObjectForDistance(c).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){gx.setFromMatrixPosition(e.matrixWorld),gT.setFromMatrixPosition(this.matrixWorld);const r=gx.distanceTo(gT)/e.zoom;t[0].object.visible=!0;let c,p;for(c=1,p=t.length;c<p;c++){let y=t[c].distance;if(t[c].object.visible&&(y-=y*t[c].hysteresis),r>=y)t[c-1].object.visible=!1,t[c].object.visible=!0;else break}for(this._currentLevel=c-1;c<p;c++)t[c].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const r=this.levels;for(let c=0,p=r.length;c<p;c++){const y=r[c];t.object.levels.push({object:y.object.uuid,distance:y.distance,hysteresis:y.hysteresis})}return t}}const _T=new ft,yT=new as,xT=new as,CN=new ft,vT=new ar;class qI extends us{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ar,this.bindMatrixInverse=new ar}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new as,t=this.geometry.attributes.skinWeight;for(let r=0,c=t.count;r<c;r++){e.fromBufferAttribute(t,r);const p=1/e.manhattanLength();p!==1/0?e.multiplyScalar(p):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const r=this.skeleton,c=this.geometry;yT.fromBufferAttribute(c.attributes.skinIndex,e),xT.fromBufferAttribute(c.attributes.skinWeight,e),_T.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let p=0;p<4;p++){const y=xT.getComponent(p);if(y!==0){const i=yT.getComponent(p);vT.multiplyMatrices(r.bones[i].matrixWorld,r.boneInverses[i]),t.addScaledVector(CN.copy(_T).applyMatrix4(vT),y)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Z2 extends ls{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Qm extends To{constructor(e=null,t=1,r=1,c,p,y,i,C,D=Co,R=Co,Q,z){super(null,y,i,C,D,R,c,p,Q,z),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const wT=new ar,EN=new ar;class Kv{constructor(e=[],t=[]){this.uuid=Pc(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,c=this.bones.length;r<c;r++)this.boneInverses.push(new ar)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const r=new ar;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,t=this.boneInverses,r=this.boneMatrices,c=this.boneTexture;for(let p=0,y=e.length;p<y;p++){const i=e[p]?e[p].matrixWorld:EN;wT.multiplyMatrices(i,t[p]),wT.toArray(r,p*16)}c!==null&&(c.needsUpdate=!0)}clone(){return new Kv(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=DI(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const r=new Qm(t,e,e,Dl,GA);return r.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=r,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,r=this.bones.length;t<r;t++){const c=this.bones[t];if(c.name===e)return c}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let r=0,c=e.bones.length;r<c;r++){const p=e.bones[r];let y=t[p];y===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",p),y=new Z2),this.bones.push(y),this.boneInverses.push(new ar().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,r=this.boneInverses;for(let c=0,p=t.length;c<p;c++){const y=t[c];e.bones.push(y.uuid);const i=r[c];e.boneInverses.push(i.toArray())}return e}}class Km extends As{constructor(e,t,r,c=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=c}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const bT=new ar,BT=new ar,_x=[],TN=new ar,u_=new us;class YI extends us{constructor(e,t,r){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Km(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,this.frustumCulled=!1;for(let c=0;c<r;c++)this.setMatrixAt(c,TN)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const r=this.matrixWorld,c=this.count;if(u_.geometry=this.geometry,u_.material=this.material,u_.material!==void 0)for(let p=0;p<c;p++){this.getMatrixAt(p,bT),BT.multiplyMatrices(r,bT),u_.matrixWorld=BT,u_.raycast(e,_x);for(let y=0,i=_x.length;y<i;y++){const C=_x[y];C.instanceId=p,C.object=this,t.push(C)}_x.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Km(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class ra extends ol{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Dn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const CT=new ft,ET=new ft,TT=new ar,Gw=new cy,yx=new XA;class Ku extends ls{constructor(e=new br,t=new ra){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[0];for(let c=1,p=t.count;c<p;c++)CT.fromBufferAttribute(t,c-1),ET.fromBufferAttribute(t,c),r[c]=r[c-1],r[c]+=CT.distanceTo(ET);e.setAttribute("lineDistance",new jn(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const r=this.geometry,c=this.matrixWorld,p=e.params.Line.threshold,y=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),yx.copy(r.boundingSphere),yx.applyMatrix4(c),yx.radius+=p,e.ray.intersectsSphere(yx)===!1)return;TT.copy(c).invert(),Gw.copy(e.ray).applyMatrix4(TT);const i=p/((this.scale.x+this.scale.y+this.scale.z)/3),C=i*i,D=new ft,R=new ft,Q=new ft,z=new ft,G=this.isLineSegments?2:1,J=r.index,B=r.attributes.position;if(J!==null){const ae=Math.max(0,y.start),ce=Math.min(J.count,y.start+y.count);for(let Ae=ae,we=ce-1;Ae<we;Ae+=G){const me=J.getX(Ae),De=J.getX(Ae+1);if(D.fromBufferAttribute(B,me),R.fromBufferAttribute(B,De),Gw.distanceSqToSegment(D,R,z,Q)>C)continue;z.applyMatrix4(this.matrixWorld);const Fe=e.ray.origin.distanceTo(z);Fe<e.near||Fe>e.far||t.push({distance:Fe,point:Q.clone().applyMatrix4(this.matrixWorld),index:Ae,face:null,faceIndex:null,object:this})}}else{const ae=Math.max(0,y.start),ce=Math.min(B.count,y.start+y.count);for(let Ae=ae,we=ce-1;Ae<we;Ae+=G){if(D.fromBufferAttribute(B,Ae),R.fromBufferAttribute(B,Ae+1),Gw.distanceSqToSegment(D,R,z,Q)>C)continue;z.applyMatrix4(this.matrixWorld);const De=e.ray.origin.distanceTo(z);De<e.near||De>e.far||t.push({distance:De,point:Q.clone().applyMatrix4(this.matrixWorld),index:Ae,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const c=t[r[0]];if(c!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let p=0,y=c.length;p<y;p++){const i=c[p].name||String(p);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=p}}}}}const ST=new ft,MT=new ft;class Yu extends Ku{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let c=0,p=t.count;c<p;c+=2)ST.fromBufferAttribute(t,c),MT.fromBufferAttribute(t,c+1),r[c]=c===0?0:r[c-1],r[c+1]=r[c]+ST.distanceTo(MT);e.setAttribute("lineDistance",new jn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class mv extends Ku{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class X2 extends ol{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Dn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const IT=new ar,c2=new cy,xx=new XA,vx=new ft;class q2 extends ls{constructor(e=new br,t=new X2){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const r=this.geometry,c=this.matrixWorld,p=e.params.Points.threshold,y=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),xx.copy(r.boundingSphere),xx.applyMatrix4(c),xx.radius+=p,e.ray.intersectsSphere(xx)===!1)return;IT.copy(c).invert(),c2.copy(e.ray).applyMatrix4(IT);const i=p/((this.scale.x+this.scale.y+this.scale.z)/3),C=i*i,D=r.index,Q=r.attributes.position;if(D!==null){const z=Math.max(0,y.start),G=Math.min(D.count,y.start+y.count);for(let J=z,Y=G;J<Y;J++){const B=D.getX(J);vx.fromBufferAttribute(Q,B),FT(vx,B,C,c,e,t,this)}}else{const z=Math.max(0,y.start),G=Math.min(Q.count,y.start+y.count);for(let J=z,Y=G;J<Y;J++)vx.fromBufferAttribute(Q,J),FT(vx,J,C,c,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const c=t[r[0]];if(c!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let p=0,y=c.length;p<y;p++){const i=c[p].name||String(p);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=p}}}}}function FT(u,e,t,r,c,p,y){const i=c2.distanceSqToPoint(u);if(i<t){const C=new ft;c2.closestPointToPoint(u,C),C.applyMatrix4(r);const D=c.ray.origin.distanceTo(C);if(D<c.near||D>c.far)return;p.push({distance:D,distanceToRay:Math.sqrt(i),point:C,index:e,face:null,object:y})}}class SN extends To{constructor(e,t,r,c,p,y,i,C,D){super(e,t,r,c,p,y,i,C,D),this.isVideoTexture=!0,this.minFilter=y!==void 0?y:Xs,this.magFilter=p!==void 0?p:Xs,this.generateMipmaps=!1;const R=this;function Q(){R.needsUpdate=!0,e.requestVideoFrameCallback(Q)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(Q)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class MN extends To{constructor(e,t,r){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=r,this.magFilter=Co,this.minFilter=Co,this.generateMipmaps=!1,this.needsUpdate=!0}}class Y2 extends To{constructor(e,t,r,c,p,y,i,C,D,R,Q,z){super(null,y,i,C,D,R,c,p,Q,z),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class IN extends Y2{constructor(e,t,r,c,p,y){super(e,t,r,p,y),this.isCompressedArrayTexture=!0,this.image.depth=c,this.wrapR=nl}}class JI extends To{constructor(e,t,r,c,p,y,i,C,D){super(e,t,r,c,p,y,i,C,D),this.isCanvasTexture=!0,this.needsUpdate=!0}}class du{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,c=this.getPoint(0),p=0;t.push(0);for(let y=1;y<=e;y++)r=this.getPoint(y/e),p+=r.distanceTo(c),t.push(p),c=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let c=0;const p=r.length;let y;t?y=t:y=e*r[p-1];let i=0,C=p-1,D;for(;i<=C;)if(c=Math.floor(i+(C-i)/2),D=r[c]-y,D<0)i=c+1;else if(D>0)C=c-1;else{C=c;break}if(c=C,r[c]===y)return c/(p-1);const R=r[c],z=r[c+1]-R,G=(y-R)/z;return(c+G)/(p-1)}getTangent(e,t){let c=e-1e-4,p=e+1e-4;c<0&&(c=0),p>1&&(p=1);const y=this.getPoint(c),i=this.getPoint(p),C=t||(y.isVector2?new Di:new ft);return C.copy(i).sub(y).normalize(),C}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new ft,c=[],p=[],y=[],i=new ft,C=new ar;for(let G=0;G<=e;G++){const J=G/e;c[G]=this.getTangentAt(J,new ft)}p[0]=new ft,y[0]=new ft;let D=Number.MAX_VALUE;const R=Math.abs(c[0].x),Q=Math.abs(c[0].y),z=Math.abs(c[0].z);R<=D&&(D=R,r.set(1,0,0)),Q<=D&&(D=Q,r.set(0,1,0)),z<=D&&r.set(0,0,1),i.crossVectors(c[0],r).normalize(),p[0].crossVectors(c[0],i),y[0].crossVectors(c[0],p[0]);for(let G=1;G<=e;G++){if(p[G]=p[G-1].clone(),y[G]=y[G-1].clone(),i.crossVectors(c[G-1],c[G]),i.length()>Number.EPSILON){i.normalize();const J=Math.acos(Eo(c[G-1].dot(c[G]),-1,1));p[G].applyMatrix4(C.makeRotationAxis(i,J))}y[G].crossVectors(c[G],p[G])}if(t===!0){let G=Math.acos(Eo(p[0].dot(p[e]),-1,1));G/=e,c[0].dot(i.crossVectors(p[0],p[e]))>0&&(G=-G);for(let J=1;J<=e;J++)p[J].applyMatrix4(C.makeRotationAxis(c[J],G*J)),y[J].crossVectors(c[J],p[J])}return{tangents:c,normals:p,binormals:y}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class $v extends du{constructor(e=0,t=0,r=1,c=1,p=0,y=Math.PI*2,i=!1,C=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=c,this.aStartAngle=p,this.aEndAngle=y,this.aClockwise=i,this.aRotation=C}getPoint(e,t){const r=t||new Di,c=Math.PI*2;let p=this.aEndAngle-this.aStartAngle;const y=Math.abs(p)<Number.EPSILON;for(;p<0;)p+=c;for(;p>c;)p-=c;p<Number.EPSILON&&(y?p=0:p=c),this.aClockwise===!0&&!y&&(p===c?p=-c:p=p-c);const i=this.aStartAngle+e*p;let C=this.aX+this.xRadius*Math.cos(i),D=this.aY+this.yRadius*Math.sin(i);if(this.aRotation!==0){const R=Math.cos(this.aRotation),Q=Math.sin(this.aRotation),z=C-this.aX,G=D-this.aY;C=z*R-G*Q+this.aX,D=z*Q+G*R+this.aY}return r.set(C,D)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class eF extends $v{constructor(e,t,r,c,p,y){super(e,t,r,r,c,p,y),this.isArcCurve=!0,this.type="ArcCurve"}}function J2(){let u=0,e=0,t=0,r=0;function c(p,y,i,C){u=p,e=i,t=-3*p+3*y-2*i-C,r=2*p-2*y+i+C}return{initCatmullRom:function(p,y,i,C,D){c(y,i,D*(i-p),D*(C-y))},initNonuniformCatmullRom:function(p,y,i,C,D,R,Q){let z=(y-p)/D-(i-p)/(D+R)+(i-y)/R,G=(i-y)/R-(C-y)/(R+Q)+(C-i)/Q;z*=R,G*=R,c(y,i,z,G)},calc:function(p){const y=p*p,i=y*p;return u+e*p+t*y+r*i}}}const wx=new ft,Ww=new J2,jw=new J2,Kw=new J2;class $_ extends du{constructor(e=[],t=!1,r="centripetal",c=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=c}getPoint(e,t=new ft){const r=t,c=this.points,p=c.length,y=(p-(this.closed?0:1))*e;let i=Math.floor(y),C=y-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/p)+1)*p:C===0&&i===p-1&&(i=p-2,C=1);let D,R;this.closed||i>0?D=c[(i-1)%p]:(wx.subVectors(c[0],c[1]).add(c[0]),D=wx);const Q=c[i%p],z=c[(i+1)%p];if(this.closed||i+2<p?R=c[(i+2)%p]:(wx.subVectors(c[p-1],c[p-2]).add(c[p-1]),R=wx),this.curveType==="centripetal"||this.curveType==="chordal"){const G=this.curveType==="chordal"?.5:.25;let J=Math.pow(D.distanceToSquared(Q),G),Y=Math.pow(Q.distanceToSquared(z),G),B=Math.pow(z.distanceToSquared(R),G);Y<1e-4&&(Y=1),J<1e-4&&(J=Y),B<1e-4&&(B=Y),Ww.initNonuniformCatmullRom(D.x,Q.x,z.x,R.x,J,Y,B),jw.initNonuniformCatmullRom(D.y,Q.y,z.y,R.y,J,Y,B),Kw.initNonuniformCatmullRom(D.z,Q.z,z.z,R.z,J,Y,B)}else this.curveType==="catmullrom"&&(Ww.initCatmullRom(D.x,Q.x,z.x,R.x,this.tension),jw.initCatmullRom(D.y,Q.y,z.y,R.y,this.tension),Kw.initCatmullRom(D.z,Q.z,z.z,R.z,this.tension));return r.set(Ww.calc(C),jw.calc(C),Kw.calc(C)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(c.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const c=this.points[t];e.points.push(c.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(new ft().fromArray(c))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function LT(u,e,t,r,c){const p=(r-e)*.5,y=(c-t)*.5,i=u*u,C=u*i;return(2*t-2*r+p+y)*C+(-3*t+3*r-2*p-y)*i+p*u+t}function FN(u,e){const t=1-u;return t*t*e}function LN(u,e){return 2*(1-u)*u*e}function DN(u,e){return u*u*e}function F_(u,e,t,r){return FN(u,e)+LN(u,t)+DN(u,r)}function PN(u,e){const t=1-u;return t*t*t*e}function UN(u,e){const t=1-u;return 3*t*t*u*e}function RN(u,e){return 3*(1-u)*u*u*e}function zN(u,e){return u*u*u*e}function L_(u,e,t,r,c){return PN(u,e)+UN(u,t)+RN(u,r)+zN(u,c)}class eB extends du{constructor(e=new Di,t=new Di,r=new Di,c=new Di){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=c}getPoint(e,t=new Di){const r=t,c=this.v0,p=this.v1,y=this.v2,i=this.v3;return r.set(L_(e,c.x,p.x,y.x,i.x),L_(e,c.y,p.y,y.y,i.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class tF extends du{constructor(e=new ft,t=new ft,r=new ft,c=new ft){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=c}getPoint(e,t=new ft){const r=t,c=this.v0,p=this.v1,y=this.v2,i=this.v3;return r.set(L_(e,c.x,p.x,y.x,i.x),L_(e,c.y,p.y,y.y,i.y),L_(e,c.z,p.z,y.z,i.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Zv extends du{constructor(e=new Di,t=new Di){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Di){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const r=t||new Di;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class iF extends du{constructor(e=new ft,t=new ft){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ft){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class tB extends du{constructor(e=new Di,t=new Di,r=new Di){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new Di){const r=t,c=this.v0,p=this.v1,y=this.v2;return r.set(F_(e,c.x,p.x,y.x),F_(e,c.y,p.y,y.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class iB extends du{constructor(e=new ft,t=new ft,r=new ft){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new ft){const r=t,c=this.v0,p=this.v1,y=this.v2;return r.set(F_(e,c.x,p.x,y.x),F_(e,c.y,p.y,y.y),F_(e,c.z,p.z,y.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class nB extends du{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Di){const r=t,c=this.points,p=(c.length-1)*e,y=Math.floor(p),i=p-y,C=c[y===0?y:y-1],D=c[y],R=c[y>c.length-2?c.length-1:y+1],Q=c[y>c.length-3?c.length-1:y+2];return r.set(LT(i,C.x,D.x,R.x,Q.x),LT(i,C.y,D.y,R.y,Q.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(c.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const c=this.points[t];e.points.push(c.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const c=e.points[t];this.points.push(new Di().fromArray(c))}return this}}var rB=Object.freeze({__proto__:null,ArcCurve:eF,CatmullRomCurve3:$_,CubicBezierCurve:eB,CubicBezierCurve3:tF,EllipseCurve:$v,LineCurve:Zv,LineCurve3:iF,QuadraticBezierCurve:tB,QuadraticBezierCurve3:iB,SplineCurve:nB});class nF extends du{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Zv(t,e))}getPoint(e,t){const r=e*this.getLength(),c=this.getCurveLengths();let p=0;for(;p<c.length;){if(c[p]>=r){const y=c[p]-r,i=this.curves[p],C=i.getLength(),D=C===0?0:1-y/C;return i.getPointAt(D,t)}p++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let r=0,c=this.curves.length;r<c;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let r;for(let c=0,p=this.curves;c<p.length;c++){const y=p[c],i=y.isEllipseCurve?e*2:y.isLineCurve||y.isLineCurve3?1:y.isSplineCurve?e*y.points.length:e,C=y.getPoints(i);for(let D=0;D<C.length;D++){const R=C[D];r&&r.equals(R)||(t.push(R),r=R)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const c=e.curves[t];this.curves.push(c.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){const c=this.curves[t];e.curves.push(c.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const c=e.curves[t];this.curves.push(new rB[c.type]().fromJSON(c))}return this}}class Z_ extends nF{constructor(e){super(),this.type="Path",this.currentPoint=new Di,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const r=new Zv(this.currentPoint.clone(),new Di(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,c){const p=new tB(this.currentPoint.clone(),new Di(e,t),new Di(r,c));return this.curves.push(p),this.currentPoint.set(r,c),this}bezierCurveTo(e,t,r,c,p,y){const i=new eB(this.currentPoint.clone(),new Di(e,t),new Di(r,c),new Di(p,y));return this.curves.push(i),this.currentPoint.set(p,y),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),r=new nB(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,c,p,y){const i=this.currentPoint.x,C=this.currentPoint.y;return this.absarc(e+i,t+C,r,c,p,y),this}absarc(e,t,r,c,p,y){return this.absellipse(e,t,r,r,c,p,y),this}ellipse(e,t,r,c,p,y,i,C){const D=this.currentPoint.x,R=this.currentPoint.y;return this.absellipse(e+D,t+R,r,c,p,y,i,C),this}absellipse(e,t,r,c,p,y,i,C){const D=new $v(e,t,r,c,p,y,i,C);if(this.curves.length>0){const Q=D.getPoint(0);Q.equals(this.currentPoint)||this.lineTo(Q.x,Q.y)}this.curves.push(D);const R=D.getPoint(1);return this.currentPoint.copy(R),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Jm extends br{constructor(e=[new Di(0,-.5),new Di(.5,0),new Di(0,.5)],t=12,r=0,c=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:c},t=Math.floor(t),c=Eo(c,0,Math.PI*2);const p=[],y=[],i=[],C=[],D=[],R=1/t,Q=new ft,z=new Di,G=new ft,J=new ft,Y=new ft;let B=0,ae=0;for(let ce=0;ce<=e.length-1;ce++)switch(ce){case 0:B=e[ce+1].x-e[ce].x,ae=e[ce+1].y-e[ce].y,G.x=ae*1,G.y=-B,G.z=ae*0,Y.copy(G),G.normalize(),C.push(G.x,G.y,G.z);break;case e.length-1:C.push(Y.x,Y.y,Y.z);break;default:B=e[ce+1].x-e[ce].x,ae=e[ce+1].y-e[ce].y,G.x=ae*1,G.y=-B,G.z=ae*0,J.copy(G),G.x+=Y.x,G.y+=Y.y,G.z+=Y.z,G.normalize(),C.push(G.x,G.y,G.z),Y.copy(J)}for(let ce=0;ce<=t;ce++){const Ae=r+ce*R*c,we=Math.sin(Ae),me=Math.cos(Ae);for(let De=0;De<=e.length-1;De++){Q.x=e[De].x*we,Q.y=e[De].y,Q.z=e[De].x*me,y.push(Q.x,Q.y,Q.z),z.x=ce/t,z.y=De/(e.length-1),i.push(z.x,z.y);const Je=C[3*De+0]*we,Fe=C[3*De+1],Ge=C[3*De+0]*me;D.push(Je,Fe,Ge)}}for(let ce=0;ce<t;ce++)for(let Ae=0;Ae<e.length-1;Ae++){const we=Ae+ce*e.length,me=we,De=we+e.length,Je=we+e.length+1,Fe=we+1;p.push(me,De,Fe),p.push(Je,Fe,De)}this.setIndex(p),this.setAttribute("position",new jn(y,3)),this.setAttribute("uv",new jn(i,2)),this.setAttribute("normal",new jn(D,3))}static fromJSON(e){return new Jm(e.points,e.segments,e.phiStart,e.phiLength)}}class fy extends Jm{constructor(e=1,t=1,r=4,c=8){const p=new Z_;p.absarc(0,-t/2,e,Math.PI*1.5,0),p.absarc(0,t/2,e,0,Math.PI*.5),super(p.getPoints(r),c),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:r,radialSegments:c}}static fromJSON(e){return new fy(e.radius,e.length,e.capSegments,e.radialSegments)}}class my extends br{constructor(e=1,t=32,r=0,c=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:c},t=Math.max(3,t);const p=[],y=[],i=[],C=[],D=new ft,R=new Di;y.push(0,0,0),i.push(0,0,1),C.push(.5,.5);for(let Q=0,z=3;Q<=t;Q++,z+=3){const G=r+Q/t*c;D.x=e*Math.cos(G),D.y=e*Math.sin(G),y.push(D.x,D.y,D.z),i.push(0,0,1),R.x=(y[z]/e+1)/2,R.y=(y[z+1]/e+1)/2,C.push(R.x,R.y)}for(let Q=1;Q<=t;Q++)p.push(Q,Q+1,0);this.setIndex(p),this.setAttribute("position",new jn(y,3)),this.setAttribute("normal",new jn(i,3)),this.setAttribute("uv",new jn(C,2))}static fromJSON(e){return new my(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class vf extends br{constructor(e=1,t=1,r=1,c=32,p=1,y=!1,i=0,C=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:c,heightSegments:p,openEnded:y,thetaStart:i,thetaLength:C};const D=this;c=Math.floor(c),p=Math.floor(p);const R=[],Q=[],z=[],G=[];let J=0;const Y=[],B=r/2;let ae=0;ce(),y===!1&&(e>0&&Ae(!0),t>0&&Ae(!1)),this.setIndex(R),this.setAttribute("position",new jn(Q,3)),this.setAttribute("normal",new jn(z,3)),this.setAttribute("uv",new jn(G,2));function ce(){const we=new ft,me=new ft;let De=0;const Je=(t-e)/r;for(let Fe=0;Fe<=p;Fe++){const Ge=[],Et=Fe/p,li=Et*(t-e)+e;for(let xi=0;xi<=c;xi++){const te=xi/c,le=te*C+i,ye=Math.sin(le),xe=Math.cos(le);me.x=li*ye,me.y=-Et*r+B,me.z=li*xe,Q.push(me.x,me.y,me.z),we.set(ye,Je,xe).normalize(),z.push(we.x,we.y,we.z),G.push(te,1-Et),Ge.push(J++)}Y.push(Ge)}for(let Fe=0;Fe<c;Fe++)for(let Ge=0;Ge<p;Ge++){const Et=Y[Ge][Fe],li=Y[Ge+1][Fe],xi=Y[Ge+1][Fe+1],te=Y[Ge][Fe+1];R.push(Et,li,te),R.push(li,xi,te),De+=6}D.addGroup(ae,De,0),ae+=De}function Ae(we){const me=J,De=new Di,Je=new ft;let Fe=0;const Ge=we===!0?e:t,Et=we===!0?1:-1;for(let xi=1;xi<=c;xi++)Q.push(0,B*Et,0),z.push(0,Et,0),G.push(.5,.5),J++;const li=J;for(let xi=0;xi<=c;xi++){const le=xi/c*C+i,ye=Math.cos(le),xe=Math.sin(le);Je.x=Ge*xe,Je.y=B*Et,Je.z=Ge*ye,Q.push(Je.x,Je.y,Je.z),z.push(0,Et,0),De.x=ye*.5+.5,De.y=xe*.5*Et+.5,G.push(De.x,De.y),J++}for(let xi=0;xi<c;xi++){const te=me+xi,le=li+xi;we===!0?R.push(le,le+1,te):R.push(le+1,le,te),Fe+=3}D.addGroup(ae,Fe,we===!0?1:2),ae+=Fe}}static fromJSON(e){return new vf(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class gf extends vf{constructor(e=1,t=1,r=32,c=1,p=!1,y=0,i=Math.PI*2){super(0,e,t,r,c,p,y,i),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:c,openEnded:p,thetaStart:y,thetaLength:i}}static fromJSON(e){return new gf(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class YA extends br{constructor(e=[],t=[],r=1,c=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:c};const p=[],y=[];i(c),D(r),R(),this.setAttribute("position",new jn(p,3)),this.setAttribute("normal",new jn(p.slice(),3)),this.setAttribute("uv",new jn(y,2)),c===0?this.computeVertexNormals():this.normalizeNormals();function i(ce){const Ae=new ft,we=new ft,me=new ft;for(let De=0;De<t.length;De+=3)G(t[De+0],Ae),G(t[De+1],we),G(t[De+2],me),C(Ae,we,me,ce)}function C(ce,Ae,we,me){const De=me+1,Je=[];for(let Fe=0;Fe<=De;Fe++){Je[Fe]=[];const Ge=ce.clone().lerp(we,Fe/De),Et=Ae.clone().lerp(we,Fe/De),li=De-Fe;for(let xi=0;xi<=li;xi++)xi===0&&Fe===De?Je[Fe][xi]=Ge:Je[Fe][xi]=Ge.clone().lerp(Et,xi/li)}for(let Fe=0;Fe<De;Fe++)for(let Ge=0;Ge<2*(De-Fe)-1;Ge++){const Et=Math.floor(Ge/2);Ge%2===0?(z(Je[Fe][Et+1]),z(Je[Fe+1][Et]),z(Je[Fe][Et])):(z(Je[Fe][Et+1]),z(Je[Fe+1][Et+1]),z(Je[Fe+1][Et]))}}function D(ce){const Ae=new ft;for(let we=0;we<p.length;we+=3)Ae.x=p[we+0],Ae.y=p[we+1],Ae.z=p[we+2],Ae.normalize().multiplyScalar(ce),p[we+0]=Ae.x,p[we+1]=Ae.y,p[we+2]=Ae.z}function R(){const ce=new ft;for(let Ae=0;Ae<p.length;Ae+=3){ce.x=p[Ae+0],ce.y=p[Ae+1],ce.z=p[Ae+2];const we=B(ce)/2/Math.PI+.5,me=ae(ce)/Math.PI+.5;y.push(we,1-me)}J(),Q()}function Q(){for(let ce=0;ce<y.length;ce+=6){const Ae=y[ce+0],we=y[ce+2],me=y[ce+4],De=Math.max(Ae,we,me),Je=Math.min(Ae,we,me);De>.9&&Je<.1&&(Ae<.2&&(y[ce+0]+=1),we<.2&&(y[ce+2]+=1),me<.2&&(y[ce+4]+=1))}}function z(ce){p.push(ce.x,ce.y,ce.z)}function G(ce,Ae){const we=ce*3;Ae.x=e[we+0],Ae.y=e[we+1],Ae.z=e[we+2]}function J(){const ce=new ft,Ae=new ft,we=new ft,me=new ft,De=new Di,Je=new Di,Fe=new Di;for(let Ge=0,Et=0;Ge<p.length;Ge+=9,Et+=6){ce.set(p[Ge+0],p[Ge+1],p[Ge+2]),Ae.set(p[Ge+3],p[Ge+4],p[Ge+5]),we.set(p[Ge+6],p[Ge+7],p[Ge+8]),De.set(y[Et+0],y[Et+1]),Je.set(y[Et+2],y[Et+3]),Fe.set(y[Et+4],y[Et+5]),me.copy(ce).add(Ae).add(we).divideScalar(3);const li=B(me);Y(De,Et+0,ce,li),Y(Je,Et+2,Ae,li),Y(Fe,Et+4,we,li)}}function Y(ce,Ae,we,me){me<0&&ce.x===1&&(y[Ae]=ce.x-1),we.x===0&&we.z===0&&(y[Ae]=me/2/Math.PI+.5)}function B(ce){return Math.atan2(ce.z,-ce.x)}function ae(ce){return Math.atan2(-ce.y,Math.sqrt(ce.x*ce.x+ce.z*ce.z))}}static fromJSON(e){return new YA(e.vertices,e.indices,e.radius,e.details)}}class gy extends YA{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,c=1/r,p=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-c,-r,0,-c,r,0,c,-r,0,c,r,-c,-r,0,-c,r,0,c,-r,0,c,r,0,-r,0,-c,r,0,-c,-r,0,c,r,0,c],y=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(p,y,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new gy(e.radius,e.detail)}}const bx=new ft,Bx=new ft,$w=new ft,Cx=new wh;class rF extends br{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const c=Math.pow(10,4),p=Math.cos(Af*t),y=e.getIndex(),i=e.getAttribute("position"),C=y?y.count:i.count,D=[0,0,0],R=["a","b","c"],Q=new Array(3),z={},G=[];for(let J=0;J<C;J+=3){y?(D[0]=y.getX(J),D[1]=y.getX(J+1),D[2]=y.getX(J+2)):(D[0]=J,D[1]=J+1,D[2]=J+2);const{a:Y,b:B,c:ae}=Cx;if(Y.fromBufferAttribute(i,D[0]),B.fromBufferAttribute(i,D[1]),ae.fromBufferAttribute(i,D[2]),Cx.getNormal($w),Q[0]=`${Math.round(Y.x*c)},${Math.round(Y.y*c)},${Math.round(Y.z*c)}`,Q[1]=`${Math.round(B.x*c)},${Math.round(B.y*c)},${Math.round(B.z*c)}`,Q[2]=`${Math.round(ae.x*c)},${Math.round(ae.y*c)},${Math.round(ae.z*c)}`,!(Q[0]===Q[1]||Q[1]===Q[2]||Q[2]===Q[0]))for(let ce=0;ce<3;ce++){const Ae=(ce+1)%3,we=Q[ce],me=Q[Ae],De=Cx[R[ce]],Je=Cx[R[Ae]],Fe=`${we}_${me}`,Ge=`${me}_${we}`;Ge in z&&z[Ge]?($w.dot(z[Ge].normal)<=p&&(G.push(De.x,De.y,De.z),G.push(Je.x,Je.y,Je.z)),z[Ge]=null):Fe in z||(z[Fe]={index0:D[ce],index1:D[Ae],normal:$w.clone()})}}for(const J in z)if(z[J]){const{index0:Y,index1:B}=z[J];bx.fromBufferAttribute(i,Y),Bx.fromBufferAttribute(i,B),G.push(bx.x,bx.y,bx.z),G.push(Bx.x,Bx.y,Bx.z)}this.setAttribute("position",new jn(G,3))}}}class tp extends Z_{constructor(e){super(e),this.uuid=Pc(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let r=0,c=this.holes.length;r<c;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const c=e.holes[t];this.holes.push(c.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){const c=this.holes[t];e.holes.push(c.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const c=e.holes[t];this.holes.push(new Z_().fromJSON(c))}return this}}const kN={triangulate:function(u,e,t=2){const r=e&&e.length,c=r?e[0]*t:u.length;let p=sF(u,0,c,t,!0);const y=[];if(!p||p.next===p.prev)return y;let i,C,D,R,Q,z,G;if(r&&(p=HN(u,e,p,t)),u.length>80*t){i=D=u[0],C=R=u[1];for(let J=t;J<c;J+=t)Q=u[J],z=u[J+1],Q<i&&(i=Q),z<C&&(C=z),Q>D&&(D=Q),z>R&&(R=z);G=Math.max(D-i,R-C),G=G!==0?32767/G:0}return X_(p,y,t,i,C,G,0),y}};function sF(u,e,t,r,c){let p,y;if(c===eQ(u,e,t,r)>0)for(p=e;p<t;p+=r)y=DT(p,u[p],u[p+1],y);else for(p=t-r;p>=e;p-=r)y=DT(p,u[p],u[p+1],y);return y&&Xv(y,y.next)&&(Y_(y),y=y.next),y}function _f(u,e){if(!u)return u;e||(e=u);let t=u,r;do if(r=!1,!t.steiner&&(Xv(t,t.next)||co(t.prev,t,t.next)===0)){if(Y_(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function X_(u,e,t,r,c,p,y){if(!u)return;!y&&p&&$N(u,r,c,p);let i=u,C,D;for(;u.prev!==u.next;){if(C=u.prev,D=u.next,p?NN(u,r,c,p):ON(u)){e.push(C.i/t|0),e.push(u.i/t|0),e.push(D.i/t|0),Y_(u),u=D.next,i=D.next;continue}if(u=D,u===i){y?y===1?(u=QN(_f(u),e,t),X_(u,e,t,r,c,p,2)):y===2&&VN(u,e,t,r,c,p):X_(_f(u),e,t,r,c,p,1);break}}}function ON(u){const e=u.prev,t=u,r=u.next;if(co(e,t,r)>=0)return!1;const c=e.x,p=t.x,y=r.x,i=e.y,C=t.y,D=r.y,R=c<p?c<y?c:y:p<y?p:y,Q=i<C?i<D?i:D:C<D?C:D,z=c>p?c>y?c:y:p>y?p:y,G=i>C?i>D?i:D:C>D?C:D;let J=r.next;for(;J!==e;){if(J.x>=R&&J.x<=z&&J.y>=Q&&J.y<=G&&Rm(c,i,p,C,y,D,J.x,J.y)&&co(J.prev,J,J.next)>=0)return!1;J=J.next}return!0}function NN(u,e,t,r){const c=u.prev,p=u,y=u.next;if(co(c,p,y)>=0)return!1;const i=c.x,C=p.x,D=y.x,R=c.y,Q=p.y,z=y.y,G=i<C?i<D?i:D:C<D?C:D,J=R<Q?R<z?R:z:Q<z?Q:z,Y=i>C?i>D?i:D:C>D?C:D,B=R>Q?R>z?R:z:Q>z?Q:z,ae=h2(G,J,e,t,r),ce=h2(Y,B,e,t,r);let Ae=u.prevZ,we=u.nextZ;for(;Ae&&Ae.z>=ae&&we&&we.z<=ce;){if(Ae.x>=G&&Ae.x<=Y&&Ae.y>=J&&Ae.y<=B&&Ae!==c&&Ae!==y&&Rm(i,R,C,Q,D,z,Ae.x,Ae.y)&&co(Ae.prev,Ae,Ae.next)>=0||(Ae=Ae.prevZ,we.x>=G&&we.x<=Y&&we.y>=J&&we.y<=B&&we!==c&&we!==y&&Rm(i,R,C,Q,D,z,we.x,we.y)&&co(we.prev,we,we.next)>=0))return!1;we=we.nextZ}for(;Ae&&Ae.z>=ae;){if(Ae.x>=G&&Ae.x<=Y&&Ae.y>=J&&Ae.y<=B&&Ae!==c&&Ae!==y&&Rm(i,R,C,Q,D,z,Ae.x,Ae.y)&&co(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.prevZ}for(;we&&we.z<=ce;){if(we.x>=G&&we.x<=Y&&we.y>=J&&we.y<=B&&we!==c&&we!==y&&Rm(i,R,C,Q,D,z,we.x,we.y)&&co(we.prev,we,we.next)>=0)return!1;we=we.nextZ}return!0}function QN(u,e,t){let r=u;do{const c=r.prev,p=r.next.next;!Xv(c,p)&&oF(c,r,r.next,p)&&q_(c,p)&&q_(p,c)&&(e.push(c.i/t|0),e.push(r.i/t|0),e.push(p.i/t|0),Y_(r),Y_(r.next),r=u=p),r=r.next}while(r!==u);return _f(r)}function VN(u,e,t,r,c,p){let y=u;do{let i=y.next.next;for(;i!==y.prev;){if(y.i!==i.i&&qN(y,i)){let C=aF(y,i);y=_f(y,y.next),C=_f(C,C.next),X_(y,e,t,r,c,p,0),X_(C,e,t,r,c,p,0);return}i=i.next}y=y.next}while(y!==u)}function HN(u,e,t,r){const c=[];let p,y,i,C,D;for(p=0,y=e.length;p<y;p++)i=e[p]*r,C=p<y-1?e[p+1]*r:u.length,D=sF(u,i,C,r,!1),D===D.next&&(D.steiner=!0),c.push(XN(D));for(c.sort(GN),p=0;p<c.length;p++)t=WN(c[p],t);return t}function GN(u,e){return u.x-e.x}function WN(u,e){const t=jN(u,e);if(!t)return e;const r=aF(t,u);return _f(r,r.next),_f(t,t.next)}function jN(u,e){let t=e,r=-1/0,c;const p=u.x,y=u.y;do{if(y<=t.y&&y>=t.next.y&&t.next.y!==t.y){const z=t.x+(y-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(z<=p&&z>r&&(r=z,c=t.x<t.next.x?t:t.next,z===p))return c}t=t.next}while(t!==e);if(!c)return null;const i=c,C=c.x,D=c.y;let R=1/0,Q;t=c;do p>=t.x&&t.x>=C&&p!==t.x&&Rm(y<D?p:r,y,C,D,y<D?r:p,y,t.x,t.y)&&(Q=Math.abs(y-t.y)/(p-t.x),q_(t,u)&&(Q<R||Q===R&&(t.x>c.x||t.x===c.x&&KN(c,t)))&&(c=t,R=Q)),t=t.next;while(t!==i);return c}function KN(u,e){return co(u.prev,u,e.prev)<0&&co(e.next,u,u.next)<0}function $N(u,e,t,r){let c=u;do c.z===0&&(c.z=h2(c.x,c.y,e,t,r)),c.prevZ=c.prev,c.nextZ=c.next,c=c.next;while(c!==u);c.prevZ.nextZ=null,c.prevZ=null,ZN(c)}function ZN(u){let e,t,r,c,p,y,i,C,D=1;do{for(t=u,u=null,p=null,y=0;t;){for(y++,r=t,i=0,e=0;e<D&&(i++,r=r.nextZ,!!r);e++);for(C=D;i>0||C>0&&r;)i!==0&&(C===0||!r||t.z<=r.z)?(c=t,t=t.nextZ,i--):(c=r,r=r.nextZ,C--),p?p.nextZ=c:u=c,c.prevZ=p,p=c;t=r}p.nextZ=null,D*=2}while(y>1);return u}function h2(u,e,t,r,c){return u=(u-t)*c|0,e=(e-r)*c|0,u=(u|u<<8)&16711935,u=(u|u<<4)&252645135,u=(u|u<<2)&858993459,u=(u|u<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,u|e<<1}function XN(u){let e=u,t=u;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==u);return t}function Rm(u,e,t,r,c,p,y,i){return(c-y)*(e-i)>=(u-y)*(p-i)&&(u-y)*(r-i)>=(t-y)*(e-i)&&(t-y)*(p-i)>=(c-y)*(r-i)}function qN(u,e){return u.next.i!==e.i&&u.prev.i!==e.i&&!YN(u,e)&&(q_(u,e)&&q_(e,u)&&JN(u,e)&&(co(u.prev,u,e.prev)||co(u,e.prev,e))||Xv(u,e)&&co(u.prev,u,u.next)>0&&co(e.prev,e,e.next)>0)}function co(u,e,t){return(e.y-u.y)*(t.x-e.x)-(e.x-u.x)*(t.y-e.y)}function Xv(u,e){return u.x===e.x&&u.y===e.y}function oF(u,e,t,r){const c=Tx(co(u,e,t)),p=Tx(co(u,e,r)),y=Tx(co(t,r,u)),i=Tx(co(t,r,e));return!!(c!==p&&y!==i||c===0&&Ex(u,t,e)||p===0&&Ex(u,r,e)||y===0&&Ex(t,u,r)||i===0&&Ex(t,e,r))}function Ex(u,e,t){return e.x<=Math.max(u.x,t.x)&&e.x>=Math.min(u.x,t.x)&&e.y<=Math.max(u.y,t.y)&&e.y>=Math.min(u.y,t.y)}function Tx(u){return u>0?1:u<0?-1:0}function YN(u,e){let t=u;do{if(t.i!==u.i&&t.next.i!==u.i&&t.i!==e.i&&t.next.i!==e.i&&oF(t,t.next,u,e))return!0;t=t.next}while(t!==u);return!1}function q_(u,e){return co(u.prev,u,u.next)<0?co(u,e,u.next)>=0&&co(u,u.prev,e)>=0:co(u,e,u.prev)<0||co(u,u.next,e)<0}function JN(u,e){let t=u,r=!1;const c=(u.x+e.x)/2,p=(u.y+e.y)/2;do t.y>p!=t.next.y>p&&t.next.y!==t.y&&c<(t.next.x-t.x)*(p-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==u);return r}function aF(u,e){const t=new u2(u.i,u.x,u.y),r=new u2(e.i,e.x,e.y),c=u.next,p=e.prev;return u.next=e,e.prev=u,t.next=c,c.prev=t,r.next=t,t.prev=r,p.next=r,r.prev=p,r}function DT(u,e,t,r){const c=new u2(u,e,t);return r?(c.next=r.next,c.prev=r,r.next.prev=c,r.next=c):(c.prev=c,c.next=c),c}function Y_(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function u2(u,e,t){this.i=u,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function eQ(u,e,t,r){let c=0;for(let p=e,y=t-r;p<t;p+=r)c+=(u[y]-u[p])*(u[p+1]+u[y+1]),y=p;return c}class Gu{static area(e){const t=e.length;let r=0;for(let c=t-1,p=0;p<t;c=p++)r+=e[c].x*e[p].y-e[p].x*e[c].y;return r*.5}static isClockWise(e){return Gu.area(e)<0}static triangulateShape(e,t){const r=[],c=[],p=[];PT(e),UT(r,e);let y=e.length;t.forEach(PT);for(let C=0;C<t.length;C++)c.push(y),y+=t[C].length,UT(r,t[C]);const i=kN.triangulate(r,c);for(let C=0;C<i.length;C+=3)p.push(i.slice(C,C+3));return p}}function PT(u){const e=u.length;e>2&&u[e-1].equals(u[0])&&u.pop()}function UT(u,e){for(let t=0;t<e.length;t++)u.push(e[t].x),u.push(e[t].y)}class _y extends br{constructor(e=new tp([new Di(.5,.5),new Di(-.5,.5),new Di(-.5,-.5),new Di(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const r=this,c=[],p=[];for(let i=0,C=e.length;i<C;i++){const D=e[i];y(D)}this.setAttribute("position",new jn(c,3)),this.setAttribute("uv",new jn(p,2)),this.computeVertexNormals();function y(i){const C=[],D=t.curveSegments!==void 0?t.curveSegments:12,R=t.steps!==void 0?t.steps:1,Q=t.depth!==void 0?t.depth:1;let z=t.bevelEnabled!==void 0?t.bevelEnabled:!0,G=t.bevelThickness!==void 0?t.bevelThickness:.2,J=t.bevelSize!==void 0?t.bevelSize:G-.1,Y=t.bevelOffset!==void 0?t.bevelOffset:0,B=t.bevelSegments!==void 0?t.bevelSegments:3;const ae=t.extrudePath,ce=t.UVGenerator!==void 0?t.UVGenerator:tQ;let Ae,we=!1,me,De,Je,Fe;ae&&(Ae=ae.getSpacedPoints(R),we=!0,z=!1,me=ae.computeFrenetFrames(R,!1),De=new ft,Je=new ft,Fe=new ft),z||(B=0,G=0,J=0,Y=0);const Ge=i.extractPoints(D);let Et=Ge.shape;const li=Ge.holes;if(!Gu.isClockWise(Et)){Et=Et.reverse();for(let Ct=0,Ft=li.length;Ct<Ft;Ct++){const Xt=li[Ct];Gu.isClockWise(Xt)&&(li[Ct]=Xt.reverse())}}const te=Gu.triangulateShape(Et,li),le=Et;for(let Ct=0,Ft=li.length;Ct<Ft;Ct++){const Xt=li[Ct];Et=Et.concat(Xt)}function ye(Ct,Ft,Xt){return Ft||console.error("THREE.ExtrudeGeometry: vec does not exist"),Ft.clone().multiplyScalar(Xt).add(Ct)}const xe=Et.length,Re=te.length;function Oe(Ct,Ft,Xt){let _i,fi,Gi;const wn=Ct.x-Ft.x,zi=Ct.y-Ft.y,Gn=Xt.x-Ct.x,kn=Xt.y-Ct.y,yt=wn*wn+zi*zi,rt=wn*kn-zi*Gn;if(Math.abs(rt)>Number.EPSILON){const ti=Math.sqrt(yt),Ni=Math.sqrt(Gn*Gn+kn*kn),qi=Ft.x-zi/ti,en=Ft.y+wn/ti,$t=Xt.x-kn/Ni,at=Xt.y+Gn/Ni,ii=(($t-qi)*kn-(at-en)*Gn)/(wn*kn-zi*Gn);_i=qi+wn*ii-Ct.x,fi=en+zi*ii-Ct.y;const hn=_i*_i+fi*fi;if(hn<=2)return new Di(_i,fi);Gi=Math.sqrt(hn/2)}else{let ti=!1;wn>Number.EPSILON?Gn>Number.EPSILON&&(ti=!0):wn<-Number.EPSILON?Gn<-Number.EPSILON&&(ti=!0):Math.sign(zi)===Math.sign(kn)&&(ti=!0),ti?(_i=-zi,fi=wn,Gi=Math.sqrt(yt)):(_i=wn,fi=zi,Gi=Math.sqrt(yt/2))}return new Di(_i/Gi,fi/Gi)}const We=[];for(let Ct=0,Ft=le.length,Xt=Ft-1,_i=Ct+1;Ct<Ft;Ct++,Xt++,_i++)Xt===Ft&&(Xt=0),_i===Ft&&(_i=0),We[Ct]=Oe(le[Ct],le[Xt],le[_i]);const Ve=[];let Qe,Se=We.concat();for(let Ct=0,Ft=li.length;Ct<Ft;Ct++){const Xt=li[Ct];Qe=[];for(let _i=0,fi=Xt.length,Gi=fi-1,wn=_i+1;_i<fi;_i++,Gi++,wn++)Gi===fi&&(Gi=0),wn===fi&&(wn=0),Qe[_i]=Oe(Xt[_i],Xt[Gi],Xt[wn]);Ve.push(Qe),Se=Se.concat(Qe)}for(let Ct=0;Ct<B;Ct++){const Ft=Ct/B,Xt=G*Math.cos(Ft*Math.PI/2),_i=J*Math.sin(Ft*Math.PI/2)+Y;for(let fi=0,Gi=le.length;fi<Gi;fi++){const wn=ye(le[fi],We[fi],_i);At(wn.x,wn.y,-Xt)}for(let fi=0,Gi=li.length;fi<Gi;fi++){const wn=li[fi];Qe=Ve[fi];for(let zi=0,Gn=wn.length;zi<Gn;zi++){const kn=ye(wn[zi],Qe[zi],_i);At(kn.x,kn.y,-Xt)}}}const Ke=J+Y;for(let Ct=0;Ct<xe;Ct++){const Ft=z?ye(Et[Ct],Se[Ct],Ke):Et[Ct];we?(Je.copy(me.normals[0]).multiplyScalar(Ft.x),De.copy(me.binormals[0]).multiplyScalar(Ft.y),Fe.copy(Ae[0]).add(Je).add(De),At(Fe.x,Fe.y,Fe.z)):At(Ft.x,Ft.y,0)}for(let Ct=1;Ct<=R;Ct++)for(let Ft=0;Ft<xe;Ft++){const Xt=z?ye(Et[Ft],Se[Ft],Ke):Et[Ft];we?(Je.copy(me.normals[Ct]).multiplyScalar(Xt.x),De.copy(me.binormals[Ct]).multiplyScalar(Xt.y),Fe.copy(Ae[Ct]).add(Je).add(De),At(Fe.x,Fe.y,Fe.z)):At(Xt.x,Xt.y,Q/R*Ct)}for(let Ct=B-1;Ct>=0;Ct--){const Ft=Ct/B,Xt=G*Math.cos(Ft*Math.PI/2),_i=J*Math.sin(Ft*Math.PI/2)+Y;for(let fi=0,Gi=le.length;fi<Gi;fi++){const wn=ye(le[fi],We[fi],_i);At(wn.x,wn.y,Q+Xt)}for(let fi=0,Gi=li.length;fi<Gi;fi++){const wn=li[fi];Qe=Ve[fi];for(let zi=0,Gn=wn.length;zi<Gn;zi++){const kn=ye(wn[zi],Qe[zi],_i);we?At(kn.x,kn.y+Ae[R-1].y,Ae[R-1].x+Xt):At(kn.x,kn.y,Q+Xt)}}}nt(),vt();function nt(){const Ct=c.length/3;if(z){let Ft=0,Xt=xe*Ft;for(let _i=0;_i<Re;_i++){const fi=te[_i];ut(fi[2]+Xt,fi[1]+Xt,fi[0]+Xt)}Ft=R+B*2,Xt=xe*Ft;for(let _i=0;_i<Re;_i++){const fi=te[_i];ut(fi[0]+Xt,fi[1]+Xt,fi[2]+Xt)}}else{for(let Ft=0;Ft<Re;Ft++){const Xt=te[Ft];ut(Xt[2],Xt[1],Xt[0])}for(let Ft=0;Ft<Re;Ft++){const Xt=te[Ft];ut(Xt[0]+xe*R,Xt[1]+xe*R,Xt[2]+xe*R)}}r.addGroup(Ct,c.length/3-Ct,0)}function vt(){const Ct=c.length/3;let Ft=0;be(le,Ft),Ft+=le.length;for(let Xt=0,_i=li.length;Xt<_i;Xt++){const fi=li[Xt];be(fi,Ft),Ft+=fi.length}r.addGroup(Ct,c.length/3-Ct,1)}function be(Ct,Ft){let Xt=Ct.length;for(;--Xt>=0;){const _i=Xt;let fi=Xt-1;fi<0&&(fi=Ct.length-1);for(let Gi=0,wn=R+B*2;Gi<wn;Gi++){const zi=xe*Gi,Gn=xe*(Gi+1),kn=Ft+_i+zi,yt=Ft+fi+zi,rt=Ft+fi+Gn,ti=Ft+_i+Gn;Nt(kn,yt,rt,ti)}}}function At(Ct,Ft,Xt){C.push(Ct),C.push(Ft),C.push(Xt)}function ut(Ct,Ft,Xt){Gt(Ct),Gt(Ft),Gt(Xt);const _i=c.length/3,fi=ce.generateTopUV(r,c,_i-3,_i-2,_i-1);Qt(fi[0]),Qt(fi[1]),Qt(fi[2])}function Nt(Ct,Ft,Xt,_i){Gt(Ct),Gt(Ft),Gt(_i),Gt(Ft),Gt(Xt),Gt(_i);const fi=c.length/3,Gi=ce.generateSideWallUV(r,c,fi-6,fi-3,fi-2,fi-1);Qt(Gi[0]),Qt(Gi[1]),Qt(Gi[3]),Qt(Gi[1]),Qt(Gi[2]),Qt(Gi[3])}function Gt(Ct){c.push(C[Ct*3+0]),c.push(C[Ct*3+1]),c.push(C[Ct*3+2])}function Qt(Ct){p.push(Ct.x),p.push(Ct.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return iQ(t,r,e)}static fromJSON(e,t){const r=[];for(let p=0,y=e.shapes.length;p<y;p++){const i=t[e.shapes[p]];r.push(i)}const c=e.options.extrudePath;return c!==void 0&&(e.options.extrudePath=new rB[c.type]().fromJSON(c)),new _y(r,e.options)}}const tQ={generateTopUV:function(u,e,t,r,c){const p=e[t*3],y=e[t*3+1],i=e[r*3],C=e[r*3+1],D=e[c*3],R=e[c*3+1];return[new Di(p,y),new Di(i,C),new Di(D,R)]},generateSideWallUV:function(u,e,t,r,c,p){const y=e[t*3],i=e[t*3+1],C=e[t*3+2],D=e[r*3],R=e[r*3+1],Q=e[r*3+2],z=e[c*3],G=e[c*3+1],J=e[c*3+2],Y=e[p*3],B=e[p*3+1],ae=e[p*3+2];return Math.abs(i-R)<Math.abs(y-D)?[new Di(y,1-C),new Di(D,1-Q),new Di(z,1-J),new Di(Y,1-ae)]:[new Di(i,1-C),new Di(R,1-Q),new Di(G,1-J),new Di(B,1-ae)]}};function iQ(u,e,t){if(t.shapes=[],Array.isArray(u))for(let r=0,c=u.length;r<c;r++){const p=u[r];t.shapes.push(p.uuid)}else t.shapes.push(u.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class yy extends YA{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,c=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],p=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(c,p,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new yy(e.radius,e.detail)}}class eg extends YA{constructor(e=1,t=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],c=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,c,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new eg(e.radius,e.detail)}}class xy extends br{constructor(e=.5,t=1,r=32,c=1,p=0,y=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:c,thetaStart:p,thetaLength:y},r=Math.max(3,r),c=Math.max(1,c);const i=[],C=[],D=[],R=[];let Q=e;const z=(t-e)/c,G=new ft,J=new Di;for(let Y=0;Y<=c;Y++){for(let B=0;B<=r;B++){const ae=p+B/r*y;G.x=Q*Math.cos(ae),G.y=Q*Math.sin(ae),C.push(G.x,G.y,G.z),D.push(0,0,1),J.x=(G.x/t+1)/2,J.y=(G.y/t+1)/2,R.push(J.x,J.y)}Q+=z}for(let Y=0;Y<c;Y++){const B=Y*(r+1);for(let ae=0;ae<r;ae++){const ce=ae+B,Ae=ce,we=ce+r+1,me=ce+r+2,De=ce+1;i.push(Ae,we,De),i.push(we,me,De)}}this.setIndex(i),this.setAttribute("position",new jn(C,3)),this.setAttribute("normal",new jn(D,3)),this.setAttribute("uv",new jn(R,2))}static fromJSON(e){return new xy(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class tg extends br{constructor(e=new tp([new Di(0,.5),new Di(-.5,-.5),new Di(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const r=[],c=[],p=[],y=[];let i=0,C=0;if(Array.isArray(e)===!1)D(e);else for(let R=0;R<e.length;R++)D(e[R]),this.addGroup(i,C,R),i+=C,C=0;this.setIndex(r),this.setAttribute("position",new jn(c,3)),this.setAttribute("normal",new jn(p,3)),this.setAttribute("uv",new jn(y,2));function D(R){const Q=c.length/3,z=R.extractPoints(t);let G=z.shape;const J=z.holes;Gu.isClockWise(G)===!1&&(G=G.reverse());for(let B=0,ae=J.length;B<ae;B++){const ce=J[B];Gu.isClockWise(ce)===!0&&(J[B]=ce.reverse())}const Y=Gu.triangulateShape(G,J);for(let B=0,ae=J.length;B<ae;B++){const ce=J[B];G=G.concat(ce)}for(let B=0,ae=G.length;B<ae;B++){const ce=G[B];c.push(ce.x,ce.y,0),p.push(0,0,1),y.push(ce.x,ce.y)}for(let B=0,ae=Y.length;B<ae;B++){const ce=Y[B],Ae=ce[0]+Q,we=ce[1]+Q,me=ce[2]+Q;r.push(Ae,we,me),C+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return nQ(t,e)}static fromJSON(e,t){const r=[];for(let c=0,p=e.shapes.length;c<p;c++){const y=t[e.shapes[c]];r.push(y)}return new tg(r,e.curveSegments)}}function nQ(u,e){if(e.shapes=[],Array.isArray(u))for(let t=0,r=u.length;t<r;t++){const c=u[t];e.shapes.push(c.uuid)}else e.shapes.push(u.uuid);return e}class Vu extends br{constructor(e=1,t=32,r=16,c=0,p=Math.PI*2,y=0,i=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:c,phiLength:p,thetaStart:y,thetaLength:i},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));const C=Math.min(y+i,Math.PI);let D=0;const R=[],Q=new ft,z=new ft,G=[],J=[],Y=[],B=[];for(let ae=0;ae<=r;ae++){const ce=[],Ae=ae/r;let we=0;ae==0&&y==0?we=.5/t:ae==r&&C==Math.PI&&(we=-.5/t);for(let me=0;me<=t;me++){const De=me/t;Q.x=-e*Math.cos(c+De*p)*Math.sin(y+Ae*i),Q.y=e*Math.cos(y+Ae*i),Q.z=e*Math.sin(c+De*p)*Math.sin(y+Ae*i),J.push(Q.x,Q.y,Q.z),z.copy(Q).normalize(),Y.push(z.x,z.y,z.z),B.push(De+we,1-Ae),ce.push(D++)}R.push(ce)}for(let ae=0;ae<r;ae++)for(let ce=0;ce<t;ce++){const Ae=R[ae][ce+1],we=R[ae][ce],me=R[ae+1][ce],De=R[ae+1][ce+1];(ae!==0||y>0)&&G.push(Ae,we,De),(ae!==r-1||C<Math.PI)&&G.push(we,me,De)}this.setIndex(G),this.setAttribute("position",new jn(J,3)),this.setAttribute("normal",new jn(Y,3)),this.setAttribute("uv",new jn(B,2))}static fromJSON(e){return new Vu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class vy extends YA{constructor(e=1,t=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],c=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,c,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new vy(e.radius,e.detail)}}class wy extends br{constructor(e=1,t=.4,r=12,c=48,p=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:c,arc:p},r=Math.floor(r),c=Math.floor(c);const y=[],i=[],C=[],D=[],R=new ft,Q=new ft,z=new ft;for(let G=0;G<=r;G++)for(let J=0;J<=c;J++){const Y=J/c*p,B=G/r*Math.PI*2;Q.x=(e+t*Math.cos(B))*Math.cos(Y),Q.y=(e+t*Math.cos(B))*Math.sin(Y),Q.z=t*Math.sin(B),i.push(Q.x,Q.y,Q.z),R.x=e*Math.cos(Y),R.y=e*Math.sin(Y),z.subVectors(Q,R).normalize(),C.push(z.x,z.y,z.z),D.push(J/c),D.push(G/r)}for(let G=1;G<=r;G++)for(let J=1;J<=c;J++){const Y=(c+1)*G+J-1,B=(c+1)*(G-1)+J-1,ae=(c+1)*(G-1)+J,ce=(c+1)*G+J;y.push(Y,B,ce),y.push(B,ae,ce)}this.setIndex(y),this.setAttribute("position",new jn(i,3)),this.setAttribute("normal",new jn(C,3)),this.setAttribute("uv",new jn(D,2))}static fromJSON(e){return new wy(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class by extends br{constructor(e=1,t=.4,r=64,c=8,p=2,y=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:c,p,q:y},r=Math.floor(r),c=Math.floor(c);const i=[],C=[],D=[],R=[],Q=new ft,z=new ft,G=new ft,J=new ft,Y=new ft,B=new ft,ae=new ft;for(let Ae=0;Ae<=r;++Ae){const we=Ae/r*p*Math.PI*2;ce(we,p,y,e,G),ce(we+.01,p,y,e,J),B.subVectors(J,G),ae.addVectors(J,G),Y.crossVectors(B,ae),ae.crossVectors(Y,B),Y.normalize(),ae.normalize();for(let me=0;me<=c;++me){const De=me/c*Math.PI*2,Je=-t*Math.cos(De),Fe=t*Math.sin(De);Q.x=G.x+(Je*ae.x+Fe*Y.x),Q.y=G.y+(Je*ae.y+Fe*Y.y),Q.z=G.z+(Je*ae.z+Fe*Y.z),C.push(Q.x,Q.y,Q.z),z.subVectors(Q,G).normalize(),D.push(z.x,z.y,z.z),R.push(Ae/r),R.push(me/c)}}for(let Ae=1;Ae<=r;Ae++)for(let we=1;we<=c;we++){const me=(c+1)*(Ae-1)+(we-1),De=(c+1)*Ae+(we-1),Je=(c+1)*Ae+we,Fe=(c+1)*(Ae-1)+we;i.push(me,De,Fe),i.push(De,Je,Fe)}this.setIndex(i),this.setAttribute("position",new jn(C,3)),this.setAttribute("normal",new jn(D,3)),this.setAttribute("uv",new jn(R,2));function ce(Ae,we,me,De,Je){const Fe=Math.cos(Ae),Ge=Math.sin(Ae),Et=me/we*Ae,li=Math.cos(Et);Je.x=De*(2+li)*.5*Fe,Je.y=De*(2+li)*Ge*.5,Je.z=De*Math.sin(Et)*.5}}static fromJSON(e){return new by(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ig extends br{constructor(e=new iB(new ft(-1,-1,0),new ft(-1,1,0),new ft(1,1,0)),t=64,r=1,c=8,p=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:c,closed:p};const y=e.computeFrenetFrames(t,p);this.tangents=y.tangents,this.normals=y.normals,this.binormals=y.binormals;const i=new ft,C=new ft,D=new Di;let R=new ft;const Q=[],z=[],G=[],J=[];Y(),this.setIndex(J),this.setAttribute("position",new jn(Q,3)),this.setAttribute("normal",new jn(z,3)),this.setAttribute("uv",new jn(G,2));function Y(){for(let Ae=0;Ae<t;Ae++)B(Ae);B(p===!1?t:0),ce(),ae()}function B(Ae){R=e.getPointAt(Ae/t,R);const we=y.normals[Ae],me=y.binormals[Ae];for(let De=0;De<=c;De++){const Je=De/c*Math.PI*2,Fe=Math.sin(Je),Ge=-Math.cos(Je);C.x=Ge*we.x+Fe*me.x,C.y=Ge*we.y+Fe*me.y,C.z=Ge*we.z+Fe*me.z,C.normalize(),z.push(C.x,C.y,C.z),i.x=R.x+r*C.x,i.y=R.y+r*C.y,i.z=R.z+r*C.z,Q.push(i.x,i.y,i.z)}}function ae(){for(let Ae=1;Ae<=t;Ae++)for(let we=1;we<=c;we++){const me=(c+1)*(Ae-1)+(we-1),De=(c+1)*Ae+(we-1),Je=(c+1)*Ae+we,Fe=(c+1)*(Ae-1)+we;J.push(me,De,Fe),J.push(De,Je,Fe)}}function ce(){for(let Ae=0;Ae<=t;Ae++)for(let we=0;we<=c;we++)D.x=Ae/t,D.y=we/c,G.push(D.x,D.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ig(new rB[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class sB extends br{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],r=new Set,c=new ft,p=new ft;if(e.index!==null){const y=e.attributes.position,i=e.index;let C=e.groups;C.length===0&&(C=[{start:0,count:i.count,materialIndex:0}]);for(let D=0,R=C.length;D<R;++D){const Q=C[D],z=Q.start,G=Q.count;for(let J=z,Y=z+G;J<Y;J+=3)for(let B=0;B<3;B++){const ae=i.getX(J+B),ce=i.getX(J+(B+1)%3);c.fromBufferAttribute(y,ae),p.fromBufferAttribute(y,ce),RT(c,p,r)===!0&&(t.push(c.x,c.y,c.z),t.push(p.x,p.y,p.z))}}}else{const y=e.attributes.position;for(let i=0,C=y.count/3;i<C;i++)for(let D=0;D<3;D++){const R=3*i+D,Q=3*i+(D+1)%3;c.fromBufferAttribute(y,R),p.fromBufferAttribute(y,Q),RT(c,p,r)===!0&&(t.push(c.x,c.y,c.z),t.push(p.x,p.y,p.z))}}this.setAttribute("position",new jn(t,3))}}}function RT(u,e,t){const r=`${u.x},${u.y},${u.z}-${e.x},${e.y},${e.z}`,c=`${e.x},${e.y},${e.z}-${u.x},${u.y},${u.z}`;return t.has(r)===!0||t.has(c)===!0?!1:(t.add(r),t.add(c),!0)}var zT=Object.freeze({__proto__:null,BoxGeometry:qA,CapsuleGeometry:fy,CircleGeometry:my,ConeGeometry:gf,CylinderGeometry:vf,DodecahedronGeometry:gy,EdgesGeometry:rF,ExtrudeGeometry:_y,IcosahedronGeometry:yy,LatheGeometry:Jm,OctahedronGeometry:eg,PlaneGeometry:xf,PolyhedronGeometry:YA,RingGeometry:xy,ShapeGeometry:tg,SphereGeometry:Vu,TetrahedronGeometry:vy,TorusGeometry:wy,TorusKnotGeometry:by,TubeGeometry:ig,WireframeGeometry:sB});class lF extends ol{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Dn(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class cF extends ko{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class J_ extends ol{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Dn(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cp,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class oB extends J_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Di(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Eo(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Dn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Dn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Dn(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class aB extends ol{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Dn(16777215),this.specular=new Dn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cp,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ly,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hF extends ol{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Dn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cp,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class uF extends ol{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cp,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class gv extends ol{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Dn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cp,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ly,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class AF extends ol{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Dn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cp,this.normalScale=new Di(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class dF extends ra{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function xh(u,e,t){return lB(u)?new u.constructor(u.subarray(e,t!==void 0?t:u.length)):u.slice(e,t)}function af(u,e,t){return!u||!t&&u.constructor===e?u:typeof e.BYTES_PER_ELEMENT=="number"?new e(u):Array.prototype.slice.call(u)}function lB(u){return ArrayBuffer.isView(u)&&!(u instanceof DataView)}function pF(u){function e(c,p){return u[c]-u[p]}const t=u.length,r=new Array(t);for(let c=0;c!==t;++c)r[c]=c;return r.sort(e),r}function A2(u,e,t){const r=u.length,c=new u.constructor(r);for(let p=0,y=0;y!==r;++p){const i=t[p]*e;for(let C=0;C!==e;++C)c[y++]=u[i+C]}return c}function cB(u,e,t,r){let c=1,p=u[0];for(;p!==void 0&&p[r]===void 0;)p=u[c++];if(p===void 0)return;let y=p[r];if(y!==void 0)if(Array.isArray(y))do y=p[r],y!==void 0&&(e.push(p.time),t.push.apply(t,y)),p=u[c++];while(p!==void 0);else if(y.toArray!==void 0)do y=p[r],y!==void 0&&(e.push(p.time),y.toArray(t,t.length)),p=u[c++];while(p!==void 0);else do y=p[r],y!==void 0&&(e.push(p.time),t.push(y)),p=u[c++];while(p!==void 0)}function rQ(u,e,t,r,c=30){const p=u.clone();p.name=e;const y=[];for(let C=0;C<p.tracks.length;++C){const D=p.tracks[C],R=D.getValueSize(),Q=[],z=[];for(let G=0;G<D.times.length;++G){const J=D.times[G]*c;if(!(J<t||J>=r)){Q.push(D.times[G]);for(let Y=0;Y<R;++Y)z.push(D.values[G*R+Y])}}Q.length!==0&&(D.times=af(Q,D.times.constructor),D.values=af(z,D.values.constructor),y.push(D))}p.tracks=y;let i=1/0;for(let C=0;C<p.tracks.length;++C)i>p.tracks[C].times[0]&&(i=p.tracks[C].times[0]);for(let C=0;C<p.tracks.length;++C)p.tracks[C].shift(-1*i);return p.resetDuration(),p}function sQ(u,e=0,t=u,r=30){r<=0&&(r=30);const c=t.tracks.length,p=e/r;for(let y=0;y<c;++y){const i=t.tracks[y],C=i.ValueTypeName;if(C==="bool"||C==="string")continue;const D=u.tracks.find(function(ae){return ae.name===i.name&&ae.ValueTypeName===C});if(D===void 0)continue;let R=0;const Q=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(R=Q/3);let z=0;const G=D.getValueSize();D.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(z=G/3);const J=i.times.length-1;let Y;if(p<=i.times[0]){const ae=R,ce=Q-R;Y=xh(i.values,ae,ce)}else if(p>=i.times[J]){const ae=J*Q+R,ce=ae+Q-R;Y=xh(i.values,ae,ce)}else{const ae=i.createInterpolant(),ce=R,Ae=Q-R;ae.evaluate(p),Y=xh(ae.resultBuffer,ce,Ae)}C==="quaternion"&&new sl().fromArray(Y).normalize().conjugate().toArray(Y);const B=D.times.length;for(let ae=0;ae<B;++ae){const ce=ae*G+z;if(C==="quaternion")sl.multiplyQuaternionsFlat(D.values,ce,Y,0,D.values,ce);else{const Ae=G-z*2;for(let we=0;we<Ae;++we)D.values[ce+we]-=Y[we]}}}return u.blendMode=k2,u}var oQ=Object.freeze({__proto__:null,arraySlice:xh,convertArray:af,flattenJSON:cB,getKeyframeOrder:pF,isTypedArray:lB,makeClipAdditive:sQ,sortedArray:A2,subclip:rQ});class By{constructor(e,t,r,c){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=c!==void 0?c:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,c=t[r],p=t[r-1];e:{t:{let y;i:{n:if(!(e<c)){for(let i=r+2;;){if(c===void 0){if(e<p)break n;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===i)break;if(p=c,c=t[++r],e<c)break t}y=t.length;break i}if(!(e>=p)){const i=t[1];e<i&&(r=2,p=i);for(let C=r-2;;){if(p===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===C)break;if(c=p,p=t[--r-1],e>=p)break t}y=r,r=0;break i}break e}for(;r<y;){const i=r+y>>>1;e<t[i]?y=i:r=i+1}if(c=t[r],p=t[r-1],p===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(c===void 0)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,p,c)}return this.interpolate_(r,p,e,c)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,c=this.valueSize,p=e*c;for(let y=0;y!==c;++y)t[y]=r[p+y];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class fF extends By{constructor(e,t,r,c){super(e,t,r,c),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:rf,endingEnd:rf}}intervalChanged_(e,t,r){const c=this.parameterPositions;let p=e-2,y=e+1,i=c[p],C=c[y];if(i===void 0)switch(this.getSettings_().endingStart){case sf:p=e,i=2*t-r;break;case G_:p=c.length-2,i=t+c[p]-c[p+1];break;default:p=e,i=r}if(C===void 0)switch(this.getSettings_().endingEnd){case sf:y=e,C=2*r-t;break;case G_:y=1,C=r+c[1]-c[0];break;default:y=e-1,C=t}const D=(r-t)*.5,R=this.valueSize;this._weightPrev=D/(t-i),this._weightNext=D/(C-r),this._offsetPrev=p*R,this._offsetNext=y*R}interpolate_(e,t,r,c){const p=this.resultBuffer,y=this.sampleValues,i=this.valueSize,C=e*i,D=C-i,R=this._offsetPrev,Q=this._offsetNext,z=this._weightPrev,G=this._weightNext,J=(r-t)/(c-t),Y=J*J,B=Y*J,ae=-z*B+2*z*Y-z*J,ce=(1+z)*B+(-1.5-2*z)*Y+(-.5+z)*J+1,Ae=(-1-G)*B+(1.5+G)*Y+.5*J,we=G*B-G*Y;for(let me=0;me!==i;++me)p[me]=ae*y[R+me]+ce*y[D+me]+Ae*y[C+me]+we*y[Q+me];return p}}class hB extends By{constructor(e,t,r,c){super(e,t,r,c)}interpolate_(e,t,r,c){const p=this.resultBuffer,y=this.sampleValues,i=this.valueSize,C=e*i,D=C-i,R=(r-t)/(c-t),Q=1-R;for(let z=0;z!==i;++z)p[z]=y[D+z]*Q+y[C+z]*R;return p}}class mF extends By{constructor(e,t,r,c){super(e,t,r,c)}interpolate_(e){return this.copySampleValue_(e-1)}}class pu{constructor(e,t,r,c){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=af(t,this.TimeBufferType),this.values=af(r,this.ValueBufferType),this.setInterpolation(c||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:af(e.times,Array),values:af(e.values,Array)};const c=e.getInterpolation();c!==e.DefaultInterpolation&&(r.interpolation=c)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new mF(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new hB(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new fF(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case V_:t=this.InterpolantFactoryMethodDiscrete;break;case H_:t=this.InterpolantFactoryMethodLinear;break;case Zx:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return V_;case this.InterpolantFactoryMethodLinear:return H_;case this.InterpolantFactoryMethodSmooth:return Zx}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let r=0,c=t.length;r!==c;++r)t[r]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let r=0,c=t.length;r!==c;++r)t[r]*=e}return this}trim(e,t){const r=this.times,c=r.length;let p=0,y=c-1;for(;p!==c&&r[p]<e;)++p;for(;y!==-1&&r[y]>t;)--y;if(++y,p!==0||y!==c){p>=y&&(y=Math.max(y,1),p=y-1);const i=this.getValueSize();this.times=xh(r,p,y),this.values=xh(this.values,p*i,y*i)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,c=this.values,p=r.length;p===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let y=null;for(let i=0;i!==p;i++){const C=r[i];if(typeof C=="number"&&isNaN(C)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,i,C),e=!1;break}if(y!==null&&y>C){console.error("THREE.KeyframeTrack: Out of order keys.",this,i,C,y),e=!1;break}y=C}if(c!==void 0&&lB(c))for(let i=0,C=c.length;i!==C;++i){const D=c[i];if(isNaN(D)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,i,D),e=!1;break}}return e}optimize(){const e=xh(this.times),t=xh(this.values),r=this.getValueSize(),c=this.getInterpolation()===Zx,p=e.length-1;let y=1;for(let i=1;i<p;++i){let C=!1;const D=e[i],R=e[i+1];if(D!==R&&(i!==1||D!==e[0]))if(c)C=!0;else{const Q=i*r,z=Q-r,G=Q+r;for(let J=0;J!==r;++J){const Y=t[Q+J];if(Y!==t[z+J]||Y!==t[G+J]){C=!0;break}}}if(C){if(i!==y){e[y]=e[i];const Q=i*r,z=y*r;for(let G=0;G!==r;++G)t[z+G]=t[Q+G]}++y}}if(p>0){e[y]=e[p];for(let i=p*r,C=y*r,D=0;D!==r;++D)t[C+D]=t[i+D];++y}return y!==e.length?(this.times=xh(e,0,y),this.values=xh(t,0,y*r)):(this.times=e,this.values=t),this}clone(){const e=xh(this.times,0),t=xh(this.values,0),r=this.constructor,c=new r(this.name,e,t);return c.createInterpolant=this.createInterpolant,c}}pu.prototype.TimeBufferType=Float32Array;pu.prototype.ValueBufferType=Float32Array;pu.prototype.DefaultInterpolation=H_;class wf extends pu{}wf.prototype.ValueTypeName="bool";wf.prototype.ValueBufferType=Array;wf.prototype.DefaultInterpolation=V_;wf.prototype.InterpolantFactoryMethodLinear=void 0;wf.prototype.InterpolantFactoryMethodSmooth=void 0;class uB extends pu{}uB.prototype.ValueTypeName="color";class ey extends pu{}ey.prototype.ValueTypeName="number";class gF extends By{constructor(e,t,r,c){super(e,t,r,c)}interpolate_(e,t,r,c){const p=this.resultBuffer,y=this.sampleValues,i=this.valueSize,C=(r-t)/(c-t);let D=e*i;for(let R=D+i;D!==R;D+=4)sl.slerpFlat(p,0,y,D-i,y,D,C);return p}}class ng extends pu{InterpolantFactoryMethodLinear(e){return new gF(this.times,this.values,this.getValueSize(),e)}}ng.prototype.ValueTypeName="quaternion";ng.prototype.DefaultInterpolation=H_;ng.prototype.InterpolantFactoryMethodSmooth=void 0;class bf extends pu{}bf.prototype.ValueTypeName="string";bf.prototype.ValueBufferType=Array;bf.prototype.DefaultInterpolation=V_;bf.prototype.InterpolantFactoryMethodLinear=void 0;bf.prototype.InterpolantFactoryMethodSmooth=void 0;class ty extends pu{}ty.prototype.ValueTypeName="vector";class iy{constructor(e,t=-1,r,c=Ov){this.name=e,this.tracks=r,this.duration=t,this.blendMode=c,this.uuid=Pc(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,c=1/(e.fps||1);for(let y=0,i=r.length;y!==i;++y)t.push(lQ(r[y]).scale(c));const p=new this(e.name,e.duration,t,e.blendMode);return p.uuid=e.uuid,p}static toJSON(e){const t=[],r=e.tracks,c={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let p=0,y=r.length;p!==y;++p)t.push(pu.toJSON(r[p]));return c}static CreateFromMorphTargetSequence(e,t,r,c){const p=t.length,y=[];for(let i=0;i<p;i++){let C=[],D=[];C.push((i+p-1)%p,i,(i+1)%p),D.push(0,1,0);const R=pF(C);C=A2(C,1,R),D=A2(D,1,R),!c&&C[0]===0&&(C.push(p),D.push(D[0])),y.push(new ey(".morphTargetInfluences["+t[i].name+"]",C,D).scale(1/r))}return new this(e,-1,y)}static findByName(e,t){let r=e;if(!Array.isArray(e)){const c=e;r=c.geometry&&c.geometry.animations||c.animations}for(let c=0;c<r.length;c++)if(r[c].name===t)return r[c];return null}static CreateClipsFromMorphTargetSequences(e,t,r){const c={},p=/^([\w-]*?)([\d]+)$/;for(let i=0,C=e.length;i<C;i++){const D=e[i],R=D.name.match(p);if(R&&R.length>1){const Q=R[1];let z=c[Q];z||(c[Q]=z=[]),z.push(D)}}const y=[];for(const i in c)y.push(this.CreateFromMorphTargetSequence(i,c[i],t,r));return y}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(Q,z,G,J,Y){if(G.length!==0){const B=[],ae=[];cB(G,B,ae,J),B.length!==0&&Y.push(new Q(z,B,ae))}},c=[],p=e.name||"default",y=e.fps||30,i=e.blendMode;let C=e.length||-1;const D=e.hierarchy||[];for(let Q=0;Q<D.length;Q++){const z=D[Q].keys;if(!(!z||z.length===0))if(z[0].morphTargets){const G={};let J;for(J=0;J<z.length;J++)if(z[J].morphTargets)for(let Y=0;Y<z[J].morphTargets.length;Y++)G[z[J].morphTargets[Y]]=-1;for(const Y in G){const B=[],ae=[];for(let ce=0;ce!==z[J].morphTargets.length;++ce){const Ae=z[J];B.push(Ae.time),ae.push(Ae.morphTarget===Y?1:0)}c.push(new ey(".morphTargetInfluence["+Y+"]",B,ae))}C=G.length*y}else{const G=".bones["+t[Q].name+"]";r(ty,G+".position",z,"pos",c),r(ng,G+".quaternion",z,"rot",c),r(ty,G+".scale",z,"scl",c)}}return c.length===0?null:new this(p,C,c,i)}resetDuration(){const e=this.tracks;let t=0;for(let r=0,c=e.length;r!==c;++r){const p=this.tracks[r];t=Math.max(t,p.times[p.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function aQ(u){switch(u.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ey;case"vector":case"vector2":case"vector3":case"vector4":return ty;case"color":return uB;case"quaternion":return ng;case"bool":case"boolean":return wf;case"string":return bf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+u)}function lQ(u){if(u.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=aQ(u.type);if(u.times===void 0){const t=[],r=[];cB(u.keys,t,r,"value"),u.times=t,u.values=r}return e.parse!==void 0?e.parse(u):new e(u.name,u.times,u.values,u.interpolation)}const yf={enabled:!1,files:{},add:function(u,e){this.enabled!==!1&&(this.files[u]=e)},get:function(u){if(this.enabled!==!1)return this.files[u]},remove:function(u){delete this.files[u]},clear:function(){this.files={}}};class AB{constructor(e,t,r){const c=this;let p=!1,y=0,i=0,C;const D=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(R){i++,p===!1&&c.onStart!==void 0&&c.onStart(R,y,i),p=!0},this.itemEnd=function(R){y++,c.onProgress!==void 0&&c.onProgress(R,y,i),y===i&&(p=!1,c.onLoad!==void 0&&c.onLoad())},this.itemError=function(R){c.onError!==void 0&&c.onError(R)},this.resolveURL=function(R){return C?C(R):R},this.setURLModifier=function(R){return C=R,this},this.addHandler=function(R,Q){return D.push(R,Q),this},this.removeHandler=function(R){const Q=D.indexOf(R);return Q!==-1&&D.splice(Q,2),this},this.getHandler=function(R){for(let Q=0,z=D.length;Q<z;Q+=2){const G=D[Q],J=D[Q+1];if(G.global&&(G.lastIndex=0),G.test(R))return J}return null}}}const _F=new AB;class Uc{constructor(e){this.manager=e!==void 0?e:_F,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const r=this;return new Promise(function(c,p){r.load(e,c,t,p)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const QA={};class cQ extends Error{constructor(e,t){super(e),this.response=t}}class ZA extends Uc{constructor(e){super(e)}load(e,t,r,c){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const p=yf.get(e);if(p!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(p),this.manager.itemEnd(e)},0),p;if(QA[e]!==void 0){QA[e].push({onLoad:t,onProgress:r,onError:c});return}QA[e]=[],QA[e].push({onLoad:t,onProgress:r,onError:c});const y=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),i=this.mimeType,C=this.responseType;fetch(y).then(D=>{if(D.status===200||D.status===0){if(D.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||D.body===void 0||D.body.getReader===void 0)return D;const R=QA[e],Q=D.body.getReader(),z=D.headers.get("Content-Length")||D.headers.get("X-File-Size"),G=z?parseInt(z):0,J=G!==0;let Y=0;const B=new ReadableStream({start(ae){ce();function ce(){Q.read().then(({done:Ae,value:we})=>{if(Ae)ae.close();else{Y+=we.byteLength;const me=new ProgressEvent("progress",{lengthComputable:J,loaded:Y,total:G});for(let De=0,Je=R.length;De<Je;De++){const Fe=R[De];Fe.onProgress&&Fe.onProgress(me)}ae.enqueue(we),ce()}})}}});return new Response(B)}else throw new cQ(`fetch for "${D.url}" responded with ${D.status}: ${D.statusText}`,D)}).then(D=>{switch(C){case"arraybuffer":return D.arrayBuffer();case"blob":return D.blob();case"document":return D.text().then(R=>new DOMParser().parseFromString(R,i));case"json":return D.json();default:if(i===void 0)return D.text();{const Q=/charset="?([^;"\s]*)"?/i.exec(i),z=Q&&Q[1]?Q[1].toLowerCase():void 0,G=new TextDecoder(z);return D.arrayBuffer().then(J=>G.decode(J))}}}).then(D=>{yf.add(e,D);const R=QA[e];delete QA[e];for(let Q=0,z=R.length;Q<z;Q++){const G=R[Q];G.onLoad&&G.onLoad(D)}}).catch(D=>{const R=QA[e];if(R===void 0)throw this.manager.itemError(e),D;delete QA[e];for(let Q=0,z=R.length;Q<z;Q++){const G=R[Q];G.onError&&G.onError(D)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class hQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new ZA(this.manager);y.setPath(this.path),y.setRequestHeader(this.requestHeader),y.setWithCredentials(this.withCredentials),y.load(e,function(i){try{t(p.parse(JSON.parse(i)))}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}parse(e){const t=[];for(let r=0;r<e.length;r++){const c=iy.parse(e[r]);t.push(c)}return t}}class uQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=[],i=new Y2,C=new ZA(this.manager);C.setPath(this.path),C.setResponseType("arraybuffer"),C.setRequestHeader(this.requestHeader),C.setWithCredentials(p.withCredentials);let D=0;function R(Q){C.load(e[Q],function(z){const G=p.parse(z,!0);y[Q]={width:G.width,height:G.height,format:G.format,mipmaps:G.mipmaps},D+=1,D===6&&(G.mipmapCount===1&&(i.minFilter=Xs),i.image=y,i.format=G.format,i.needsUpdate=!0,t&&t(i))},r,c)}if(Array.isArray(e))for(let Q=0,z=e.length;Q<z;++Q)R(Q);else C.load(e,function(Q){const z=p.parse(Q,!0);if(z.isCubemap){const G=z.mipmaps.length/z.mipmapCount;for(let J=0;J<G;J++){y[J]={mipmaps:[]};for(let Y=0;Y<z.mipmapCount;Y++)y[J].mipmaps.push(z.mipmaps[J*z.mipmapCount+Y]),y[J].format=z.format,y[J].width=z.width,y[J].height=z.height}i.image=y}else i.image.width=z.width,i.image.height=z.height,i.mipmaps=z.mipmaps;z.mipmapCount===1&&(i.minFilter=Xs),i.format=z.format,i.needsUpdate=!0,t&&t(i)},r,c);return i}}class ny extends Uc{constructor(e){super(e)}load(e,t,r,c){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const p=this,y=yf.get(e);if(y!==void 0)return p.manager.itemStart(e),setTimeout(function(){t&&t(y),p.manager.itemEnd(e)},0),y;const i=K_("img");function C(){R(),yf.add(e,this),t&&t(this),p.manager.itemEnd(e)}function D(Q){R(),c&&c(Q),p.manager.itemError(e),p.manager.itemEnd(e)}function R(){i.removeEventListener("load",C,!1),i.removeEventListener("error",D,!1)}return i.addEventListener("load",C,!1),i.addEventListener("error",D,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(i.crossOrigin=this.crossOrigin),p.manager.itemStart(e),i.src=e,i}}class AQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=new Ay,y=new ny(this.manager);y.setCrossOrigin(this.crossOrigin),y.setPath(this.path);let i=0;function C(D){y.load(e[D],function(R){p.images[D]=R,i++,i===6&&(p.needsUpdate=!0,t&&t(p))},void 0,c)}for(let D=0;D<e.length;++D)C(D);return p}}class dQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new Qm,i=new ZA(this.manager);return i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setPath(this.path),i.setWithCredentials(p.withCredentials),i.load(e,function(C){const D=p.parse(C);!D||(D.image!==void 0?y.image=D.image:D.data!==void 0&&(y.image.width=D.width,y.image.height=D.height,y.image.data=D.data),y.wrapS=D.wrapS!==void 0?D.wrapS:nl,y.wrapT=D.wrapT!==void 0?D.wrapT:nl,y.magFilter=D.magFilter!==void 0?D.magFilter:Xs,y.minFilter=D.minFilter!==void 0?D.minFilter:Xs,y.anisotropy=D.anisotropy!==void 0?D.anisotropy:1,D.encoding!==void 0&&(y.encoding=D.encoding),D.flipY!==void 0&&(y.flipY=D.flipY),D.format!==void 0&&(y.format=D.format),D.type!==void 0&&(y.type=D.type),D.mipmaps!==void 0&&(y.mipmaps=D.mipmaps,y.minFilter=op),D.mipmapCount===1&&(y.minFilter=Xs),D.generateMipmaps!==void 0&&(y.generateMipmaps=D.generateMipmaps),y.needsUpdate=!0,t&&t(y,D))},r,c),y}}class Im extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=new To,y=new ny(this.manager);return y.setCrossOrigin(this.crossOrigin),y.setPath(this.path),y.load(e,function(i){p.image=i,p.needsUpdate=!0,t!==void 0&&t(p)},r,c),p}}class hp extends ls{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Dn(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class dB extends hp{constructor(e,t,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ls.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Dn(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Zw=new ar,kT=new ft,OT=new ft;class pB{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Di(512,512),this.map=null,this.mapPass=null,this.matrix=new ar,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Vv,this._frameExtents=new Di(1,1),this._viewportCount=1,this._viewports=[new as(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;kT.setFromMatrixPosition(e.matrixWorld),t.position.copy(kT),OT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(OT),t.updateMatrixWorld(),Zw.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Zw),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(Zw)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class pQ extends pB{constructor(){super(new _a(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=j_*2*e.angle*this.focus,c=this.mapSize.width/this.mapSize.height,p=e.distance||t.far;(r!==t.fov||c!==t.aspect||p!==t.far)&&(t.fov=r,t.aspect=c,t.far=p,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class yF extends hp{constructor(e,t,r=0,c=Math.PI/3,p=0,y=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ls.DEFAULT_UP),this.updateMatrix(),this.target=new ls,this.distance=r,this.angle=c,this.penumbra=p,this.decay=y,this.map=null,this.shadow=new pQ}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const NT=new ar,A_=new ft,Xw=new ft;class fQ extends pB{constructor(){super(new _a(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Di(4,2),this._viewportCount=6,this._viewports=[new as(2,1,1,1),new as(0,1,1,1),new as(3,1,1,1),new as(1,1,1,1),new as(3,0,1,1),new as(1,0,1,1)],this._cubeDirections=[new ft(1,0,0),new ft(-1,0,0),new ft(0,0,1),new ft(0,0,-1),new ft(0,1,0),new ft(0,-1,0)],this._cubeUps=[new ft(0,1,0),new ft(0,1,0),new ft(0,1,0),new ft(0,1,0),new ft(0,0,1),new ft(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,c=this.matrix,p=e.distance||r.far;p!==r.far&&(r.far=p,r.updateProjectionMatrix()),A_.setFromMatrixPosition(e.matrixWorld),r.position.copy(A_),Xw.copy(r.position),Xw.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Xw),r.updateMatrixWorld(),c.makeTranslation(-A_.x,-A_.y,-A_.z),NT.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NT)}}class fB extends hp{constructor(e,t,r=0,c=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=c,this.shadow=new fQ}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class mQ extends pB{constructor(){super(new dy(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class mB extends hp{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ls.DEFAULT_UP),this.updateMatrix(),this.target=new ls,this.shadow=new mQ}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class gB extends hp{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xF extends hp{constructor(e,t,r=10,c=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=c}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class vF{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ft)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const r=e.x,c=e.y,p=e.z,y=this.coefficients;return t.copy(y[0]).multiplyScalar(.282095),t.addScaledVector(y[1],.488603*c),t.addScaledVector(y[2],.488603*p),t.addScaledVector(y[3],.488603*r),t.addScaledVector(y[4],1.092548*(r*c)),t.addScaledVector(y[5],1.092548*(c*p)),t.addScaledVector(y[6],.315392*(3*p*p-1)),t.addScaledVector(y[7],1.092548*(r*p)),t.addScaledVector(y[8],.546274*(r*r-c*c)),t}getIrradianceAt(e,t){const r=e.x,c=e.y,p=e.z,y=this.coefficients;return t.copy(y[0]).multiplyScalar(.886227),t.addScaledVector(y[1],2*.511664*c),t.addScaledVector(y[2],2*.511664*p),t.addScaledVector(y[3],2*.511664*r),t.addScaledVector(y[4],2*.429043*r*c),t.addScaledVector(y[5],2*.429043*c*p),t.addScaledVector(y[6],.743125*p*p-.247708),t.addScaledVector(y[7],2*.429043*r*p),t.addScaledVector(y[8],.429043*(r*r-c*c)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const r=this.coefficients;for(let c=0;c<9;c++)r[c].fromArray(e,t+c*3);return this}toArray(e=[],t=0){const r=this.coefficients;for(let c=0;c<9;c++)r[c].toArray(e,t+c*3);return e}static getBasisAt(e,t){const r=e.x,c=e.y,p=e.z;t[0]=.282095,t[1]=.488603*c,t[2]=.488603*p,t[3]=.488603*r,t[4]=1.092548*r*c,t[5]=1.092548*c*p,t[6]=.315392*(3*p*p-1),t[7]=1.092548*r*p,t[8]=.546274*(r*r-c*c)}}class qv extends hp{constructor(e=new vF,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Yv extends Uc{constructor(e){super(e),this.textures={}}load(e,t,r,c){const p=this,y=new ZA(p.manager);y.setPath(p.path),y.setRequestHeader(p.requestHeader),y.setWithCredentials(p.withCredentials),y.load(e,function(i){try{t(p.parse(JSON.parse(i)))}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}parse(e){const t=this.textures;function r(p){return t[p]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",p),t[p]}const c=Yv.createMaterialFromType(e.type);if(e.uuid!==void 0&&(c.uuid=e.uuid),e.name!==void 0&&(c.name=e.name),e.color!==void 0&&c.color!==void 0&&c.color.setHex(e.color),e.roughness!==void 0&&(c.roughness=e.roughness),e.metalness!==void 0&&(c.metalness=e.metalness),e.sheen!==void 0&&(c.sheen=e.sheen),e.sheenColor!==void 0&&(c.sheenColor=new Dn().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(c.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&c.emissive!==void 0&&c.emissive.setHex(e.emissive),e.specular!==void 0&&c.specular!==void 0&&c.specular.setHex(e.specular),e.specularIntensity!==void 0&&(c.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&c.specularColor!==void 0&&c.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(c.shininess=e.shininess),e.clearcoat!==void 0&&(c.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(c.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(c.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(c.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(c.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(c.transmission=e.transmission),e.thickness!==void 0&&(c.thickness=e.thickness),e.attenuationDistance!==void 0&&(c.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&c.attenuationColor!==void 0&&c.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(c.fog=e.fog),e.flatShading!==void 0&&(c.flatShading=e.flatShading),e.blending!==void 0&&(c.blending=e.blending),e.combine!==void 0&&(c.combine=e.combine),e.side!==void 0&&(c.side=e.side),e.shadowSide!==void 0&&(c.shadowSide=e.shadowSide),e.opacity!==void 0&&(c.opacity=e.opacity),e.transparent!==void 0&&(c.transparent=e.transparent),e.alphaTest!==void 0&&(c.alphaTest=e.alphaTest),e.depthTest!==void 0&&(c.depthTest=e.depthTest),e.depthWrite!==void 0&&(c.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(c.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(c.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(c.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(c.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(c.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(c.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(c.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(c.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(c.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(c.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(c.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(c.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(c.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(c.rotation=e.rotation),e.linewidth!==1&&(c.linewidth=e.linewidth),e.dashSize!==void 0&&(c.dashSize=e.dashSize),e.gapSize!==void 0&&(c.gapSize=e.gapSize),e.scale!==void 0&&(c.scale=e.scale),e.polygonOffset!==void 0&&(c.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(c.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(c.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(c.dithering=e.dithering),e.alphaToCoverage!==void 0&&(c.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(c.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(c.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(c.visible=e.visible),e.toneMapped!==void 0&&(c.toneMapped=e.toneMapped),e.userData!==void 0&&(c.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?c.vertexColors=e.vertexColors>0:c.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const p in e.uniforms){const y=e.uniforms[p];switch(c.uniforms[p]={},y.type){case"t":c.uniforms[p].value=r(y.value);break;case"c":c.uniforms[p].value=new Dn().setHex(y.value);break;case"v2":c.uniforms[p].value=new Di().fromArray(y.value);break;case"v3":c.uniforms[p].value=new ft().fromArray(y.value);break;case"v4":c.uniforms[p].value=new as().fromArray(y.value);break;case"m3":c.uniforms[p].value=new Pl().fromArray(y.value);break;case"m4":c.uniforms[p].value=new ar().fromArray(y.value);break;default:c.uniforms[p].value=y.value}}if(e.defines!==void 0&&(c.defines=e.defines),e.vertexShader!==void 0&&(c.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(c.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(c.glslVersion=e.glslVersion),e.extensions!==void 0)for(const p in e.extensions)c.extensions[p]=e.extensions[p];if(e.size!==void 0&&(c.size=e.size),e.sizeAttenuation!==void 0&&(c.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(c.map=r(e.map)),e.matcap!==void 0&&(c.matcap=r(e.matcap)),e.alphaMap!==void 0&&(c.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(c.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(c.bumpScale=e.bumpScale),e.normalMap!==void 0&&(c.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(c.normalMapType=e.normalMapType),e.normalScale!==void 0){let p=e.normalScale;Array.isArray(p)===!1&&(p=[p,p]),c.normalScale=new Di().fromArray(p)}return e.displacementMap!==void 0&&(c.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(c.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(c.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(c.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(c.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(c.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(c.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(c.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(c.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(c.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(c.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(c.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(c.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(c.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(c.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(c.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(c.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(c.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(c.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(c.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(c.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(c.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(c.clearcoatNormalScale=new Di().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(c.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(c.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(c.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(c.thicknessMap=r(e.thicknessMap)),e.sheenColorMap!==void 0&&(c.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(c.sheenRoughnessMap=r(e.sheenRoughnessMap)),c}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:lF,SpriteMaterial:py,RawShaderMaterial:cF,ShaderMaterial:ko,PointsMaterial:X2,MeshPhysicalMaterial:oB,MeshStandardMaterial:J_,MeshPhongMaterial:aB,MeshToonMaterial:hF,MeshNormalMaterial:uF,MeshLambertMaterial:gv,MeshDepthMaterial:W2,MeshDistanceMaterial:j2,MeshBasicMaterial:za,MeshMatcapMaterial:AF,LineDashedMaterial:dF,LineBasicMaterial:ra,Material:ol};return new t[e]}}class d2{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,c=e.length;r<c;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class _B extends br{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class wF extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new ZA(p.manager);y.setPath(p.path),y.setRequestHeader(p.requestHeader),y.setWithCredentials(p.withCredentials),y.load(e,function(i){try{t(p.parse(JSON.parse(i)))}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}parse(e){const t={},r={};function c(G,J){if(t[J]!==void 0)return t[J];const B=G.interleavedBuffers[J],ae=p(G,B.buffer),ce=Pm(B.type,ae),Ae=new jv(ce,B.stride);return Ae.uuid=B.uuid,t[J]=Ae,Ae}function p(G,J){if(r[J]!==void 0)return r[J];const B=G.arrayBuffers[J],ae=new Uint32Array(B).buffer;return r[J]=ae,ae}const y=e.isInstancedBufferGeometry?new _B:new br,i=e.data.index;if(i!==void 0){const G=Pm(i.type,i.array);y.setIndex(new As(G,1))}const C=e.data.attributes;for(const G in C){const J=C[G];let Y;if(J.isInterleavedBufferAttribute){const B=c(e.data,J.data);Y=new Dc(B,J.itemSize,J.offset,J.normalized)}else{const B=Pm(J.type,J.array),ae=J.isInstancedBufferAttribute?Km:As;Y=new ae(B,J.itemSize,J.normalized)}J.name!==void 0&&(Y.name=J.name),J.usage!==void 0&&Y.setUsage(J.usage),J.updateRange!==void 0&&(Y.updateRange.offset=J.updateRange.offset,Y.updateRange.count=J.updateRange.count),y.setAttribute(G,Y)}const D=e.data.morphAttributes;if(D)for(const G in D){const J=D[G],Y=[];for(let B=0,ae=J.length;B<ae;B++){const ce=J[B];let Ae;if(ce.isInterleavedBufferAttribute){const we=c(e.data,ce.data);Ae=new Dc(we,ce.itemSize,ce.offset,ce.normalized)}else{const we=Pm(ce.type,ce.array);Ae=new As(we,ce.itemSize,ce.normalized)}ce.name!==void 0&&(Ae.name=ce.name),Y.push(Ae)}y.morphAttributes[G]=Y}e.data.morphTargetsRelative&&(y.morphTargetsRelative=!0);const Q=e.data.groups||e.data.drawcalls||e.data.offsets;if(Q!==void 0)for(let G=0,J=Q.length;G!==J;++G){const Y=Q[G];y.addGroup(Y.start,Y.count,Y.materialIndex)}const z=e.data.boundingSphere;if(z!==void 0){const G=new ft;z.center!==void 0&&G.fromArray(z.center),y.boundingSphere=new XA(G,z.radius)}return e.name&&(y.name=e.name),e.userData&&(y.userData=e.userData),y}}class gQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=this.path===""?d2.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||y;const i=new ZA(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,function(C){let D=null;try{D=JSON.parse(C)}catch(Q){c!==void 0&&c(Q),console.error("THREE:ObjectLoader: Can't parse "+e+".",Q.message);return}const R=D.metadata;if(R===void 0||R.type===void 0||R.type.toLowerCase()==="geometry"){c!==void 0&&c(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}p.parse(D,t)},r,c)}async loadAsync(e,t){const r=this,c=this.path===""?d2.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||c;const p=new ZA(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials);const y=await p.loadAsync(e,t),i=JSON.parse(y),C=i.metadata;if(C===void 0||C.type===void 0||C.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(i)}parse(e,t){const r=this.parseAnimations(e.animations),c=this.parseShapes(e.shapes),p=this.parseGeometries(e.geometries,c),y=this.parseImages(e.images,function(){t!==void 0&&t(D)}),i=this.parseTextures(e.textures,y),C=this.parseMaterials(e.materials,i),D=this.parseObject(e.object,p,C,i,r),R=this.parseSkeletons(e.skeletons,D);if(this.bindSkeletons(D,R),t!==void 0){let Q=!1;for(const z in y)if(y[z].data instanceof HTMLImageElement){Q=!0;break}Q===!1&&t(D)}return D}async parseAsync(e){const t=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),c=this.parseGeometries(e.geometries,r),p=await this.parseImagesAsync(e.images),y=this.parseTextures(e.textures,p),i=this.parseMaterials(e.materials,y),C=this.parseObject(e.object,c,i,y,t),D=this.parseSkeletons(e.skeletons,C);return this.bindSkeletons(C,D),C}parseShapes(e){const t={};if(e!==void 0)for(let r=0,c=e.length;r<c;r++){const p=new tp().fromJSON(e[r]);t[p.uuid]=p}return t}parseSkeletons(e,t){const r={},c={};if(t.traverse(function(p){p.isBone&&(c[p.uuid]=p)}),e!==void 0)for(let p=0,y=e.length;p<y;p++){const i=new Kv().fromJSON(e[p],c);r[i.uuid]=i}return r}parseGeometries(e,t){const r={};if(e!==void 0){const c=new wF;for(let p=0,y=e.length;p<y;p++){let i;const C=e[p];switch(C.type){case"BufferGeometry":case"InstancedBufferGeometry":i=c.parse(C);break;default:C.type in zT?i=zT[C.type].fromJSON(C,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${C.type}"`)}i.uuid=C.uuid,C.name!==void 0&&(i.name=C.name),i.isBufferGeometry===!0&&C.userData!==void 0&&(i.userData=C.userData),r[C.uuid]=i}}return r}parseMaterials(e,t){const r={},c={};if(e!==void 0){const p=new Yv;p.setTextures(t);for(let y=0,i=e.length;y<i;y++){const C=e[y];r[C.uuid]===void 0&&(r[C.uuid]=p.parse(C)),c[C.uuid]=r[C.uuid]}}return c}parseAnimations(e){const t={};if(e!==void 0)for(let r=0;r<e.length;r++){const c=e[r],p=iy.parse(c);t[p.uuid]=p}return t}parseImages(e,t){const r=this,c={};let p;function y(C){return r.manager.itemStart(C),p.load(C,function(){r.manager.itemEnd(C)},void 0,function(){r.manager.itemError(C),r.manager.itemEnd(C)})}function i(C){if(typeof C=="string"){const D=C,R=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(D)?D:r.resourcePath+D;return y(R)}else return C.data?{data:Pm(C.type,C.data),width:C.width,height:C.height}:null}if(e!==void 0&&e.length>0){const C=new AB(t);p=new ny(C),p.setCrossOrigin(this.crossOrigin);for(let D=0,R=e.length;D<R;D++){const Q=e[D],z=Q.url;if(Array.isArray(z)){const G=[];for(let J=0,Y=z.length;J<Y;J++){const B=z[J],ae=i(B);ae!==null&&(ae instanceof HTMLImageElement?G.push(ae):G.push(new Qm(ae.data,ae.width,ae.height)))}c[Q.uuid]=new of(G)}else{const G=i(Q.url);c[Q.uuid]=new of(G)}}}return c}async parseImagesAsync(e){const t=this,r={};let c;async function p(y){if(typeof y=="string"){const i=y,C=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i)?i:t.resourcePath+i;return await c.loadAsync(C)}else return y.data?{data:Pm(y.type,y.data),width:y.width,height:y.height}:null}if(e!==void 0&&e.length>0){c=new ny(this.manager),c.setCrossOrigin(this.crossOrigin);for(let y=0,i=e.length;y<i;y++){const C=e[y],D=C.url;if(Array.isArray(D)){const R=[];for(let Q=0,z=D.length;Q<z;Q++){const G=D[Q],J=await p(G);J!==null&&(J instanceof HTMLImageElement?R.push(J):R.push(new Qm(J.data,J.width,J.height)))}r[C.uuid]=new of(R)}else{const R=await p(C.url);r[C.uuid]=new of(R)}}}return r}parseTextures(e,t){function r(p,y){return typeof p=="number"?p:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",p),y[p])}const c={};if(e!==void 0)for(let p=0,y=e.length;p<y;p++){const i=e[p];i.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',i.uuid),t[i.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",i.image);const C=t[i.image],D=C.data;let R;Array.isArray(D)?(R=new Ay,D.length===6&&(R.needsUpdate=!0)):(D&&D.data?R=new Qm:R=new To,D&&(R.needsUpdate=!0)),R.source=C,R.uuid=i.uuid,i.name!==void 0&&(R.name=i.name),i.mapping!==void 0&&(R.mapping=r(i.mapping,_Q)),i.offset!==void 0&&R.offset.fromArray(i.offset),i.repeat!==void 0&&R.repeat.fromArray(i.repeat),i.center!==void 0&&R.center.fromArray(i.center),i.rotation!==void 0&&(R.rotation=i.rotation),i.wrap!==void 0&&(R.wrapS=r(i.wrap[0],QT),R.wrapT=r(i.wrap[1],QT)),i.format!==void 0&&(R.format=i.format),i.type!==void 0&&(R.type=i.type),i.encoding!==void 0&&(R.encoding=i.encoding),i.minFilter!==void 0&&(R.minFilter=r(i.minFilter,VT)),i.magFilter!==void 0&&(R.magFilter=r(i.magFilter,VT)),i.anisotropy!==void 0&&(R.anisotropy=i.anisotropy),i.flipY!==void 0&&(R.flipY=i.flipY),i.generateMipmaps!==void 0&&(R.generateMipmaps=i.generateMipmaps),i.premultiplyAlpha!==void 0&&(R.premultiplyAlpha=i.premultiplyAlpha),i.unpackAlignment!==void 0&&(R.unpackAlignment=i.unpackAlignment),i.userData!==void 0&&(R.userData=i.userData),c[i.uuid]=R}return c}parseObject(e,t,r,c,p){let y;function i(z){return t[z]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",z),t[z]}function C(z){if(z!==void 0){if(Array.isArray(z)){const G=[];for(let J=0,Y=z.length;J<Y;J++){const B=z[J];r[B]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",B),G.push(r[B])}return G}return r[z]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",z),r[z]}}function D(z){return c[z]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",z),c[z]}let R,Q;switch(e.type){case"Scene":y=new K2,e.background!==void 0&&(Number.isInteger(e.background)?y.background=new Dn(e.background):y.background=D(e.background)),e.environment!==void 0&&(y.environment=D(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?y.fog=new Wv(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(y.fog=new Gv(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(y.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(y.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":y=new _a(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(y.focus=e.focus),e.zoom!==void 0&&(y.zoom=e.zoom),e.filmGauge!==void 0&&(y.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(y.filmOffset=e.filmOffset),e.view!==void 0&&(y.view=Object.assign({},e.view));break;case"OrthographicCamera":y=new dy(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(y.zoom=e.zoom),e.view!==void 0&&(y.view=Object.assign({},e.view));break;case"AmbientLight":y=new gB(e.color,e.intensity);break;case"DirectionalLight":y=new mB(e.color,e.intensity);break;case"PointLight":y=new fB(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":y=new xF(e.color,e.intensity,e.width,e.height);break;case"SpotLight":y=new yF(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":y=new dB(e.color,e.groundColor,e.intensity);break;case"LightProbe":y=new qv().fromJSON(e);break;case"SkinnedMesh":R=i(e.geometry),Q=C(e.material),y=new qI(R,Q),e.bindMode!==void 0&&(y.bindMode=e.bindMode),e.bindMatrix!==void 0&&y.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(y.skeleton=e.skeleton);break;case"Mesh":R=i(e.geometry),Q=C(e.material),y=new us(R,Q);break;case"InstancedMesh":R=i(e.geometry),Q=C(e.material);const z=e.count,G=e.instanceMatrix,J=e.instanceColor;y=new YI(R,Q,z),y.instanceMatrix=new Km(new Float32Array(G.array),16),J!==void 0&&(y.instanceColor=new Km(new Float32Array(J.array),J.itemSize));break;case"LOD":y=new XI;break;case"Line":y=new Ku(i(e.geometry),C(e.material));break;case"LineLoop":y=new mv(i(e.geometry),C(e.material));break;case"LineSegments":y=new Yu(i(e.geometry),C(e.material));break;case"PointCloud":case"Points":y=new q2(i(e.geometry),C(e.material));break;case"Sprite":y=new $2(C(e.material));break;case"Group":y=new Hs;break;case"Bone":y=new Z2;break;default:y=new ls}if(y.uuid=e.uuid,e.name!==void 0&&(y.name=e.name),e.matrix!==void 0?(y.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(y.matrixAutoUpdate=e.matrixAutoUpdate),y.matrixAutoUpdate&&y.matrix.decompose(y.position,y.quaternion,y.scale)):(e.position!==void 0&&y.position.fromArray(e.position),e.rotation!==void 0&&y.rotation.fromArray(e.rotation),e.quaternion!==void 0&&y.quaternion.fromArray(e.quaternion),e.scale!==void 0&&y.scale.fromArray(e.scale)),e.castShadow!==void 0&&(y.castShadow=e.castShadow),e.receiveShadow!==void 0&&(y.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(y.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(y.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(y.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&y.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(y.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(y.visible=e.visible),e.frustumCulled!==void 0&&(y.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(y.renderOrder=e.renderOrder),e.userData!==void 0&&(y.userData=e.userData),e.layers!==void 0&&(y.layers.mask=e.layers),e.children!==void 0){const z=e.children;for(let G=0;G<z.length;G++)y.add(this.parseObject(z[G],t,r,c,p))}if(e.animations!==void 0){const z=e.animations;for(let G=0;G<z.length;G++){const J=z[G];y.animations.push(p[J])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(y.autoUpdate=e.autoUpdate);const z=e.levels;for(let G=0;G<z.length;G++){const J=z[G],Y=y.getObjectByProperty("uuid",J.object);Y!==void 0&&y.addLevel(Y,J.distance,J.hysteresis)}}return y}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const c=t[r.skeleton];c===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(c,r.bindMatrix)}})}}const _Q={UVMapping:kv,CubeReflectionMapping:rp,CubeRefractionMapping:sp,EquirectangularReflectionMapping:O_,EquirectangularRefractionMapping:N_,CubeUVReflectionMapping:qm},QT={RepeatWrapping:HA,ClampToEdgeWrapping:nl,MirroredRepeatWrapping:Q_},VT={NearestFilter:Co,NearestMipmapNearestFilter:Av,NearestMipmapLinearFilter:M_,LinearFilter:Xs,LinearMipmapNearestFilter:R2,LinearMipmapLinearFilter:op};class yQ extends Uc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,c){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const p=this,y=yf.get(e);if(y!==void 0)return p.manager.itemStart(e),setTimeout(function(){t&&t(y),p.manager.itemEnd(e)},0),y;const i={};i.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",i.headers=this.requestHeader,fetch(e,i).then(function(C){return C.blob()}).then(function(C){return createImageBitmap(C,Object.assign(p.options,{colorSpaceConversion:"none"}))}).then(function(C){yf.add(e,C),t&&t(C),p.manager.itemEnd(e)}).catch(function(C){c&&c(C),p.manager.itemError(e),p.manager.itemEnd(e)}),p.manager.itemStart(e)}}let Sx;class yB{static getContext(){return Sx===void 0&&(Sx=new(window.AudioContext||window.webkitAudioContext)),Sx}static setContext(e){Sx=e}}class xQ extends Uc{constructor(e){super(e)}load(e,t,r,c){const p=this,y=new ZA(this.manager);y.setResponseType("arraybuffer"),y.setPath(this.path),y.setRequestHeader(this.requestHeader),y.setWithCredentials(this.withCredentials),y.load(e,function(i){try{const C=i.slice(0);yB.getContext().decodeAudioData(C,function(R){t(R)})}catch(C){c?c(C):console.error(C),p.manager.itemError(e)}},r,c)}}class vQ extends qv{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;const c=new Dn().set(e),p=new Dn().set(t),y=new ft(c.r,c.g,c.b),i=new ft(p.r,p.g,p.b),C=Math.sqrt(Math.PI),D=C*Math.sqrt(.75);this.sh.coefficients[0].copy(y).add(i).multiplyScalar(C),this.sh.coefficients[1].copy(y).sub(i).multiplyScalar(D)}}class bF extends qv{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const r=new Dn().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const HT=new ar,GT=new ar,Qp=new ar;class wQ{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new _a,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _a,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Qp.copy(e.projectionMatrix);const c=t.eyeSep/2,p=c*t.near/t.focus,y=t.near*Math.tan(Af*t.fov*.5)/t.zoom;let i,C;GT.elements[12]=-c,HT.elements[12]=c,i=-y*t.aspect+p,C=y*t.aspect+p,Qp.elements[0]=2*t.near/(C-i),Qp.elements[8]=(C+i)/(C-i),this.cameraL.projectionMatrix.copy(Qp),i=-y*t.aspect-p,C=y*t.aspect-p,Qp.elements[0]=2*t.near/(C-i),Qp.elements[8]=(C+i)/(C-i),this.cameraR.projectionMatrix.copy(Qp)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(GT),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(HT)}}class Jv{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=WT(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=WT();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function WT(){return(typeof performance>"u"?Date:performance).now()}const Vp=new ft,jT=new sl,bQ=new ft,Hp=new ft;class BQ extends ls{constructor(){super(),this.type="AudioListener",this.context=yB.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Jv}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Vp,jT,bQ),Hp.set(0,0,-1).applyQuaternion(jT),t.positionX){const c=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Vp.x,c),t.positionY.linearRampToValueAtTime(Vp.y,c),t.positionZ.linearRampToValueAtTime(Vp.z,c),t.forwardX.linearRampToValueAtTime(Hp.x,c),t.forwardY.linearRampToValueAtTime(Hp.y,c),t.forwardZ.linearRampToValueAtTime(Hp.z,c),t.upX.linearRampToValueAtTime(r.x,c),t.upY.linearRampToValueAtTime(r.y,c),t.upZ.linearRampToValueAtTime(r.z,c)}else t.setPosition(Vp.x,Vp.y,Vp.z),t.setOrientation(Hp.x,Hp.y,Hp.z,r.x,r.y,r.z)}}class BF extends ls{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Gp=new ft,KT=new sl,CQ=new ft,Wp=new ft;class EQ extends BF{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Gp,KT,CQ),Wp.set(0,0,1).applyQuaternion(KT);const t=this.panner;if(t.positionX){const r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Gp.x,r),t.positionY.linearRampToValueAtTime(Gp.y,r),t.positionZ.linearRampToValueAtTime(Gp.z,r),t.orientationX.linearRampToValueAtTime(Wp.x,r),t.orientationY.linearRampToValueAtTime(Wp.y,r),t.orientationZ.linearRampToValueAtTime(Wp.z,r)}else t.setPosition(Gp.x,Gp.y,Gp.z),t.setOrientation(Wp.x,Wp.y,Wp.z)}}class TQ{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}}class CF{constructor(e,t,r){this.binding=e,this.valueSize=r;let c,p,y;switch(t){case"quaternion":c=this._slerp,p=this._slerpAdditive,y=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":c=this._select,p=this._select,y=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:c=this._lerp,p=this._lerpAdditive,y=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=c,this._mixBufferRegionAdditive=p,this._setIdentity=y,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,c=this.valueSize,p=e*c+c;let y=this.cumulativeWeight;if(y===0){for(let i=0;i!==c;++i)r[p+i]=r[i];y=t}else{y+=t;const i=t/y;this._mixBufferRegion(r,p,0,i,c)}this.cumulativeWeight=y}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,c=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,c,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,c=e*t+t,p=this.cumulativeWeight,y=this.cumulativeWeightAdditive,i=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,p<1){const C=t*this._origIndex;this._mixBufferRegion(r,c,C,1-p,t)}y>0&&this._mixBufferRegionAdditive(r,c,this._addIndex*t,1,t);for(let C=t,D=t+t;C!==D;++C)if(r[C]!==r[C+t]){i.setValue(r,c);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,c=r*this._origIndex;e.getValue(t,c);for(let p=r,y=c;p!==y;++p)t[p]=t[c+p%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,c,p){if(c>=.5)for(let y=0;y!==p;++y)e[t+y]=e[r+y]}_slerp(e,t,r,c){sl.slerpFlat(e,t,e,t,e,r,c)}_slerpAdditive(e,t,r,c,p){const y=this._workIndex*p;sl.multiplyQuaternionsFlat(e,y,e,t,e,r),sl.slerpFlat(e,t,e,t,e,y,c)}_lerp(e,t,r,c,p){const y=1-c;for(let i=0;i!==p;++i){const C=t+i;e[C]=e[C]*y+e[r+i]*c}}_lerpAdditive(e,t,r,c,p){for(let y=0;y!==p;++y){const i=t+y;e[i]=e[i]+e[r+y]*c}}}const xB="\\[\\]\\.:\\/",SQ=new RegExp("["+xB+"]","g"),vB="[^"+xB+"]",MQ="[^"+xB.replace("\\.","")+"]",IQ=/((?:WC+[\/:])*)/.source.replace("WC",vB),FQ=/(WCOD+)?/.source.replace("WCOD",MQ),LQ=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",vB),DQ=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",vB),PQ=new RegExp("^"+IQ+FQ+LQ+DQ+"$"),UQ=["material","materials","bones","map"];class RQ{constructor(e,t,r){const c=r||os.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,c)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,c=this._bindings[r];c!==void 0&&c.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let c=this._targetGroup.nCachedObjects_,p=r.length;c!==p;++c)r[c].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class os{constructor(e,t,r){this.path=t,this.parsedPath=r||os.parseTrackName(t),this.node=os.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new os.Composite(e,t,r):new os(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(SQ,"")}static parseTrackName(e){const t=PQ.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},c=r.nodeName&&r.nodeName.lastIndexOf(".");if(c!==void 0&&c!==-1){const p=r.nodeName.substring(c+1);UQ.indexOf(p)!==-1&&(r.nodeName=r.nodeName.substring(0,c),r.objectName=p)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(p){for(let y=0;y<p.length;y++){const i=p[y];if(i.name===t||i.uuid===t)return i;const C=r(i.children);if(C)return C}return null},c=r(e.children);if(c)return c}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)e[t++]=r[c]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)r[c]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)r[c]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const r=this.resolvedProperty;for(let c=0,p=r.length;c!==p;++c)r[c]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,r=t.objectName,c=t.propertyName;let p=t.propertyIndex;if(e||(e=os.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(r){let D=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let R=0;R<e.length;R++)if(e[R].name===D){D=R;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(D!==void 0){if(e[D]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[D]}}const y=e[c];if(y===void 0){const D=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+D+"."+c+" but it wasn't found.",e);return}let i=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?i=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(i=this.Versioning.MatrixWorldNeedsUpdate);let C=this.BindingType.Direct;if(p!==void 0){if(c==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[p]!==void 0&&(p=e.morphTargetDictionary[p])}C=this.BindingType.ArrayElement,this.resolvedProperty=y,this.propertyIndex=p}else y.fromArray!==void 0&&y.toArray!==void 0?(C=this.BindingType.HasFromToArray,this.resolvedProperty=y):Array.isArray(y)?(C=this.BindingType.EntireArray,this.resolvedProperty=y):this.propertyName=c;this.getValue=this.GetterByBindingType[C],this.setValue=this.SetterByBindingTypeAndVersioning[C][i]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}os.Composite=RQ;os.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};os.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};os.prototype.GetterByBindingType=[os.prototype._getValue_direct,os.prototype._getValue_array,os.prototype._getValue_arrayElement,os.prototype._getValue_toArray];os.prototype.SetterByBindingTypeAndVersioning=[[os.prototype._setValue_direct,os.prototype._setValue_direct_setNeedsUpdate,os.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[os.prototype._setValue_array,os.prototype._setValue_array_setNeedsUpdate,os.prototype._setValue_array_setMatrixWorldNeedsUpdate],[os.prototype._setValue_arrayElement,os.prototype._setValue_arrayElement_setNeedsUpdate,os.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[os.prototype._setValue_fromArray,os.prototype._setValue_fromArray_setNeedsUpdate,os.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class zQ{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Pc(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,c=arguments.length;r!==c;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,r=this._paths,c=this._parsedPaths,p=this._bindings,y=p.length;let i,C=e.length,D=this.nCachedObjects_;for(let R=0,Q=arguments.length;R!==Q;++R){const z=arguments[R],G=z.uuid;let J=t[G];if(J===void 0){J=C++,t[G]=J,e.push(z);for(let Y=0,B=y;Y!==B;++Y)p[Y].push(new os(z,r[Y],c[Y]))}else if(J<D){i=e[J];const Y=--D,B=e[Y];t[B.uuid]=J,e[J]=B,t[G]=Y,e[Y]=z;for(let ae=0,ce=y;ae!==ce;++ae){const Ae=p[ae],we=Ae[Y];let me=Ae[J];Ae[J]=we,me===void 0&&(me=new os(z,r[ae],c[ae])),Ae[Y]=me}}else e[J]!==i&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=D}remove(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,c=r.length;let p=this.nCachedObjects_;for(let y=0,i=arguments.length;y!==i;++y){const C=arguments[y],D=C.uuid,R=t[D];if(R!==void 0&&R>=p){const Q=p++,z=e[Q];t[z.uuid]=R,e[R]=z,t[D]=Q,e[Q]=C;for(let G=0,J=c;G!==J;++G){const Y=r[G],B=Y[Q],ae=Y[R];Y[R]=B,Y[Q]=ae}}}this.nCachedObjects_=p}uncache(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,c=r.length;let p=this.nCachedObjects_,y=e.length;for(let i=0,C=arguments.length;i!==C;++i){const D=arguments[i],R=D.uuid,Q=t[R];if(Q!==void 0)if(delete t[R],Q<p){const z=--p,G=e[z],J=--y,Y=e[J];t[G.uuid]=Q,e[Q]=G,t[Y.uuid]=z,e[z]=Y,e.pop();for(let B=0,ae=c;B!==ae;++B){const ce=r[B],Ae=ce[z],we=ce[J];ce[Q]=Ae,ce[z]=we,ce.pop()}}else{const z=--y,G=e[z];z>0&&(t[G.uuid]=Q),e[Q]=G,e.pop();for(let J=0,Y=c;J!==Y;++J){const B=r[J];B[Q]=B[z],B.pop()}}}this.nCachedObjects_=p}subscribe_(e,t){const r=this._bindingsIndicesByPath;let c=r[e];const p=this._bindings;if(c!==void 0)return p[c];const y=this._paths,i=this._parsedPaths,C=this._objects,D=C.length,R=this.nCachedObjects_,Q=new Array(D);c=p.length,r[e]=c,y.push(e),i.push(t),p.push(Q);for(let z=R,G=C.length;z!==G;++z){const J=C[z];Q[z]=new os(J,e,t)}return Q}unsubscribe_(e){const t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){const c=this._paths,p=this._parsedPaths,y=this._bindings,i=y.length-1,C=y[i],D=e[i];t[D]=r,y[r]=C,y.pop(),p[r]=p[i],p.pop(),c[r]=c[i],c.pop()}}}class kQ{constructor(e,t,r=null,c=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=c;const p=t.tracks,y=p.length,i=new Array(y),C={endingStart:rf,endingEnd:rf};for(let D=0;D!==y;++D){const R=p[D].createInterpolant(null);i[D]=R,R.settings=C}this._interpolantSettings=C,this._interpolants=i,this._propertyBindings=new Array(y),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=TI,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){const c=this._clip.duration,p=e._clip.duration,y=p/c,i=c/p;e.warp(1,y,t),this.warp(i,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){const c=this._mixer,p=c.time,y=this.timeScale;let i=this._timeScaleInterpolant;i===null&&(i=c._lendControlInterpolant(),this._timeScaleInterpolant=i);const C=i.parameterPositions,D=i.sampleValues;return C[0]=p,C[1]=p+r,D[0]=e/y,D[1]=t/y,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,c){if(!this.enabled){this._updateWeight(e);return}const p=this._startTime;if(p!==null){const C=(e-p)*r;C<0||r===0?t=0:(this._startTime=null,t=r*C)}t*=this._updateTimeScale(e);const y=this._updateTime(t),i=this._updateWeight(e);if(i>0){const C=this._interpolants,D=this._propertyBindings;switch(this.blendMode){case k2:for(let R=0,Q=C.length;R!==Q;++R)C[R].evaluate(y),D[R].accumulateAdditive(i);break;case Ov:default:for(let R=0,Q=C.length;R!==Q;++R)C[R].evaluate(y),D[R].accumulate(c,i)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const c=r.evaluate(e)[0];t*=c,e>r.parameterPositions[1]&&(this.stopFading(),c===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const c=r.evaluate(e)[0];t*=c,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let c=this.time+e,p=this._loopCount;const y=r===SI;if(e===0)return p===-1?c:y&&(p&1)===1?t-c:c;if(r===EI){p===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(c>=t)c=t;else if(c<0)c=0;else{this.time=c;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=c,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(p===-1&&(e>=0?(p=0,this._setEndings(!0,this.repetitions===0,y)):this._setEndings(this.repetitions===0,!0,y)),c>=t||c<0){const i=Math.floor(c/t);c-=t*i,p+=Math.abs(i);const C=this.repetitions-p;if(C<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,c=e>0?t:0,this.time=c,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(C===1){const D=e<0;this._setEndings(D,!D,y)}else this._setEndings(!1,!1,y);this._loopCount=p,this.time=c,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=c;if(y&&(p&1)===1)return t-c}return c}_setEndings(e,t,r){const c=this._interpolantSettings;r?(c.endingStart=sf,c.endingEnd=sf):(e?c.endingStart=this.zeroSlopeAtStart?sf:rf:c.endingStart=G_,t?c.endingEnd=this.zeroSlopeAtEnd?sf:rf:c.endingEnd=G_)}_scheduleFading(e,t,r){const c=this._mixer,p=c.time;let y=this._weightInterpolant;y===null&&(y=c._lendControlInterpolant(),this._weightInterpolant=y);const i=y.parameterPositions,C=y.sampleValues;return i[0]=p,C[0]=t,i[1]=p+e,C[1]=r,this}}const OQ=new Float32Array(1);class NQ extends Xu{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,c=e._clip.tracks,p=c.length,y=e._propertyBindings,i=e._interpolants,C=r.uuid,D=this._bindingsByRootAndName;let R=D[C];R===void 0&&(R={},D[C]=R);for(let Q=0;Q!==p;++Q){const z=c[Q],G=z.name;let J=R[G];if(J!==void 0)++J.referenceCount,y[Q]=J;else{if(J=y[Q],J!==void 0){J._cacheIndex===null&&(++J.referenceCount,this._addInactiveBinding(J,C,G));continue}const Y=t&&t._propertyBindings[Q].binding.parsedPath;J=new CF(os.create(r,G,Y),z.ValueTypeName,z.getValueSize()),++J.referenceCount,this._addInactiveBinding(J,C,G),y[Q]=J}i[Q].resultBuffer=J.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,c=e._clip.uuid,p=this._actionsByClip[c];this._bindAction(e,p&&p.knownActions[0]),this._addInactiveAction(e,c,r)}const t=e._propertyBindings;for(let r=0,c=t.length;r!==c;++r){const p=t[r];p.useCount++===0&&(this._lendBinding(p),p.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,c=t.length;r!==c;++r){const p=t[r];--p.useCount===0&&(p.restoreOriginalState(),this._takeBackBinding(p))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){const c=this._actions,p=this._actionsByClip;let y=p[t];if(y===void 0)y={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,p[t]=y;else{const i=y.knownActions;e._byClipCacheIndex=i.length,i.push(e)}e._cacheIndex=c.length,c.push(e),y.actionByRoot[r]=e}_removeInactiveAction(e){const t=this._actions,r=t[t.length-1],c=e._cacheIndex;r._cacheIndex=c,t[c]=r,t.pop(),e._cacheIndex=null;const p=e._clip.uuid,y=this._actionsByClip,i=y[p],C=i.knownActions,D=C[C.length-1],R=e._byClipCacheIndex;D._byClipCacheIndex=R,C[R]=D,C.pop(),e._byClipCacheIndex=null;const Q=i.actionByRoot,z=(e._localRoot||this._root).uuid;delete Q[z],C.length===0&&delete y[p],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let r=0,c=t.length;r!==c;++r){const p=t[r];--p.referenceCount===0&&this._removeInactiveBinding(p)}}_lendAction(e){const t=this._actions,r=e._cacheIndex,c=this._nActiveActions++,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_takeBackAction(e){const t=this._actions,r=e._cacheIndex,c=--this._nActiveActions,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_addInactiveBinding(e,t,r){const c=this._bindingsByRootAndName,p=this._bindings;let y=c[t];y===void 0&&(y={},c[t]=y),y[r]=e,e._cacheIndex=p.length,p.push(e)}_removeInactiveBinding(e){const t=this._bindings,r=e.binding,c=r.rootNode.uuid,p=r.path,y=this._bindingsByRootAndName,i=y[c],C=t[t.length-1],D=e._cacheIndex;C._cacheIndex=D,t[D]=C,t.pop(),delete i[p],Object.keys(i).length===0&&delete y[c]}_lendBinding(e){const t=this._bindings,r=e._cacheIndex,c=this._nActiveBindings++,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_takeBackBinding(e){const t=this._bindings,r=e._cacheIndex,c=--this._nActiveBindings,p=t[c];e._cacheIndex=c,t[c]=e,p._cacheIndex=r,t[r]=p}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let r=e[t];return r===void 0&&(r=new hB(new Float32Array(2),new Float32Array(2),1,OQ),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){const t=this._controlInterpolants,r=e.__cacheIndex,c=--this._nActiveControlInterpolants,p=t[c];e.__cacheIndex=c,t[c]=e,p.__cacheIndex=r,t[r]=p}clipAction(e,t,r){const c=t||this._root,p=c.uuid;let y=typeof e=="string"?iy.findByName(c,e):e;const i=y!==null?y.uuid:e,C=this._actionsByClip[i];let D=null;if(r===void 0&&(y!==null?r=y.blendMode:r=Ov),C!==void 0){const Q=C.actionByRoot[p];if(Q!==void 0&&Q.blendMode===r)return Q;D=C.knownActions[0],y===null&&(y=D._clip)}if(y===null)return null;const R=new kQ(this,y,t,r);return this._bindAction(R,D),this._addInactiveAction(R,i,p),R}existingAction(e,t){const r=t||this._root,c=r.uuid,p=typeof e=="string"?iy.findByName(r,e):e,y=p?p.uuid:e,i=this._actionsByClip[y];return i!==void 0&&i.actionByRoot[c]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,c=this.time+=e,p=Math.sign(e),y=this._accuIndex^=1;for(let D=0;D!==r;++D)t[D]._update(c,e,p,y);const i=this._bindings,C=this._nActiveBindings;for(let D=0;D!==C;++D)i[D].apply(y);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,r=e.uuid,c=this._actionsByClip,p=c[r];if(p!==void 0){const y=p.knownActions;for(let i=0,C=y.length;i!==C;++i){const D=y[i];this._deactivateAction(D);const R=D._cacheIndex,Q=t[t.length-1];D._cacheIndex=null,D._byClipCacheIndex=null,Q._cacheIndex=R,t[R]=Q,t.pop(),this._removeInactiveBindingsForAction(D)}delete c[r]}}uncacheRoot(e){const t=e.uuid,r=this._actionsByClip;for(const y in r){const i=r[y].actionByRoot,C=i[t];C!==void 0&&(this._deactivateAction(C),this._removeInactiveAction(C))}const c=this._bindingsByRootAndName,p=c[t];if(p!==void 0)for(const y in p){const i=p[y];i.restoreOriginalState(),this._removeInactiveBinding(i)}}uncacheAction(e,t){const r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class wB{constructor(e){this.value=e}clone(){return new wB(this.value.clone===void 0?this.value:this.value.clone())}}let QQ=0;class VQ extends Xu{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:QQ++}),this.name="",this.usage=W_,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let r=0,c=t.length;r<c;r++)this.uniforms.push(t[r].clone());return this}clone(){return new this.constructor().copy(this)}}class _v extends jv{constructor(e,t,r=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class HQ{constructor(e,t,r,c,p){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=c,this.count=p,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class p2{constructor(e,t,r=0,c=1/0){this.ray=new cy(e,t),this.near=r,this.far=c,this.camera=null,this.layers=new uy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return f2(e,this,r,t),r.sort($T),r}intersectObjects(e,t=!0,r=[]){for(let c=0,p=e.length;c<p;c++)f2(e[c],this,r,t);return r.sort($T),r}}function $T(u,e){return u.distance-e.distance}function f2(u,e,t,r){if(u.layers.test(e.layers)&&u.raycast(e,t),r===!0){const c=u.children;for(let p=0,y=c.length;p<y;p++)f2(c[p],e,t,!0)}}class m2{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Eo(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class GQ{constructor(e=1,t=0,r=0){return this.radius=e,this.theta=t,this.y=r,this}set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return new this.constructor().copy(this)}}const ZT=new Di;class WQ{constructor(e=new Di(1/0,1/0),t=new Di(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=ZT.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ZT.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const XT=new ft,Mx=new ft;class EF{constructor(e=new ft,t=new ft){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){XT.subVectors(e,this.start),Mx.subVectors(this.end,this.start);const r=Mx.dot(Mx);let p=Mx.dot(XT)/r;return t&&(p=Eo(p,0,1)),p}closestPointToPoint(e,t,r){const c=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(c).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const qT=new ft;class jQ extends ls{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new br,c=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let y=0,i=1,C=32;y<C;y++,i++){const D=y/C*Math.PI*2,R=i/C*Math.PI*2;c.push(Math.cos(D),Math.sin(D),1,Math.cos(R),Math.sin(R),1)}r.setAttribute("position",new jn(c,3));const p=new ra({fog:!1,toneMapped:!1});this.cone=new Yu(r,p),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),qT.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(qT),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Nd=new ft,Ix=new ar,qw=new ar;class KQ extends Yu{constructor(e){const t=TF(e),r=new br,c=[],p=[],y=new Dn(0,0,1),i=new Dn(0,1,0);for(let D=0;D<t.length;D++){const R=t[D];R.parent&&R.parent.isBone&&(c.push(0,0,0),c.push(0,0,0),p.push(y.r,y.g,y.b),p.push(i.r,i.g,i.b))}r.setAttribute("position",new jn(c,3)),r.setAttribute("color",new jn(p,3));const C=new ra({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,C),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,r=this.geometry,c=r.getAttribute("position");qw.copy(this.root.matrixWorld).invert();for(let p=0,y=0;p<t.length;p++){const i=t[p];i.parent&&i.parent.isBone&&(Ix.multiplyMatrices(qw,i.matrixWorld),Nd.setFromMatrixPosition(Ix),c.setXYZ(y,Nd.x,Nd.y,Nd.z),Ix.multiplyMatrices(qw,i.parent.matrixWorld),Nd.setFromMatrixPosition(Ix),c.setXYZ(y+1,Nd.x,Nd.y,Nd.z),y+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function TF(u){const e=[];u.isBone===!0&&e.push(u);for(let t=0;t<u.children.length;t++)e.push.apply(e,TF(u.children[t]));return e}class $Q extends us{constructor(e,t,r){const c=new Vu(t,4,2),p=new za({wireframe:!0,fog:!1,toneMapped:!1});super(c,p),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const ZQ=new ft,YT=new Dn,JT=new Dn;class SF extends ls{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const c=new eg(t);c.rotateY(Math.PI*.5),this.material=new za({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const p=c.getAttribute("position"),y=new Float32Array(p.count*3);c.setAttribute("color",new As(y,3)),this.add(new us(c,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");YT.copy(this.light.color),JT.copy(this.light.groundColor);for(let r=0,c=t.count;r<c;r++){const p=r<c/2?YT:JT;t.setXYZ(r,p.r,p.g,p.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(ZQ.setFromMatrixPosition(this.light.matrixWorld).negate())}}class XQ extends Yu{constructor(e=10,t=10,r=4473924,c=8947848){r=new Dn(r),c=new Dn(c);const p=t/2,y=e/t,i=e/2,C=[],D=[];for(let z=0,G=0,J=-i;z<=t;z++,J+=y){C.push(-i,0,J,i,0,J),C.push(J,0,-i,J,0,i);const Y=z===p?r:c;Y.toArray(D,G),G+=3,Y.toArray(D,G),G+=3,Y.toArray(D,G),G+=3,Y.toArray(D,G),G+=3}const R=new br;R.setAttribute("position",new jn(C,3)),R.setAttribute("color",new jn(D,3));const Q=new ra({vertexColors:!0,toneMapped:!1});super(R,Q),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class qQ extends Yu{constructor(e=10,t=16,r=8,c=64,p=4473924,y=8947848){p=new Dn(p),y=new Dn(y);const i=[],C=[];if(t>1)for(let Q=0;Q<t;Q++){const z=Q/t*(Math.PI*2),G=Math.sin(z)*e,J=Math.cos(z)*e;i.push(0,0,0),i.push(G,0,J);const Y=Q&1?p:y;C.push(Y.r,Y.g,Y.b),C.push(Y.r,Y.g,Y.b)}for(let Q=0;Q<r;Q++){const z=Q&1?p:y,G=e-e/r*Q;for(let J=0;J<c;J++){let Y=J/c*(Math.PI*2),B=Math.sin(Y)*G,ae=Math.cos(Y)*G;i.push(B,0,ae),C.push(z.r,z.g,z.b),Y=(J+1)/c*(Math.PI*2),B=Math.sin(Y)*G,ae=Math.cos(Y)*G,i.push(B,0,ae),C.push(z.r,z.g,z.b)}}const D=new br;D.setAttribute("position",new jn(i,3)),D.setAttribute("color",new jn(C,3));const R=new ra({vertexColors:!0,toneMapped:!1});super(D,R),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const eS=new ft,Fx=new ft,tS=new ft;class MF extends ls{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",t===void 0&&(t=1);let c=new br;c.setAttribute("position",new jn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const p=new ra({fog:!1,toneMapped:!1});this.lightPlane=new Ku(c,p),this.add(this.lightPlane),c=new br,c.setAttribute("position",new jn([0,0,0,0,0,1],3)),this.targetLine=new Ku(c,p),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),eS.setFromMatrixPosition(this.light.matrixWorld),Fx.setFromMatrixPosition(this.light.target.matrixWorld),tS.subVectors(Fx,eS),this.lightPlane.lookAt(Fx),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Fx),this.targetLine.scale.z=tS.length()}}const Lx=new ft,po=new Qv;class IF extends Yu{constructor(e){const t=new br,r=new ra({color:16777215,vertexColors:!0,toneMapped:!1}),c=[],p=[],y={};i("n1","n2"),i("n2","n4"),i("n4","n3"),i("n3","n1"),i("f1","f2"),i("f2","f4"),i("f4","f3"),i("f3","f1"),i("n1","f1"),i("n2","f2"),i("n3","f3"),i("n4","f4"),i("p","n1"),i("p","n2"),i("p","n3"),i("p","n4"),i("u1","u2"),i("u2","u3"),i("u3","u1"),i("c","t"),i("p","c"),i("cn1","cn2"),i("cn3","cn4"),i("cf1","cf2"),i("cf3","cf4");function i(J,Y){C(J),C(Y)}function C(J){c.push(0,0,0),p.push(0,0,0),y[J]===void 0&&(y[J]=[]),y[J].push(c.length/3-1)}t.setAttribute("position",new jn(c,3)),t.setAttribute("color",new jn(p,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=y,this.update();const D=new Dn(16755200),R=new Dn(16711680),Q=new Dn(43775),z=new Dn(16777215),G=new Dn(3355443);this.setColors(D,R,Q,z,G)}setColors(e,t,r,c,p){const i=this.geometry.getAttribute("color");i.setXYZ(0,e.r,e.g,e.b),i.setXYZ(1,e.r,e.g,e.b),i.setXYZ(2,e.r,e.g,e.b),i.setXYZ(3,e.r,e.g,e.b),i.setXYZ(4,e.r,e.g,e.b),i.setXYZ(5,e.r,e.g,e.b),i.setXYZ(6,e.r,e.g,e.b),i.setXYZ(7,e.r,e.g,e.b),i.setXYZ(8,e.r,e.g,e.b),i.setXYZ(9,e.r,e.g,e.b),i.setXYZ(10,e.r,e.g,e.b),i.setXYZ(11,e.r,e.g,e.b),i.setXYZ(12,e.r,e.g,e.b),i.setXYZ(13,e.r,e.g,e.b),i.setXYZ(14,e.r,e.g,e.b),i.setXYZ(15,e.r,e.g,e.b),i.setXYZ(16,e.r,e.g,e.b),i.setXYZ(17,e.r,e.g,e.b),i.setXYZ(18,e.r,e.g,e.b),i.setXYZ(19,e.r,e.g,e.b),i.setXYZ(20,e.r,e.g,e.b),i.setXYZ(21,e.r,e.g,e.b),i.setXYZ(22,e.r,e.g,e.b),i.setXYZ(23,e.r,e.g,e.b),i.setXYZ(24,t.r,t.g,t.b),i.setXYZ(25,t.r,t.g,t.b),i.setXYZ(26,t.r,t.g,t.b),i.setXYZ(27,t.r,t.g,t.b),i.setXYZ(28,t.r,t.g,t.b),i.setXYZ(29,t.r,t.g,t.b),i.setXYZ(30,t.r,t.g,t.b),i.setXYZ(31,t.r,t.g,t.b),i.setXYZ(32,r.r,r.g,r.b),i.setXYZ(33,r.r,r.g,r.b),i.setXYZ(34,r.r,r.g,r.b),i.setXYZ(35,r.r,r.g,r.b),i.setXYZ(36,r.r,r.g,r.b),i.setXYZ(37,r.r,r.g,r.b),i.setXYZ(38,c.r,c.g,c.b),i.setXYZ(39,c.r,c.g,c.b),i.setXYZ(40,p.r,p.g,p.b),i.setXYZ(41,p.r,p.g,p.b),i.setXYZ(42,p.r,p.g,p.b),i.setXYZ(43,p.r,p.g,p.b),i.setXYZ(44,p.r,p.g,p.b),i.setXYZ(45,p.r,p.g,p.b),i.setXYZ(46,p.r,p.g,p.b),i.setXYZ(47,p.r,p.g,p.b),i.setXYZ(48,p.r,p.g,p.b),i.setXYZ(49,p.r,p.g,p.b),i.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,r=1,c=1;po.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),bo("c",t,e,po,0,0,-1),bo("t",t,e,po,0,0,1),bo("n1",t,e,po,-r,-c,-1),bo("n2",t,e,po,r,-c,-1),bo("n3",t,e,po,-r,c,-1),bo("n4",t,e,po,r,c,-1),bo("f1",t,e,po,-r,-c,1),bo("f2",t,e,po,r,-c,1),bo("f3",t,e,po,-r,c,1),bo("f4",t,e,po,r,c,1),bo("u1",t,e,po,r*.7,c*1.1,-1),bo("u2",t,e,po,-r*.7,c*1.1,-1),bo("u3",t,e,po,0,c*2,-1),bo("cf1",t,e,po,-r,0,1),bo("cf2",t,e,po,r,0,1),bo("cf3",t,e,po,0,-c,1),bo("cf4",t,e,po,0,c,1),bo("cn1",t,e,po,-r,0,-1),bo("cn2",t,e,po,r,0,-1),bo("cn3",t,e,po,0,-c,-1),bo("cn4",t,e,po,0,c,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function bo(u,e,t,r,c,p,y){Lx.set(c,p,y).unproject(r);const i=e[u];if(i!==void 0){const C=t.getAttribute("position");for(let D=0,R=i.length;D<R;D++)C.setXYZ(i[D],Lx.x,Lx.y,Lx.z)}}const Dx=new qu;class g2 extends Yu{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),c=new Float32Array(8*3),p=new br;p.setIndex(new As(r,1)),p.setAttribute("position",new As(c,3)),super(p,new ra({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Dx.setFromObject(this.object),Dx.isEmpty())return;const t=Dx.min,r=Dx.max,c=this.geometry.attributes.position,p=c.array;p[0]=r.x,p[1]=r.y,p[2]=r.z,p[3]=t.x,p[4]=r.y,p[5]=r.z,p[6]=t.x,p[7]=t.y,p[8]=r.z,p[9]=r.x,p[10]=t.y,p[11]=r.z,p[12]=r.x,p[13]=r.y,p[14]=t.z,p[15]=t.x,p[16]=r.y,p[17]=t.z,p[18]=t.x,p[19]=t.y,p[20]=t.z,p[21]=r.x,p[22]=t.y,p[23]=t.z,c.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class YQ extends Yu{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),c=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],p=new br;p.setIndex(new As(r,1)),p.setAttribute("position",new jn(c,3)),super(p,new ra({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class JQ extends Ku{constructor(e,t=1,r=16776960){const c=r,p=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],y=new br;y.setAttribute("position",new jn(p,3)),y.computeBoundingSphere(),super(y,new ra({color:c,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const i=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],C=new br;C.setAttribute("position",new jn(i,3)),C.computeBoundingSphere(),this.add(new us(C,new za({color:c,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const iS=new ft;let Px,Yw;class FF extends ls{constructor(e=new ft(0,0,1),t=new ft(0,0,0),r=1,c=16776960,p=r*.2,y=p*.2){super(),this.type="ArrowHelper",Px===void 0&&(Px=new br,Px.setAttribute("position",new jn([0,0,0,0,1,0],3)),Yw=new vf(0,.5,1,5,1),Yw.translate(0,-.5,0)),this.position.copy(t),this.line=new Ku(Px,new ra({color:c,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new us(Yw,new za({color:c,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,p,y)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{iS.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(iS,t)}}setLength(e,t=e*.2,r=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class LF extends Yu{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],c=new br;c.setAttribute("position",new jn(t,3)),c.setAttribute("color",new jn(r,3));const p=new ra({vertexColors:!0,toneMapped:!1});super(c,p),this.type="AxesHelper"}setColors(e,t,r){const c=new Dn,p=this.geometry.attributes.color.array;return c.set(e),c.toArray(p,0),c.toArray(p,3),c.set(t),c.toArray(p,6),c.toArray(p,9),c.set(r),c.toArray(p,12),c.toArray(p,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class eV{constructor(){this.type="ShapePath",this.color=new Dn,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Z_,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,c){return this.currentPath.quadraticCurveTo(e,t,r,c),this}bezierCurveTo(e,t,r,c,p,y){return this.currentPath.bezierCurveTo(e,t,r,c,p,y),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(ae){const ce=[];for(let Ae=0,we=ae.length;Ae<we;Ae++){const me=ae[Ae],De=new tp;De.curves=me.curves,ce.push(De)}return ce}function r(ae,ce){const Ae=ce.length;let we=!1;for(let me=Ae-1,De=0;De<Ae;me=De++){let Je=ce[me],Fe=ce[De],Ge=Fe.x-Je.x,Et=Fe.y-Je.y;if(Math.abs(Et)>Number.EPSILON){if(Et<0&&(Je=ce[De],Ge=-Ge,Fe=ce[me],Et=-Et),ae.y<Je.y||ae.y>Fe.y)continue;if(ae.y===Je.y){if(ae.x===Je.x)return!0}else{const li=Et*(ae.x-Je.x)-Ge*(ae.y-Je.y);if(li===0)return!0;if(li<0)continue;we=!we}}else{if(ae.y!==Je.y)continue;if(Fe.x<=ae.x&&ae.x<=Je.x||Je.x<=ae.x&&ae.x<=Fe.x)return!0}}return we}const c=Gu.isClockWise,p=this.subPaths;if(p.length===0)return[];let y,i,C;const D=[];if(p.length===1)return i=p[0],C=new tp,C.curves=i.curves,D.push(C),D;let R=!c(p[0].getPoints());R=e?!R:R;const Q=[],z=[];let G=[],J=0,Y;z[J]=void 0,G[J]=[];for(let ae=0,ce=p.length;ae<ce;ae++)i=p[ae],Y=i.getPoints(),y=c(Y),y=e?!y:y,y?(!R&&z[J]&&J++,z[J]={s:new tp,p:Y},z[J].s.curves=i.curves,R&&J++,G[J]=[]):G[J].push({h:i,p:Y[0]});if(!z[0])return t(p);if(z.length>1){let ae=!1,ce=0;for(let Ae=0,we=z.length;Ae<we;Ae++)Q[Ae]=[];for(let Ae=0,we=z.length;Ae<we;Ae++){const me=G[Ae];for(let De=0;De<me.length;De++){const Je=me[De];let Fe=!0;for(let Ge=0;Ge<z.length;Ge++)r(Je.p,z[Ge].p)&&(Ae!==Ge&&ce++,Fe?(Fe=!1,Q[Ge].push(Je)):ae=!0);Fe&&Q[Ae].push(Je)}}ce>0&&ae===!1&&(G=Q)}let B;for(let ae=0,ce=z.length;ae<ce;ae++){C=z[ae].s,D.push(C),B=G[ae];for(let Ae=0,we=B.length;Ae<we;Ae++)C.holes.push(B[Ae].h)}return D}}const VA=tV();function tV(){const u=new ArrayBuffer(4),e=new Float32Array(u),t=new Uint32Array(u),r=new Uint32Array(512),c=new Uint32Array(512);for(let C=0;C<256;++C){const D=C-127;D<-27?(r[C]=0,r[C|256]=32768,c[C]=24,c[C|256]=24):D<-14?(r[C]=1024>>-D-14,r[C|256]=1024>>-D-14|32768,c[C]=-D-1,c[C|256]=-D-1):D<=15?(r[C]=D+15<<10,r[C|256]=D+15<<10|32768,c[C]=13,c[C|256]=13):D<128?(r[C]=31744,r[C|256]=64512,c[C]=24,c[C|256]=24):(r[C]=31744,r[C|256]=64512,c[C]=13,c[C|256]=13)}const p=new Uint32Array(2048),y=new Uint32Array(64),i=new Uint32Array(64);for(let C=1;C<1024;++C){let D=C<<13,R=0;for(;(D&8388608)===0;)D<<=1,R-=8388608;D&=-8388609,R+=947912704,p[C]=D|R}for(let C=1024;C<2048;++C)p[C]=939524096+(C-1024<<13);for(let C=1;C<31;++C)y[C]=C<<23;y[31]=1199570944,y[32]=2147483648;for(let C=33;C<63;++C)y[C]=2147483648+(C-32<<23);y[63]=3347054592;for(let C=1;C<64;++C)C!==32&&(i[C]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:c,mantissaTable:p,exponentTable:y,offsetTable:i}}function iV(u){Math.abs(u)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),u=Eo(u,-65504,65504),VA.floatView[0]=u;const e=VA.uint32View[0],t=e>>23&511;return VA.baseTable[t]+((e&8388607)>>VA.shiftTable[t])}function nV(u){const e=u>>10;return VA.uint32View[0]=VA.mantissaTable[VA.offsetTable[e]+(u&1023)]+VA.exponentTable[e],VA.floatView[0]}var rV=Object.freeze({__proto__:null,fromHalfFloat:nV,toHalfFloat:iV});class sV extends qA{constructor(e,t,r,c,p,y){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,r,c,p,y)}}class oV extends fy{constructor(e,t,r,c){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,r,c)}}class aV extends my{constructor(e,t,r,c){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,r,c)}}class lV extends gf{constructor(e,t,r,c,p,y,i){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,r,c,p,y,i)}}class cV extends vf{constructor(e,t,r,c,p,y,i,C){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,r,c,p,y,i,C)}}class hV extends gy{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class uV extends _y{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class AV extends yy{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class dV extends Jm{constructor(e,t,r,c){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,r,c)}}class pV extends eg{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class DF extends xf{constructor(e,t,r,c){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,r,c)}}class fV extends YA{constructor(e,t,r,c){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,r,c)}}class mV extends xy{constructor(e,t,r,c,p,y){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,r,c,p,y)}}class gV extends tg{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class _V extends Vu{constructor(e,t,r,c,p,y,i){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,r,c,p,y,i)}}class yV extends vy{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class xV extends wy{constructor(e,t,r,c,p){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,r,c,p)}}class vV extends by{constructor(e,t,r,c,p,y){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,r,c,p,y)}}class wV extends ig{constructor(e,t,r,c,p){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,r,c,p)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:zv}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=zv);const PF=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:cI,AddEquation:qp,AddOperation:oI,AdditiveAnimationBlendMode:k2,AdditiveBlending:hv,AlphaFormat:mI,AlwaysDepth:JM,AlwaysStencilFunc:LI,AmbientLight:gB,AmbientLightProbe:bF,AnimationClip:iy,AnimationLoader:hQ,AnimationMixer:NQ,AnimationObjectGroup:zQ,AnimationUtils:oQ,ArcCurve:eF,ArrayCamera:jI,ArrowHelper:FF,Audio:BF,AudioAnalyser:TQ,AudioContext:yB,AudioListener:BQ,AudioLoader:xQ,AxesHelper:LF,BackSide:rc,BasicDepthPacking:MI,BasicShadowMap:DR,Bone:Z2,BooleanKeyframeTrack:wf,Box2:WQ,Box3:qu,Box3Helper:YQ,BoxBufferGeometry:sV,BoxGeometry:qA,BoxHelper:g2,BufferAttribute:As,BufferGeometry:br,BufferGeometryLoader:wF,ByteType:uI,Cache:yf,Camera:Qv,CameraHelper:IF,CanvasTexture:JI,CapsuleBufferGeometry:oV,CapsuleGeometry:fy,CatmullRomCurve3:$_,CineonToneMapping:lI,CircleBufferGeometry:aV,CircleGeometry:my,ClampToEdgeWrapping:nl,Clock:Jv,Color:Dn,ColorKeyframeTrack:uB,ColorManagement:el,CompressedArrayTexture:IN,CompressedTexture:Y2,CompressedTextureLoader:uQ,ConeBufferGeometry:lV,ConeGeometry:gf,CubeCamera:kI,CubeReflectionMapping:rp,CubeRefractionMapping:sp,CubeTexture:Ay,CubeTextureLoader:AQ,CubeUVReflectionMapping:qm,CubicBezierCurve:eB,CubicBezierCurve3:tF,CubicInterpolant:fF,CullFaceBack:Fb,CullFaceFront:kM,CullFaceFrontBack:LR,CullFaceNone:zM,Curve:du,CurvePath:nF,CustomBlending:NM,CustomToneMapping:hI,CylinderBufferGeometry:cV,CylinderGeometry:vf,Cylindrical:GQ,Data3DTexture:Q2,DataArrayTexture:Nv,DataTexture:Qm,DataTextureLoader:dQ,DataUtils:rV,DecrementStencilOp:jR,DecrementWrapStencilOp:$R,DefaultLoadingManager:_F,DepthFormat:ep,DepthStencilFormat:ff,DepthTexture:KI,DirectionalLight:mB,DirectionalLightHelper:MF,DiscreteInterpolant:mF,DodecahedronBufferGeometry:hV,DodecahedronGeometry:gy,DoubleSide:ga,DstAlphaFactor:KM,DstColorFactor:ZM,DynamicCopyUsage:cz,DynamicDrawUsage:nz,DynamicReadUsage:oz,EdgesGeometry:rF,EllipseCurve:$v,EqualDepth:tI,EqualStencilFunc:YR,EquirectangularReflectionMapping:O_,EquirectangularRefractionMapping:N_,Euler:hy,EventDispatcher:Xu,ExtrudeBufferGeometry:uV,ExtrudeGeometry:_y,FileLoader:ZA,Float16BufferAttribute:Hz,Float32BufferAttribute:jn,Float64BufferAttribute:Gz,FloatType:GA,Fog:Wv,FogExp2:Gv,FramebufferTexture:MN,FrontSide:uu,Frustum:Vv,GLBufferAttribute:HQ,GLSL1:uz,GLSL3:s2,GreaterDepth:nI,GreaterEqualDepth:iI,GreaterEqualStencilFunc:iz,GreaterStencilFunc:ez,GridHelper:XQ,Group:Hs,HalfFloatType:Gm,HemisphereLight:dB,HemisphereLightHelper:SF,HemisphereLightProbe:vQ,IcosahedronBufferGeometry:AV,IcosahedronGeometry:yy,ImageBitmapLoader:yQ,ImageLoader:ny,ImageUtils:N2,IncrementStencilOp:WR,IncrementWrapStencilOp:KR,InstancedBufferAttribute:Km,InstancedBufferGeometry:_B,InstancedInterleavedBuffer:_v,InstancedMesh:YI,Int16BufferAttribute:Qz,Int32BufferAttribute:Vz,Int8BufferAttribute:kz,IntType:dI,InterleavedBuffer:jv,InterleavedBufferAttribute:Dc,Interpolant:By,InterpolateDiscrete:V_,InterpolateLinear:H_,InterpolateSmooth:Zx,InvertStencilOp:ZR,KeepStencilOp:Xx,KeyframeTrack:pu,LOD:XI,LatheBufferGeometry:dV,LatheGeometry:Jm,Layers:uy,LessDepth:eI,LessEqualDepth:uv,LessEqualStencilFunc:JR,LessStencilFunc:qR,Light:hp,LightProbe:qv,Line:Ku,Line3:EF,LineBasicMaterial:ra,LineCurve:Zv,LineCurve3:iF,LineDashedMaterial:dF,LineLoop:mv,LineSegments:Yu,LinearEncoding:lp,LinearFilter:Xs,LinearInterpolant:hB,LinearMipMapLinearFilter:kR,LinearMipMapNearestFilter:zR,LinearMipmapLinearFilter:op,LinearMipmapNearestFilter:R2,LinearSRGBColorSpace:Wm,LinearToneMapping:U2,Loader:Uc,LoaderUtils:d2,LoadingManager:AB,LoopOnce:EI,LoopPingPong:SI,LoopRepeat:TI,LuminanceAlphaFormat:_I,LuminanceFormat:gI,MOUSE:jp,Material:ol,MaterialLoader:Yv,MathUtils:PI,Matrix3:Pl,Matrix4:ar,MaxEquation:Ub,Mesh:us,MeshBasicMaterial:za,MeshDepthMaterial:W2,MeshDistanceMaterial:j2,MeshLambertMaterial:gv,MeshMatcapMaterial:AF,MeshNormalMaterial:uF,MeshPhongMaterial:aB,MeshPhysicalMaterial:oB,MeshStandardMaterial:J_,MeshToonMaterial:hF,MinEquation:Pb,MirroredRepeatWrapping:Q_,MixOperation:sI,MultiplyBlending:Db,MultiplyOperation:ly,NearestFilter:Co,NearestMipMapLinearFilter:RR,NearestMipMapNearestFilter:UR,NearestMipmapLinearFilter:M_,NearestMipmapNearestFilter:Av,NeverDepth:YM,NeverStencilFunc:XR,NoBlending:KA,NoColorSpace:VR,NoToneMapping:Hu,NormalAnimationBlendMode:Ov,NormalBlending:hf,NotEqualDepth:rI,NotEqualStencilFunc:tz,NumberKeyframeTrack:ey,Object3D:ls,ObjectLoader:gQ,ObjectSpaceNormalMap:FI,OctahedronBufferGeometry:pV,OctahedronGeometry:eg,OneFactor:GM,OneMinusDstAlphaFactor:$M,OneMinusDstColorFactor:XM,OneMinusSrcAlphaFactor:P2,OneMinusSrcColorFactor:jM,OrthographicCamera:dy,PCFShadowMap:L2,PCFSoftShadowMap:OM,PMREMGenerator:a2,Path:Z_,PerspectiveCamera:_a,Plane:jd,PlaneBufferGeometry:DF,PlaneGeometry:xf,PlaneHelper:JQ,PointLight:fB,PointLightHelper:$Q,Points:q2,PointsMaterial:X2,PolarGridHelper:qQ,PolyhedronBufferGeometry:fV,PolyhedronGeometry:YA,PositionalAudio:EQ,PropertyBinding:os,PropertyMixer:CF,QuadraticBezierCurve:tB,QuadraticBezierCurve3:iB,Quaternion:sl,QuaternionKeyframeTrack:ng,QuaternionLinearInterpolant:gF,RED_GREEN_RGTC2_Format:n2,RED_RGTC1_Format:CI,REVISION:zv,RGBADepthPacking:II,RGBAFormat:Dl,RGBAIntegerFormat:bI,RGBA_ASTC_10x10_Format:Jb,RGBA_ASTC_10x5_Format:Xb,RGBA_ASTC_10x6_Format:qb,RGBA_ASTC_10x8_Format:Yb,RGBA_ASTC_12x10_Format:e2,RGBA_ASTC_12x12_Format:t2,RGBA_ASTC_4x4_Format:Vb,RGBA_ASTC_5x4_Format:Hb,RGBA_ASTC_5x5_Format:Gb,RGBA_ASTC_6x5_Format:Wb,RGBA_ASTC_6x6_Format:jb,RGBA_ASTC_8x5_Format:Kb,RGBA_ASTC_8x6_Format:$b,RGBA_ASTC_8x8_Format:Zb,RGBA_BPTC_Format:$x,RGBA_ETC2_EAC_Format:Qb,RGBA_PVRTC_2BPPV1_Format:Ob,RGBA_PVRTC_4BPPV1_Format:kb,RGBA_S3TC_DXT1_Format:Wx,RGBA_S3TC_DXT3_Format:jx,RGBA_S3TC_DXT5_Format:Kx,RGB_ETC1_Format:BI,RGB_ETC2_Format:Nb,RGB_PVRTC_2BPPV1_Format:zb,RGB_PVRTC_4BPPV1_Format:Rb,RGB_S3TC_DXT1_Format:Gx,RGFormat:vI,RGIntegerFormat:wI,RawShaderMaterial:cF,Ray:cy,Raycaster:p2,RectAreaLight:xF,RedFormat:yI,RedIntegerFormat:xI,ReinhardToneMapping:aI,RepeatWrapping:HA,ReplaceStencilOp:GR,ReverseSubtractEquation:VM,RingBufferGeometry:mV,RingGeometry:xy,SIGNED_RED_GREEN_RGTC2_Format:r2,SIGNED_RED_RGTC1_Format:i2,SRGBColorSpace:cu,Scene:K2,ShaderChunk:zr,ShaderLib:Fl,ShaderMaterial:ko,ShadowMaterial:lF,Shape:tp,ShapeBufferGeometry:gV,ShapeGeometry:tg,ShapePath:eV,ShapeUtils:Gu,ShortType:AI,Skeleton:Kv,SkeletonHelper:KQ,SkinnedMesh:qI,Source:of,Sphere:XA,SphereBufferGeometry:_V,SphereGeometry:Vu,Spherical:m2,SphericalHarmonics3:vF,SplineCurve:nB,SpotLight:yF,SpotLightHelper:jQ,Sprite:$2,SpriteMaterial:py,SrcAlphaFactor:D2,SrcAlphaSaturateFactor:qM,SrcColorFactor:WM,StaticCopyUsage:lz,StaticDrawUsage:W_,StaticReadUsage:sz,StereoCamera:wQ,StreamCopyUsage:hz,StreamDrawUsage:rz,StreamReadUsage:az,StringKeyframeTrack:bf,SubtractEquation:QM,SubtractiveBlending:Lb,TOUCH:Kp,TangentSpaceNormalMap:cp,TetrahedronBufferGeometry:yV,TetrahedronGeometry:vy,Texture:To,TextureLoader:Im,TorusBufferGeometry:xV,TorusGeometry:wy,TorusKnotBufferGeometry:vV,TorusKnotGeometry:by,Triangle:wh,TriangleFanDrawMode:QR,TriangleStripDrawMode:NR,TrianglesDrawMode:OR,TubeBufferGeometry:wV,TubeGeometry:ig,TwoPassDoubleSide:PR,UVMapping:kv,Uint16BufferAttribute:V2,Uint32BufferAttribute:H2,Uint8BufferAttribute:Oz,Uint8ClampedBufferAttribute:Nz,Uniform:wB,UniformsGroup:VQ,UniformsLib:En,UniformsUtils:mf,UnsignedByteType:ap,UnsignedInt248Type:uf,UnsignedIntType:Xd,UnsignedShort4444Type:pI,UnsignedShort5551Type:fI,UnsignedShortType:z2,VSMShadowMap:Dm,Vector2:Di,Vector3:ft,Vector4:as,VectorKeyframeTrack:ty,VideoTexture:SN,WebGL1Renderer:$I,WebGL3DRenderTarget:Sz,WebGLArrayRenderTarget:Tz,WebGLCubeRenderTarget:OI,WebGLMultipleRenderTargets:Mz,WebGLRenderTarget:rl,WebGLRenderer:fv,WebGLUtils:WI,WireframeGeometry:sB,WrapAroundEnding:G_,ZeroCurvatureEnding:rf,ZeroFactor:HM,ZeroSlopeEnding:sf,ZeroStencilOp:HR,_SRGBAFormat:dv,sRGBEncoding:Ts},Symbol.toStringTag,{value:"Module"}));var UF={exports:{}};(function(u,e){(function({},t){u.exports=t()})(MS,function(){var t,r,c;function p(i,C){if(!t)t=C;else if(!r)r=C;else{var D="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+t+")(sharedChunk); ("+r+")(sharedChunk); self.onerror = null;",R={};t(R),c=C(R),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(c.workerUrl=window.URL.createObjectURL(new Blob([D],{type:"text/javascript"})))}}p(["exports"],function(i){var C=typeof self<"u"?self:{},D="2.12.0";let R;const Q={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(R==null){const s=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{R={}.API_URL_REGEX!=null?new RegExp({}.API_URL_REGEX):s}catch{R=s}}return R},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},z={supported:!1,testSupport:function(s){!Y&&J&&(B?ae(s):G=s)}};let G,J,Y=!1,B=!1;function ae(s){const n=s.createTexture();s.bindTexture(s.TEXTURE_2D,n);try{if(s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,J),s.isContextLost())return;z.supported=!0}catch{}s.deleteTexture(n),Y=!0}C.document&&(J=C.document.createElement("img"),J.onload=function(){G&&ae(G),G=null,B=!0},J.onerror=function(){Y=!0,G=null},J.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ce="01";var Ae=we;function we(s,n,o,d){this.cx=3*s,this.bx=3*(o-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=o,this.p2y=d}we.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var o=s,d=0;d<8;d++){var g=this.sampleCurveX(o)-s;if(Math.abs(g)<n)return o;var v=this.sampleCurveDerivativeX(o);if(Math.abs(v)<1e-6)break;o-=g/v}var E=0,L=1;for(o=s,d=0;d<20&&(g=this.sampleCurveX(o),!(Math.abs(g-s)<n));d++)s>g?E=o:L=o,o=.5*(L-E)+E;return o},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var me=De;function De(s,n){this.x=s,this.y=n}De.prototype={clone:function(){return new De(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,n){return this.clone()._rotateAround(s,n)},matMult:function(s){return this.clone()._matMult(s)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var n=s.x-this.x,o=s.y-this.y;return n*n+o*o},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,n){return Math.atan2(this.x*n-this.y*s,this.x*s+this.y*n)},_matMult:function(s){var n=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=n,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var n=Math.cos(s),o=Math.sin(s),d=o*this.x+n*this.y;return this.x=n*this.x-o*this.y,this.y=d,this},_rotateAround:function(s,n){var o=Math.cos(s),d=Math.sin(s),g=n.y+d*(this.x-n.x)+o*(this.y-n.y);return this.x=n.x+o*(this.x-n.x)-d*(this.y-n.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},De.convert=function(s){return s instanceof De?s:Array.isArray(s)?new De(s[0],s[1]):s};const Je=Math.PI/180,Fe=180/Math.PI;function Ge(s){return s*Je}function Et(s){return s*Fe}const li=[[0,0],[1,0],[1,1],[0,1]];function xi(s){if(s<=0)return 0;if(s>=1)return 1;const n=s*s,o=n*s;return 4*(s<.5?o:3*(s-n)+o-.75)}function te(s,n,o,d){const g=new Ae(s,n,o,d);return function(v){return g.solve(v)}}const le=te(.25,.1,.25,1);function ye(s,n,o){return Math.min(o,Math.max(n,s))}function xe(s,n,o){return(o=ye((o-s)/(n-s),0,1))*o*(3-2*o)}function Re(s,n,o){const d=o-n,g=((s-n)%d+d)%d+n;return g===n?o:g}function Oe(s,n,o){if(!s.length)return o(null,[]);let d=s.length;const g=new Array(s.length);let v=null;s.forEach((E,L)=>{n(E,(k,V)=>{k&&(v=k),g[L]=V,--d==0&&o(v,g)})})}function We(s){const n=[];for(const o in s)n.push(s[o]);return n}function Ve(s,...n){for(const o of n)for(const d in o)s[d]=o[d];return s}let Qe=1;function Se(){return Qe++}function Ke(){return function s(n){return n?(n^Math.random()*(16>>n/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,s)}()}function nt(s){return s<=1?1:Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function vt(s){return!!s&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(s)}function be(s,n){s.forEach(o=>{n[o]&&(n[o]=n[o].bind(n))})}function At(s,n){return s.indexOf(n,s.length-n.length)!==-1}function ut(s,n,o){const d={};for(const g in s)d[g]=n.call(o||this,s[g],g,s);return d}function Nt(s,n,o){const d={};for(const g in s)n.call(o||this,s[g],g,s)&&(d[g]=s[g]);return d}function Gt(s){return Array.isArray(s)?s.map(Gt):typeof s=="object"&&s?ut(s,Gt):s}const Qt={};function Ct(s){Qt[s]||(typeof console<"u"&&console.warn(s),Qt[s]=!0)}function Ft(s,n,o){return(o.y-s.y)*(n.x-s.x)>(n.y-s.y)*(o.x-s.x)}function Xt(s){let n=0;for(let o,d,g=0,v=s.length,E=v-1;g<v;E=g++)o=s[g],d=s[E],n+=(d.x-o.x)*(o.y+d.y);return n}function _i(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function fi(s){const n={};if(s.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,d,g,v)=>{const E=g||v;return n[d]=!E||E.toLowerCase(),""}),n["max-age"]){const o=parseInt(n["max-age"],10);isNaN(o)?delete n["max-age"]:n["max-age"]=o}return n}let Gi=null;function wn(s){if(Gi==null){const n=s.navigator?s.navigator.userAgent:null;Gi=!!s.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return Gi}function zi(s){try{const n=C[s];return n.setItem("_mapbox_test_",1),n.removeItem("_mapbox_test_"),!0}catch{return!1}}function Gn(s,n){return[s[4*n],s[4*n+1],s[4*n+2],s[4*n+3]]}const kn="mapbox-tiles";let yt,rt,ti=500,Ni=50;function qi(){try{return C.caches}catch{}}function en(){qi()&&!yt&&(yt=C.caches.open(kn))}function $t(s){const n=s.indexOf("?");if(n<0)return s;const o=function(g){const v=g.indexOf("?");return v>0?g.slice(v+1).split("&"):[]}(s),d=o.filter(g=>{const v=g.split("=");return v[0]==="language"||v[0]==="worldview"});return d.length?`${s.slice(0,n)}?${d.join("&")}`:s.slice(0,n)}let at=1/0;const ii={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(ii);class hn extends Error{constructor(n,o,d){o===401&&Ui(d)&&(n+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(n),this.status=o,this.url=d}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Xi=_i()?()=>self.worker&&self.worker.referrer:()=>(C.location.protocol==="blob:"?C.parent:C).location.href,on=function(s,n){if(!(/^file:/.test(o=s.url)||/^file:/.test(Xi())&&!/^\w+:/.test(o))){if(C.fetch&&C.Request&&C.AbortController&&C.Request.prototype.hasOwnProperty("signal"))return function(d,g){const v=new C.AbortController,E=new C.Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,referrer:Xi(),signal:v.signal});let L=!1,k=!1;const V=(q=E.url).indexOf("sku=")>0&&Ui(q);var q;d.type==="json"&&E.headers.set("Accept","application/json");const se=(_e,Be,Le)=>{if(k)return;if(_e&&_e.message!=="SecurityError"&&Ct(_e),Be&&Le)return he(Be);const Xe=Date.now();C.fetch(E).then(xt=>{if(xt.ok){const Dt=V?xt.clone():null;return he(xt,Dt,Xe)}return g(new hn(xt.statusText,xt.status,d.url))}).catch(xt=>{xt.code!==20&&g(new Error(xt.message))})},he=(_e,Be,Le)=>{(d.type==="arrayBuffer"?_e.arrayBuffer():d.type==="json"?_e.json():_e.text()).then(Xe=>{k||(Be&&Le&&function(xt,Dt,_t){if(en(),!yt)return;const Tt={status:Dt.status,statusText:Dt.statusText,headers:new C.Headers};Dt.headers.forEach((ci,oi)=>Tt.headers.set(oi,ci));const kt=fi(Dt.headers.get("Cache-Control")||"");if(kt["no-store"])return;kt["max-age"]&&Tt.headers.set("Expires",new Date(_t+1e3*kt["max-age"]).toUTCString());const Ut=Tt.headers.get("Expires");Ut&&(new Date(Ut).getTime()-_t<42e4||function(ci,oi){if(rt===void 0)try{new Response(new ReadableStream),rt=!0}catch{rt=!1}rt?oi(ci.body):ci.blob().then(oi)}(Dt,ci=>{const oi=new C.Response(ci,Tt);en(),yt&&yt.then(Ti=>Ti.put($t(xt.url),oi)).catch(Ti=>Ct(Ti.message))}))}(E,Be,Le),L=!0,g(null,Xe,_e.headers.get("Cache-Control"),_e.headers.get("Expires")))}).catch(Xe=>{k||g(new Error(Xe.message))})};return V?function(_e,Be){if(en(),!yt)return Be(null);const Le=$t(_e.url);yt.then(Xe=>{Xe.match(Le).then(xt=>{const Dt=function(_t){if(!_t)return!1;const Tt=new Date(_t.headers.get("Expires")||0),kt=fi(_t.headers.get("Cache-Control")||"");return Tt>Date.now()&&!kt["no-cache"]}(xt);Xe.delete(Le),Dt&&Xe.put(Le,xt.clone()),Be(null,xt,Dt)}).catch(Be)}).catch(Be)}(E,se):se(null,null),{cancel:()=>{k=!0,L||v.abort()}}}(s,n);if(_i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",s,n,void 0,!0)}var o;return function(d,g){const v=new C.XMLHttpRequest;v.open(d.method||"GET",d.url,!0),d.type==="arrayBuffer"&&(v.responseType="arraybuffer");for(const E in d.headers)v.setRequestHeader(E,d.headers[E]);return d.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=d.credentials==="include",v.onerror=()=>{g(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let E=v.response;if(d.type==="json")try{E=JSON.parse(v.response)}catch(L){return g(L)}g(null,E,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else g(new hn(v.statusText,v.status,d.url))},v.send(d.body),{cancel:()=>v.abort()}}(s,n)},Cn=function(s,n){return on(Ve(s,{type:"arrayBuffer"}),n)};function Tn(s){const n=C.document.createElement("a");return n.href=s,n.protocol===C.document.location.protocol&&n.host===C.document.location.host}const nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Ii,bn;Ii=[],bn=0;const Ot=function(s,n){if(z.supported&&(s.headers||(s.headers={}),s.headers.accept="image/webp,*/*"),bn>=Q.MAX_PARALLEL_IMAGE_REQUESTS){const v={requestParameters:s,callback:n,cancelled:!1,cancel(){this.cancelled=!0}};return Ii.push(v),v}bn++;let o=!1;const d=()=>{if(!o)for(o=!0,bn--;Ii.length&&bn<Q.MAX_PARALLEL_IMAGE_REQUESTS;){const v=Ii.shift(),{requestParameters:E,callback:L,cancelled:k}=v;k||(v.cancel=Ot(E,L).cancel)}},g=Cn(s,(v,E,L,k)=>{d(),v?n(v):E&&(C.createImageBitmap?function(V,q){const se=new C.Blob([new Uint8Array(V)],{type:"image/png"});C.createImageBitmap(se).then(he=>{q(null,he)}).catch(he=>{q(new Error(`Could not load image because of ${he.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(E,(V,q)=>n(V,q,L,k)):function(V,q){const se=new C.Image,he=C.URL;se.onload=()=>{q(null,se),he.revokeObjectURL(se.src),se.onload=null,C.requestAnimationFrame(()=>{se.src=nr})},se.onerror=()=>q(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 _e=new C.Blob([new Uint8Array(V)],{type:"image/png"});se.src=V.byteLength?he.createObjectURL(_e):nr}(E,(V,q)=>n(V,q,L,k)))});return{cancel:()=>{g.cancel(),d()}}},wi="NO_ACCESS_TOKEN";function Wi(s){return s.indexOf("mapbox:")===0}function Ui(s){return Q.API_URL_REGEX.test(s)}function Pn(s){return Q.API_CDN_URL_REGEX.test(s)}function qn(s){return Q.API_STYLE_REGEX.test(s)&&!Hr(s)}function Hr(s){return Q.API_SPRITE_REGEX.test(s)}const fr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function kr(s){const n=s.match(fr);if(!n)throw new Error("Unable to parse URL object");return{protocol:n[1],authority:n[2],path:n[3]||"/",params:n[4]?n[4].split("&"):[]}}function Qn(s){const n=s.params.length?`?${s.params.join("&")}`:"";return`${s.protocol}://${s.authority}${s.path}${n}`}function Rs(s){if(!s)return null;const n=s.split(".");if(!n||n.length!==3)return null;try{return JSON.parse(decodeURIComponent(C.atob(n[1]).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class ot{constructor(n){this.type=n,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(n){const o=Rs(Q.ACCESS_TOKEN);let d="";return d=o&&o.u?C.btoa(encodeURIComponent(o.u).replace(/%([0-9A-F]{2})/g,(g,v)=>String.fromCharCode(Number("0x"+v)))):Q.ACCESS_TOKEN||"",n?`mapbox.eventData.${n}:${d}`:`mapbox.eventData:${d}`}fetchEventData(){const n=zi("localStorage"),o=this.getStorageKey(),d=this.getStorageKey("uuid");if(n)try{const g=C.localStorage.getItem(o);g&&(this.eventData=JSON.parse(g));const v=C.localStorage.getItem(d);v&&(this.anonId=v)}catch{Ct("Unable to read from LocalStorage")}}saveEventData(){const n=zi("localStorage"),o=this.getStorageKey(),d=this.getStorageKey("uuid");if(n)try{C.localStorage.setItem(d,this.anonId),Object.keys(this.eventData).length>=1&&C.localStorage.setItem(o,JSON.stringify(this.eventData))}catch{Ct("Unable to write to LocalStorage")}}processRequests(n){}postEvent(n,o,d,g){if(!Q.EVENTS_URL)return;const v=kr(Q.EVENTS_URL);v.params.push(`access_token=${g||Q.ACCESS_TOKEN||""}`);const E={event:this.type,created:new Date(n).toISOString()},L=o?Ve(E,o):E,k={url:Qn(v),headers:{"Content-Type":"text/plain"},body:JSON.stringify([L])};this.pendingRequest=function(V,q){return on(Ve(V,{method:"POST"}),q)}(k,V=>{this.pendingRequest=null,d(V),this.saveEventData(),this.processRequests(g)})}queueRequest(n,o){this.queue.push(n),this.processRequests(o)}}const Ee=new class extends ot{constructor(s){super("appUserTurnstile"),this._customAccessToken=s}postTurnstileEvent(s,n){Q.EVENTS_URL&&Q.ACCESS_TOKEN&&Array.isArray(s)&&s.some(o=>Wi(o)||Ui(o))&&this.queueRequest(Date.now(),n)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const n=Rs(Q.ACCESS_TOKEN),o=n?n.u:Q.ACCESS_TOKEN;let d=o!==this.eventData.tokenU;vt(this.anonId)||(this.anonId=Ke(),d=!0);const g=this.queue.shift();if(this.eventData.lastSuccess){const v=new Date(this.eventData.lastSuccess),E=new Date(g),L=(g-this.eventData.lastSuccess)/864e5;d=d||L>=1||L<-1||v.getDate()!==E.getDate()}else d=!0;d?this.postEvent(g,{sdkIdentifier:"mapbox-gl-js",sdkVersion:D,skuId:ce,"enabled.telemetry":!1,userId:this.anonId},v=>{v||(this.eventData.lastSuccess=g,this.eventData.tokenU=o)},s):this.processRequests()}},Pe=Ee.postTurnstileEvent.bind(Ee),ct=new class extends ot{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(s,n,o,d){this.skuToken=n,this.errorCb=d,Q.EVENTS_URL&&(o||Q.ACCESS_TOKEN?this.queueRequest({id:s,timestamp:Date.now()},o):this.errorCb(new Error(wi)))}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{id:n,timestamp:o}=this.queue.shift();n&&this.success[n]||(this.anonId||this.fetchEventData(),vt(this.anonId)||(this.anonId=Ke()),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:D,skuId:ce,skuToken:this.skuToken,userId:this.anonId},d=>{d?this.errorCb(d):n&&(this.success[n]=!0)},s))}},wt=ct.postMapLoadEvent.bind(ct),X=new class extends ot{constructor(){super("gljs.performance")}postPerformanceEvent(s,n){Q.EVENTS_URL&&(s||Q.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:n},s)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:n,performanceData:o}=this.queue.shift(),d=function(g){const v=C.performance.getEntriesByType("resource"),E=C.performance.getEntriesByType("mark"),L=function(he){const _e={};if(he){for(const Be in he)if(Be!=="other")for(const Le of he[Be]){const Xe=`${Be}ResolveRangeMin`,xt=`${Be}ResolveRangeMax`,Dt=`${Be}RequestCount`,_t=`${Be}RequestCachedCount`;_e[Xe]=Math.min(_e[Xe]||1/0,Le.startTime),_e[xt]=Math.max(_e[xt]||-1/0,Le.responseEnd);const Tt=kt=>{_e[kt]===void 0&&(_e[kt]=0),++_e[kt]};Le.transferSize!==void 0&&Le.transferSize===0&&Tt(_t),Tt(Dt)}}return _e}(function(he,_e){const Be={};if(he)for(const Le of he){const Xe=_e(Le);Be[Xe]===void 0&&(Be[Xe]=[]),Be[Xe].push(Le)}return Be}(v,He)),k=C.devicePixelRatio,V=C.navigator.connection||C.navigator.mozConnection||C.navigator.webkitConnection,q={counters:[],metadata:[],attributes:[]},se=(he,_e,Be)=>{Be!=null&&he.push({name:_e,value:Be.toString()})};for(const he in L)se(q.counters,he,L[he]);if(g.interactionRange[0]!==1/0&&g.interactionRange[1]!==-1/0&&(se(q.counters,"interactionRangeMin",g.interactionRange[0]),se(q.counters,"interactionRangeMax",g.interactionRange[1])),E)for(const he of Object.keys(Ue)){const _e=Ue[he],Be=E.find(Le=>Le.name===_e);Be&&se(q.counters,_e,Be.startTime)}return se(q.counters,"visibilityHidden",g.visibilityHidden),se(q.attributes,"style",function(he){if(he)for(const _e of he){const Be=_e.name.split("?")[0];if(qn(Be)){const Le=Be.split("/").slice(-2);if(Le.length===2)return`mapbox://styles/${Le[0]}/${Le[1]}`}}}(v)),se(q.attributes,"terrainEnabled",g.terrainEnabled?"true":"false"),se(q.attributes,"fogEnabled",g.fogEnabled?"true":"false"),se(q.attributes,"projection",g.projection),se(q.attributes,"zoom",g.zoom),se(q.metadata,"devicePixelRatio",k),se(q.metadata,"connectionEffectiveType",V?V.effectiveType:void 0),se(q.metadata,"navigatorUserAgent",C.navigator.userAgent),se(q.metadata,"screenWidth",C.screen.width),se(q.metadata,"screenHeight",C.screen.height),se(q.metadata,"windowWidth",C.innerWidth),se(q.metadata,"windowHeight",C.innerHeight),se(q.metadata,"mapWidth",g.width/k),se(q.metadata,"mapHeight",g.height/k),se(q.metadata,"webglRenderer",g.renderer),se(q.metadata,"webglVendor",g.vendor),se(q.metadata,"sdkVersion",D),se(q.metadata,"sdkIdentifier","mapbox-gl-js"),q}(o);for(const g of d.metadata);for(const g of d.counters);for(const g of d.attributes);this.postEvent(n,d,()=>{},s)}},j=X.postPerformanceEvent.bind(X),ie=new class extends ot{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(s,n,o,d){if(!Q.API_URL||!Q.SESSION_PATH)return;const g=kr(Q.API_URL+Q.SESSION_PATH);g.params.push(`sku=${n||""}`),g.params.push(`access_token=${d||Q.ACCESS_TOKEN||""}`);const v={url:Qn(g),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(E,L){return on(Ve(E,{method:"GET"}),L)}(v,E=>{this.pendingRequest=null,o(E),this.saveEventData(),this.processRequests(d)})}getSessionAPI(s,n,o,d){this.skuToken=n,this.errorCb=d,Q.SESSION_PATH&&Q.API_URL&&(o||Q.ACCESS_TOKEN?this.queueRequest({id:s,timestamp:Date.now()},o):this.errorCb(new Error(wi)))}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{id:n,timestamp:o}=this.queue.shift();n&&this.success[n]||this.getSession(o,this.skuToken,d=>{d?this.errorCb(d):n&&(this.success[n]=!0)},s)}},ne=ie.getSessionAPI.bind(ie),de=new Set,Ue={create:"create",load:"load",fullLoad:"fullLoad"},tt={mark(s){C.performance.mark(s)},measure(s,n,o){C.performance.measure(s,n,o)}};function He(s){const n=s.name.split("?")[0];return Pn(n)&&n.includes("mapbox-gl.js")?"javascript":Pn(n)&&n.includes("mapbox-gl.css")?"css":function(o){return Q.API_FONTS_REGEX.test(o)}(n)?"fontRange":Hr(n)?"sprite":qn(n)?"style":function(o){return Q.API_TILEJSON_REGEX.test(o)}(n)?"tilejson":"other"}const et=C.performance;function pt(s){const n=s?s.url.toString():void 0;return et.getEntriesByName(n)}let Lt,jt,Wt,ki;const bi={now:()=>Wt!==void 0?Wt:C.performance.now(),setNow(s){Wt=s},restoreNow(){Wt=void 0},frame(s){const n=C.requestAnimationFrame(s);return{cancel:()=>C.cancelAnimationFrame(n)}},getImageData(s,n=0){const{width:o,height:d}=s;ki||(ki=C.document.createElement("canvas"));const g=ki.getContext("2d",{willReadFrequently:!0});if(!g)throw new Error("failed to create canvas 2d context");return(o>ki.width||d>ki.height)&&(ki.width=o,ki.height=d),g.clearRect(-n,-n,o+2*n,d+2*n),g.drawImage(s,0,0,o,d),g.getImageData(-n,-n,o+2*n,d+2*n)},resolveURL:s=>(Lt||(Lt=C.document.createElement("a")),Lt.href=s,Lt.href),get devicePixelRatio(){return C.devicePixelRatio},get prefersReducedMotion(){return!!C.matchMedia&&(jt==null&&(jt=C.matchMedia("(prefers-reduced-motion: reduce)")),jt.matches)}};function Oi(s,n,o){o[s]&&o[s].indexOf(n)!==-1||(o[s]=o[s]||[],o[s].push(n))}function Yi(s,n,o){if(o&&o[s]){const d=o[s].indexOf(n);d!==-1&&o[s].splice(d,1)}}class tn{constructor(n,o={}){Ve(this,o),this.type=n}}class rr extends tn{constructor(n,o={}){super("error",Ve({error:n},o))}}class yn{on(n,o){return this._listeners=this._listeners||{},Oi(n,o,this._listeners),this}off(n,o){return Yi(n,o,this._listeners),Yi(n,o,this._oneTimeListeners),this}once(n,o){return o?(this._oneTimeListeners=this._oneTimeListeners||{},Oi(n,o,this._oneTimeListeners),this):new Promise(d=>this.once(n,d))}fire(n,o){typeof n=="string"&&(n=new tn(n,o||{}));const d=n.type;if(this.listens(d)){n.target=this;const g=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const L of g)L.call(this,n);const v=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const L of v)Yi(d,L,this._oneTimeListeners),L.call(this,n);const E=this._eventedParent;E&&(Ve(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),E.fire(n))}else n instanceof rr&&console.error(n.error);return this}listens(n){return!!(this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n))}setEventedParent(n,o){return this._eventedParent=n,this._eventedParentData=o,this}}var Yt=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function sr(s,...n){for(const o of n)for(const d in o)s[d]=o[d];return s}function Yn(s){return s instanceof Number||s instanceof String||s instanceof Boolean?s.valueOf():s}function Wr(s){if(Array.isArray(s))return s.map(Wr);if(s instanceof Object&&!(s instanceof Number||s instanceof String||s instanceof Boolean)){const n={};for(const o in s)n[o]=Wr(s[o]);return n}return Yn(s)}class mr extends Error{constructor(n,o){super(o),this.message=o,this.key=n}}var Mr=mr;class Oo{constructor(n,o=[]){this.parent=n,this.bindings={};for(const[d,g]of o)this.bindings[d]=g}concat(n){return new Oo(this,n)}get(n){if(this.bindings[n])return this.bindings[n];if(this.parent)return this.parent.get(n);throw new Error(`${n} not found in scope.`)}has(n){return!!this.bindings[n]||!!this.parent&&this.parent.has(n)}}var zs=Oo;const or={kind:"null"},rn={kind:"number"},cr={kind:"string"},Ar={kind:"boolean"},aa={kind:"color"},al={kind:"object"},dr={kind:"value"},Ul={kind:"collator"},Rl={kind:"formatted"},ll={kind:"resolvedImage"};function qs(s,n){return{kind:"array",itemType:s,N:n}}function cs(s){if(s.kind==="array"){const n=cs(s.itemType);return typeof s.N=="number"?`array<${n}, ${s.N}>`:s.itemType.kind==="value"?"array":`array<${n}>`}return s.kind}const ho=[or,rn,cr,Ar,aa,Rl,al,qs(dr),ll];function cl(s,n){if(n.kind==="error")return null;if(s.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!cl(s.itemType,n.itemType))&&(typeof s.N!="number"||s.N===n.N))return null}else{if(s.kind===n.kind)return null;if(s.kind==="value"){for(const o of ho)if(!cl(o,n))return null}}return`Expected ${cs(s)} but found ${cs(n)} instead.`}function Oa(s,n){return n.some(o=>o.kind===s.kind)}function zl(s,n){return n.some(o=>o==="null"?s===null:o==="array"?Array.isArray(s):o==="object"?s&&!Array.isArray(s)&&typeof s=="object":o===typeof s)}var kl,Ol={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Na(s){return(s=Math.round(s))<0?0:s>255?255:s}function Nl(s){return Na(s[s.length-1]==="%"?parseFloat(s)/100*255:parseInt(s))}function Ql(s){return(n=s[s.length-1]==="%"?parseFloat(s)/100:parseFloat(s))<0?0:n>1?1:n;var n}function is(s,n,o){return o<0?o+=1:o>1&&(o-=1),6*o<1?s+(n-s)*o*6:2*o<1?n:3*o<2?s+(n-s)*(2/3-o)*6:s}try{kl={}.parseCSSColor=function(s){var n,o=s.replace(/ /g,"").toLowerCase();if(o in Ol)return Ol[o].slice();if(o[0]==="#")return o.length===4?(n=parseInt(o.substr(1),16))>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null:o.length===7&&(n=parseInt(o.substr(1),16))>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null;var d=o.indexOf("("),g=o.indexOf(")");if(d!==-1&&g+1===o.length){var v=o.substr(0,d),E=o.substr(d+1,g-(d+1)).split(","),L=1;switch(v){case"rgba":if(E.length!==4)return null;L=Ql(E.pop());case"rgb":return E.length!==3?null:[Nl(E[0]),Nl(E[1]),Nl(E[2]),L];case"hsla":if(E.length!==4)return null;L=Ql(E.pop());case"hsl":if(E.length!==3)return null;var k=(parseFloat(E[0])%360+360)%360/360,V=Ql(E[1]),q=Ql(E[2]),se=q<=.5?q*(V+1):q+V-q*V,he=2*q-se;return[Na(255*is(he,se,k+1/3)),Na(255*is(he,se,k)),Na(255*is(he,se,k-1/3)),L];default:return null}}return null}}catch{}class Ys{constructor(n,o,d,g=1){this.r=n,this.g=o,this.b=d,this.a=g}static parse(n){if(!n)return;if(n instanceof Ys)return n;if(typeof n!="string")return;const o=kl(n);return o?new Ys(o[0]/255*o[3],o[1]/255*o[3],o[2]/255*o[3],o[3]):void 0}toString(){const[n,o,d,g]=this.toArray();return`rgba(${Math.round(n)},${Math.round(o)},${Math.round(d)},${g})`}toArray(){const{r:n,g:o,b:d,a:g}=this;return g===0?[0,0,0,0]:[255*n/g,255*o/g,255*d/g,g]}toArray01(){const{r:n,g:o,b:d,a:g}=this;return g===0?[0,0,0,0]:[n/g,o/g,d/g,g]}toArray01PremultipliedAlpha(){const{r:n,g:o,b:d,a:g}=this;return[n,o,d,g]}}Ys.black=new Ys(0,0,0,1),Ys.white=new Ys(1,1,1,1),Ys.transparent=new Ys(0,0,0,0),Ys.red=new Ys(1,0,0,1),Ys.blue=new Ys(0,0,1,1);var ps=Ys;class Rc{constructor(n,o,d){this.sensitivity=n?o?"variant":"case":o?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,o){return this.collator.compare(n,o)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Eh{constructor(n,o,d,g,v){this.text=n.normalize?n.normalize():n,this.image=o,this.scale=d,this.fontStack=g,this.textColor=v}}class ks{constructor(n){this.sections=n}static fromString(n){return new ks([new Eh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof ks?n:ks.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}serialize(){const n=["format"];for(const o of this.sections){if(o.image){n.push(["image",o.image.name]);continue}n.push(o.text);const d={};o.fontStack&&(d["text-font"]=["literal",o.fontStack.split(",")]),o.scale&&(d["font-scale"]=o.scale),o.textColor&&(d["text-color"]=["rgba"].concat(o.textColor.toArray())),n.push(d)}return n}}class No{constructor(n){this.name=n.name,this.available=n.available}toString(){return this.name}static fromString(n){return n?new No({name:n,available:!1}):null}serialize(){return["image",this.name]}}function JA(s,n,o,d){return typeof s=="number"&&s>=0&&s<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof o=="number"&&o>=0&&o<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,n,o,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,n,o,d]:[s,n,o]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fu(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof ps||s instanceof Rc||s instanceof ks||s instanceof No)return!0;if(Array.isArray(s)){for(const n of s)if(!fu(n))return!1;return!0}if(typeof s=="object"){for(const n in s)if(!fu(s[n]))return!1;return!0}return!1}function Bs(s){if(s===null)return or;if(typeof s=="string")return cr;if(typeof s=="boolean")return Ar;if(typeof s=="number")return rn;if(s instanceof ps)return aa;if(s instanceof Rc)return Ul;if(s instanceof ks)return Rl;if(s instanceof No)return ll;if(Array.isArray(s)){const n=s.length;let o;for(const d of s){const g=Bs(d);if(o){if(o===g)continue;o=dr;break}o=g}return qs(o||dr,n)}return al}function sc(s){const n=typeof s;return s===null?"":n==="string"||n==="number"||n==="boolean"?String(s):s instanceof ps||s instanceof ks||s instanceof No?s.toString():JSON.stringify(s)}class Th{constructor(n,o){this.type=n,this.value=o}static parse(n,o){if(n.length!==2)return o.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!fu(n[1]))return o.error("invalid value");const d=n[1];let g=Bs(d);const v=o.expectedType;return g.kind!=="array"||g.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(g=v),new Th(g,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof ps?["rgba"].concat(this.value.toArray()):this.value instanceof ks?this.value.serialize():this.value}}var oc=Th,er=class{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}};const ac={string:cr,number:rn,boolean:Ar,object:al};class Ju{constructor(n,o){this.type=n,this.args=o}static parse(n,o){if(n.length<2)return o.error("Expected at least one argument.");let d,g=1;const v=n[0];if(v==="array"){let L,k;if(n.length>2){const V=n[1];if(typeof V!="string"||!(V in ac)||V==="object")return o.error('The item type argument of "array" must be one of string, number, boolean',1);L=ac[V],g++}else L=dr;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return o.error('The length argument to "array" must be a positive integer literal',2);k=n[2],g++}d=qs(L,k)}else d=ac[v];const E=[];for(;g<n.length;g++){const L=o.parse(n[g],g,dr);if(!L)return null;E.push(L)}return new Ju(d,E)}evaluate(n){for(let o=0;o<this.args.length;o++){const d=this.args[o].evaluate(n);if(!cl(this.type,Bs(d)))return d;if(o===this.args.length-1)throw new er(`Expected value to be of type ${cs(this.type)}, but found ${cs(Bs(d))} instead.`)}return null}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}serialize(){const n=this.type,o=[n.kind];if(n.kind==="array"){const d=n.itemType;if(d.kind==="string"||d.kind==="number"||d.kind==="boolean"){o.push(d.kind);const g=n.N;(typeof g=="number"||this.args.length>1)&&o.push(g)}}return o.concat(this.args.map(d=>d.serialize()))}}var Qo=Ju;class hl{constructor(n){this.type=Rl,this.sections=n}static parse(n,o){if(n.length<2)return o.error("Expected at least one argument.");const d=n[1];if(!Array.isArray(d)&&typeof d=="object")return o.error("First argument must be an image or text section.");const g=[];let v=!1;for(let E=1;E<=n.length-1;++E){const L=n[E];if(v&&typeof L=="object"&&!Array.isArray(L)){v=!1;let k=null;if(L["font-scale"]&&(k=o.parse(L["font-scale"],1,rn),!k))return null;let V=null;if(L["text-font"]&&(V=o.parse(L["text-font"],1,qs(cr)),!V))return null;let q=null;if(L["text-color"]&&(q=o.parse(L["text-color"],1,aa),!q))return null;const se=g[g.length-1];se.scale=k,se.font=V,se.textColor=q}else{const k=o.parse(n[E],1,dr);if(!k)return null;const V=k.type.kind;if(V!=="string"&&V!=="value"&&V!=="null"&&V!=="resolvedImage")return o.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,g.push({content:k,scale:null,font:null,textColor:null})}}return new hl(g)}evaluate(n){return new ks(this.sections.map(o=>{const d=o.content.evaluate(n);return Bs(d)===ll?new Eh("",d,null,null,null):new Eh(sc(d),null,o.scale?o.scale.evaluate(n):null,o.font?o.font.evaluate(n).join(","):null,o.textColor?o.textColor.evaluate(n):null)}))}eachChild(n){for(const o of this.sections)n(o.content),o.scale&&n(o.scale),o.font&&n(o.font),o.textColor&&n(o.textColor)}outputDefined(){return!1}serialize(){const n=["format"];for(const o of this.sections){n.push(o.content.serialize());const d={};o.scale&&(d["font-scale"]=o.scale.serialize()),o.font&&(d["text-font"]=o.font.serialize()),o.textColor&&(d["text-color"]=o.textColor.serialize()),n.push(d)}return n}}class Sh{constructor(n){this.type=ll,this.input=n}static parse(n,o){if(n.length!==2)return o.error("Expected two arguments.");const d=o.parse(n[1],1,cr);return d?new Sh(d):o.error("No image name provided.")}evaluate(n){const o=this.input.evaluate(n),d=No.fromString(o);return d&&n.availableImages&&(d.available=n.availableImages.indexOf(o)>-1),d}eachChild(n){n(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Vo={"to-boolean":Ar,"to-color":aa,"to-number":rn,"to-string":cr};class Mh{constructor(n,o){this.type=n,this.args=o}static parse(n,o){if(n.length<2)return o.error("Expected at least one argument.");const d=n[0];if((d==="to-boolean"||d==="to-string")&&n.length!==2)return o.error("Expected one argument.");const g=Vo[d],v=[];for(let E=1;E<n.length;E++){const L=o.parse(n[E],E,dr);if(!L)return null;v.push(L)}return new Mh(g,v)}evaluate(n){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(n));if(this.type.kind==="color"){let o,d;for(const g of this.args){if(o=g.evaluate(n),d=null,o instanceof ps)return o;if(typeof o=="string"){const v=n.parseColor(o);if(v)return v}else if(Array.isArray(o)&&(d=o.length<3||o.length>4?`Invalid rbga value ${JSON.stringify(o)}: expected an array containing either three or four numeric values.`:JA(o[0],o[1],o[2],o[3]),!d))return new ps(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new er(d||`Could not parse color from value '${typeof o=="string"?o:String(JSON.stringify(o))}'`)}if(this.type.kind==="number"){let o=null;for(const d of this.args){if(o=d.evaluate(n),o===null)return 0;const g=Number(o);if(!isNaN(g))return g}throw new er(`Could not convert ${JSON.stringify(o)} to number.`)}return this.type.kind==="formatted"?ks.fromString(sc(this.args[0].evaluate(n))):this.type.kind==="resolvedImage"?No.fromString(sc(this.args[0].evaluate(n))):sc(this.args[0].evaluate(n))}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}serialize(){if(this.type.kind==="formatted")return new hl([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Sh(this.args[0]).serialize();const n=[`to-${this.type.kind}`];return this.eachChild(o=>{n.push(o.serialize())}),n}}var Qa=Mh;const lc=["Unknown","Point","LineString","Polygon"];var mu=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?lc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const s=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:o,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*n-s[0])+this.featureDistanceData.bearing[1]*(d*n-s[1])}return 0}parseColor(s){let n=this._parseColorCache[s];return n||(n=this._parseColorCache[s]=ps.parse(s)),n}};class Vl{constructor(n,o,d,g){this.name=n,this.type=o,this._evaluate=d,this.args=g}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(n=>n.serialize()))}static parse(n,o){const d=n[0],g=Vl.definitions[d];if(!g)return o.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(g)?g[0]:g.type,E=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,L=E.filter(([V])=>!Array.isArray(V)||V.length===n.length-1);let k=null;for(const[V,q]of L){k=new hr(o.registry,o.path,null,o.scope);const se=[];let he=!1;for(let _e=1;_e<n.length;_e++){const Be=n[_e],Le=Array.isArray(V)?V[_e-1]:V.type,Xe=k.parse(Be,1+se.length,Le);if(!Xe){he=!0;break}se.push(Xe)}if(!he)if(Array.isArray(V)&&V.length!==se.length)k.error(`Expected ${V.length} arguments, but found ${se.length} instead.`);else{for(let _e=0;_e<se.length;_e++){const Be=Array.isArray(V)?V[_e]:V.type,Le=se[_e];k.concat(_e+1).checkSubtype(Be,Le.type)}if(k.errors.length===0)return new Vl(d,v,q,se)}}if(L.length===1)o.errors.push(...k.errors);else{const V=(L.length?L:E).map(([se])=>{return he=se,Array.isArray(he)?`(${he.map(cs).join(", ")})`:`(${cs(he.type)}...)`;var he}).join(" | "),q=[];for(let se=1;se<n.length;se++){const he=o.parse(n[se],1+q.length);if(!he)return null;q.push(cs(he.type))}o.error(`Expected arguments of type ${V}, but found (${q.join(", ")}) instead.`)}return null}static register(n,o){Vl.definitions=o;for(const d in o)n[d]=Vl}}var ya=Vl;class zc{constructor(n,o,d){this.type=Ul,this.locale=d,this.caseSensitive=n,this.diacriticSensitive=o}static parse(n,o){if(n.length!==2)return o.error("Expected one argument.");const d=n[1];if(typeof d!="object"||Array.isArray(d))return o.error("Collator options argument must be an object.");const g=o.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,Ar);if(!g)return null;const v=o.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,Ar);if(!v)return null;let E=null;return d.locale&&(E=o.parse(d.locale,1,cr),!E)?null:new zc(g,v,E)}evaluate(n){return new Rc(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}serialize(){const n={};return n["case-sensitive"]=this.caseSensitive.serialize(),n["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(n.locale=this.locale.serialize()),["collator",n]}}const Ws=8192;function cc(s,n){s[0]=Math.min(s[0],n[0]),s[1]=Math.min(s[1],n[1]),s[2]=Math.max(s[2],n[0]),s[3]=Math.max(s[3],n[1])}function kc(s,n){return!(s[0]<=n[0]||s[2]>=n[2]||s[1]<=n[1]||s[3]>=n[3])}function eA(s,n){const o=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,g=Math.pow(2,n.z);return[Math.round(o*g*Ws),Math.round(d*g*Ws)]}function hc(s,n,o){const d=s[0]-n[0],g=s[1]-n[1],v=s[0]-o[0],E=s[1]-o[1];return d*E-v*g==0&&d*v<=0&&g*E<=0}function gu(s,n){let o=!1;for(let E=0,L=n.length;E<L;E++){const k=n[E];for(let V=0,q=k.length;V<q-1;V++){if(hc(s,k[V],k[V+1]))return!1;(g=k[V])[1]>(d=s)[1]!=(v=k[V+1])[1]>d[1]&&d[0]<(v[0]-g[0])*(d[1]-g[1])/(v[1]-g[1])+g[0]&&(o=!o)}}var d,g,v;return o}function ed(s,n){for(let o=0;o<n.length;o++)if(gu(s,n[o]))return!0;return!1}function _u(s,n,o,d){const g=d[0]-o[0],v=d[1]-o[1],E=(s[0]-o[0])*v-g*(s[1]-o[1]),L=(n[0]-o[0])*v-g*(n[1]-o[1]);return E>0&&L<0||E<0&&L>0}function Ih(s,n,o){for(const V of o)for(let q=0;q<V.length-1;++q)if((L=[(E=V[q+1])[0]-(v=V[q])[0],E[1]-v[1]])[0]*(k=[(g=n)[0]-(d=s)[0],g[1]-d[1]])[1]-L[1]*k[0]!=0&&_u(d,g,v,E)&&_u(v,E,d,g))return!0;var d,g,v,E,L,k;return!1}function tA(s,n){for(let o=0;o<s.length;++o)if(!gu(s[o],n))return!1;for(let o=0;o<s.length-1;++o)if(Ih(s[o],s[o+1],n))return!1;return!0}function td(s,n){for(let o=0;o<n.length;o++)if(tA(s,n[o]))return!0;return!1}function uc(s,n,o){const d=[];for(let g=0;g<s.length;g++){const v=[];for(let E=0;E<s[g].length;E++){const L=eA(s[g][E],o);cc(n,L),v.push(L)}d.push(v)}return d}function Oc(s,n,o){const d=[];for(let g=0;g<s.length;g++){const v=uc(s[g],n,o);d.push(v)}return d}function ul(s,n,o,d){if(s[0]<o[0]||s[0]>o[2]){const g=.5*d;let v=s[0]-o[0]>g?-d:o[0]-s[0]>g?d:0;v===0&&(v=s[0]-o[2]>g?-d:o[2]-s[0]>g?d:0),s[0]+=v}cc(n,s)}function Ir(s,n,o,d){const g=Math.pow(2,d.z)*Ws,v=[d.x*Ws,d.y*Ws],E=[];if(!s)return E;for(const L of s)for(const k of L){const V=[k.x+v[0],k.y+v[1]];ul(V,n,o,g),E.push(V)}return E}function Ac(s,n,o,d){const g=Math.pow(2,d.z)*Ws,v=[d.x*Ws,d.y*Ws],E=[];if(!s)return E;for(const k of s){const V=[];for(const q of k){const se=[q.x+v[0],q.y+v[1]];cc(n,se),V.push(se)}E.push(V)}if(n[2]-n[0]<=g/2){(L=n)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const k of E)for(const V of k)ul(V,n,o,g)}var L;return E}class Nc{constructor(n,o){this.type=Ar,this.geojson=n,this.geometries=o}static parse(n,o){if(n.length!==2)return o.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(fu(n[1])){const d=n[1];if(d.type==="FeatureCollection")for(let g=0;g<d.features.length;++g){const v=d.features[g].geometry.type;if(v==="Polygon"||v==="MultiPolygon")return new Nc(d,d.features[g].geometry)}else if(d.type==="Feature"){const g=d.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new Nc(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new Nc(d,d)}return o.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(o,d){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],E=o.canonicalID();if(!E)return!1;if(d.type==="Polygon"){const L=uc(d.coordinates,v,E),k=Ir(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!gu(V,L))return!1}if(d.type==="MultiPolygon"){const L=Oc(d.coordinates,v,E),k=Ir(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!ed(V,L))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(o,d){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],E=o.canonicalID();if(!E)return!1;if(d.type==="Polygon"){const L=uc(d.coordinates,v,E),k=Ac(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!tA(V,L))return!1}if(d.type==="MultiPolygon"){const L=Oc(d.coordinates,v,E),k=Ac(o.geometry(),g,v,E);if(!kc(g,v))return!1;for(const V of k)if(!td(V,L))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var yu=Nc;function Al(s){if(s instanceof ya&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof yu)return!1;let n=!0;return s.eachChild(o=>{n&&!Al(o)&&(n=!1)}),n}function Va(s){if(s instanceof ya&&s.name==="feature-state")return!1;let n=!0;return s.eachChild(o=>{n&&!Va(o)&&(n=!1)}),n}function Qc(s,n){if(s instanceof ya&&n.indexOf(s.name)>=0)return!1;let o=!0;return s.eachChild(d=>{o&&!Qc(d,n)&&(o=!1)}),o}class dl{constructor(n,o){this.type=o.type,this.name=n,this.boundExpression=o}static parse(n,o){if(n.length!==2||typeof n[1]!="string")return o.error("'var' expression requires exactly one string literal argument.");const d=n[1];return o.scope.has(d)?new dl(d,o.scope.get(d)):o.error(`Unknown variable "${d}". Make sure "${d}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(n){return this.boundExpression.evaluate(n)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var qr=dl;class Fh{constructor(n,o=[],d,g=new zs,v=[]){this.registry=n,this.path=o,this.key=o.map(E=>`[${E}]`).join(""),this.scope=g,this.errors=v,this.expectedType=d}parse(n,o,d,g,v={}){return o?this.concat(o,d,g)._parse(n,v):this._parse(n,v)}_parse(n,o){function d(g,v,E){return E==="assert"?new Qo(v,[g]):E==="coerce"?new Qa(v,[g]):g}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=n[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[g];if(v){let E=v.parse(n,this);if(!E)return null;if(this.expectedType){const L=this.expectedType,k=E.type;if(L.kind!=="string"&&L.kind!=="number"&&L.kind!=="boolean"&&L.kind!=="object"&&L.kind!=="array"||k.kind!=="value")if(L.kind!=="color"&&L.kind!=="formatted"&&L.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string"){if(this.checkSubtype(L,k))return null}else E=d(E,L,o.typeAnnotation||"coerce");else E=d(E,L,o.typeAnnotation||"assert")}if(!(E instanceof oc)&&E.type.kind!=="resolvedImage"&&Br(E)){const L=new mu;try{E=new oc(E.type,E.evaluate(L))}catch(k){return this.error(k.message),null}}return E}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,o,d){const g=typeof n=="number"?this.path.concat(n):this.path,v=d?this.scope.concat(d):this.scope;return new Fh(this.registry,g,o||null,v,this.errors)}error(n,...o){const d=`${this.key}${o.map(g=>`[${g}]`).join("")}`;this.errors.push(new Mr(d,n))}checkSubtype(n,o){const d=cl(n,o);return d&&this.error(d),d}}var hr=Fh;function Br(s){if(s instanceof qr)return Br(s.boundExpression);if(s instanceof ya&&s.name==="error"||s instanceof zc||s instanceof yu)return!1;const n=s instanceof Qa||s instanceof Qo;let o=!0;return s.eachChild(d=>{o=n?o&&Br(d):o&&d instanceof oc}),!!o&&Al(s)&&Qc(s,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function jr(s,n){const o=s.length-1;let d,g,v=0,E=o,L=0;for(;v<=E;)if(L=Math.floor((v+E)/2),d=s[L],g=s[L+1],d<=n){if(L===o||n<g)return L;v=L+1}else{if(!(d>n))throw new er("Input is not a number.");E=L-1}return 0}class $r{constructor(n,o,d){this.type=n,this.input=o,this.labels=[],this.outputs=[];for(const[g,v]of d)this.labels.push(g),this.outputs.push(v)}static parse(n,o){if(n.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return o.error("Expected an even number of arguments.");const d=o.parse(n[1],1,rn);if(!d)return null;const g=[];let v=null;o.expectedType&&o.expectedType.kind!=="value"&&(v=o.expectedType);for(let E=1;E<n.length;E+=2){const L=E===1?-1/0:n[E],k=n[E+1],V=E,q=E+1;if(typeof L!="number")return o.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',V);if(g.length&&g[g.length-1][0]>=L)return o.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',V);const se=o.parse(k,q,v);if(!se)return null;v=v||se.type,g.push([L,se])}return new $r(v,d,g)}evaluate(n){const o=this.labels,d=this.outputs;if(o.length===1)return d[0].evaluate(n);const g=this.input.evaluate(n);if(g<=o[0])return d[0].evaluate(n);const v=o.length;return g>=o[v-1]?d[v-1].evaluate(n):d[jr(o,g)].evaluate(n)}eachChild(n){n(this.input);for(const o of this.outputs)n(o)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}serialize(){const n=["step",this.input.serialize()];for(let o=0;o<this.labels.length;o++)o>0&&n.push(this.labels[o]),n.push(this.outputs[o].serialize());return n}}var Hl=$r;function gr(s,n,o){return s*(1-o)+n*o}var xu=Object.freeze({__proto__:null,number:gr,color:function(s,n,o){return new ps(gr(s.r,n.r,o),gr(s.g,n.g,o),gr(s.b,n.b,o),gr(s.a,n.a,o))},array:function(s,n,o){return s.map((d,g)=>gr(d,n[g],o))}});const iA=.95047,nA=1.08883,rA=4/29,dc=6/29,Vc=3*dc*dc,Hc=Math.PI/180,Lh=180/Math.PI;function Gc(s){return s>.008856451679035631?Math.pow(s,1/3):s/Vc+rA}function Dh(s){return s>dc?s*s*s:Vc*(s-rA)}function Wc(s){return 255*(s<=.0031308?12.92*s:1.055*Math.pow(s,1/2.4)-.055)}function jc(s){return(s/=255)<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function la(s){const n=jc(s.r),o=jc(s.g),d=jc(s.b),g=Gc((.4124564*n+.3575761*o+.1804375*d)/iA),v=Gc((.2126729*n+.7151522*o+.072175*d)/1);return{l:116*v-16,a:500*(g-v),b:200*(v-Gc((.0193339*n+.119192*o+.9503041*d)/nA)),alpha:s.a}}function sA(s){let n=(s.l+16)/116,o=isNaN(s.a)?n:n+s.a/500,d=isNaN(s.b)?n:n-s.b/200;return n=1*Dh(n),o=iA*Dh(o),d=nA*Dh(d),new ps(Wc(3.2404542*o-1.5371385*n-.4985314*d),Wc(-.969266*o+1.8760108*n+.041556*d),Wc(.0556434*o-.2040259*n+1.0572252*d),s.alpha)}function oA(s,n,o){const d=n-s;return s+o*(d>180||d<-180?d-360*Math.round(d/360):d)}const Kc={forward:la,reverse:sA,interpolate:function(s,n,o){return{l:gr(s.l,n.l,o),a:gr(s.a,n.a,o),b:gr(s.b,n.b,o),alpha:gr(s.alpha,n.alpha,o)}}},ca={forward:function(s){const{l:n,a:o,b:d}=la(s),g=Math.atan2(d,o)*Lh;return{h:g<0?g+360:g,c:Math.sqrt(o*o+d*d),l:n,alpha:s.a}},reverse:function(s){const n=s.h*Hc,o=s.c;return sA({l:s.l,a:Math.cos(n)*o,b:Math.sin(n)*o,alpha:s.alpha})},interpolate:function(s,n,o){return{h:oA(s.h,n.h,o),c:gr(s.c,n.c,o),l:gr(s.l,n.l,o),alpha:gr(s.alpha,n.alpha,o)}}};var $c=Object.freeze({__proto__:null,lab:Kc,hcl:ca});class pl{constructor(n,o,d,g,v){this.type=n,this.operator=o,this.interpolation=d,this.input=g,this.labels=[],this.outputs=[];for(const[E,L]of v)this.labels.push(E),this.outputs.push(L)}static interpolationFactor(n,o,d,g){let v=0;if(n.name==="exponential")v=aA(o,n.base,d,g);else if(n.name==="linear")v=aA(o,1,d,g);else if(n.name==="cubic-bezier"){const E=n.controlPoints;v=new Ae(E[0],E[1],E[2],E[3]).solve(aA(o,1,d,g))}return v}static parse(n,o){let[d,g,v,...E]=n;if(!Array.isArray(g)||g.length===0)return o.error("Expected an interpolation type expression.",1);if(g[0]==="linear")g={name:"linear"};else if(g[0]==="exponential"){const V=g[1];if(typeof V!="number")return o.error("Exponential interpolation requires a numeric base.",1,1);g={name:"exponential",base:V}}else{if(g[0]!=="cubic-bezier")return o.error(`Unknown interpolation type ${String(g[0])}`,1,0);{const V=g.slice(1);if(V.length!==4||V.some(q=>typeof q!="number"||q<0||q>1))return o.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:V}}}if(n.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return o.error("Expected an even number of arguments.");if(v=o.parse(v,2,rn),!v)return null;const L=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=aa:o.expectedType&&o.expectedType.kind!=="value"&&(k=o.expectedType);for(let V=0;V<E.length;V+=2){const q=E[V],se=E[V+1],he=V+3,_e=V+4;if(typeof q!="number")return o.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',he);if(L.length&&L[L.length-1][0]>=q)return o.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',he);const Be=o.parse(se,_e,k);if(!Be)return null;k=k||Be.type,L.push([q,Be])}return k.kind==="number"||k.kind==="color"||k.kind==="array"&&k.itemType.kind==="number"&&typeof k.N=="number"?new pl(k,d,g,v,L):o.error(`Type ${cs(k)} is not interpolatable.`)}evaluate(n){const o=this.labels,d=this.outputs;if(o.length===1)return d[0].evaluate(n);const g=this.input.evaluate(n);if(g<=o[0])return d[0].evaluate(n);const v=o.length;if(g>=o[v-1])return d[v-1].evaluate(n);const E=jr(o,g),L=pl.interpolationFactor(this.interpolation,g,o[E],o[E+1]),k=d[E].evaluate(n),V=d[E+1].evaluate(n);return this.operator==="interpolate"?xu[this.type.kind.toLowerCase()](k,V,L):this.operator==="interpolate-hcl"?ca.reverse(ca.interpolate(ca.forward(k),ca.forward(V),L)):Kc.reverse(Kc.interpolate(Kc.forward(k),Kc.forward(V),L))}eachChild(n){n(this.input);for(const o of this.outputs)n(o)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}serialize(){let n;n=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const o=[this.operator,n,this.input.serialize()];for(let d=0;d<this.labels.length;d++)o.push(this.labels[d],this.outputs[d].serialize());return o}}function aA(s,n,o,d){const g=d-o,v=s-o;return g===0?0:n===1?v/g:(Math.pow(n,v)-1)/(Math.pow(n,g)-1)}var Ho=pl;class Ph{constructor(n,o){this.type=n,this.args=o}static parse(n,o){if(n.length<2)return o.error("Expectected at least one argument.");let d=null;const g=o.expectedType;g&&g.kind!=="value"&&(d=g);const v=[];for(const L of n.slice(1)){const k=o.parse(L,1+v.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,v.push(k)}const E=g&&v.some(L=>cl(g,L.type));return new Ph(E?dr:d,v)}evaluate(n){let o,d=null,g=0;for(const v of this.args){if(g++,d=v.evaluate(n),d&&d instanceof No&&!d.available&&(o||(o=d),d=null,g===this.args.length))return o;if(d!==null)break}return d}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}serialize(){const n=["coalesce"];return this.eachChild(o=>{n.push(o.serialize())}),n}}var vu=Ph;class Gl{constructor(n,o){this.type=o.type,this.bindings=[].concat(n),this.result=o}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const o of this.bindings)n(o[1]);n(this.result)}static parse(n,o){if(n.length<4)return o.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const d=[];for(let v=1;v<n.length-1;v+=2){const E=n[v];if(typeof E!="string")return o.error(`Expected string, but found ${typeof E} instead.`,v);if(/[^a-zA-Z0-9_]/.test(E))return o.error("Variable names must contain only alphanumeric characters or '_'.",v);const L=o.parse(n[v+1],v+1);if(!L)return null;d.push([E,L])}const g=o.parse(n[n.length-1],n.length-1,o.expectedType,d);return g?new Gl(d,g):null}outputDefined(){return this.result.outputDefined()}serialize(){const n=["let"];for(const[o,d]of this.bindings)n.push(o,d.serialize());return n.push(this.result.serialize()),n}}var wu=Gl;class Zc{constructor(n,o,d){this.type=n,this.index=o,this.input=d}static parse(n,o){if(n.length!==3)return o.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,rn),g=o.parse(n[2],2,qs(o.expectedType||dr));return d&&g?new Zc(g.type.itemType,d,g):null}evaluate(n){const o=this.index.evaluate(n),d=this.input.evaluate(n);if(o<0)throw new er(`Array index out of bounds: ${o} < 0.`);if(o>=d.length)throw new er(`Array index out of bounds: ${o} > ${d.length-1}.`);if(o!==Math.floor(o))throw new er(`Array index must be an integer, but found ${o} instead.`);return d[o]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Xc=Zc;class fl{constructor(n,o){this.type=Ar,this.needle=n,this.haystack=o}static parse(n,o){if(n.length!==3)return o.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,dr),g=o.parse(n[2],2,dr);return d&&g?Oa(d.type,[Ar,cr,rn,or,dr])?new fl(d,g):o.error(`Expected first argument to be of type boolean, string, number or null, but found ${cs(d.type)} instead`):null}evaluate(n){const o=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(d==null)return!1;if(!zl(o,["boolean","string","number","null"]))throw new er(`Expected first argument to be of type boolean, string, number or null, but found ${cs(Bs(o))} instead.`);if(!zl(d,["string","array"]))throw new er(`Expected second argument to be of type array or string, but found ${cs(Bs(d))} instead.`);return d.indexOf(o)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var qc=fl;class Uh{constructor(n,o,d){this.type=rn,this.needle=n,this.haystack=o,this.fromIndex=d}static parse(n,o){if(n.length<=2||n.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,dr),g=o.parse(n[2],2,dr);if(!d||!g)return null;if(!Oa(d.type,[Ar,cr,rn,or,dr]))return o.error(`Expected first argument to be of type boolean, string, number or null, but found ${cs(d.type)} instead`);if(n.length===4){const v=o.parse(n[3],3,rn);return v?new Uh(d,g,v):null}return new Uh(d,g)}evaluate(n){const o=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!zl(o,["boolean","string","number","null"]))throw new er(`Expected first argument to be of type boolean, string, number or null, but found ${cs(Bs(o))} instead.`);if(!zl(d,["string","array"]))throw new er(`Expected second argument to be of type array or string, but found ${cs(Bs(d))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(n);return d.indexOf(o,g)}return d.indexOf(o)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const n=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),n]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Rh=Uh;class bu{constructor(n,o,d,g,v,E){this.inputType=n,this.type=o,this.input=d,this.cases=g,this.outputs=v,this.otherwise=E}static parse(n,o){if(n.length<5)return o.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return o.error("Expected an even number of arguments.");let d,g;o.expectedType&&o.expectedType.kind!=="value"&&(g=o.expectedType);const v={},E=[];for(let V=2;V<n.length-1;V+=2){let q=n[V];const se=n[V+1];Array.isArray(q)||(q=[q]);const he=o.concat(V);if(q.length===0)return he.error("Expected at least one branch label.");for(const Be of q){if(typeof Be!="number"&&typeof Be!="string")return he.error("Branch labels must be numbers or strings.");if(typeof Be=="number"&&Math.abs(Be)>Number.MAX_SAFE_INTEGER)return he.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Be=="number"&&Math.floor(Be)!==Be)return he.error("Numeric branch labels must be integer values.");if(d){if(he.checkSubtype(d,Bs(Be)))return null}else d=Bs(Be);if(v[String(Be)]!==void 0)return he.error("Branch labels must be unique.");v[String(Be)]=E.length}const _e=o.parse(se,V,g);if(!_e)return null;g=g||_e.type,E.push(_e)}const L=o.parse(n[1],1,dr);if(!L)return null;const k=o.parse(n[n.length-1],n.length-1,g);return k?L.type.kind!=="value"&&o.concat(1).checkSubtype(d,L.type)?null:new bu(d,g,L,v,E,k):null}evaluate(n){const o=this.input.evaluate(n);return(Bs(o)===this.inputType&&this.outputs[this.cases[o]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}serialize(){const n=["match",this.input.serialize()],o=Object.keys(this.cases).sort(),d=[],g={};for(const E of o){const L=g[this.cases[E]];L===void 0?(g[this.cases[E]]=d.length,d.push([this.cases[E],[E]])):d[L][1].push(E)}const v=E=>this.inputType.kind==="number"?Number(E):E;for(const[E,L]of d)n.push(L.length===1?v(L[0]):L.map(v)),n.push(this.outputs[E].serialize());return n.push(this.otherwise.serialize()),n}}var id=bu;class pc{constructor(n,o,d){this.type=n,this.branches=o,this.otherwise=d}static parse(n,o){if(n.length<4)return o.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return o.error("Expected an odd number of arguments.");let d;o.expectedType&&o.expectedType.kind!=="value"&&(d=o.expectedType);const g=[];for(let E=1;E<n.length-1;E+=2){const L=o.parse(n[E],E,Ar);if(!L)return null;const k=o.parse(n[E+1],E+1,d);if(!k)return null;g.push([L,k]),d=d||k.type}const v=o.parse(n[n.length-1],n.length-1,d);return v?new pc(d,g,v):null}evaluate(n){for(const[o,d]of this.branches)if(o.evaluate(n))return d.evaluate(n);return this.otherwise.evaluate(n)}eachChild(n){for(const[o,d]of this.branches)n(o),n(d);n(this.otherwise)}outputDefined(){return this.branches.every(([n,o])=>o.outputDefined())&&this.otherwise.outputDefined()}serialize(){const n=["case"];return this.eachChild(o=>{n.push(o.serialize())}),n}}var fc=pc;class Yc{constructor(n,o,d,g){this.type=n,this.input=o,this.beginIndex=d,this.endIndex=g}static parse(n,o){if(n.length<=2||n.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=o.parse(n[1],1,dr),g=o.parse(n[2],2,rn);if(!d||!g)return null;if(!Oa(d.type,[qs(dr),cr,dr]))return o.error(`Expected first argument to be of type array or string, but found ${cs(d.type)} instead`);if(n.length===4){const v=o.parse(n[3],3,rn);return v?new Yc(d.type,d,g,v):null}return new Yc(d.type,d,g)}evaluate(n){const o=this.input.evaluate(n),d=this.beginIndex.evaluate(n);if(!zl(o,["string","array"]))throw new er(`Expected first argument to be of type array or string, but found ${cs(Bs(o))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(n);return o.slice(d,g)}return o.slice(d)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const n=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),n]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var zh=Yc;function Jc(s,n){return s==="=="||s==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function So(s,n,o,d){return d.compare(n,o)===0}function xa(s,n,o){const d=s!=="=="&&s!=="!=";return class RF{constructor(v,E,L){this.type=Ar,this.lhs=v,this.rhs=E,this.collator=L,this.hasUntypedArgument=v.type.kind==="value"||E.type.kind==="value"}static parse(v,E){if(v.length!==3&&v.length!==4)return E.error("Expected two or three arguments.");const L=v[0];let k=E.parse(v[1],1,dr);if(!k)return null;if(!Jc(L,k.type))return E.concat(1).error(`"${L}" comparisons are not supported for type '${cs(k.type)}'.`);let V=E.parse(v[2],2,dr);if(!V)return null;if(!Jc(L,V.type))return E.concat(2).error(`"${L}" comparisons are not supported for type '${cs(V.type)}'.`);if(k.type.kind!==V.type.kind&&k.type.kind!=="value"&&V.type.kind!=="value")return E.error(`Cannot compare types '${cs(k.type)}' and '${cs(V.type)}'.`);d&&(k.type.kind==="value"&&V.type.kind!=="value"?k=new Qo(V.type,[k]):k.type.kind!=="value"&&V.type.kind==="value"&&(V=new Qo(k.type,[V])));let q=null;if(v.length===4){if(k.type.kind!=="string"&&V.type.kind!=="string"&&k.type.kind!=="value"&&V.type.kind!=="value")return E.error("Cannot use collator to compare non-string types.");if(q=E.parse(v[3],3,Ul),!q)return null}return new RF(k,V,q)}evaluate(v){const E=this.lhs.evaluate(v),L=this.rhs.evaluate(v);if(d&&this.hasUntypedArgument){const k=Bs(E),V=Bs(L);if(k.kind!==V.kind||k.kind!=="string"&&k.kind!=="number")throw new er(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${V.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=Bs(E),V=Bs(L);if(k.kind!=="string"||V.kind!=="string")return n(v,E,L)}return this.collator?o(v,E,L,this.collator.evaluate(v)):n(v,E,L)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}serialize(){const v=[s];return this.eachChild(E=>{v.push(E.serialize())}),v}}}const Mo=xa("==",function(s,n,o){return n===o},So),nd=xa("!=",function(s,n,o){return n!==o},function(s,n,o,d){return!So(0,n,o,d)}),Ha=xa("<",function(s,n,o){return n<o},function(s,n,o,d){return d.compare(n,o)<0}),rd=xa(">",function(s,n,o){return n>o},function(s,n,o,d){return d.compare(n,o)>0}),ml=xa("<=",function(s,n,o){return n<=o},function(s,n,o,d){return d.compare(n,o)<=0}),kh=xa(">=",function(s,n,o){return n>=o},function(s,n,o,d){return d.compare(n,o)>=0});class Oh{constructor(n,o,d,g,v,E){this.type=cr,this.number=n,this.locale=o,this.currency=d,this.unit=g,this.minFractionDigits=v,this.maxFractionDigits=E}static parse(n,o){if(n.length!==3)return o.error("Expected two arguments.");const d=o.parse(n[1],1,rn);if(!d)return null;const g=n[2];if(typeof g!="object"||Array.isArray(g))return o.error("NumberFormat options argument must be an object.");let v=null;if(g.locale&&(v=o.parse(g.locale,1,cr),!v))return null;let E=null;if(g.currency&&(E=o.parse(g.currency,1,cr),!E))return null;let L=null;if(g.unit&&(L=o.parse(g.unit,1,cr),!L))return null;let k=null;if(g["min-fraction-digits"]&&(k=o.parse(g["min-fraction-digits"],1,rn),!k))return null;let V=null;return g["max-fraction-digits"]&&(V=o.parse(g["max-fraction-digits"],1,rn),!V)?null:new Oh(d,v,E,L,k,V)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(n):void 0,unit:this.unit?this.unit.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.unit&&n(this.unit),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const n={};return this.locale&&(n.locale=this.locale.serialize()),this.currency&&(n.currency=this.currency.serialize()),this.unit&&(n.unit=this.unit.serialize()),this.minFractionDigits&&(n["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(n["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),n]}}class lA{constructor(n){this.type=rn,this.input=n}static parse(n,o){if(n.length!==2)return o.error(`Expected 1 argument, but found ${n.length-1} instead.`);const d=o.parse(n[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?o.error(`Expected argument of type string or array, but found ${cs(d.type)} instead.`):new lA(d):null}evaluate(n){const o=this.input.evaluate(n);if(typeof o=="string"||Array.isArray(o))return o.length;throw new er(`Expected value to be of type string or array, but found ${cs(Bs(o))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}serialize(){const n=["length"];return this.eachChild(o=>{n.push(o.serialize())}),n}}const sd={"==":Mo,"!=":nd,">":rd,"<":Ha,">=":kh,"<=":ml,array:Qo,at:Xc,boolean:Qo,case:fc,coalesce:vu,collator:zc,format:hl,image:Sh,in:qc,"index-of":Rh,interpolate:Ho,"interpolate-hcl":Ho,"interpolate-lab":Ho,length:lA,let:wu,literal:oc,match:id,number:Qo,"number-format":Oh,object:Qo,slice:zh,step:Hl,string:Qo,"to-boolean":Qa,"to-color":Qa,"to-number":Qa,"to-string":Qa,var:qr,within:yu};function Nh(s,[n,o,d,g]){n=n.evaluate(s),o=o.evaluate(s),d=d.evaluate(s);const v=g?g.evaluate(s):1,E=JA(n,o,d,v);if(E)throw new er(E);return new ps(n/255*v,o/255*v,d/255*v,v)}function mc(s,n){return s in n}function ha(s,n){const o=n[s];return o===void 0?null:o}function pn(s){return{type:s}}ya.register(sd,{error:[{kind:"error"},[cr],(s,[n])=>{throw new er(n.evaluate(s))}],typeof:[cr,[dr],(s,[n])=>cs(Bs(n.evaluate(s)))],"to-rgba":[qs(rn,4),[aa],(s,[n])=>n.evaluate(s).toArray()],rgb:[aa,[rn,rn,rn],Nh],rgba:[aa,[rn,rn,rn,rn],Nh],has:{type:Ar,overloads:[[[cr],(s,[n])=>mc(n.evaluate(s),s.properties())],[[cr,al],(s,[n,o])=>mc(n.evaluate(s),o.evaluate(s))]]},get:{type:dr,overloads:[[[cr],(s,[n])=>ha(n.evaluate(s),s.properties())],[[cr,al],(s,[n,o])=>ha(n.evaluate(s),o.evaluate(s))]]},"feature-state":[dr,[cr],(s,[n])=>ha(n.evaluate(s),s.featureState||{})],properties:[al,[],s=>s.properties()],"geometry-type":[cr,[],s=>s.geometryType()],id:[dr,[],s=>s.id()],zoom:[rn,[],s=>s.globals.zoom],pitch:[rn,[],s=>s.globals.pitch||0],"distance-from-center":[rn,[],s=>s.distanceFromCenter()],"heatmap-density":[rn,[],s=>s.globals.heatmapDensity||0],"line-progress":[rn,[],s=>s.globals.lineProgress||0],"sky-radial-progress":[rn,[],s=>s.globals.skyRadialProgress||0],accumulated:[dr,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[rn,pn(rn),(s,n)=>{let o=0;for(const d of n)o+=d.evaluate(s);return o}],"*":[rn,pn(rn),(s,n)=>{let o=1;for(const d of n)o*=d.evaluate(s);return o}],"-":{type:rn,overloads:[[[rn,rn],(s,[n,o])=>n.evaluate(s)-o.evaluate(s)],[[rn],(s,[n])=>-n.evaluate(s)]]},"/":[rn,[rn,rn],(s,[n,o])=>n.evaluate(s)/o.evaluate(s)],"%":[rn,[rn,rn],(s,[n,o])=>n.evaluate(s)%o.evaluate(s)],ln2:[rn,[],()=>Math.LN2],pi:[rn,[],()=>Math.PI],e:[rn,[],()=>Math.E],"^":[rn,[rn,rn],(s,[n,o])=>Math.pow(n.evaluate(s),o.evaluate(s))],sqrt:[rn,[rn],(s,[n])=>Math.sqrt(n.evaluate(s))],log10:[rn,[rn],(s,[n])=>Math.log(n.evaluate(s))/Math.LN10],ln:[rn,[rn],(s,[n])=>Math.log(n.evaluate(s))],log2:[rn,[rn],(s,[n])=>Math.log(n.evaluate(s))/Math.LN2],sin:[rn,[rn],(s,[n])=>Math.sin(n.evaluate(s))],cos:[rn,[rn],(s,[n])=>Math.cos(n.evaluate(s))],tan:[rn,[rn],(s,[n])=>Math.tan(n.evaluate(s))],asin:[rn,[rn],(s,[n])=>Math.asin(n.evaluate(s))],acos:[rn,[rn],(s,[n])=>Math.acos(n.evaluate(s))],atan:[rn,[rn],(s,[n])=>Math.atan(n.evaluate(s))],min:[rn,pn(rn),(s,n)=>Math.min(...n.map(o=>o.evaluate(s)))],max:[rn,pn(rn),(s,n)=>Math.max(...n.map(o=>o.evaluate(s)))],abs:[rn,[rn],(s,[n])=>Math.abs(n.evaluate(s))],round:[rn,[rn],(s,[n])=>{const o=n.evaluate(s);return o<0?-Math.round(-o):Math.round(o)}],floor:[rn,[rn],(s,[n])=>Math.floor(n.evaluate(s))],ceil:[rn,[rn],(s,[n])=>Math.ceil(n.evaluate(s))],"filter-==":[Ar,[cr,dr],(s,[n,o])=>s.properties()[n.value]===o.value],"filter-id-==":[Ar,[dr],(s,[n])=>s.id()===n.value],"filter-type-==":[Ar,[cr],(s,[n])=>s.geometryType()===n.value],"filter-<":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d<g}],"filter-id-<":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o<d}],"filter->":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d>g}],"filter-id->":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o>d}],"filter-<=":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d<=g}],"filter-id-<=":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o<=d}],"filter->=":[Ar,[cr,dr],(s,[n,o])=>{const d=s.properties()[n.value],g=o.value;return typeof d==typeof g&&d>=g}],"filter-id->=":[Ar,[dr],(s,[n])=>{const o=s.id(),d=n.value;return typeof o==typeof d&&o>=d}],"filter-has":[Ar,[dr],(s,[n])=>n.value in s.properties()],"filter-has-id":[Ar,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Ar,[qs(cr)],(s,[n])=>n.value.indexOf(s.geometryType())>=0],"filter-id-in":[Ar,[qs(dr)],(s,[n])=>n.value.indexOf(s.id())>=0],"filter-in-small":[Ar,[cr,qs(dr)],(s,[n,o])=>o.value.indexOf(s.properties()[n.value])>=0],"filter-in-large":[Ar,[cr,qs(dr)],(s,[n,o])=>function(d,g,v,E){for(;v<=E;){const L=v+E>>1;if(g[L]===d)return!0;g[L]>d?E=L-1:v=L+1}return!1}(s.properties()[n.value],o.value,0,o.value.length-1)],all:{type:Ar,overloads:[[[Ar,Ar],(s,[n,o])=>n.evaluate(s)&&o.evaluate(s)],[pn(Ar),(s,n)=>{for(const o of n)if(!o.evaluate(s))return!1;return!0}]]},any:{type:Ar,overloads:[[[Ar,Ar],(s,[n,o])=>n.evaluate(s)||o.evaluate(s)],[pn(Ar),(s,n)=>{for(const o of n)if(o.evaluate(s))return!0;return!1}]]},"!":[Ar,[Ar],(s,[n])=>!n.evaluate(s)],"is-supported-script":[Ar,[cr],(s,[n])=>{const o=s.globals&&s.globals.isSupportedScript;return!o||o(n.evaluate(s))}],upcase:[cr,[cr],(s,[n])=>n.evaluate(s).toUpperCase()],downcase:[cr,[cr],(s,[n])=>n.evaluate(s).toLowerCase()],concat:[cr,pn(dr),(s,n)=>n.map(o=>sc(o.evaluate(s))).join("")],"resolved-locale":[cr,[Ul],(s,[n])=>n.evaluate(s).resolvedLocale()]});var eh=sd;function Wl(s){return{result:"success",value:s}}function Os(s){return{result:"error",value:s}}function gl(s){return s["property-type"]==="data-driven"}function un(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function th(s){return!!s.expression&&s.expression.interpolated}function Ur(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function gc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function cA(s){return s}function Qh(s,n){const o=n.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",g=d||!(d||s.property!==void 0),v=s.type||(th(n)?"exponential":"interval");if(o&&((s=sr({},s)).stops&&(s.stops=s.stops.map(V=>[V[0],ps.parse(V[1])])),s.default=ps.parse(s.default?s.default:n.default)),s.colorSpace&&s.colorSpace!=="rgb"&&!$c[s.colorSpace])throw new Error(`Unknown color space: ${s.colorSpace}`);let E,L,k;if(v==="exponential")E=Vh;else if(v==="interval")E=uA;else if(v==="categorical"){E=hA,L=Object.create(null);for(const V of s.stops)L[V[0]]=V[1];k=typeof s.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Hh}if(d){const V={},q=[];for(let _e=0;_e<s.stops.length;_e++){const Be=s.stops[_e],Le=Be[0].zoom;V[Le]===void 0&&(V[Le]={zoom:Le,type:s.type,property:s.property,default:s.default,stops:[]},q.push(Le)),V[Le].stops.push([Be[0].value,Be[1]])}const se=[];for(const _e of q)se.push([V[_e].zoom,Qh(V[_e],n)]);const he={name:"linear"};return{kind:"composite",interpolationType:he,interpolationFactor:Ho.interpolationFactor.bind(void 0,he),zoomStops:se.map(_e=>_e[0]),evaluate:({zoom:_e},Be)=>Vh({stops:se,base:s.base},n,_e).evaluate(_e,Be)}}if(g){const V=v==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:V,interpolationFactor:Ho.interpolationFactor.bind(void 0,V),zoomStops:s.stops.map(q=>q[0]),evaluate:({zoom:q})=>E(s,n,q,L,k)}}return{kind:"source",evaluate(V,q){const se=q&&q.properties?q.properties[s.property]:void 0;return se===void 0?_c(s.default,n.default):E(s,n,se,L,k)}}}function _c(s,n,o){return s!==void 0?s:n!==void 0?n:o!==void 0?o:void 0}function hA(s,n,o,d,g){return _c(typeof o===g?d[o]:void 0,s.default,n.default)}function uA(s,n,o){if(Ur(o)!=="number")return _c(s.default,n.default);const d=s.stops.length;if(d===1||o<=s.stops[0][0])return s.stops[0][1];if(o>=s.stops[d-1][0])return s.stops[d-1][1];const g=jr(s.stops.map(v=>v[0]),o);return s.stops[g][1]}function Vh(s,n,o){const d=s.base!==void 0?s.base:1;if(Ur(o)!=="number")return _c(s.default,n.default);const g=s.stops.length;if(g===1||o<=s.stops[0][0])return s.stops[0][1];if(o>=s.stops[g-1][0])return s.stops[g-1][1];const v=jr(s.stops.map(q=>q[0]),o),E=function(q,se,he,_e){const Be=_e-he,Le=q-he;return Be===0?0:se===1?Le/Be:(Math.pow(se,Le)-1)/(Math.pow(se,Be)-1)}(o,d,s.stops[v][0],s.stops[v+1][0]),L=s.stops[v][1],k=s.stops[v+1][1];let V=xu[n.type]||cA;if(s.colorSpace&&s.colorSpace!=="rgb"){const q=$c[s.colorSpace];V=(se,he)=>q.reverse(q.interpolate(q.forward(se),q.forward(he),E))}return typeof L.evaluate=="function"?{evaluate(...q){const se=L.evaluate.apply(void 0,q),he=k.evaluate.apply(void 0,q);if(se!==void 0&&he!==void 0)return V(se,he,E)}}:V(L,k,E)}function Hh(s,n,o){return n.type==="color"?o=ps.parse(o):n.type==="formatted"?o=ks.fromString(o.toString()):n.type==="resolvedImage"?o=No.fromString(o.toString()):Ur(o)===n.type||n.type==="enum"&&n.values[o]||(o=void 0),_c(o,s.default,n.default)}class ih{constructor(n,o){this.expression=n,this._warningHistory={},this._evaluator=new mu,this._defaultValue=o?function(d){return d.type==="color"&&(gc(d.default)||Array.isArray(d.default))?new ps(0,0,0,0):d.type==="color"?ps.parse(d.default)||null:d.default===void 0?null:d.default}(o):null,this._enumValues=o&&o.type==="enum"?o.values:null}evaluateWithoutErrorHandling(n,o,d,g,v,E,L,k){return this._evaluator.globals=n,this._evaluator.feature=o,this._evaluator.featureState=d,this._evaluator.canonical=g||null,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E,this._evaluator.featureTileCoord=L||null,this._evaluator.featureDistanceData=k||null,this.expression.evaluate(this._evaluator)}evaluate(n,o,d,g,v,E,L,k){this._evaluator.globals=n,this._evaluator.feature=o||null,this._evaluator.featureState=d||null,this._evaluator.canonical=g||null,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E||null,this._evaluator.featureTileCoord=L||null,this._evaluator.featureDistanceData=k||null;try{const V=this.expression.evaluate(this._evaluator);if(V==null||typeof V=="number"&&V!=V)return this._defaultValue;if(this._enumValues&&!(V in this._enumValues))throw new er(`Expected value to be one of ${Object.keys(this._enumValues).map(q=>JSON.stringify(q)).join(", ")}, but found ${JSON.stringify(V)} instead.`);return V}catch(V){return this._warningHistory[V.message]||(this._warningHistory[V.message]=!0,typeof console<"u"&&console.warn(V.message)),this._defaultValue}}}function yc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in eh}function Ms(s,n){const o=new hr(eh,[],n?function(g){const v={color:aa,string:cr,number:rn,enum:cr,boolean:Ar,formatted:Rl,resolvedImage:ll};return g.type==="array"?qs(v[g.value]||dr,g.length):v[g.type]}(n):void 0),d=o.parse(s,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?Wl(new ih(d,n)):Os(o.errors)}class fo{constructor(n,o){this.kind=n,this._styleExpression=o,this.isStateDependent=n!=="constant"&&!Va(o.expression)}evaluateWithoutErrorHandling(n,o,d,g,v,E){return this._styleExpression.evaluateWithoutErrorHandling(n,o,d,g,v,E)}evaluate(n,o,d,g,v,E){return this._styleExpression.evaluate(n,o,d,g,v,E)}}class Gh{constructor(n,o,d,g){this.kind=n,this.zoomStops=d,this._styleExpression=o,this.isStateDependent=n!=="camera"&&!Va(o.expression),this.interpolationType=g}evaluateWithoutErrorHandling(n,o,d,g,v,E){return this._styleExpression.evaluateWithoutErrorHandling(n,o,d,g,v,E)}evaluate(n,o,d,g,v,E){return this._styleExpression.evaluate(n,o,d,g,v,E)}interpolationFactor(n,o,d){return this.interpolationType?Ho.interpolationFactor(this.interpolationType,n,o,d):0}}function jl(s,n){if((s=Ms(s,n)).result==="error")return s;const o=s.value.expression,d=Al(o);if(!d&&!gl(n))return Os([new Mr("","data expressions not supported")]);const g=Qc(o,["zoom","pitch","distance-from-center"]);if(!g&&!un(n))return Os([new Mr("","zoom expressions not supported")]);const v=_l(o);return v||g?v instanceof Mr?Os([v]):v instanceof Ho&&!th(n)?Os([new Mr("",'"interpolate" expressions cannot be used with this property')]):Wl(v?new Gh(d?"camera":"composite",s.value,v.labels,v instanceof Ho?v.interpolation:void 0):new fo(d?"constant":"source",s.value)):Os([new Mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Kl{constructor(n,o){this._parameters=n,this._specification=o,sr(this,Qh(this._parameters,this._specification))}static deserialize(n){return new Kl(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function _l(s){let n=null;if(s instanceof wu)n=_l(s.result);else if(s instanceof vu){for(const o of s.args)if(n=_l(o),n)break}else(s instanceof Hl||s instanceof Ho)&&s.input instanceof ya&&s.input.name==="zoom"&&(n=s);return n instanceof Mr||s.eachChild(o=>{const d=_l(o);d instanceof Mr?n=d:!n&&d?n=new Mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&d&&n!==d&&(n=new Mr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}class An{constructor(n,o,d,g){this.message=(n?`${n}: `:"")+d,g&&(this.identifier=g),o!=null&&o.__line__&&(this.line=o.__line__)}}function xs(s){const n=s.key,o=s.value,d=s.valueSpec||{},g=s.objectElementValidators||{},v=s.style,E=s.styleSpec;let L=[];const k=Ur(o);if(k!=="object")return[new An(n,o,`object expected, ${k} found`)];for(const V in o){const q=V.split(".")[0],se=d[q]||d["*"];let he;g[q]?he=g[q]:d[q]?he=Te:g["*"]?he=g["*"]:d["*"]&&(he=Te),he?L=L.concat(he({key:(n&&`${n}.`)+V,value:o[V],valueSpec:se,style:v,styleSpec:E,object:o,objectKey:V},o)):L.push(new An(n,o[V],`unknown property "${V}"`))}for(const V in d)g[V]||d[V].required&&d[V].default===void 0&&o[V]===void 0&&L.push(new An(n,o,`missing required property "${V}"`));return L}function Zr(s){const n=s.value,o=s.valueSpec,d=s.style,g=s.styleSpec,v=s.key,E=s.arrayElementValidator||Te;if(Ur(n)!=="array")return[new An(v,n,`array expected, ${Ur(n)} found`)];if(o.length&&n.length!==o.length)return[new An(v,n,`array length ${o.length} expected, length ${n.length} found`)];if(o["min-length"]&&n.length<o["min-length"])return[new An(v,n,`array length at least ${o["min-length"]} expected, length ${n.length} found`)];let L={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};g.$version<7&&(L.function=o.function),Ur(o.value)==="object"&&(L=o.value);let k=[];for(let V=0;V<n.length;V++)k=k.concat(E({array:n,arrayIndex:V,value:n[V],valueSpec:L,style:d,styleSpec:g,key:`${v}[${V}]`}));return k}function nh(s){const n=s.key,o=s.value,d=s.valueSpec;let g=Ur(o);if(g==="number"&&o!=o&&(g="NaN"),g!=="number")return[new An(n,o,`number expected, ${g} found`)];if("minimum"in d){let v=d.minimum;if(Ur(d.minimum)==="array"&&(v=d.minimum[s.arrayIndex]),o<v)return[new An(n,o,`${o} is less than the minimum value ${v}`)]}if("maximum"in d){let v=d.maximum;if(Ur(d.maximum)==="array"&&(v=d.maximum[s.arrayIndex]),o>v)return[new An(n,o,`${o} is greater than the maximum value ${v}`)]}return[]}function Wh(s){const n=s.valueSpec,o=Yn(s.value.type);let d,g,v,E={};const L=o!=="categorical"&&s.value.property===void 0,k=!L,V=Ur(s.value.stops)==="array"&&Ur(s.value.stops[0])==="array"&&Ur(s.value.stops[0][0])==="object",q=xs({key:s.key,value:s.value,valueSpec:s.styleSpec.function,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(_e){if(o==="identity")return[new An(_e.key,_e.value,'identity function may not have a "stops" property')];let Be=[];const Le=_e.value;return Be=Be.concat(Zr({key:_e.key,value:Le,valueSpec:_e.valueSpec,style:_e.style,styleSpec:_e.styleSpec,arrayElementValidator:se})),Ur(Le)==="array"&&Le.length===0&&Be.push(new An(_e.key,Le,"array must have at least one stop")),Be},default:function(_e){return Te({key:_e.key,value:_e.value,valueSpec:n,style:_e.style,styleSpec:_e.styleSpec})}}});return o==="identity"&&L&&q.push(new An(s.key,s.value,'missing required property "property"')),o==="identity"||s.value.stops||q.push(new An(s.key,s.value,'missing required property "stops"')),o==="exponential"&&s.valueSpec.expression&&!th(s.valueSpec)&&q.push(new An(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!gl(s.valueSpec)?q.push(new An(s.key,s.value,"property functions not supported")):L&&!un(s.valueSpec)&&q.push(new An(s.key,s.value,"zoom functions not supported"))),o!=="categorical"&&!V||s.value.property!==void 0||q.push(new An(s.key,s.value,'"property" property is required')),q;function se(_e){let Be=[];const Le=_e.value,Xe=_e.key;if(Ur(Le)!=="array")return[new An(Xe,Le,`array expected, ${Ur(Le)} found`)];if(Le.length!==2)return[new An(Xe,Le,`array length 2 expected, length ${Le.length} found`)];if(V){if(Ur(Le[0])!=="object")return[new An(Xe,Le,`object expected, ${Ur(Le[0])} found`)];if(Le[0].zoom===void 0)return[new An(Xe,Le,"object stop key must have zoom")];if(Le[0].value===void 0)return[new An(Xe,Le,"object stop key must have value")];const xt=Yn(Le[0].zoom);if(typeof xt!="number")return[new An(Xe,Le[0].zoom,"stop zoom values must be numbers")];if(v&&v>xt)return[new An(Xe,Le[0].zoom,"stop zoom values must appear in ascending order")];xt!==v&&(v=xt,g=void 0,E={}),Be=Be.concat(xs({key:`${Xe}[0]`,value:Le[0],valueSpec:{zoom:{}},style:_e.style,styleSpec:_e.styleSpec,objectElementValidators:{zoom:nh,value:he}}))}else Be=Be.concat(he({key:`${Xe}[0]`,value:Le[0],valueSpec:{},style:_e.style,styleSpec:_e.styleSpec},Le));return yc(Wr(Le[1]))?Be.concat([new An(`${Xe}[1]`,Le[1],"expressions are not allowed in function stops.")]):Be.concat(Te({key:`${Xe}[1]`,value:Le[1],valueSpec:n,style:_e.style,styleSpec:_e.styleSpec}))}function he(_e,Be){const Le=Ur(_e.value),Xe=Yn(_e.value),xt=_e.value!==null?_e.value:Be;if(d){if(Le!==d)return[new An(_e.key,xt,`${Le} stop domain type must match previous stop domain type ${d}`)]}else d=Le;if(Le!=="number"&&Le!=="string"&&Le!=="boolean"&&typeof Xe!="number"&&typeof Xe!="string"&&typeof Xe!="boolean")return[new An(_e.key,xt,"stop domain value must be a number, string, or boolean")];if(Le!=="number"&&o!=="categorical"){let Dt=`number expected, ${Le} found`;return gl(n)&&o===void 0&&(Dt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new An(_e.key,xt,Dt)]}return o!=="categorical"||Le!=="number"||typeof Xe=="number"&&isFinite(Xe)&&Math.floor(Xe)===Xe?o!=="categorical"&&Le==="number"&&typeof Xe=="number"&&typeof g=="number"&&g!==void 0&&Xe<g?[new An(_e.key,xt,"stop domain values must appear in ascending order")]:(g=Xe,o==="categorical"&&Xe in E?[new An(_e.key,xt,"stop domain values must be unique")]:(E[Xe]=!0,[])):[new An(_e.key,xt,`integer expected, found ${String(Xe)}`)]}}function xc(s){const n=(s.expressionContext==="property"?jl:Ms)(Wr(s.value),s.valueSpec);if(n.result==="error")return n.value.map(d=>new An(`${s.key}${d.key}`,s.value,d.message));const o=n.value.expression||n.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!o.outputDefined())return[new An(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Va(o))return[new An(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter")return AA(o,s);if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!Qc(o,["zoom","feature-state"]))return[new An(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!Al(o))return[new An(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function AA(s,n){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(const g of n.valueSpec.expression.parameters)o.delete(g);if(o.size===0)return[];const d=[];return s instanceof ya&&o.has(s.name)?[new An(n.key,n.value,`["${s.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(s.eachChild(g=>{d.push(...AA(g,n))}),d)}function jh(s){const n=s.key,o=s.value,d=s.valueSpec,g=[];return Array.isArray(d.values)?d.values.indexOf(Yn(o))===-1&&g.push(new An(n,o,`expected one of [${d.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(d.values).indexOf(Yn(o))===-1&&g.push(new An(n,o,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(o)} found`)),g}function rh(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const n of s.slice(1))if(!rh(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}function uo(s,n="fill"){if(s==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};rh(s)||(s=Cs(s));const o=s;let d=!0;try{d=function(V){if(!Vn(V))return V;let q=Wr(V);return Fn(q),q=Js(q),q}(o)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
  3658. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
  3659. and paste the contents of this message in the report.
  3660. Thank you!
  3661. Filter Expression:
  3662. ${JSON.stringify(o,null,2)}
  3663. `)}const g=Yt[`filter_${n}`],v=Ms(d,g);let E=null;if(v.result==="error")throw new Error(v.value.map(V=>`${V.key}: ${V.message}`).join(", "));E=(V,q,se)=>v.value.evaluate(V,q,{},se);let L=null,k=null;if(d!==o){const V=Ms(o,g);if(V.result==="error")throw new Error(V.value.map(q=>`${q.key}: ${q.message}`).join(", "));L=(q,se,he,_e,Be)=>V.value.evaluate(q,se,{},he,void 0,void 0,_e,Be),k=!Al(V.value.expression)}return{filter:E,dynamicFilter:L||void 0,needGeometry:yl(d),needFeature:!!k}}function Js(s){if(!Array.isArray(s))return s;const n=function(o){if(sh.has(o[0])){for(let d=1;d<o.length;d++)if(Vn(o[d]))return!0}return o}(s);return n===!0?n:n.map(o=>Js(o))}function Fn(s){let n=!1;const o=[];if(s[0]==="case"){for(let d=1;d<s.length-1;d+=2)n=n||Vn(s[d]),o.push(s[d+1]);o.push(s[s.length-1])}else if(s[0]==="match"){n=n||Vn(s[1]);for(let d=2;d<s.length-1;d+=2)o.push(s[d+1]);o.push(s[s.length-1])}else if(s[0]==="step"){n=n||Vn(s[1]);for(let d=1;d<s.length-1;d+=2)o.push(s[d+1])}n&&(s.length=0,s.push("any",...o));for(let d=1;d<s.length;d++)Fn(s[d])}function Vn(s){if(!Array.isArray(s))return!1;if((n=s[0])==="pitch"||n==="distance-from-center")return!0;var n;for(let o=1;o<s.length;o++)if(Vn(s[o]))return!0;return!1}const sh=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function dA(s,n){return s<n?-1:s>n?1:0}function yl(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let n=1;n<s.length;n++)if(yl(s[n]))return!0;return!1}function Cs(s){if(!s)return!0;const n=s[0];return s.length<=1?n!=="any":n==="=="?Ga(s[1],s[2],"=="):n==="!="?va(Ga(s[1],s[2],"==")):n==="<"||n===">"||n==="<="||n===">="?Ga(s[1],s[2],n):n==="any"?(o=s.slice(1),["any"].concat(o.map(Cs))):n==="all"?["all"].concat(s.slice(1).map(Cs)):n==="none"?["all"].concat(s.slice(1).map(Cs).map(va)):n==="in"?Go(s[1],s.slice(2)):n==="!in"?va(Go(s[1],s.slice(2))):n==="has"?pA(s[1]):n==="!has"?va(pA(s[1])):n!=="within"||s;var o}function Ga(s,n,o){switch(s){case"$type":return[`filter-type-${o}`,n];case"$id":return[`filter-id-${o}`,n];default:return[`filter-${o}`,s,n]}}function Go(s,n){if(n.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(o=>typeof o!=typeof n[0])?["filter-in-large",s,["literal",n.sort(dA)]]:["filter-in-small",s,["literal",n]]}}function pA(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function va(s){return["!",s]}function hs(s){return rh(Wr(s.value))?xc(sr({},s,{expressionContext:"filter",valueSpec:s.styleSpec[`filter_${s.layerType||"fill"}`]})):Is(s)}function Is(s){const n=s.value,o=s.key;if(Ur(n)!=="array")return[new An(o,n,`array expected, ${Ur(n)} found`)];const d=s.styleSpec;let g,v=[];if(n.length<1)return[new An(o,n,"filter array must have at least 1 element")];switch(v=v.concat(jh({key:`${o}[0]`,value:n[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),Yn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&Yn(n[1])==="$type"&&v.push(new An(o,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&v.push(new An(o,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(g=Ur(n[1]),g!=="string"&&v.push(new An(`${o}[1]`,n[1],`string expected, ${g} found`)));for(let E=2;E<n.length;E++)g=Ur(n[E]),Yn(n[1])==="$type"?v=v.concat(jh({key:`${o}[${E}]`,value:n[E],valueSpec:d.geometry_type,style:s.style,styleSpec:s.styleSpec})):g!=="string"&&g!=="number"&&g!=="boolean"&&v.push(new An(`${o}[${E}]`,n[E],`string, number, or boolean expected, ${g} found`));break;case"any":case"all":case"none":for(let E=1;E<n.length;E++)v=v.concat(Is({key:`${o}[${E}]`,value:n[E],style:s.style,styleSpec:s.styleSpec}));break;case"has":case"!has":g=Ur(n[1]),n.length!==2?v.push(new An(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):g!=="string"&&v.push(new An(`${o}[1]`,n[1],`string expected, ${g} found`));break;case"within":g=Ur(n[1]),n.length!==2?v.push(new An(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):g!=="object"&&v.push(new An(`${o}[1]`,n[1],`object expected, ${g} found`))}return v}function Kh(s,n){const o=s.key,d=s.style,g=s.styleSpec,v=s.value,E=s.objectKey,L=g[`${n}_${s.layerType}`];if(!L)return[];const k=E.match(/^(.*)-transition$/);if(n==="paint"&&k&&L[k[1]]&&L[k[1]].transition)return Te({key:o,value:v,valueSpec:g.transition,style:d,styleSpec:g});const V=s.valueSpec||L[E];if(!V)return[new An(o,v,`unknown property "${E}"`)];let q;if(Ur(v)==="string"&&gl(V)&&!V.tokens&&(q=/^{([^}]+)}$/.exec(v)))return[new An(o,v,`"${E}" does not support interpolation syntax
  3664. Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(q[1])} }\`.`)];const se=[];return s.layerType==="symbol"&&(E==="text-field"&&d&&!d.glyphs&&se.push(new An(o,v,'use of "text-field" requires a style "glyphs" property')),E==="text-font"&&gc(Wr(v))&&Yn(v.type)==="identity"&&se.push(new An(o,v,'"text-font" does not support identity functions'))),se.concat(Te({key:s.key,value:v,valueSpec:V,style:d,styleSpec:g,expressionContext:"property",propertyType:n,propertyKey:E}))}function xl(s){return Kh(s,"paint")}function M(s){return Kh(s,"layout")}function h(s){let n=[];const o=s.value,d=s.key,g=s.style,v=s.styleSpec;o.type||o.ref||n.push(new An(d,o,'either "type" or "ref" is required'));let E=Yn(o.type);const L=Yn(o.ref);if(o.id){const k=Yn(o.id);for(let V=0;V<s.arrayIndex;V++){const q=g.layers[V];Yn(q.id)===k&&n.push(new An(d,o.id,`duplicate layer id "${o.id}", previously used at line ${q.id.__line__}`))}}if("ref"in o){let k;["type","source","source-layer","filter","layout"].forEach(V=>{V in o&&n.push(new An(d,o[V],`"${V}" is prohibited for ref layers`))}),g.layers.forEach(V=>{Yn(V.id)===L&&(k=V)}),k?k.ref?n.push(new An(d,o.ref,"ref cannot reference another ref layer")):E=Yn(k.type):typeof L=="string"&&n.push(new An(d,o.ref,`ref layer "${L}" not found`))}else if(E!=="background"&&E!=="sky")if(o.source){const k=g.sources&&g.sources[o.source],V=k&&Yn(k.type);k?V==="vector"&&E==="raster"?n.push(new An(d,o.source,`layer "${o.id}" requires a raster source`)):V==="raster"&&E!=="raster"?n.push(new An(d,o.source,`layer "${o.id}" requires a vector source`)):V!=="vector"||o["source-layer"]?V==="raster-dem"&&E!=="hillshade"?n.push(new An(d,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="line"||!o.paint||!o.paint["line-gradient"]&&!o.paint["line-trim-offset"]||V==="geojson"&&k.lineMetrics||n.push(new An(d,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new An(d,o,`layer "${o.id}" must specify a "source-layer"`)):n.push(new An(d,o.source,`source "${o.source}" not found`))}else n.push(new An(d,o,'missing required property "source"'));return n=n.concat(xs({key:d,value:o,valueSpec:v.layer,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Te({key:`${d}.type`,value:o.type,valueSpec:v.layer.type,style:s.style,styleSpec:s.styleSpec,object:o,objectKey:"type"}),filter:k=>hs(sr({layerType:E},k)),layout:k=>xs({layer:o,key:k.key,value:k.value,valueSpec:{},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{"*":V=>M(sr({layerType:E},V))}}),paint:k=>xs({layer:o,key:k.key,value:k.value,valueSpec:{},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{"*":V=>xl(sr({layerType:E},V))}})}})),n}function _(s){const n=s.value,o=s.key,d=Ur(n);return d!=="string"?[new An(o,n,`string expected, ${d} found`)]:[]}const T={promoteId:function({key:s,value:n}){if(Ur(n)==="string")return _({key:s,value:n});{const o=[];for(const d in n)o.push(..._({key:`${s}.${d}`,value:n[d]}));return o}}};function F(s){const n=s.value,o=s.key,d=s.styleSpec,g=s.style;if(!n.type)return[new An(o,n,'"type" is required')];const v=Yn(n.type);let E;switch(v){case"vector":case"raster":case"raster-dem":return E=xs({key:o,value:n,valueSpec:d[`source_${v.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:T}),E;case"geojson":if(E=xs({key:o,value:n,valueSpec:d.source_geojson,style:g,styleSpec:d,objectElementValidators:T}),n.cluster)for(const L in n.clusterProperties){const[k,V]=n.clusterProperties[L],q=typeof k=="string"?[k,["accumulated"],["get",L]]:k;E.push(...xc({key:`${o}.${L}.map`,value:V,expressionContext:"cluster-map"})),E.push(...xc({key:`${o}.${L}.reduce`,value:q,expressionContext:"cluster-reduce"}))}return E;case"video":return xs({key:o,value:n,valueSpec:d.source_video,style:g,styleSpec:d});case"image":return xs({key:o,value:n,valueSpec:d.source_image,style:g,styleSpec:d});case"canvas":return[new An(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return jh({key:`${o}.type`,value:n.type,valueSpec:{values:O(d)},style:g,styleSpec:d})}}function O(s){return s.source.reduce((n,o)=>{const d=s[o];return d.type.type==="enum"&&(n=n.concat(Object.keys(d.type.values))),n},[])}function K(s){const n=s.value,o=s.styleSpec,d=o.light,g=s.style;let v=[];const E=Ur(n);if(n===void 0)return v;if(E!=="object")return v=v.concat([new An("light",n,`object expected, ${E} found`)]),v;for(const L in n){const k=L.match(/^(.*)-transition$/);v=v.concat(k&&d[k[1]]&&d[k[1]].transition?Te({key:L,value:n[L],valueSpec:o.transition,style:g,styleSpec:o}):d[L]?Te({key:L,value:n[L],valueSpec:d[L],style:g,styleSpec:o}):[new An(L,n[L],`unknown property "${L}"`)])}return v}function oe(s){const n=s.value,o=s.key,d=s.style,g=s.styleSpec,v=g.terrain;let E=[];const L=Ur(n);if(n===void 0)return E;if(L!=="object")return E=E.concat([new An("terrain",n,`object expected, ${L} found`)]),E;for(const k in n){const V=k.match(/^(.*)-transition$/);E=E.concat(V&&v[V[1]]&&v[V[1]].transition?Te({key:k,value:n[k],valueSpec:g.transition,style:d,styleSpec:g}):v[k]?Te({key:k,value:n[k],valueSpec:v[k],style:d,styleSpec:g}):[new An(k,n[k],`unknown property "${k}"`)])}if(n.source){const k=d.sources&&d.sources[n.source],V=k&&Yn(k.type);k?V!=="raster-dem"&&E.push(new An(o,n.source,`terrain cannot be used with a source of type ${String(V)}, it only be used with a "raster-dem" source type`)):E.push(new An(o,n.source,`source "${n.source}" not found`))}else E.push(new An(o,n,'terrain is missing required property "source"'));return E}function ue(s){const n=s.value,o=s.style,d=s.styleSpec,g=d.fog;let v=[];const E=Ur(n);if(n===void 0)return v;if(E!=="object")return v=v.concat([new An("fog",n,`object expected, ${E} found`)]),v;for(const L in n){const k=L.match(/^(.*)-transition$/);v=v.concat(k&&g[k[1]]&&g[k[1]].transition?Te({key:L,value:n[L],valueSpec:d.transition,style:o,styleSpec:d}):g[L]?Te({key:L,value:n[L],valueSpec:g[L],style:o,styleSpec:d}):[new An(L,n[L],`unknown property "${L}"`)])}return v}const ve={"*":()=>[],array:Zr,boolean:function(s){const n=s.value,o=s.key,d=Ur(n);return d!=="boolean"?[new An(o,n,`boolean expected, ${d} found`)]:[]},number:nh,color:function(s){const n=s.key,o=s.value,d=Ur(o);return d!=="string"?[new An(n,o,`color expected, ${d} found`)]:kl(o)===null?[new An(n,o,`color expected, "${o}" found`)]:[]},enum:jh,filter:hs,function:Wh,layer:h,object:xs,source:F,light:K,terrain:oe,fog:ue,string:_,formatted:function(s){return _(s).length===0?[]:xc(s)},resolvedImage:function(s){return _(s).length===0?[]:xc(s)},projection:function(s){const n=s.value,o=s.styleSpec,d=o.projection,g=s.style;let v=[];const E=Ur(n);if(E==="object")for(const L in n)v=v.concat(Te({key:L,value:n[L],valueSpec:d[L],style:g,styleSpec:o}));else E!=="string"&&(v=v.concat([new An("projection",n,`object or string expected, ${E} found`)]));return v}};function Te(s){const n=s.value,o=s.valueSpec,d=s.styleSpec;return o.expression&&gc(Yn(n))?Wh(s):o.expression&&yc(Wr(n))?xc(s):o.type&&ve[o.type]?ve[o.type](s):xs(sr({},s,{valueSpec:o.type?d[o.type]:o}))}function ze(s){const n=s.value,o=s.key,d=_(s);return d.length||(n.indexOf("{fontstack}")===-1&&d.push(new An(o,n,'"glyphs" url must include a "{fontstack}" token')),n.indexOf("{range}")===-1&&d.push(new An(o,n,'"glyphs" url must include a "{range}" token'))),d}function je(s,n=Yt){return gt(Te({key:"",value:s,valueSpec:n.$root,styleSpec:n,style:s,objectElementValidators:{glyphs:ze,"*":()=>[]}}))}const bt=s=>gt(xl(s)),mt=s=>gt(M(s));function gt(s){return s.slice().sort((n,o)=>n.line&&o.line?n.line-o.line:0)}function Vt(s,n){let o=!1;if(n&&n.length)for(const d of n)s.fire(new rr(new Error(d.message))),o=!0;return o}var Zt=ni;function ni(s,n,o){var d=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;var g=new Int32Array(this.arrayBuffer);s=g[0],this.d=(n=g[1])+2*(o=g[2]);for(var v=0;v<this.d*this.d;v++){var E=g[3+v],L=g[3+v+1];d.push(E===L?null:g.subarray(E,L))}var k=g[3+d.length+1];this.keys=g.subarray(g[3+d.length],k),this.bboxes=g.subarray(k),this.insert=this._insertReadonly}else{this.d=n+2*o;for(var V=0;V<this.d*this.d;V++)d.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=s,this.padding=o,this.scale=n/s,this.uid=0;var q=o/n*s;this.min=-q,this.max=s+q}ni.prototype.insert=function(s,n,o,d,g){this._forEachCell(n,o,d,g,this._insertCell,this.uid++),this.keys.push(s),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(d),this.bboxes.push(g)},ni.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},ni.prototype._insertCell=function(s,n,o,d,g,v){this.cells[g].push(v)},ni.prototype.query=function(s,n,o,d,g){var v=this.min,E=this.max;if(s<=v&&n<=v&&E<=o&&E<=d&&!g)return Array.prototype.slice.call(this.keys);var L=[];return this._forEachCell(s,n,o,d,this._queryCell,L,{},g),L},ni.prototype._queryCell=function(s,n,o,d,g,v,E,L){var k=this.cells[g];if(k!==null)for(var V=this.keys,q=this.bboxes,se=0;se<k.length;se++){var he=k[se];if(E[he]===void 0){var _e=4*he;(L?L(q[_e+0],q[_e+1],q[_e+2],q[_e+3]):s<=q[_e+2]&&n<=q[_e+3]&&o>=q[_e+0]&&d>=q[_e+1])?(E[he]=!0,v.push(V[he])):E[he]=!1}}},ni.prototype._forEachCell=function(s,n,o,d,g,v,E,L){for(var k=this._convertToCellCoord(s),V=this._convertToCellCoord(n),q=this._convertToCellCoord(o),se=this._convertToCellCoord(d),he=k;he<=q;he++)for(var _e=V;_e<=se;_e++){var Be=this.d*_e+he;if((!L||L(this._convertFromCellCoord(he),this._convertFromCellCoord(_e),this._convertFromCellCoord(he+1),this._convertFromCellCoord(_e+1)))&&g.call(this,s,n,o,d,Be,v,E,L))return}},ni.prototype._convertFromCellCoord=function(s){return(s-this.padding)/this.scale},ni.prototype._convertToCellCoord=function(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))},ni.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var s=this.cells,n=3+this.cells.length+1+1,o=0,d=0;d<this.cells.length;d++)o+=this.cells[d].length;var g=new Int32Array(n+o+this.keys.length+this.bboxes.length);g[0]=this.extent,g[1]=this.n,g[2]=this.padding;for(var v=n,E=0;E<s.length;E++){var L=s[E];g[3+E]=v,g.set(L,v),v+=L.length}return g[3+s.length]=v,g.set(this.keys,v),g[3+s.length+1]=v+=this.keys.length,g.set(this.bboxes,v),v+=this.bboxes.length,g.buffer};const St={};function zt(s,n,o={}){Object.defineProperty(s,"_classRegistryKey",{value:n,writeable:!1}),St[n]={klass:s,omit:o.omit||[]}}zt(Object,"Object"),Zt.serialize=function(s,n){const o=s.toArrayBuffer();return n&&n.push(o),{buffer:o}},Zt.deserialize=function(s){return new Zt(s.buffer)},Object.defineProperty(Zt,"name",{value:"Grid"}),zt(Zt,"Grid"),zt(ps,"Color"),zt(Error,"Error"),zt(hn,"AJAXError"),zt(No,"ResolvedImage"),zt(Kl,"StylePropertyFunction"),zt(ih,"StyleExpression",{omit:["_evaluator"]}),zt(Gh,"ZoomDependentExpression"),zt(fo,"ZoomConstantExpression"),zt(ya,"CompoundExpression",{omit:["_evaluate"]});for(const s in eh)St[eh[s]._classRegistryKey]||zt(eh[s],`Expression${s}`);function ai(s){return s&&typeof ArrayBuffer<"u"&&(s instanceof ArrayBuffer||s.constructor&&s.constructor.name==="ArrayBuffer")}function Ei(s){return C.ImageBitmap&&s instanceof C.ImageBitmap}function Bi(s,n){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp)return s;if(ai(s)||Ei(s))return n&&n.push(s),s;if(ArrayBuffer.isView(s)){const o=s;return n&&n.push(o.buffer),o}if(s instanceof C.ImageData)return n&&n.push(s.data.buffer),s;if(Array.isArray(s)){const o=[];for(const d of s)o.push(Bi(d,n));return o}if(typeof s=="object"){const o=s.constructor,d=o._classRegistryKey;if(!d)throw new Error(`can't serialize object of unregistered class ${d}`);const g=o.serialize?o.serialize(s,n):{};if(!o.serialize){for(const v in s)s.hasOwnProperty(v)&&(St[d].omit.indexOf(v)>=0||(g[v]=Bi(s[v],n)));s instanceof Error&&(g.message=s.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return d!=="Object"&&(g.$name=d),g}throw new Error("can't serialize object of type "+typeof s)}function Hi(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||ai(s)||Ei(s)||ArrayBuffer.isView(s)||s instanceof C.ImageData)return s;if(Array.isArray(s))return s.map(Hi);if(typeof s=="object"){const n=s.$name||"Object",{klass:o}=St[n];if(!o)throw new Error(`can't deserialize unregistered class ${n}`);if(o.deserialize)return o.deserialize(s);const d=Object.create(o.prototype);for(const g of Object.keys(s))g!=="$name"&&(d[g]=Hi(s[g]));return d}throw new Error("can't deserialize object of type "+typeof s)}const vi=s=>s>=1536&&s<=1791,xn=s=>s>=1872&&s<=1919,cn=s=>s>=2208&&s<=2303,Bn=s=>s>=11904&&s<=12031,tr=s=>s>=12032&&s<=12255,ur=s=>s>=12272&&s<=12287,Un=s=>s>=12288&&s<=12351,Lr=s=>s>=12352&&s<=12447,Rr=s=>s>=12448&&s<=12543,Cr=s=>s>=12544&&s<=12591,Er=s=>s>=12704&&s<=12735,Gr=s=>s>=12736&&s<=12783,js=s=>s>=12784&&s<=12799,wa=s=>s>=12800&&s<=13055,ua=s=>s>=13056&&s<=13311,ba=s=>s>=13312&&s<=19903,Wa=s=>s>=19968&&s<=40959,Wo=s=>s>=40960&&s<=42127,mo=s=>s>=42128&&s<=42191,Ba=s=>s>=44032&&s<=55215,$l=s=>s>=63744&&s<=64255,x=s=>s>=64336&&s<=65023,a=s=>s>=65040&&s<=65055,m=s=>s>=65072&&s<=65103,b=s=>s>=65104&&s<=65135,S=s=>s>=65136&&s<=65279,P=s=>s>=65280&&s<=65519;function H(s){for(const n of s)if(pe(n.charCodeAt(0)))return!0;return!1}function W(s){for(const n of s)if(!ee(n.charCodeAt(0)))return!1;return!0}function ee(s){return!(vi(s)||xn(s)||cn(s)||x(s)||S(s))}function pe(s){return!(s!==746&&s!==747&&(s<4352||!(Er(s)||Cr(s)||m(s)&&!(s>=65097&&s<=65103)||$l(s)||ua(s)||Bn(s)||Gr(s)||!(!Un(s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ba(s)||Wa(s)||wa(s)||(n=>n>=12592&&n<=12687)(s)||(n=>n>=43360&&n<=43391)(s)||(n=>n>=55216&&n<=55295)(s)||(n=>n>=4352&&n<=4607)(s)||Ba(s)||Lr(s)||ur(s)||(n=>n>=12688&&n<=12703)(s)||tr(s)||js(s)||Rr(s)&&s!==12540||!(!P(s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!b(s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||(n=>n>=5120&&n<=5759)(s)||(n=>n>=6320&&n<=6399)(s)||a(s)||(n=>n>=19904&&n<=19967)(s)||Wo(s)||mo(s))))}function fe(s){return!(pe(s)||function(n){return!!((o=>o>=128&&o<=255)(n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||(o=>o>=8192&&o<=8303)(n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||(o=>o>=8448&&o<=8527)(n)||(o=>o>=8528&&o<=8591)(n)||(o=>o>=8960&&o<=9215)(n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||(o=>o>=9216&&o<=9279)(n)&&n!==9251||(o=>o>=9280&&o<=9311)(n)||(o=>o>=9312&&o<=9471)(n)||(o=>o>=9632&&o<=9727)(n)||(o=>o>=9728&&o<=9983)(n)&&!(n>=9754&&n<=9759)||(o=>o>=11008&&o<=11263)(n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||Un(n)||Rr(n)||(o=>o>=57344&&o<=63743)(n)||m(n)||b(n)||P(n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(s))}function Me(s){return s>=1424&&s<=2303||x(s)||S(s)}function Ne(s,n){return!(!n&&Me(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||(o=>o>=6016&&o<=6143)(s))}function st(s){for(const n of s)if(Me(n.charCodeAt(0)))return!0;return!1}const it="deferred",lt="loading",qe="loaded";let Ye=null,dt="unavailable",ht=null;const Bt=function(s){s&&typeof s=="string"&&s.indexOf("NetworkError")>-1&&(dt="error"),Ye&&Ye(s)};function Pt(){It.fire(new tn("pluginStateChange",{pluginStatus:dt,pluginURL:ht}))}const It=new yn,Ht=function(){return dt},hi=function(){if(dt!==it||!ht)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");dt=lt,Pt(),ht&&Cn({url:ht},s=>{s?Bt(s):(dt=qe,Pt())})},si={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>dt===qe||si.applyArabicShaping!=null,isLoading:()=>dt===lt,setState(s){dt=s.pluginStatus,ht=s.pluginURL},isParsed:()=>si.applyArabicShaping!=null&&si.processBidirectionalText!=null&&si.processStyledBidirectionalText!=null,getPluginURL:()=>ht};class qt{constructor(n,o){this.zoom=n,o?(this.now=o.now,this.fadeDuration=o.fadeDuration,this.transition=o.transition,this.pitch=o.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(n){return function(o,d){for(const g of o)if(!Ne(g.charCodeAt(0),d))return!1;return!0}(n,si.isLoaded())}}class ji{constructor(n,o){this.property=n,this.value=o,this.expression=function(d,g){if(gc(d))return new Kl(d,g);if(yc(d)){const v=jl(d,g);if(v.result==="error")throw new Error(v.value.map(E=>`${E.key}: ${E.message}`).join(", "));return v.value}{let v=d;return typeof d=="string"&&g.type==="color"&&(v=ps.parse(d)),{kind:"constant",evaluate:()=>v}}}(o===void 0?n.specification.default:o,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,o,d){return this.property.possiblyEvaluate(this,n,o,d)}}class Kt{constructor(n){this.property=n,this.value=new ji(n,void 0)}transitioned(n,o){return new di(this.property,this.value,o,Ve({},n.transition,this.transition),n.now)}untransitioned(){return new di(this.property,this.value,null,{},0)}}class Ci{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return Gt(this._values[n].value.value)}setValue(n,o){this._values.hasOwnProperty(n)||(this._values[n]=new Kt(this._values[n].property)),this._values[n].value=new ji(this._values[n].property,o===null?void 0:Gt(o))}getTransition(n){return Gt(this._values[n].transition)}setTransition(n,o){this._values.hasOwnProperty(n)||(this._values[n]=new Kt(this._values[n].property)),this._values[n].transition=Gt(o)||void 0}serialize(){const n={};for(const o of Object.keys(this._values)){const d=this.getValue(o);d!==void 0&&(n[o]=d);const g=this.getTransition(o);g!==void 0&&(n[`${o}-transition`]=g)}return n}transitioned(n,o){const d=new Ri(this._properties);for(const g of Object.keys(this._values))d._values[g]=this._values[g].transitioned(n,o._values[g]);return d}untransitioned(){const n=new Ri(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].untransitioned();return n}}class di{constructor(n,o,d,g,v){const E=g.delay||0,L=g.duration||0;v=v||0,this.property=n,this.value=o,this.begin=v+E,this.end=this.begin+L,n.specification.transition&&(g.delay||g.duration)&&(this.prior=d)}possiblyEvaluate(n,o,d){const g=n.now||0,v=this.value.possiblyEvaluate(n,o,d),E=this.prior;if(E){if(g>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(g<this.begin)return E.possiblyEvaluate(n,o,d);{const L=(g-this.begin)/(this.end-this.begin);return this.property.interpolate(E.possiblyEvaluate(n,o,d),v,xi(L))}}return v}}class Ri{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,o,d){const g=new $i(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,o,d);return g}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class Ai{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}getValue(n){return Gt(this._values[n].value)}setValue(n,o){this._values[n]=new ji(this._values[n].property,o===null?void 0:Gt(o))}serialize(){const n={};for(const o of Object.keys(this._values)){const d=this.getValue(o);d!==void 0&&(n[o]=d)}return n}possiblyEvaluate(n,o,d){const g=new $i(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,o,d);return g}}class Mi{constructor(n,o,d){this.property=n,this.value=o,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,o,d,g){return this.property.evaluate(this.value,this.parameters,n,o,d,g)}}class $i{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class Jt{constructor(n){this.specification=n}possiblyEvaluate(n,o){return n.expression.evaluate(o)}interpolate(n,o,d){const g=xu[this.specification.type];return g?g(n,o,d):n}}class pi{constructor(n,o){this.specification=n,this.overrides=o}possiblyEvaluate(n,o,d,g){return new Mi(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(o,null,{},d,g)}:n.expression,o)}interpolate(n,o,d){if(n.value.kind!=="constant"||o.value.kind!=="constant")return n;if(n.value.value===void 0||o.value.value===void 0)return new Mi(this,{kind:"constant",value:void 0},n.parameters);const g=xu[this.specification.type];return g?new Mi(this,{kind:"constant",value:g(n.value.value,o.value.value,d)},n.parameters):n}evaluate(n,o,d,g,v,E){return n.kind==="constant"?n.value:n.evaluate(o,d,g,v,E)}}class In{constructor(n){this.specification=n}possiblyEvaluate(n,o,d,g){return!!n.expression.evaluate(o,null,{},d,g)}interpolate(){return!1}}class Hn{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const o=new qt(0,{});for(const d in n){const g=n[d];g.specification.overridable&&this.overridableProperties.push(d);const v=this.defaultPropertyValues[d]=new ji(g,void 0),E=this.defaultTransitionablePropertyValues[d]=new Kt(g);this.defaultTransitioningPropertyValues[d]=E.untransitioned(),this.defaultPossiblyEvaluatedValues[d]=v.possiblyEvaluate(o)}}}function Mn(s,n){return 256*(s=ye(Math.floor(s),0,255))+ye(Math.floor(n),0,255)}zt(pi,"DataDrivenProperty"),zt(Jt,"DataConstantProperty"),zt(In,"ColorRampProperty");const $n={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class lr{constructor(n,o){this._structArray=n,this._pos1=o*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class On{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,o){return n._trim(),o&&(n.isTransferred=!0,o.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const o=Object.create(this.prototype);return o.arrayBuffer=n.arrayBuffer,o.length=n.length,o.capacity=n.arrayBuffer.byteLength/o.bytesPerElement,o._refreshViews(),o}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const o=this.uint8;this._refreshViews(),o&&this.uint8.set(o)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function _n(s,n=1){let o=0,d=0;return{members:s.map(g=>{const v=$n[g.type].BYTES_PER_ELEMENT,E=o=Dr(o,Math.max(n,v)),L=g.components||1;return d=Math.max(d,v),o+=v*L,{name:g.name,type:g.type,components:L,offset:E}}),size:Dr(o,Math.max(d,n)),alignment:n}}function Dr(s,n){return Math.ceil(s/n)*n}class Or extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o){const d=this.length;return this.resize(d+1),this.emplace(d,n,o)}emplace(n,o,d){const g=2*n;return this.int16[g+0]=o,this.int16[g+1]=d,n}}Or.prototype.bytesPerElement=4,zt(Or,"StructArrayLayout2i4");class Nr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d){const g=this.length;return this.resize(g+1),this.emplace(g,n,o,d)}emplace(n,o,d,g){const v=3*n;return this.int16[v+0]=o,this.int16[v+1]=d,this.int16[v+2]=g,n}}Nr.prototype.bytesPerElement=6,zt(Nr,"StructArrayLayout3i6");class Qr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=4*n;return this.int16[E+0]=o,this.int16[E+1]=d,this.int16[E+2]=g,this.int16[E+3]=v,n}}Qr.prototype.bytesPerElement=8,zt(Qr,"StructArrayLayout4i8");class go extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L){const k=this.length;return this.resize(k+1),this.emplace(k,n,o,d,g,v,E,L)}emplace(n,o,d,g,v,E,L,k){const V=6*n,q=12*n,se=3*n;return this.int16[V+0]=o,this.int16[V+1]=d,this.uint8[q+4]=g,this.uint8[q+5]=v,this.uint8[q+6]=E,this.uint8[q+7]=L,this.float32[se+2]=k,n}}go.prototype.bytesPerElement=12,zt(go,"StructArrayLayout2i4ub1f12");class Ca extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=4*n;return this.float32[E+0]=o,this.float32[E+1]=d,this.float32[E+2]=g,this.float32[E+3]=v,n}}Ca.prototype.bytesPerElement=16,zt(Ca,"StructArrayLayout4f16");class jo extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v){const E=this.length;return this.resize(E+1),this.emplace(E,n,o,d,g,v)}emplace(n,o,d,g,v,E){const L=6*n,k=3*n;return this.uint16[L+0]=o,this.uint16[L+1]=d,this.uint16[L+2]=g,this.uint16[L+3]=v,this.float32[k+2]=E,n}}jo.prototype.bytesPerElement=12,zt(jo,"StructArrayLayout4ui1f12");class vs extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=4*n;return this.uint16[E+0]=o,this.uint16[E+1]=d,this.uint16[E+2]=g,this.uint16[E+3]=v,n}}vs.prototype.bytesPerElement=8,zt(vs,"StructArrayLayout4ui8");class _r extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E){const L=this.length;return this.resize(L+1),this.emplace(L,n,o,d,g,v,E)}emplace(n,o,d,g,v,E,L){const k=6*n;return this.int16[k+0]=o,this.int16[k+1]=d,this.int16[k+2]=g,this.int16[k+3]=v,this.int16[k+4]=E,this.int16[k+5]=L,n}}_r.prototype.bytesPerElement=12,zt(_r,"StructArrayLayout6i12");class Xr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he){const _e=this.length;return this.resize(_e+1),this.emplace(_e,n,o,d,g,v,E,L,k,V,q,se,he)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e){const Be=12*n;return this.int16[Be+0]=o,this.int16[Be+1]=d,this.int16[Be+2]=g,this.int16[Be+3]=v,this.uint16[Be+4]=E,this.uint16[Be+5]=L,this.uint16[Be+6]=k,this.uint16[Be+7]=V,this.int16[Be+8]=q,this.int16[Be+9]=se,this.int16[Be+10]=he,this.int16[Be+11]=_e,n}}Xr.prototype.bytesPerElement=24,zt(Xr,"StructArrayLayout4i4ui4i24");class Fr extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E){const L=this.length;return this.resize(L+1),this.emplace(L,n,o,d,g,v,E)}emplace(n,o,d,g,v,E,L){const k=10*n,V=5*n;return this.int16[k+0]=o,this.int16[k+1]=d,this.int16[k+2]=g,this.float32[V+2]=v,this.float32[V+3]=E,this.float32[V+4]=L,n}}Fr.prototype.bytesPerElement=20,zt(Fr,"StructArrayLayout3i3f20");class Fs extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const o=this.length;return this.resize(o+1),this.emplace(o,n)}emplace(n,o){return this.uint32[1*n+0]=o,n}}Fs.prototype.bytesPerElement=4,zt(Fs,"StructArrayLayout1ul4");class eo extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he,_e){const Be=this.length;return this.resize(Be+1),this.emplace(Be,n,o,d,g,v,E,L,k,V,q,se,he,_e)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e,Be){const Le=20*n,Xe=10*n;return this.int16[Le+0]=o,this.int16[Le+1]=d,this.int16[Le+2]=g,this.int16[Le+3]=v,this.int16[Le+4]=E,this.float32[Xe+3]=L,this.float32[Xe+4]=k,this.float32[Xe+5]=V,this.float32[Xe+6]=q,this.int16[Le+14]=se,this.uint32[Xe+8]=he,this.uint16[Le+18]=_e,this.uint16[Le+19]=Be,n}}eo.prototype.bytesPerElement=40,zt(eo,"StructArrayLayout5i4f1i1ul2ui40");class ns extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L){const k=this.length;return this.resize(k+1),this.emplace(k,n,o,d,g,v,E,L)}emplace(n,o,d,g,v,E,L,k){const V=8*n;return this.int16[V+0]=o,this.int16[V+1]=d,this.int16[V+2]=g,this.int16[V+4]=v,this.int16[V+5]=E,this.int16[V+6]=L,this.int16[V+7]=k,n}}ns.prototype.bytesPerElement=16,zt(ns,"StructArrayLayout3i2i2i16");class Io extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v){const E=this.length;return this.resize(E+1),this.emplace(E,n,o,d,g,v)}emplace(n,o,d,g,v,E){const L=4*n,k=8*n;return this.float32[L+0]=o,this.float32[L+1]=d,this.float32[L+2]=g,this.int16[k+6]=v,this.int16[k+7]=E,n}}Io.prototype.bytesPerElement=16,zt(Io,"StructArrayLayout2f1f2i16");class Bu extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=12*n,L=3*n;return this.uint8[E+0]=o,this.uint8[E+1]=d,this.float32[L+1]=g,this.float32[L+2]=v,n}}Bu.prototype.bytesPerElement=12,zt(Bu,"StructArrayLayout2ub2f12");class ja extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d){const g=this.length;return this.resize(g+1),this.emplace(g,n,o,d)}emplace(n,o,d,g){const v=3*n;return this.float32[v+0]=o,this.float32[v+1]=d,this.float32[v+2]=g,n}}ja.prototype.bytesPerElement=12,zt(ja,"StructArrayLayout3f12");class _o extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d){const g=this.length;return this.resize(g+1),this.emplace(g,n,o,d)}emplace(n,o,d,g){const v=3*n;return this.uint16[v+0]=o,this.uint16[v+1]=d,this.uint16[v+2]=g,n}}_o.prototype.bytesPerElement=6,zt(_o,"StructArrayLayout3ui6");class Ea extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe,xt,Dt,_t,Tt,kt){const Ut=this.length;return this.resize(Ut+1),this.emplace(Ut,n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe,xt,Dt,_t,Tt,kt)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe,xt,Dt,_t,Tt,kt,Ut){const ci=30*n,oi=15*n,Ti=60*n;return this.int16[ci+0]=o,this.int16[ci+1]=d,this.int16[ci+2]=g,this.float32[oi+2]=v,this.float32[oi+3]=E,this.uint16[ci+8]=L,this.uint16[ci+9]=k,this.uint32[oi+5]=V,this.uint32[oi+6]=q,this.uint32[oi+7]=se,this.uint16[ci+16]=he,this.uint16[ci+17]=_e,this.uint16[ci+18]=Be,this.float32[oi+10]=Le,this.float32[oi+11]=Xe,this.uint8[Ti+48]=xt,this.uint8[Ti+49]=Dt,this.uint8[Ti+50]=_t,this.uint32[oi+13]=Tt,this.int16[ci+28]=kt,this.uint8[Ti+58]=Ut,n}}Ea.prototype.bytesPerElement=60,zt(Ea,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class vl extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe,xt,Dt,_t,Tt,kt,Ut,ci,oi,Ti,Ki,gi,Si,Li,Vi){const Zi=this.length;return this.resize(Zi+1),this.emplace(Zi,n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe,xt,Dt,_t,Tt,kt,Ut,ci,oi,Ti,Ki,gi,Si,Li,Vi)}emplace(n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe,xt,Dt,_t,Tt,kt,Ut,ci,oi,Ti,Ki,gi,Si,Li,Vi,Zi){const yi=38*n,sn=19*n;return this.int16[yi+0]=o,this.int16[yi+1]=d,this.int16[yi+2]=g,this.float32[sn+2]=v,this.float32[sn+3]=E,this.int16[yi+8]=L,this.int16[yi+9]=k,this.int16[yi+10]=V,this.int16[yi+11]=q,this.int16[yi+12]=se,this.int16[yi+13]=he,this.uint16[yi+14]=_e,this.uint16[yi+15]=Be,this.uint16[yi+16]=Le,this.uint16[yi+17]=Xe,this.uint16[yi+18]=xt,this.uint16[yi+19]=Dt,this.uint16[yi+20]=_t,this.uint16[yi+21]=Tt,this.uint16[yi+22]=kt,this.uint16[yi+23]=Ut,this.uint16[yi+24]=ci,this.uint16[yi+25]=oi,this.uint16[yi+26]=Ti,this.uint16[yi+27]=Ki,this.uint16[yi+28]=gi,this.uint32[sn+15]=Si,this.float32[sn+16]=Li,this.float32[sn+17]=Vi,this.float32[sn+18]=Zi,n}}vl.prototype.bytesPerElement=76,zt(vl,"StructArrayLayout3i2f6i15ui1ul3f76");class Zl extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const o=this.length;return this.resize(o+1),this.emplace(o,n)}emplace(n,o){return this.float32[1*n+0]=o,n}}Zl.prototype.bytesPerElement=4,zt(Zl,"StructArrayLayout1f4");class $h extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o,d,g,v){const E=this.length;return this.resize(E+1),this.emplace(E,n,o,d,g,v)}emplace(n,o,d,g,v,E){const L=5*n;return this.float32[L+0]=o,this.float32[L+1]=d,this.float32[L+2]=g,this.float32[L+3]=v,this.float32[L+4]=E,n}}$h.prototype.bytesPerElement=20,zt($h,"StructArrayLayout5f20");class Zh extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o,d,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,o,d,g)}emplace(n,o,d,g,v){const E=6*n;return this.uint32[3*n+0]=o,this.uint16[E+2]=d,this.uint16[E+3]=g,this.uint16[E+4]=v,n}}Zh.prototype.bytesPerElement=12,zt(Zh,"StructArrayLayout1ul3ui12");class Ka extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,o){const d=this.length;return this.resize(d+1),this.emplace(d,n,o)}emplace(n,o,d){const g=2*n;return this.uint16[g+0]=o,this.uint16[g+1]=d,n}}Ka.prototype.bytesPerElement=4,zt(Ka,"StructArrayLayout2ui4");class Xh extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const o=this.length;return this.resize(o+1),this.emplace(o,n)}emplace(n,o){return this.uint16[1*n+0]=o,n}}Xh.prototype.bytesPerElement=2,zt(Xh,"StructArrayLayout1ui2");class Aa extends On{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,o){const d=this.length;return this.resize(d+1),this.emplace(d,n,o)}emplace(n,o,d){const g=2*n;return this.float32[g+0]=o,this.float32[g+1]=d,n}}Aa.prototype.bytesPerElement=8,zt(Aa,"StructArrayLayout2f8");class rg extends lr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}rg.prototype.size=40;class sg extends eo{get(n){return new rg(this,n)}}zt(sg,"CollisionBoxArray");class Ey extends lr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(n){this._structArray.uint8[this._pos1+49]=n}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(n){this._structArray.uint8[this._pos1+50]=n}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(n){this._structArray.uint32[this._pos4+13]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(n){this._structArray.uint8[this._pos1+58]=n}}Ey.prototype.size=60;class Ty extends Ea{get(n){return new Ey(this,n)}}zt(Ty,"PlacedSymbolArray");class up extends lr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(n){this._structArray.uint32[this._pos4+15]=n}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}up.prototype.size=76;class Ap extends vl{get(n){return new up(this,n)}}zt(Ap,"SymbolInstanceArray");class og extends Zl{getoffsetX(n){return this.float32[1*n+0]}}zt(og,"GlyphOffsetArray");class Cu extends Or{getx(n){return this.int16[2*n+0]}gety(n){return this.int16[2*n+1]}}zt(Cu,"SymbolLineVertexArray");class od extends lr{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}od.prototype.size=12;class Sy extends Zh{get(n){return new od(this,n)}}zt(Sy,"FeatureIndexArray");class My extends Ka{geta_centroid_pos0(n){return this.uint16[2*n+0]}geta_centroid_pos1(n){return this.uint16[2*n+1]}}zt(My,"FillExtrusionCentroidArray");const i1=_n([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),n1=_n([{name:"a_dash",components:4,type:"Uint16"}]);var ad={exports:{}},Iy={exports:{}};Iy.exports=function(s,n){var o,d,g,v,E,L,k,V;for(d=s.length-(o=3&s.length),g=n,E=3432918353,L=461845907,V=0;V<d;)k=255&s.charCodeAt(V)|(255&s.charCodeAt(++V))<<8|(255&s.charCodeAt(++V))<<16|(255&s.charCodeAt(++V))<<24,++V,g=27492+(65535&(v=5*(65535&(g=(g^=k=(65535&(k=(k=(65535&k)*E+(((k>>>16)*E&65535)<<16)&4294967295)<<15|k>>>17))*L+(((k>>>16)*L&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(k=0,o){case 3:k^=(255&s.charCodeAt(V+2))<<16;case 2:k^=(255&s.charCodeAt(V+1))<<8;case 1:g^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(V)))*E+(((k>>>16)*E&65535)<<16)&4294967295)<<15|k>>>17))*L+(((k>>>16)*L&65535)<<16)&4294967295}return g^=s.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var Fy={exports:{}};Fy.exports=function(s,n){for(var o,d=s.length,g=n^d,v=0;d>=4;)o=1540483477*(65535&(o=255&s.charCodeAt(v)|(255&s.charCodeAt(++v))<<8|(255&s.charCodeAt(++v))<<16|(255&s.charCodeAt(++v))<<24))+((1540483477*(o>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),d-=4,++v;switch(d){case 3:g^=(255&s.charCodeAt(v+2))<<16;case 2:g^=(255&s.charCodeAt(v+1))<<8;case 1:g=1540483477*(65535&(g^=255&s.charCodeAt(v)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var Bf=Iy.exports,r1=Fy.exports;ad.exports=Bf,ad.exports.murmur3=Bf,ad.exports.murmur2=r1;class qh{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,o,d,g){this.ids.push(Ly(n)),this.positions.push(o,d,g)}getPositions(n){const o=Ly(n);let d=0,g=this.ids.length-1;for(;d<g;){const E=d+g>>1;this.ids[E]>=o?g=E:d=E+1}const v=[];for(;this.ids[d]===o;)v.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return v}static serialize(n,o){const d=new Float64Array(n.ids),g=new Uint32Array(n.positions);return Ls(d,g,0,d.length-1),o&&o.push(d.buffer,g.buffer),{ids:d,positions:g}}static deserialize(n){const o=new qh;return o.ids=n.ids,o.positions=n.positions,o.indexed=!0,o}}function Ly(s){const n=+s;return!isNaN(n)&&Number.MIN_SAFE_INTEGER<=n&&n<=Number.MAX_SAFE_INTEGER?n:ad.exports(String(s))}function Ls(s,n,o,d){for(;o<d;){const g=s[o+d>>1];let v=o-1,E=d+1;for(;;){do v++;while(s[v]<g);do E--;while(s[E]>g);if(v>=E)break;fA(s,v,E),fA(n,3*v,3*E),fA(n,3*v+1,3*E+1),fA(n,3*v+2,3*E+2)}E-o<d-E?(Ls(s,n,o,E),o=E+1):(Ls(s,n,E+1,d),d=E)}}function fA(s,n,o){const d=s[n];s[n]=s[o],s[o]=d}zt(qh,"FeaturePositionMap");class oh{constructor(n){this.gl=n.gl,this.initialized=!1}fetchUniformLocation(n,o){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(n,o),this.initialized=!0),!!this.location}}class mA extends oh{constructor(n){super(n),this.current=0}set(n,o,d){this.fetchUniformLocation(n,o)&&this.current!==d&&(this.current=d,this.gl.uniform1f(this.location,d))}}class dp extends oh{constructor(n){super(n),this.current=[0,0,0,0]}set(n,o,d){this.fetchUniformLocation(n,o)&&(d[0]===this.current[0]&&d[1]===this.current[1]&&d[2]===this.current[2]&&d[3]===this.current[3]||(this.current=d,this.gl.uniform4f(this.location,d[0],d[1],d[2],d[3])))}}class ld extends oh{constructor(n){super(n),this.current=ps.transparent}set(n,o,d){this.fetchUniformLocation(n,o)&&(d.r===this.current.r&&d.g===this.current.g&&d.b===this.current.b&&d.a===this.current.a||(this.current=d,this.gl.uniform4f(this.location,d.r,d.g,d.b,d.a)))}}const Dy=new Float32Array(16),Py=new Float32Array(9),pp=new Float32Array(4);function fp(s){return[Mn(255*s.r,255*s.g),Mn(255*s.b,255*s.a)]}class gA{constructor(n,o,d){this.value=n,this.uniformNames=o.map(g=>`u_${g}`),this.type=d}setUniform(n,o,d,g,v){o.set(n,v,g.constantOr(this.value))}getBinding(n,o){return this.type==="color"?new ld(n):new mA(n)}}class cd{constructor(n,o){this.uniformNames=o.map(d=>`u_${d}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(n){this.pixelRatio=n.pixelRatio||1,this.pattern=n.tl.concat(n.br)}setUniform(n,o,d,g,v){const E=v==="u_pattern"||v==="u_dash"?this.pattern:v==="u_pixel_ratio"?this.pixelRatio:null;E&&o.set(n,v,E)}getBinding(n,o){return o==="u_pattern"||o==="u_dash"?new dp(n):new mA(n)}}class ah{constructor(n,o,d,g){this.expression=n,this.type=d,this.maxValue=0,this.paintVertexAttributes=o.map(v=>({name:`a_${v}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(n,o,d,g,v,E){const L=this.paintVertexArray.length,k=this.expression.evaluate(new qt(0),o,{},v,g,E);this.paintVertexArray.resize(n),this._setPaintValue(L,n,k)}updatePaintArray(n,o,d,g,v){const E=this.expression.evaluate({zoom:0},d,g,void 0,v);this._setPaintValue(n,o,E)}_setPaintValue(n,o,d){if(this.type==="color"){const g=fp(d);for(let v=n;v<o;v++)this.paintVertexArray.emplace(v,g[0],g[1])}else{for(let g=n;g<o;g++)this.paintVertexArray.emplace(g,d);this.maxValue=Math.max(this.maxValue,Math.abs(d))}}upload(n){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=n.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ta{constructor(n,o,d,g,v,E){this.expression=n,this.uniformNames=o.map(L=>`u_${L}_t`),this.type=d,this.useIntegerZoom=g,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=o.map(L=>({name:`a_${L}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new E}populatePaintArray(n,o,d,g,v,E){const L=this.expression.evaluate(new qt(this.zoom),o,{},v,g,E),k=this.expression.evaluate(new qt(this.zoom+1),o,{},v,g,E),V=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(V,n,L,k)}updatePaintArray(n,o,d,g,v){const E=this.expression.evaluate({zoom:this.zoom},d,g,void 0,v),L=this.expression.evaluate({zoom:this.zoom+1},d,g,void 0,v);this._setPaintValue(n,o,E,L)}_setPaintValue(n,o,d,g){if(this.type==="color"){const v=fp(d),E=fp(g);for(let L=n;L<o;L++)this.paintVertexArray.emplace(L,v[0],v[1],E[0],E[1])}else{for(let v=n;v<o;v++)this.paintVertexArray.emplace(v,d,g);this.maxValue=Math.max(this.maxValue,Math.abs(d),Math.abs(g))}}upload(n){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=n.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(n,o,d,g,v){const E=this.useIntegerZoom?Math.floor(d.zoom):d.zoom,L=ye(this.expression.interpolationFactor(E,this.zoom,this.zoom+1),0,1);o.set(n,v,L)}getBinding(n,o){return new mA(n)}}class Eu{constructor(n,o,d,g,v){this.expression=n,this.layerId=v,this.paintVertexAttributes=(d==="array"?n1:i1).members;for(let E=0;E<o.length;++E);this.paintVertexArray=new g}populatePaintArray(n,o,d){const g=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValues(g,n,o.patterns&&o.patterns[this.layerId],d)}updatePaintArray(n,o,d,g,v,E){this._setPaintValues(n,o,d.patterns&&d.patterns[this.layerId],E)}_setPaintValues(n,o,d,g){if(!g||!d)return;const v=g[d];if(!v)return;const{tl:E,br:L,pixelRatio:k}=v;for(let V=n;V<o;V++)this.paintVertexArray.emplace(V,E[0],E[1],L[0],L[1],k)}upload(n){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=n.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class lh{constructor(n,o,d=()=>!0){this.binders={},this._buffers=[];const g=[];for(const v in n.paint._values){if(!d(v))continue;const E=n.paint.get(v);if(!(E instanceof Mi&&gl(E.property.specification)))continue;const L=lg(v,n.type),k=E.value,V=E.property.specification.type,q=E.property.useIntegerZoom,se=v==="line-dasharray"||v.endsWith("pattern"),he=v==="line-dasharray"&&n.layout.get("line-cap").value.kind!=="constant";if(k.kind!=="constant"||he)if(k.kind==="source"||he||se){const _e=Uy(v,V,"source");this.binders[v]=se?new Eu(k,L,V,_e,n.id):new ah(k,L,V,_e),g.push(`/a_${v}`)}else{const _e=Uy(v,V,"composite");this.binders[v]=new Ta(k,L,V,q,o,_e),g.push(`/z_${v}`)}else this.binders[v]=se?new cd(k.value,L):new gA(k.value,L,V),g.push(`/u_${v}`)}this.cacheKey=g.sort().join("")}getMaxValue(n){const o=this.binders[n];return o instanceof ah||o instanceof Ta?o.maxValue:0}populatePaintArrays(n,o,d,g,v,E){for(const L in this.binders){const k=this.binders[L];(k instanceof ah||k instanceof Ta||k instanceof Eu)&&k.populatePaintArray(n,o,d,g,v,E)}}setConstantPatternPositions(n){for(const o in this.binders){const d=this.binders[o];d instanceof cd&&d.setConstantPatternPositions(n)}}updatePaintArrays(n,o,d,g,v,E){let L=!1;for(const k in n){const V=o.getPositions(k);for(const q of V){const se=d.feature(q.index);for(const he in this.binders){const _e=this.binders[he];if((_e instanceof ah||_e instanceof Ta||_e instanceof Eu)&&_e.expression.isStateDependent===!0){const Be=g.paint.get(he);_e.expression=Be.value,_e.updatePaintArray(q.start,q.end,se,n[k],v,E),L=!0}}}}return L}defines(){const n=[];for(const o in this.binders){const d=this.binders[o];(d instanceof gA||d instanceof cd)&&n.push(...d.uniformNames.map(g=>`#define HAS_UNIFORM_${g}`))}return n}getBinderAttributes(){const n=[];for(const o in this.binders){const d=this.binders[o];if(d instanceof ah||d instanceof Ta||d instanceof Eu)for(let g=0;g<d.paintVertexAttributes.length;g++)n.push(d.paintVertexAttributes[g].name)}return n}getBinderUniforms(){const n=[];for(const o in this.binders){const d=this.binders[o];if(d instanceof gA||d instanceof cd||d instanceof Ta)for(const g of d.uniformNames)n.push(g)}return n}getPaintVertexBuffers(){return this._buffers}getUniforms(n){const o=[];for(const d in this.binders){const g=this.binders[d];if(g instanceof gA||g instanceof cd||g instanceof Ta)for(const v of g.uniformNames)o.push({name:v,property:d,binding:g.getBinding(n,v)})}return o}setUniforms(n,o,d,g,v){for(const{name:E,property:L,binding:k}of d)this.binders[L].setUniform(n,k,v,g.get(L),E)}updatePaintBuffers(){this._buffers=[];for(const n in this.binders){const o=this.binders[n];(o instanceof ah||o instanceof Ta||o instanceof Eu)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(n){for(const o in this.binders){const d=this.binders[o];(d instanceof ah||d instanceof Ta||d instanceof Eu)&&d.upload(n)}this.updatePaintBuffers()}destroy(){for(const n in this.binders){const o=this.binders[n];(o instanceof ah||o instanceof Ta||o instanceof Eu)&&o.destroy()}}}class _A{constructor(n,o,d=()=>!0){this.programConfigurations={};for(const g of n)this.programConfigurations[g.id]=new lh(g,o,d);this.needsUpload=!1,this._featureMap=new qh,this._bufferOffset=0}populatePaintArrays(n,o,d,g,v,E,L){for(const k in this.programConfigurations)this.programConfigurations[k].populatePaintArrays(n,o,g,v,E,L);o.id!==void 0&&this._featureMap.add(o.id,d,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,o,d,g,v){for(const E of d)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(n,this._featureMap,o,E,g,v)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const o in this.programConfigurations)this.programConfigurations[o].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}const ag={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function lg(s,n){return ag[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]}const cg={"line-pattern":{source:jo,composite:jo},"fill-pattern":{source:jo,composite:jo},"fill-extrusion-pattern":{source:jo,composite:jo},"line-dasharray":{source:vs,composite:vs}},s1={color:{source:Aa,composite:Ca},number:{source:Zl,composite:Aa}};function Uy(s,n,o){const d=cg[s];return d&&d[o]||s1[n][o]}zt(gA,"ConstantBinder"),zt(cd,"PatternConstantBinder"),zt(ah,"SourceExpressionBinder"),zt(Eu,"PatternCompositeBinder"),zt(Ta,"CompositeExpressionBinder"),zt(lh,"ProgramConfiguration",{omit:["_buffers"]}),zt(_A,"ProgramConfigurationSet");const Cf="-transition";class vc extends yn{constructor(n,o){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&n.type!=="sky"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),o.layout&&(this._unevaluatedLayout=new Ai(o.layout)),o.paint)){this._transitionablePaint=new Ci(o.paint);for(const d in n.paint)this.setPaintProperty(d,n.paint[d],{validate:!1});for(const d in n.layout)this.setLayoutProperty(d,n.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new $i(o.paint)}}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,o,d={}){o!=null&&this._validate(mt,`layers.${this.id}.layout.${n}`,n,o,d)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,o):this.visibility=o)}getPaintProperty(n){return At(n,Cf)?this._transitionablePaint.getTransition(n.slice(0,-Cf.length)):this._transitionablePaint.getValue(n)}setPaintProperty(n,o,d={}){if(o!=null&&this._validate(bt,`layers.${this.id}.paint.${n}`,n,o,d))return!1;if(At(n,Cf))return this._transitionablePaint.setTransition(n.slice(0,-Cf.length),o||void 0),!1;{const g=this._transitionablePaint._values[n],v=g.value.isDataDriven(),E=g.value;this._transitionablePaint.setValue(n,o),this._handleSpecialPaintPropertyUpdate(n);const L=this._transitionablePaint._values[n].value,k=L.isDataDriven(),V=At(n,"pattern")||n==="line-dasharray";return k||v||V||this._handleOverridablePaintPropertyUpdate(n,E,L)}}_handleSpecialPaintPropertyUpdate(n){}getProgramIds(){return null}getProgramConfiguration(n){return null}_handleOverridablePaintPropertyUpdate(n,o,d){return!1}isHidden(n){return!!(this.minzoom&&n<this.minzoom)||!!(this.maxzoom&&n>=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,o){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,o)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,o)}serialize(){const n={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),Nt(n,(o,d)=>!(o===void 0||d==="layout"&&!Object.keys(o).length||d==="paint"&&!Object.keys(o).length))}_validate(n,o,d,g,v={}){return(!v||v.validate!==!1)&&Vt(this,n.call(je,{key:o,layerType:this.type,objectKey:d,value:g,styleSpec:Yt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const o=this.paint.get(n);if(o instanceof Mi&&gl(o.property.specification)&&(o.value.kind==="source"||o.value.kind==="composite")&&o.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=uo(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const o1=_n([{name:"a_pos",components:2,type:"Int16"}],4),Tu=_n([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class to{constructor(n=[]){this.segments=n}prepareSegment(n,o,d,g){let v=this.segments[this.segments.length-1];return n>to.MAX_VERTEX_ARRAY_LENGTH&&Ct(`Max vertices per segment is ${to.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!v||v.vertexLength+n>to.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==g)&&(v={vertexOffset:o.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},g!==void 0&&(v.sortKey=g),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const n of this.segments)for(const o in n.vaos)n.vaos[o].destroy()}static simpleSegment(n,o,d,g){return new to([{vertexOffset:n,primitiveOffset:o,vertexLength:d,primitiveLength:g,vaos:{},sortKey:0}])}}to.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,zt(to,"SegmentVector");var Zn=8192;class wl{constructor(n,o){n&&(o?this.setSouthWest(n).setNorthEast(o):n.length===4?this.setSouthWest([n[0],n[1]]).setNorthEast([n[2],n[3]]):this.setSouthWest(n[0]).setNorthEast(n[1]))}setNorthEast(n){return this._ne=n instanceof Pr?new Pr(n.lng,n.lat):Pr.convert(n),this}setSouthWest(n){return this._sw=n instanceof Pr?new Pr(n.lng,n.lat):Pr.convert(n),this}extend(n){const o=this._sw,d=this._ne;let g,v;if(n instanceof Pr)g=n,v=n;else{if(!(n instanceof wl))return Array.isArray(n)?n.length===4||n.every(Array.isArray)?this.extend(wl.convert(n)):this.extend(Pr.convert(n)):typeof n=="object"&&n!==null&&n.hasOwnProperty("lat")&&n.hasOwnProperty("lon")?this.extend(Pr.convert(n)):this;if(g=n._sw,v=n._ne,!g||!v)return this}return o||d?(o.lng=Math.min(g.lng,o.lng),o.lat=Math.min(g.lat,o.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new Pr(g.lng,g.lat),this._ne=new Pr(v.lng,v.lat)),this}getCenter(){return new Pr((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Pr(this.getWest(),this.getNorth())}getSouthEast(){return new Pr(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(n){const{lng:o,lat:d}=Pr.convert(n);let g=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(n){return!n||n instanceof wl?n:new wl(n)}}const Ef=63710088e-1;class Pr{constructor(n,o){if(isNaN(n)||isNaN(o))throw new Error(`Invalid LngLat object: (${n}, ${o})`);if(this.lng=+n,this.lat=+o,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Pr(Re(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const o=Math.PI/180,d=this.lat*o,g=n.lat*o,v=Math.sin(d)*Math.sin(g)+Math.cos(d)*Math.cos(g)*Math.cos((n.lng-this.lng)*o);return Ef*Math.acos(Math.min(v,1))}toBounds(n=0){const o=360*n/40075017,d=o/Math.cos(Math.PI/180*this.lat);return new wl(new Pr(this.lng-d,this.lat-o),new Pr(this.lng+d,this.lat+o))}static convert(n){if(n instanceof Pr)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new Pr(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new Pr(Number("lng"in n?n.lng:n.lon),Number(n.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 Ry=2*Math.PI*Ef;function Tf(s){return Ry*Math.cos(s*Math.PI/180)}function wc(s){return(180+s)/360}function ch(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function Xl(s,n){return s/Tf(n)}function bl(s){return 360*s-180}function Fo(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}function Sf(s,n){return s*Tf(Fo(n))}const $a=85.051129;function Mf(s){return 1/Math.cos(s*Math.PI/180)}class hd{constructor(n,o,d=0){this.x=+n,this.y=+o,this.z=+d}static fromLngLat(n,o=0){const d=Pr.convert(n);return new hd(wc(d.lng),ch(d.lat),Xl(o,d.lat))}toLngLat(){return new Pr(bl(this.x),Fo(this.y))}toAltitude(){return Sf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ry*Mf(Fo(this.y))}}function hg(s,n,o,d,g,v,E,L,k){const V=(n+d)/2,q=(o+g)/2,se=new me(V,q);L(se),function(he,_e,Be,Le,Xe,xt){const Dt=Be-Xe,_t=Le-xt;return Math.abs((Le-_e)*Dt-(Be-he)*_t)/Math.hypot(Dt,_t)}(se.x,se.y,v.x,v.y,E.x,E.y)>=k?(hg(s,n,o,V,q,v,se,L,k),hg(s,V,q,d,g,se,E,L,k)):s.push(E)}function zy(s,n,o){let d=s[0],g=d.x,v=d.y;n(d);const E=[d];for(let L=1;L<s.length;L++){const k=s[L],{x:V,y:q}=k;n(k),hg(E,g,v,V,q,d,k,n,o),g=V,v=q,d=k}return E}function yA(s,n,o,d){if(d(n,o)){const g=n.add(o)._mult(.5);yA(s,n,g,d),yA(s,g,o,d)}else s.push(o)}function ky(s,n){let o=s[0];const d=[o];for(let g=1;g<s.length;g++){const v=s[g];yA(d,o,v,n),o=v}return d}const ug=Math.pow(2,14)-1,Oy=-ug-1;function a1(s,n){const o=Math.round(s.x*n),d=Math.round(s.y*n);return s.x=ye(o,Oy,ug),s.y=ye(d,Oy,ug),(o<s.x||o>s.x+1||d<s.y||d>s.y+1)&&Ct("Geometry exceeds allowed extent, reduce your vector tile buffer size"),s}function Yh(s,n,o){const d=s.loadGeometry(),g=s.extent,v=Zn/g;if(n&&o&&o.projection.isReprojectedInTileSpace){const E=1<<n.z,{scale:L,x:k,y:V,projection:q}=o,se=he=>{const _e=bl((n.x+he.x/g)/E),Be=Fo((n.y+he.y/g)/E),Le=q.project(_e,Be);he.x=(Le.x*L-k)*g,he.y=(Le.y*L-V)*g};for(let he=0;he<d.length;he++)if(s.type!==1)d[he]=zy(d[he],se,1);else{const _e=[];for(const Be of d[he])Be.x<0||Be.x>=g||Be.y<0||Be.y>=g||(se(Be),_e.push(Be));d[he]=_e}}for(const E of d)for(const L of E)a1(L,v);return d}function xA(s,n){return{type:s.type,id:s.id,properties:s.properties,geometry:n?Yh(s):[]}}function If(s,n,o,d,g){s.emplaceBack(2*n+(d+1)/2,2*o+(g+1)/2)}function mp(s,n,o){s.emplaceBack(n.x,n.y,n.z,o[0]*16384,o[1]*16384,o[2]*16384)}class gp{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.hasPattern=!1,this.projection=n.projection,this.layoutVertexArray=new Or,this.indexArray=new _o,this.segments=new to,this.programConfigurations=new _A(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(n,o,d,g){const v=this.layers[0],E=[];let L=null;v.type==="circle"&&(L=v.layout.get("circle-sort-key"));for(const{feature:V,id:q,index:se,sourceLayerIndex:he}of n){const _e=this.layers[0]._featureFilter.needGeometry,Be=xA(V,_e);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),Be,d))continue;const Le=L?L.evaluate(Be,{},d):void 0,Xe={id:q,properties:V.properties,type:V.type,sourceLayerIndex:he,index:se,geometry:_e?Be.geometry:Yh(V,d,g),patterns:{},sortKey:Le};E.push(Xe)}L&&E.sort((V,q)=>V.sortKey-q.sortKey);let k=null;g.projection.name==="globe"&&(this.globeExtVertexArray=new _r,k=g.projection);for(const V of E){const{geometry:q,index:se,sourceLayerIndex:he}=V,_e=n[se].feature;this.addFeature(V,q,se,o.availableImages,d,k),o.featureIndex.insert(_e,q,se,he,this.index)}}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,o1.members),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=n.createVertexBuffer(this.globeExtVertexArray,Tu.members))),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(n,o,d,g,v,E){for(const L of o)for(const k of L){const V=k.x,q=k.y;if(V<0||V>=Zn||q<0||q>=Zn)continue;if(E){const _e=E.projectTilePoint(V,q,v),Be=E.upVector(v,V,q),Le=this.globeExtVertexArray;mp(Le,_e,Be),mp(Le,_e,Be),mp(Le,_e,Be),mp(Le,_e,Be)}const se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),he=se.vertexLength;If(this.layoutVertexArray,V,q,-1,-1),If(this.layoutVertexArray,V,q,1,-1),If(this.layoutVertexArray,V,q,1,1),If(this.layoutVertexArray,V,q,-1,1),this.indexArray.emplaceBack(he,he+1,he+2),this.indexArray.emplaceBack(he,he+2,he+3),se.vertexLength+=4,se.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,{},g,v)}}function Ny(s,n){for(let o=0;o<s.length;o++)if(vA(n,s[o]))return!0;for(let o=0;o<n.length;o++)if(vA(s,n[o]))return!0;return!!dg(s,n)}function Qy(s,n,o){return!!vA(s,n)||!!pg(n,s,o)}function Ag(s,n){if(s.length===1)return Hy(n,s[0]);for(let o=0;o<n.length;o++){const d=n[o];for(let g=0;g<d.length;g++)if(vA(s,d[g]))return!0}for(let o=0;o<s.length;o++)if(Hy(n,s[o]))return!0;for(let o=0;o<n.length;o++)if(dg(s,n[o]))return!0;return!1}function Vy(s,n,o){if(s.length>1){if(dg(s,n))return!0;for(let d=0;d<n.length;d++)if(pg(n[d],s,o))return!0}for(let d=0;d<s.length;d++)if(pg(s[d],n,o))return!0;return!1}function dg(s,n){if(s.length===0||n.length===0)return!1;for(let o=0;o<s.length-1;o++){const d=s[o],g=s[o+1];for(let v=0;v<n.length-1;v++)if(l1(d,g,n[v],n[v+1]))return!0}return!1}function l1(s,n,o,d){return Ft(s,o,d)!==Ft(n,o,d)&&Ft(s,n,o)!==Ft(s,n,d)}function pg(s,n,o){const d=o*o;if(n.length===1)return s.distSqr(n[0])<d;for(let g=1;g<n.length;g++)if(fg(s,n[g-1],n[g])<d)return!0;return!1}function fg(s,n,o){const d=n.distSqr(o);if(d===0)return s.distSqr(n);const g=((s.x-n.x)*(o.x-n.x)+(s.y-n.y)*(o.y-n.y))/d;return s.distSqr(g<0?n:g>1?o:o.sub(n)._mult(g)._add(n))}function Hy(s,n){let o,d,g,v=!1;for(let E=0;E<s.length;E++){o=s[E];for(let L=0,k=o.length-1;L<o.length;k=L++)d=o[L],g=o[k],d.y>n.y!=g.y>n.y&&n.x<(g.x-d.x)*(n.y-d.y)/(g.y-d.y)+d.x&&(v=!v)}return v}function vA(s,n){let o=!1;for(let d=0,g=s.length-1;d<s.length;g=d++){const v=s[d],E=s[g];v.y>n.y!=E.y>n.y&&n.x<(E.x-v.x)*(n.y-v.y)/(E.y-v.y)+v.x&&(o=!o)}return o}function ud(s,n,o,d,g){for(const E of s)if(n<=E.x&&o<=E.y&&d>=E.x&&g>=E.y)return!0;const v=[new me(n,o),new me(n,g),new me(d,g),new me(d,o)];if(s.length>2){for(const E of v)if(vA(s,E))return!0}for(let E=0;E<s.length-1;E++)if(yo(s[E],s[E+1],v))return!0;return!1}function yo(s,n,o){const d=o[0],g=o[2];if(s.x<d.x&&n.x<d.x||s.x>g.x&&n.x>g.x||s.y<d.y&&n.y<d.y||s.y>g.y&&n.y>g.y)return!1;const v=Ft(s,n,o[0]);return v!==Ft(s,n,o[1])||v!==Ft(s,n,o[2])||v!==Ft(s,n,o[3])}function Su(s,n,o){const d=n.paint.get(s).value;return d.kind==="constant"?d.value:o.programConfigurations.get(n.id).getMaxValue(s)}function _p(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mg(s,n,o,d,g){if(!n[0]&&!n[1])return s;const v=me.convert(n)._mult(g);o==="viewport"&&v._rotate(-d);const E=[];for(let L=0;L<s.length;L++)E.push(s[L].sub(v));return E}function Yr(s,n,o,d){const g=me.convert(s)._mult(d);return n==="viewport"&&g._rotate(-o),g}zt(gp,"CircleBucket",{omit:["layers"]});const Mu=new Hn({"circle-sort-key":new pi(Yt.layout_circle["circle-sort-key"])});var gg={paint:new Hn({"circle-radius":new pi(Yt.paint_circle["circle-radius"]),"circle-color":new pi(Yt.paint_circle["circle-color"]),"circle-blur":new pi(Yt.paint_circle["circle-blur"]),"circle-opacity":new pi(Yt.paint_circle["circle-opacity"]),"circle-translate":new Jt(Yt.paint_circle["circle-translate"]),"circle-translate-anchor":new Jt(Yt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Jt(Yt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Jt(Yt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new pi(Yt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new pi(Yt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new pi(Yt.paint_circle["circle-stroke-opacity"])}),layout:Mu},yp=1e-6,Sa=typeof Float32Array<"u"?Float32Array:Array;function hh(){var s=new Sa(9);return Sa!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[5]=0,s[6]=0,s[7]=0),s[0]=1,s[4]=1,s[8]=1,s}function wA(s,n,o){var d=n[0],g=n[1],v=n[2],E=n[3],L=n[4],k=n[5],V=n[6],q=n[7],se=n[8],he=o[0],_e=o[1],Be=o[2],Le=o[3],Xe=o[4],xt=o[5],Dt=o[6],_t=o[7],Tt=o[8];return s[0]=he*d+_e*E+Be*V,s[1]=he*g+_e*L+Be*q,s[2]=he*v+_e*k+Be*se,s[3]=Le*d+Xe*E+xt*V,s[4]=Le*g+Xe*L+xt*q,s[5]=Le*v+Xe*k+xt*se,s[6]=Dt*d+_t*E+Tt*V,s[7]=Dt*g+_t*L+Tt*q,s[8]=Dt*v+_t*k+Tt*se,s}function ql(s){return s[0]=1,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function _g(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=n[4],L=n[5],k=n[6],V=n[7],q=n[8],se=n[9],he=n[10],_e=n[11],Be=n[12],Le=n[13],Xe=n[14],xt=n[15],Dt=o*L-d*E,_t=o*k-g*E,Tt=o*V-v*E,kt=d*k-g*L,Ut=d*V-v*L,ci=g*V-v*k,oi=q*Le-se*Be,Ti=q*Xe-he*Be,Ki=q*xt-_e*Be,gi=se*Xe-he*Le,Si=se*xt-_e*Le,Li=he*xt-_e*Xe,Vi=Dt*Li-_t*Si+Tt*gi+kt*Ki-Ut*Ti+ci*oi;return Vi?(s[0]=(L*Li-k*Si+V*gi)*(Vi=1/Vi),s[1]=(g*Si-d*Li-v*gi)*Vi,s[2]=(Le*ci-Xe*Ut+xt*kt)*Vi,s[3]=(he*Ut-se*ci-_e*kt)*Vi,s[4]=(k*Ki-E*Li-V*Ti)*Vi,s[5]=(o*Li-g*Ki+v*Ti)*Vi,s[6]=(Xe*Tt-Be*ci-xt*_t)*Vi,s[7]=(q*ci-he*Tt+_e*_t)*Vi,s[8]=(E*Si-L*Ki+V*oi)*Vi,s[9]=(d*Ki-o*Si-v*oi)*Vi,s[10]=(Be*Ut-Le*Tt+xt*Dt)*Vi,s[11]=(se*Tt-q*Ut-_e*Dt)*Vi,s[12]=(L*Ti-E*gi-k*oi)*Vi,s[13]=(o*gi-d*Ti+g*oi)*Vi,s[14]=(Le*_t-Be*kt-Xe*Dt)*Vi,s[15]=(q*kt-se*_t+he*Dt)*Vi,s):null}function bA(s,n,o){var d=n[0],g=n[1],v=n[2],E=n[3],L=n[4],k=n[5],V=n[6],q=n[7],se=n[8],he=n[9],_e=n[10],Be=n[11],Le=n[12],Xe=n[13],xt=n[14],Dt=n[15],_t=o[0],Tt=o[1],kt=o[2],Ut=o[3];return s[0]=_t*d+Tt*L+kt*se+Ut*Le,s[1]=_t*g+Tt*k+kt*he+Ut*Xe,s[2]=_t*v+Tt*V+kt*_e+Ut*xt,s[3]=_t*E+Tt*q+kt*Be+Ut*Dt,s[4]=(_t=o[4])*d+(Tt=o[5])*L+(kt=o[6])*se+(Ut=o[7])*Le,s[5]=_t*g+Tt*k+kt*he+Ut*Xe,s[6]=_t*v+Tt*V+kt*_e+Ut*xt,s[7]=_t*E+Tt*q+kt*Be+Ut*Dt,s[8]=(_t=o[8])*d+(Tt=o[9])*L+(kt=o[10])*se+(Ut=o[11])*Le,s[9]=_t*g+Tt*k+kt*he+Ut*Xe,s[10]=_t*v+Tt*V+kt*_e+Ut*xt,s[11]=_t*E+Tt*q+kt*Be+Ut*Dt,s[12]=(_t=o[12])*d+(Tt=o[13])*L+(kt=o[14])*se+(Ut=o[15])*Le,s[13]=_t*g+Tt*k+kt*he+Ut*Xe,s[14]=_t*v+Tt*V+kt*_e+Ut*xt,s[15]=_t*E+Tt*q+kt*Be+Ut*Dt,s}function xp(s,n,o){var d,g,v,E,L,k,V,q,se,he,_e,Be,Le=o[0],Xe=o[1],xt=o[2];return n===s?(s[12]=n[0]*Le+n[4]*Xe+n[8]*xt+n[12],s[13]=n[1]*Le+n[5]*Xe+n[9]*xt+n[13],s[14]=n[2]*Le+n[6]*Xe+n[10]*xt+n[14],s[15]=n[3]*Le+n[7]*Xe+n[11]*xt+n[15]):(g=n[1],v=n[2],E=n[3],L=n[4],k=n[5],V=n[6],q=n[7],se=n[8],he=n[9],_e=n[10],Be=n[11],s[0]=d=n[0],s[1]=g,s[2]=v,s[3]=E,s[4]=L,s[5]=k,s[6]=V,s[7]=q,s[8]=se,s[9]=he,s[10]=_e,s[11]=Be,s[12]=d*Le+L*Xe+se*xt+n[12],s[13]=g*Le+k*Xe+he*xt+n[13],s[14]=v*Le+V*Xe+_e*xt+n[14],s[15]=E*Le+q*Xe+Be*xt+n[15]),s}function BA(s,n,o){var d=o[0],g=o[1],v=o[2];return s[0]=n[0]*d,s[1]=n[1]*d,s[2]=n[2]*d,s[3]=n[3]*d,s[4]=n[4]*g,s[5]=n[5]*g,s[6]=n[6]*g,s[7]=n[7]*g,s[8]=n[8]*v,s[9]=n[9]*v,s[10]=n[10]*v,s[11]=n[11]*v,s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15],s}function yg(s,n,o){var d=Math.sin(o),g=Math.cos(o),v=n[4],E=n[5],L=n[6],k=n[7],V=n[8],q=n[9],se=n[10],he=n[11];return n!==s&&(s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[4]=v*g+V*d,s[5]=E*g+q*d,s[6]=L*g+se*d,s[7]=k*g+he*d,s[8]=V*g-v*d,s[9]=q*g-E*d,s[10]=se*g-L*d,s[11]=he*g-k*d,s}function Ff(s,n,o){var d=Math.sin(o),g=Math.cos(o),v=n[0],E=n[1],L=n[2],k=n[3],V=n[8],q=n[9],se=n[10],he=n[11];return n!==s&&(s[4]=n[4],s[5]=n[5],s[6]=n[6],s[7]=n[7],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=v*g-V*d,s[1]=E*g-q*d,s[2]=L*g-se*d,s[3]=k*g-he*d,s[8]=v*d+V*g,s[9]=E*d+q*g,s[10]=L*d+se*g,s[11]=k*d+he*g,s}function Gy(s,n){return s[0]=n[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=n[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function Wy(s,n,o){var d,g,v,E=o[0],L=o[1],k=o[2],V=Math.hypot(E,L,k);return V<yp?null:(E*=V=1/V,L*=V,k*=V,d=Math.sin(n),g=Math.cos(n),s[0]=E*E*(v=1-g)+g,s[1]=L*E*v+k*d,s[2]=k*E*v-L*d,s[3]=0,s[4]=E*L*v-k*d,s[5]=L*L*v+g,s[6]=k*L*v+E*d,s[7]=0,s[8]=E*k*v+L*d,s[9]=L*k*v-E*d,s[10]=k*k*v+g,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s)}Math.hypot||(Math.hypot=function(){for(var s=0,n=arguments.length;n--;)s+=arguments[n]*arguments[n];return Math.sqrt(s)});var c1=bA;function Ad(){var s=new Sa(3);return Sa!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s}function CA(s){var n=new Sa(3);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n}function dd(s){return Math.hypot(s[0],s[1],s[2])}function pd(s,n,o){var d=new Sa(3);return d[0]=s,d[1]=n,d[2]=o,d}function Jh(s,n,o){return s[0]=n[0]+o[0],s[1]=n[1]+o[1],s[2]=n[2]+o[2],s}function xg(s,n,o){return s[0]=n[0]-o[0],s[1]=n[1]-o[1],s[2]=n[2]-o[2],s}function vg(s,n,o){return s[0]=n[0]*o[0],s[1]=n[1]*o[1],s[2]=n[2]*o[2],s}function EA(s,n,o){return s[0]=Math.min(n[0],o[0]),s[1]=Math.min(n[1],o[1]),s[2]=Math.min(n[2],o[2]),s}function fd(s,n,o){return s[0]=Math.max(n[0],o[0]),s[1]=Math.max(n[1],o[1]),s[2]=Math.max(n[2],o[2]),s}function da(s,n,o){return s[0]=n[0]*o,s[1]=n[1]*o,s[2]=n[2]*o,s}function eu(s,n,o,d){return s[0]=n[0]+o[0]*d,s[1]=n[1]+o[1]*d,s[2]=n[2]+o[2]*d,s}function so(s,n){var o=n[0],d=n[1],g=n[2],v=o*o+d*d+g*g;return v>0&&(v=1/Math.sqrt(v)),s[0]=n[0]*v,s[1]=n[1]*v,s[2]=n[2]*v,s}function Ma(s,n){return s[0]*n[0]+s[1]*n[1]+s[2]*n[2]}function md(s,n,o){var d=n[0],g=n[1],v=n[2],E=o[0],L=o[1],k=o[2];return s[0]=g*k-v*L,s[1]=v*E-d*k,s[2]=d*L-g*E,s}function Ns(s,n,o){var d=n[0],g=n[1],v=n[2],E=o[3]*d+o[7]*g+o[11]*v+o[15];return s[0]=(o[0]*d+o[4]*g+o[8]*v+o[12])/(E=E||1),s[1]=(o[1]*d+o[5]*g+o[9]*v+o[13])/E,s[2]=(o[2]*d+o[6]*g+o[10]*v+o[14])/E,s}function wg(s,n,o){var d=o[0],g=o[1],v=o[2],E=n[0],L=n[1],k=n[2],V=g*k-v*L,q=v*E-d*k,se=d*L-g*E,he=g*se-v*q,_e=v*V-d*se,Be=d*q-g*V,Le=2*o[3];return q*=Le,se*=Le,_e*=2,Be*=2,s[0]=E+(V*=Le)+(he*=2),s[1]=L+q+_e,s[2]=k+se+Be,s}var gd,bc=xg,jy=vg,Ky=dd;function Lf(s,n,o){return s[0]=n[0]*o,s[1]=n[1]*o,s[2]=n[2]*o,s[3]=n[3]*o,s}function Df(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=o*o+d*d+g*g+v*v;return E>0&&(E=1/Math.sqrt(E)),s[0]=o*E,s[1]=d*E,s[2]=g*E,s[3]=v*E,s}function TA(s,n,o){var d=n[0],g=n[1],v=n[2],E=n[3];return s[0]=o[0]*d+o[4]*g+o[8]*v+o[12]*E,s[1]=o[1]*d+o[5]*g+o[9]*v+o[13]*E,s[2]=o[2]*d+o[6]*g+o[10]*v+o[14]*E,s[3]=o[3]*d+o[7]*g+o[11]*v+o[15]*E,s}function $y(){var s=new Sa(4);return Sa!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s[3]=1,s}function bg(s){return s[0]=0,s[1]=0,s[2]=0,s[3]=1,s}function uh(s,n,o){o*=.5;var d=n[0],g=n[1],v=n[2],E=n[3],L=Math.sin(o),k=Math.cos(o);return s[0]=d*k+E*L,s[1]=g*k+v*L,s[2]=v*k-g*L,s[3]=E*k-d*L,s}function Bg(s,n,o){o*=.5;var d=n[0],g=n[1],v=n[2],E=n[3],L=Math.sin(o),k=Math.cos(o);return s[0]=d*k-v*L,s[1]=g*k+E*L,s[2]=v*k+d*L,s[3]=E*k-g*L,s}Ad(),gd=new Sa(4),Sa!=Float32Array&&(gd[0]=0,gd[1]=0,gd[2]=0,gd[3]=0);var Iu=Df;Ad(),pd(1,0,0),pd(0,1,0),$y(),$y(),hh();class Pf{constructor(n,o){this.pos=n,this.dir=o}intersectsPlane(n,o,d){const g=Ma(o,this.dir);if(Math.abs(g)<1e-6)return!1;const v=((n[0]-this.pos[0])*o[0]+(n[1]-this.pos[1])*o[1]+(n[2]-this.pos[2])*o[2])/g;return d[0]=this.pos[0]+this.dir[0]*v,d[1]=this.pos[1]+this.dir[1]*v,d[2]=this.pos[2]+this.dir[2]*v,!0}closestPointOnSphere(n,o,d){if(function(_e,Be){var Le=_e[0],Xe=_e[1],xt=_e[2],Dt=Be[0],_t=Be[1],Tt=Be[2];return Math.abs(Le-Dt)<=yp*Math.max(1,Math.abs(Le),Math.abs(Dt))&&Math.abs(Xe-_t)<=yp*Math.max(1,Math.abs(Xe),Math.abs(_t))&&Math.abs(xt-Tt)<=yp*Math.max(1,Math.abs(xt),Math.abs(Tt))}(this.pos,n)||o===0)return d[0]=d[1]=d[2]=0,!1;const[g,v,E]=this.dir,L=this.pos[0]-n[0],k=this.pos[1]-n[1],V=this.pos[2]-n[2],q=g*g+v*v+E*E,se=2*(L*g+k*v+V*E),he=se*se-4*q*(L*L+k*k+V*V-o*o);if(he<0){const _e=Math.max(-se/2,0),Be=L+g*_e,Le=k+v*_e,Xe=V+E*_e,xt=Math.hypot(Be,Le,Xe);return d[0]=Be*o/xt,d[1]=Le*o/xt,d[2]=Xe*o/xt,!1}{const _e=(-se-Math.sqrt(he))/(2*q);if(_e<0){const Be=Math.hypot(L,k,V);return d[0]=L*o/Be,d[1]=k*o/Be,d[2]=V*o/Be,!1}return d[0]=L+g*_e,d[1]=k+v*_e,d[2]=V+E*_e,!0}}}class Uf{constructor(n,o,d,g,v){this.TL=n,this.TR=o,this.BR=d,this.BL=g,this.horizon=v}static fromInvProjectionMatrix(n,o,d){const g=[-1,1,1],v=[1,1,1],E=[1,-1,1],L=[-1,-1,1],k=Ns(g,g,n),V=Ns(v,v,n),q=Ns(E,E,n),se=Ns(L,L,n);return new Uf(k,V,q,se,o/d)}}class Rf{constructor(n,o){this.points=n,this.planes=o}static fromInvProjectionMatrix(n,o,d,g){const v=Math.pow(2,d),E=[[-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(k=>{const V=TA([],k,n),q=1/V[3]/o*v;return function(se,he,_e){return se[0]=he[0]*_e[0],se[1]=he[1]*_e[1],se[2]=he[2]*_e[2],se[3]=he[3]*_e[3],se}(V,V,[q,q,g?1/V[3]:q,q])}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(k=>{const V=so([],md([],bc([],E[k[0]],E[k[1]]),bc([],E[k[2]],E[k[1]]))),q=-Ma(V,E[k[1]]);return V.concat(q)});return new Rf(E,L)}}class Ko{static fromPoints(n){const o=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(const g of n)EA(o,o,g),fd(d,d,g);return new Ko(o,d)}static applyTransform(n,o){const d=n.getCorners();for(let g=0;g<d.length;++g)Ns(d[g],d[g],o);return Ko.fromPoints(d)}constructor(n,o){this.min=n,this.max=o,this.center=da([],Jh([],this.min,this.max),.5)}quadrant(n){const o=[n%2==0,n<2],d=CA(this.min),g=CA(this.max);for(let v=0;v<o.length;v++)d[v]=o[v]?this.min[v]:this.center[v],g[v]=o[v]?this.center[v]:this.max[v];return g[2]=this.max[2],new Ko(d,g)}distanceX(n){return Math.max(Math.min(this.max[0],n[0]),this.min[0])-n[0]}distanceY(n){return Math.max(Math.min(this.max[1],n[1]),this.min[1])-n[1]}distanceZ(n){return Math.max(Math.min(this.max[2],n[2]),this.min[2])-n[2]}getCorners(){const n=this.min,o=this.max;return[[n[0],n[1],n[2]],[o[0],n[1],n[2]],[o[0],o[1],n[2]],[n[0],o[1],n[2]],[n[0],n[1],o[2]],[o[0],n[1],o[2]],[o[0],o[1],o[2]],[n[0],o[1],o[2]]]}intersects(n){const o=this.getCorners();let d=!0;for(let g=0;g<n.planes.length;g++){const v=n.planes[g];let E=0;for(let L=0;L<o.length;L++)E+=Ma(v,o[L])+v[3]>=0;if(E===0)return 0;E!==o.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let L=0;L<n.points.length;L++){const k=n.points[L][g]-this.min[g];v=Math.min(v,k),E=Math.max(E,k)}if(E<0||v>this.max[g]-this.min[g])return 0}return 1}}function Zy(s,n,o,d,g,v,E,L,k){if(v&&s.queryGeometry.isAboveHorizon)return!1;v&&(k*=s.pixelToTileUnitsFactor);const V=s.tileID.canonical,q=o.projection.upVectorScale(V,o.center.lat,o.worldSize).metersToTile;for(const se of n)for(const he of se){const _e=he.add(L),Be=g&&o.elevation?o.elevation.exaggeration()*g.getElevationAt(_e.x,_e.y,!0):0,Le=o.projection.projectTilePoint(_e.x,_e.y,V);if(Be>0){const _t=o.projection.upVector(V,_e.x,_e.y);Le.x+=_t[0]*q*Be,Le.y+=_t[1]*q*Be,Le.z+=_t[2]*q*Be}const Xe=v?_e:h1(Le.x,Le.y,Le.z,d),xt=v?s.tilespaceRays.map(_t=>qy(_t,Be)):s.queryGeometry.screenGeometry,Dt=TA([],[Le.x,Le.y,Le.z,1],d);if(!E&&v?k*=Dt[3]/o.cameraToCenterDistance:E&&!v&&(k*=o.cameraToCenterDistance/Dt[3]),v){const _t=Fo((he.y/Zn+V.y)/(1<<V.z));k/=o.projection.pixelsPerMeter(_t,1)/Xl(1,_t)}if(Qy(xt,Xe,k))return!0}return!1}function h1(s,n,o,d){const g=TA([],[s,n,o,1],d);return new me(g[0]/g[3],g[1]/g[3])}const Cg=pd(0,0,0),Xy=pd(0,0,1);function qy(s,n){const o=Ad();return Cg[2]=n,s.intersectsPlane(Cg,Xy,o),new me(o[0],o[1])}class vp extends gp{}function Eg(s,{width:n,height:o},d,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==n*o*d)throw new RangeError("mismatched image size")}else g=new Uint8Array(n*o*d);return s.width=n,s.height=o,s.data=g,s}function wp(s,n,o){const{width:d,height:g}=n;d===s.width&&g===s.height||(_d(s,n,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,d),height:Math.min(s.height,g)},o),s.width=d,s.height=g,s.data=n.data)}function _d(s,n,o,d,g,v){if(g.width===0||g.height===0)return n;if(g.width>s.width||g.height>s.height||o.x>s.width-g.width||o.y>s.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>n.width||g.height>n.height||d.x>n.width-g.width||d.y>n.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const E=s.data,L=n.data;for(let k=0;k<g.height;k++){const V=((o.y+k)*s.width+o.x)*v,q=((d.y+k)*n.width+d.x)*v;for(let se=0;se<g.width*v;se++)L[q+se]=E[V+se]}return n}zt(vp,"HeatmapBucket",{omit:["layers"]});class Yl{constructor(n,o){Eg(this,n,1,o)}resize(n){wp(this,new Yl(n),1)}clone(){return new Yl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(n,o,d,g,v){_d(n,o,d,g,v,1)}}class Za{constructor(n,o){Eg(this,n,4,o)}resize(n){wp(this,new Za(n),4)}replace(n,o){o?this.data.set(n):this.data=n instanceof Uint8ClampedArray?new Uint8Array(n.buffer):n}clone(){return new Za({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(n,o,d,g,v){_d(n,o,d,g,v,4)}}zt(Yl,"AlphaImage"),zt(Za,"RGBAImage");var u1={paint:new Hn({"heatmap-radius":new pi(Yt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new pi(Yt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Jt(Yt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new In(Yt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Jt(Yt.paint_heatmap["heatmap-opacity"])})};function Tg(s){const n={},o=s.resolution||256,d=s.clips?s.clips.length:1,g=s.image||new Za({width:o,height:d}),v=(E,L,k)=>{n[s.evaluationKey]=k;const V=s.expression.evaluate(n);g.data[E+L+0]=Math.floor(255*V.r/V.a),g.data[E+L+1]=Math.floor(255*V.g/V.a),g.data[E+L+2]=Math.floor(255*V.b/V.a),g.data[E+L+3]=Math.floor(255*V.a)};if(s.clips)for(let E=0,L=0;E<d;++E,L+=4*o)for(let k=0,V=0;k<o;k++,V+=4){const q=k/(o-1),{start:se,end:he}=s.clips[E];v(L,V,se*(1-q)+he*q)}else for(let E=0,L=0;E<o;E++,L+=4)v(0,L,E/(o-1));return g}var A1={paint:new Hn({"hillshade-illumination-direction":new Jt(Yt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Jt(Yt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Jt(Yt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Jt(Yt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Jt(Yt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Jt(Yt.paint_hillshade["hillshade-accent-color"])})};const yd=_n([{name:"a_pos",components:2,type:"Int16"}],4),{members:Sg}=yd;var xd={exports:{}};function vd(s,n,o){o=o||2;var d,g,v,E,L,k,V,q=n&&n.length,se=q?n[0]*o:s.length,he=Yy(s,0,se,o,!0),_e=[];if(!he||he.next===he.prev)return _e;if(q&&(he=function(Le,Xe,xt,Dt){var _t,Tt,kt,Ut=[];for(_t=0,Tt=Xe.length;_t<Tt;_t++)(kt=Yy(Le,Xe[_t]*Dt,_t<Tt-1?Xe[_t+1]*Dt:Le.length,Dt,!1))===kt.next&&(kt.steiner=!0),Ut.push(Ig(kt));for(Ut.sort(zf),_t=0;_t<Ut.length;_t++)xt=Mg(Ut[_t],xt);return xt}(s,n,he,o)),s.length>80*o){d=v=s[0],g=E=s[1];for(var Be=o;Be<se;Be+=o)(L=s[Be])<d&&(d=L),(k=s[Be+1])<g&&(g=k),L>v&&(v=L),k>E&&(E=k);V=(V=Math.max(v-d,E-g))!==0?32767/V:0}return wd(he,_e,o,d,g,V,0),_e}function Yy(s,n,o,d,g){var v,E;if(g===Es(s,n,o,d)>0)for(v=n;v<o;v+=d)E=t0(v,s[v],s[v+1],E);else for(v=o-d;v>=n;v-=d)E=t0(v,s[v],s[v+1],E);return E&&Bp(E,E.next)&&(Tp(E),E=E.next),E}function Xa(s,n){if(!s)return s;n||(n=s);var o,d=s;do if(o=!1,d.steiner||!Bp(d,d.next)&&Ds(d.prev,d,d.next)!==0)d=d.next;else{if(Tp(d),(d=n=d.prev)===d.next)break;o=!0}while(o||d!==n);return n}function wd(s,n,o,d,g,v,E){if(s){!E&&v&&function(q,se,he,_e){var Be=q;do Be.z===0&&(Be.z=bp(Be.x,Be.y,se,he,_e)),Be.prevZ=Be.prev,Be.nextZ=Be.next,Be=Be.next;while(Be!==q);Be.prevZ.nextZ=null,Be.prevZ=null,function(Le){var Xe,xt,Dt,_t,Tt,kt,Ut,ci,oi=1;do{for(xt=Le,Le=null,Tt=null,kt=0;xt;){for(kt++,Dt=xt,Ut=0,Xe=0;Xe<oi&&(Ut++,Dt=Dt.nextZ);Xe++);for(ci=oi;Ut>0||ci>0&&Dt;)Ut!==0&&(ci===0||!Dt||xt.z<=Dt.z)?(_t=xt,xt=xt.nextZ,Ut--):(_t=Dt,Dt=Dt.nextZ,ci--),Tt?Tt.nextZ=_t:Le=_t,_t.prevZ=Tt,Tt=_t;xt=Dt}Tt.nextZ=null,oi*=2}while(kt>1)}(Be)}(s,d,g,v);for(var L,k,V=s;s.prev!==s.next;)if(L=s.prev,k=s.next,v?d1(s,d,g,v):Jy(s))n.push(L.i/o|0),n.push(s.i/o|0),n.push(k.i/o|0),Tp(s),s=k.next,V=k.next;else if((s=k)===V){E?E===1?wd(s=p1(Xa(s),n,o),n,o,d,g,v,2):E===2&&f1(s,n,o,d,g,v):wd(Xa(s),n,o,d,g,v,1);break}}}function Jy(s){var n=s.prev,o=s,d=s.next;if(Ds(n,o,d)>=0)return!1;for(var g=n.x,v=o.x,E=d.x,L=n.y,k=o.y,V=d.y,q=g<v?g<E?g:E:v<E?v:E,se=L<k?L<V?L:V:k<V?k:V,he=g>v?g>E?g:E:v>E?v:E,_e=L>k?L>V?L:V:k>V?k:V,Be=d.next;Be!==n;){if(Be.x>=q&&Be.x<=he&&Be.y>=se&&Be.y<=_e&&Bc(g,L,v,k,E,V,Be.x,Be.y)&&Ds(Be.prev,Be,Be.next)>=0)return!1;Be=Be.next}return!0}function d1(s,n,o,d){var g=s.prev,v=s,E=s.next;if(Ds(g,v,E)>=0)return!1;for(var L=g.x,k=v.x,V=E.x,q=g.y,se=v.y,he=E.y,_e=L<k?L<V?L:V:k<V?k:V,Be=q<se?q<he?q:he:se<he?se:he,Le=L>k?L>V?L:V:k>V?k:V,Xe=q>se?q>he?q:he:se>he?se:he,xt=bp(_e,Be,n,o,d),Dt=bp(Le,Xe,n,o,d),_t=s.prevZ,Tt=s.nextZ;_t&&_t.z>=xt&&Tt&&Tt.z<=Dt;){if(_t.x>=_e&&_t.x<=Le&&_t.y>=Be&&_t.y<=Xe&&_t!==g&&_t!==E&&Bc(L,q,k,se,V,he,_t.x,_t.y)&&Ds(_t.prev,_t,_t.next)>=0||(_t=_t.prevZ,Tt.x>=_e&&Tt.x<=Le&&Tt.y>=Be&&Tt.y<=Xe&&Tt!==g&&Tt!==E&&Bc(L,q,k,se,V,he,Tt.x,Tt.y)&&Ds(Tt.prev,Tt,Tt.next)>=0))return!1;Tt=Tt.nextZ}for(;_t&&_t.z>=xt;){if(_t.x>=_e&&_t.x<=Le&&_t.y>=Be&&_t.y<=Xe&&_t!==g&&_t!==E&&Bc(L,q,k,se,V,he,_t.x,_t.y)&&Ds(_t.prev,_t,_t.next)>=0)return!1;_t=_t.prevZ}for(;Tt&&Tt.z<=Dt;){if(Tt.x>=_e&&Tt.x<=Le&&Tt.y>=Be&&Tt.y<=Xe&&Tt!==g&&Tt!==E&&Bc(L,q,k,se,V,he,Tt.x,Tt.y)&&Ds(Tt.prev,Tt,Tt.next)>=0)return!1;Tt=Tt.nextZ}return!0}function p1(s,n,o){var d=s;do{var g=d.prev,v=d.next.next;!Bp(g,v)&&Cp(g,d,d.next,v)&&Ep(g,v)&&Ep(v,g)&&(n.push(g.i/o|0),n.push(d.i/o|0),n.push(v.i/o|0),Tp(d),Tp(d.next),d=s=v),d=d.next}while(d!==s);return Xa(d)}function f1(s,n,o,d,g,v){var E=s;do{for(var L=E.next.next;L!==E.prev;){if(E.i!==L.i&&g1(E,L)){var k=e0(E,L);return E=Xa(E,E.next),k=Xa(k,k.next),wd(E,n,o,d,g,v,0),void wd(k,n,o,d,g,v,0)}L=L.next}E=E.next}while(E!==s)}function zf(s,n){return s.x-n.x}function Mg(s,n){var o=function(g,v){var E,L=v,k=g.x,V=g.y,q=-1/0;do{if(V<=L.y&&V>=L.next.y&&L.next.y!==L.y){var se=L.x+(V-L.y)*(L.next.x-L.x)/(L.next.y-L.y);if(se<=k&&se>q&&(q=se,E=L.x<L.next.x?L:L.next,se===k))return E}L=L.next}while(L!==v);if(!E)return null;var he,_e=E,Be=E.x,Le=E.y,Xe=1/0;L=E;do k>=L.x&&L.x>=Be&&k!==L.x&&Bc(V<Le?k:q,V,Be,Le,V<Le?q:k,V,L.x,L.y)&&(he=Math.abs(V-L.y)/(k-L.x),Ep(L,g)&&(he<Xe||he===Xe&&(L.x>E.x||L.x===E.x&&m1(E,L)))&&(E=L,Xe=he)),L=L.next;while(L!==_e);return E}(s,n);if(!o)return n;var d=e0(o,s);return Xa(d,d.next),Xa(o,o.next)}function m1(s,n){return Ds(s.prev,s,n.prev)<0&&Ds(n.next,s,s.next)<0}function bp(s,n,o,d,g){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-o)*g|0)|s<<8))|s<<4))|s<<2))|s<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-d)*g|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Ig(s){var n=s,o=s;do(n.x<o.x||n.x===o.x&&n.y<o.y)&&(o=n),n=n.next;while(n!==s);return o}function Bc(s,n,o,d,g,v,E,L){return(g-E)*(n-L)>=(s-E)*(v-L)&&(s-E)*(d-L)>=(o-E)*(n-L)&&(o-E)*(v-L)>=(g-E)*(d-L)}function g1(s,n){return s.next.i!==n.i&&s.prev.i!==n.i&&!function(o,d){var g=o;do{if(g.i!==o.i&&g.next.i!==o.i&&g.i!==d.i&&g.next.i!==d.i&&Cp(g,g.next,o,d))return!0;g=g.next}while(g!==o);return!1}(s,n)&&(Ep(s,n)&&Ep(n,s)&&function(o,d){var g=o,v=!1,E=(o.x+d.x)/2,L=(o.y+d.y)/2;do g.y>L!=g.next.y>L&&g.next.y!==g.y&&E<(g.next.x-g.x)*(L-g.y)/(g.next.y-g.y)+g.x&&(v=!v),g=g.next;while(g!==o);return v}(s,n)&&(Ds(s.prev,s,n.prev)||Ds(s,n.prev,n))||Bp(s,n)&&Ds(s.prev,s,s.next)>0&&Ds(n.prev,n,n.next)>0)}function Ds(s,n,o){return(n.y-s.y)*(o.x-n.x)-(n.x-s.x)*(o.y-n.y)}function Bp(s,n){return s.x===n.x&&s.y===n.y}function Cp(s,n,o,d){var g=kf(Ds(s,n,o)),v=kf(Ds(s,n,d)),E=kf(Ds(o,d,s)),L=kf(Ds(o,d,n));return g!==v&&E!==L||!(g!==0||!bd(s,o,n))||!(v!==0||!bd(s,d,n))||!(E!==0||!bd(o,s,d))||!(L!==0||!bd(o,n,d))}function bd(s,n,o){return n.x<=Math.max(s.x,o.x)&&n.x>=Math.min(s.x,o.x)&&n.y<=Math.max(s.y,o.y)&&n.y>=Math.min(s.y,o.y)}function kf(s){return s>0?1:s<0?-1:0}function Ep(s,n){return Ds(s.prev,s,s.next)<0?Ds(s,n,s.next)>=0&&Ds(s,s.prev,n)>=0:Ds(s,n,s.prev)<0||Ds(s,s.next,n)<0}function e0(s,n){var o=new Of(s.i,s.x,s.y),d=new Of(n.i,n.x,n.y),g=s.next,v=n.prev;return s.next=n,n.prev=s,o.next=g,g.prev=o,d.next=o,o.prev=d,v.next=d,d.prev=v,d}function t0(s,n,o,d){var g=new Of(s,n,o);return d?(g.next=d.next,g.prev=d,d.next.prev=g,d.next=g):(g.prev=g,g.next=g),g}function Tp(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Of(s,n,o){this.i=s,this.x=n,this.y=o,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Es(s,n,o,d){for(var g=0,v=n,E=o-d;v<o;v+=d)g+=(s[E]-s[v])*(s[v+1]+s[E+1]),E=v;return g}function SA(s,n,o,d,g){Fg(s,n,o||0,d||s.length-1,g||i0)}function Fg(s,n,o,d,g){for(;d>o;){if(d-o>600){var v=d-o+1,E=n-o+1,L=Math.log(v),k=.5*Math.exp(2*L/3),V=.5*Math.sqrt(L*k*(v-k)/v)*(E-v/2<0?-1:1);Fg(s,n,Math.max(o,Math.floor(n-E*k/v+V)),Math.min(d,Math.floor(n+(v-E)*k/v+V)),g)}var q=s[n],se=o,he=d;for(Bd(s,o,n),g(s[d],q)>0&&Bd(s,o,d);se<he;){for(Bd(s,se,he),se++,he--;g(s[se],q)<0;)se++;for(;g(s[he],q)>0;)he--}g(s[o],q)===0?Bd(s,o,he):Bd(s,++he,d),he<=n&&(o=he+1),n<=he&&(d=he-1)}}function Bd(s,n,o){var d=s[n];s[n]=s[o],s[o]=d}function i0(s,n){return s<n?-1:s>n?1:0}function Nf(s,n){const o=s.length;if(o<=1)return[s];const d=[];let g,v;for(let E=0;E<o;E++){const L=Xt(s[E]);L!==0&&(s[E].area=Math.abs(L),v===void 0&&(v=L<0),v===L<0?(g&&d.push(g),g=[s[E]]):g.push(s[E]))}if(g&&d.push(g),n>1)for(let E=0;E<d.length;E++)d[E].length<=n||(SA(d[E],n,1,d[E].length-1,n0),d[E]=d[E].slice(0,n));return d}function n0(s,n){return n.area-s.area}function Sp(s,n,o){const d=o.patternDependencies;let g=!1;for(const v of n){const E=v.paint.get(`${s}-pattern`);E.isConstant()||(g=!0);const L=E.constantOr(null);L&&(g=!0,d[L]=!0)}return g}function Cd(s,n,o,d,g){const v=g.patternDependencies;for(const E of n){const L=E.paint.get(`${s}-pattern`).value;if(L.kind!=="constant"){let k=L.evaluate({zoom:d},o,{},g.availableImages);k=k&&k.name?k.name:k,v[k]=!0,o.patterns[E.id]=k}}return o}xd.exports=vd,xd.exports.default=vd,vd.deviation=function(s,n,o,d){var g=n&&n.length,v=Math.abs(Es(s,0,g?n[0]*o:s.length,o));if(g)for(var E=0,L=n.length;E<L;E++)v-=Math.abs(Es(s,n[E]*o,E<L-1?n[E+1]*o:s.length,o));var k=0;for(E=0;E<d.length;E+=3){var V=d[E]*o,q=d[E+1]*o,se=d[E+2]*o;k+=Math.abs((s[V]-s[se])*(s[q+1]-s[V+1])-(s[V]-s[q])*(s[se+1]-s[V+1]))}return v===0&&k===0?0:Math.abs((k-v)/v)},vd.flatten=function(s){for(var n=s[0][0].length,o={vertices:[],holes:[],dimensions:n},d=0,g=0;g<s.length;g++){for(var v=0;v<s[g].length;v++)for(var E=0;E<n;E++)o.vertices.push(s[g][v][E]);g>0&&o.holes.push(d+=s[g-1].length)}return o};class Mp{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Or,this.indexArray=new _o,this.indexArray2=new Ka,this.programConfigurations=new _A(n.layers,n.zoom),this.segments=new to,this.segments2=new to,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.projection=n.projection}populate(n,o,d,g){this.hasPattern=Sp("fill",this.layers,o);const v=this.layers[0].layout.get("fill-sort-key"),E=[];for(const{feature:L,id:k,index:V,sourceLayerIndex:q}of n){const se=this.layers[0]._featureFilter.needGeometry,he=xA(L,se);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),he,d))continue;const _e=v?v.evaluate(he,{},d,o.availableImages):void 0,Be={id:k,properties:L.properties,type:L.type,sourceLayerIndex:q,index:V,geometry:se?he.geometry:Yh(L,d,g),patterns:{},sortKey:_e};E.push(Be)}v&&E.sort((L,k)=>L.sortKey-k.sortKey);for(const L of E){const{geometry:k,index:V,sourceLayerIndex:q}=L;if(this.hasPattern){const se=Cd("fill",this.layers,L,this.zoom,o);this.patternFeatures.push(se)}else this.addFeature(L,k,V,d,{},o.availableImages);o.featureIndex.insert(n[V].feature,k,V,q,this.index)}}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}addFeatures(n,o,d,g,v){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,o,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Sg),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,o,d,g,v,E=[]){for(const L of Nf(o,500)){let k=0;for(const Be of L)k+=Be.length;const V=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray),q=V.vertexLength,se=[],he=[];for(const Be of L){if(Be.length===0)continue;Be!==L[0]&&he.push(se.length/2);const Le=this.segments2.prepareSegment(Be.length,this.layoutVertexArray,this.indexArray2),Xe=Le.vertexLength;this.layoutVertexArray.emplaceBack(Be[0].x,Be[0].y),this.indexArray2.emplaceBack(Xe+Be.length-1,Xe),se.push(Be[0].x),se.push(Be[0].y);for(let xt=1;xt<Be.length;xt++)this.layoutVertexArray.emplaceBack(Be[xt].x,Be[xt].y),this.indexArray2.emplaceBack(Xe+xt-1,Xe+xt),se.push(Be[xt].x),se.push(Be[xt].y);Le.vertexLength+=Be.length,Le.primitiveLength+=Be.length}const _e=xd.exports(se,he);for(let Be=0;Be<_e.length;Be+=3)this.indexArray.emplaceBack(q+_e[Be],q+_e[Be+1],q+_e[Be+2]);V.vertexLength+=k,V.primitiveLength+=_e.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,v,E,g)}}zt(Mp,"FillBucket",{omit:["layers","patternFeatures"]});const Lg=new Hn({"fill-sort-key":new pi(Yt.layout_fill["fill-sort-key"])});var r0={paint:new Hn({"fill-antialias":new Jt(Yt.paint_fill["fill-antialias"]),"fill-opacity":new pi(Yt.paint_fill["fill-opacity"]),"fill-color":new pi(Yt.paint_fill["fill-color"]),"fill-outline-color":new pi(Yt.paint_fill["fill-outline-color"]),"fill-translate":new Jt(Yt.paint_fill["fill-translate"]),"fill-translate-anchor":new Jt(Yt.paint_fill["fill-translate-anchor"]),"fill-pattern":new pi(Yt.paint_fill["fill-pattern"])}),layout:Lg};const Bl=_n([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Ip=_n([{name:"a_centroid_pos",components:2,type:"Uint16"}]),s0=_n([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:o0}=Bl;var Fp={},a0=me,Dg=MA;function MA(s,n,o,d,g){this.properties={},this.extent=o,this.type=0,this._pbf=s,this._geometry=-1,this._keys=d,this._values=g,s.readFields(_1,this,n)}function _1(s,n,o){s==1?n.id=o.readVarint():s==2?function(d,g){for(var v=d.readVarint()+d.pos;d.pos<v;){var E=g._keys[d.readVarint()],L=g._values[d.readVarint()];g.properties[E]=L}}(o,n):s==3?n.type=o.readVarint():s==4&&(n._geometry=o.pos)}function Pg(s){for(var n,o,d=0,g=0,v=s.length,E=v-1;g<v;E=g++)d+=((o=s[E]).x-(n=s[g]).x)*(n.y+o.y);return d}MA.types=["Unknown","Point","LineString","Polygon"],MA.prototype.loadGeometry=function(){var s=this._pbf;s.pos=this._geometry;for(var n,o=s.readVarint()+s.pos,d=1,g=0,v=0,E=0,L=[];s.pos<o;){if(g<=0){var k=s.readVarint();d=7&k,g=k>>3}if(g--,d===1||d===2)v+=s.readSVarint(),E+=s.readSVarint(),d===1&&(n&&L.push(n),n=[]),n.push(new a0(v,E));else{if(d!==7)throw new Error("unknown command "+d);n&&n.push(n[0].clone())}}return n&&L.push(n),L},MA.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var n=s.readVarint()+s.pos,o=1,d=0,g=0,v=0,E=1/0,L=-1/0,k=1/0,V=-1/0;s.pos<n;){if(d<=0){var q=s.readVarint();o=7&q,d=q>>3}if(d--,o===1||o===2)(g+=s.readSVarint())<E&&(E=g),g>L&&(L=g),(v+=s.readSVarint())<k&&(k=v),v>V&&(V=v);else if(o!==7)throw new Error("unknown command "+o)}return[E,k,L,V]},MA.prototype.toGeoJSON=function(s,n,o){var d,g,v=this.extent*Math.pow(2,o),E=this.extent*s,L=this.extent*n,k=this.loadGeometry(),V=MA.types[this.type];function q(_e){for(var Be=0;Be<_e.length;Be++){var Le=_e[Be];_e[Be]=[360*(Le.x+E)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(Le.y+L)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var se=[];for(d=0;d<k.length;d++)se[d]=k[d][0];q(k=se);break;case 2:for(d=0;d<k.length;d++)q(k[d]);break;case 3:for(k=function(_e){var Be=_e.length;if(Be<=1)return[_e];for(var Le,Xe,xt=[],Dt=0;Dt<Be;Dt++){var _t=Pg(_e[Dt]);_t!==0&&(Xe===void 0&&(Xe=_t<0),Xe===_t<0?(Le&&xt.push(Le),Le=[_e[Dt]]):Le.push(_e[Dt]))}return Le&&xt.push(Le),xt}(k),d=0;d<k.length;d++)for(g=0;g<k[d].length;g++)q(k[d][g])}k.length===1?k=k[0]:V="Multi"+V;var he={type:"Feature",geometry:{type:V,coordinates:k},properties:this.properties};return"id"in this&&(he.id=this.id),he};var Qf=Dg,Ed=Vf;function Vf(s,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(y1,this,n),this.length=this._features.length}function y1(s,n,o){s===15?n.version=o.readVarint():s===1?n.name=o.readString():s===5?n.extent=o.readVarint():s===2?n._features.push(o.pos):s===3?n._keys.push(o.readString()):s===4&&n._values.push(function(d){for(var g=null,v=d.readVarint()+d.pos;d.pos<v;){var E=d.readVarint()>>3;g=E===1?d.readString():E===2?d.readFloat():E===3?d.readDouble():E===4?d.readVarint64():E===5?d.readVarint():E===6?d.readSVarint():E===7?d.readBoolean():null}return g}(o))}Vf.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var n=this._pbf.readVarint()+this._pbf.pos;return new Qf(this._pbf,n,this.extent,this._keys,this._values)};var A=Ed;function l(s,n,o){if(s===3){var d=new A(o,o.readVarint()+o.pos);d.length&&(n[d.name]=d)}}var f=Fp.VectorTile=function(s,n){this.layers=s.readFields(l,{},n)},w=Fp.VectorTileFeature=Dg;function I(s,n,o,d){const g=[],v=d===0?(E,L,k,V,q,se)=>{E.push(new me(se,k+(se-L)/(V-L)*(q-k)))}:(E,L,k,V,q,se)=>{E.push(new me(L+(se-k)/(q-k)*(V-L),se))};for(const E of s){const L=[];for(const k of E){if(k.length<=2)continue;const V=[];for(let he=0;he<k.length-1;he++){const _e=k[he].x,Be=k[he].y,Le=k[he+1].x,Xe=k[he+1].y,xt=d===0?_e:Be,Dt=d===0?Le:Xe;xt<n?Dt>n&&v(V,_e,Be,Le,Xe,n):xt>o?Dt<o&&v(V,_e,Be,Le,Xe,o):V.push(k[he]),Dt<n&&xt>=n&&v(V,_e,Be,Le,Xe,n),Dt>o&&xt<=o&&v(V,_e,Be,Le,Xe,o)}let q=k[k.length-1];const se=d===0?q.x:q.y;se>=n&&se<=o&&V.push(q),V.length&&(q=V[V.length-1],V[0].x===q.x&&V[0].y===q.y||V.push(V[0]),L.push(V))}L.length&&g.push(L)}return g}Fp.VectorTileLayer=Ed;const U=w.types,N=Math.pow(2,13);function Z(s,n,o,d,g,v,E,L){s.emplaceBack((n<<1)+E,(o<<1)+v,(Math.floor(d*N)<<1)+g,Math.round(L))}function re(s,n,o){s.emplaceBack(n.x,n.y,n.z,o[0]*16384,o[1]*16384,o[2]*16384)}class ge{constructor(){this.acc=new me(0,0),this.polyCount=[]}startRing(n){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new me(n.x,n.y),this.max=new me(n.x,n.y))}append(n,o){this.currentPolyCount.edges++,this.acc._add(n);const d=this.min,g=this.max;n.x<d.x?d.x=n.x:n.x>g.x&&(g.x=n.x),n.y<d.y?d.y=n.y:n.y>g.y&&(g.y=n.y),((n.x===0||n.x===Zn)&&n.x===o.x)!=((n.y===0||n.y===Zn)&&n.y===o.y)&&this.processBorderOverlap(n,o),o.x<0!=n.x<0&&this.addBorderIntersection(0,gr(o.y,n.y,(0-o.x)/(n.x-o.x))),o.x>Zn!=n.x>Zn&&this.addBorderIntersection(1,gr(o.y,n.y,(Zn-o.x)/(n.x-o.x))),o.y<0!=n.y<0&&this.addBorderIntersection(2,gr(o.x,n.x,(0-o.y)/(n.y-o.y))),o.y>Zn!=n.y>Zn&&this.addBorderIntersection(3,gr(o.x,n.x,(Zn-o.y)/(n.y-o.y)))}addBorderIntersection(n,o){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const d=this.borders[n];o<d[0]&&(d[0]=o),o>d[1]&&(d[1]=o)}processBorderOverlap(n,o){if(n.x===o.x){if(n.y===o.y)return;const d=n.x===0?0:1;this.addBorderIntersection(d,o.y),this.addBorderIntersection(d,n.y)}else{const d=n.y===0?2:3;this.addBorderIntersection(d,o.x),this.addBorderIntersection(d,n.x)}}centroid(){const n=this.polyCount.reduce((o,d)=>o+d.edges,0);return n!==0?this.acc.div(n)._round():new me(0,0)}span(){return new me(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((n,o)=>n+ +(o[0]!==Number.MAX_VALUE),0)}}class Ce{constructor(n){this.zoom=n.zoom,this.canonical=n.canonical,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=n.projection,this.layoutVertexArray=new Qr,this.centroidVertexArray=new My,this.indexArray=new _o,this.programConfigurations=new _A(n.layers,n.zoom),this.segments=new to,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.enableTerrain=n.enableTerrain}populate(n,o,d,g){this.features=[],this.hasPattern=Sp("fill-extrusion",this.layers,o),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(v){const E=Math.exp(Math.PI*(1-v.y/(1<<v.z)*2));return 80150034*E/(E*E+1)/Zn/(1<<v.z)}(d),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:v,id:E,index:L,sourceLayerIndex:k}of n){const V=this.layers[0]._featureFilter.needGeometry,q=xA(v,V);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),q,d))continue;const se={id:E,sourceLayerIndex:k,index:L,geometry:V?q.geometry:Yh(v,d,g),properties:v.properties,type:v.type,patterns:{}},he=this.layoutVertexArray.length;this.hasPattern?this.features.push(Cd("fill-extrusion",this.layers,se,this.zoom,o)):this.addFeature(se,se.geometry,L,d,{},o.availableImages,g),o.featureIndex.insert(v,se.geometry,L,k,this.index,he)}this.sortBorders()}addFeatures(n,o,d,g,v){for(const E of this.features){const{geometry:L}=E;this.addFeature(E,L,E.index,o,d,g,v)}this.sortBorders()}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,o0),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=n.createVertexBuffer(this.layoutVertexExtArray,s0.members,!0))),this.programConfigurations.upload(n),this.uploaded=!0}uploadCentroid(n){this.centroidVertexArray.length!==0&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,Ip.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,o,d,g,v,E,L){const k=[new me(0,0),new me(Zn,Zn)],V=L.projection,q=V.name==="globe",se=this.enableTerrain&&!q?new ge:null,he=U[n.type]==="Polygon";q&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new _r);const _e=Nf(o,500);for(let xt=_e.length-1;xt>=0;xt--){const Dt=_e[xt];(Dt.length===0||(Be=Dt[0]).every(_t=>_t.x<=0)||Be.every(_t=>_t.x>=Zn)||Be.every(_t=>_t.y<=0)||Be.every(_t=>_t.y>=Zn))&&_e.splice(xt,1)}var Be;let Le;if(q)Le=mi(_e,k,g);else{Le=[];for(const xt of _e)Le.push({polygon:xt,bounds:k})}const Xe=he?this.edgeRadius:0;for(const{polygon:xt,bounds:Dt}of Le){let _t=0,Tt=0;for(const Ut of xt)he&&!Ut[0].equals(Ut[Ut.length-1])&&Ut.push(Ut[0]),Tt+=he?Ut.length-1:Ut.length;const kt=this.segments.prepareSegment((he?5:4)*Tt,this.layoutVertexArray,this.indexArray);if(he){const Ut=[],ci=[];_t=kt.vertexLength;for(const Ti of xt){let Ki,gi;Ti.length&&Ti!==xt[0]&&ci.push(Ut.length/2),Ki=Ti[1].sub(Ti[0])._perp()._unit();for(let Si=1;Si<Ti.length;Si++){const Li=Ti[Si],Vi=Ti[Si===Ti.length-1?1:Si+1];let{x:Zi,y:yi}=Li;if(Xe){gi=Vi.sub(Li)._perp()._unit();const sn=Ki.add(gi)._unit(),Kn=Xe*Math.min(4,1/(Ki.x*sn.x+Ki.y*sn.y));Zi+=Kn*sn.x,yi+=Kn*sn.y,Ki=gi}Z(this.layoutVertexArray,Zi,yi,0,0,1,1,0),kt.vertexLength++,Ut.push(Li.x,Li.y),q&&re(this.layoutVertexExtArray,V.projectTilePoint(Zi,yi,g),V.upVector(g,Zi,yi))}}const oi=xd.exports(Ut,ci);for(let Ti=0;Ti<oi.length;Ti+=3)this.indexArray.emplaceBack(_t+oi[Ti],_t+oi[Ti+2],_t+oi[Ti+1]),kt.primitiveLength++}for(const Ut of xt){se&&Ut.length&&se.startRing(Ut[0]);let ci,oi,Ti,Ki=Ut.length>4&&Rt(Ut[Ut.length-2],Ut[0],Ut[1]),gi=Xe?ke(Ut[Ut.length-2],Ut[0],Ut[1],Xe):0;oi=Ut[1].sub(Ut[0])._perp()._unit();let Si=!0;for(let Li=1,Vi=0;Li<Ut.length;Li++){let Zi=Ut[Li-1],yi=Ut[Li];const sn=Ut[Li===Ut.length-1?1:Li+1];if(se&&he&&se.currentPolyCount.top++,Ze(yi,Zi,Dt)){Xe&&(oi=sn.sub(yi)._perp()._unit(),Si=!Si);continue}se&&se.append(yi,Zi);const Kn=yi.sub(Zi)._perp(),dn=Kn.x/(Math.abs(Kn.x)+Math.abs(Kn.y)),Ln=Kn.y>0?1:0,ln=Zi.dist(yi);if(Vi+ln>32768&&(Vi=0),Xe){Ti=sn.sub(yi)._perp()._unit();let xr=$e(Zi,yi,sn,Ie(oi,Ti),Xe);isNaN(xr)&&(xr=0);const Jn=yi.sub(Zi)._unit();Zi=Zi.add(Jn.mult(gi))._round(),yi=yi.add(Jn.mult(-xr))._round(),gi=xr,oi=Ti}const Xn=kt.vertexLength,Tr=Ut.length>4&&Rt(Zi,yi,sn);let wr=Mt(Vi,Ki,Si);if(Z(this.layoutVertexArray,Zi.x,Zi.y,dn,Ln,0,0,wr),Z(this.layoutVertexArray,Zi.x,Zi.y,dn,Ln,0,1,wr),Vi+=ln,wr=Mt(Vi,Tr,!Si),Ki=Tr,Z(this.layoutVertexArray,yi.x,yi.y,dn,Ln,0,0,wr),Z(this.layoutVertexArray,yi.x,yi.y,dn,Ln,0,1,wr),kt.vertexLength+=4,this.indexArray.emplaceBack(Xn+0,Xn+1,Xn+2),this.indexArray.emplaceBack(Xn+1,Xn+3,Xn+2),kt.primitiveLength+=2,Xe){const xr=_t+(Li===1?Ut.length-2:Li-2),Jn=Li===1?_t:xr+1;if(this.indexArray.emplaceBack(Xn+1,xr,Xn+3),this.indexArray.emplaceBack(xr,Jn,Xn+3),kt.primitiveLength+=2,ci===void 0&&(ci=Xn),!Ze(sn,Ut[Li],Dt)){const es=Li===Ut.length-1?ci:kt.vertexLength;this.indexArray.emplaceBack(Xn+2,Xn+3,es),this.indexArray.emplaceBack(Xn+3,es+1,es),this.indexArray.emplaceBack(Xn+3,Jn,es+1),kt.primitiveLength+=3}Si=!Si}if(q){const xr=this.layoutVertexExtArray,Jn=V.projectTilePoint(Zi.x,Zi.y,g),es=V.projectTilePoint(yi.x,yi.y,g),ir=V.upVector(g,Zi.x,Zi.y),Sr=V.upVector(g,yi.x,yi.y);re(xr,Jn,ir),re(xr,Jn,ir),re(xr,es,Sr),re(xr,es,Sr)}}he&&(_t+=Ut.length-1)}}if(se&&se.polyCount.length>0){if(se.borders){se.vertexArrayOffset=this.centroidVertexArray.length;const xt=se.borders,Dt=this.featuresOnBorder.push(se)-1;for(let _t=0;_t<4;_t++)xt[_t][0]!==Number.MAX_VALUE&&this.borders[_t].push(Dt)}this.encodeCentroid(se.borders?void 0:se.centroid(),se)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,v,E,g)}sortBorders(){for(let n=0;n<4;n++)this.borders[n].sort((o,d)=>this.featuresOnBorder[o].borders[n][0]-this.featuresOnBorder[d].borders[n][0])}encodeCentroid(n,o,d=!0){let g,v;if(n)if(n.y!==0){const L=o.span()._mult(this.tileToMeter);g=(Math.max(n.x,1)<<3)+Math.min(7,Math.round(L.x/10)),v=(Math.max(n.y,1)<<3)+Math.min(7,Math.round(L.y/10))}else g=Math.ceil(7*(n.x+450)),v=0;else g=0,v=+d;let E=d?this.centroidVertexArray.length:o.vertexArrayOffset;for(const L of o.polyCount){d&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*L.edges+L.top);for(let k=0;k<L.top;k++)this.centroidVertexArray.emplace(E++,g,v);for(let k=0;k<2*L.edges;k++)this.centroidVertexArray.emplace(E++,0,v),this.centroidVertexArray.emplace(E++,g,v)}}}function Ie(s,n){const o=s.add(n)._unit();return s.x*o.x+s.y*o.y}function ke(s,n,o,d){const g=n.sub(s)._perp()._unit(),v=o.sub(n)._perp()._unit();return $e(s,n,o,Ie(g,v),d)}function $e(s,n,o,d,g){const v=Math.sqrt(1-d*d);return Math.min(s.dist(n)/3,n.dist(o)/3,g*v/d)}function Ze(s,n,o){return s.x<o[0].x&&n.x<o[0].x||s.x>o[1].x&&n.x>o[1].x||s.y<o[0].y&&n.y<o[0].y||s.y>o[1].y&&n.y>o[1].y}function Rt(s,n,o){if(s.x<0||s.x>=Zn||n.x<0||n.x>=Zn||o.x<0||o.x>=Zn)return!1;const d=o.sub(n),g=d.perp(),v=s.sub(n);return(d.x*v.x+d.y*v.y)/Math.sqrt((d.x*d.x+d.y*d.y)*(v.x*v.x+v.y*v.y))>-.866&&g.x*v.x+g.y*v.y<0}function Mt(s,n,o){const d=n?2|s:-3&s;return o?1|d:-2&d}function ri(){const s=Math.PI/32,n=Math.tan(s),o=Ef;return o*Math.sqrt(1+2*n*n)-o}function mi(s,n,o){const d=1<<o.z,g=bl(o.x/d),v=bl((o.x+1)/d),E=Fo(o.y/d),L=Fo((o.y+1)/d);return function(k,V,q,se,he=0,_e){const Be=[];if(!k.length||!q||!se)return Be;const Le=(Ut,ci)=>{for(const oi of Ut)Be.push({polygon:oi,bounds:ci})},Xe=Math.ceil(Math.log2(q)),xt=Math.ceil(Math.log2(se)),Dt=Xe-xt,_t=[];for(let Ut=0;Ut<Math.abs(Dt);Ut++)_t.push(Dt>0?0:1);for(let Ut=0;Ut<Math.min(Xe,xt);Ut++)_t.push(0),_t.push(1);let Tt=k;if(Tt=I(Tt,V[0].y-he,V[1].y+he,1),Tt=I(Tt,V[0].x-he,V[1].x+he,0),!Tt.length)return Be;const kt=[];for(_t.length?kt.push({polygons:Tt,bounds:V,depth:0}):Le(Tt,V);kt.length;){const Ut=kt.pop(),ci=Ut.depth,oi=_t[ci],Ti=Ut.bounds[0],Ki=Ut.bounds[1],gi=oi===0?Ti.x:Ti.y,Si=oi===0?Ki.x:Ki.y,Li=_e?_e(oi,gi,Si):.5*(gi+Si),Vi=I(Ut.polygons,gi-he,Li+he,oi),Zi=I(Ut.polygons,Li-he,Si+he,oi);if(Vi.length){const yi=[Ti,new me(oi===0?Li:Ki.x,oi===1?Li:Ki.y)];_t.length>ci+1?kt.push({polygons:Vi,bounds:yi,depth:ci+1}):Le(Vi,yi)}if(Zi.length){const yi=[new me(oi===0?Li:Ti.x,oi===1?Li:Ti.y),Ki];_t.length>ci+1?kt.push({polygons:Zi,bounds:yi,depth:ci+1}):Le(Zi,yi)}}return Be}(s,n,Math.ceil((v-g)/11.25),Math.ceil((E-L)/11.25),1,(k,V,q)=>{if(k===0)return .5*(V+q);{const se=Fo((o.y+V/Zn)/d);return(ch(.5*(Fo((o.y+q/Zn)/d)+se))*d-o.y)*Zn}})}zt(Ce,"FillExtrusionBucket",{omit:["layers","features"]}),zt(ge,"PartMetadata");const ei=new Hn({"fill-extrusion-edge-radius":new Jt(Yt["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var ui={paint:new Hn({"fill-extrusion-opacity":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new pi(Yt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Jt(Yt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:ei};function Pi(s,n,o){var d=2*Math.PI*6378137/256/Math.pow(2,o);return[s*d-2*Math.PI*6378137/2,n*d-2*Math.PI*6378137/2]}class Fi{constructor(n,o,d){this.z=n,this.x=o,this.y=d,this.key=mn(0,n,n,o,d)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,o){const d=function(v,E,L){var k=Pi(256*v,256*(E=Math.pow(2,L)-E-1),L),V=Pi(256*(v+1),256*(E+1),L);return k[0]+","+k[1]+","+V[0]+","+V[1]}(this.x,this.y,this.z),g=function(v,E,L){let k,V="";for(let q=v;q>0;q--)k=1<<q-1,V+=(E&k?1:0)+(L&k?2:0);return V}(this.z,this.x,this.y);return n[(this.x+this.y)%n.length].replace("{prefix}",(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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",g).replace("{bbox-epsg-3857}",d)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sn{constructor(n,o){this.wrap=n,this.canonical=o,this.key=mn(n,o.z,o.z,o.x,o.y)}}class fn{constructor(n,o,d,g,v){this.overscaledZ=n,this.wrap=o,this.canonical=new Fi(d,+g,+v),this.key=o===0&&n===d?this.canonical.key:mn(o,n,d,g,v)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){const o=this.canonical.z-n;return n>this.canonical.z?new fn(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new fn(n,this.wrap,n,this.canonical.x>>o,this.canonical.y>>o)}calculateScaledKey(n,o=!0){if(this.overscaledZ===n&&o)return this.key;if(n>this.canonical.z)return mn(this.wrap*+o,n,this.canonical.z,this.canonical.x,this.canonical.y);{const d=this.canonical.z-n;return mn(this.wrap*+o,n,n,this.canonical.x>>d,this.canonical.y>>d)}}isChildOf(n){if(n.wrap!==this.wrap)return!1;const o=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ<this.overscaledZ&&n.canonical.x===this.canonical.x>>o&&n.canonical.y===this.canonical.y>>o}children(n){if(this.overscaledZ>=n)return[new fn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const o=this.canonical.z+1,d=2*this.canonical.x,g=2*this.canonical.y;return[new fn(o,this.wrap,o,d,g),new fn(o,this.wrap,o,d+1,g),new fn(o,this.wrap,o,d,g+1),new fn(o,this.wrap,o,d+1,g+1)]}isLessThan(n){return this.wrap<n.wrap||!(this.wrap>n.wrap)&&(this.overscaledZ<n.overscaledZ||!(this.overscaledZ>n.overscaledZ)&&(this.canonical.x<n.canonical.x||!(this.canonical.x>n.canonical.x)&&this.canonical.y<n.canonical.y))}wrapped(){return new fn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(n){return new fn(this.overscaledZ,n,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Sn(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function mn(s,n,o,d,g){const v=1<<Math.min(o,22);let E=v*(g%v)+d%v;return s&&o<22&&(E+=v*v*((s<0?-2*s-1:2*s)%(1<<2*(22-o)))),16*(32*E+o)+(n-o)}zt(Fi,"CanonicalTileID"),zt(fn,"OverscaledTileID",{omit:["projMatrix"]});class an extends me{constructor(n,o,d){super(n,o),this.z=d}}function nn(s,n){return s.x*n.x+s.y*n.y}function vn(s,n){if(s.length===1){let o=0;const d=n[o++];let g;for(;!g||d.equals(g);)if(g=n[o++],!g)return 1/0;for(;o<n.length;o++){const v=n[o],E=s[0],L=g.sub(d),k=v.sub(d),V=E.sub(d),q=nn(L,L),se=nn(L,k),he=nn(k,k),_e=nn(V,L),Be=nn(V,k),Le=q*he-se*se,Xe=(he*_e-se*Be)/Le,xt=(q*Be-se*_e)/Le,Dt=d.z*(1-Xe-xt)+g.z*Xe+v.z*xt;if(isFinite(Dt))return Dt}return 1/0}{let o=1/0;for(const d of n)o=Math.min(o,d.z);return o}}function gn(s,n,o,d,g,v,E,L){const k=E*g.getElevationAt(s,n,!0,!0),V=v[0]!==0,q=V?v[1]===0?E*(v[0]/7-450):E*function(se,he,_e){const Be=Math.floor(he[0]/8),Le=Math.floor(he[1]/8),Xe=10*(he[0]-8*Be),xt=10*(he[1]-8*Le),Dt=se.getElevationAt(Be,Le,!0,!0),_t=se.getMeterToDEM(_e),Tt=Math.floor(.5*(Xe*_t-1)),kt=Math.floor(.5*(xt*_t-1)),Ut=se.tileCoordToPixel(Be,Le),ci=2*Tt+1,oi=2*kt+1,Ti=function(Zi,yi,sn,Kn,dn){return[Zi.getElevationAtPixel(yi,sn,!0),Zi.getElevationAtPixel(yi+dn,sn,!0),Zi.getElevationAtPixel(yi,sn+dn,!0),Zi.getElevationAtPixel(yi+Kn,sn+dn,!0)]}(se,Ut.x-Tt,Ut.y-kt,ci,oi),Ki=Math.abs(Ti[0]-Ti[1]),gi=Math.abs(Ti[2]-Ti[3]),Si=Math.abs(Ti[0]-Ti[2])+Math.abs(Ti[1]-Ti[3]),Li=Math.min(.25,.5*_t*(Ki+gi)/ci),Vi=Math.min(.25,.5*_t*Si/oi);return Dt+Math.max(Li*Xe,Vi*xt)}(g,v,L):k;return{base:k+(o===0)?-1:o,top:V?Math.max(q+d,k+o+2):k+d}}const Ji=_n([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Wn}=Ji,zn=_n([{name:"a_packed",components:4,type:"Float32"}]),{members:yr}=zn,fs=w.types,ws=Math.cos(Math.PI/180*37.5);class Qs{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(o=>o.id),this.index=n.index,this.projection=n.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(o=>{this.gradients[o.id]={}}),this.layoutVertexArray=new go,this.layoutVertexArray2=new Ca,this.indexArray=new _o,this.programConfigurations=new _A(n.layers,n.zoom),this.segments=new to,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(n,o,d,g){this.hasPattern=Sp("line",this.layers,o);const v=this.layers[0].layout.get("line-sort-key"),E=[];for(const{feature:q,id:se,index:he,sourceLayerIndex:_e}of n){const Be=this.layers[0]._featureFilter.needGeometry,Le=xA(q,Be);if(!this.layers[0]._featureFilter.filter(new qt(this.zoom),Le,d))continue;const Xe=v?v.evaluate(Le,{},d):void 0,xt={id:se,properties:q.properties,type:q.type,sourceLayerIndex:_e,index:he,geometry:Be?Le.geometry:Yh(q,d,g),patterns:{},sortKey:Xe};E.push(xt)}v&&E.sort((q,se)=>q.sortKey-se.sortKey);const{lineAtlas:L,featureIndex:k}=o,V=this.addConstantDashes(L);for(const q of E){const{geometry:se,index:he,sourceLayerIndex:_e}=q;if(V&&this.addFeatureDashes(q,L),this.hasPattern){const Be=Cd("line",this.layers,q,this.zoom,o);this.patternFeatures.push(Be)}else this.addFeature(q,se,he,d,L.positions,o.availableImages);k.insert(n[he].feature,se,he,_e,this.index)}}addConstantDashes(n){let o=!1;for(const d of this.layers){const g=d.paint.get("line-dasharray").value,v=d.layout.get("line-cap").value;if(g.kind!=="constant"||v.kind!=="constant")o=!0;else{const E=v.value,L=g.value;if(!L)continue;n.addDash(L,E)}}return o}addFeatureDashes(n,o){const d=this.zoom;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,E=g.layout.get("line-cap").value;if(v.kind==="constant"&&E.kind==="constant")continue;let L,k;if(v.kind==="constant"){if(L=v.value,!L)continue}else L=v.evaluate({zoom:d},n);k=E.kind==="constant"?E.value:E.evaluate({zoom:d},n),o.addDash(L,k),n.patterns[g.id]=o.getKey(L,k)}}update(n,o,d,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,o,this.stateDependentLayers,d,g)}addFeatures(n,o,d,g,v){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,o,d,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,yr)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Wn),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&n.properties.hasOwnProperty("mapbox_clip_start")&&n.properties.hasOwnProperty("mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,o,d,g,v,E){const L=this.layers[0].layout,k=L.get("line-join").evaluate(n,{}),V=L.get("line-cap").evaluate(n,{}),q=L.get("line-miter-limit"),se=L.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const he of o)this.addLine(he,n,k,V,q,se);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,v,E,g)}addLine(n,o,d,g,v,E){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let xt=0;xt<n.length-1;xt++)this.totalDistance+=n[xt].dist(n[xt+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const L=fs[o.type]==="Polygon";let k=n.length;for(;k>=2&&n[k-1].equals(n[k-2]);)k--;let V=0;for(;V<k-1&&n[V].equals(n[V+1]);)V++;if(k<(L?3:2))return;d==="bevel"&&(v=1.05);const q=this.overscaling<=16?122880/(512*this.overscaling):0,se=this.segments.prepareSegment(10*k,this.layoutVertexArray,this.indexArray);let he,_e,Be,Le,Xe;this.e1=this.e2=-1,L&&(he=n[k-2],Xe=n[V].sub(he)._unit()._perp());for(let xt=V;xt<k;xt++){if(Be=xt===k-1?L?n[V+1]:void 0:n[xt+1],Be&&n[xt].equals(Be))continue;Xe&&(Le=Xe),he&&(_e=he),he=n[xt],Xe=Be?Be.sub(he)._unit()._perp():Le,Le=Le||Xe;let Dt=Le.add(Xe);Dt.x===0&&Dt.y===0||Dt._unit();const _t=Le.x*Xe.x+Le.y*Xe.y,Tt=Dt.x*Xe.x+Dt.y*Xe.y,kt=Tt!==0?1/Tt:1/0,Ut=2*Math.sqrt(2-2*Tt),ci=Tt<ws&&_e&&Be,oi=Le.x*Xe.y-Le.y*Xe.x>0;if(ci&&xt>V){const gi=he.dist(_e);if(gi>2*q){const Si=he.sub(he.sub(_e)._mult(q/gi)._round());this.updateDistance(_e,Si),this.addCurrentVertex(Si,Le,0,0,se),_e=Si}}const Ti=_e&&Be;let Ki=Ti?d:L?"butt":g;if(Ti&&Ki==="round"&&(kt<E?Ki="miter":kt<=2&&(Ki="fakeround")),Ki==="miter"&&kt>v&&(Ki="bevel"),Ki==="bevel"&&(kt>2&&(Ki="flipbevel"),kt<v&&(Ki="miter")),_e&&this.updateDistance(_e,he),Ki==="miter")Dt._mult(kt),this.addCurrentVertex(he,Dt,0,0,se);else if(Ki==="flipbevel"){if(kt>100)Dt=Xe.mult(-1);else{const gi=kt*Le.add(Xe).mag()/Le.sub(Xe).mag();Dt._perp()._mult(gi*(oi?-1:1))}this.addCurrentVertex(he,Dt,0,0,se),this.addCurrentVertex(he,Dt.mult(-1),0,0,se)}else if(Ki==="bevel"||Ki==="fakeround"){const gi=-Math.sqrt(kt*kt-1),Si=oi?gi:0,Li=oi?0:gi;if(_e&&this.addCurrentVertex(he,Le,Si,Li,se),Ki==="fakeround"){const Vi=Math.round(180*Ut/Math.PI/20);for(let Zi=1;Zi<Vi;Zi++){let yi=Zi/Vi;if(yi!==.5){const Kn=yi-.5;yi+=yi*Kn*(yi-1)*((1.0904+_t*(_t*(3.55645-1.43519*_t)-3.2452))*Kn*Kn+(.848013+_t*(.215638*_t-1.06021)))}const sn=Xe.sub(Le)._mult(yi)._add(Le)._unit()._mult(oi?-1:1);this.addHalfVertex(he,sn.x,sn.y,!1,oi,0,se)}}Be&&this.addCurrentVertex(he,Xe,-Si,-Li,se)}else if(Ki==="butt")this.addCurrentVertex(he,Dt,0,0,se);else if(Ki==="square"){const gi=_e?1:-1;_e||this.addCurrentVertex(he,Dt,gi,gi,se),this.addCurrentVertex(he,Dt,0,0,se),_e&&this.addCurrentVertex(he,Dt,gi,gi,se)}else Ki==="round"&&(_e&&(this.addCurrentVertex(he,Le,0,0,se),this.addCurrentVertex(he,Le,1,1,se,!0)),Be&&(this.addCurrentVertex(he,Xe,-1,-1,se,!0),this.addCurrentVertex(he,Xe,0,0,se)));if(ci&&xt<k-1){const gi=he.dist(Be);if(gi>2*q){const Si=he.add(Be.sub(he)._mult(q/gi)._round());this.updateDistance(he,Si),this.addCurrentVertex(Si,Xe,0,0,se),he=Si}}}}addCurrentVertex(n,o,d,g,v,E=!1){const L=o.y*g-o.x,k=-o.y-o.x*g;this.addHalfVertex(n,o.x+o.y*d,o.y-o.x*d,E,!1,d,v),this.addHalfVertex(n,L,k,E,!0,-g,v)}addHalfVertex({x:n,y:o},d,g,v,E,L,k){this.layoutVertexArray.emplaceBack((n<<1)+(v?1:0),(o<<1)+(E?1:0),Math.round(63*d)+128,Math.round(63*g)+128,1+(L===0?0:L<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const V=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,V),k.primitiveLength++),E?this.e2=V:this.e1=V}updateScaledDistance(){if(this.lineClips){const n=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=n*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(n,o){this.distance+=n.dist(o),this.updateScaledDistance()}}zt(Qs,"LineBucket",{omit:["layers","patternFeatures"]});const Cl=new Hn({"line-cap":new pi(Yt.layout_line["line-cap"]),"line-join":new pi(Yt.layout_line["line-join"]),"line-miter-limit":new Jt(Yt.layout_line["line-miter-limit"]),"line-round-limit":new Jt(Yt.layout_line["line-round-limit"]),"line-sort-key":new pi(Yt.layout_line["line-sort-key"])});var xo={paint:new Hn({"line-opacity":new pi(Yt.paint_line["line-opacity"]),"line-color":new pi(Yt.paint_line["line-color"]),"line-translate":new Jt(Yt.paint_line["line-translate"]),"line-translate-anchor":new Jt(Yt.paint_line["line-translate-anchor"]),"line-width":new pi(Yt.paint_line["line-width"]),"line-gap-width":new pi(Yt.paint_line["line-gap-width"]),"line-offset":new pi(Yt.paint_line["line-offset"]),"line-blur":new pi(Yt.paint_line["line-blur"]),"line-dasharray":new pi(Yt.paint_line["line-dasharray"]),"line-pattern":new pi(Yt.paint_line["line-pattern"]),"line-gradient":new In(Yt.paint_line["line-gradient"]),"line-trim-offset":new Jt(Yt.paint_line["line-trim-offset"])}),layout:Cl};const Ks=new class extends pi{possiblyEvaluate(s,n){return n=new qt(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,transition:n.transition}),super.possiblyEvaluate(s,n)}evaluate(s,n,o,d){return n=Ve({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(s,n,o,d)}}(xo.paint.properties["line-width"].specification);function oo(s,n){return n>0?n+2*s:s}Ks.useIntegerZoom=!0;const Lo=_n([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),$o=_n([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Ia=_n([{name:"a_projected_pos",components:4,type:"Float32"}],4);_n([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const io=_n([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Do=_n([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);_n([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Po=_n([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),pa=_n([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);_n([{name:"triangle",components:3,type:"Uint16"}]),_n([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),_n([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),_n([{type:"Float32",name:"offsetX"}]),_n([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Jr=24;const Vs=128;function ms(s,n){const{expression:o}=n;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new qt(s+1))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:g}=o;let v=0;for(;v<d.length&&d[v]<=s;)v++;v=Math.max(0,v-1);let E=v;for(;E<d.length&&d[E]<s+1;)E++;E=Math.min(d.length-1,E);const L=d[v],k=d[E];return o.kind==="composite"?{kind:"composite",minZoom:L,maxZoom:k,interpolationType:g}:{kind:"camera",minZoom:L,maxZoom:k,minSize:o.evaluate(new qt(L)),maxSize:o.evaluate(new qt(k)),interpolationType:g}}}function $s(s,{uSize:n,uSizeT:o},{lowerSize:d,upperSize:g}){return s.kind==="source"?d/Vs:s.kind==="composite"?gr(d/Vs,g/Vs,o):n}function pr(s,n){let o=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:g,minZoom:v,maxZoom:E}=s,L=g?ye(Ho.interpolationFactor(g,n,v,E),0,1):0;s.kind==="camera"?d=gr(s.minSize,s.maxSize,L):o=L}return{uSizeT:o,uSize:d}}var qa=Object.freeze({__proto__:null,getSizeData:ms,evaluateSizeForFeature:$s,evaluateSizeForZoom:pr,SIZE_PACK_FACTOR:Vs});function Uo(s,n,o){return s.sections.forEach(d=>{d.text=function(g,v,E){const L=v.layout.get("text-transform").evaluate(E,{});return L==="uppercase"?g=g.toLocaleUpperCase():L==="lowercase"&&(g=g.toLocaleLowerCase()),si.applyArabicShaping&&(g=si.applyArabicShaping(g)),g}(d.text,n,o)}),s}const ao={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};function Jl(s){return s==="\uFE36"||s==="\uFE48"||s==="\uFE38"||s==="\uFE44"||s==="\uFE42"||s==="\uFE3E"||s==="\uFE3C"||s==="\uFE3A"||s==="\uFE18"||s==="\uFE40"||s==="\uFE10"||s==="\uFE13"||s==="\uFE14"||s==="\uFF40"||s==="\uFFE3"||s==="\uFE11"||s==="\uFE12"}function Cc(s){return s==="\uFE35"||s==="\uFE47"||s==="\uFE37"||s==="\uFE43"||s==="\uFE41"||s==="\uFE3D"||s==="\uFE3B"||s==="\uFE39"||s==="\uFE17"||s==="\uFE3F"}var Fa=vr,Ah=function(s,n,o,d,g){var v,E,L=8*g-d-1,k=(1<<L)-1,V=k>>1,q=-7,se=o?g-1:0,he=o?-1:1,_e=s[n+se];for(se+=he,v=_e&(1<<-q)-1,_e>>=-q,q+=L;q>0;v=256*v+s[n+se],se+=he,q-=8);for(E=v&(1<<-q)-1,v>>=-q,q+=d;q>0;E=256*E+s[n+se],se+=he,q-=8);if(v===0)v=1-V;else{if(v===k)return E?NaN:1/0*(_e?-1:1);E+=Math.pow(2,d),v-=V}return(_e?-1:1)*E*Math.pow(2,v-d)},El=function(s,n,o,d,g,v){var E,L,k,V=8*v-g-1,q=(1<<V)-1,se=q>>1,he=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,_e=d?0:v-1,Be=d?1:-1,Le=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(L=isNaN(n)?1:0,E=q):(E=Math.floor(Math.log(n)/Math.LN2),n*(k=Math.pow(2,-E))<1&&(E--,k*=2),(n+=E+se>=1?he/k:he*Math.pow(2,1-se))*k>=2&&(E++,k/=2),E+se>=q?(L=0,E=q):E+se>=1?(L=(n*k-1)*Math.pow(2,g),E+=se):(L=n*Math.pow(2,se-1)*Math.pow(2,g),E=0));g>=8;s[o+_e]=255&L,_e+=Be,L/=256,g-=8);for(E=E<<g|L,V+=g;V>0;s[o+_e]=255&E,_e+=Be,E/=256,V-=8);s[o+_e-Be]|=128*Le};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function vr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}vr.Varint=0,vr.Fixed64=1,vr.Bytes=2,vr.Fixed32=5;var Zo=4294967296,dh=1/Zo,Td=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ph(s){return s.type===vr.Bytes?s.readVarint()+s.pos:s.pos+1}function Fu(s,n,o){return o?4294967296*n+(s>>>0):4294967296*(n>>>0)+(s>>>0)}function Hf(s,n,o){var d=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));o.realloc(d);for(var g=o.pos-1;g>=s;g--)o.buf[g+d]=o.buf[g]}function tu(s,n){for(var o=0;o<s.length;o++)n.writeVarint(s[o])}function l0(s,n){for(var o=0;o<s.length;o++)n.writeSVarint(s[o])}function Ug(s,n){for(var o=0;o<s.length;o++)n.writeFloat(s[o])}function Rg(s,n){for(var o=0;o<s.length;o++)n.writeDouble(s[o])}function c0(s,n){for(var o=0;o<s.length;o++)n.writeBoolean(s[o])}function x1(s,n){for(var o=0;o<s.length;o++)n.writeFixed32(s[o])}function v1(s,n){for(var o=0;o<s.length;o++)n.writeSFixed32(s[o])}function w1(s,n){for(var o=0;o<s.length;o++)n.writeFixed64(s[o])}function b1(s,n){for(var o=0;o<s.length;o++)n.writeSFixed64(s[o])}function Gf(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+16777216*s[n+3]}function Sd(s,n,o){s[o]=n,s[o+1]=n>>>8,s[o+2]=n>>>16,s[o+3]=n>>>24}function h0(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+(s[n+3]<<24)}function B1(s,n,o){n.glyphs=[],s===1&&o.readMessage(Ec,n)}function Ec(s,n,o){if(s===3){const{id:d,bitmap:g,width:v,height:E,left:L,top:k,advance:V}=o.readMessage(Wf,{});n.glyphs.push({id:d,bitmap:new Yl({width:v+6,height:E+6},g),metrics:{width:v,height:E,left:L,top:k,advance:V}})}else s===4?n.ascender=o.readSVarint():s===5&&(n.descender=o.readSVarint())}function Wf(s,n,o){s===1?n.id=o.readVarint():s===2?n.bitmap=o.readBytes():s===3?n.width=o.readVarint():s===4?n.height=o.readVarint():s===5?n.left=o.readSVarint():s===6?n.top=o.readSVarint():s===7&&(n.advance=o.readVarint())}function jf(s){let n=0,o=0;for(const E of s)n+=E.w*E.h,o=Math.max(o,E.w);s.sort((E,L)=>L.h-E.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),o),h:1/0}];let g=0,v=0;for(const E of s)for(let L=d.length-1;L>=0;L--){const k=d[L];if(!(E.w>k.w||E.h>k.h)){if(E.x=k.x,E.y=k.y,v=Math.max(v,E.y+E.h),g=Math.max(g,E.x+E.w),E.w===k.w&&E.h===k.h){const V=d.pop();L<d.length&&(d[L]=V)}else E.h===k.h?(k.x+=E.w,k.w-=E.w):E.w===k.w?(k.y+=E.h,k.h-=E.h):(d.push({x:k.x+E.w,y:k.y,w:k.w-E.w,h:E.h}),k.y+=E.h,k.h-=E.h);break}}return{w:g,h:v,fill:n/(g*v)||0}}vr.prototype={destroy:function(){this.buf=null},readFields:function(s,n,o){for(o=o||this.length;this.pos<o;){var d=this.readVarint(),g=d>>3,v=this.pos;this.type=7&d,s(g,n,this),this.pos===v&&this.skip(d)}return n},readMessage:function(s,n){return this.readFields(s,n,this.readVarint()+this.pos)},readFixed32:function(){var s=Gf(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=h0(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=Gf(this.buf,this.pos)+Gf(this.buf,this.pos+4)*Zo;return this.pos+=8,s},readSFixed64:function(){var s=Gf(this.buf,this.pos)+h0(this.buf,this.pos+4)*Zo;return this.pos+=8,s},readFloat:function(){var s=Ah(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=Ah(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var n,o,d=this.buf;return n=127&(o=d[this.pos++]),o<128?n:(n|=(127&(o=d[this.pos++]))<<7,o<128?n:(n|=(127&(o=d[this.pos++]))<<14,o<128?n:(n|=(127&(o=d[this.pos++]))<<21,o<128?n:function(g,v,E){var L,k,V=E.buf;if(L=(112&(k=V[E.pos++]))>>4,k<128||(L|=(127&(k=V[E.pos++]))<<3,k<128)||(L|=(127&(k=V[E.pos++]))<<10,k<128)||(L|=(127&(k=V[E.pos++]))<<17,k<128)||(L|=(127&(k=V[E.pos++]))<<24,k<128)||(L|=(1&(k=V[E.pos++]))<<31,k<128))return Fu(g,L,v);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(o=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var s=this.readVarint()+this.pos,n=this.pos;return this.pos=s,s-n>=12&&Td?function(o,d,g){return Td.decode(o.subarray(d,g))}(this.buf,n,s):function(o,d,g){for(var v="",E=d;E<g;){var L,k,V,q=o[E],se=null,he=q>239?4:q>223?3:q>191?2:1;if(E+he>g)break;he===1?q<128&&(se=q):he===2?(192&(L=o[E+1]))==128&&(se=(31&q)<<6|63&L)<=127&&(se=null):he===3?(k=o[E+2],(192&(L=o[E+1]))==128&&(192&k)==128&&((se=(15&q)<<12|(63&L)<<6|63&k)<=2047||se>=55296&&se<=57343)&&(se=null)):he===4&&(k=o[E+2],V=o[E+3],(192&(L=o[E+1]))==128&&(192&k)==128&&(192&V)==128&&((se=(15&q)<<18|(63&L)<<12|(63&k)<<6|63&V)<=65535||se>=1114112)&&(se=null)),se===null?(se=65533,he=1):se>65535&&(se-=65536,v+=String.fromCharCode(se>>>10&1023|55296),se=56320|1023&se),v+=String.fromCharCode(se),E+=he}return v}(this.buf,n,s)},readBytes:function(){var s=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,s);return this.pos=s,n},readPackedVarint:function(s,n){if(this.type!==vr.Bytes)return s.push(this.readVarint(n));var o=ph(this);for(s=s||[];this.pos<o;)s.push(this.readVarint(n));return s},readPackedSVarint:function(s){if(this.type!==vr.Bytes)return s.push(this.readSVarint());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readSVarint());return s},readPackedBoolean:function(s){if(this.type!==vr.Bytes)return s.push(this.readBoolean());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readBoolean());return s},readPackedFloat:function(s){if(this.type!==vr.Bytes)return s.push(this.readFloat());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readFloat());return s},readPackedDouble:function(s){if(this.type!==vr.Bytes)return s.push(this.readDouble());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readDouble());return s},readPackedFixed32:function(s){if(this.type!==vr.Bytes)return s.push(this.readFixed32());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readFixed32());return s},readPackedSFixed32:function(s){if(this.type!==vr.Bytes)return s.push(this.readSFixed32());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readSFixed32());return s},readPackedFixed64:function(s){if(this.type!==vr.Bytes)return s.push(this.readFixed64());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readFixed64());return s},readPackedSFixed64:function(s){if(this.type!==vr.Bytes)return s.push(this.readSFixed64());var n=ph(this);for(s=s||[];this.pos<n;)s.push(this.readSFixed64());return s},skip:function(s){var n=7&s;if(n===vr.Varint)for(;this.buf[this.pos++]>127;);else if(n===vr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===vr.Fixed32)this.pos+=4;else{if(n!==vr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(s,n){this.writeVarint(s<<3|n)},realloc:function(s){for(var n=this.length||16;n<this.pos+s;)n*=2;if(n!==this.length){var o=new Uint8Array(n);o.set(this.buf),this.buf=o,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(s){this.realloc(4),Sd(this.buf,s,this.pos),this.pos+=4},writeSFixed32:function(s){this.realloc(4),Sd(this.buf,s,this.pos),this.pos+=4},writeFixed64:function(s){this.realloc(8),Sd(this.buf,-1&s,this.pos),Sd(this.buf,Math.floor(s*dh),this.pos+4),this.pos+=8},writeSFixed64:function(s){this.realloc(8),Sd(this.buf,-1&s,this.pos),Sd(this.buf,Math.floor(s*dh),this.pos+4),this.pos+=8},writeVarint:function(s){(s=+s||0)>268435455||s<0?function(n,o){var d,g;if(n>=0?(d=n%4294967296|0,g=n/4294967296|0):(g=~(-n/4294967296),4294967295^(d=~(-n%4294967296))?d=d+1|0:(d=0,g=g+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),function(v,E,L){L.buf[L.pos++]=127&v|128,v>>>=7,L.buf[L.pos++]=127&v|128,v>>>=7,L.buf[L.pos++]=127&v|128,v>>>=7,L.buf[L.pos++]=127&v|128,L.buf[L.pos]=127&(v>>>=7)}(d,0,o),function(v,E){var L=(7&v)<<4;E.buf[E.pos++]|=L|((v>>>=3)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v)))))}(g,o)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(Boolean(s))},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var n=this.pos;this.pos=function(d,g,v){for(var E,L,k=0;k<g.length;k++){if((E=g.charCodeAt(k))>55295&&E<57344){if(!L){E>56319||k+1===g.length?(d[v++]=239,d[v++]=191,d[v++]=189):L=E;continue}if(E<56320){d[v++]=239,d[v++]=191,d[v++]=189,L=E;continue}E=L-55296<<10|E-56320|65536,L=null}else L&&(d[v++]=239,d[v++]=191,d[v++]=189,L=null);E<128?d[v++]=E:(E<2048?d[v++]=E>>6|192:(E<65536?d[v++]=E>>12|224:(d[v++]=E>>18|240,d[v++]=E>>12&63|128),d[v++]=E>>6&63|128),d[v++]=63&E|128)}return v}(this.buf,s,this.pos);var o=this.pos-n;o>=128&&Hf(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeFloat:function(s){this.realloc(4),El(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),El(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var n=s.length;this.writeVarint(n),this.realloc(n);for(var o=0;o<n;o++)this.buf[this.pos++]=s[o]},writeRawMessage:function(s,n){this.pos++;var o=this.pos;s(n,this);var d=this.pos-o;d>=128&&Hf(o,d,this),this.pos=o-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,n,o){this.writeTag(s,vr.Bytes),this.writeRawMessage(n,o)},writePackedVarint:function(s,n){n.length&&this.writeMessage(s,tu,n)},writePackedSVarint:function(s,n){n.length&&this.writeMessage(s,l0,n)},writePackedBoolean:function(s,n){n.length&&this.writeMessage(s,c0,n)},writePackedFloat:function(s,n){n.length&&this.writeMessage(s,Ug,n)},writePackedDouble:function(s,n){n.length&&this.writeMessage(s,Rg,n)},writePackedFixed32:function(s,n){n.length&&this.writeMessage(s,x1,n)},writePackedSFixed32:function(s,n){n.length&&this.writeMessage(s,v1,n)},writePackedFixed64:function(s,n){n.length&&this.writeMessage(s,w1,n)},writePackedSFixed64:function(s,n){n.length&&this.writeMessage(s,b1,n)},writeBytesField:function(s,n){this.writeTag(s,vr.Bytes),this.writeBytes(n)},writeFixed32Field:function(s,n){this.writeTag(s,vr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(s,n){this.writeTag(s,vr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(s,n){this.writeTag(s,vr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(s,n){this.writeTag(s,vr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(s,n){this.writeTag(s,vr.Varint),this.writeVarint(n)},writeSVarintField:function(s,n){this.writeTag(s,vr.Varint),this.writeSVarint(n)},writeStringField:function(s,n){this.writeTag(s,vr.Bytes),this.writeString(n)},writeFloatField:function(s,n){this.writeTag(s,vr.Fixed32),this.writeFloat(n)},writeDoubleField:function(s,n){this.writeTag(s,vr.Fixed64),this.writeDouble(n)},writeBooleanField:function(s,n){this.writeVarintField(s,Boolean(n))}};class Xo{constructor(n,{pixelRatio:o,version:d,stretchX:g,stretchY:v,content:E}){this.paddedRect=n,this.pixelRatio=o,this.stretchX=g,this.stretchY=v,this.content=E,this.version=d}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 displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Tc{constructor(n,o){const d={},g={};this.haveRenderCallbacks=[];const v=[];this.addImages(n,d,v),this.addImages(o,g,v);const{w:E,h:L}=jf(v),k=new Za({width:E||1,height:L||1});for(const V in n){const q=n[V],se=d[V].paddedRect;Za.copy(q.data,k,{x:0,y:0},{x:se.x+1,y:se.y+1},q.data)}for(const V in o){const q=o[V],se=g[V].paddedRect,he=se.x+1,_e=se.y+1,Be=q.data.width,Le=q.data.height;Za.copy(q.data,k,{x:0,y:0},{x:he,y:_e},q.data),Za.copy(q.data,k,{x:0,y:Le-1},{x:he,y:_e-1},{width:Be,height:1}),Za.copy(q.data,k,{x:0,y:0},{x:he,y:_e+Le},{width:Be,height:1}),Za.copy(q.data,k,{x:Be-1,y:0},{x:he-1,y:_e},{width:1,height:Le}),Za.copy(q.data,k,{x:0,y:0},{x:he+Be,y:_e},{width:1,height:Le})}this.image=k,this.iconPositions=d,this.patternPositions=g}addImages(n,o,d){for(const g in n){const v=n[g],E={x:0,y:0,w:v.data.width+2,h:v.data.height+2};d.push(E),o[g]=new Xo(E,v),v.hasRenderCallback&&this.haveRenderCallbacks.push(g)}}patchUpdatedImages(n,o){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(d=>n.hasImage(d)),n.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const d in n.updatedImages)this.patchUpdatedImage(this.iconPositions[d],n.getImage(d),o),this.patchUpdatedImage(this.patternPositions[d],n.getImage(d),o)}patchUpdatedImage(n,o,d){if(!n||!o||n.version===o.version)return;n.version=o.version;const[g,v]=n.tl;d.update(o.data,void 0,{x:g,y:v})}}zt(Xo,"ImagePosition"),zt(Tc,"ImageAtlas");const qo={horizontal:1,vertical:2,horizontalOnly:3};class iu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(n,o){const d=new iu;return d.scale=n||1,d.fontStack=o,d}static forImage(n){const o=new iu;return o.imageName=n,o}}class IA{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(n,o){const d=new IA;for(let g=0;g<n.sections.length;g++){const v=n.sections[g];v.image?d.addImageSection(v):d.addTextSection(v,o)}return d}length(){return this.text.length}getSection(n){return this.sections[this.sectionIndex[n]]}getSections(){return this.sections}getSectionIndex(n){return this.sectionIndex[n]}getCharCode(n){return this.text.charCodeAt(n)}verticalizePunctuation(n){this.text=function(o,d){let g="";for(let v=0;v<o.length;v++){const E=o.charCodeAt(v+1)||null,L=o.charCodeAt(v-1)||null;g+=!d&&(E&&fe(E)&&!ao[o[v+1]]||L&&fe(L)&&!ao[o[v-1]])||!ao[o[v]]?o[v]:ao[o[v]]}return g}(this.text,n)}trim(){let n=0;for(let d=0;d<this.text.length&&u0[this.text.charCodeAt(d)];d++)n++;let o=this.text.length;for(let d=this.text.length-1;d>=0&&d>=n&&u0[this.text.charCodeAt(d)];d--)o--;this.text=this.text.substring(n,o),this.sectionIndex=this.sectionIndex.slice(n,o)}substring(n,o){const d=new IA;return d.text=this.text.substring(n,o),d.sectionIndex=this.sectionIndex.slice(n,o),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,o)=>Math.max(n,this.sections[o].scale),0)}addTextSection(n,o){this.text+=n.text,this.sections.push(iu.forText(n.scale,n.fontStack||o));const d=this.sections.length-1;for(let g=0;g<n.text.length;++g)this.sectionIndex.push(d)}addImageSection(n){const o=n.image?n.image.name:"";if(o.length===0)return void Ct("Can't add FormattedSection with an empty image.");const d=this.getNextImageSectionCharCode();d?(this.text+=String.fromCharCode(d),this.sections.push(iu.forImage(o)),this.sectionIndex.push(this.sections.length-1)):Ct("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nu(s,n,o,d,g,v,E,L,k,V,q,se,he,_e,Be){const Le=IA.fromFeature(s,g);se===qo.vertical&&Le.verticalizePunctuation(he);let Xe=[];const xt=function(Ut,ci,oi,Ti,Ki,gi){if(!Ut)return[];const Si=[],Li=function(sn,Kn,dn,Ln,ln,Xn){let Tr=0;for(let wr=0;wr<sn.length();wr++){const xr=sn.getSection(wr);Tr+=SB(sn.getCharCode(wr),xr,Ln,ln,Kn,Xn)}return Tr/Math.max(1,Math.ceil(Tr/dn))}(Ut,ci,oi,Ti,Ki,gi),Vi=Ut.text.indexOf("\u200B")>=0;let Zi=0;for(let sn=0;sn<Ut.length();sn++){const Kn=Ut.getSection(sn),dn=Ut.getCharCode(sn);if(u0[dn]||(Zi+=SB(dn,Kn,Ti,Ki,ci,gi)),sn<Ut.length()-1){const Ln=!((yi=dn)<11904||!(Er(yi)||Cr(yi)||m(yi)||$l(yi)||ua(yi)||Bn(yi)||Gr(yi)||Un(yi)||ba(yi)||Wa(yi)||wa(yi)||P(yi)||Lr(yi)||ur(yi)||tr(yi)||js(yi)||Rr(yi)||a(yi)||mo(yi)||Wo(yi)));($F[dn]||Ln||Kn.imageName)&&Si.push(IB(sn+1,Zi,Li,Si,ZF(dn,Ut.getCharCode(sn+1),Ln&&Vi),!1))}}var yi;return FB(IB(Ut.length(),Zi,Li,Si,0,!0))}(Le,V,v,n,d,_e),{processBidirectionalText:Dt,processStyledBidirectionalText:_t}=si;if(Dt&&Le.sections.length===1){const Ut=Dt(Le.toString(),xt);for(const ci of Ut){const oi=new IA;oi.text=ci,oi.sections=Le.sections;for(let Ti=0;Ti<ci.length;Ti++)oi.sectionIndex.push(0);Xe.push(oi)}}else if(_t){const Ut=_t(Le.text,Le.sectionIndex,xt);for(const ci of Ut){const oi=new IA;oi.text=ci[0],oi.sectionIndex=ci[1],oi.sections=Le.sections,Xe.push(oi)}}else Xe=function(Ut,ci){const oi=[],Ti=Ut.text;let Ki=0;for(const gi of ci)oi.push(Ut.substring(Ki,gi)),Ki=gi;return Ki<Ti.length&&oi.push(Ut.substring(Ki,Ti.length)),oi}(Le,xt);const Tt=[],kt={positionedLines:Tt,text:Le.toString(),top:q[1],bottom:q[1],left:q[0],right:q[0],writingMode:se,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(Ut,ci,oi,Ti,Ki,gi,Si,Li,Vi,Zi,yi,sn){let Kn=0,dn=0,Ln=0;const ln=Li==="right"?1:Li==="left"?0:.5;let Xn=!1;for(const ir of Ki){const Sr=ir.getSections();for(const rs of Sr){if(rs.imageName)continue;const gs=ci[rs.fontStack];if(gs&&(Xn=gs.ascender!==void 0&&gs.descender!==void 0,!Xn))break}if(!Xn)break}let Tr=0;for(const ir of Ki){ir.trim();const Sr=ir.getMaxScale(),rs=(Sr-1)*Jr,gs={positionedGlyphs:[],lineOffset:0};Ut.positionedLines[Tr]=gs;const ds=gs.positionedGlyphs;let _s=0;if(!ir.length()){dn+=gi,++Tr;continue}let bs=0,Zs=0;for(let ts=0;ts<ir.length();ts++){const Ao=ir.getSection(ts),lo=ir.getSectionIndex(ts),Vr=ir.getCharCode(ts);let Ps=Ao.scale,vo=null,ss=null,no=null,La=Jr,Jo=0;const ea=!(Vi===qo.horizontal||!yi&&!pe(Vr)||yi&&(u0[Vr]||(wr=Vr,vi(wr)||xn(wr)||cn(wr)||x(wr)||S(wr))));if(Ao.imageName){const Ya=Ti[Ao.imageName];if(!Ya)continue;no=Ao.imageName,Ut.iconsInText=Ut.iconsInText||!0,ss=Ya.paddedRect;const ta=Ya.displaySize;Ps=Ps*Jr/sn,vo={width:ta[0],height:ta[1],left:1,top:-3,advance:ea?ta[1]:ta[0],localGlyph:!1},Jo=Xn?-vo.height*Ps:Sr*Jr-17-ta[1]*Ps,La=vo.advance;const DA=(ea?ta[0]:ta[1])*Ps-Jr*Sr;DA>0&&DA>_s&&(_s=DA)}else{const Ya=oi[Ao.fontStack];if(!Ya)continue;Ya[Vr]&&(ss=Ya[Vr]);const ta=ci[Ao.fontStack];if(!ta)continue;const DA=ta.glyphs[Vr];if(!DA)continue;if(vo=DA.metrics,La=Vr!==8203?Jr:0,Xn){const tm=ta.ascender!==void 0?Math.abs(ta.ascender):0,$g=ta.descender!==void 0?Math.abs(ta.descender):0,Zg=(tm+$g)*Ps;bs<Zg&&(bs=Zg,Zs=(tm-$g)/2*Ps),Jo=-tm*Ps}else Jo=(Sr-Ps)*Jr-17}ea?(Ut.verticalizable=!0,ds.push({glyph:Vr,imageName:no,x:Kn,y:dn+Jo,vertical:ea,scale:Ps,localGlyph:vo.localGlyph,fontStack:Ao.fontStack,sectionIndex:lo,metrics:vo,rect:ss}),Kn+=La*Ps+Zi):(ds.push({glyph:Vr,imageName:no,x:Kn,y:dn+Jo,vertical:ea,scale:Ps,localGlyph:vo.localGlyph,fontStack:Ao.fontStack,sectionIndex:lo,metrics:vo,rect:ss}),Kn+=vo.advance*Ps+Zi)}ds.length!==0&&(Ln=Math.max(Kn-Zi,Ln),Xn?LB(ds,ln,_s,Zs,gi*Sr/2):LB(ds,ln,_s,0,gi/2)),Kn=0;const Yo=gi*Sr+_s;gs.lineOffset=Math.max(_s,rs),dn+=Yo,++Tr}var wr;const xr=dn,{horizontalAlign:Jn,verticalAlign:es}=C1(Si);(function(ir,Sr,rs,gs,ds,_s){const bs=(Sr-rs)*ds,Zs=-_s*gs;for(const Yo of ir)for(const ts of Yo.positionedGlyphs)ts.x+=bs,ts.y+=Zs})(Ut.positionedLines,ln,Jn,es,Ln,xr),Ut.top+=-es*xr,Ut.bottom=Ut.top+xr,Ut.left+=-Jn*Ln,Ut.right=Ut.left+Ln,Ut.hasBaseline=Xn}(kt,n,o,d,Xe,E,L,k,se,V,he,Be),!function(Ut){for(const ci of Ut)if(ci.positionedGlyphs.length!==0)return!1;return!0}(Tt)&&kt}const u0={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$F={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function SB(s,n,o,d,g,v){if(n.imageName){const E=d[n.imageName];return E?E.displaySize[0]*n.scale*Jr/v+g:0}{const E=o[n.fontStack],L=E&&E.glyphs[s];return L?L.metrics.advance*n.scale+g:0}}function MB(s,n,o,d){const g=Math.pow(s-n,2);return d?s<n?g/2:2*g:g+Math.abs(o)*o}function ZF(s,n,o){let d=0;return s===10&&(d-=1e4),o&&(d+=150),s!==40&&s!==65288||(d+=50),n!==41&&n!==65289||(d+=50),d}function IB(s,n,o,d,g,v){let E=null,L=MB(n,o,g,v);for(const k of d){const V=MB(n-k.x,o,g,v)+k.badness;V<=L&&(E=k,L=V)}return{index:s,x:n,priorBreak:E,badness:L}}function FB(s){return s?FB(s.priorBreak).concat(s.index):[]}function C1(s){let n=.5,o=.5;switch(s){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(s){case"bottom":case"bottom-right":case"bottom-left":o=1;break;case"top":case"top-right":case"top-left":o=0}return{horizontalAlign:n,verticalAlign:o}}function LB(s,n,o,d,g){if(!(n||o||d||g))return;const v=s.length-1,E=s[v],L=(E.x+E.metrics.advance*E.scale)*n;for(let k=0;k<=v;k++)s[k].x-=L,s[k].y+=o+d+g}function XF(s,n,o){const{horizontalAlign:d,verticalAlign:g}=C1(o),v=n[0]-s.displaySize[0]*d,E=n[1]-s.displaySize[1]*g;return{image:s,top:E,bottom:E+s.displaySize[1],left:v,right:v+s.displaySize[0]}}function DB(s,n,o,d,g,v){const E=s.image;let L;if(E.content){const Xe=E.content,xt=E.pixelRatio||1;L=[Xe[0]/xt,Xe[1]/xt,E.displaySize[0]-Xe[2]/xt,E.displaySize[1]-Xe[3]/xt]}const k=n.left*v,V=n.right*v;let q,se,he,_e;o==="width"||o==="both"?(_e=g[0]+k-d[3],se=g[0]+V+d[1]):(_e=g[0]+(k+V-E.displaySize[0])/2,se=_e+E.displaySize[0]);const Be=n.top*v,Le=n.bottom*v;return o==="height"||o==="both"?(q=g[1]+Be-d[0],he=g[1]+Le+d[2]):(q=g[1]+(Be+Le-E.displaySize[1])/2,he=q+E.displaySize[1]),{image:E,top:q,right:se,bottom:he,left:_e,collisionPadding:L}}class FA extends me{constructor(n,o,d,g,v){super(n,o),this.angle=g,this.z=d,v!==void 0&&(this.segment=v)}clone(){return new FA(this.x,this.y,this.z,this.angle,this.segment)}}function PB(s,n,o,d,g){if(n.segment===void 0)return!0;let v=n,E=n.segment+1,L=0;for(;L>-o/2;){if(E--,E<0)return!1;L-=s[E].dist(v),v=s[E]}L+=s[E].dist(s[E+1]),E++;const k=[];let V=0;for(;L<o/2;){const q=s[E],se=s[E+1];if(!se)return!1;let he=s[E-1].angleTo(q)-q.angleTo(se);for(he=Math.abs((he+3*Math.PI)%(2*Math.PI)-Math.PI),k.push({distance:L,angleDelta:he}),V+=he;L-k[0].distance>d;)V-=k.shift().angleDelta;if(V>g)return!1;E++,L+=q.dist(se)}return!0}function UB(s){let n=0;for(let o=0;o<s.length-1;o++)n+=s[o].dist(s[o+1]);return n}function RB(s,n,o){return s?.6*n*o:0}function zB(s,n){return Math.max(s?s.right-s.left:0,n?n.right-n.left:0)}function qF(s,n,o,d,g,v){const E=RB(o,g,v),L=zB(o,d)*v;let k=0;const V=UB(s)/2;for(let q=0;q<s.length-1;q++){const se=s[q],he=s[q+1],_e=se.dist(he);if(k+_e>V){const Be=(V-k)/_e,Le=gr(se.x,he.x,Be),Xe=gr(se.y,he.y,Be),xt=new FA(Le,Xe,0,he.angleTo(se),q);return!E||PB(s,xt,L,E,n)?xt:void 0}k+=_e}}function YF(s,n,o,d,g,v,E,L,k){const V=RB(d,v,E),q=zB(d,g),se=q*E,he=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return n-se<n/4&&(n=se+n/4),kB(s,he?n/2*L%n:(q/2+2*v)*E*L%n,n,V,o,se,he,!1,k)}function kB(s,n,o,d,g,v,E,L,k){const V=v/2,q=UB(s);let se=0,he=n-o,_e=[];for(let Be=0;Be<s.length-1;Be++){const Le=s[Be],Xe=s[Be+1],xt=Le.dist(Xe),Dt=Xe.angleTo(Le);for(;he+o<se+xt;){he+=o;const _t=(he-se)/xt,Tt=gr(Le.x,Xe.x,_t),kt=gr(Le.y,Xe.y,_t);if(Tt>=0&&Tt<k&&kt>=0&&kt<k&&he-V>=0&&he+V<=q){const Ut=new FA(Tt,kt,0,Dt,Be);Ut._round(),d&&!PB(s,Ut,v,d,g)||_e.push(Ut)}}se+=xt}return L||_e.length||E||(_e=kB(s,se/2,o,d,g,v,E,!0,k)),_e}function OB(s,n,o,d,g){const v=[];for(let E=0;E<s.length;E++){const L=s[E];let k;for(let V=0;V<L.length-1;V++){let q=L[V],se=L[V+1];q.x<n&&se.x<n||(q.x<n?q=new me(n,q.y+(n-q.x)/(se.x-q.x)*(se.y-q.y))._round():se.x<n&&(se=new me(n,q.y+(n-q.x)/(se.x-q.x)*(se.y-q.y))._round()),q.y<o&&se.y<o||(q.y<o?q=new me(q.x+(o-q.y)/(se.y-q.y)*(se.x-q.x),o)._round():se.y<o&&(se=new me(q.x+(o-q.y)/(se.y-q.y)*(se.x-q.x),o)._round()),q.x>=d&&se.x>=d||(q.x>=d?q=new me(d,q.y+(d-q.x)/(se.x-q.x)*(se.y-q.y))._round():se.x>=d&&(se=new me(d,q.y+(d-q.x)/(se.x-q.x)*(se.y-q.y))._round()),q.y>=g&&se.y>=g||(q.y>=g?q=new me(q.x+(g-q.y)/(se.y-q.y)*(se.x-q.x),g)._round():se.y>=g&&(se=new me(q.x+(g-q.y)/(se.y-q.y)*(se.x-q.x),g)._round()),k&&q.equals(k[k.length-1])||(k=[q],v.push(k)),k.push(se)))))}}return v}zt(FA,"Anchor");const zg=1e20;function NB(s,n,o,d,g,v,E,L,k){for(let V=n;V<n+d;V++)QB(s,o*v+V,v,g,E,L,k);for(let V=o;V<o+g;V++)QB(s,V*v+n,1,d,E,L,k)}function QB(s,n,o,d,g,v,E){v[0]=0,E[0]=-zg,E[1]=zg,g[0]=s[n];for(let L=1,k=0,V=0;L<d;L++){g[L]=s[n+L*o];const q=L*L;do{const se=v[k];V=(g[L]-g[se]+q-se*se)/(L-se)/2}while(V<=E[k]&&--k>-1);k++,v[k]=L,E[k]=V,E[k+1]=zg}for(let L=0,k=0;L<d;L++){for(;E[k+1]<L;)k++;const V=v[k],q=L-V;s[n+L*o]=g[V]+q*q}}const E1={none:0,ideographs:1,all:2};class Kf{constructor(n,o,d){this.requestManager=n,this.localGlyphMode=o,this.localFontFamily=d,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(n){this.url=n}getGlyphs(n,o){const d=[];for(const g in n)for(const v of n[g])d.push({stack:g,id:v});Oe(d,({stack:g,id:v},E)=>{let L=this.entries[g];L||(L=this.entries[g]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let k=L.glyphs[v];if(k!==void 0)return void E(null,{stack:g,id:v,glyph:k});if(k=this._tinySDF(L,g,v),k)return L.glyphs[v]=k,void E(null,{stack:g,id:v,glyph:k});const V=Math.floor(v/256);if(256*V>65535)return void E(new Error("glyphs > 65535 not supported"));if(L.ranges[V])return void E(null,{stack:g,id:v,glyph:k});let q=L.requests[V];q||(q=L.requests[V]=[],Kf.loadGlyphRange(g,V,this.url,this.requestManager,(se,he)=>{if(he){L.ascender=he.ascender,L.descender=he.descender;for(const _e in he.glyphs)this._doesCharSupportLocalGlyph(+_e)||(L.glyphs[+_e]=he.glyphs[+_e]);L.ranges[V]=!0}for(const _e of q)_e(se,he);delete L.requests[V]})),q.push((se,he)=>{se?E(se):he&&E(null,{stack:g,id:v,glyph:he.glyphs[v]||null})})},(g,v)=>{if(g)o(g);else if(v){const E={};for(const{stack:L,id:k,glyph:V}of v)E[L]===void 0&&(E[L]={}),E[L].glyphs===void 0&&(E[L].glyphs={}),E[L].glyphs[k]=V&&{id:V.id,bitmap:V.bitmap.clone(),metrics:V.metrics},E[L].ascender=this.entries[L].ascender,E[L].descender=this.entries[L].descender;o(null,E)}})}_doesCharSupportLocalGlyph(n){return this.localGlyphMode!==E1.none&&(this.localGlyphMode===E1.all?!!this.localFontFamily:!!this.localFontFamily&&(Wa(n)||Ba(n)||Lr(n)||Rr(n)||Un(n)))}_tinySDF(n,o,d){const g=this.localFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let v=n.tinySDF;if(!v){let Le="400";/bold/i.test(o)?Le="900":/medium/i.test(o)?Le="500":/light/i.test(o)&&(Le="200"),v=n.tinySDF=new Kf.TinySDF({fontFamily:g,fontWeight:Le,fontSize:48,buffer:6,radius:16}),v.fontWeight=Le}if(this.localGlyphs[v.fontWeight][d])return this.localGlyphs[v.fontWeight][d];const E=String.fromCharCode(d),{data:L,width:k,height:V,glyphWidth:q,glyphHeight:se,glyphLeft:he,glyphTop:_e,glyphAdvance:Be}=v.draw(E);return this.localGlyphs[v.fontWeight][d]={id:d,bitmap:new Yl({width:k,height:V},L),metrics:{width:q/2,height:se/2,left:he/2,top:_e/2-27,advance:Be/2,localGlyph:!0}}}}function VB(s,n,o,d){const g=[],v=s.image,E=v.pixelRatio,L=v.paddedRect.w-2,k=v.paddedRect.h-2,V=s.right-s.left,q=s.bottom-s.top,se=v.stretchX||[[0,L]],he=v.stretchY||[[0,k]],_e=(gi,Si)=>gi+Si[1]-Si[0],Be=se.reduce(_e,0),Le=he.reduce(_e,0),Xe=L-Be,xt=k-Le;let Dt=0,_t=Be,Tt=0,kt=Le,Ut=0,ci=Xe,oi=0,Ti=xt;if(v.content&&d){const gi=v.content;Dt=A0(se,0,gi[0]),Tt=A0(he,0,gi[1]),_t=A0(se,gi[0],gi[2]),kt=A0(he,gi[1],gi[3]),Ut=gi[0]-Dt,oi=gi[1]-Tt,ci=gi[2]-gi[0]-_t,Ti=gi[3]-gi[1]-kt}const Ki=(gi,Si,Li,Vi)=>{const Zi=d0(gi.stretch-Dt,_t,V,s.left),yi=p0(gi.fixed-Ut,ci,gi.stretch,Be),sn=d0(Si.stretch-Tt,kt,q,s.top),Kn=p0(Si.fixed-oi,Ti,Si.stretch,Le),dn=d0(Li.stretch-Dt,_t,V,s.left),Ln=p0(Li.fixed-Ut,ci,Li.stretch,Be),ln=d0(Vi.stretch-Tt,kt,q,s.top),Xn=p0(Vi.fixed-oi,Ti,Vi.stretch,Le),Tr=new me(Zi,sn),wr=new me(dn,sn),xr=new me(dn,ln),Jn=new me(Zi,ln),es=new me(yi/E,Kn/E),ir=new me(Ln/E,Xn/E),Sr=n*Math.PI/180;if(Sr){const ds=Math.sin(Sr),_s=Math.cos(Sr),bs=[_s,-ds,ds,_s];Tr._matMult(bs),wr._matMult(bs),Jn._matMult(bs),xr._matMult(bs)}const rs=gi.stretch+gi.fixed,gs=Si.stretch+Si.fixed;return{tl:Tr,tr:wr,bl:Jn,br:xr,tex:{x:v.paddedRect.x+1+rs,y:v.paddedRect.y+1+gs,w:Li.stretch+Li.fixed-rs,h:Vi.stretch+Vi.fixed-gs},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:es,pixelOffsetBR:ir,minFontScaleX:ci/E/V,minFontScaleY:Ti/E/q,isSDF:o}};if(d&&(v.stretchX||v.stretchY)){const gi=HB(se,Xe,Be),Si=HB(he,xt,Le);for(let Li=0;Li<gi.length-1;Li++){const Vi=gi[Li],Zi=gi[Li+1];for(let yi=0;yi<Si.length-1;yi++)g.push(Ki(Vi,Si[yi],Zi,Si[yi+1]))}}else g.push(Ki({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:L+1},{fixed:0,stretch:k+1}));return g}function A0(s,n,o){let d=0;for(const g of s)d+=Math.max(n,Math.min(o,g[1]))-Math.max(n,Math.min(o,g[0]));return d}function HB(s,n,o){const d=[{fixed:-1,stretch:0}];for(const[g,v]of s){const E=d[d.length-1];d.push({fixed:g-E.stretch,stretch:E.stretch}),d.push({fixed:g-E.stretch,stretch:E.stretch+(v-g)})}return d.push({fixed:n+1,stretch:o}),d}function d0(s,n,o,d){return s/n*o+d}function p0(s,n,o,d){return s-n*o/d}function JF(s,n,o,d){const g=n+s.positionedLines[d].lineOffset;return d===0?o+g/2:o+(g+(n+s.positionedLines[d-1].lineOffset))/2}Kf.loadGlyphRange=function(s,n,o,d,g){const v=256*n,E=v+255,L=d.transformRequest(d.normalizeGlyphsURL(o).replace("{fontstack}",s).replace("{range}",`${v}-${E}`),ii.Glyphs);Cn(L,(k,V)=>{if(k)g(k);else if(V){const q={},se=function(he){return new Fa(he).readFields(B1,{})}(V);for(const he of se.glyphs)q[he.id]=he;g(null,{glyphs:q,ascender:se.ascender,descender:se.descender})}})},Kf.TinySDF=class{constructor({fontSize:s=24,buffer:n=3,radius:o=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:E="normal"}={}){this.buffer=n,this.cutoff=d,this.radius=o;const L=this.size=s+4*n,k=this._createCanvas(L),V=this.ctx=k.getContext("2d",{willReadFrequently:!0});V.font=`${E} ${v} ${s}px ${g}`,V.textBaseline="alphabetic",V.textAlign="left",V.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(s){const n=document.createElement("canvas");return n.width=n.height=s,n}draw(s){const{width:n,actualBoundingBoxAscent:o,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(s),E=Math.ceil(o),L=Math.min(this.size-this.buffer,Math.ceil(v-g)),k=Math.min(this.size-this.buffer,E+Math.ceil(d)),V=L+2*this.buffer,q=k+2*this.buffer,se=Math.max(V*q,0),he=new Uint8ClampedArray(se),_e={data:he,width:V,height:q,glyphWidth:L,glyphHeight:k,glyphTop:E,glyphLeft:0,glyphAdvance:n};if(L===0||k===0)return _e;const{ctx:Be,buffer:Le,gridInner:Xe,gridOuter:xt}=this;Be.clearRect(Le,Le,L,k),Be.fillText(s,Le,Le+E);const Dt=Be.getImageData(Le,Le,L,k);xt.fill(zg,0,se),Xe.fill(0,0,se);for(let _t=0;_t<k;_t++)for(let Tt=0;Tt<L;Tt++){const kt=Dt.data[4*(_t*L+Tt)+3]/255;if(kt===0)continue;const Ut=(_t+Le)*V+Tt+Le;if(kt===1)xt[Ut]=0,Xe[Ut]=zg;else{const ci=.5-kt;xt[Ut]=ci>0?ci*ci:0,Xe[Ut]=ci<0?ci*ci:0}}NB(xt,0,0,V,q,V,this.f,this.v,this.z),NB(Xe,Le,Le,L,k,V,this.f,this.v,this.z);for(let _t=0;_t<se;_t++){const Tt=Math.sqrt(xt[_t])-Math.sqrt(Xe[_t]);he[_t]=Math.round(255-255*(Tt/this.radius+this.cutoff))}return _e}};class e3{constructor(n=[],o=t3){if(this.data=n,this.length=this.data.length,this.compare=o,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(n){this.data.push(n),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const n=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:o,compare:d}=this,g=o[n];for(;n>0;){const v=n-1>>1,E=o[v];if(d(g,E)>=0)break;o[n]=E,n=v}o[n]=g}_down(n){const{data:o,compare:d}=this,g=this.length>>1,v=o[n];for(;n<g;){let E=1+(n<<1),L=o[E];const k=E+1;if(k<this.length&&d(o[k],L)<0&&(E=k,L=o[k]),d(L,v)>=0)break;o[n]=L,n=E}o[n]=v}}function t3(s,n){return s<n?-1:s>n?1:0}function i3(s,n=1,o=!1){let d=1/0,g=1/0,v=-1/0,E=-1/0;const L=s[0];for(let _e=0;_e<L.length;_e++){const Be=L[_e];(!_e||Be.x<d)&&(d=Be.x),(!_e||Be.y<g)&&(g=Be.y),(!_e||Be.x>v)&&(v=Be.x),(!_e||Be.y>E)&&(E=Be.y)}const k=Math.min(v-d,E-g);let V=k/2;const q=new e3([],n3);if(k===0)return new me(d,g);for(let _e=d;_e<v;_e+=k)for(let Be=g;Be<E;Be+=k)q.push(new $f(_e+V,Be+V,V,s));let se=function(_e){let Be=0,Le=0,Xe=0;const xt=_e[0];for(let Dt=0,_t=xt.length,Tt=_t-1;Dt<_t;Tt=Dt++){const kt=xt[Dt],Ut=xt[Tt],ci=kt.x*Ut.y-Ut.x*kt.y;Le+=(kt.x+Ut.x)*ci,Xe+=(kt.y+Ut.y)*ci,Be+=3*ci}return new $f(Le/Be,Xe/Be,0,_e)}(s),he=q.length;for(;q.length;){const _e=q.pop();(_e.d>se.d||!se.d)&&(se=_e,o&&console.log("found best %d after %d probes",Math.round(1e4*_e.d)/1e4,he)),_e.max-se.d<=n||(V=_e.h/2,q.push(new $f(_e.p.x-V,_e.p.y-V,V,s)),q.push(new $f(_e.p.x+V,_e.p.y-V,V,s)),q.push(new $f(_e.p.x-V,_e.p.y+V,V,s)),q.push(new $f(_e.p.x+V,_e.p.y+V,V,s)),he+=4)}return o&&(console.log(`num probes: ${he}`),console.log(`best distance: ${se.d}`)),se.p}function n3(s,n){return n.max-s.max}function $f(s,n,o,d){this.p=new me(s,n),this.h=o,this.d=function(g,v){let E=!1,L=1/0;for(let k=0;k<v.length;k++){const V=v[k];for(let q=0,se=V.length,he=se-1;q<se;he=q++){const _e=V[q],Be=V[he];_e.y>g.y!=Be.y>g.y&&g.x<(Be.x-_e.x)*(g.y-_e.y)/(Be.y-_e.y)+_e.x&&(E=!E),L=Math.min(L,fg(g,_e,Be))}}return(E?1:-1)*Math.sqrt(L)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const T1=Number.POSITIVE_INFINITY,r3=Math.sqrt(2);function GB(s,[n,o]){let d=0,g=0;if(o===T1){n<0&&(n=0);const v=n/r3;switch(s){case"top-right":case"top-left":g=v-7;break;case"bottom-right":case"bottom-left":g=7-v;break;case"bottom":g=7-n;break;case"top":g=n-7}switch(s){case"top-right":case"bottom-right":d=-v;break;case"top-left":case"bottom-left":d=v;break;case"left":d=n;break;case"right":d=-n}}else{switch(n=Math.abs(n),o=Math.abs(o),s){case"top-right":case"top-left":case"top":g=o-7;break;case"bottom-right":case"bottom-left":case"bottom":g=7-o}switch(s){case"top-right":case"bottom-right":case"right":d=-n;break;case"top-left":case"bottom-left":case"left":d=n}}return[d,g]}function s3(s,n,o,d,g,v,E,L,k,V){s.createArrays(),s.tilePixelRatio=Zn/(512*s.overscaling),s.compareText={},s.iconsNeedLinear=!1;const q=s.layers[0].layout,se=s.layers[0]._unevaluatedLayout._values,he={};if(s.textSizeData.kind==="composite"){const{minZoom:Le,maxZoom:Xe}=s.textSizeData;he.compositeTextSizes=[se["text-size"].possiblyEvaluate(new qt(Le),L),se["text-size"].possiblyEvaluate(new qt(Xe),L)]}if(s.iconSizeData.kind==="composite"){const{minZoom:Le,maxZoom:Xe}=s.iconSizeData;he.compositeIconSizes=[se["icon-size"].possiblyEvaluate(new qt(Le),L),se["icon-size"].possiblyEvaluate(new qt(Xe),L)]}he.layoutTextSize=se["text-size"].possiblyEvaluate(new qt(k+1),L),he.layoutIconSize=se["icon-size"].possiblyEvaluate(new qt(k+1),L),he.textMaxSize=se["text-size"].possiblyEvaluate(new qt(18),L);const _e=q.get("text-rotation-alignment")==="map"&&q.get("symbol-placement")!=="point",Be=q.get("text-size");for(const Le of s.features){const Xe=q.get("text-font").evaluate(Le,{},L).join(","),xt=Be.evaluate(Le,{},L),Dt=he.layoutTextSize.evaluate(Le,{},L),_t=(he.layoutIconSize.evaluate(Le,{},L),{horizontal:{},vertical:void 0}),Tt=Le.text;let kt,Ut=[0,0];if(Tt){const Ti=Tt.toString(),Ki=q.get("text-letter-spacing").evaluate(Le,{},L)*Jr,gi=q.get("text-line-height").evaluate(Le,{},L)*Jr,Si=W(Ti)?Ki:0,Li=q.get("text-anchor").evaluate(Le,{},L),Vi=q.get("text-variable-anchor");if(!Vi){const dn=q.get("text-radial-offset").evaluate(Le,{},L);Ut=dn?GB(Li,[dn*Jr,T1]):q.get("text-offset").evaluate(Le,{},L).map(Ln=>Ln*Jr)}let Zi=_e?"center":q.get("text-justify").evaluate(Le,{},L);const yi=q.get("symbol-placement")==="point",sn=yi?q.get("text-max-width").evaluate(Le,{},L)*Jr:1/0,Kn=dn=>{s.allowVerticalPlacement&&H(Ti)&&(_t.vertical=nu(Tt,n,o,g,Xe,sn,gi,Li,dn,Si,Ut,qo.vertical,!0,Dt,xt))};if(!_e&&Vi){const dn=Zi==="auto"?Vi.map(ln=>S1(ln)):[Zi];let Ln=!1;for(let ln=0;ln<dn.length;ln++){const Xn=dn[ln];if(!_t.horizontal[Xn])if(Ln)_t.horizontal[Xn]=_t.horizontal[0];else{const Tr=nu(Tt,n,o,g,Xe,sn,gi,"center",Xn,Si,Ut,qo.horizontal,!1,Dt,xt);Tr&&(_t.horizontal[Xn]=Tr,Ln=Tr.positionedLines.length===1)}}Kn("left")}else{if(Zi==="auto"&&(Zi=S1(Li)),yi||q.get("text-writing-mode").indexOf("horizontal")>=0||!H(Ti)){const dn=nu(Tt,n,o,g,Xe,sn,gi,Li,Zi,Si,Ut,qo.horizontal,!1,Dt,xt);dn&&(_t.horizontal[Zi]=dn)}Kn(yi?"left":Zi)}}let ci=!1;if(Le.icon&&Le.icon.name){const Ti=d[Le.icon.name];Ti&&(kt=XF(g[Le.icon.name],q.get("icon-offset").evaluate(Le,{},L),q.get("icon-anchor").evaluate(Le,{},L)),ci=Ti.sdf,s.sdfIcons===void 0?s.sdfIcons=Ti.sdf:s.sdfIcons!==Ti.sdf&&Ct("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Ti.pixelRatio!==s.pixelRatio||q.get("icon-rotate").constantOr(1)!==0)&&(s.iconsNeedLinear=!0))}const oi=jB(_t.horizontal)||_t.vertical;s.iconsInText||(s.iconsInText=!!oi&&oi.iconsInText),(oi||kt)&&o3(s,Le,_t,kt,d,he,Dt,0,Ut,ci,E,L,V)}v&&s.generateCollisionDebugBuffers(k,s.collisionBoxArray)}function S1(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function o3(s,n,o,d,g,v,E,L,k,V,q,se,he){let _e=v.textMaxSize.evaluate(n,{},se);_e===void 0&&(_e=E);const Be=s.layers[0].layout,Le=Be.get("icon-offset").evaluate(n,{},se),Xe=jB(o.horizontal)||o.vertical,xt=he.name==="globe",Dt=E/24,_t=s.tilePixelRatio*_e/24,Tt=(Si=s.overscaling,s.zoom>18&&Si>2&&(Si>>=1),Math.max(Zn/(512*Si),1)*Be.get("symbol-spacing")),kt=Be.get("text-padding")*s.tilePixelRatio,Ut=Be.get("icon-padding")*s.tilePixelRatio,ci=Ge(Be.get("text-max-angle")),oi=Be.get("text-rotation-alignment")==="map"&&Be.get("symbol-placement")!=="point",Ti=Be.get("icon-rotation-alignment")==="map"&&Be.get("symbol-placement")!=="point",Ki=Be.get("symbol-placement"),gi=Tt/2;var Si;const Li=Be.get("icon-text-fit");let Vi;d&&Li!=="none"&&(s.allowVerticalPlacement&&o.vertical&&(Vi=DB(d,o.vertical,Li,Be.get("icon-text-fit-padding"),Le,Dt)),Xe&&(d=DB(d,Xe,Li,Be.get("icon-text-fit-padding"),Le,Dt)));const Zi=(yi,sn,Kn)=>{if(sn.x<0||sn.x>=Zn||sn.y<0||sn.y>=Zn)return;let dn=null;if(xt){const{x:Ln,y:ln,z:Xn}=he.projectTilePoint(sn.x,sn.y,Kn);dn={anchor:new FA(Ln,ln,Xn,0,void 0),up:he.upVector(Kn,sn.x,sn.y)}}(function(Ln,ln,Xn,Tr,wr,xr,Jn,es,ir,Sr,rs,gs,ds,_s,bs,Zs,Yo,ts,Ao,lo,Vr,Ps,vo,ss,no){const La=Ln.addToLineVertexArray(ln,Tr);let Jo,ea,Ya,ta,DA,tm,$g,Zg=0,IC=0,FC=0,LC=0,W1=-1,j1=-1;const Ru={};let DC=ad.exports("");const Up=Xn?Xn.anchor:ln;let K1=0,$1=0;if(ir._unevaluatedLayout.getValue("text-radial-offset")===void 0?[K1,$1]=ir.layout.get("text-offset").evaluate(Vr,{},no).map(ec=>ec*Jr):(K1=ir.layout.get("text-radial-offset").evaluate(Vr,{},no)*Jr,$1=T1),Ln.allowVerticalPlacement&&wr.vertical){const ec=wr.vertical;if(bs)tm=M1(ec),es&&($g=M1(es));else{const tc=ir.layout.get("text-rotate").evaluate(Vr,{},no)+90;Ya=f0(Sr,Up,ln,rs,gs,ds,ec,_s,tc,Zs),es&&(ta=f0(Sr,Up,ln,rs,gs,ds,es,ts,tc))}}if(xr){const ec=ir.layout.get("icon-rotate").evaluate(Vr,{},no),tc=ir.layout.get("icon-text-fit")!=="none",Xg=VB(xr,ec,vo,tc),X1=es?VB(es,ec,vo,tc):void 0;ea=f0(Sr,Up,ln,rs,gs,ds,xr,ts,ec),Zg=4*Xg.length;const PC=Ln.iconSizeData;let Rp=null;PC.kind==="source"?(Rp=[Vs*ir.layout.get("icon-size").evaluate(Vr,{},no)],Rp[0]>Md&&Ct(`${Ln.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):PC.kind==="composite"&&(Rp=[Vs*Ps.compositeIconSizes[0].evaluate(Vr,{},no),Vs*Ps.compositeIconSizes[1].evaluate(Vr,{},no)],(Rp[0]>Md||Rp[1]>Md)&&Ct(`${Ln.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ln.addSymbols(Ln.icon,Xg,Rp,lo,Ao,Vr,!1,Xn,ln,La.lineStartIndex,La.lineLength,-1,ss,no),W1=Ln.icon.placedSymbolArray.length-1,X1&&(IC=4*X1.length,Ln.addSymbols(Ln.icon,X1,Rp,lo,Ao,Vr,qo.vertical,Xn,ln,La.lineStartIndex,La.lineLength,-1,ss,no),j1=Ln.icon.placedSymbolArray.length-1)}for(const ec in wr.horizontal){const tc=wr.horizontal[ec];Jo||(DC=ad.exports(tc.text),bs?DA=M1(tc):Jo=f0(Sr,Up,ln,rs,gs,ds,tc,_s,ir.layout.get("text-rotate").evaluate(Vr,{},no),Zs));const Xg=tc.positionedLines.length===1;if(FC+=WB(Ln,Xn,ln,tc,Jn,ir,bs,Vr,Zs,La,wr.vertical?qo.horizontal:qo.horizontalOnly,Xg?Object.keys(wr.horizontal):[ec],Ru,W1,Ps,ss,no),Xg)break}wr.vertical&&(LC+=WB(Ln,Xn,ln,wr.vertical,Jn,ir,bs,Vr,Zs,La,qo.vertical,["vertical"],Ru,j1,Ps,ss,no));let Ud=-1;const Z1=(ec,tc)=>ec?Math.max(ec,tc):tc;Ud=Z1(DA,Ud),Ud=Z1(tm,Ud),Ud=Z1($g,Ud);const k3=Ud>-1?1:0;Ln.glyphOffsetArray.length>=Fd.MAX_GLYPHS&&Ct("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Vr.sortKey!==void 0&&Ln.addToSortKeyRanges(Ln.symbolInstances.length,Vr.sortKey),Ln.symbolInstances.emplaceBack(Up.x,Up.y,Up.z,ln.x,ln.y,Ru.right>=0?Ru.right:-1,Ru.center>=0?Ru.center:-1,Ru.left>=0?Ru.left:-1,Ru.vertical>=0?Ru.vertical:-1,W1,j1,DC,Jo!==void 0?Jo:Ln.collisionBoxArray.length,Jo!==void 0?Jo+1:Ln.collisionBoxArray.length,Ya!==void 0?Ya:Ln.collisionBoxArray.length,Ya!==void 0?Ya+1:Ln.collisionBoxArray.length,ea!==void 0?ea:Ln.collisionBoxArray.length,ea!==void 0?ea+1:Ln.collisionBoxArray.length,ta||Ln.collisionBoxArray.length,ta?ta+1:Ln.collisionBoxArray.length,rs,FC,LC,Zg,IC,k3,0,K1,$1,Ud)})(s,sn,dn,yi,o,d,g,Vi,s.layers[0],s.collisionBoxArray,n.index,n.sourceLayerIndex,s.index,kt,oi,k,0,Ut,Ti,Le,n,v,V,q,se)};if(Ki==="line")for(const yi of OB(n.geometry,0,0,Zn,Zn)){const sn=YF(yi,Tt,ci,o.vertical||Xe,d,24,_t,s.overscaling,Zn);for(const Kn of sn){const dn=Xe;dn&&a3(s,dn.text,gi,Kn)||Zi(yi,Kn,se)}}else if(Ki==="line-center"){for(const yi of n.geometry)if(yi.length>1){const sn=qF(yi,ci,o.vertical||Xe,d,24,_t);sn&&Zi(yi,sn,se)}}else if(n.type==="Polygon")for(const yi of Nf(n.geometry,0)){const sn=i3(yi,16);Zi(yi[0],new FA(sn.x,sn.y,0,0,void 0),se)}else if(n.type==="LineString")for(const yi of n.geometry)Zi(yi,new FA(yi[0].x,yi[0].y,0,0,void 0),se);else if(n.type==="Point")for(const yi of n.geometry)for(const sn of yi)Zi([sn],new FA(sn.x,sn.y,0,0,void 0),se)}const Md=32640;function WB(s,n,o,d,g,v,E,L,k,V,q,se,he,_e,Be,Le,Xe){const xt=function(Tt,kt,Ut,ci,oi,Ti,Ki,gi){const Si=[];if(kt.positionedLines.length===0)return Si;const Li=ci.layout.get("text-rotate").evaluate(Ti,{})*Math.PI/180,Vi=function(dn){const Ln=dn[0],ln=dn[1],Xn=Ln*ln;return Xn>0?[Ln,-ln]:Xn<0?[-Ln,ln]:Ln===0?[ln,Ln]:[ln,-Ln]}(Ut);let Zi=Math.abs(kt.top-kt.bottom);for(const dn of kt.positionedLines)Zi-=dn.lineOffset;const yi=kt.positionedLines.length,sn=Zi/yi;let Kn=kt.top-Ut[1];for(let dn=0;dn<yi;++dn){const Ln=kt.positionedLines[dn];Kn=JF(kt,sn,Kn,dn);for(const ln of Ln.positionedGlyphs){if(!ln.rect)continue;const Xn=ln.rect||{};let Tr=4,wr=!0,xr=1,Jn=0;if(ln.imageName){const ss=Ki[ln.imageName];if(!ss)continue;if(ss.sdf){Ct("SDF images are not supported in formatted text and will be ignored.");continue}wr=!1,xr=ss.pixelRatio,Tr=1/xr}const es=(oi||gi)&&ln.vertical,ir=ln.metrics.advance*ln.scale/2,Sr=ln.metrics,rs=ln.rect;if(rs===null)continue;gi&&kt.verticalizable&&(Jn=ln.imageName?ir-ln.metrics.width*ln.scale/2:0);const gs=oi?[ln.x+ir,ln.y]:[0,0];let ds=[0,0],_s=[0,0],bs=!1;oi||(es?(_s=[ln.x+ir+Vi[0],ln.y+Vi[1]-Jn],bs=!0):ds=[ln.x+ir+Ut[0],ln.y+Ut[1]-Jn]);const Zs=rs.w*ln.scale/(xr*(ln.localGlyph?2:1)),Yo=rs.h*ln.scale/(xr*(ln.localGlyph?2:1));let ts,Ao,lo,Vr;if(es){const ss=ln.y-Kn,no=new me(-ir,ir-ss),La=-Math.PI/2,Jo=new me(..._s);ts=new me(-ir+ds[0],ds[1]),ts._rotateAround(La,no)._add(Jo),ts.x+=-ss+ir,ts.y-=(Sr.left-Tr)*ln.scale;const ea=ln.imageName?Sr.advance*ln.scale:Jr*ln.scale,Ya=String.fromCharCode(ln.glyph);Jl(Ya)?ts.x+=(1-Tr)*ln.scale:Cc(Ya)?ts.x+=ea-Sr.height*ln.scale+(-Tr-1)*ln.scale:ts.x+=ln.imageName||Sr.width+2*Tr===rs.w&&Sr.height+2*Tr===rs.h?(ea-Yo)/2:(ea-(Sr.height+2*Tr)*ln.scale)/2,Ao=new me(ts.x,ts.y-Zs),lo=new me(ts.x+Yo,ts.y),Vr=new me(ts.x+Yo,ts.y-Zs)}else{const ss=(Sr.left-Tr)*ln.scale-ir+ds[0],no=(-Sr.top-Tr)*ln.scale+ds[1],La=ss+Zs,Jo=no+Yo;ts=new me(ss,no),Ao=new me(La,no),lo=new me(ss,Jo),Vr=new me(La,Jo)}if(Li){let ss;ss=oi?new me(0,0):bs?new me(Vi[0],Vi[1]):new me(Ut[0],Ut[1]),ts._rotateAround(Li,ss),Ao._rotateAround(Li,ss),lo._rotateAround(Li,ss),Vr._rotateAround(Li,ss)}const Ps=new me(0,0),vo=new me(0,0);Si.push({tl:ts,tr:Ao,bl:lo,br:Vr,tex:Xn,writingMode:kt.writingMode,glyphOffset:gs,sectionIndex:ln.sectionIndex,isSDF:wr,pixelOffsetTL:Ps,pixelOffsetBR:vo,minFontScaleX:0,minFontScaleY:0})}}return Si}(0,d,k,v,E,L,g,s.allowVerticalPlacement),Dt=s.textSizeData;let _t=null;Dt.kind==="source"?(_t=[Vs*v.layout.get("text-size").evaluate(L,{},Xe)],_t[0]>Md&&Ct(`${s.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Dt.kind==="composite"&&(_t=[Vs*Be.compositeTextSizes[0].evaluate(L,{},Xe),Vs*Be.compositeTextSizes[1].evaluate(L,{},Xe)],(_t[0]>Md||_t[1]>Md)&&Ct(`${s.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),s.addSymbols(s.text,xt,_t,k,E,L,q,n,o,V.lineStartIndex,V.lineLength,_e,Le,Xe);for(const Tt of se)he[Tt]=s.text.placedSymbolArray.length-1;return 4*xt.length}function jB(s){for(const n in s)return s[n];return null}function f0(s,n,o,d,g,v,E,L,k,V){let q=E.top,se=E.bottom,he=E.left,_e=E.right;const Be=E.collisionPadding;if(Be&&(he-=Be[0],q-=Be[1],_e+=Be[2],se+=Be[3]),k){const Le=new me(he,q),Xe=new me(_e,q),xt=new me(he,se),Dt=new me(_e,se),_t=Ge(k);let Tt=new me(0,0);V&&(Tt=new me(V[0],V[1])),Le._rotateAround(_t,Tt),Xe._rotateAround(_t,Tt),xt._rotateAround(_t,Tt),Dt._rotateAround(_t,Tt),he=Math.min(Le.x,Xe.x,xt.x,Dt.x),_e=Math.max(Le.x,Xe.x,xt.x,Dt.x),q=Math.min(Le.y,Xe.y,xt.y,Dt.y),se=Math.max(Le.y,Xe.y,xt.y,Dt.y)}return s.emplaceBack(n.x,n.y,n.z,o.x,o.y,he,q,_e,se,L,d,g,v),s.length-1}function M1(s){s.collisionPadding&&(s.top-=s.collisionPadding[1],s.bottom+=s.collisionPadding[3]);const n=s.bottom-s.top;return n>0?Math.max(10,n):null}function a3(s,n,o,d){const g=s.compareText;if(n in g){const v=g[n];for(let E=v.length-1;E>=0;E--)if(d.dist(v[E])<o)return!0}else g[n]=[];return g[n].push(d),!1}const l3=_n([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:KB}=l3,$B=_n([{name:"a_pos_3",components:3,type:"Int16"}]);var kg=_n([{name:"a_pos",type:"Int16",components:2}]);const LA=Zn/Math.PI/2,I1=2*Xl(1,0)*LA*Math.PI,Zf=64,Xf=[Zf,32,16],fh=-LA,mh=LA,c3=[new Ko([fh,fh,fh],[mh,mh,mh]),new Ko([fh,fh,fh],[0,0,mh]),new Ko([0,fh,fh],[mh,0,mh]),new Ko([fh,0,fh],[0,mh,mh]),new Ko([0,0,fh],[mh,mh,mh])];function ZB(s,n,o,d=!0){const g=da([],s._camera.position,s.worldSize),v=[n,o,1,1];TA(v,v,s.pixelMatrixInverse),Lf(v,v,1/v[3]);const E=so([],bc([],v,g)),L=s.globeMatrix,k=[L[12],L[13],L[14]],V=bc([],k,g),q=dd(V),se=so([],V),he=s.worldSize/(2*Math.PI),_e=Ma(se,E),Be=Math.asin(he/q);if(Be<Math.acos(_e)){if(!d)return null;const Ki=[],gi=[];da(Ki,E,q/_e),so(gi,bc(gi,Ki,V)),so(E,Jh(E,V,da(E,gi,Math.tan(Be)*q)))}const Le=[];new Pf(g,E).closestPointOnSphere(k,he,Le);const Xe=so([],Gn(L,0)),xt=so([],Gn(L,1)),Dt=so([],Gn(L,2)),_t=Ma(Xe,Le),Tt=Ma(xt,Le),kt=Ma(Dt,Le),Ut=Et(Math.asin(-Tt/he));let ci=Et(Math.atan2(_t,kt));ci=s.center.lng+function(Ki,gi){const Si=(gi-Ki+180)%360-180;return Si<-180?Si+360:Si}(s.center.lng,ci);const oi=wc(ci),Ti=ye(ch(Ut),0,1);return new hd(oi,Ti)}class h3{constructor(n,o,d){this.a=bc([],n,d),this.b=bc([],o,d),this.center=d;const g=so([],this.a),v=so([],this.b);this.angle=Math.acos(Ma(g,v))}}function F1(s,n){if(s.angle===0)return null;let o;return o=s.a[n]===0?1/s.angle*.5*Math.PI:1/s.angle*Math.atan(s.b[n]/s.a[n]/Math.sin(s.angle)-1/Math.tan(s.angle)),o<0||o>1?null:function(d,g,v,E){const L=Math.sin(v);return d*(Math.sin((1-E)*v)/L)+g*(Math.sin(E*v)/L)}(s.a[n],s.b[n],s.angle,ye(o,0,1))+s.center[n]}function Lu(s){if(s.z<=1)return c3[s.z+2*s.y+s.x];const n=L1(m0(s));return Ko.fromPoints(n)}function Lp(s,n,o){return da(s,s,1-o),eu(s,s,n,o)}function XB(s,n){const o=Yf(n.zoom);if(o===0)return Lu(s);const d=m0(s),g=L1(d),v=wc(d.getWest())*n.worldSize,E=wc(d.getEast())*n.worldSize,L=ch(d.getNorth())*n.worldSize,k=ch(d.getSouth())*n.worldSize,V=[v,L,0],q=[E,L,0],se=[v,k,0],he=[E,k,0],_e=_g([],n.globeMatrix);return Ns(V,V,_e),Ns(q,q,_e),Ns(se,se,_e),Ns(he,he,_e),g[0]=Lp(g[0],se,o),g[1]=Lp(g[1],he,o),g[2]=Lp(g[2],q,o),g[3]=Lp(g[3],V,o),Ko.fromPoints(g)}function qB(s,n,o){for(const d of s)Ns(d,d,n),da(d,d,o)}function u3(s,n,o){const d=n/s.worldSize,g=s.globeMatrix;if(o.z<=1){const oi=Lu(o).getCorners();return qB(oi,g,d),Ko.fromPoints(oi)}const v=m0(o),E=L1(v);qB(E,g,d);const L=Number.MAX_VALUE,k=[-L,-L,-L],V=[L,L,L];if(v.contains(s.center)){for(const Ki of E)EA(V,V,Ki),fd(k,k,Ki);k[2]=0;const oi=s.point,Ti=[oi.x*d,oi.y*d,0];return EA(V,V,Ti),fd(k,k,Ti),new Ko(V,k)}const q=[g[12]*d,g[13]*d,g[14]*d],se=v.getCenter(),he=ye(s.center.lat,-85.051129,$a),_e=ye(se.lat,-85.051129,$a),Be=wc(s.center.lng),Le=ch(he);let Xe=Be-wc(se.lng);const xt=Le-ch(_e);Xe>.5?Xe-=1:Xe<-.5&&(Xe+=1);let Dt=0;Math.abs(Xe)>Math.abs(xt)?Dt=Xe>=0?1:3:(Dt=xt>=0?0:2,eu(q,q,[g[4]*d,g[5]*d,g[6]*d],-Math.sin(Ge(xt>=0?v.getSouth():v.getNorth()))*LA));const _t=E[Dt],Tt=E[(Dt+1)%4],kt=new h3(_t,Tt,q),Ut=[F1(kt,0)||_t[0],F1(kt,1)||_t[1],F1(kt,2)||_t[2]],ci=Yf(s.zoom);if(ci>0){const oi=function({x:Ki,y:gi,z:Si},Li,Vi,Zi,yi){const sn=1/(1<<Si);let Kn=Ki*sn,dn=Kn+sn,Ln=gi*sn,ln=Ln+sn,Xn=0;const Tr=(Kn+dn)/2-Zi;return Tr>.5?Xn=-1:Tr<-.5&&(Xn=1),Kn=((Kn+Xn)*Li-(Zi*=Li))*Vi+Zi,dn=((dn+Xn)*Li-Zi)*Vi+Zi,Ln=(Ln*Li-(yi*=Li))*Vi+yi,ln=(ln*Li-yi)*Vi+yi,[[Kn,ln,0],[dn,ln,0],[dn,Ln,0],[Kn,Ln,0]]}(o,n,s._pixelsPerMercatorPixel,Be,Le);for(let Ki=0;Ki<E.length;Ki++)Lp(E[Ki],oi[Ki],ci);const Ti=Jh([],oi[Dt],oi[(Dt+1)%4]);da(Ti,Ti,.5),Lp(Ut,Ti,ci)}for(const oi of E)EA(V,V,oi),fd(k,k,oi);return V[2]=Math.min(_t[2],Tt[2]),EA(V,V,Ut),fd(k,k,Ut),new Ko(V,k)}function m0({x:s,y:n,z:o}){const d=1/(1<<o),g=new Pr(bl(s*d),Fo((n+1)*d)),v=new Pr(bl((s+1)*d),Fo(n*d));return new wl(g,v)}function L1(s){const n=Ge(s.getNorth()),o=Ge(s.getSouth()),d=Math.cos(n),g=Math.cos(o),v=Math.sin(n),E=Math.sin(o),L=s.getWest(),k=s.getEast();return[qf(g,E,L),qf(g,E,k),qf(d,v,k),qf(d,v,L)]}function qf(s,n,o,d=LA){return o=Ge(o),[s*Math.sin(o)*d,-n*d,s*Math.cos(o)*d]}function Og(s,n,o){return qf(Math.cos(Ge(s)),Math.sin(Ge(s)),n,o)}function Ng(s,n,o,d){const g=1<<o.z,v=(s/Zn+o.x)/g;return Og(Fo((n/Zn+o.y)/g),bl(v),d)}function g0({min:s,max:n}){return 16383/Math.max(n[0]-s[0],n[1]-s[1],n[2]-s[2])}const YB=new Float64Array(16);function Qg(s){const n=g0(s),o=Gy(YB,[n,n,n]);return xp(o,o,((d=[])[0]=-(g=s.min)[0],d[1]=-g[1],d[2]=-g[2],d));var d,g}function D1(s){const n=(d=s.min,(o=YB)[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=d[0],o[13]=d[1],o[14]=d[2],o[15]=1,o);var o,d;const g=1/g0(s);return BA(n,n,[g,g,g])}function JB(s,n,o,d,g){const v=function(k){const V=Zn/(2*Math.PI);return k/(2*Math.PI)/V}(o),E=[s,n,-o/(2*Math.PI)],L=ql(new Float64Array(16));return xp(L,L,E),BA(L,L,[v,v,v]),yg(L,L,Ge(-g)),Ff(L,L,Ge(-d)),L}function Yf(s){return xe(5,6,s)}function eC(s,n){const o=Og(n.lat,n.lng),d=function(Be){const Le=Og(Be._center.lat,Be._center.lng);let Xe=md([],pd(0,1,0),Le);const xt=Wy([],-Be.angle,Le);Xe=Ns(Xe,Xe,xt),Wy(xt,-Be._pitch,Xe);const Dt=so([],Le);return da(Dt,Dt,Be.cameraToCenterDistance/Be.pixelsPerMeter*I1),Ns(Dt,Dt,xt),Jh([],Le,Dt)}(s);return E=(g=xg([],d,o))[0],L=g[1],k=g[2],V=(v=o)[0],q=v[1],se=v[2],_e=(he=Math.sqrt(E*E+L*L+k*k)*Math.sqrt(V*V+q*q+se*se))&&Ma(g,v)/he,Math.acos(Math.min(Math.max(_e,-1),1));var g,v,E,L,k,V,q,se,he,_e}function P1(s,n){return eC(s,n)>Math.PI/2*1.01}const tC=Ge(85),A3=Math.cos(tC),d3=Math.sin(tC);function iC(s,n){const o=s.fovAboveCenter,d=s.elevation?s.elevation.getMinElevationBelowMSL()*n:0,g=(s._camera.position[2]*s.worldSize-d)/Math.cos(s._pitch),v=Math.sin(o)*g/Math.sin(Math.max(Math.PI/2-s._pitch-o,.01)),E=Math.sin(s._pitch)*v+g;return Math.min(1.01*E,g*(1/s._horizonShift))}function Dp(s,n){if(!n.isReprojectedInTileSpace)return{scale:1<<s.z,x:s.x,y:s.y,x2:s.x+1,y2:s.y+1,projection:n};const o=Math.pow(2,-s.z),d=s.x*o,g=(s.x+1)*o,v=s.y*o,E=(s.y+1)*o,L=bl(d),k=bl(g),V=Fo(v),q=Fo(E),se=n.project(L,V),he=n.project(k,V),_e=n.project(k,q),Be=n.project(L,q);let Le=Math.min(se.x,he.x,_e.x,Be.x),Xe=Math.min(se.y,he.y,_e.y,Be.y),xt=Math.max(se.x,he.x,_e.x,Be.x),Dt=Math.max(se.y,he.y,_e.y,Be.y);const _t=o/16;function Tt(Ut,ci,oi,Ti,Ki,gi){const Si=(oi+Ki)/2,Li=(Ti+gi)/2,Vi=n.project(bl(Si),Fo(Li)),Zi=Math.max(0,Le-Vi.x,Xe-Vi.y,Vi.x-xt,Vi.y-Dt);Le=Math.min(Le,Vi.x),xt=Math.max(xt,Vi.x),Xe=Math.min(Xe,Vi.y),Dt=Math.max(Dt,Vi.y),Zi>_t&&(Tt(Ut,Vi,oi,Ti,Si,Li),Tt(Vi,ci,Si,Li,Ki,gi))}Tt(se,he,d,v,g,v),Tt(he,_e,g,v,g,E),Tt(_e,Be,g,E,d,E),Tt(Be,se,d,E,d,v),Le-=_t,Xe-=_t,xt+=_t,Dt+=_t;const kt=1/Math.max(xt-Le,Dt-Xe);return{scale:kt,x:Le*kt,y:Xe*kt,x2:xt*kt,y2:Dt*kt,projection:n}}const p3=ql(new Float32Array(16));class Id{constructor(n){this.spec=n,this.name=n.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(n,o){return{x:0,y:0,z:0}}unproject(n,o){return new Pr(0,0)}projectTilePoint(n,o,d){return{x:n,y:o,z:0}}locationPoint(n,o,d=!0){return n._coordinatePoint(n.locationCoordinate(o),d)}pixelsPerMeter(n,o){return Xl(1,n)*o}pixelSpaceConversion(n,o,d){return 1}farthestPixelDistance(n){return iC(n,n.pixelsPerMeter)}pointCoordinate(n,o,d,g){const v=n.horizonLineFromTop(!1),E=new me(o,Math.max(v,d));return n.rayIntersectionCoordinate(n.pointRayIntersection(E,g))}pointCoordinate3D(n,o,d){const g=new me(o,d);if(n.elevation)return n.elevation.pointCoordinate(g);{const v=this.pointCoordinate(n,g.x,g.y,0);return[v.x,v.y,v.z]}}isPointAboveHorizon(n,o){if(n.elevation)return!this.pointCoordinate3D(n,o.x,o.y);const d=n.horizonLineFromTop();return o.y<d}createInversionMatrix(n,o){return p3}createTileMatrix(n,o,d){let g,v,E;const L=d.canonical,k=ql(new Float64Array(16));if(this.isReprojectedInTileSpace){const V=Dp(L,this);g=1,v=V.x+d.wrap*V.scale,E=V.y,BA(k,k,[g/V.scale,g/V.scale,n.pixelsPerMeter/o])}else g=o/n.zoomScale(L.z),v=(L.x+Math.pow(2,L.z)*d.wrap)*g,E=L.y*g;return xp(k,k,[v,E,0]),BA(k,k,[g/Zn,g/Zn,1]),k}upVector(n,o,d){return[0,0,1]}upVectorScale(n,o,d){return{metersToTile:1}}}class f3 extends Id{constructor(n){super(n),this.range=[4,7],this.center=n.center||[-96,37.5];const[o,d]=this.parallels=n.parallels||[29.5,45.5],g=Math.sin(Ge(o));this.n=(g+Math.sin(Ge(d)))/2,this.c=1+g*(2*this.n-g),this.r0=Math.sqrt(this.c)/this.n}project(n,o){const{n:d,c:g,r0:v}=this,E=Ge(n-this.center[0]),L=Ge(o),k=Math.sqrt(g-2*d*Math.sin(L))/d;return{x:k*Math.sin(E*d),y:k*Math.cos(E*d)-v,z:0}}unproject(n,o){const{n:d,c:g,r0:v}=this,E=v+o;let L=Math.atan2(n,Math.abs(E))*Math.sign(E);E*d<0&&(L-=Math.PI*Math.sign(n)*Math.sign(E));const k=Ge(this.center[0])*d;L=Re(L,-Math.PI-k,Math.PI-k);const V=ye(Et(L/d)+this.center[0],-180,180),q=Math.asin(ye((g-(n*n+E*E)*d*d)/(2*d),-1,1)),se=ye(Et(q),-85.051129,$a);return new Pr(V,se)}}const Vg=1.340264,Hg=-.081106,Gg=893e-6,Wg=.003796,_0=Math.sqrt(3)/2;class m3 extends Id{project(n,o){o=o/180*Math.PI,n=n/180*Math.PI;const d=Math.asin(_0*Math.sin(o)),g=d*d,v=g*g*g;return{x:.5*(n*Math.cos(d)/(_0*(Vg+3*Hg*g+v*(7*Gg+9*Wg*g)))/Math.PI+.5),y:1-.5*(d*(Vg+Hg*g+v*(Gg+Wg*g))/Math.PI+1),z:0}}unproject(n,o){n=(2*n-.5)*Math.PI;let d=o=(2*(1-o)-1)*Math.PI,g=d*d,v=g*g*g;for(let q,se,he,_e=0;_e<12&&(se=d*(Vg+Hg*g+v*(Gg+Wg*g))-o,he=Vg+3*Hg*g+v*(7*Gg+9*Wg*g),q=se/he,d=ye(d-q,-Math.PI/3,Math.PI/3),g=d*d,v=g*g*g,!(Math.abs(q)<1e-12));++_e);const E=_0*n*(Vg+3*Hg*g+v*(7*Gg+9*Wg*g))/Math.cos(d),L=Math.asin(Math.sin(d)/_0),k=ye(180*E/Math.PI,-180,180),V=ye(180*L/Math.PI,-85.051129,$a);return new Pr(k,V)}}class g3 extends Id{constructor(n){super(n),this.wrap=!0,this.supportsWorldCopies=!0}project(n,o){return{x:.5+n/360,y:.5-o/360,z:0}}unproject(n,o){const d=360*(n-.5),g=ye(360*(.5-o),-85.051129,$a);return new Pr(d,g)}}const Jf=Math.PI/2;function y0(s){return Math.tan((Jf+s)/2)}class _3 extends Id{constructor(n){super(n),this.center=n.center||[0,30];const[o,d]=this.parallels=n.parallels||[30,30];let g=Ge(o),v=Ge(d);this.southernCenter=g+v<0,this.southernCenter&&(g=-g,v=-v);const E=Math.cos(g),L=y0(g);this.n=g===v?Math.sin(g):Math.log(E/Math.cos(v))/Math.log(y0(v)/L),this.f=E*Math.pow(y0(g),this.n)/this.n}project(n,o){o=Ge(o),this.southernCenter&&(o=-o),n=Ge(n-this.center[0]);const d=1e-6,{n:g,f:v}=this;v>0?o<-Jf+d&&(o=-Jf+d):o>Jf-d&&(o=Jf-d);const E=v/Math.pow(y0(o),g);let L=E*Math.sin(g*n),k=v-E*Math.cos(g*n);return L=.5*(L/Math.PI+.5),k=.5*(k/Math.PI+.5),{x:L,y:this.southernCenter?k:1-k,z:0}}unproject(n,o){n=(2*n-.5)*Math.PI,this.southernCenter&&(o=1-o),o=(2*(1-o)-.5)*Math.PI;const{n:d,f:g}=this,v=g-o,E=Math.sign(v),L=Math.sign(d)*Math.sqrt(n*n+v*v);let k=Math.atan2(n,Math.abs(v))*E;v*d<0&&(k-=Math.PI*Math.sign(n)*E);const V=ye(Et(k/d)+this.center[0],-180,180),q=ye(Et(2*Math.atan(Math.pow(g/L,1/d))-Jf),-85.051129,$a);return new Pr(V,this.southernCenter?-q:q)}}class nC extends Id{constructor(n){super(n),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(n,o){return{x:wc(n),y:ch(o),z:0}}unproject(n,o){const d=bl(n),g=Fo(o);return new Pr(d,g)}}const rC=Ge($a);class y3 extends Id{project(n,o){const d=(o=Ge(o))*o,g=d*d;return{x:.5*((n=Ge(n))*(.8707-.131979*d+g*(g*(.003971*d-.001529*g)-.013791))/Math.PI+.5),y:1-.5*(o*(1.007226+d*(.015085+g*(.028874*d-.044475-.005916*g)))/Math.PI+1),z:0}}unproject(n,o){n=(2*n-.5)*Math.PI;let d=o=(2*(1-o)-1)*Math.PI,g=25,v=0,E=d*d;do{E=d*d;const V=E*E;v=(d*(1.007226+E*(.015085+V*(.028874*E-.044475-.005916*V)))-o)/(1.007226+E*(.045255+V*(.259866*E-.311325-.005916*11*V))),d=ye(d-v,-rC,rC)}while(Math.abs(v)>1e-6&&--g>0);E=d*d;const L=ye(Et(n/(.8707+E*(E*(E*E*E*(.003971-.001529*E)-.013791)-.131979))),-180,180),k=Et(d);return new Pr(L,k)}}const sC=Ge($a);class x3 extends Id{project(n,o){o=Ge(o),n=Ge(n);const d=Math.cos(o),g=2/Math.PI,v=Math.acos(d*Math.cos(n/2)),E=Math.sin(v)/v,L=.5*(n*g+2*d*Math.sin(n/2)/E)||0,k=.5*(o+Math.sin(o)/E)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(k/Math.PI+1),z:0}}unproject(n,o){let d=n=(2*n-.5)*Math.PI,g=o=(2*(1-o)-1)*Math.PI,v=25;const E=1e-6;let L=0,k=0;do{const V=Math.cos(g),q=Math.sin(g),se=2*q*V,he=q*q,_e=V*V,Be=Math.cos(d/2),Le=Math.sin(d/2),Xe=2*Be*Le,xt=Le*Le,Dt=1-_e*Be*Be,_t=Dt?1/Dt:0,Tt=Dt?Math.acos(V*Be)*Math.sqrt(1/Dt):0,kt=.5*(2*Tt*V*Le+2*d/Math.PI)-n,Ut=.5*(Tt*q+g)-o,ci=.5*_t*(_e*xt+Tt*V*Be*he)+1/Math.PI,oi=_t*(Xe*se/4-Tt*q*Le),Ti=.125*_t*(se*Le-Tt*q*_e*Xe),Ki=.5*_t*(he*Be+Tt*xt*V)+.5,gi=oi*Ti-Ki*ci;L=(Ut*oi-kt*Ki)/gi,k=(kt*Ti-Ut*ci)/gi,d=ye(d-L,-Math.PI,Math.PI),g=ye(g-k,-sC,sC)}while((Math.abs(L)>E||Math.abs(k)>E)&&--v>0);return new Pr(Et(d),Et(g))}}class oC extends Id{constructor(n){super(n),this.center=n.center||[0,0],this.parallels=n.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Ge(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(n,o){const{scale:d,cosPhi:g}=this;return{x:Ge(n)*g*d+.5,y:-Math.sin(Ge(o))/g*d+.5,z:0}}unproject(n,o){const{scale:d,cosPhi:g}=this,v=-(o-.5)/d,E=ye(Et((n-.5)/d)/g,-180,180),L=Math.asin(ye(v*g,-1,1)),k=ye(Et(L),-85.051129,$a);return new Pr(E,k)}}class v3 extends nC{constructor(n){super(n),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(n,o,d){const g=Ng(n,o,d);return Ns(g,g,Qg(Lu(d))),{x:g[0],y:g[1],z:g[2]}}locationPoint(n,o){const d=Og(o.lat,o.lng),g=so([],d),v=n.elevation?n.elevation.getAtPointOrZero(n.locationCoordinate(o),n._centerAltitude):n._centerAltitude;eu(d,d,g,Xl(1,0)*Zn*v);const E=ql(new Float64Array(16));return bA(E,n.pixelMatrix,n.globeMatrix),Ns(d,d,E),new me(d[0],d[1])}pixelsPerMeter(n,o){return Xl(1,0)*o}pixelSpaceConversion(n,o,d){const g=Xl(1,n)*o,v=gr(Xl(1,45)*o,g,d);return this.pixelsPerMeter(n,o)/v}createTileMatrix(n,o,d){const g=D1(Lu(d.canonical));return bA(new Float64Array(16),n.globeMatrix,g)}createInversionMatrix(n,o){const{center:d}=n,g=Qg(Lu(o));return Ff(g,g,Ge(d.lng)),yg(g,g,Ge(d.lat)),BA(g,g,[n._pixelsPerMercatorPixel,n._pixelsPerMercatorPixel,1]),Float32Array.from(g)}pointCoordinate(n,o,d,g){return ZB(n,o,d,!0)||new hd(0,0)}pointCoordinate3D(n,o,d){const g=this.pointCoordinate(n,o,d,0);return[g.x,g.y,g.z]}isPointAboveHorizon(n,o){return!ZB(n,o.x,o.y,!1)}farthestPixelDistance(n){const o=function(g,v){const E=g.cameraToCenterDistance,L=g._centerAltitude*v,k=g._camera,V=g._camera.forward(),q=Jh([],da([],V,-E),[0,0,L]),se=g.worldSize/(2*Math.PI),he=[0,0,-se],_e=g.width/g.height,Be=Math.tan(g.fovAboveCenter),Le=da([],k.up(),Be),Xe=da([],k.right(),Be*_e),xt=so([],Jh([],Jh([],V,Le),Xe)),Dt=[];let _t;if(new Pf(q,xt).closestPointOnSphere(he,se,Dt)){const Tt=Jh([],Dt,he),kt=bc([],Tt,q);_t=Math.cos(g.fovAboveCenter)*dd(kt)}else{const Tt=bc([],q,he),kt=bc([],he,q);so(kt,kt);const Ut=dd(Tt)-se;_t=Math.sqrt(Ut*(Ut+2*se));const ci=Math.acos(_t/(se+Ut))-Math.acos(Ma(V,kt));_t*=Math.cos(ci)}return 1.01*_t}(n,this.pixelsPerMeter(n.center.lat,n.worldSize)),d=Yf(n.zoom);if(d>0){const g=iC(n,Xl(1,n.center.lat)*n.worldSize),v=n.worldSize/(2*Math.PI),E=Math.max(n.width,n.height)/n.worldSize*Math.PI;return gr(o,g+v*(1-Math.cos(E)),Math.pow(d,10))}return o}upVector(n,o,d){return Ng(o,d,n,1)}upVectorScale(n){return{metersToTile:I1*g0(Lu(n))}}}function aC(s){const n=s.parallels,o=!!n&&Math.abs(n[0]+n[1])<.01;switch(s.name){case"mercator":return new nC(s);case"equirectangular":return new g3(s);case"naturalEarth":return new y3(s);case"equalEarth":return new m3(s);case"winkelTripel":return new x3(s);case"albers":return o?new oC(s):new f3(s);case"lambertConformalConic":return o?new oC(s):new _3(s);case"globe":return new v3(s)}throw new Error(`Invalid projection name: ${s.name}`)}const w3=w.types,b3=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function x0(s,n,o,d,g,v,E,L,k,V,q,se,he){const _e=L?Math.min(Md,Math.round(L[0])):0,Be=L?Math.min(Md,Math.round(L[1])):0;s.emplaceBack(n,o,Math.round(32*d),Math.round(32*g),v,E,(_e<<1)+(k?1:0),Be,16*V,16*q,256*se,256*he)}function v0(s,n,o,d,g,v,E){s.emplaceBack(n,o,d,g,v,E)}function w0(s,n,o,d,g){s.emplaceBack(n,o,d,g),s.emplaceBack(n,o,d,g),s.emplaceBack(n,o,d,g),s.emplaceBack(n,o,d,g)}function B3(s){for(const n of s.sections)if(st(n.text))return!0;return!1}class U1{constructor(n){this.layoutVertexArray=new Xr,this.indexArray=new _o,this.programConfigurations=n,this.segments=new to,this.dynamicLayoutVertexArray=new Ca,this.opacityVertexArray=new Fs,this.placedSymbolArray=new Ty,this.globeExtVertexArray=new Fr}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(n,o,d,g){this.isEmpty()||(d&&(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Lo.members),this.indexBuffer=n.createIndexBuffer(this.indexArray,o),this.dynamicLayoutVertexBuffer=n.createVertexBuffer(this.dynamicLayoutVertexArray,Ia.members,!0),this.opacityVertexBuffer=n.createVertexBuffer(this.opacityVertexArray,b3,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=n.createVertexBuffer(this.globeExtVertexArray,$o.members,!0)),this.opacityVertexBuffer.itemSize=1),(d||g)&&this.programConfigurations.upload(n))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}zt(U1,"SymbolBuffers");class R1{constructor(n,o,d){this.layoutVertexArray=new n,this.layoutAttributes=o,this.indexArray=new d,this.segments=new to,this.collisionVertexArray=new Bu,this.collisionVertexArrayExt=new ja}upload(n){this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=n.createVertexBuffer(this.collisionVertexArray,io.members,!0),this.collisionVertexBufferExt=n.createVertexBuffer(this.collisionVertexArrayExt,Do.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}zt(R1,"CollisionBuffers");class Fd{constructor(n){this.collisionBoxArray=n.collisionBoxArray,this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(E=>E.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ql([]),this.placementViewportMatrix=ql([]);const o=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ms(this.zoom,o["text-size"]),this.iconSizeData=ms(this.zoom,o["icon-size"]);const d=this.layers[0].layout,g=d.get("symbol-sort-key"),v=d.get("symbol-z-order");this.canOverlap=d.get("text-allow-overlap")||d.get("icon-allow-overlap")||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&g.constantOr(1)!==void 0,this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=d.get("text-writing-mode").map(E=>qo[E]),this.stateDependentLayerIds=this.layers.filter(E=>E.isStateDependent()).map(E=>E.id),this.sourceID=n.sourceID,this.projection=n.projection}createArrays(){this.text=new U1(new _A(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new U1(new _A(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new og,this.lineVertexArray=new Cu,this.symbolInstances=new Ap}calculateGlyphDependencies(n,o,d,g,v){for(let E=0;E<n.length;E++)if(o[n.charCodeAt(E)]=!0,g&&v){const L=ao[n.charAt(E)];L&&(o[L.charCodeAt(0)]=!0)}}populate(n,o,d,g){const v=this.layers[0],E=v.layout,L=this.projection.name==="globe",k=E.get("text-font"),V=E.get("text-field"),q=E.get("icon-image"),se=(V.value.kind!=="constant"||V.value.value instanceof ks&&!V.value.value.isEmpty()||V.value.value.toString().length>0)&&(k.value.kind!=="constant"||k.value.value.length>0),he=q.value.kind!=="constant"||!!q.value.value||Object.keys(q.parameters).length>0,_e=E.get("symbol-sort-key");if(this.features=[],!se&&!he)return;const Be=o.iconDependencies,Le=o.glyphDependencies,Xe=o.availableImages,xt=new qt(this.zoom);for(const{feature:Dt,id:_t,index:Tt,sourceLayerIndex:kt}of n){const Ut=v._featureFilter.needGeometry,ci=xA(Dt,Ut);if(!v._featureFilter.filter(xt,ci,d))continue;if(Ut||(ci.geometry=Yh(Dt,d,g)),L&&Dt.type!==1&&d.z<=5){const gi=ci.geometry,Si=.98078528056,Li=(Vi,Zi)=>Ma(Ng(Vi.x,Vi.y,d,1),Ng(Zi.x,Zi.y,d,1))<Si;for(let Vi=0;Vi<gi.length;Vi++)gi[Vi]=ky(gi[Vi],Li)}let oi,Ti;if(se){const gi=v.getValueAndResolveTokens("text-field",ci,d,Xe),Si=ks.factory(gi);B3(Si)&&(this.hasRTLText=!0),(!this.hasRTLText||Ht()==="unavailable"||this.hasRTLText&&si.isParsed())&&(oi=Uo(Si,v,ci))}if(he){const gi=v.getValueAndResolveTokens("icon-image",ci,d,Xe);Ti=gi instanceof No?gi:No.fromString(gi)}if(!oi&&!Ti)continue;const Ki=this.sortFeaturesByKey?_e.evaluate(ci,{},d):void 0;if(this.features.push({id:_t,text:oi,icon:Ti,index:Tt,sourceLayerIndex:kt,geometry:ci.geometry,properties:Dt.properties,type:w3[Dt.type],sortKey:Ki}),Ti&&(Be[Ti.name]=!0),oi){const gi=k.evaluate(ci,{},d).join(","),Si=E.get("text-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(qo.vertical)>=0;for(const Li of oi.sections)if(Li.image)Be[Li.image.name]=!0;else{const Vi=H(oi.toString()),Zi=Li.fontStack||gi,yi=Le[Zi]=Le[Zi]||{};this.calculateGlyphDependencies(Li.text,yi,Si,this.allowVerticalPlacement,Vi)}}}E.get("symbol-placement")==="line"&&(this.features=function(Dt){const _t={},Tt={},kt=[];let Ut=0;function ci(gi){kt.push(Dt[gi]),Ut++}function oi(gi,Si,Li){const Vi=Tt[gi];return delete Tt[gi],Tt[Si]=Vi,kt[Vi].geometry[0].pop(),kt[Vi].geometry[0]=kt[Vi].geometry[0].concat(Li[0]),Vi}function Ti(gi,Si,Li){const Vi=_t[Si];return delete _t[Si],_t[gi]=Vi,kt[Vi].geometry[0].shift(),kt[Vi].geometry[0]=Li[0].concat(kt[Vi].geometry[0]),Vi}function Ki(gi,Si,Li){const Vi=Li?Si[0][Si[0].length-1]:Si[0][0];return`${gi}:${Vi.x}:${Vi.y}`}for(let gi=0;gi<Dt.length;gi++){const Si=Dt[gi],Li=Si.geometry,Vi=Si.text?Si.text.toString():null;if(!Vi){ci(gi);continue}const Zi=Ki(Vi,Li),yi=Ki(Vi,Li,!0);if(Zi in Tt&&yi in _t&&Tt[Zi]!==_t[yi]){const sn=Ti(Zi,yi,Li),Kn=oi(Zi,yi,kt[sn].geometry);delete _t[Zi],delete Tt[yi],Tt[Ki(Vi,kt[Kn].geometry,!0)]=Kn,kt[sn].geometry=null}else Zi in Tt?oi(Zi,yi,Li):yi in _t?Ti(Zi,yi,Li):(ci(gi),_t[Zi]=Ut-1,Tt[yi]=Ut-1)}return kt.filter(gi=>gi.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Dt,_t)=>Dt.sortKey-_t.sortKey)}update(n,o,d,g){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,o,this.layers,d,g),this.icon.programConfigurations.updatePaintArrays(n,o,this.layers,d,g))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=aC(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(n,o){const d=this.lineVertexArray.length;if(n.segment!==void 0)for(const{x:g,y:v}of o)this.lineVertexArray.emplaceBack(g,v);return{lineStartIndex:d,lineLength:this.lineVertexArray.length-d}}addSymbols(n,o,d,g,v,E,L,k,V,q,se,he,_e,Be){const Le=n.indexArray,Xe=n.layoutVertexArray,xt=n.globeExtVertexArray,Dt=n.segments.prepareSegment(4*o.length,Xe,Le,this.canOverlap?E.sortKey:void 0),_t=this.glyphOffsetArray.length,Tt=Dt.vertexLength,kt=this.allowVerticalPlacement&&L===qo.vertical?Math.PI/2:0,Ut=E.text&&E.text.sections;for(let oi=0;oi<o.length;oi++){const{tl:Ti,tr:Ki,bl:gi,br:Si,tex:Li,pixelOffsetTL:Vi,pixelOffsetBR:Zi,minFontScaleX:yi,minFontScaleY:sn,glyphOffset:Kn,isSDF:dn,sectionIndex:Ln}=o[oi],ln=Dt.vertexLength,Xn=Kn[1];if(x0(Xe,V.x,V.y,Ti.x,Xn+Ti.y,Li.x,Li.y,d,dn,Vi.x,Vi.y,yi,sn),x0(Xe,V.x,V.y,Ki.x,Xn+Ki.y,Li.x+Li.w,Li.y,d,dn,Zi.x,Vi.y,yi,sn),x0(Xe,V.x,V.y,gi.x,Xn+gi.y,Li.x,Li.y+Li.h,d,dn,Vi.x,Zi.y,yi,sn),x0(Xe,V.x,V.y,Si.x,Xn+Si.y,Li.x+Li.w,Li.y+Li.h,d,dn,Zi.x,Zi.y,yi,sn),k){const{x:Tr,y:wr,z:xr}=k.anchor,[Jn,es,ir]=k.up;v0(xt,Tr,wr,xr,Jn,es,ir),v0(xt,Tr,wr,xr,Jn,es,ir),v0(xt,Tr,wr,xr,Jn,es,ir),v0(xt,Tr,wr,xr,Jn,es,ir),w0(n.dynamicLayoutVertexArray,Tr,wr,xr,kt)}else w0(n.dynamicLayoutVertexArray,V.x,V.y,V.z,kt);Le.emplaceBack(ln,ln+1,ln+2),Le.emplaceBack(ln+1,ln+2,ln+3),Dt.vertexLength+=4,Dt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Kn[0]),oi!==o.length-1&&Ln===o[oi+1].sectionIndex||n.programConfigurations.populatePaintArrays(Xe.length,E,E.index,{},_e,Be,Ut&&Ut[Ln])}const ci=k?k.anchor:V;n.placedSymbolArray.emplaceBack(ci.x,ci.y,ci.z,V.x,V.y,_t,this.glyphOffsetArray.length-_t,Tt,q,se,V.segment,d?d[0]:0,d?d[1]:0,g[0],g[1],L,0,!1,0,he,0)}_commitLayoutVertex(n,o,d,g,v,E,L){n.emplaceBack(o,d,g,v,E,Math.round(L.x),Math.round(L.y))}_addCollisionDebugVertices(n,o,d,g,v,E,L){const k=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),V=k.vertexLength,q=L.tileAnchorX,se=L.tileAnchorY;for(let _e=0;_e<4;_e++)d.collisionVertexArray.emplaceBack(0,0,0,0);d.collisionVertexArrayExt.emplaceBack(o,-n.padding,-n.padding),d.collisionVertexArrayExt.emplaceBack(o,n.padding,-n.padding),d.collisionVertexArrayExt.emplaceBack(o,n.padding,n.padding),d.collisionVertexArrayExt.emplaceBack(o,-n.padding,n.padding),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x1,n.y1)),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x2,n.y1)),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x2,n.y2)),this._commitLayoutVertex(d.layoutVertexArray,g,v,E,q,se,new me(n.x1,n.y2)),k.vertexLength+=4;const he=d.indexArray;he.emplaceBack(V,V+1),he.emplaceBack(V+1,V+2),he.emplaceBack(V+2,V+3),he.emplaceBack(V+3,V),k.primitiveLength+=4}_addTextDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceTextSize(n,E,o,L);this._addCollisionDebugVertices(k,V,this.textCollisionBox,k.projectedAnchorX,k.projectedAnchorY,k.projectedAnchorZ,E)}}_addIconDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceIconSize(n,o,E.placedIconSymbolIndex);this._addCollisionDebugVertices(k,V,this.iconCollisionBox,k.projectedAnchorX,k.projectedAnchorY,k.projectedAnchorZ,E)}}generateCollisionDebugBuffers(n,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new R1(ns,Po.members,Ka),this.iconCollisionBox=new R1(ns,Po.members,Ka);const d=pr(this.iconSizeData,n),g=pr(this.textSizeData,n);for(let v=0;v<this.symbolInstances.length;v++){const E=this.symbolInstances.get(v);this._addTextDebugCollisionBoxes(g,n,o,E.textBoxStartIndex,E.textBoxEndIndex,E),this._addTextDebugCollisionBoxes(g,n,o,E.verticalTextBoxStartIndex,E.verticalTextBoxEndIndex,E),this._addIconDebugCollisionBoxes(d,n,o,E.iconBoxStartIndex,E.iconBoxEndIndex,E),this._addIconDebugCollisionBoxes(d,n,o,E.verticalIconBoxStartIndex,E.verticalIconBoxEndIndex,E)}}getSymbolInstanceTextSize(n,o,d,g){const v=this.text.placedSymbolArray.get(o.rightJustifiedTextSymbolIndex>=0?o.rightJustifiedTextSymbolIndex:o.centerJustifiedTextSymbolIndex>=0?o.centerJustifiedTextSymbolIndex:o.leftJustifiedTextSymbolIndex>=0?o.leftJustifiedTextSymbolIndex:o.verticalPlacedTextSymbolIndex>=0?o.verticalPlacedTextSymbolIndex:g),E=$s(this.textSizeData,n,v)/Jr;return this.tilePixelRatio*E}getSymbolInstanceIconSize(n,o,d){const g=this.icon.placedSymbolArray.get(d),v=$s(this.iconSizeData,n,g);return this.tilePixelRatio*v}_commitDebugCollisionVertexUpdate(n,o,d){n.emplaceBack(o,-d,-d),n.emplaceBack(o,d,-d),n.emplaceBack(o,d,d),n.emplaceBack(o,-d,d)}_updateTextDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceTextSize(n,E,o,L);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,V,k.padding)}}_updateIconDebugCollisionBoxes(n,o,d,g,v,E){for(let L=g;L<v;L++){const k=d.get(L),V=this.getSymbolInstanceIconSize(n,o,E);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,V,k.padding)}}updateCollisionDebugBuffers(n,o){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const d=pr(this.iconSizeData,n),g=pr(this.textSizeData,n);for(let v=0;v<this.symbolInstances.length;v++){const E=this.symbolInstances.get(v);this._updateTextDebugCollisionBoxes(g,n,o,E.textBoxStartIndex,E.textBoxEndIndex,E),this._updateTextDebugCollisionBoxes(g,n,o,E.verticalTextBoxStartIndex,E.verticalTextBoxEndIndex,E),this._updateIconDebugCollisionBoxes(d,n,o,E.iconBoxStartIndex,E.iconBoxEndIndex,E.placedIconSymbolIndex),this._updateIconDebugCollisionBoxes(d,n,o,E.verticalIconBoxStartIndex,E.verticalIconBoxEndIndex,E.placedIconSymbolIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(n,o,d,g,v,E,L,k,V){const q={};if(o<d){const{x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(o);q.textBox={x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.textFeatureIndex=kt}if(g<v){const{x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(g);q.verticalTextBox={x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.verticalTextFeatureIndex=kt}if(E<L){const{x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(E);q.iconBox={x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.iconFeatureIndex=kt}if(k<V){const{x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt,featureIndex:kt}=n.get(k);q.verticalIconBox={x1:se,y1:he,x2:_e,y2:Be,padding:Le,projectedAnchorX:Xe,projectedAnchorY:xt,projectedAnchorZ:Dt,tileAnchorX:_t,tileAnchorY:Tt},q.verticalIconFeatureIndex=kt}return q}deserializeCollisionBoxes(n){this.collisionArrays=[];for(let o=0;o<this.symbolInstances.length;o++){const d=this.symbolInstances.get(o);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(n,d.textBoxStartIndex,d.textBoxEndIndex,d.verticalTextBoxStartIndex,d.verticalTextBoxEndIndex,d.iconBoxStartIndex,d.iconBoxEndIndex,d.verticalIconBoxStartIndex,d.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(n,o){const d=n.placedSymbolArray.get(o),g=d.vertexStartIndex+4*d.numGlyphs;for(let v=d.vertexStartIndex;v<g;v+=4)n.indexArray.emplaceBack(v,v+1,v+2),n.indexArray.emplaceBack(v+1,v+2,v+3)}getSortedSymbolIndexes(n){if(this.sortedAngle===n&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const o=Math.sin(n),d=Math.cos(n),g=[],v=[],E=[];for(let L=0;L<this.symbolInstances.length;++L){E.push(L);const k=this.symbolInstances.get(L);g.push(0|Math.round(o*k.tileAnchorX+d*k.tileAnchorY)),v.push(k.featureIndex)}return E.sort((L,k)=>g[L]-g[k]||v[k]-v[L]),E}addToSortKeyRanges(n,o){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===o?d.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:o,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const o of this.symbolInstanceIndexes){const d=this.symbolInstances.get(o);this.featureSortOrder.push(d.featureIndex);const{rightJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:v,leftJustifiedTextSymbolIndex:E,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:k,verticalPlacedIconSymbolIndex:V}=d;g>=0&&this.addIndicesForPlacedSymbol(this.text,g),v>=0&&v!==g&&this.addIndicesForPlacedSymbol(this.text,v),E>=0&&E!==v&&E!==g&&this.addIndicesForPlacedSymbol(this.text,E),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),k>=0&&this.addIndicesForPlacedSymbol(this.icon,k),V>=0&&this.addIndicesForPlacedSymbol(this.icon,V)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}zt(Fd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Fd.MAX_GLYPHS=65535,Fd.addDynamicAttributes=w0;const C3=new Hn({"symbol-placement":new Jt(Yt.layout_symbol["symbol-placement"]),"symbol-spacing":new Jt(Yt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Jt(Yt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new pi(Yt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Jt(Yt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Jt(Yt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Jt(Yt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Jt(Yt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Jt(Yt.layout_symbol["icon-rotation-alignment"]),"icon-size":new pi(Yt.layout_symbol["icon-size"]),"icon-text-fit":new Jt(Yt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Jt(Yt.layout_symbol["icon-text-fit-padding"]),"icon-image":new pi(Yt.layout_symbol["icon-image"]),"icon-rotate":new pi(Yt.layout_symbol["icon-rotate"]),"icon-padding":new Jt(Yt.layout_symbol["icon-padding"]),"icon-keep-upright":new Jt(Yt.layout_symbol["icon-keep-upright"]),"icon-offset":new pi(Yt.layout_symbol["icon-offset"]),"icon-anchor":new pi(Yt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Jt(Yt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Jt(Yt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Jt(Yt.layout_symbol["text-rotation-alignment"]),"text-field":new pi(Yt.layout_symbol["text-field"]),"text-font":new pi(Yt.layout_symbol["text-font"]),"text-size":new pi(Yt.layout_symbol["text-size"]),"text-max-width":new pi(Yt.layout_symbol["text-max-width"]),"text-line-height":new pi(Yt.layout_symbol["text-line-height"]),"text-letter-spacing":new pi(Yt.layout_symbol["text-letter-spacing"]),"text-justify":new pi(Yt.layout_symbol["text-justify"]),"text-radial-offset":new pi(Yt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Jt(Yt.layout_symbol["text-variable-anchor"]),"text-anchor":new pi(Yt.layout_symbol["text-anchor"]),"text-max-angle":new Jt(Yt.layout_symbol["text-max-angle"]),"text-writing-mode":new Jt(Yt.layout_symbol["text-writing-mode"]),"text-rotate":new pi(Yt.layout_symbol["text-rotate"]),"text-padding":new Jt(Yt.layout_symbol["text-padding"]),"text-keep-upright":new Jt(Yt.layout_symbol["text-keep-upright"]),"text-transform":new pi(Yt.layout_symbol["text-transform"]),"text-offset":new pi(Yt.layout_symbol["text-offset"]),"text-allow-overlap":new Jt(Yt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Jt(Yt.layout_symbol["text-ignore-placement"]),"text-optional":new Jt(Yt.layout_symbol["text-optional"])});var z1={paint:new Hn({"icon-opacity":new pi(Yt.paint_symbol["icon-opacity"]),"icon-color":new pi(Yt.paint_symbol["icon-color"]),"icon-halo-color":new pi(Yt.paint_symbol["icon-halo-color"]),"icon-halo-width":new pi(Yt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new pi(Yt.paint_symbol["icon-halo-blur"]),"icon-translate":new Jt(Yt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Jt(Yt.paint_symbol["icon-translate-anchor"]),"text-opacity":new pi(Yt.paint_symbol["text-opacity"]),"text-color":new pi(Yt.paint_symbol["text-color"],{runtimeType:aa,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new pi(Yt.paint_symbol["text-halo-color"]),"text-halo-width":new pi(Yt.paint_symbol["text-halo-width"]),"text-halo-blur":new pi(Yt.paint_symbol["text-halo-blur"]),"text-translate":new Jt(Yt.paint_symbol["text-translate"]),"text-translate-anchor":new Jt(Yt.paint_symbol["text-translate-anchor"])}),layout:C3};class lC{constructor(n){this.type=n.property.overrides?n.property.overrides.runtimeType:or,this.defaultValue=n}evaluate(n){if(n.formattedSection){const o=this.defaultValue.property.overrides;if(o&&o.hasOverride(n.formattedSection))return o.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}zt(lC,"FormatSectionOverride",{omit:["defaultValue"]});class b0 extends vc{constructor(n){super(n,z1)}recalculate(n,o){super.recalculate(n,o),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const d=this.layout.get("text-writing-mode");if(d){const g=[];for(const v of d)g.indexOf(v)<0&&g.push(v);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(n,o,d,g){const v=this.layout.get(n).evaluate(o,{},d,g),E=this._unevaluatedLayout._values[n];return E.isDataDriven()||yc(E.value)||!v?v:function(L,k){return k.replace(/{([^{}]+)}/g,(V,q)=>q in L?String(L[q]):"")}(o.properties,v)}createBucket(n){return new Fd(n)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const n of z1.paint.overridableProperties){if(!b0.hasPaintOverride(this.layout,n))continue;const o=this.paint.get(n),d=new lC(o),g=new ih(d,o.property.specification);let v=null;v=o.value.kind==="constant"||o.value.kind==="source"?new fo("source",g):new Gh("composite",g,o.value.zoomStops,o.value._interpolationType),this.paint._values[n]=new Mi(o.property,v,o.parameters)}}_handleOverridablePaintPropertyUpdate(n,o,d){return!(!this.layout||o.isDataDriven()||d.isDataDriven())&&b0.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,o){const d=n.get("text-field"),g=z1.paint.properties[o];let v=!1;const E=L=>{for(const k of L)if(g.overrides&&g.overrides.hasOverride(k))return void(v=!0)};if(d.value.kind==="constant"&&d.value.value instanceof ks)E(d.value.value.sections);else if(d.value.kind==="source"){const L=V=>{v||(V instanceof oc&&Bs(V.value)===Rl?E(V.value.sections):V instanceof hl?E(V.sections):V.eachChild(L))},k=d.value;k._styleExpression&&L(k._styleExpression.expression)}return v}getProgramConfiguration(n){return new lh(this,n)}}var E3={paint:new Hn({"background-color":new Jt(Yt.paint_background["background-color"]),"background-pattern":new Jt(Yt.paint_background["background-pattern"]),"background-opacity":new Jt(Yt.paint_background["background-opacity"])})},T3={paint:new Hn({"raster-opacity":new Jt(Yt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Jt(Yt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Jt(Yt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Jt(Yt.paint_raster["raster-brightness-max"]),"raster-saturation":new Jt(Yt.paint_raster["raster-saturation"]),"raster-contrast":new Jt(Yt.paint_raster["raster-contrast"]),"raster-resampling":new Jt(Yt.paint_raster["raster-resampling"]),"raster-fade-duration":new Jt(Yt.paint_raster["raster-fade-duration"])})};class S3 extends vc{constructor(n){super(n,{}),this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(n){this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)}onRemove(n){this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)}}var M3={paint:new Hn({"sky-type":new Jt(Yt.paint_sky["sky-type"]),"sky-atmosphere-sun":new Jt(Yt.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Jt(Yt.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Jt(Yt.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Jt(Yt.paint_sky["sky-gradient-radius"]),"sky-gradient":new In(Yt.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Jt(Yt.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Jt(Yt.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Jt(Yt.paint_sky["sky-opacity"])})};function k1(s,n,o){const d=[0,0,1],g=bg([]);return Bg(g,g,o?-Ge(s)+Math.PI:Ge(s)),uh(g,g,-Ge(n)),wg(d,d,g),so(d,d)}const I3={circle:class extends vc{constructor(s){super(s,gg)}createBucket(s){return new gp(s)}queryRadius(s){const n=s;return Su("circle-radius",this,n)+Su("circle-stroke-width",this,n)+_p(this.paint.get("circle-translate"))}queryIntersectsFeature(s,n,o,d,g,v,E,L){const k=Yr(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),V=this.paint.get("circle-radius").evaluate(n,o)+this.paint.get("circle-stroke-width").evaluate(n,o);return Zy(s,d,v,E,L,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",k,V)}getProgramIds(){return["circle"]}getProgramConfiguration(s){return new lh(this,s)}},heatmap:class extends vc{createBucket(s){return new vp(s)}constructor(s){super(s,u1),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Tg({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(s){return Su("heatmap-radius",this,s)}queryIntersectsFeature(s,n,o,d,g,v,E,L){const k=this.paint.get("heatmap-radius").evaluate(n,o);return Zy(s,d,v,E,L,!0,!0,new me(0,0),k)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(s){return new lh(this,s)}},hillshade:class extends vc{constructor(s){super(s,A1)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends vc{constructor(s){super(s,r0)}getProgramIds(){const s=this.paint.get("fill-pattern"),n=s&&s.constantOr(1),o=[n?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&o.push(n&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),o}getProgramConfiguration(s){return new lh(this,s)}recalculate(s,n){super.recalculate(s,n);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new Mp(s)}queryRadius(){return _p(this.paint.get("fill-translate"))}queryIntersectsFeature(s,n,o,d,g,v){return!s.queryGeometry.isAboveHorizon&&Ag(mg(s.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),d)}isTileClipped(){return!0}},"fill-extrusion":class extends vc{constructor(s){super(s,ui)}createBucket(s){return new Ce(s)}queryRadius(){return _p(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(s){return new lh(this,s)}queryIntersectsFeature(s,n,o,d,g,v,E,L,k){const V=Yr(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),q=this.paint.get("fill-extrusion-height").evaluate(n,o),se=this.paint.get("fill-extrusion-base").evaluate(n,o),he=[0,0],_e=L&&v.elevation,Be=v.elevation?v.elevation.exaggeration():1,Le=s.tile.getBucket(this);if(_e&&Le instanceof Ce){const Tt=Le.centroidVertexArray,kt=k+1;kt<Tt.length&&(he[0]=Tt.geta_centroid_pos0(kt),he[1]=Tt.geta_centroid_pos1(kt))}if(he[0]===0&&he[1]===1)return!1;v.projection.name==="globe"&&(d=mi([d],[new me(0,0),new me(Zn,Zn)],s.tileID.canonical).map(Tt=>Tt.polygon).flat());const Xe=_e?L:null,[xt,Dt]=function(Tt,kt,Ut,ci,oi,Ti,Ki,gi,Si,Li,Vi){return Tt.projection.name==="globe"?function(Zi,yi,sn,Kn,dn,Ln,ln,Xn,Tr,wr,xr){const Jn=[],es=[],ir=Zi.projection.upVectorScale(xr,Zi.center.lat,Zi.worldSize).metersToTile,Sr=[0,0,0,1],rs=[0,0,0,1],gs=(_s,bs,Zs,Yo)=>{_s[0]=bs,_s[1]=Zs,_s[2]=Yo,_s[3]=1},ds=ri();sn>0&&(sn+=ds),Kn+=ds;for(const _s of yi){const bs=[],Zs=[];for(const Yo of _s){const ts=Yo.x+dn.x,Ao=Yo.y+dn.y,lo=Zi.projection.projectTilePoint(ts,Ao,xr),Vr=Zi.projection.upVector(xr,Yo.x,Yo.y);let Ps=sn,vo=Kn;if(ln){const ss=gn(ts,Ao,sn,Kn,ln,Xn,Tr,wr);Ps+=ss.base,vo+=ss.top}sn!==0?gs(Sr,lo.x+Vr[0]*ir*Ps,lo.y+Vr[1]*ir*Ps,lo.z+Vr[2]*ir*Ps):gs(Sr,lo.x,lo.y,lo.z),gs(rs,lo.x+Vr[0]*ir*vo,lo.y+Vr[1]*ir*vo,lo.z+Vr[2]*ir*vo),Ns(Sr,Sr,Ln),Ns(rs,rs,Ln),bs.push(new an(Sr[0],Sr[1],Sr[2])),Zs.push(new an(rs[0],rs[1],rs[2]))}Jn.push(bs),es.push(Zs)}return[Jn,es]}(Tt,kt,Ut,ci,oi,Ti,Ki,gi,Si,Li,Vi):Ki?function(Zi,yi,sn,Kn,dn,Ln,ln,Xn,Tr){const wr=[],xr=[],Jn=[0,0,0,1];for(const es of Zi){const ir=[],Sr=[];for(const rs of es){const gs=rs.x+Kn.x,ds=rs.y+Kn.y,_s=gn(gs,ds,yi,sn,Ln,ln,Xn,Tr);Jn[0]=gs,Jn[1]=ds,Jn[2]=_s.base,Jn[3]=1,TA(Jn,Jn,dn),Jn[3]=Math.max(Jn[3],1e-5);const bs=new an(Jn[0]/Jn[3],Jn[1]/Jn[3],Jn[2]/Jn[3]);Jn[0]=gs,Jn[1]=ds,Jn[2]=_s.top,Jn[3]=1,TA(Jn,Jn,dn),Jn[3]=Math.max(Jn[3],1e-5);const Zs=new an(Jn[0]/Jn[3],Jn[1]/Jn[3],Jn[2]/Jn[3]);ir.push(bs),Sr.push(Zs)}wr.push(ir),xr.push(Sr)}return[wr,xr]}(kt,Ut,ci,oi,Ti,Ki,gi,Si,Li):function(Zi,yi,sn,Kn,dn){const Ln=[],ln=[],Xn=dn[8]*yi,Tr=dn[9]*yi,wr=dn[10]*yi,xr=dn[11]*yi,Jn=dn[8]*sn,es=dn[9]*sn,ir=dn[10]*sn,Sr=dn[11]*sn;for(const rs of Zi){const gs=[],ds=[];for(const _s of rs){const bs=_s.x+Kn.x,Zs=_s.y+Kn.y,Yo=dn[0]*bs+dn[4]*Zs+dn[12],ts=dn[1]*bs+dn[5]*Zs+dn[13],Ao=dn[2]*bs+dn[6]*Zs+dn[14],lo=dn[3]*bs+dn[7]*Zs+dn[15],Vr=Yo+Xn,Ps=ts+Tr,vo=Ao+wr,ss=Math.max(lo+xr,1e-5),no=Yo+Jn,La=ts+es,Jo=Ao+ir,ea=Math.max(lo+Sr,1e-5);gs.push(new an(Vr/ss,Ps/ss,vo/ss)),ds.push(new an(no/ea,La/ea,Jo/ea))}Ln.push(gs),ln.push(ds)}return[Ln,ln]}(kt,Ut,ci,oi,Ti)}(v,d,se,q,V,E,Xe,he,Be,v.center.lat,s.tileID.canonical),_t=s.queryGeometry;return function(Tt,kt,Ut){let ci=1/0;Ag(Ut,kt)&&(ci=vn(Ut,kt[0]));for(let oi=0;oi<kt.length;oi++){const Ti=kt[oi],Ki=Tt[oi];for(let gi=0;gi<Ti.length-1;gi++){const Si=Ti[gi],Li=[Si,Ti[gi+1],Ki[gi+1],Ki[gi],Si];Ny(Ut,Li)&&(ci=Math.min(ci,vn(Ut,Li)))}}return ci!==1/0&&ci}(xt,Dt,_t.isPointQuery()?_t.screenBounds:_t.screenGeometry)}},line:class extends vc{constructor(s){super(s,xo),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const n=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=n._styleExpression&&n._styleExpression.expression instanceof Hl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,n){super.recalculate(s,n),this.paint._values["line-floorwidth"]=Ks.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new Qs(s)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(s){return new lh(this,s)}queryRadius(s){const n=s,o=oo(Su("line-width",this,n),Su("line-gap-width",this,n)),d=Su("line-offset",this,n);return o/2+Math.abs(d)+_p(this.paint.get("line-translate"))}queryIntersectsFeature(s,n,o,d,g,v){if(s.queryGeometry.isAboveHorizon)return!1;const E=mg(s.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),v.angle,s.pixelToTileUnitsFactor),L=s.pixelToTileUnitsFactor/2*oo(this.paint.get("line-width").evaluate(n,o),this.paint.get("line-gap-width").evaluate(n,o)),k=this.paint.get("line-offset").evaluate(n,o);return k&&(d=function(V,q){const se=[],he=new me(0,0);for(let _e=0;_e<V.length;_e++){const Be=V[_e],Le=[];for(let Xe=0;Xe<Be.length;Xe++){const xt=Be[Xe-1],Dt=Be[Xe],_t=Be[Xe+1],Tt=Xe===0?he:Dt.sub(xt)._unit()._perp(),kt=Xe===Be.length-1?he:_t.sub(Dt)._unit()._perp(),Ut=Tt._add(kt)._unit();Ut._mult(1/(Ut.x*kt.x+Ut.y*kt.y)),Le.push(Ut._mult(q)._add(Dt))}se.push(Le)}return se}(d,k*s.pixelToTileUnitsFactor)),function(V,q,se){for(let he=0;he<q.length;he++){const _e=q[he];if(V.length>=3){for(let Be=0;Be<_e.length;Be++)if(vA(V,_e[Be]))return!0}if(Vy(V,_e,se))return!0}return!1}(E,d,L)}isTileClipped(){return!0}},symbol:b0,background:class extends vc{constructor(s){super(s,E3)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends vc{constructor(s){super(s,T3)}getProgramIds(){return["raster"]}},sky:class extends vc{constructor(s){super(s,M3),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="sky-gradient"?this._updateColorRamp():s!=="sky-atmosphere-sun"&&s!=="sky-atmosphere-halo-color"&&s!=="sky-atmosphere-color"&&s!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Tg({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(s){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const n=s.style.light.properties.get("position");return this._lightPosition.azimuthal!==n.azimuthal||this._lightPosition.polar!==n.polar}return!1}getCenter(s,n){if(this.paint.get("sky-type")==="atmosphere"){const d=this.paint.get("sky-atmosphere-sun"),g=!d,v=s.style.light,E=v.properties.get("position");return g&&v.properties.get("anchor")==="viewport"&&Ct("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),g?k1(E.azimuthal,90-E.polar,n):k1(d[0],90-d[1],n)}const o=this.paint.get("sky-gradient-center");return k1(o[0],90-o[1],n)}is3D(){return!1}isSky(){return!0}markSkyboxValid(s){this._skyboxInvalidated=!1,this._lightPosition=s.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const s=this.paint.get("sky-type");return s==="atmosphere"?["skyboxCapture","skybox"]:s==="gradient"?["skyboxGradient"]:null}}};class jg{constructor(n,o,d,g){this.context=n,this.format=d,this.texture=n.gl.createTexture(),this.update(o,g)}update(n,o,d){const{width:g,height:v}=n,{context:E}=this,{gl:L}=E,{HTMLImageElement:k,HTMLCanvasElement:V,HTMLVideoElement:q,ImageData:se,ImageBitmap:he}=C;if(L.bindTexture(L.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===L.RGBA&&(!o||o.premultiply!==!1)),d||this.size&&this.size[0]===g&&this.size[1]===v){const{x:_e,y:Be}=d||{x:0,y:0};n instanceof k||n instanceof V||n instanceof q||n instanceof se||he&&n instanceof he?L.texSubImage2D(L.TEXTURE_2D,0,_e,Be,L.RGBA,L.UNSIGNED_BYTE,n):L.texSubImage2D(L.TEXTURE_2D,0,_e,Be,g,v,L.RGBA,L.UNSIGNED_BYTE,n.data)}else this.size=[g,v],n instanceof k||n instanceof V||n instanceof q||n instanceof se||he&&n instanceof he?L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,L.UNSIGNED_BYTE,n):L.texImage2D(L.TEXTURE_2D,0,this.format,g,v,0,this.format,L.UNSIGNED_BYTE,n.data);this.useMipmap=Boolean(o&&o.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&L.generateMipmap(L.TEXTURE_2D)}bind(n,o){const{context:d}=this,{gl:g}=d;g.bindTexture(g.TEXTURE_2D,this.texture),n!==this.filter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,n),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,this.useMipmap?n===g.NEAREST?g.NEAREST_MIPMAP_NEAREST:g.LINEAR_MIPMAP_NEAREST:n),this.filter=n),o!==this.wrap&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,o),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:n}=this.context;n.deleteTexture(this.texture),this.texture=null}}class F3{constructor(n){this._callback=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class L3{constructor(){this.tasks={},this.taskQueue=[],be(["process"],this),this.invoker=new F3(this.process),this.nextId=0}add(n,o){const d=this.nextId++,g=function({type:v,isSymbolTile:E,zoom:L}){return L=L||0,v==="message"?0:v!=="maybePrepare"||E?v!=="parseTile"||E?v==="parseTile"&&E?300-L:v==="maybePrepare"&&E?400-L:500:200-L:100-L}(o);if(g===0){_i();try{n()}finally{}return{cancel:()=>{}}}return this.tasks[d]={fn:n,metadata:o,priority:g,id:d},this.taskQueue.push(d),this.invoker.trigger(),{cancel:()=>{delete this.tasks[d]}}}process(){_i();try{if(this.taskQueue=this.taskQueue.filter(d=>!!this.tasks[d]),!this.taskQueue.length)return;const n=this.pick();if(n===null)return;const o=this.tasks[n];if(delete this.tasks[n],this.taskQueue.length&&this.invoker.trigger(),!o)return;o.fn()}finally{}}pick(){let n=null,o=1/0;for(let g=0;g<this.taskQueue.length;g++){const v=this.tasks[this.taskQueue[g]];v.priority<o&&(o=v.priority,n=g)}if(n===null)return null;const d=this.taskQueue[n];return this.taskQueue.splice(n,1),d}remove(){this.invoker.remove()}}class cC{constructor(n){this._stringToNumber={},this._numberToString=[];for(let o=0;o<n.length;o++){const d=n[o];this._stringToNumber[d]=o,this._numberToString[o]=d}}encode(n){return this._stringToNumber[n]}decode(n){return this._numberToString[n]}}const D3=["tile","layer","source","sourceLayer","state"];class hC{constructor(n,o,d,g,v){this.type="Feature",this._vectorTileFeature=n,this._z=o,this._x=d,this._y=g,this.properties=n.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={type:"Feature",geometry:this.geometry,properties:this.properties};this.id!==void 0&&(n.id=this.id);for(const o of D3)this[o]!==void 0&&(n[o]=this[o]);return n}}const gh=32,Du=33,Ld=new Uint16Array(8184);for(let s=0;s<2046;s++){let n=s+2,o=0,d=0,g=0,v=0,E=0,L=0;for(1&n?g=v=E=gh:o=d=L=gh;(n>>=1)>1;){const V=o+g>>1,q=d+v>>1;1&n?(g=o,v=d,o=E,d=L):(o=g,d=v,g=E,v=L),E=V,L=q}const k=4*s;Ld[k+0]=o,Ld[k+1]=d,Ld[k+2]=g,Ld[k+3]=v}const Pu=new Uint16Array(2178),Dd=new Uint8Array(1089),B0=new Uint16Array(1089);function uC(s){return s===0?-.03125:s===32?.03125:0}var AC=_n([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const dC={type:2,extent:Zn,loadGeometry:()=>[[new me(0,0),new me(8193,0),new me(8193,8193),new me(0,8193),new me(0,0)]]};class O1{constructor(n,o,d,g,v){this.tileID=n,this.uid=Se(),this.uses=0,this.tileSize=o,this.tileZoom=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=v,this.expiredRequestCount=0,this.state="loading",g&&g.transform&&(this.projection=g.transform.projection)}registerFadeDuration(n){const o=n+this.timeAdded;o<bi.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=Dp(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(n,o,d){if(this.unloadVectorData(),this.state="loaded",n){n.featureIndex&&(this.latestFeatureIndex=n.featureIndex,n.rawTileData?(this.latestRawTileData=n.rawTileData,this.latestFeatureIndex.rawTileData=n.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=n.collisionBoxArray,this.buckets=function(g,v){const E={};if(!v)return E;for(const L of g){const k=L.layerIds.map(V=>v.getLayer(V)).filter(Boolean);if(k.length!==0){L.layers=k,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(V=>k.filter(q=>q.id===V)[0]));for(const V of k)E[V.id]=L}}return E}(n.buckets,o.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof Fd){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const v=this.buckets[g];if(v instanceof Fd&&v.hasRTLText){this.hasRTLText=!0,si.isLoading()||si.isLoaded()||Ht()!=="deferred"||hi();break}}this.queryPadding=0;for(const g in this.buckets){const v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(g).queryRadius(v))}n.imageAtlas&&(this.imageAtlas=n.imageAtlas),n.glyphAtlasImage&&(this.glyphAtlasImage=n.glyphAtlasImage),n.lineAtlas&&(this.lineAtlas=n.lineAtlas)}else this.collisionBoxArray=new sg}unloadVectorData(){if(this.hasData()){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(n){return this.buckets[n.id]}upload(n){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(n)}const o=n.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jg(n,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jg(n,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new jg(n,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(n){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(n,this.imageAtlasTexture)}queryRenderedFeatures(n,o,d,g,v,E,L,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:g,pixelPosMatrix:L,transform:E,params:v,tileTransform:this.tileTransform},n,o,d):{}}querySourceFeatures(n,o){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),v=o?o.sourceLayer:"",E=g._geojsonTileLayer||g[v];if(!E)return;const L=uo(o&&o.filter),{z:k,x:V,y:q}=this.tileID.canonical,se={z:k,x:V,y:q};for(let he=0;he<E.length;he++){const _e=E.feature(he);if(L.needGeometry){const Xe=xA(_e,!0);if(!L.filter(new qt(this.tileID.overscaledZ),Xe,this.tileID.canonical))continue}else if(!L.filter(new qt(this.tileID.overscaledZ),_e))continue;const Be=d.getId(_e,v),Le=new hC(_e,k,V,q,Be);Le.tile=se,n.push(Le)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(n){const o=this.expirationTime;if(n.cacheControl){const d=fi(n.cacheControl);d["max-age"]&&(this.expirationTime=Date.now()+1e3*d["max-age"])}else n.expires&&(this.expirationTime=new Date(n.expires).getTime());if(this.expirationTime){const d=Date.now();let g=!1;if(this.expirationTime>d)g=!1;else if(o)if(this.expirationTime<o)g=!0;else{const v=this.expirationTime-o;v?this.expirationTime=d+Math.max(v,3e4):g=!0}else g=!0;g?(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(n,o){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(n).length===0||!o)return;const d=this.latestFeatureIndex.loadVTLayers(),g=o.style.listImages();for(const v in this.buckets){if(!o.style.hasLayer(v))continue;const E=this.buckets[v],L=E.layers[0].sourceLayer||"_geojsonTileLayer",k=d[L],V=n[L];if(!k||!V||Object.keys(V).length===0)continue;if(E.update(V,k,g,this.imageAtlas&&this.imageAtlas.patternPositions||{}),E instanceof Qs||E instanceof Mp){const se=o.style._getSourceCache(E.layers[0].source);o._terrain&&o._terrain.enabled&&se&&E.programConfigurations.needsUpload&&o._terrain._clearRenderCacheForTile(se.id,this.tileID)}const q=o&&o.style&&o.style.getLayer(v);q&&(this.queryPadding=Math.max(this.queryPadding,q.queryRadius(E)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<bi.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(n){this.symbolFadeHoldUntil=bi.now()+n}setTexture(n,o){const d=o.context,g=d.gl;this.texture=this.texture||o.getTileTexture(n.width),this.texture?this.texture.update(n,{useMipmap:!0}):(this.texture=new jg(d,n,g.RGBA,{useMipmap:!0}),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE),d.extTextureFilterAnisotropic&&g.texParameterf(g.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax))}setDependencies(n,o){const d={};for(const g of o)d[g]=!0;this.dependencies[n]=d}hasDependency(n,o){for(const d of n){const g=this.dependencies[d];if(g){for(const v of o)if(g[v])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(n,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const d=Yh(dC,this.tileID.canonical,this.tileTransform)[0],g=new Or,v=new Xh;for(let E=0;E<d.length;E++){const{x:L,y:k}=d[E];g.emplaceBack(L,k),v.emplaceBack(E)}v.emplaceBack(0),this._tileDebugIndexBuffer=n.createIndexBuffer(v),this._tileDebugBuffer=n.createVertexBuffer(g,kg.members),this._tileDebugSegments=to.simpleSegment(0,0,g.length,v.length)}_makeTileBoundsBuffers(n,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const d=Yh(dC,this.tileID.canonical,this.tileTransform)[0];let g,v;if(this.isRaster){const E=function(L,k){const V=Dp(L,k),q=Math.pow(2,L.z);for(let Xe=0;Xe<Du;Xe++)for(let xt=0;xt<Du;xt++){const Dt=bl((L.x+(xt+uC(xt))/gh)/q),_t=Fo((L.y+(Xe+uC(Xe))/gh)/q),Tt=k.project(Dt,_t),kt=Xe*Du+xt;Pu[2*kt+0]=Math.round((Tt.x*V.scale-V.x)*Zn),Pu[2*kt+1]=Math.round((Tt.y*V.scale-V.y)*Zn)}Dd.fill(0),B0.fill(0);for(let Xe=2045;Xe>=0;Xe--){const xt=4*Xe,Dt=Ld[xt+0],_t=Ld[xt+1],Tt=Ld[xt+2],kt=Ld[xt+3],Ut=Dt+Tt>>1,ci=_t+kt>>1,oi=Ut+ci-_t,Ti=ci+Dt-Ut,Ki=_t*Du+Dt,gi=kt*Du+Tt,Si=ci*Du+Ut,Li=Math.hypot((Pu[2*Ki+0]+Pu[2*gi+0])/2-Pu[2*Si+0],(Pu[2*Ki+1]+Pu[2*gi+1])/2-Pu[2*Si+1])>=16;if(Dd[Si]=Dd[Si]||(Li?1:0),Xe<1022){const Vi=(_t+Ti>>1)*Du+(Dt+oi>>1),Zi=(kt+Ti>>1)*Du+(Tt+oi>>1);Dd[Si]=Dd[Si]||Dd[Vi]||Dd[Zi]}}const se=new Qr,he=new _o;let _e=0;function Be(Xe,xt){const Dt=xt*Du+Xe;return B0[Dt]===0&&(se.emplaceBack(Pu[2*Dt+0],Pu[2*Dt+1],Xe*Zn/gh,xt*Zn/gh),B0[Dt]=++_e),B0[Dt]-1}function Le(Xe,xt,Dt,_t,Tt,kt){const Ut=Xe+Dt>>1,ci=xt+_t>>1;if(Math.abs(Xe-Tt)+Math.abs(xt-kt)>1&&Dd[ci*Du+Ut])Le(Tt,kt,Xe,xt,Ut,ci),Le(Dt,_t,Tt,kt,Ut,ci);else{const oi=Be(Xe,xt),Ti=Be(Dt,_t),Ki=Be(Tt,kt);he.emplaceBack(oi,Ti,Ki)}}return Le(0,0,gh,gh,gh,0),Le(gh,gh,0,0,0,gh),{vertices:se,indices:he}}(this.tileID.canonical,o);g=E.vertices,v=E.indices}else{g=new Qr,v=new _o;for(const{x:L,y:k}of d)g.emplaceBack(L,k,0,0);const E=xd.exports(g.int16,void 0,4);for(let L=0;L<E.length;L+=3)v.emplaceBack(E[L],E[L+1],E[L+2])}this._tileBoundsBuffer=n.createVertexBuffer(g,AC.members),this._tileBoundsIndexBuffer=n.createIndexBuffer(v),this._tileBoundsSegments=to.simpleSegment(0,0,g.length,v.length)}_makeGlobeTileDebugBuffers(n,o){const d=o.projection;if(!d||d.name!=="globe"||o.freezeTileCoverage)return;const g=this.tileID.canonical,v=Qg(XB(g,o)),E=Yf(o.zoom);let L;E>0&&(L=_g(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(n,g,o,v,L,E),this._makeGlobeTileDebugTextBuffer(n,g,o,v,L,E)}_globePoint(n,o,d,g,v,E,L){let k=Ng(n,o,d);if(E){const V=1<<d.z,q=wc(g.center.lng),se=ch(g.center.lat),he=(d.x+.5)/V-q;let _e=0;he>.5?_e=-1:he<-.5&&(_e=1);let Be=(n/Zn+d.x)/V+_e,Le=(o/Zn+d.y)/V;Be=(Be-q)*g._pixelsPerMercatorPixel+q,Le=(Le-se)*g._pixelsPerMercatorPixel+se;const Xe=[Be*g.worldSize,Le*g.worldSize,0];Ns(Xe,Xe,E),k=Lp(k,Xe,L)}return Ns(k,k,v)}_makeGlobeTileDebugBorderBuffer(n,o,d,g,v,E){const L=new Or,k=new Xh,V=new Nr,q=(he,_e,Be,Le,Xe)=>{const xt=(Be-he)/(Xe-1),Dt=(Le-_e)/(Xe-1),_t=L.length;for(let Tt=0;Tt<Xe;Tt++){const kt=he+Tt*xt,Ut=_e+Tt*Dt;L.emplaceBack(kt,Ut);const ci=this._globePoint(kt,Ut,o,d,g,v,E);V.emplaceBack(ci[0],ci[1],ci[2]),k.emplaceBack(_t+Tt)}},se=Zn;q(0,0,se,0,16),q(se,0,se,se,16),q(se,se,0,se,16),q(0,se,0,0,16),this._tileDebugIndexBuffer=n.createIndexBuffer(k),this._tileDebugBuffer=n.createVertexBuffer(L,kg.members),this._globeTileDebugBorderBuffer=n.createVertexBuffer(V,$B.members),this._tileDebugSegments=to.simpleSegment(0,0,L.length,k.length)}_makeGlobeTileDebugTextBuffer(n,o,d,g,v,E){const L=new Or,k=new _o,V=new Nr,q=25;k.reserve(32),L.reserve(q),V.reserve(q);const se=(he,_e)=>q*he+_e;for(let he=0;he<q;he++){const _e=2048*he;for(let Be=0;Be<q;Be++){const Le=2048*Be;L.emplaceBack(Le,_e);const Xe=this._globePoint(Le,_e,o,d,g,v,E);V.emplaceBack(Xe[0],Xe[1],Xe[2])}}for(let he=0;he<4;he++)for(let _e=0;_e<4;_e++){const Be=se(he,_e),Le=se(he,_e+1),Xe=se(he+1,_e),xt=se(he+1,_e+1);k.emplaceBack(Be,Le,Xe),k.emplaceBack(Xe,Le,xt)}this._tileDebugTextIndexBuffer=n.createIndexBuffer(k),this._tileDebugTextBuffer=n.createVertexBuffer(L,kg.members),this._globeTileDebugTextBuffer=n.createVertexBuffer(V,$B.members),this._tileDebugTextSegments=to.simpleSegment(0,0,q,32)}}class P3{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(n,o,d){const g=String(o);if(this.stateChanges[n]=this.stateChanges[n]||{},this.stateChanges[n][g]=this.stateChanges[n][g]||{},Ve(this.stateChanges[n][g],d),this.deletedStates[n]===null){this.deletedStates[n]={};for(const v in this.state[n])v!==g&&(this.deletedStates[n][v]=null)}else if(this.deletedStates[n]&&this.deletedStates[n][g]===null){this.deletedStates[n][g]={};for(const v in this.state[n][g])d[v]||(this.deletedStates[n][g][v]=null)}else for(const v in d)this.deletedStates[n]&&this.deletedStates[n][g]&&this.deletedStates[n][g][v]===null&&delete this.deletedStates[n][g][v]}removeFeatureState(n,o,d){if(this.deletedStates[n]===null)return;const g=String(o);if(this.deletedStates[n]=this.deletedStates[n]||{},d&&o!==void 0)this.deletedStates[n][g]!==null&&(this.deletedStates[n][g]=this.deletedStates[n][g]||{},this.deletedStates[n][g][d]=null);else if(o!==void 0)if(this.stateChanges[n]&&this.stateChanges[n][g])for(d in this.deletedStates[n][g]={},this.stateChanges[n][g])this.deletedStates[n][g][d]=null;else this.deletedStates[n][g]=null;else this.deletedStates[n]=null}getState(n,o){const d=String(o),g=Ve({},(this.state[n]||{})[d],(this.stateChanges[n]||{})[d]);if(this.deletedStates[n]===null)return{};if(this.deletedStates[n]){const v=this.deletedStates[n][o];if(v===null)return{};for(const E in v)delete g[E]}return g}initializeTileState(n,o){n.setFeatureState(this.state,o)}coalesceChanges(n,o){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const v={};for(const E in this.stateChanges[g])this.state[g][E]||(this.state[g][E]={}),Ve(this.state[g][E],this.stateChanges[g][E]),v[E]=this.state[g][E];d[g]=v}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const v={};if(this.deletedStates[g]===null)for(const E in this.state[g])v[E]={},this.state[g][E]={};else for(const E in this.deletedStates[g]){if(this.deletedStates[g][E]===null)this.state[g][E]={};else for(const L of Object.keys(this.deletedStates[g][E]))delete this.state[g][E][L];v[E]=this.state[g][E]}d[g]=d[g]||{},Ve(d[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in n)n[g].setFeatureState(d,o)}}class pC{constructor(n){this.size=n,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(n,o){const d=this.toIdx(n,o);return{min:this.minimums[d],max:this.maximums[d]}}isLeaf(n,o){return this.leaves[this.toIdx(n,o)]}toIdx(n,o){return o*this.size+n}}function fC(s,n,o,d){let g=0,v=Number.MAX_VALUE;for(let E=0;E<3;E++)if(Math.abs(d[E])<1e-15){if(o[E]<s[E]||o[E]>n[E])return null}else{const L=1/d[E];let k=(s[E]-o[E])*L,V=(n[E]-o[E])*L;if(k>V){const q=k;k=V,V=q}if(k>g&&(g=k),V<v&&(v=V),g>v)return null}return g}function mC(s,n,o,d,g,v,E,L,k,V,q){const se=d-s,he=g-n,_e=v-o,Be=E-s,Le=L-n,Xe=k-o,xt=q[1]*Xe-q[2]*Le,Dt=q[2]*Be-q[0]*Xe,_t=q[0]*Le-q[1]*Be,Tt=se*xt+he*Dt+_e*_t;if(Math.abs(Tt)<1e-15)return null;const kt=1/Tt,Ut=V[0]-s,ci=V[1]-n,oi=V[2]-o,Ti=(Ut*xt+ci*Dt+oi*_t)*kt;if(Ti<0||Ti>1)return null;const Ki=ci*_e-oi*he,gi=oi*se-Ut*_e,Si=Ut*he-ci*se,Li=(q[0]*Ki+q[1]*gi+q[2]*Si)*kt;return Li<0||Ti+Li>1?null:(Be*Ki+Le*gi+Xe*Si)*kt}function gC(s,n,o){return(s-n)/(o-n)}function _C(s,n,o,d,g,v,E,L,k){const V=1<<o,q=v-d,se=E-g,he=(s+1)/V*q+d,_e=(n+0)/V*se+g,Be=(n+1)/V*se+g;L[0]=(s+0)/V*q+d,L[1]=_e,k[0]=he,k[1]=Be}class yC{constructor(n){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=n,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const o=function(v){const E=Math.ceil(Math.log2(v.dim/8)),L=[];let k=Math.ceil(Math.pow(2,E));const V=1/k,q=(_e,Be,Le,Xe,xt)=>{const Dt=Xe?1:0,_t=(_e+1)*Le-Dt,Tt=Be*Le,kt=(Be+1)*Le-Dt;xt[0]=_e*Le,xt[1]=Tt,xt[2]=_t,xt[3]=kt};let se=new pC(k);const he=[];for(let _e=0;_e<k*k;_e++){q(_e%k,Math.floor(_e/k),V,!1,he);const Be=Pd(he[0],he[1],v),Le=Pd(he[2],he[1],v),Xe=Pd(he[2],he[3],v),xt=Pd(he[0],he[3],v);se.minimums.push(Math.min(Be,Le,Xe,xt)),se.maximums.push(Math.max(Be,Le,Xe,xt)),se.leaves.push(1)}for(L.push(se),k/=2;k>=1;k/=2){const _e=L[L.length-1];se=new pC(k);for(let Be=0;Be<k*k;Be++){q(Be%k,Math.floor(Be/k),2,!0,he);const Le=_e.getElevation(he[0],he[1]),Xe=_e.getElevation(he[2],he[1]),xt=_e.getElevation(he[2],he[3]),Dt=_e.getElevation(he[0],he[3]),_t=_e.isLeaf(he[0],he[1]),Tt=_e.isLeaf(he[2],he[1]),kt=_e.isLeaf(he[2],he[3]),Ut=_e.isLeaf(he[0],he[3]),ci=Math.min(Le.min,Xe.min,xt.min,Dt.min),oi=Math.max(Le.max,Xe.max,xt.max,Dt.max),Ti=_t&&Tt&&kt&&Ut;se.maximums.push(oi),se.minimums.push(ci),se.leaves.push(oi-ci<=5&&Ti?1:0)}L.push(se)}return L}(this.dem),d=o.length-1,g=o[d];this._addNode(g.minimums[0],g.maximums[0],g.leaves[0]),this._construct(o,0,0,d,0)}raycastRoot(n,o,d,g,v,E,L=1){return fC([n,o,-100],[d,g,this.maximums[0]*L],v,E)}raycast(n,o,d,g,v,E,L=1){if(!this.nodeCount)return null;const k=this.raycastRoot(n,o,d,g,v,E,L);if(k==null)return null;const V=[],q=[],se=[],he=[],_e=[{idx:0,t:k,nodex:0,nodey:0,depth:0}];for(;_e.length>0;){const{idx:Be,t:Le,nodex:Xe,nodey:xt,depth:Dt}=_e.pop();if(this.leaves[Be]){_C(Xe,xt,Dt,n,o,d,g,se,he);const Tt=1<<Dt,kt=(Xe+0)/Tt,Ut=(Xe+1)/Tt,ci=(xt+0)/Tt,oi=(xt+1)/Tt,Ti=Pd(kt,ci,this.dem)*L,Ki=Pd(Ut,ci,this.dem)*L,gi=Pd(Ut,oi,this.dem)*L,Si=Pd(kt,oi,this.dem)*L,Li=mC(se[0],se[1],Ti,he[0],se[1],Ki,he[0],he[1],gi,v,E),Vi=mC(he[0],he[1],gi,se[0],he[1],Si,se[0],se[1],Ti,v,E),Zi=Math.min(Li!==null?Li:Number.MAX_VALUE,Vi!==null?Vi:Number.MAX_VALUE);if(Zi!==Number.MAX_VALUE)return Zi;{const yi=eu([],v,E,Le);if(xC(Ti,Ki,Si,gi,gC(yi[0],se[0],he[0]),gC(yi[1],se[1],he[1]))>=yi[2])return Le}continue}let _t=0;for(let Tt=0;Tt<this._siblingOffset.length;Tt++){_C((Xe<<1)+this._siblingOffset[Tt][0],(xt<<1)+this._siblingOffset[Tt][1],Dt+1,n,o,d,g,se,he),se[2]=-100,he[2]=this.maximums[this.childOffsets[Be]+Tt]*L;const kt=fC(se,he,v,E);if(kt!=null){const Ut=kt;V[Tt]=Ut;let ci=!1;for(let oi=0;oi<_t&&!ci;oi++)Ut>=V[q[oi]]&&(q.splice(oi,0,Tt),ci=!0);ci||(q[_t]=Tt),_t++}}for(let Tt=0;Tt<_t;Tt++){const kt=q[Tt];_e.push({idx:this.childOffsets[Be]+kt,t:V[kt],nodex:(Xe<<1)+this._siblingOffset[kt][0],nodey:(xt<<1)+this._siblingOffset[kt][1],depth:Dt+1})}}return null}_addNode(n,o,d){return this.minimums.push(n),this.maximums.push(o),this.leaves.push(d),this.childOffsets.push(0),this.nodeCount++}_construct(n,o,d,g,v){if(n[g].isLeaf(o,d)===1)return;this.childOffsets[v]||(this.childOffsets[v]=this.nodeCount);const E=g-1,L=n[E];let k=0,V=0;for(let q=0;q<this._siblingOffset.length;q++){const se=2*o+this._siblingOffset[q][0],he=2*d+this._siblingOffset[q][1],_e=L.getElevation(se,he),Be=L.isLeaf(se,he),Le=this._addNode(_e.min,_e.max,Be);Be&&(k|=1<<q),V||(V=Le)}for(let q=0;q<this._siblingOffset.length;q++)k&1<<q||this._construct(n,2*o+this._siblingOffset[q][0],2*d+this._siblingOffset[q][1],E,V+q)}}function xC(s,n,o,d,g,v){return gr(gr(s,o,v),gr(n,d,v),g)}function Pd(s,n,o){const d=o.dim,g=ye(s*d-.5,0,d-1),v=ye(n*d-.5,0,d-1),E=Math.floor(g),L=Math.floor(v),k=Math.min(E+1,d-1),V=Math.min(L+1,d-1);return xC(o.get(E,L),o.get(k,L),o.get(E,V),o.get(k,V),g-E,v-L)}const vC={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class C0{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(n,o,d,g=!1,v=!1){if(this.uid=n,o.height!==o.width)throw new RangeError("DEM tiles must be square");if(d&&d!=="mapbox"&&d!=="terrarium")return Ct(`"${d}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=o.height;const E=this.dim=o.height-2,L=new Uint32Array(o.data.buffer);if(this.pixels=new Uint8Array(o.data.buffer),this.encoding=d||"mapbox",this.borderReady=g,!g){for(let k=0;k<E;k++)L[this._idx(-1,k)]=L[this._idx(0,k)],L[this._idx(E,k)]=L[this._idx(E-1,k)],L[this._idx(k,-1)]=L[this._idx(k,0)],L[this._idx(k,E)]=L[this._idx(k,E-1)];L[this._idx(-1,-1)]=L[this._idx(0,0)],L[this._idx(E,-1)]=L[this._idx(E-1,0)],L[this._idx(-1,E)]=L[this._idx(0,E-1)],L[this._idx(E,E)]=L[this._idx(E-1,E-1)],v&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new yC(this)}get(n,o,d=!1){d&&(n=ye(n,-1,this.dim),o=ye(o,-1,this.dim));const g=4*this._idx(n,o);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}static getUnpackVector(n){return vC[n]}get unpackVector(){return vC[this.encoding]}_idx(n,o){if(n<-1||n>=this.dim+1||o<-1||o>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(o+1)*this.stride+(n+1)}_unpackMapbox(n,o,d){return(256*n*256+256*o+d)/10-1e4}_unpackTerrarium(n,o,d){return 256*n+o+d/256-32768}static pack(n,o){const d=[0,0,0,0],g=C0.getUnpackVector(o);let v=Math.floor((n+g[3])/g[2]);return d[2]=v%256,v=Math.floor(v/256),d[1]=v%256,v=Math.floor(v/256),d[0]=v,d}getPixels(){return new Za({width:this.stride,height:this.stride},this.pixels)}backfillBorder(n,o,d){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let g=o*this.dim,v=o*this.dim+this.dim,E=d*this.dim,L=d*this.dim+this.dim;switch(o){case-1:g=v-1;break;case 1:v=g+1}switch(d){case-1:E=L-1;break;case 1:L=E+1}const k=-o*this.dim,V=-d*this.dim;for(let q=E;q<L;q++)for(let se=g;se<v;se++){const he=4*this._idx(se,q),_e=4*this._idx(se+k,q+V);this.pixels[he+0]=n.pixels[_e+0],this.pixels[he+1]=n.pixels[_e+1],this.pixels[he+2]=n.pixels[_e+2],this.pixels[he+3]=n.pixels[_e+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}zt(C0,"DEMData"),zt(yC,"DemMinMaxQuadTree",{omit:["dem"]});class U3{constructor(n,o){this.max=n,this.onRemove=o,this.reset()}reset(){for(const n in this.data)for(const o of this.data[n])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(n,o,d){const g=n.wrapped().key;this.data[g]===void 0&&(this.data[g]=[]);const v={value:o,timeout:void 0};if(d!==void 0&&(v.timeout=setTimeout(()=>{this.remove(n,v)},d)),this.data[g].push(v),this.order.push(g),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(n){return n.wrapped().key in this.data}getAndRemove(n){return this.has(n)?this._getAndRemoveByKey(n.wrapped().key):null}_getAndRemoveByKey(n){const o=this.data[n].shift();return o.timeout&&clearTimeout(o.timeout),this.data[n].length===0&&delete this.data[n],this.order.splice(this.order.indexOf(n),1),o.value}getByKey(n){const o=this.data[n];return o?o[0].value:null}get(n){return this.has(n)?this.data[n.wrapped().key][0].value:null}remove(n,o){if(!this.has(n))return this;const d=n.wrapped().key,g=o===void 0?0:this.data[d].indexOf(o),v=this.data[d][g];return this.data[d].splice(g,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(n){for(this.max=n;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(n){const o=[];for(const d in this.data)for(const g of this.data[d])n(g.value)||o.push(g);for(const d of o)this.remove(d.value.tileID,d)}}class em{constructor(n,o,d){this.func=n,this.mask=o,this.range=d}}em.ReadOnly=!1,em.ReadWrite=!0,em.disabled=new em(519,em.ReadOnly,[0,1]);const N1=7680;class Q1{constructor(n,o,d,g,v,E){this.test=n,this.ref=o,this.mask=d,this.fail=g,this.depthFail=v,this.pass=E}}Q1.disabled=new Q1({func:519,mask:0},0,0,N1,N1,N1);class Uu{constructor(n,o,d){this.blendFunction=n,this.blendColor=o,this.mask=d}}Uu.Replace=[1,0],Uu.disabled=new Uu(Uu.Replace,ps.transparent,[!1,!1,!1,!1]),Uu.unblended=new Uu(Uu.Replace,ps.transparent,[!0,!0,!0,!0]),Uu.alphaBlended=new Uu([1,771],ps.transparent,[!0,!0,!0,!0]);const V1=1029,H1=2305;class ru{constructor(n,o,d){this.enable=n,this.mode=o,this.frontFace=d}}ru.disabled=new ru(!1,V1,H1),ru.backCCW=new ru(!0,V1,H1),ru.backCW=new ru(!0,V1,2304),ru.frontCW=new ru(!0,1028,2304),ru.frontCCW=new ru(!0,1028,H1);class Pp extends yn{constructor(n,o,d){super(),this.id=n,this._onlySymbols=d,o.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new U3(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new P3,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(n){this.map=n,this._minTileCacheSize=this._minTileCacheSize===void 0&&n?n._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&n?n._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const n in this._tiles){const o=this._tiles[n];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const n=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,n&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(n,o){return n.isSymbolTile=this._onlySymbols,this._source.loadTile(n,o)}_unloadTile(n){if(this._source.unloadTile)return this._source.unloadTile(n,()=>{})}_abortTile(n){if(this._source.abortTile)return this._source.abortTile(n,()=>{})}serialize(){return this._source.serialize()}prepare(n){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const d=this._tiles[o];d.upload(n),d.prepare(this.map.style.imageManager)}}getIds(){return We(this._tiles).map(n=>n.tileID).sort(wC).map(n=>n.key)}getRenderableIds(n){const o=[];for(const d in this._tiles)this._isIdRenderable(+d,n)&&o.push(this._tiles[d]);return n?o.sort((d,g)=>{const v=d.tileID,E=g.tileID,L=new me(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),k=new me(E.canonical.x,E.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-E.overscaledZ||k.y-L.y||k.x-L.x}).map(d=>d.tileID.key):o.map(d=>d.tileID).sort(wC).map(d=>d.key)}hasRenderableParent(n){const o=this.findLoadedParent(n,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(n,o){return this._tiles[n]&&this._tiles[n].hasData()&&!this._coveredTiles[n]&&(o||!this._tiles[n].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const n in this._tiles)this._tiles[n].state!=="errored"&&this._reloadTile(+n,"reloading")}}_reloadTile(n,o){const d=this._tiles[n];d&&(d.state!=="loading"&&(d.state=o),this._loadTile(d,this._tileLoaded.bind(this,d,n,o)))}_tileLoaded(n,o,d,g){if(g)if(n.state="errored",g.status!==404)this._source.fire(new rr(g,{tile:n}));else if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const v=this.map.painter.terrain;this.update(this.transform,v.getScaledDemTileSize(),!0),v.resetTileLookupCache(this.id)}else this.update(this.transform);else n.timeAdded=bi.now(),d==="expired"&&(n.refreshedUponExpiration=!0),this._setTileReloadTimer(o,n),this._source.type==="raster-dem"&&n.dem&&this._backfillDEM(n),this._state.initializeTileState(n,this.map?this.map.painter:null),this._source.fire(new tn("data",{dataType:"source",tile:n,coord:n.tileID,sourceCacheId:this.id}))}_backfillDEM(n){const o=this.getRenderableIds();for(let g=0;g<o.length;g++){const v=o[g];if(n.neighboringTiles&&n.neighboringTiles[v]){const E=this.getTileByID(v);d(n,E),d(E,n)}}function d(g,v){if(!g.dem||g.dem.borderReady)return;g.needsHillshadePrepare=!0,g.needsDEMTextureUpload=!0;let E=v.tileID.canonical.x-g.tileID.canonical.x;const L=v.tileID.canonical.y-g.tileID.canonical.y,k=Math.pow(2,g.tileID.canonical.z),V=v.tileID.key;E===0&&L===0||Math.abs(L)>1||(Math.abs(E)>1&&(Math.abs(E+k)===1?E+=k:Math.abs(E-k)===1&&(E-=k)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,E,L),g.neighboringTiles&&g.neighboringTiles[V]&&(g.neighboringTiles[V].backfilled=!0)))}}getTile(n){return this.getTileByID(n.key)}getTileByID(n){return this._tiles[n]}_retainLoadedChildren(n,o,d,g){for(const v in this._tiles){let E=this._tiles[v];if(g[v]||!E.hasData()||E.tileID.overscaledZ<=o||E.tileID.overscaledZ>d)continue;let L=E.tileID;for(;E&&E.tileID.overscaledZ>o+1;){const V=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[V.key],E&&E.hasData()&&(L=V)}let k=L;for(;k.overscaledZ>o;)if(k=k.scaledTo(k.overscaledZ-1),n[k.key]){g[L.key]=L;break}}}findLoadedParent(n,o){if(n.key in this._loadedParentTiles){const d=this._loadedParentTiles[n.key];return d&&d.tileID.overscaledZ>=o?d:null}for(let d=n.overscaledZ-1;d>=o;d--){const g=n.scaledTo(d),v=this._getLoadedTile(g);if(v)return v}}_getLoadedTile(n){const o=this._tiles[n.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?n.wrapped().key:n.canonical.key)}updateCacheSize(n,o){o=o||this._source.tileSize;const d=Math.ceil(n.width/o)+1,g=Math.ceil(n.height/o)+1,v=Math.floor(d*g*5),E=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,v):v,L=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,E):E;this._cache.setMaxSize(L)}handleWrapJump(n){const o=Math.round((n-(this._prevLng===void 0?n:this._prevLng))/360);if(this._prevLng=n,o){const d={};for(const g in this._tiles){const v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+o),d[v.tileID.key]=v}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(+g,this._tiles[g])}}update(n,o,d){if(this.transform=n,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!d)return;let g;this.updateCacheSize(n,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?g=n.getVisibleUnwrappedCoordinates(this._source.tileID).map(L=>new fn(L.canonical.z,L.wrap,L.canonical.z,L.canonical.x,L.canonical.y)):(g=n.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!d,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(g=g.filter(L=>this._source.hasTile(L)))):g=[];const v=this._updateRetainedTiles(g);if(bC(this._source.type)&&g.length!==0){const L={},k={},V=Object.keys(v);for(const se of V){const he=v[se],_e=this._tiles[se];if(!_e||_e.fadeEndTime&&_e.fadeEndTime<=bi.now())continue;const Be=this.findLoadedParent(he,Math.max(he.overscaledZ-Pp.maxOverzooming,this._source.minzoom));Be&&(this._addTile(Be.tileID),L[Be.tileID.key]=Be.tileID),k[se]=he}const q=g[g.length-1].overscaledZ;for(const se in this._tiles){const he=this._tiles[se];if(v[se]||!he.hasData())continue;let _e=he.tileID;for(;_e.overscaledZ>q;){_e=_e.scaledTo(_e.overscaledZ-1);const Be=this._tiles[_e.key];if(Be&&Be.hasData()&&k[_e.key]){v[se]=he.tileID;break}}}for(const se in L)v[se]||(this._coveredTiles[se]=!0,v[se]=L[se])}for(const L in v)this._tiles[L].clearFadeHold();const E=function(L,k){const V=[];for(const q in L)q in k||V.push(q);return V}(this._tiles,v);for(const L of E){const k=this._tiles[L];k.hasSymbolBuckets&&!k.holdingForFade()?k.setHoldDuration(this.map._fadeDuration):k.hasSymbolBuckets&&!k.symbolFadeFinished()||this._removeTile(+L)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const n in this._tiles)this._tiles[n].holdingForFade()&&this._removeTile(+n)}_updateRetainedTiles(n){const o={};if(n.length===0)return o;const d={},g=n.reduce((V,q)=>Math.min(V,q.overscaledZ),1/0),v=n[0].overscaledZ,E=Math.max(v-Pp.maxOverzooming,this._source.minzoom),L=Math.max(v+Pp.maxUnderzooming,this._source.minzoom),k={};for(const V of n){const q=this._addTile(V);o[V.key]=V,q.hasData()||g<this._source.maxzoom&&(k[V.key]=V)}this._retainLoadedChildren(k,g,L,o);for(const V of n){let q=this._tiles[V.key];if(q.hasData())continue;if(V.canonical.z>=this._source.maxzoom){const he=V.children(this._source.maxzoom)[0],_e=this.getTile(he);if(_e&&_e.hasData()){o[he.key]=he;continue}}else{const he=V.children(this._source.maxzoom);if(o[he[0].key]&&o[he[1].key]&&o[he[2].key]&&o[he[3].key])continue}let se=q.wasRequested();for(let he=V.overscaledZ-1;he>=E;--he){const _e=V.scaledTo(he);if(d[_e.key]||(d[_e.key]=!0,q=this.getTile(_e),!q&&se&&(q=this._addTile(_e)),q&&(o[_e.key]=_e,se=q.wasRequested(),q.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const n in this._tiles){const o=[];let d,g=this._tiles[n].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}o.push(g.key);const v=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;g=v}for(const v of o)this._loadedParentTiles[v]=d}}_addTile(n){let o=this._tiles[n.key];if(o)return o;o=this._cache.getAndRemove(n),o&&(this._setTileReloadTimer(n.key,o),o.tileID=n,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[n.key]&&(clearTimeout(this._cacheTimers[n.key]),delete this._cacheTimers[n.key],this._setTileReloadTimer(n.key,o)));const d=Boolean(o);if(!d){const g=this.map?this.map.painter:null;o=new O1(n,this._source.tileSize*n.overscaleFactor(),this.transform.tileZoom,g,this._isRaster),this._loadTile(o,this._tileLoaded.bind(this,o,n.key,o.state))}return o?(o.uses++,this._tiles[n.key]=o,d||this._source.fire(new tn("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o):null}_setTileReloadTimer(n,o){n in this._timers&&(clearTimeout(this._timers[n]),delete this._timers[n]);const d=o.getExpiryTimeout();d&&(this._timers[n]=setTimeout(()=>{this._reloadTile(n,"expired"),delete this._timers[n]},d))}_removeTile(n){const o=this._tiles[n];o&&(o.uses--,delete this._tiles[n],this._timers[n]&&(clearTimeout(this._timers[n]),delete this._timers[n]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const n in this._tiles)this._removeTile(+n);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(n,o,d){const g=[],v=this.transform;if(!v)return g;const E=v.projection.name==="globe",L=wc(v.center.lng);for(const k in this._tiles){const V=this._tiles[k];if(d&&V.clearQueryDebugViz(),V.holdingForFade())continue;let q;if(E){const se=V.tileID.canonical;if(se.z===0){const he=[Math.abs(ye(L,...Kg(se,-1))-L),Math.abs(ye(L,...Kg(se,1))-L)];q=[0,2*he.indexOf(Math.min(...he))-1]}else{const he=[Math.abs(ye(L,...Kg(se,-1))-L),Math.abs(ye(L,...Kg(se,0))-L),Math.abs(ye(L,...Kg(se,1))-L)];q=[he.indexOf(Math.min(...he))-1]}}else q=[0];for(const se of q){const he=n.containsTile(V,v,o,se);he&&g.push(he)}}return g}getVisibleCoordinates(n){const o=this.getRenderableIds(n).map(d=>this._tiles[d].tileID);for(const d of o)d.projMatrix=this.transform.calculateProjMatrix(d.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(bC(this._source.type))for(const n in this._tiles){const o=this._tiles[n];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=bi.now())return!0}return!1}setFeatureState(n,o,d){this._state.updateState(n=n||"_geojsonTileLayer",o,d)}removeFeatureState(n,o,d){this._state.removeFeatureState(n=n||"_geojsonTileLayer",o,d)}getFeatureState(n,o){return this._state.getState(n=n||"_geojsonTileLayer",o)}setDependencies(n,o,d){const g=this._tiles[n];g&&g.setDependencies(o,d)}reloadTilesForDependencies(n,o){for(const d in this._tiles)this._tiles[d].hasDependency(n,o)&&this._reloadTile(+d,"reloading");this._cache.filter(d=>!d.hasDependency(n,o))}_preloadTiles(n,o){const d=new Map,g=Array.isArray(n)?n:[n],v=this.map.painter.terrain,E=this.usedForTerrain&&v?v.getScaledDemTileSize():this._source.tileSize;for(const L of g){const k=L.coveringTiles({tileSize:E,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const V of k)d.set(V.key,V);this.usedForTerrain&&L.updateElevation(!1)}Oe(Array.from(d.values()),(L,k)=>{const V=new O1(L,this._source.tileSize*L.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(V,q=>{this._source.type==="raster-dem"&&V.dem&&this._backfillDEM(V),k(q,V)})},o)}}function wC(s,n){const o=Math.abs(2*s.wrap)-+(s.wrap<0),d=Math.abs(2*n.wrap)-+(n.wrap<0);return s.overscaledZ-n.overscaledZ||d-o||n.canonical.y-s.canonical.y||n.canonical.x-s.canonical.x}function bC(s){return s==="raster"||s==="image"||s==="video"||s==="custom"}function Kg(s,n){const o=1<<s.z;return[s.x/o+n,(s.x+1)/o+n]}Pp.maxOverzooming=10,Pp.maxUnderzooming=3;class E0{constructor(n,o,d){this._demTile=n,this._dem=this._demTile.dem,this._scale=o,this._offset=d}static create(n,o,d){const g=d||n.findDEMTileFor(o);if(!g||!g.dem)return;const v=g.dem,E=g.tileID,L=1<<o.canonical.z-E.canonical.z;return new E0(g,g.tileSize/Zn/L,[(o.canonical.x/L-E.canonical.x)*v.dim,(o.canonical.y/L-E.canonical.y)*v.dim])}tileCoordToPixel(n,o){const d=o*this._scale+this._offset[1],g=Math.floor(n*this._scale+this._offset[0]),v=Math.floor(d);return new me(g,v)}getElevationAt(n,o,d,g){const v=n*this._scale+this._offset[0],E=o*this._scale+this._offset[1],L=Math.floor(v),k=Math.floor(E),V=this._dem;return g=!!g,d?gr(gr(V.get(L,k,g),V.get(L,k+1,g),E-k),gr(V.get(L+1,k,g),V.get(L+1,k+1,g),E-k),v-L):V.get(L,k,g)}getElevationAtPixel(n,o,d){return this._dem.get(n,o,!!d)}getMeterToDEM(n){return(1<<this._demTile.tileID.canonical.z)*Xl(1,n)*this._dem.stride}}class BC{constructor(n,o){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new Zt(Zn,16,0),this.featureIndexArray=new Sy,this.promoteId=o}insert(n,o,d,g,v,E=0){const L=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,g,v,E);const k=this.grid;for(let V=0;V<o.length;V++){const q=o[V],se=[1/0,1/0,-1/0,-1/0];for(let he=0;he<q.length;he++){const _e=q[he];se[0]=Math.min(se[0],_e.x),se[1]=Math.min(se[1],_e.y),se[2]=Math.max(se[2],_e.x),se[3]=Math.max(se[3],_e.y)}se[0]<Zn&&se[1]<Zn&&se[2]>=0&&se[3]>=0&&k.insert(L,se[0],se[1],se[2],se[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new f(new Fa(this.rawTileData)).layers,this.sourceLayerCoder=new cC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const n in this.vtLayers)this.vtFeatures[n]=[]}return this.vtLayers}query(n,o,d,g){this.loadVTLayers();const v=n.params||{},E=uo(v.filter),L=n.tileResult,k=n.transform,V=L.bufferedTilespaceBounds,q=this.grid.query(V.min.x,V.min.y,V.max.x,V.max.y,(Be,Le,Xe,xt)=>ud(L.bufferedTilespaceGeometry,Be,Le,Xe,xt));q.sort(R3);let se=null;k.elevation&&q.length>0&&(se=E0.create(k.elevation,this.tileID));const he={};let _e;for(let Be=0;Be<q.length;Be++){const Le=q[Be];if(Le===_e)continue;_e=Le;const Xe=this.featureIndexArray.get(Le);let xt=null;this.loadMatchingFeature(he,Xe,E,v.layers,v.availableImages,o,d,g,(Dt,_t,Tt,kt=0)=>(xt||(xt=Yh(Dt,this.tileID.canonical,n.tileTransform)),_t.queryIntersectsFeature(L,Dt,Tt,xt,this.z,n.transform,n.pixelPosMatrix,se,kt)))}return he}loadMatchingFeature(n,o,d,g,v,E,L,k,V){const{featureIndex:q,bucketIndex:se,sourceLayerIndex:he,layoutVertexArrayOffset:_e}=o,Be=this.bucketLayerIDs[se];if(g&&!function(Dt,_t){for(let Tt=0;Tt<Dt.length;Tt++)if(_t.indexOf(Dt[Tt])>=0)return!0;return!1}(g,Be))return;const Le=this.sourceLayerCoder.decode(he),Xe=this.vtLayers[Le].feature(q);if(d.needGeometry){const Dt=xA(Xe,!0);if(!d.filter(new qt(this.tileID.overscaledZ),Dt,this.tileID.canonical))return}else if(!d.filter(new qt(this.tileID.overscaledZ),Xe))return;const xt=this.getId(Xe,Le);for(let Dt=0;Dt<Be.length;Dt++){const _t=Be[Dt];if(g&&g.indexOf(_t)<0)continue;const Tt=E[_t];if(!Tt)continue;let kt={};xt!==void 0&&k&&(kt=k.getState(Tt.sourceLayer||"_geojsonTileLayer",xt));const Ut=Ve({},L[_t]);Ut.paint=CC(Ut.paint,Tt.paint,Xe,kt,v),Ut.layout=CC(Ut.layout,Tt.layout,Xe,kt,v);const ci=!V||V(Xe,Tt,kt,_e);if(!ci)continue;const oi=new hC(Xe,this.z,this.x,this.y,xt);oi.layer=Ut;let Ti=n[_t];Ti===void 0&&(Ti=n[_t]=[]),Ti.push({featureIndex:q,feature:oi,intersectionZ:ci})}}lookupSymbolFeatures(n,o,d,g,v,E,L,k){const V={};this.loadVTLayers();const q=uo(v);for(const se of n)this.loadMatchingFeature(V,{bucketIndex:d,sourceLayerIndex:g,featureIndex:se,layoutVertexArrayOffset:0},q,E,L,k,o);return V}loadFeature(n){const{featureIndex:o,sourceLayerIndex:d}=n;this.loadVTLayers();const g=this.sourceLayerCoder.decode(d),v=this.vtFeatures[g];if(v[o])return v[o];const E=this.vtLayers[g].feature(o);return v[o]=E,E}hasLayer(n){for(const o of this.bucketLayerIDs)for(const d of o)if(n===d)return!0;return!1}getId(n,o){let d=n.id;if(this.promoteId){const g=typeof this.promoteId=="string"?this.promoteId:this.promoteId[o];g!=null&&(d=n.properties[g]),typeof d=="boolean"&&(d=Number(d))}return d}}function CC(s,n,o,d,g){return ut(s,(v,E)=>{const L=n instanceof $i?n.get(E):null;return L&&L.evaluate?L.evaluate(o,d,g):L})}function R3(s,n){return n-s}zt(BC,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class EC{constructor(n,o){this.width=n,this.height=o,this.nextRow=0,this.image=new Yl({width:n,height:o}),this.positions={},this.uploaded=!1}getDash(n,o){const d=this.getKey(n,o);return this.positions[d]}trim(){const n=this.width,o=this.height=nt(this.nextRow);this.image.resize({width:n,height:o})}getKey(n,o){return n.join(",")+o}getDashRanges(n,o,d){const g=[];let v=n.length%2==1?-n[n.length-1]*d:0,E=n[0]*d,L=!0;g.push({left:v,right:E,isDash:L,zeroLength:n[0]===0});let k=n[0];for(let V=1;V<n.length;V++){L=!L;const q=n[V];v=k*d,k+=q,E=k*d,g.push({left:v,right:E,isDash:L,zeroLength:q===0})}return g}addRoundDash(n,o,d){const g=o/2;for(let v=-d;v<=d;v++){const E=this.width*(this.nextRow+d+v);let L=0,k=n[L];for(let V=0;V<this.width;V++){V/k.right>1&&(k=n[++L]);const q=Math.abs(V-k.left),se=Math.abs(V-k.right),he=Math.min(q,se);let _e;const Be=v/d*(g+1);if(k.isDash){const Le=g-Math.abs(Be);_e=Math.sqrt(he*he+Le*Le)}else _e=g-Math.sqrt(he*he+Be*Be);this.image.data[E+V]=Math.max(0,Math.min(255,_e+128))}}}addRegularDash(n,o){for(let k=n.length-1;k>=0;--k){const V=n[k],q=n[k+1];V.zeroLength?n.splice(k,1):q&&q.isDash===V.isDash&&(q.left=V.left,n.splice(k,1))}const d=n[0],g=n[n.length-1];d.isDash===g.isDash&&(d.left=g.left-this.width,g.right=d.right+this.width);const v=this.width*this.nextRow;let E=0,L=n[E];for(let k=0;k<this.width;k++){k/L.right>1&&(L=n[++E]);const V=Math.abs(k-L.left),q=Math.abs(k-L.right),se=Math.min(V,q);this.image.data[v+k]=Math.max(0,Math.min(255,(L.isDash?se:-se)+o+128))}}addDash(n,o){const d=this.getKey(n,o);if(this.positions[d])return this.positions[d];const g=o==="round",v=g?7:0,E=2*v+1;if(this.nextRow+E>this.height)return Ct("LineAtlas out of space"),null;n.length===0&&n.push(1);let L=0;for(let q=0;q<n.length;q++)n[q]<0&&(Ct("Negative value is found in line dasharray, replacing values with 0"),n[q]=0),L+=n[q];if(L!==0){const q=this.width/L,se=this.getDashRanges(n,this.width,q);g?this.addRoundDash(se,q,v):this.addRegularDash(se,o==="square"?.5*q:0)}const k=this.nextRow+v;this.nextRow+=E;const V={tl:[k,v],br:[L,0]};return this.positions[d]=V,V}}zt(EC,"LineAtlas");class TC{constructor(n){const o={},d=[];for(const L in n){const k=n[L],V=o[L]={};for(const q in k.glyphs){const se=k.glyphs[+q];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;const he=se.metrics.localGlyph?2:1,_e={x:0,y:0,w:se.bitmap.width+2*he,h:se.bitmap.height+2*he};d.push(_e),V[q]=_e}}const{w:g,h:v}=jf(d),E=new Yl({width:g||1,height:v||1});for(const L in n){const k=n[L];for(const V in k.glyphs){const q=k.glyphs[+V];if(!q||q.bitmap.width===0||q.bitmap.height===0)continue;const se=o[L][V],he=q.metrics.localGlyph?2:1;Yl.copy(q.bitmap,E,{x:0,y:0},{x:se.x+he,y:se.y+he},q.bitmap)}}this.image=E,this.positions=o}}zt(TC,"GlyphAtlas");class z3{constructor(n){this.tileID=new fn(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),this.tileZoom=n.tileZoom,this.uid=n.uid,this.zoom=n.zoom,this.canonical=n.tileID.canonical,this.pixelRatio=n.pixelRatio,this.tileSize=n.tileSize,this.source=n.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=n.showCollisionBoxes,this.collectResourceTiming=!!n.collectResourceTiming,this.returnDependencies=!!n.returnDependencies,this.promoteId=n.promoteId,this.enableTerrain=!!n.enableTerrain,this.isSymbolTile=n.isSymbolTile,this.tileTransform=Dp(n.tileID.canonical,n.projection),this.projection=n.projection}parse(n,o,d,g,v){this.status="parsing",this.data=n,this.collisionBoxArray=new sg;const E=new cC(Object.keys(n.layers).sort()),L=new BC(this.tileID,this.promoteId);L.bucketLayerIDs=[];const k={},V=new EC(256,256),q={featureIndex:L,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:V,availableImages:d},se=o.familiesBySource[this.source];for(const kt in se){const Ut=n.layers[kt];if(!Ut)continue;let ci=!1,oi=!1;for(const gi of se[kt])gi[0].type==="symbol"?ci=!0:oi=!0;if(this.isSymbolTile===!0&&!ci||this.isSymbolTile===!1&&!oi)continue;Ut.version===1&&Ct(`Vector tile source "${this.source}" layer "${kt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ti=E.encode(kt),Ki=[];for(let gi=0;gi<Ut.length;gi++){const Si=Ut.feature(gi),Li=L.getId(Si,kt);Ki.push({feature:Si,id:Li,index:gi,sourceLayerIndex:Ti})}for(const gi of se[kt]){const Si=gi[0];this.isSymbolTile!==void 0&&Si.type==="symbol"!==this.isSymbolTile||Si.minzoom&&this.zoom<Math.floor(Si.minzoom)||Si.maxzoom&&this.zoom>=Si.maxzoom||Si.visibility!=="none"&&(G1(gi,this.zoom,d),(k[Si.id]=Si.createBucket({index:L.bucketLayerIDs.length,layers:gi,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ti,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:d})).populate(Ki,q,this.tileID.canonical,this.tileTransform),L.bucketLayerIDs.push(gi.map(Li=>Li.id)))}}let he,_e,Be,Le;V.trim();const Xe={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},xt=ut(q.glyphDependencies,kt=>Object.keys(kt).map(Number));Object.keys(xt).length?g.send("getGlyphs",{uid:this.uid,stacks:xt},(kt,Ut)=>{he||(he=kt,_e=Ut,Tt.call(this))},void 0,!1,Xe):_e={};const Dt=Object.keys(q.iconDependencies);Dt.length?g.send("getImages",{icons:Dt,source:this.source,tileID:this.tileID,type:"icons"},(kt,Ut)=>{he||(he=kt,Be=Ut,Tt.call(this))},void 0,!1,Xe):Be={};const _t=Object.keys(q.patternDependencies);function Tt(){if(he)return v(he);if(_e&&Be&&Le){const kt=new TC(_e),Ut=new Tc(Be,Le);for(const ci in k){const oi=k[ci];oi instanceof Fd?(G1(oi.layers,this.zoom,d),s3(oi,_e,kt.positions,Be,Ut.iconPositions,this.showCollisionBoxes,d,this.tileID.canonical,this.tileZoom,this.projection)):oi.hasPattern&&(oi instanceof Qs||oi instanceof Mp||oi instanceof Ce)&&(G1(oi.layers,this.zoom,d),oi.addFeatures(q,this.tileID.canonical,Ut.patternPositions,d,this.tileTransform))}this.status="done",v(null,{buckets:We(k).filter(ci=>!ci.isEmpty()),featureIndex:L,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:kt.image,lineAtlas:V,imageAtlas:Ut,glyphMap:this.returnDependencies?_e:null,iconMap:this.returnDependencies?Be:null,glyphPositions:this.returnDependencies?kt.positions:null})}}_t.length?g.send("getImages",{icons:_t,source:this.source,tileID:this.tileID,type:"patterns"},(kt,Ut)=>{he||(he=kt,Le=Ut,Tt.call(this))},void 0,!1,Xe):Le={},Tt.call(this)}}function G1(s,n,o){const d=new qt(n);for(const g of s)g.recalculate(d,o)}class SC{constructor(n){this.entries={},this.scheduler=n}request(n,o,d,g){const v=this.entries[n]=this.entries[n]||{callbacks:[]};if(v.result){const[E,L]=v.result;return this.scheduler?this.scheduler.add(()=>{g(E,L)},o):g(E,L),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=d((E,L)=>{v.result=[E,L];for(const k of v.callbacks)this.scheduler?this.scheduler.add(()=>{k(E,L)},o):k(E,L);setTimeout(()=>delete this.entries[n],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(E=>E!==g),v.callbacks.length||(v.cancel(),delete this.entries[n]))}}}function MC(s,n,o){const d=JSON.stringify(s.request);return s.data&&(this.deduped.entries[d]={result:[null,s.data]}),this.deduped.request(d,{type:"parseTile",isSymbolTile:s.isSymbolTile,zoom:s.tileZoom},g=>{const v=Cn(s.request,(E,L,k,V)=>{E?g(E):L&&g(null,{vectorTile:o?void 0:new f(new Fa(L)),rawData:L,cacheControl:k,expires:V})});return()=>{v.cancel(),g()}},n)}i.ARRAY_TYPE=Sa,i.AUTH_ERR_MSG=wi,i.Aabb=Ko,i.Actor=class{constructor(s,n,o){this.target=s,this.parent=n,this.mapId=o,this.callbacks={},this.cancelCallbacks={},be(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=_i()?s:C,this.scheduler=new L3}send(s,n,o,d,g=!1,v){const E=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=v,this.callbacks[E]=o);const L=wn(this.globalScope)?void 0:[];return this.target.postMessage({id:E,type:s,hasCallback:!!o,targetMapId:d,mustQueue:g,sourceMapId:this.mapId,data:Bi(n,L)},L),{cancel:()=>{o&&delete this.callbacks[E],this.target.postMessage({id:E,type:"<cancel>",targetMapId:d,sourceMapId:this.mapId})}}}receive(s){const n=s.data,o=n.id;if(o&&(!n.targetMapId||this.mapId===n.targetMapId))if(n.type==="<cancel>"){const d=this.cancelCallbacks[o];delete this.cancelCallbacks[o],d&&d.cancel()}else if(n.mustQueue||_i()){const d=this.callbacks[o];this.cancelCallbacks[o]=this.scheduler.add(()=>this.processTask(o,n),d&&d.metadata||{type:"message"})}else this.processTask(o,n)}processTask(s,n){if(n.type==="<response>"){const o=this.callbacks[s];delete this.callbacks[s],o&&(n.error?o(Hi(n.error)):o(null,Hi(n.data)))}else{const o=wn(this.globalScope)?void 0:[],d=n.hasCallback?(v,E)=>{delete this.cancelCallbacks[s],this.target.postMessage({id:s,type:"<response>",sourceMapId:this.mapId,error:v?Bi(v):null,data:Bi(E,o)},o)}:v=>{},g=Hi(n.data);if(this.parent[n.type])this.parent[n.type](n.sourceMapId,g,d);else if(this.parent.getWorkerSource){const v=n.type.split(".");this.parent.getWorkerSource(n.sourceMapId,v[0],g.source)[v[1]](g,d)}else d(new Error(`Could not find function ${n.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=Fi,i.Color=ps,i.ColorMode=Uu,i.CullFaceMode=ru,i.DEMData=C0,i.DataConstantProperty=Jt,i.DedupedRequest=SC,i.DepthMode=em,i.EXTENT=Zn,i.Elevation=class{isDataAvailableAtPoint(s){const n=this._source();if(this.isUsingMockSource()||!n||s.y<0||s.y>1)return!1;const o=n.getSource().maxzoom,d=1<<o,g=Math.floor(s.x),v=Math.floor((s.x-g)*d),E=Math.floor(s.y*d),L=this.findDEMTileFor(new fn(o,g,o,v,E));return!(!L||!L.dem)}getAtPointOrZero(s,n=0){return this.getAtPoint(s,n)||0}getAtPoint(s,n,o=!0){if(this.isUsingMockSource())return null;n==null&&(n=null);const d=this._source();if(!d||s.y<0||s.y>1)return n;const g=d.getSource().maxzoom,v=1<<g,E=Math.floor(s.x),L=s.x-E,k=new fn(g,E,g,Math.floor(L*v),Math.floor(s.y*v)),V=this.findDEMTileFor(k);if(!V||!V.dem)return n;const q=V.dem,se=1<<V.tileID.canonical.z,he=(L*se-V.tileID.canonical.x)*q.dim,_e=(s.y*se-V.tileID.canonical.y)*q.dim,Be=Math.floor(he),Le=Math.floor(_e);return(o?this.exaggeration():1)*gr(gr(q.get(Be,Le),q.get(Be,Le+1),_e-Le),gr(q.get(Be+1,Le),q.get(Be+1,Le+1),_e-Le),he-Be)}getAtTileOffset(s,n,o){const d=1<<s.canonical.z;return this.getAtPointOrZero(new hd(s.wrap+(s.canonical.x+n/Zn)/d,(s.canonical.y+o/Zn)/d))}getAtTileOffsetFunc(s,n,o,d){return g=>{const v=this.getAtTileOffset(s,g.x,g.y),E=d.upVector(s.canonical,g.x,g.y);return da(E,E,v*d.upVectorScale(s.canonical,n,o).metersToTile),E}}getForTilePoints(s,n,o,d){if(this.isUsingMockSource())return!1;const g=E0.create(this,s,d);return!!g&&(n.forEach(v=>{v[2]=this.exaggeration()*g.getElevationAt(v[0],v[1],o)}),!0)}getMinMaxForTile(s){if(this.isUsingMockSource())return null;const n=this.findDEMTileFor(s);if(!n||!n.dem)return null;const o=n.dem.tree,d=n.tileID,g=1<<s.canonical.z-d.canonical.z;let v=s.canonical.x/g-d.canonical.x,E=s.canonical.y/g-d.canonical.y,L=0;for(let k=0;k<s.canonical.z-d.canonical.z&&!o.leaves[L];k++){v*=2,E*=2;const V=2*Math.floor(E)+Math.floor(v);L=o.childOffsets[L]+V,v%=1,E%=1}return{min:this.exaggeration()*o.minimums[L],max:this.exaggeration()*o.maximums[L]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(s,n,o){throw new Error("Pure virtual method called.")}pointCoordinate(s){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(s){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}},i.ErrorEvent=rr,i.EvaluationParameters=qt,i.Event=tn,i.Evented=yn,i.FillExtrusionBucket=Ce,i.Frustum=Rf,i.FrustumCorners=Uf,i.GLOBE_METERS_TO_ECEF=I1,i.GLOBE_RADIUS=LA,i.GLOBE_SCALE_MATCH_LATITUDE=45,i.GLOBE_ZOOM_THRESHOLD_MAX=6,i.GLOBE_ZOOM_THRESHOLD_MIN=5,i.GlobeSharedBuffers=class{constructor(s){this._createGrid(s),this._createPoles(s)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const s of this._poleSegments)s.destroy();for(const s of this._gridSegments)s.destroy();if(this._wireframeIndexBuffer){this._wireframeIndexBuffer.destroy();for(const s of this._wireframeSegments)s.destroy()}}_createGrid(s){const n=new Or,o=new _o,d=65;for(let g=0;g<d;g++)for(let v=0;v<d;v++)n.emplaceBack(v,g);this._gridSegments=[];for(let g=0,v=0;g<Xf.length;g++){const E=Xf[g];for(let k=0;k<E;k++)for(let V=0;V<64;V++){const q=k*d+V;o.emplaceBack(q+1,q,q+d),o.emplaceBack(q+d,q+d+1,q+1)}const L=64*E*2;this._gridSegments.push(to.simpleSegment(0,v,(E+1)*d,L)),v+=L}this._gridBuffer=s.createVertexBuffer(n,kg.members),this._gridIndexBuffer=s.createIndexBuffer(o,!0)}_createPoles(s){const n=new _o;for(let g=0;g<=Zf;g++)n.emplaceBack(0,g+1,g+2);this._poleIndexBuffer=s.createIndexBuffer(n,!0);const o=new $h,d=new $h;this._poleSegments=[];for(let g=0,v=0;g<5;g++){const E=360/(1<<g);o.emplaceBack(0,-LA,0,.5,0),d.emplaceBack(0,-LA,0,.5,1);for(let L=0;L<=Zf;L++){const k=L/Zf,V=gr(0,E,k),[q,se,he]=qf(A3,d3,V,LA);o.emplaceBack(q,se,he,k,0),d.emplaceBack(q,se,he,k,1)}this._poleSegments.push(to.simpleSegment(v,0,66,64)),v+=66}this._poleNorthVertexBuffer=s.createVertexBuffer(o,KB,!1),this._poleSouthVertexBuffer=s.createVertexBuffer(d,KB,!1)}getGridBuffers(s){return[this._gridBuffer,this._gridIndexBuffer,this._gridSegments[s]]}getPoleBuffers(s){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[s]]}getWirefameBuffers(s,n){if(!this._wireframeSegments){const o=new Ka,d=Zf,g=d+1;this._wireframeSegments=[];for(let v=0,E=0;v<Xf.length;v++){const L=Xf[v];for(let V=0;V<L;V++)for(let q=0;q<d;q++){const se=V*g+q;o.emplaceBack(se,se+1),o.emplaceBack(se,se+g),o.emplaceBack(se,se+g+1)}const k=L*d*3;this._wireframeSegments.push(to.simpleSegment(0,E,(L+1)*g,k)),E+=k}this._wireframeIndexBuffer=s.createIndexBuffer(o)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[n]]}},i.GlyphManager=Kf,i.ImagePosition=Xo,i.LivePerformanceUtils=tt,i.LngLat=Pr,i.LngLatBounds=wl,i.LocalGlyphMode=E1,i.MAX_MERCATOR_LATITUDE=$a,i.MercatorCoordinate=hd,i.ONE_EM=Jr,i.OverscaledTileID=fn,i.PerformanceMarkers=Ue,i.Properties=Hn,i.RGBAImage=Za,i.Ray=Pf,i.RequestManager=class{constructor(s,n,o){this._transformRequestFn=s,this._customAccessToken=n,this._silenceAuthErrors=!!o,this._createSkuToken()}_createSkuToken(){const s=function(){let n="";for(let o=0;o<10;o++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",ce,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=s.token,this._skuTokenExpiresAt=s.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(s,n){return this._transformRequestFn&&this._transformRequestFn(s,n)||{url:s}}normalizeStyleURL(s,n){if(!Wi(s))return s;const o=kr(s);return o.path=`/styles/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||n)}normalizeGlyphsURL(s,n){if(!Wi(s))return s;const o=kr(s);return o.path=`/fonts/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||n)}normalizeSourceURL(s,n,o,d){if(!Wi(s))return s;const g=kr(s);return g.path=`/v4/${g.authority}.json`,g.params.push("secure"),o&&g.params.push(`language=${o}`),d&&g.params.push(`worldview=${d}`),this._makeAPIURL(g,this._customAccessToken||n)}normalizeSpriteURL(s,n,o,d){const g=kr(s);return Wi(s)?(g.path=`/styles/v1${g.path}/sprite${n}${o}`,this._makeAPIURL(g,this._customAccessToken||d)):(g.path+=`${n}${o}`,Qn(g))}normalizeTileURL(s,n,o){if(this._isSkuTokenExpired()&&this._createSkuToken(),s&&!Wi(s))return s;const d=kr(s);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||o&&d.authority!=="raster"&&o===512?"@2x":""}${z.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${Q.RASTER_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${Q.TILE_URL_VERSION}${d.path}`);const g=this._customAccessToken||function(v){for(const E of v){const L=E.match(/^access_token=(.*)$/);if(L)return L[1]}return null}(d.params)||Q.ACCESS_TOKEN;return Q.REQUIRE_ACCESS_TOKEN&&g&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,g)}canonicalizeTileURL(s,n){const o=kr(s);if(!o.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!o.path.match(/\.[\w]+$/))return s;let d="mapbox://";o.path.match(/^\/raster\/v1\//)?d+=`raster/${o.path.replace(`/${Q.RASTER_URL_PREFIX}/`,"")}`:d+=`tiles/${o.path.replace(`/${Q.TILE_URL_VERSION}/`,"")}`;let g=o.params;return n&&(g=g.filter(v=>!v.match(/^access_token=/))),g.length&&(d+=`?${g.join("&")}`),d}canonicalizeTileset(s,n){const o=!!n&&Wi(n),d=[];for(const g of s.tiles||[])Ui(g)?d.push(this.canonicalizeTileURL(g,o)):d.push(g);return d}_makeAPIURL(s,n){const o="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=kr(Q.API_URL);if(s.protocol=d.protocol,s.authority=d.authority,s.protocol==="http"){const g=s.params.indexOf("secure");g>=0&&s.params.splice(g,1)}if(d.path!=="/"&&(s.path=`${d.path}${s.path}`),!Q.REQUIRE_ACCESS_TOKEN)return Qn(s);if(n=n||Q.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${o}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${o}`)}return s.params=s.params.filter(g=>g.indexOf("access_token")===-1),s.params.push(`access_token=${n||""}`),Qn(s)}},i.ResourceType=ii,i.SegmentVector=to,i.SourceCache=Pp,i.StencilMode=Q1,i.StructArrayLayout1ui2=Xh,i.StructArrayLayout2f1f2i16=Io,i.StructArrayLayout2i4=Or,i.StructArrayLayout2ui4=Ka,i.StructArrayLayout3f12=ja,i.StructArrayLayout3ui6=_o,i.StructArrayLayout4i8=Qr,i.StructArrayLayout5f20=$h,i.Texture=jg,i.Tile=O1,i.Transitionable=Ci,i.Uniform1f=mA,i.Uniform1i=class extends oh{constructor(s){super(s),this.current=0}set(s,n,o){this.fetchUniformLocation(s,n)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}},i.Uniform2f=class extends oh{constructor(s){super(s),this.current=[0,0]}set(s,n,o){this.fetchUniformLocation(s,n)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}},i.Uniform3f=class extends oh{constructor(s){super(s),this.current=[0,0,0]}set(s,n,o){this.fetchUniformLocation(s,n)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}},i.Uniform4f=dp,i.UniformColor=ld,i.UniformMatrix2f=class extends oh{constructor(s){super(s),this.current=pp}set(s,n,o){if(this.fetchUniformLocation(s,n)){for(let d=0;d<4;d++)if(o[d]!==this.current[d]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}},i.UniformMatrix3f=class extends oh{constructor(s){super(s),this.current=Py}set(s,n,o){if(this.fetchUniformLocation(s,n)){for(let d=0;d<9;d++)if(o[d]!==this.current[d]){this.current=o,this.gl.uniformMatrix3fv(this.location,!1,o);break}}}},i.UniformMatrix4f=class extends oh{constructor(s){super(s),this.current=Dy}set(s,n,o){if(this.fetchUniformLocation(s,n)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let d=1;d<16;d++)if(o[d]!==this.current[d]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}},i.UnwrappedTileID=Sn,i.ValidationError=An,i.VectorTileFeature=w,i.VectorTileWorkerSource=class extends yn{constructor(s,n,o,d,g){super(),this.actor=s,this.layerIndex=n,this.availableImages=o,this.loadVectorData=g||MC,this.loading={},this.loaded={},this.deduped=new SC(s.scheduler),this.isSpriteLoaded=d,this.scheduler=s.scheduler}loadTile(s,n){const o=s.uid,d=s&&s.request,g=d&&d.collectResourceTiming,v=this.loading[o]=new z3(s);v.abort=this.loadVectorData(s,(E,L)=>{const k=!this.loading[o];if(delete this.loading[o],k||E||!L)return v.status="done",k||(this.loaded[o]=v),n(E);const V=L.rawData,q={};L.expires&&(q.expires=L.expires),L.cacheControl&&(q.cacheControl=L.cacheControl),v.vectorTile=L.vectorTile||new f(new Fa(V));const se=()=>{v.parse(v.vectorTile,this.layerIndex,this.availableImages,this.actor,(he,_e)=>{if(he||!_e)return n(he);const Be={};if(g){const Le=pt(d);Le.length>0&&(Be.resourceTiming=JSON.parse(JSON.stringify(Le)))}n(null,Ve({rawTileData:V.slice(0)},_e,q,Be))})};this.isSpriteLoaded?se():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(se,{type:"parseTile",isSymbolTile:s.isSymbolTile,zoom:s.tileZoom}):se()}),this.loaded=this.loaded||{},this.loaded[o]=v})}reloadTile(s,n){const o=this.loaded,d=s.uid,g=this;if(o&&o[d]){const v=o[d];v.showCollisionBoxes=s.showCollisionBoxes,v.enableTerrain=!!s.enableTerrain,v.projection=s.projection,v.tileTransform=Dp(s.tileID.canonical,s.projection);const E=(L,k)=>{const V=v.reloadCallback;V&&(delete v.reloadCallback,v.parse(v.vectorTile,g.layerIndex,this.availableImages,g.actor,V)),n(L,k)};v.status==="parsing"?v.reloadCallback=E:v.status==="done"&&(v.vectorTile?v.parse(v.vectorTile,this.layerIndex,this.availableImages,this.actor,E):E())}}abortTile(s,n){const o=s.uid,d=this.loading[o];d&&(d.abort&&d.abort(),delete this.loading[o]),n()}removeTile(s,n){const o=this.loaded,d=s.uid;o&&o[d]&&delete o[d],n()}},i.WritingMode=qo,i.add=Jh,i.addDynamicAttributes=w0,i.adjoint=function(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=n[4],L=n[5],k=n[6],V=n[7],q=n[8];return s[0]=E*q-L*V,s[1]=g*V-d*q,s[2]=d*L-g*E,s[3]=L*k-v*q,s[4]=o*q-g*k,s[5]=g*v-o*L,s[6]=v*V-E*k,s[7]=d*k-o*V,s[8]=o*E-d*v,s},i.asyncAll=Oe,i.bezier=te,i.bindAll=be,i.boundsAttributes=AC,i.bufferConvexPolygon=function(s,n){const o=[];for(let d=0;d<s.length;d++){const g=Re(d-1,-1,s.length-1),v=Re(d+1,-1,s.length-1),E=s[d],L=s[v],k=s[g].sub(E).unit(),V=L.sub(E).unit(),q=V.angleWithSep(k.x,k.y),se=k.add(V).unit().mult(-1*n/Math.sin(q/2));o.push(E.add(se))}return o},i.cacheEntryPossiblyAdded=function(s){at++,at>Ni&&(s.getActor().send("enforceCacheSizeLimit",ti),at=0)},i.calculateGlobeLabelMatrix=function(s,n){const{x:o,y:d}=s.point,g=JB(o,d,s.worldSize/s._pixelsPerMercatorPixel,0,0);return bA(g,g,D1(Lu(n)))},i.calculateGlobeMatrix=function(s){const{x:n,y:o}=s.point,{lng:d,lat:g}=s._center;return JB(n,o,s.worldSize,d,g)},i.calculateGlobeMercatorMatrix=function(s){const n=s.pixelsPerMeter,o=n/Xl(1,s.center.lat),d=ql(new Float64Array(16));return xp(d,d,[s.point.x,s.point.y,0]),BA(d,d,[o,o,n]),Float32Array.from(d)},i.circumferenceAtLatitude=Tf,i.clamp=ye,i.clearTileCache=function(s){if(!qi())return;const n=C.caches.delete(kn);s&&n.catch(s).then(()=>s())},i.clipLine=OB,i.clone=function(s){var n=new Sa(16);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],n},i.clone$1=Gt,i.collisionCircleLayout=pa,i.config=Q,i.conjugate=function(s,n){return s[0]=-n[0],s[1]=-n[1],s[2]=-n[2],s[3]=n[3],s},i.create=function(){var s=new Sa(16);return Sa!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},i.create$1=hh,i.createExpression=Ms,i.createLayout=_n,i.createStyleLayer=function(s){return s.type==="custom"?new S3(s):new I3[s.type](s)},i.cross=md,i.degToRad=Ge,i.distance=function(s,n){return Math.hypot(n[0]-s[0],n[1]-s[1],n[2]-s[2])},i.div=function(s,n,o){return s[0]=n[0]/o[0],s[1]=n[1]/o[1],s[2]=n[2]/o[2],s},i.dot=Ma,i.earthRadius=Ef,i.ease=le,i.easeCubicInOut=xi,i.ecefToLatLng=function([s,n,o]){const d=Math.hypot(s,n,o),g=Math.atan2(s,o),v=.5*Math.PI-Math.acos(-n/d);return new Pr(Et(g),Et(v))},i.emitValidationErrors=Vt,i.endsWith=At,i.enforceCacheSizeLimit=function(s){en(),yt&&yt.then(n=>{n.keys().then(o=>{for(let d=0;d<o.length-s;d++)n.delete(o[d])})})},i.evaluateSizeForFeature=$s,i.evaluateSizeForZoom=pr,i.evaluateVariableOffset=GB,i.evented=It,i.exactEquals=function(s,n){return s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]&&s[3]===n[3]},i.exactEquals$1=function(s,n){return s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]},i.exported=bi,i.exported$1=z,i.extend=Ve,i.extend$1=sr,i.fillExtrusionHeightLift=ri,i.filterObject=Nt,i.fromMat4=function(s,n){return s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[4],s[4]=n[5],s[5]=n[6],s[6]=n[8],s[7]=n[9],s[8]=n[10],s},i.fromQuat=function(s,n){var o=n[0],d=n[1],g=n[2],v=n[3],E=o+o,L=d+d,k=g+g,V=o*E,q=d*E,se=d*L,he=g*E,_e=g*L,Be=g*k,Le=v*E,Xe=v*L,xt=v*k;return s[0]=1-se-Be,s[1]=q+xt,s[2]=he-Xe,s[3]=0,s[4]=q-xt,s[5]=1-V-Be,s[6]=_e+Le,s[7]=0,s[8]=he+Xe,s[9]=_e-Le,s[10]=1-V-se,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},i.fromRotation=function(s,n){var o=Math.sin(n),d=Math.cos(n);return s[0]=d,s[1]=o,s[2]=0,s[3]=-o,s[4]=d,s[5]=0,s[6]=0,s[7]=0,s[8]=1,s},i.fromScaling=Gy,i.furthestTileCorner=function(s){const n=Math.round((s+45+360)%360/90)%4;return li[n]},i.getAABBPointSquareDist=function(s,n,o){let d=0;for(let g=0;g<2;++g){const v=o?o[g]:0;s[g]>v&&(d+=(s[g]-v)*(s[g]-v)),n[g]<v&&(d+=(v-n[g])*(v-n[g]))}return d},i.getAnchorAlignment=C1,i.getAnchorJustification=S1,i.getBounds=function(s){let n=1/0,o=1/0,d=-1/0,g=-1/0;for(const v of s)n=Math.min(n,v.x),o=Math.min(o,v.y),d=Math.max(d,v.x),g=Math.max(g,v.y);return{min:new me(n,o),max:new me(d,g)}},i.getColumn=Gn,i.getGridMatrix=function(s,n,o,d){const g=n.getNorth(),v=n.getSouth(),E=n.getWest(),L=n.getEast(),k=1<<s.z,V=L-E,q=g-v,se=V/Zf,he=-q/Xf[o],_e=[0,se,0,he,0,0,g,E,0];if(s.z>0){const Be=180/d;wA(_e,_e,[Be/V+1,0,0,0,Be/q+1,0,-.5*Be/se,.5*Be/he,1])}return _e[2]=k,_e[5]=s.x,_e[8]=s.y,_e},i.getImage=Ot,i.getJSON=function(s,n){return on(Ve(s,{type:"json"}),n)},i.getLatitudinalLod=function(s){const n=80.051129;s=ye(s,-80.051129,n)/n*90;const o=Math.pow(Math.abs(Math.sin(Ge(s))),3);return Math.round(o*(Xf.length-1))},i.getMapSessionAPI=ne,i.getPerformanceMeasurement=pt,i.getProjection=aC,i.getRTLTextPluginStatus=Ht,i.getReferrer=Xi,i.getTilePoint=function(s,{x:n,y:o},d=0){return new me(((n-d)*s.scale-s.x)*Zn,(o*s.scale-s.y)*Zn)},i.getTileVec3=function(s,n,o=0){return pd(((n.x-o)*s.scale-s.x)*Zn,(n.y*s.scale-s.y)*Zn,Sf(n.z,n.y))},i.getVideo=function(s,n){const o=C.document.createElement("video");o.muted=!0,o.onloadstart=function(){n(null,o)};for(let d=0;d<s.length;d++){const g=C.document.createElement("source");Tn(s[d])||(o.crossOrigin="Anonymous"),g.src=s[d],o.appendChild(g)}return{cancel:()=>{}}},i.globeCenterToScreenPoint=function(s){const n=[0,0,0],o=ql(new Float64Array(16));return bA(o,s.pixelMatrix,s.globeMatrix),Ns(n,n,o),new me(n[0],n[1])},i.globeDenormalizeECEF=D1,i.globeECEFOrigin=function(s,n){const o=[0,0,0];return Ns(o,o,Qg(Lu(n.canonical))),Ns(o,o,s),o},i.globeNormalizeECEF=Qg,i.globePixelsToTileUnits=function(s,n){return Zn/(512*Math.pow(2,s))*g0(Lu(n))},i.globePoleMatrixForTile=function(s,n,o){const d=ql(new Float64Array(16)),g=(n/(1<<s)-.5)*Math.PI*2;return Ff(d,o.globeMatrix,g),Float32Array.from(d)},i.globeTileBounds=Lu,i.globeTiltAtLngLat=eC,i.globeToMercatorTransition=Yf,i.globeUseCustomAntiAliasing=function(s,n,o){const d=Yf(o.zoom),g=s.style.map._antialias,v=!!n.extStandardDerivatives,E=n.extStandardDerivativesForceOff||s.terrain&&s.terrain.exaggeration()>0;return d===0&&!g&&!E&&v},i.identity=ql,i.identity$1=bg,i.invert=_g,i.isFullscreen=function(){return!!C.document.fullscreenElement||!!C.document.webkitFullscreenElement},i.isLngLatBehindGlobe=P1,i.isMapAuthenticated=function(s){return de.has(s)},i.isMapboxURL=Wi,i.isSafariWithAntialiasingBug=function(s){const n=s.navigator?s.navigator.userAgent:null;return!!wn(s)&&n&&(n.match("Version/15.4")||n.match("Version/15.5")||n.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},i.latFromMercatorY=Fo,i.latLngToECEF=Og,i.len=Ky,i.length=dd,i.length$1=function(s){return Math.hypot(s[0],s[1],s[2],s[3])},i.lngFromMercatorX=bl,i.loadVectorTile=MC,i.makeRequest=on,i.mapValue=function(s,n,o,d,g){return ye((s-n)/(o-n)*(g-d)+d,d,g)},i.mercatorScale=Mf,i.mercatorXfromLng=wc,i.mercatorYfromLat=ch,i.mercatorZfromAltitude=Xl,i.mul=c1,i.mul$1=jy,i.multiply=bA,i.multiply$1=wA,i.multiply$2=vg,i.nextPowerOfTwo=nt,i.normalize=so,i.normalize$1=Iu,i.normalize$2=Df,i.number=gr,i.ortho=function(s,n,o,d,g,v,E){var L=1/(n-o),k=1/(d-g),V=1/(v-E);return s[0]=-2*L,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=-2*k,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=2*V,s[11]=0,s[12]=(n+o)*L,s[13]=(g+d)*k,s[14]=(E+v)*V,s[15]=1,s},i.pbf=Fa,i.perspective=function(s,n,o,d,g){var v,E=1/Math.tan(n/2);return s[0]=E/o,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=E,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,g!=null&&g!==1/0?(s[10]=(g+d)*(v=1/(d-g)),s[14]=2*g*d*v):(s[10]=-1,s[14]=-2*d),s},i.pick=function(s,n){const o={};for(let d=0;d<n.length;d++){const g=n[d];g in s&&(o[g]=s[g])}return o},i.plugin=si,i.pointGeometry=me,i.polesInViewport=function(s){const n=ql(new Float64Array(16));bA(n,s.pixelMatrix,s.globeMatrix);const o=[0,fh,0],d=[0,mh,0];return Ns(o,o,n),Ns(d,d,n),[o[0]>0&&o[0]<=s.width&&o[1]>0&&o[1]<=s.height&&!P1(s,new Pr(s.center.lat,90)),d[0]>0&&d[0]<=s.width&&d[1]>0&&d[1]<=s.height&&!P1(s,new Pr(s.center.lat,-90))]},i.polygonContainsPoint=vA,i.polygonIntersectsBox=ud,i.polygonIntersectsPolygon=Ny,i.polygonizeBounds=function(s,n,o=0,d=!0){const g=new me(o,o),v=s.sub(g),E=n.add(g),L=[v,new me(E.x,v.y),E,new me(v.x,E.y)];return d&&L.push(v.clone()),L},i.posAttributes=kg,i.postMapLoadEvent=wt,i.postPerformanceEvent=j,i.postTurnstileEvent=Pe,i.potpack=jf,i.prevPowerOfTwo=function(s){return s<=1?1:Math.pow(2,Math.floor(Math.log(s)/Math.LN2))},i.radToDeg=Et,i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.registerForPluginStateChange=function(s){return s({pluginStatus:dt,pluginURL:ht}),It.on("pluginStateChange",s),s},i.removeAuthState=function(s){de.delete(s)},i.renderColorRamp=Tg,i.resample=zy,i.rotateX=yg,i.rotateX$1=uh,i.rotateY=Ff,i.rotateY$1=Bg,i.rotateZ=function(s,n,o){var d=Math.sin(o),g=Math.cos(o),v=n[0],E=n[1],L=n[2],k=n[3],V=n[4],q=n[5],se=n[6],he=n[7];return n!==s&&(s[8]=n[8],s[9]=n[9],s[10]=n[10],s[11]=n[11],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=v*g+V*d,s[1]=E*g+q*d,s[2]=L*g+se*d,s[3]=k*g+he*d,s[4]=V*g-v*d,s[5]=q*g-E*d,s[6]=se*g-L*d,s[7]=he*g-k*d,s},i.rotateZ$1=function(s,n,o){o*=.5;var d=n[0],g=n[1],v=n[2],E=n[3],L=Math.sin(o),k=Math.cos(o);return s[0]=d*k+g*L,s[1]=g*k-d*L,s[2]=v*k+E*L,s[3]=E*k-v*L,s},i.scale=BA,i.scale$1=Lf,i.scale$2=da,i.scaleAndAdd=eu,i.set=function(s,n,o,d){return s[0]=n,s[1]=o,s[2]=d,s},i.setCacheLimits=function(s,n){ti=s,Ni=n},i.setColumn=function(s,n,o){s[4*n+0]=o[0],s[4*n+1]=o[1],s[4*n+2]=o[2],s[4*n+3]=o[3]},i.setRTLTextPlugin=function(s,n,o=!1){if(dt===it||dt===lt||dt===qe)throw new Error("setRTLTextPlugin cannot be called multiple times.");ht=bi.resolveURL(s),dt=it,Ye=n,Pt(),o||hi()},i.smoothstep=xe,i.spec=Yt,i.squaredLength=function(s){var n=s[0],o=s[1],d=s[2];return n*n+o*o+d*d},i.storeAuthState=function(s,n){n?de.add(s):de.delete(s)},i.sub=bc,i.subtract=xg,i.symbolSize=qa,i.tileAABB=function(s,n,o,d,g,v,E,L,k){if(k.name==="globe")return u3(s,n,new Fi(o,d,g));const V=Dp({z:o,x:d,y:g},k);return new Ko([(v+V.x/V.scale)*n,n*(V.y/V.scale),E],[(v+V.x2/V.scale)*n,n*(V.y2/V.scale),L])},i.tileCornersToBounds=m0,i.tileTransform=Dp,i.transformMat3=function(s,n,o){var d=n[0],g=n[1],v=n[2];return s[0]=d*o[0]+g*o[3]+v*o[6],s[1]=d*o[1]+g*o[4]+v*o[7],s[2]=d*o[2]+g*o[5]+v*o[8],s},i.transformMat4=Ns,i.transformMat4$1=TA,i.transformQuat=wg,i.transitionTileAABBinECEF=XB,i.translate=xp,i.transpose=function(s,n){if(s===n){var o=n[1],d=n[2],g=n[5];s[1]=n[3],s[2]=n[6],s[3]=o,s[5]=n[7],s[6]=d,s[7]=g}else s[0]=n[0],s[1]=n[3],s[2]=n[6],s[3]=n[1],s[4]=n[4],s[5]=n[7],s[6]=n[2],s[7]=n[5],s[8]=n[8];return s},i.triggerPluginCompletionEvent=Bt,i.uniqueId=Se,i.updateGlobeVertexNormal=function(s,n,o,d,g){const v=5*n+2;s.float32[v+0]=o,s.float32[v+1]=d,s.float32[v+2]=g},i.validateCustomStyleLayer=function(s){const n=[],o=s.id;return o===void 0&&n.push({message:`layers.${o}: missing required property "id"`}),s.render===void 0&&n.push({message:`layers.${o}: missing required method "render"`}),s.renderingMode&&s.renderingMode!=="2d"&&s.renderingMode!=="3d"&&n.push({message:`layers.${o}: property "renderingMode" must be either "2d" or "3d"`}),n},i.validateFilter=s=>gt(hs(s)),i.validateFog=s=>gt(ue(s)),i.validateLayer=s=>gt(h(s)),i.validateLight=s=>gt(K(s)),i.validateSource=s=>gt(F(s)),i.validateStyle=je,i.validateTerrain=s=>gt(oe(s)),i.values=We,i.vectorTile=Fp,i.version=D,i.warnOnce=Ct,i.window=C,i.wrap=Re}),p(["./shared"],function(i){function C(ot){if(typeof ot=="number"||typeof ot=="boolean"||typeof ot=="string"||ot==null)return JSON.stringify(ot);if(Array.isArray(ot)){let Pe="[";for(const ct of ot)Pe+=`${C(ct)},`;return`${Pe}]`}let Ee="{";for(const Pe of Object.keys(ot).sort())Ee+=`${Pe}:${C(ot[Pe])},`;return`${Ee}}`}function D(ot){let Ee="";for(const Pe of i.refProperties)Ee+=`/${C(ot[Pe])}`;return Ee}class R{constructor(Ee){this.keyCache={},Ee&&this.replace(Ee)}replace(Ee){this._layerConfigs={},this._layers={},this.update(Ee,[])}update(Ee,Pe){for(const wt of Ee)this._layerConfigs[wt.id]=wt,(this._layers[wt.id]=i.createStyleLayer(wt)).compileFilter(),this.keyCache[wt.id]&&delete this.keyCache[wt.id];for(const wt of Pe)delete this.keyCache[wt],delete this._layerConfigs[wt],delete this._layers[wt];this.familiesBySource={};const ct=function(wt,X){const j={};for(let ne=0;ne<wt.length;ne++){const de=X&&X[wt[ne].id]||D(wt[ne]);X&&(X[wt[ne].id]=de);let Ue=j[de];Ue||(Ue=j[de]=[]),Ue.push(wt[ne])}const ie=[];for(const ne in j)ie.push(j[ne]);return ie}(i.values(this._layerConfigs),this.keyCache);for(const wt of ct){const X=wt.map(tt=>this._layers[tt.id]),j=X[0];if(j.visibility==="none")continue;const ie=j.source||"";let ne=this.familiesBySource[ie];ne||(ne=this.familiesBySource[ie]={});const de=j.sourceLayer||"_geojsonTileLayer";let Ue=ne[de];Ue||(Ue=ne[de]=[]),Ue.push(X)}}}class Q{loadTile(Ee,Pe){const{uid:ct,encoding:wt,rawImageData:X,padding:j,buildQuadTree:ie}=Ee,ne=i.window.ImageBitmap&&X instanceof i.window.ImageBitmap?this.getImageData(X,j):X;Pe(null,new i.DEMData(ct,ne,wt,j<1,ie))}getImageData(Ee,Pe){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Ee.width,Ee.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=Ee.width,this.offscreenCanvas.height=Ee.height,this.offscreenCanvasContext.drawImage(Ee,0,0,Ee.width,Ee.height);const ct=this.offscreenCanvasContext.getImageData(-Pe,-Pe,Ee.width+2*Pe,Ee.height+2*Pe);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),ct}}var z=function ot(Ee,Pe){var ct,wt=Ee&&Ee.type;if(wt==="FeatureCollection")for(ct=0;ct<Ee.features.length;ct++)ot(Ee.features[ct],Pe);else if(wt==="GeometryCollection")for(ct=0;ct<Ee.geometries.length;ct++)ot(Ee.geometries[ct],Pe);else if(wt==="Feature")ot(Ee.geometry,Pe);else if(wt==="Polygon")G(Ee.coordinates,Pe);else if(wt==="MultiPolygon")for(ct=0;ct<Ee.coordinates.length;ct++)G(Ee.coordinates[ct],Pe);return Ee};function G(ot,Ee){if(ot.length!==0){J(ot[0],Ee);for(var Pe=1;Pe<ot.length;Pe++)J(ot[Pe],!Ee)}}function J(ot,Ee){for(var Pe=0,ct=0,wt=0,X=ot.length,j=X-1;wt<X;j=wt++){var ie=(ot[wt][0]-ot[j][0])*(ot[j][1]+ot[wt][1]),ne=Pe+ie;ct+=Math.abs(Pe)>=Math.abs(ie)?Pe-ne+ie:ie-ne+Pe,Pe=ne}Pe+ct>=0!=!!Ee&&ot.reverse()}const Y=i.VectorTileFeature.prototype.toGeoJSON;class B{constructor(Ee){this._feature=Ee,this.extent=i.EXTENT,this.type=Ee.type,this.properties=Ee.tags,"id"in Ee&&!isNaN(Ee.id)&&(this.id=parseInt(Ee.id,10))}loadGeometry(){if(this._feature.type===1){const Ee=[];for(const Pe of this._feature.geometry)Ee.push([new i.pointGeometry(Pe[0],Pe[1])]);return Ee}{const Ee=[];for(const Pe of this._feature.geometry){const ct=[];for(const wt of Pe)ct.push(new i.pointGeometry(wt[0],wt[1]));Ee.push(ct)}return Ee}}toGeoJSON(Ee,Pe,ct){return Y.call(this,Ee,Pe,ct)}}class ae{constructor(Ee){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=Ee.length,this._features=Ee}feature(Ee){return new B(this._features[Ee])}}var ce={exports:{}},Ae=i.pointGeometry,we=i.vectorTile.VectorTileFeature,me=De;function De(ot,Ee){this.options=Ee||{},this.features=ot,this.length=ot.length}function Je(ot,Ee){this.id=typeof ot.id=="number"?ot.id:void 0,this.type=ot.type,this.rawGeometry=ot.type===1?[ot.geometry]:ot.geometry,this.properties=ot.tags,this.extent=Ee||4096}De.prototype.feature=function(ot){return new Je(this.features[ot],this.options.extent)},Je.prototype.loadGeometry=function(){var ot=this.rawGeometry;this.geometry=[];for(var Ee=0;Ee<ot.length;Ee++){for(var Pe=ot[Ee],ct=[],wt=0;wt<Pe.length;wt++)ct.push(new Ae(Pe[wt][0],Pe[wt][1]));this.geometry.push(ct)}return this.geometry},Je.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ot=this.geometry,Ee=1/0,Pe=-1/0,ct=1/0,wt=-1/0,X=0;X<ot.length;X++)for(var j=ot[X],ie=0;ie<j.length;ie++){var ne=j[ie];Ee=Math.min(Ee,ne.x),Pe=Math.max(Pe,ne.x),ct=Math.min(ct,ne.y),wt=Math.max(wt,ne.y)}return[Ee,ct,Pe,wt]},Je.prototype.toGeoJSON=we.prototype.toGeoJSON;var Fe=i.pbf,Ge=me;function Et(ot){var Ee=new Fe;return function(Pe,ct){for(var wt in Pe.layers)ct.writeMessage(3,li,Pe.layers[wt])}(ot,Ee),Ee.finish()}function li(ot,Ee){var Pe;Ee.writeVarintField(15,ot.version||1),Ee.writeStringField(1,ot.name||""),Ee.writeVarintField(5,ot.extent||4096);var ct={keys:[],values:[],keycache:{},valuecache:{}};for(Pe=0;Pe<ot.length;Pe++)ct.feature=ot.feature(Pe),Ee.writeMessage(2,xi,ct);var wt=ct.keys;for(Pe=0;Pe<wt.length;Pe++)Ee.writeStringField(3,wt[Pe]);var X=ct.values;for(Pe=0;Pe<X.length;Pe++)Ee.writeMessage(4,Re,X[Pe])}function xi(ot,Ee){var Pe=ot.feature;Pe.id!==void 0&&Ee.writeVarintField(1,Pe.id),Ee.writeMessage(2,te,ot),Ee.writeVarintField(3,Pe.type),Ee.writeMessage(4,xe,Pe)}function te(ot,Ee){var Pe=ot.feature,ct=ot.keys,wt=ot.values,X=ot.keycache,j=ot.valuecache;for(var ie in Pe.properties){var ne=Pe.properties[ie],de=X[ie];if(ne!==null){de===void 0&&(ct.push(ie),X[ie]=de=ct.length-1),Ee.writeVarint(de);var Ue=typeof ne;Ue!=="string"&&Ue!=="boolean"&&Ue!=="number"&&(ne=JSON.stringify(ne));var tt=Ue+":"+ne,He=j[tt];He===void 0&&(wt.push(ne),j[tt]=He=wt.length-1),Ee.writeVarint(He)}}}function le(ot,Ee){return(Ee<<3)+(7&ot)}function ye(ot){return ot<<1^ot>>31}function xe(ot,Ee){for(var Pe=ot.loadGeometry(),ct=ot.type,wt=0,X=0,j=Pe.length,ie=0;ie<j;ie++){var ne=Pe[ie],de=1;ct===1&&(de=ne.length),Ee.writeVarint(le(1,de));for(var Ue=ct===3?ne.length-1:ne.length,tt=0;tt<Ue;tt++){tt===1&&ct!==1&&Ee.writeVarint(le(2,Ue-1));var He=ne[tt].x-wt,et=ne[tt].y-X;Ee.writeVarint(ye(He)),Ee.writeVarint(ye(et)),wt+=He,X+=et}ct===3&&Ee.writeVarint(le(7,1))}}function Re(ot,Ee){var Pe=typeof ot;Pe==="string"?Ee.writeStringField(1,ot):Pe==="boolean"?Ee.writeBooleanField(7,ot):Pe==="number"&&(ot%1!=0?Ee.writeDoubleField(3,ot):ot<0?Ee.writeSVarintField(6,ot):Ee.writeVarintField(5,ot))}function Oe(ot,Ee,Pe,ct,wt,X){if(wt-ct<=Pe)return;const j=ct+wt>>1;We(ot,Ee,j,ct,wt,X%2),Oe(ot,Ee,Pe,ct,j-1,X+1),Oe(ot,Ee,Pe,j+1,wt,X+1)}function We(ot,Ee,Pe,ct,wt,X){for(;wt>ct;){if(wt-ct>600){const de=wt-ct+1,Ue=Pe-ct+1,tt=Math.log(de),He=.5*Math.exp(2*tt/3),et=.5*Math.sqrt(tt*He*(de-He)/de)*(Ue-de/2<0?-1:1);We(ot,Ee,Pe,Math.max(ct,Math.floor(Pe-Ue*He/de+et)),Math.min(wt,Math.floor(Pe+(de-Ue)*He/de+et)),X)}const j=Ee[2*Pe+X];let ie=ct,ne=wt;for(Ve(ot,Ee,ct,Pe),Ee[2*wt+X]>j&&Ve(ot,Ee,ct,wt);ie<ne;){for(Ve(ot,Ee,ie,ne),ie++,ne--;Ee[2*ie+X]<j;)ie++;for(;Ee[2*ne+X]>j;)ne--}Ee[2*ct+X]===j?Ve(ot,Ee,ct,ne):(ne++,Ve(ot,Ee,ne,wt)),ne<=Pe&&(ct=ne+1),Pe<=ne&&(wt=ne-1)}}function Ve(ot,Ee,Pe,ct){Qe(ot,Pe,ct),Qe(Ee,2*Pe,2*ct),Qe(Ee,2*Pe+1,2*ct+1)}function Qe(ot,Ee,Pe){const ct=ot[Ee];ot[Ee]=ot[Pe],ot[Pe]=ct}function Se(ot,Ee,Pe,ct){const wt=ot-Pe,X=Ee-ct;return wt*wt+X*X}ce.exports=Et,ce.exports.fromVectorTileJs=Et,ce.exports.fromGeojsonVt=function(ot,Ee){Ee=Ee||{};var Pe={};for(var ct in ot)Pe[ct]=new Ge(ot[ct].features,Ee),Pe[ct].name=ct,Pe[ct].version=Ee.version,Pe[ct].extent=Ee.extent;return Et({layers:Pe})},ce.exports.GeoJSONWrapper=Ge;const Ke=ot=>ot[0],nt=ot=>ot[1];class vt{constructor(Ee,Pe=Ke,ct=nt,wt=64,X=Float64Array){this.nodeSize=wt,this.points=Ee;const j=Ee.length<65536?Uint16Array:Uint32Array,ie=this.ids=new j(Ee.length),ne=this.coords=new X(2*Ee.length);for(let de=0;de<Ee.length;de++)ie[de]=de,ne[2*de]=Pe(Ee[de]),ne[2*de+1]=ct(Ee[de]);Oe(ie,ne,wt,0,ie.length-1,0)}range(Ee,Pe,ct,wt){return function(X,j,ie,ne,de,Ue,tt){const He=[0,X.length-1,0],et=[];let pt,Lt;for(;He.length;){const jt=He.pop(),Wt=He.pop(),ki=He.pop();if(Wt-ki<=tt){for(let Yi=ki;Yi<=Wt;Yi++)pt=j[2*Yi],Lt=j[2*Yi+1],pt>=ie&&pt<=de&&Lt>=ne&&Lt<=Ue&&et.push(X[Yi]);continue}const bi=Math.floor((ki+Wt)/2);pt=j[2*bi],Lt=j[2*bi+1],pt>=ie&&pt<=de&&Lt>=ne&&Lt<=Ue&&et.push(X[bi]);const Oi=(jt+1)%2;(jt===0?ie<=pt:ne<=Lt)&&(He.push(ki),He.push(bi-1),He.push(Oi)),(jt===0?de>=pt:Ue>=Lt)&&(He.push(bi+1),He.push(Wt),He.push(Oi))}return et}(this.ids,this.coords,Ee,Pe,ct,wt,this.nodeSize)}within(Ee,Pe,ct){return function(wt,X,j,ie,ne,de){const Ue=[0,wt.length-1,0],tt=[],He=ne*ne;for(;Ue.length;){const et=Ue.pop(),pt=Ue.pop(),Lt=Ue.pop();if(pt-Lt<=de){for(let Oi=Lt;Oi<=pt;Oi++)Se(X[2*Oi],X[2*Oi+1],j,ie)<=He&&tt.push(wt[Oi]);continue}const jt=Math.floor((Lt+pt)/2),Wt=X[2*jt],ki=X[2*jt+1];Se(Wt,ki,j,ie)<=He&&tt.push(wt[jt]);const bi=(et+1)%2;(et===0?j-ne<=Wt:ie-ne<=ki)&&(Ue.push(Lt),Ue.push(jt-1),Ue.push(bi)),(et===0?j+ne>=Wt:ie+ne>=ki)&&(Ue.push(jt+1),Ue.push(pt),Ue.push(bi))}return tt}(this.ids,this.coords,Ee,Pe,ct,this.nodeSize)}}const be={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ot=>ot},At=Math.fround||(ut=new Float32Array(1),ot=>(ut[0]=+ot,ut[0]));var ut;class Nt{constructor(Ee){this.options=Gi(Object.create(be),Ee),this.trees=new Array(this.options.maxZoom+1)}load(Ee){const{log:Pe,minZoom:ct,maxZoom:wt,nodeSize:X}=this.options;Pe&&console.time("total time");const j=`prepare ${Ee.length} points`;Pe&&console.time(j),this.points=Ee;let ie=[];for(let ne=0;ne<Ee.length;ne++)Ee[ne].geometry&&ie.push(Qt(Ee[ne],ne));this.trees[wt+1]=new vt(ie,wn,zi,X,Float32Array),Pe&&console.timeEnd(j);for(let ne=wt;ne>=ct;ne--){const de=+Date.now();ie=this._cluster(ie,ne),this.trees[ne]=new vt(ie,wn,zi,X,Float32Array),Pe&&console.log("z%d: %d clusters in %dms",ne,ie.length,+Date.now()-de)}return Pe&&console.timeEnd("total time"),this}getClusters(Ee,Pe){let ct=((Ee[0]+180)%360+360)%360-180;const wt=Math.max(-90,Math.min(90,Ee[1]));let X=Ee[2]===180?180:((Ee[2]+180)%360+360)%360-180;const j=Math.max(-90,Math.min(90,Ee[3]));if(Ee[2]-Ee[0]>=360)ct=-180,X=180;else if(ct>X){const Ue=this.getClusters([ct,wt,180,j],Pe),tt=this.getClusters([-180,wt,X,j],Pe);return Ue.concat(tt)}const ie=this.trees[this._limitZoom(Pe)],ne=ie.range(Xt(ct),_i(j),Xt(X),_i(wt)),de=[];for(const Ue of ne){const tt=ie.points[Ue];de.push(tt.numPoints?Ct(tt):this.points[tt.index])}return de}getChildren(Ee){const Pe=this._getOriginId(Ee),ct=this._getOriginZoom(Ee),wt="No cluster with the specified id.",X=this.trees[ct];if(!X)throw new Error(wt);const j=X.points[Pe];if(!j)throw new Error(wt);const ie=this.options.radius/(this.options.extent*Math.pow(2,ct-1)),ne=X.within(j.x,j.y,ie),de=[];for(const Ue of ne){const tt=X.points[Ue];tt.parentId===Ee&&de.push(tt.numPoints?Ct(tt):this.points[tt.index])}if(de.length===0)throw new Error(wt);return de}getLeaves(Ee,Pe,ct){const wt=[];return this._appendLeaves(wt,Ee,Pe=Pe||10,ct=ct||0,0),wt}getTile(Ee,Pe,ct){const wt=this.trees[this._limitZoom(Ee)],X=Math.pow(2,Ee),{extent:j,radius:ie}=this.options,ne=ie/j,de=(ct-ne)/X,Ue=(ct+1+ne)/X,tt={features:[]};return this._addTileFeatures(wt.range((Pe-ne)/X,de,(Pe+1+ne)/X,Ue),wt.points,Pe,ct,X,tt),Pe===0&&this._addTileFeatures(wt.range(1-ne/X,de,1,Ue),wt.points,X,ct,X,tt),Pe===X-1&&this._addTileFeatures(wt.range(0,de,ne/X,Ue),wt.points,-1,ct,X,tt),tt.features.length?tt:null}getClusterExpansionZoom(Ee){let Pe=this._getOriginZoom(Ee)-1;for(;Pe<=this.options.maxZoom;){const ct=this.getChildren(Ee);if(Pe++,ct.length!==1)break;Ee=ct[0].properties.cluster_id}return Pe}_appendLeaves(Ee,Pe,ct,wt,X){const j=this.getChildren(Pe);for(const ie of j){const ne=ie.properties;if(ne&&ne.cluster?X+ne.point_count<=wt?X+=ne.point_count:X=this._appendLeaves(Ee,ne.cluster_id,ct,wt,X):X<wt?X++:Ee.push(ie),Ee.length===ct)break}return X}_addTileFeatures(Ee,Pe,ct,wt,X,j){for(const ie of Ee){const ne=Pe[ie],de=ne.numPoints;let Ue,tt,He;if(de)Ue=Ft(ne),tt=ne.x,He=ne.y;else{const Lt=this.points[ne.index];Ue=Lt.properties,tt=Xt(Lt.geometry.coordinates[0]),He=_i(Lt.geometry.coordinates[1])}const et={type:1,geometry:[[Math.round(this.options.extent*(tt*X-ct)),Math.round(this.options.extent*(He*X-wt))]],tags:Ue};let pt;de?pt=ne.id:this.options.generateId?pt=ne.index:this.points[ne.index].id&&(pt=this.points[ne.index].id),pt!==void 0&&(et.id=pt),j.features.push(et)}}_limitZoom(Ee){return Math.max(this.options.minZoom,Math.min(Math.floor(+Ee),this.options.maxZoom+1))}_cluster(Ee,Pe){const ct=[],{radius:wt,extent:X,reduce:j,minPoints:ie}=this.options,ne=wt/(X*Math.pow(2,Pe));for(let de=0;de<Ee.length;de++){const Ue=Ee[de];if(Ue.zoom<=Pe)continue;Ue.zoom=Pe;const tt=this.trees[Pe+1],He=tt.within(Ue.x,Ue.y,ne),et=Ue.numPoints||1;let pt=et;for(const Lt of He){const jt=tt.points[Lt];jt.zoom>Pe&&(pt+=jt.numPoints||1)}if(pt>et&&pt>=ie){let Lt=Ue.x*et,jt=Ue.y*et,Wt=j&&et>1?this._map(Ue,!0):null;const ki=(de<<5)+(Pe+1)+this.points.length;for(const bi of He){const Oi=tt.points[bi];if(Oi.zoom<=Pe)continue;Oi.zoom=Pe;const Yi=Oi.numPoints||1;Lt+=Oi.x*Yi,jt+=Oi.y*Yi,Oi.parentId=ki,j&&(Wt||(Wt=this._map(Ue,!0)),j(Wt,this._map(Oi)))}Ue.parentId=ki,ct.push(Gt(Lt/pt,jt/pt,ki,pt,Wt))}else if(ct.push(Ue),pt>1)for(const Lt of He){const jt=tt.points[Lt];jt.zoom<=Pe||(jt.zoom=Pe,ct.push(jt))}}return ct}_getOriginId(Ee){return Ee-this.points.length>>5}_getOriginZoom(Ee){return(Ee-this.points.length)%32}_map(Ee,Pe){if(Ee.numPoints)return Pe?Gi({},Ee.properties):Ee.properties;const ct=this.points[Ee.index].properties,wt=this.options.map(ct);return Pe&&wt===ct?Gi({},wt):wt}}function Gt(ot,Ee,Pe,ct,wt){return{x:At(ot),y:At(Ee),zoom:1/0,id:Pe,parentId:-1,numPoints:ct,properties:wt}}function Qt(ot,Ee){const[Pe,ct]=ot.geometry.coordinates;return{x:At(Xt(Pe)),y:At(_i(ct)),zoom:1/0,index:Ee,parentId:-1}}function Ct(ot){return{type:"Feature",id:ot.id,properties:Ft(ot),geometry:{type:"Point",coordinates:[(Ee=ot.x,360*(Ee-.5)),fi(ot.y)]}};var Ee}function Ft(ot){const Ee=ot.numPoints,Pe=Ee>=1e4?`${Math.round(Ee/1e3)}k`:Ee>=1e3?Math.round(Ee/100)/10+"k":Ee;return Gi(Gi({},ot.properties),{cluster:!0,cluster_id:ot.id,point_count:Ee,point_count_abbreviated:Pe})}function Xt(ot){return ot/360+.5}function _i(ot){const Ee=Math.sin(ot*Math.PI/180),Pe=.5-.25*Math.log((1+Ee)/(1-Ee))/Math.PI;return Pe<0?0:Pe>1?1:Pe}function fi(ot){const Ee=(180-360*ot)*Math.PI/180;return 360*Math.atan(Math.exp(Ee))/Math.PI-90}function Gi(ot,Ee){for(const Pe in Ee)ot[Pe]=Ee[Pe];return ot}function wn(ot){return ot.x}function zi(ot){return ot.y}function Gn(ot,Ee,Pe,ct){for(var wt,X=ct,j=Pe-Ee>>1,ie=Pe-Ee,ne=ot[Ee],de=ot[Ee+1],Ue=ot[Pe],tt=ot[Pe+1],He=Ee+3;He<Pe;He+=3){var et=kn(ot[He],ot[He+1],ne,de,Ue,tt);if(et>X)wt=He,X=et;else if(et===X){var pt=Math.abs(He-j);pt<ie&&(wt=He,ie=pt)}}X>ct&&(wt-Ee>3&&Gn(ot,Ee,wt,ct),ot[wt+2]=X,Pe-wt>3&&Gn(ot,wt,Pe,ct))}function kn(ot,Ee,Pe,ct,wt,X){var j=wt-Pe,ie=X-ct;if(j!==0||ie!==0){var ne=((ot-Pe)*j+(Ee-ct)*ie)/(j*j+ie*ie);ne>1?(Pe=wt,ct=X):ne>0&&(Pe+=j*ne,ct+=ie*ne)}return(j=ot-Pe)*j+(ie=Ee-ct)*ie}function yt(ot,Ee,Pe,ct){var wt={id:ot===void 0?null:ot,type:Ee,geometry:Pe,tags:ct,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(X){var j=X.geometry,ie=X.type;if(ie==="Point"||ie==="MultiPoint"||ie==="LineString")rt(X,j);else if(ie==="Polygon"||ie==="MultiLineString")for(var ne=0;ne<j.length;ne++)rt(X,j[ne]);else if(ie==="MultiPolygon")for(ne=0;ne<j.length;ne++)for(var de=0;de<j[ne].length;de++)rt(X,j[ne][de])}(wt),wt}function rt(ot,Ee){for(var Pe=0;Pe<Ee.length;Pe+=3)ot.minX=Math.min(ot.minX,Ee[Pe]),ot.minY=Math.min(ot.minY,Ee[Pe+1]),ot.maxX=Math.max(ot.maxX,Ee[Pe]),ot.maxY=Math.max(ot.maxY,Ee[Pe+1])}function ti(ot,Ee,Pe,ct){if(Ee.geometry){var wt=Ee.geometry.coordinates,X=Ee.geometry.type,j=Math.pow(Pe.tolerance/((1<<Pe.maxZoom)*Pe.extent),2),ie=[],ne=Ee.id;if(Pe.promoteId?ne=Ee.properties[Pe.promoteId]:Pe.generateId&&(ne=ct||0),X==="Point")Ni(wt,ie);else if(X==="MultiPoint")for(var de=0;de<wt.length;de++)Ni(wt[de],ie);else if(X==="LineString")qi(wt,ie,j,!1);else if(X==="MultiLineString"){if(Pe.lineMetrics){for(de=0;de<wt.length;de++)qi(wt[de],ie=[],j,!1),ot.push(yt(ne,"LineString",ie,Ee.properties));return}en(wt,ie,j,!1)}else if(X==="Polygon")en(wt,ie,j,!0);else{if(X!=="MultiPolygon"){if(X==="GeometryCollection"){for(de=0;de<Ee.geometry.geometries.length;de++)ti(ot,{id:ne,geometry:Ee.geometry.geometries[de],properties:Ee.properties},Pe,ct);return}throw new Error("Input data is not a valid GeoJSON object.")}for(de=0;de<wt.length;de++){var Ue=[];en(wt[de],Ue,j,!0),ie.push(Ue)}}ot.push(yt(ne,X,ie,Ee.properties))}}function Ni(ot,Ee){Ee.push($t(ot[0])),Ee.push(at(ot[1])),Ee.push(0)}function qi(ot,Ee,Pe,ct){for(var wt,X,j=0,ie=0;ie<ot.length;ie++){var ne=$t(ot[ie][0]),de=at(ot[ie][1]);Ee.push(ne),Ee.push(de),Ee.push(0),ie>0&&(j+=ct?(wt*de-ne*X)/2:Math.sqrt(Math.pow(ne-wt,2)+Math.pow(de-X,2))),wt=ne,X=de}var Ue=Ee.length-3;Ee[2]=1,Gn(Ee,0,Ue,Pe),Ee[Ue+2]=1,Ee.size=Math.abs(j),Ee.start=0,Ee.end=Ee.size}function en(ot,Ee,Pe,ct){for(var wt=0;wt<ot.length;wt++){var X=[];qi(ot[wt],X,Pe,ct),Ee.push(X)}}function $t(ot){return ot/360+.5}function at(ot){var Ee=Math.sin(ot*Math.PI/180),Pe=.5-.25*Math.log((1+Ee)/(1-Ee))/Math.PI;return Pe<0?0:Pe>1?1:Pe}function ii(ot,Ee,Pe,ct,wt,X,j,ie){if(ct/=Ee,X>=(Pe/=Ee)&&j<ct)return ot;if(j<Pe||X>=ct)return null;for(var ne=[],de=0;de<ot.length;de++){var Ue=ot[de],tt=Ue.geometry,He=Ue.type,et=wt===0?Ue.minX:Ue.minY,pt=wt===0?Ue.maxX:Ue.maxY;if(et>=Pe&&pt<ct)ne.push(Ue);else if(!(pt<Pe||et>=ct)){var Lt=[];if(He==="Point"||He==="MultiPoint")hn(tt,Lt,Pe,ct,wt);else if(He==="LineString")Xi(tt,Lt,Pe,ct,wt,!1,ie.lineMetrics);else if(He==="MultiLineString")Cn(tt,Lt,Pe,ct,wt,!1);else if(He==="Polygon")Cn(tt,Lt,Pe,ct,wt,!0);else if(He==="MultiPolygon")for(var jt=0;jt<tt.length;jt++){var Wt=[];Cn(tt[jt],Wt,Pe,ct,wt,!0),Wt.length&&Lt.push(Wt)}if(Lt.length){if(ie.lineMetrics&&He==="LineString"){for(jt=0;jt<Lt.length;jt++)ne.push(yt(Ue.id,He,Lt[jt],Ue.tags));continue}He!=="LineString"&&He!=="MultiLineString"||(Lt.length===1?(He="LineString",Lt=Lt[0]):He="MultiLineString"),He!=="Point"&&He!=="MultiPoint"||(He=Lt.length===3?"Point":"MultiPoint"),ne.push(yt(Ue.id,He,Lt,Ue.tags))}}}return ne.length?ne:null}function hn(ot,Ee,Pe,ct,wt){for(var X=0;X<ot.length;X+=3){var j=ot[X+wt];j>=Pe&&j<=ct&&(Ee.push(ot[X]),Ee.push(ot[X+1]),Ee.push(ot[X+2]))}}function Xi(ot,Ee,Pe,ct,wt,X,j){for(var ie,ne,de=on(ot),Ue=wt===0?nr:Ii,tt=ot.start,He=0;He<ot.length-3;He+=3){var et=ot[He],pt=ot[He+1],Lt=ot[He+2],jt=ot[He+3],Wt=ot[He+4],ki=wt===0?et:pt,bi=wt===0?jt:Wt,Oi=!1;j&&(ie=Math.sqrt(Math.pow(et-jt,2)+Math.pow(pt-Wt,2))),ki<Pe?bi>Pe&&(ne=Ue(de,et,pt,jt,Wt,Pe),j&&(de.start=tt+ie*ne)):ki>ct?bi<ct&&(ne=Ue(de,et,pt,jt,Wt,ct),j&&(de.start=tt+ie*ne)):Tn(de,et,pt,Lt),bi<Pe&&ki>=Pe&&(ne=Ue(de,et,pt,jt,Wt,Pe),Oi=!0),bi>ct&&ki<=ct&&(ne=Ue(de,et,pt,jt,Wt,ct),Oi=!0),!X&&Oi&&(j&&(de.end=tt+ie*ne),Ee.push(de),de=on(ot)),j&&(tt+=ie)}var Yi=ot.length-3;et=ot[Yi],pt=ot[Yi+1],Lt=ot[Yi+2],(ki=wt===0?et:pt)>=Pe&&ki<=ct&&Tn(de,et,pt,Lt),Yi=de.length-3,X&&Yi>=3&&(de[Yi]!==de[0]||de[Yi+1]!==de[1])&&Tn(de,de[0],de[1],de[2]),de.length&&Ee.push(de)}function on(ot){var Ee=[];return Ee.size=ot.size,Ee.start=ot.start,Ee.end=ot.end,Ee}function Cn(ot,Ee,Pe,ct,wt,X){for(var j=0;j<ot.length;j++)Xi(ot[j],Ee,Pe,ct,wt,X,!1)}function Tn(ot,Ee,Pe,ct){ot.push(Ee),ot.push(Pe),ot.push(ct)}function nr(ot,Ee,Pe,ct,wt,X){var j=(X-Ee)/(ct-Ee);return ot.push(X),ot.push(Pe+(wt-Pe)*j),ot.push(1),j}function Ii(ot,Ee,Pe,ct,wt,X){var j=(X-Pe)/(wt-Pe);return ot.push(Ee+(ct-Ee)*j),ot.push(X),ot.push(1),j}function bn(ot,Ee){for(var Pe=[],ct=0;ct<ot.length;ct++){var wt,X=ot[ct],j=X.type;if(j==="Point"||j==="MultiPoint"||j==="LineString")wt=Ot(X.geometry,Ee);else if(j==="MultiLineString"||j==="Polygon"){wt=[];for(var ie=0;ie<X.geometry.length;ie++)wt.push(Ot(X.geometry[ie],Ee))}else if(j==="MultiPolygon")for(wt=[],ie=0;ie<X.geometry.length;ie++){for(var ne=[],de=0;de<X.geometry[ie].length;de++)ne.push(Ot(X.geometry[ie][de],Ee));wt.push(ne)}Pe.push(yt(X.id,j,wt,X.tags))}return Pe}function Ot(ot,Ee){var Pe=[];Pe.size=ot.size,ot.start!==void 0&&(Pe.start=ot.start,Pe.end=ot.end);for(var ct=0;ct<ot.length;ct+=3)Pe.push(ot[ct]+Ee,ot[ct+1],ot[ct+2]);return Pe}function wi(ot,Ee){if(ot.transformed)return ot;var Pe,ct,wt,X=1<<ot.z,j=ot.x,ie=ot.y;for(Pe=0;Pe<ot.features.length;Pe++){var ne=ot.features[Pe],de=ne.geometry,Ue=ne.type;if(ne.geometry=[],Ue===1)for(ct=0;ct<de.length;ct+=2)ne.geometry.push(Wi(de[ct],de[ct+1],Ee,X,j,ie));else for(ct=0;ct<de.length;ct++){var tt=[];for(wt=0;wt<de[ct].length;wt+=2)tt.push(Wi(de[ct][wt],de[ct][wt+1],Ee,X,j,ie));ne.geometry.push(tt)}}return ot.transformed=!0,ot}function Wi(ot,Ee,Pe,ct,wt,X){return[Math.round(Pe*(ot*ct-wt)),Math.round(Pe*(Ee*ct-X))]}function Ui(ot,Ee,Pe,ct,wt){for(var X=Ee===wt.maxZoom?0:wt.tolerance/((1<<Ee)*wt.extent),j={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:Pe,y:ct,z:Ee,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ie=0;ie<ot.length;ie++){j.numFeatures++,Pn(j,ot[ie],X,wt);var ne=ot[ie].minX,de=ot[ie].minY,Ue=ot[ie].maxX,tt=ot[ie].maxY;ne<j.minX&&(j.minX=ne),de<j.minY&&(j.minY=de),Ue>j.maxX&&(j.maxX=Ue),tt>j.maxY&&(j.maxY=tt)}return j}function Pn(ot,Ee,Pe,ct){var wt=Ee.geometry,X=Ee.type,j=[];if(X==="Point"||X==="MultiPoint")for(var ie=0;ie<wt.length;ie+=3)j.push(wt[ie]),j.push(wt[ie+1]),ot.numPoints++,ot.numSimplified++;else if(X==="LineString")qn(j,wt,ot,Pe,!1,!1);else if(X==="MultiLineString"||X==="Polygon")for(ie=0;ie<wt.length;ie++)qn(j,wt[ie],ot,Pe,X==="Polygon",ie===0);else if(X==="MultiPolygon")for(var ne=0;ne<wt.length;ne++){var de=wt[ne];for(ie=0;ie<de.length;ie++)qn(j,de[ie],ot,Pe,!0,ie===0)}if(j.length){var Ue=Ee.tags||null;if(X==="LineString"&&ct.lineMetrics){for(var tt in Ue={},Ee.tags)Ue[tt]=Ee.tags[tt];Ue.mapbox_clip_start=wt.start/wt.size,Ue.mapbox_clip_end=wt.end/wt.size}var He={geometry:j,type:X==="Polygon"||X==="MultiPolygon"?3:X==="LineString"||X==="MultiLineString"?2:1,tags:Ue};Ee.id!==null&&(He.id=Ee.id),ot.features.push(He)}}function qn(ot,Ee,Pe,ct,wt,X){var j=ct*ct;if(ct>0&&Ee.size<(wt?j:ct))Pe.numPoints+=Ee.length/3;else{for(var ie=[],ne=0;ne<Ee.length;ne+=3)(ct===0||Ee[ne+2]>j)&&(Pe.numSimplified++,ie.push(Ee[ne]),ie.push(Ee[ne+1])),Pe.numPoints++;wt&&function(de,Ue){for(var tt=0,He=0,et=de.length,pt=et-2;He<et;pt=He,He+=2)tt+=(de[He]-de[pt])*(de[He+1]+de[pt+1]);if(tt>0===Ue)for(He=0,et=de.length;He<et/2;He+=2){var Lt=de[He],jt=de[He+1];de[He]=de[et-2-He],de[He+1]=de[et-1-He],de[et-2-He]=Lt,de[et-1-He]=jt}}(ie,X),ot.push(ie)}}function Hr(ot,Ee){var Pe=(Ee=this.options=function(wt,X){for(var j in X)wt[j]=X[j];return wt}(Object.create(this.options),Ee)).debug;if(Pe&&console.time("preprocess data"),Ee.maxZoom<0||Ee.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Ee.promoteId&&Ee.generateId)throw new Error("promoteId and generateId cannot be used together.");var ct=function(wt,X){var j=[];if(wt.type==="FeatureCollection")for(var ie=0;ie<wt.features.length;ie++)ti(j,wt.features[ie],X,ie);else ti(j,wt.type==="Feature"?wt:{geometry:wt},X);return j}(ot,Ee);this.tiles={},this.tileCoords=[],Pe&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Ee.indexMaxZoom,Ee.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ct=function(wt,X){var j=X.buffer/X.extent,ie=wt,ne=ii(wt,1,-1-j,j,0,-1,2,X),de=ii(wt,1,1-j,2+j,0,-1,2,X);return(ne||de)&&(ie=ii(wt,1,-j,1+j,0,-1,2,X)||[],ne&&(ie=bn(ne,1).concat(ie)),de&&(ie=ie.concat(bn(de,-1)))),ie}(ct,Ee),ct.length&&this.splitTile(ct,0,0,0),Pe&&(ct.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)))}function fr(ot,Ee,Pe){return 32*((1<<ot)*Pe+Ee)+ot}function kr(ot,Ee){const Pe=ot.tileID.canonical;if(!this._geoJSONIndex)return Ee(null,null);const ct=this._geoJSONIndex.getTile(Pe.z,Pe.x,Pe.y);if(!ct)return Ee(null,null);const wt=new ae(ct.features);let X=ce.exports(wt);X.byteOffset===0&&X.byteLength===X.buffer.byteLength||(X=new Uint8Array(X)),Ee(null,{vectorTile:wt,rawData:X.buffer})}Hr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Hr.prototype.splitTile=function(ot,Ee,Pe,ct,wt,X,j){for(var ie=[ot,Ee,Pe,ct],ne=this.options,de=ne.debug;ie.length;){ct=ie.pop(),Pe=ie.pop(),Ee=ie.pop(),ot=ie.pop();var Ue=1<<Ee,tt=fr(Ee,Pe,ct),He=this.tiles[tt];if(!He&&(de>1&&console.time("creation"),He=this.tiles[tt]=Ui(ot,Ee,Pe,ct,ne),this.tileCoords.push({z:Ee,x:Pe,y:ct}),de)){de>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ee,Pe,ct,He.numFeatures,He.numPoints,He.numSimplified),console.timeEnd("creation"));var et="z"+Ee;this.stats[et]=(this.stats[et]||0)+1,this.total++}if(He.source=ot,wt){if(Ee===ne.maxZoom||Ee===wt)continue;var pt=1<<wt-Ee;if(Pe!==Math.floor(X/pt)||ct!==Math.floor(j/pt))continue}else if(Ee===ne.indexMaxZoom||He.numPoints<=ne.indexMaxPoints)continue;if(He.source=null,ot.length!==0){de>1&&console.time("clipping");var Lt,jt,Wt,ki,bi,Oi,Yi=.5*ne.buffer/ne.extent,tn=.5-Yi,rr=.5+Yi,yn=1+Yi;Lt=jt=Wt=ki=null,bi=ii(ot,Ue,Pe-Yi,Pe+rr,0,He.minX,He.maxX,ne),Oi=ii(ot,Ue,Pe+tn,Pe+yn,0,He.minX,He.maxX,ne),ot=null,bi&&(Lt=ii(bi,Ue,ct-Yi,ct+rr,1,He.minY,He.maxY,ne),jt=ii(bi,Ue,ct+tn,ct+yn,1,He.minY,He.maxY,ne),bi=null),Oi&&(Wt=ii(Oi,Ue,ct-Yi,ct+rr,1,He.minY,He.maxY,ne),ki=ii(Oi,Ue,ct+tn,ct+yn,1,He.minY,He.maxY,ne),Oi=null),de>1&&console.timeEnd("clipping"),ie.push(Lt||[],Ee+1,2*Pe,2*ct),ie.push(jt||[],Ee+1,2*Pe,2*ct+1),ie.push(Wt||[],Ee+1,2*Pe+1,2*ct),ie.push(ki||[],Ee+1,2*Pe+1,2*ct+1)}}},Hr.prototype.getTile=function(ot,Ee,Pe){var ct=this.options,wt=ct.extent,X=ct.debug;if(ot<0||ot>24)return null;var j=1<<ot,ie=fr(ot,Ee=(Ee%j+j)%j,Pe);if(this.tiles[ie])return wi(this.tiles[ie],wt);X>1&&console.log("drilling down to z%d-%d-%d",ot,Ee,Pe);for(var ne,de=ot,Ue=Ee,tt=Pe;!ne&&de>0;)de--,Ue=Math.floor(Ue/2),tt=Math.floor(tt/2),ne=this.tiles[fr(de,Ue,tt)];return ne&&ne.source?(X>1&&console.log("found parent tile z%d-%d-%d",de,Ue,tt),X>1&&console.time("drilling down"),this.splitTile(ne.source,de,Ue,tt,ot,Ee,Pe),X>1&&console.timeEnd("drilling down"),this.tiles[ie]?wi(this.tiles[ie],wt):null):null};class Qn extends i.VectorTileWorkerSource{constructor(Ee,Pe,ct,wt,X){super(Ee,Pe,ct,wt,kr),X&&(this.loadGeoJSON=X)}loadData(Ee,Pe){const ct=Ee&&Ee.request,wt=ct&&ct.collectResourceTiming;this.loadGeoJSON(Ee,(X,j)=>{if(X||!j)return Pe(X);if(typeof j!="object")return Pe(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`));{z(j,!0);try{if(Ee.filter){const ne=i.createExpression(Ee.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ne.result==="error")throw new Error(ne.value.map(Ue=>`${Ue.key}: ${Ue.message}`).join(", "));j={type:"FeatureCollection",features:j.features.filter(Ue=>ne.value.evaluate({zoom:0},Ue))}}this._geoJSONIndex=Ee.cluster?new Nt(function({superclusterOptions:ne,clusterProperties:de}){if(!de||!ne)return ne;const Ue={},tt={},He={accumulated:null,zoom:0},et={properties:null},pt=Object.keys(de);for(const Lt of pt){const[jt,Wt]=de[Lt],ki=i.createExpression(Wt),bi=i.createExpression(typeof jt=="string"?[jt,["accumulated"],["get",Lt]]:jt);Ue[Lt]=ki.value,tt[Lt]=bi.value}return ne.map=Lt=>{et.properties=Lt;const jt={};for(const Wt of pt)jt[Wt]=Ue[Wt].evaluate(He,et);return jt},ne.reduce=(Lt,jt)=>{et.properties=jt;for(const Wt of pt)He.accumulated=Lt[Wt],Lt[Wt]=tt[Wt].evaluate(He,et)},ne}(Ee)).load(j.features):function(ne,de){return new Hr(ne,de)}(j,Ee.geojsonVtOptions)}catch(ne){return Pe(ne)}this.loaded={};const ie={};if(wt){const ne=i.getPerformanceMeasurement(ct);ne&&(ie.resourceTiming={},ie.resourceTiming[Ee.source]=JSON.parse(JSON.stringify(ne)))}Pe(null,ie)}})}reloadTile(Ee,Pe){const ct=this.loaded;return ct&&ct[Ee.uid]?super.reloadTile(Ee,Pe):this.loadTile(Ee,Pe)}loadGeoJSON(Ee,Pe){if(Ee.request)i.getJSON(Ee.request,Pe);else{if(typeof Ee.data!="string")return Pe(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`));try{return Pe(null,JSON.parse(Ee.data))}catch{return Pe(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(Ee,Pe){try{Pe(null,this._geoJSONIndex.getClusterExpansionZoom(Ee.clusterId))}catch(ct){Pe(ct)}}getClusterChildren(Ee,Pe){try{Pe(null,this._geoJSONIndex.getChildren(Ee.clusterId))}catch(ct){Pe(ct)}}getClusterLeaves(Ee,Pe){try{Pe(null,this._geoJSONIndex.getLeaves(Ee.clusterId,Ee.limit,Ee.offset))}catch(ct){Pe(ct)}}}class Rs{constructor(Ee){this.self=Ee,this.actor=new i.Actor(Ee,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:Qn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(Pe,ct)=>{if(this.workerSourceTypes[Pe])throw new Error(`Worker source with name "${Pe}" already registered.`);this.workerSourceTypes[Pe]=ct},this.self.registerRTLTextPlugin=Pe=>{if(i.plugin.isParsed())throw new Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=Pe.applyArabicShaping,i.plugin.processBidirectionalText=Pe.processBidirectionalText,i.plugin.processStyledBidirectionalText=Pe.processStyledBidirectionalText}}clearCaches(Ee,Pe,ct){delete this.layerIndexes[Ee],delete this.availableImages[Ee],delete this.workerSources[Ee],delete this.demWorkerSources[Ee],ct()}checkIfReady(Ee,Pe,ct){ct()}setReferrer(Ee,Pe){this.referrer=Pe}spriteLoaded(Ee,Pe){this.isSpriteLoaded[Ee]=Pe;for(const ct in this.workerSources[Ee]){const wt=this.workerSources[Ee][ct];for(const X in wt)wt[X]instanceof i.VectorTileWorkerSource&&(wt[X].isSpriteLoaded=Pe,wt[X].fire(new i.Event("isSpriteLoaded")))}}setImages(Ee,Pe,ct){this.availableImages[Ee]=Pe;for(const wt in this.workerSources[Ee]){const X=this.workerSources[Ee][wt];for(const j in X)X[j].availableImages=Pe}ct()}enableTerrain(Ee,Pe,ct){this.terrain=Pe,ct()}setProjection(Ee,Pe){this.projections[Ee]=i.getProjection(Pe)}setLayers(Ee,Pe,ct){this.getLayerIndex(Ee).replace(Pe),ct()}updateLayers(Ee,Pe,ct){this.getLayerIndex(Ee).update(Pe.layers,Pe.removedIds),ct()}loadTile(Ee,Pe,ct){const wt=this.enableTerrain?i.extend({enableTerrain:this.terrain},Pe):Pe;wt.projection=this.projections[Ee]||this.defaultProjection,this.getWorkerSource(Ee,Pe.type,Pe.source).loadTile(wt,ct)}loadDEMTile(Ee,Pe,ct){const wt=this.enableTerrain?i.extend({buildQuadTree:this.terrain},Pe):Pe;this.getDEMWorkerSource(Ee,Pe.source).loadTile(wt,ct)}reloadTile(Ee,Pe,ct){const wt=this.enableTerrain?i.extend({enableTerrain:this.terrain},Pe):Pe;wt.projection=this.projections[Ee]||this.defaultProjection,this.getWorkerSource(Ee,Pe.type,Pe.source).reloadTile(wt,ct)}abortTile(Ee,Pe,ct){this.getWorkerSource(Ee,Pe.type,Pe.source).abortTile(Pe,ct)}removeTile(Ee,Pe,ct){this.getWorkerSource(Ee,Pe.type,Pe.source).removeTile(Pe,ct)}removeSource(Ee,Pe,ct){if(!this.workerSources[Ee]||!this.workerSources[Ee][Pe.type]||!this.workerSources[Ee][Pe.type][Pe.source])return;const wt=this.workerSources[Ee][Pe.type][Pe.source];delete this.workerSources[Ee][Pe.type][Pe.source],wt.removeSource!==void 0?wt.removeSource(Pe,ct):ct()}loadWorkerSource(Ee,Pe,ct){try{this.self.importScripts(Pe.url),ct()}catch(wt){ct(wt.toString())}}syncRTLPluginState(Ee,Pe,ct){try{i.plugin.setState(Pe);const wt=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&wt!=null){this.self.importScripts(wt);const X=i.plugin.isParsed();ct(X?void 0:new Error(`RTL Text Plugin failed to import scripts from ${wt}`),X)}}catch(wt){ct(wt.toString())}}getAvailableImages(Ee){let Pe=this.availableImages[Ee];return Pe||(Pe=[]),Pe}getLayerIndex(Ee){let Pe=this.layerIndexes[Ee];return Pe||(Pe=this.layerIndexes[Ee]=new R),Pe}getWorkerSource(Ee,Pe,ct){if(this.workerSources[Ee]||(this.workerSources[Ee]={}),this.workerSources[Ee][Pe]||(this.workerSources[Ee][Pe]={}),!this.workerSources[Ee][Pe][ct]){const wt={send:(X,j,ie,ne,de,Ue)=>{this.actor.send(X,j,ie,Ee,de,Ue)},scheduler:this.actor.scheduler};this.workerSources[Ee][Pe][ct]=new this.workerSourceTypes[Pe](wt,this.getLayerIndex(Ee),this.getAvailableImages(Ee),this.isSpriteLoaded[Ee])}return this.workerSources[Ee][Pe][ct]}getDEMWorkerSource(Ee,Pe){return this.demWorkerSources[Ee]||(this.demWorkerSources[Ee]={}),this.demWorkerSources[Ee][Pe]||(this.demWorkerSources[Ee][Pe]=new Q),this.demWorkerSources[Ee][Pe]}enforceCacheSizeLimit(Ee,Pe){i.enforceCacheSizeLimit(Pe)}getWorkerPerformanceMetrics(Ee,Pe,ct){ct(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Rs(self)),Rs}),p(["./shared"],function(i){function C(x,a){if(Array.isArray(x)){if(!Array.isArray(a)||x.length!==a.length)return!1;for(let m=0;m<x.length;m++)if(!C(x[m],a[m]))return!1;return!0}if(typeof x=="object"&&x!==null&&a!==null){if(typeof a!="object"||Object.keys(x).length!==Object.keys(a).length)return!1;for(const m in x)if(!C(x[m],a[m]))return!1;return!0}return x===a}var D=R;function R(x){return!function(a){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var b,S,P=new Blob([""],{type:"text/javascript"}),H=URL.createObjectURL(P);try{S=new Worker(H),b=!0}catch{b=!1}return S&&S.terminate(),URL.revokeObjectURL(H),b}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var b=document.createElement("canvas");b.width=b.height=1;var S=b.getContext("2d");if(!S)return!1;var P=S.getImageData(0,0,1,1);return P&&P.width===b.width}()?(Q[m=a&&a.failIfMajorPerformanceCaveat]===void 0&&(Q[m]=function(b){var S,P=function(H){var W=document.createElement("canvas"),ee=Object.create(R.webGLContextAttributes);return ee.failIfMajorPerformanceCaveat=H,W.getContext("webgl",ee)||W.getContext("experimental-webgl",ee)}(b);if(!P)return!1;try{S=P.createShader(P.VERTEX_SHADER)}catch{return!1}return!(!S||P.isContextLost())&&(P.shaderSource(S,"void main() {}"),P.compileShader(S),P.getShaderParameter(S,P.COMPILE_STATUS)===!0)}(m)),Q[m]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var m}(x)}var Q={};function z(x,a,m){const b=i.window.document.createElement(x);return a!==void 0&&(b.className=a),m&&m.appendChild(b),b}function G(x,a,m){const b=i.window.document.createElementNS("http://www.w3.org/2000/svg",x);for(const S of Object.keys(a))b.setAttributeNS(null,S,a[S]);return m&&m.appendChild(b),b}R.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const J=i.window.document&&i.window.document.documentElement.style,Y=J&&J.userSelect!==void 0?"userSelect":"WebkitUserSelect";let B;function ae(){J&&Y&&(B=J[Y],J[Y]="none")}function ce(){J&&Y&&(J[Y]=B)}function Ae(x){x.preventDefault(),x.stopPropagation(),i.window.removeEventListener("click",Ae,!0)}function we(){i.window.addEventListener("click",Ae,!0),i.window.setTimeout(()=>{i.window.removeEventListener("click",Ae,!0)},0)}function me(x,a){const m=x.getBoundingClientRect();return Fe(x,m,a)}function De(x,a){const m=x.getBoundingClientRect(),b=[];for(let S=0;S<a.length;S++)b.push(Fe(x,m,a[S]));return b}function Je(x){return i.window.InstallTrigger!==void 0&&x.button===2&&x.ctrlKey&&i.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:x.button}function Fe(x,a,m){const b=x.offsetWidth===a.width?1:x.offsetWidth/a.width;return new i.pointGeometry((m.clientX-a.left)*b,(m.clientY-a.top)*b)}function Ge(x,a){var m=a[0],b=a[1],S=a[2],P=a[3],H=m*P-S*b;return H?(x[0]=P*(H=1/H),x[1]=-b*H,x[2]=-S*H,x[3]=m*H,x):null}function Et(x){const{userImage:a}=x;return!!(a&&a.render&&a.render())&&(x.data.replace(new Uint8Array(a.data.buffer)),!0)}class li extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:m,callback:b}of this.requestors)this._notify(m,b);this.requestors=[]}}hasImage(a){return!!this.getImage(a)}getImage(a){return this.images[a]}addImage(a,m){this._validate(a,m)&&(this.images[a]=m)}_validate(a,m){let b=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new i.ErrorEvent(new Error(`Image "${a}" has invalid "stretchX" value`))),b=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new i.ErrorEvent(new Error(`Image "${a}" has invalid "stretchY" value`))),b=!1),this._validateContent(m.content,m)||(this.fire(new i.ErrorEvent(new Error(`Image "${a}" has invalid "content" value`))),b=!1),b}_validateStretch(a,m){if(!a)return!0;let b=0;for(const S of a){if(S[0]<b||S[1]<S[0]||m<S[1])return!1;b=S[1]}return!0}_validateContent(a,m){return!(a&&(a.length!==4||a[0]<0||m.data.width<a[0]||a[1]<0||m.data.height<a[1]||a[2]<0||m.data.width<a[2]||a[3]<0||m.data.height<a[3]||a[2]<a[0]||a[3]<a[1]))}updateImage(a,m){m.version=this.images[a].version+1,this.images[a]=m,this.updatedImages[a]=!0}removeImage(a){const m=this.images[a];delete this.images[a],delete this.patterns[a],m.userImage&&m.userImage.onRemove&&m.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(a,m){let b=!0;if(!this.isLoaded())for(const S of a)this.images[S]||(b=!1);this.isLoaded()||b?this._notify(a,m):this.requestors.push({ids:a,callback:m})}_notify(a,m){const b={};for(const S of a){this.images[S]||this.fire(new i.Event("styleimagemissing",{id:S}));const P=this.images[S];P?b[S]={data:P.data.clone(),pixelRatio:P.pixelRatio,sdf:P.sdf,version:P.version,stretchX:P.stretchX,stretchY:P.stretchY,content:P.content,hasRenderCallback:Boolean(P.userImage&&P.userImage.render)}:i.warnOnce(`Image "${S}" 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.`)}m(null,b)}getPixelSize(){const{width:a,height:m}=this.atlasImage;return{width:a,height:m}}getPattern(a){const m=this.patterns[a],b=this.getImage(a);if(!b)return null;if(m&&m.position.version===b.version)return m.position;if(m)m.position.version=b.version;else{const S={w:b.data.width+2,h:b.data.height+2,x:0,y:0},P=new i.ImagePosition(S,b);this.patterns[a]={bin:S,position:P}}return this._updatePatternAtlas(),this.patterns[a].position}bind(a){const m=a.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.Texture(a,this.atlasImage,m.RGBA),this.atlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE)}_updatePatternAtlas(){const a=[];for(const P in this.patterns)a.push(this.patterns[P].bin);const{w:m,h:b}=i.potpack(a),S=this.atlasImage;S.resize({width:m||1,height:b||1});for(const P in this.patterns){const{bin:H}=this.patterns[P],W=H.x+1,ee=H.y+1,pe=this.images[P].data,fe=pe.width,Me=pe.height;i.RGBAImage.copy(pe,S,{x:0,y:0},{x:W,y:ee},{width:fe,height:Me}),i.RGBAImage.copy(pe,S,{x:0,y:Me-1},{x:W,y:ee-1},{width:fe,height:1}),i.RGBAImage.copy(pe,S,{x:0,y:0},{x:W,y:ee+Me},{width:fe,height:1}),i.RGBAImage.copy(pe,S,{x:fe-1,y:0},{x:W-1,y:ee},{width:1,height:Me}),i.RGBAImage.copy(pe,S,{x:0,y:0},{x:W+fe,y:ee},{width:1,height:Me})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(a){for(const m of a){if(this.callbackDispatchedThisFrame[m])continue;this.callbackDispatchedThisFrame[m]=!0;const b=this.images[m];Et(b)&&this.updateImage(m,b)}}}const xi=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new class{constructor(){this.specification=i.spec.light.position}possiblyEvaluate(x,a){return function([m,b,S]){const P=i.degToRad(b+90),H=i.degToRad(S);return{x:m*Math.cos(P)*Math.sin(H),y:m*Math.sin(P)*Math.sin(H),z:m*Math.cos(H),azimuthal:b,polar:S}}(x.expression.evaluate(a))}interpolate(x,a,m){return{x:i.number(x.x,a.x,m),y:i.number(x.y,a.y,m),z:i.number(x.z,a.z,m),azimuthal:i.number(x.azimuthal,a.azimuthal,m),polar:i.number(x.polar,a.polar,m)}}},color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),te="-transition";class le extends i.Evented{constructor(a){super(),this._transitionable=new i.Transitionable(xi),this.setLight(a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(a,m={}){if(!this._validate(i.validateLight,a,m))for(const b in a){const S=a[b];i.endsWith(b,te)?this._transitionable.setTransition(b.slice(0,-te.length),S):this._transitionable.setValue(b,S)}}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,m,b){return(!b||b.validate!==!1)&&i.emitValidationErrors(this,a.call(i.validateStyle,i.extend({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}const ye=new i.Properties({source:new i.DataConstantProperty(i.spec.terrain.source),exaggeration:new i.DataConstantProperty(i.spec.terrain.exaggeration)}),xe="-transition";class Re extends i.Evented{constructor(a,m){super(),this._transitionable=new i.Transitionable(ye),this.set(a),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=m}get(){return this._transitionable.serialize()}set(a){for(const m in a){const b=a[m];i.endsWith(m,xe)?this._transitionable.setTransition(m.slice(0,-xe.length),b):this._transitionable.setValue(m,b)}}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}}function Oe(x,a,m,b){const S=i.smoothstep(45,65,m),[P,H]=We(x,b),W=i.length(a);let ee=1-Math.min(1,Math.exp((W-P)/(H-P)*-6));return ee*=ee*ee,ee=Math.min(1,1.00747*ee),ee*S*x.alpha}function We(x,a){const m=.5/Math.tan(.5*a);return[x.range[0]+m,x.range[1]+m]}const Ve=new i.Properties({range:new i.DataConstantProperty(i.spec.fog.range),color:new i.DataConstantProperty(i.spec.fog.color),"high-color":new i.DataConstantProperty(i.spec.fog["high-color"]),"space-color":new i.DataConstantProperty(i.spec.fog["space-color"]),"horizon-blend":new i.DataConstantProperty(i.spec.fog["horizon-blend"]),"star-intensity":new i.DataConstantProperty(i.spec.fog["star-intensity"])}),Qe="-transition";class Se extends i.Evented{constructor(a,m){super(),this._transitionable=new i.Transitionable(Ve),this.set(a),this._transitioning=this._transitionable.untransitioned(),this._transform=m}get state(){const a=this._transform,m=a.projection.name==="globe",b=i.globeToMercatorTransition(a.zoom),S=this.properties.get("range"),P=[.5,3];return{range:m?[i.number(P[0],S[0],b),i.number(P[1],S[1],b)]:S,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(a,m={}){if(!this._validate(i.validateFog,a,m)){for(const b of Object.keys(i.spec.fog))a&&a[b]===void 0&&(a[b]=i.spec.fog[b].default);for(const b in a){const S=a[b];i.endsWith(b,Qe)?this._transitionable.setTransition(b.slice(0,-Qe.length),S):this._transitionable.setValue(b,S)}}}getOpacity(a){if(!this._transform.projection.supportsFog)return 0;const m=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.smoothstep(45,65,a))*m.a}getOpacityAtLatLng(a,m){return this._transform.projection.supportsFog?function(b,S,P){const H=i.MercatorCoordinate.fromLngLat(S),W=P.elevation?P.elevation.getAtPointOrZero(H):0,ee=[H.x,H.y,W];return i.transformMat4(ee,ee,P.mercatorFogMatrix),Oe(b,ee,P.pitch,P._fov)}(this.state,a,m):0}getFovAdjustedRange(a){return this._transform.projection.supportsFog?We(this.state,a):[0,1]}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,m,b){return(!b||b.validate!==!1)&&i.emitValidationErrors(this,a.call(i.validateStyle,i.extend({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}class Ke{constructor(a,m){this.workerPool=a,this.actors=[],this.currentActor=0,this.id=i.uniqueId();const b=this.workerPool.acquire(this.id);for(let S=0;S<b.length;S++){const P=new Ke.Actor(b[S],m,this.id);P.name=`Worker ${S}`,this.actors.push(P)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(a,m,b){i.asyncAll(this.actors,(S,P)=>{S.send(a,m,P)},b=b||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(a=>{a.remove()}),this.actors=[],this.workerPool.release(this.id)}}function nt(x,a,m){return a*(i.EXTENT/(x.tileSize*Math.pow(2,m-x.tileID.overscaledZ)))}Ke.Actor=i.Actor;class vt{constructor(a,m,b,S){this.screenBounds=a,this.cameraPoint=m,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=b,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,S)}static createFromScreenPoints(a,m){let b,S;if(a instanceof i.pointGeometry||typeof a[0]=="number"){const P=i.pointGeometry.convert(a);b=[P],S=m.isPointAboveHorizon(P)}else{const P=i.pointGeometry.convert(a[0]),H=i.pointGeometry.convert(a[1]);b=[P,H],S=i.polygonizeBounds(P,H).every(W=>m.isPointAboveHorizon(W))}return new vt(b,m.getCameraPoint(),S,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(a){return i.polygonizeBounds(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],a)}bufferedCameraGeometry(a){const m=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],S=i.polygonizeBounds(m,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x<b.x?S.splice(3,0,this.cameraPoint):this.cameraPoint.x>=b.x?S[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(S[3]=this.cameraPoint)),i.bufferConvexPolygon(S,a)}bufferedCameraGeometryGlobe(a){const m=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],S=i.polygonizeBounds(m,b,a),P=this.cameraPoint.clone();switch(3*((P.y>m.y)+(P.y>b.y))+((P.x>m.x)+(P.x>b.x))){case 0:S[0]=P,S[4]=P.clone();break;case 1:S.splice(1,0,P);break;case 2:S[1]=P;break;case 3:S.splice(4,0,P);break;case 5:S.splice(2,0,P);break;case 6:S[3]=P;break;case 7:S.splice(3,0,P);break;case 8:S[2]=P}return S}containsTile(a,m,b,S=0){const P=a.queryPadding/m._pixelsPerMercatorPixel+1,H=b?this._bufferedCameraMercator(P,m):this._bufferedScreenMercator(P,m);let W=a.tileID.wrap+(H.unwrapped?S:0);const ee=H.polygon.map(qe=>i.getTilePoint(a.tileTransform,qe,W));if(!i.polygonIntersectsBox(ee,0,0,i.EXTENT,i.EXTENT))return;W=a.tileID.wrap+(this.screenGeometryMercator.unwrapped?S:0);const pe=this.screenGeometryMercator.polygon.map(qe=>i.getTileVec3(a.tileTransform,qe,W)),fe=pe.map(qe=>new i.pointGeometry(qe[0],qe[1])),Me=m.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),Ne=i.getTileVec3(a.tileTransform,Me,W),st=pe.map(qe=>{const Ye=i.sub(qe,qe,Ne);return i.normalize(Ye,Ye),new i.Ray(Ne,Ye)}),it=nt(a,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:fe,tilespaceRays:st,bufferedTilespaceGeometry:ee,bufferedTilespaceBounds:(lt=i.getBounds(ee),lt.min.x=i.clamp(lt.min.x,0,i.EXTENT),lt.min.y=i.clamp(lt.min.y,0,i.EXTENT),lt.max.x=i.clamp(lt.max.x,0,i.EXTENT),lt.max.y=i.clamp(lt.max.y,0,i.EXTENT),lt),tile:a,tileID:a.tileID,pixelToTileUnitsFactor:it};var lt}_bufferedScreenMercator(a,m){const b=ut(a);if(this._screenRaycastCache[b])return this._screenRaycastCache[b];{let S;return S=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(a),m):{polygon:this.bufferedScreenGeometry(a).map(P=>m.pointCoordinate3D(P)),unwrapped:!0},this._screenRaycastCache[b]=S,S}}_bufferedCameraMercator(a,m){const b=ut(a);if(this._cameraRaycastCache[b])return this._cameraRaycastCache[b];{let S;return S=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(a),m):{polygon:this.bufferedCameraGeometry(a).map(P=>m.pointCoordinate3D(P)),unwrapped:!0},this._cameraRaycastCache[b]=S,S}}_projectAndResample(a,m){const b=function(P,H){const W=i.multiply([],H.pixelMatrix,H.globeMatrix),ee=[0,-i.GLOBE_RADIUS,0,1],pe=[0,i.GLOBE_RADIUS,0,1],fe=[0,0,0,1];i.transformMat4$1(ee,ee,W),i.transformMat4$1(pe,pe,W),i.transformMat4$1(fe,fe,W);const Me=new i.pointGeometry(ee[0]/ee[3],ee[1]/ee[3]),Ne=new i.pointGeometry(pe[0]/pe[3],pe[1]/pe[3]),st=i.polygonContainsPoint(P,Me)&&ee[3]<fe[3],it=i.polygonContainsPoint(P,Ne)&&pe[3]<fe[3];if(!st&&!it)return null;const lt=function(Ht,hi,si){for(let qt=1;qt<Ht.length;qt++){const ji=At(hi.pointCoordinate3D(Ht[qt-1]).x),Kt=At(hi.pointCoordinate3D(Ht[qt]).x);if(si<0){if(ji<Kt)return{idx:qt,t:-ji/(Kt-1-ji)}}else if(Kt<ji)return{idx:qt,t:(1-ji)/(Kt+1-ji)}}return null}(P,H,st?-1:1);if(!lt)return null;const{idx:qe,t:Ye}=lt;let dt=qe>1?be(P.slice(0,qe),H):[],ht=qe<P.length?be(P.slice(qe),H):[];dt=dt.map(Ht=>new i.pointGeometry(At(Ht.x),Ht.y)),ht=ht.map(Ht=>new i.pointGeometry(At(Ht.x),Ht.y));const Bt=[...dt];Bt.length===0&&Bt.push(ht[ht.length-1]);const Pt=i.number(Bt[Bt.length-1].y,(ht.length===0?dt[0]:ht[0]).y,Ye);let It;return It=st?[new i.pointGeometry(0,Pt),new i.pointGeometry(0,0),new i.pointGeometry(1,0),new i.pointGeometry(1,Pt)]:[new i.pointGeometry(1,Pt),new i.pointGeometry(1,1),new i.pointGeometry(0,1),new i.pointGeometry(0,Pt)],Bt.push(...It),ht.length===0?Bt.push(dt[0]):Bt.push(...ht),{polygon:Bt.map(Ht=>new i.MercatorCoordinate(Ht.x,Ht.y)),unwrapped:!1}}(a,m);if(b)return b;const S=function(P,H){let W=!1,ee=-1/0,pe=0;for(let Me=0;Me<P.length-1;Me++)P[Me].x>ee&&(ee=P[Me].x,pe=Me);for(let Me=0;Me<P.length-1;Me++){const Ne=(pe+Me)%(P.length-1),st=P[Ne],it=P[Ne+1];Math.abs(st.x-it.x)>.5&&(st.x<it.x?(st.x+=1,Ne===0&&(P[P.length-1].x+=1)):(it.x+=1,Ne+1===P.length-1&&(P[0].x+=1)),W=!0)}const fe=i.mercatorXfromLng(H.center.lng);return W&&fe<Math.abs(fe-1)&&P.forEach(Me=>{Me.x-=1}),{polygon:P,unwrapped:W}}(be(a,m).map(P=>new i.pointGeometry(At(P.x),P.y)),m);return{polygon:S.polygon.map(P=>new i.MercatorCoordinate(P.x,P.y)),unwrapped:S.unwrapped}}}function be(x,a){return i.resample(x,m=>{const b=a.pointCoordinate3D(m);m.x=b.x,m.y=b.y},1/256)}function At(x){return x<0?1+x%1:x%1}function ut(x){return 100*x|0}function Nt(x,a,m,b,S){const P=function(H,W){if(H)return S(H);if(W){x.url&&W.tiles&&x.tiles&&delete x.tiles;const ee=i.pick(i.extend(W,x),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);W.vector_layers&&(ee.vectorLayers=W.vector_layers,ee.vectorLayerIds=ee.vectorLayers.map(pe=>pe.id)),ee.tiles=a.canonicalizeTileset(ee,x.url),S(null,ee)}};return x.url?i.getJSON(a.transformRequest(a.normalizeSourceURL(x.url,null,m,b),i.ResourceType.Source),P):i.exported.frame(()=>P(null,x))}class Gt{constructor(a,m,b){this.bounds=i.LngLatBounds.convert(this.validateBounds(a)),this.minzoom=m||0,this.maxzoom=b||24}validateBounds(a){return Array.isArray(a)&&a.length===4?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3])]:[-180,-90,180,90]}contains(a){const m=Math.pow(2,a.z),b=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*m),S=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*m),P=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*m),H=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*m);return a.x>=b&&a.x<P&&a.y>=S&&a.y<H}}class Qt{constructor(a,m,b){this.context=a;const S=a.gl;this.buffer=S.createBuffer(),this.dynamicDraw=Boolean(b),this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),S.bufferData(S.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?S.DYNAMIC_DRAW:S.STATIC_DRAW),this.dynamicDraw||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){const m=this.context.gl;this.context.unbindVAO(),this.bind(),m.bufferSubData(m.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ct={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ft{constructor(a,m,b,S){this.length=m.length,this.attributes=b,this.itemSize=m.bytesPerElement,this.dynamicDraw=S,this.context=a;const P=a.gl;this.buffer=P.createBuffer(),a.bindVertexBuffer.set(this.buffer),P.bufferData(P.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?P.DYNAMIC_DRAW:P.STATIC_DRAW),this.dynamicDraw||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,a.arrayBuffer)}enableAttributes(a,m){for(let b=0;b<this.attributes.length;b++){const S=m.attributes[this.attributes[b].name];S!==void 0&&a.enableVertexAttribArray(S)}}setVertexAttribPointers(a,m,b){for(let S=0;S<this.attributes.length;S++){const P=this.attributes[S],H=m.attributes[P.name];H!==void 0&&a.vertexAttribPointer(H,P.components,a[Ct[P.type]],!1,this.itemSize,P.offset+this.itemSize*(b||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Xt{constructor(a){this.gl=a.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(a){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class _i extends Xt{getDefault(){return i.Color.transparent}set(a){const m=this.current;(a.r!==m.r||a.g!==m.g||a.b!==m.b||a.a!==m.a||this.dirty)&&(this.gl.clearColor(a.r,a.g,a.b,a.a),this.current=a,this.dirty=!1)}}class fi extends Xt{getDefault(){return 1}set(a){(a!==this.current||this.dirty)&&(this.gl.clearDepth(a),this.current=a,this.dirty=!1)}}class Gi extends Xt{getDefault(){return 0}set(a){(a!==this.current||this.dirty)&&(this.gl.clearStencil(a),this.current=a,this.dirty=!1)}}class wn extends Xt{getDefault(){return[!0,!0,!0,!0]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||a[2]!==m[2]||a[3]!==m[3]||this.dirty)&&(this.gl.colorMask(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class zi extends Xt{getDefault(){return!0}set(a){(a!==this.current||this.dirty)&&(this.gl.depthMask(a),this.current=a,this.dirty=!1)}}class Gn extends Xt{getDefault(){return 255}set(a){(a!==this.current||this.dirty)&&(this.gl.stencilMask(a),this.current=a,this.dirty=!1)}}class kn extends Xt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(a){const m=this.current;(a.func!==m.func||a.ref!==m.ref||a.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(a.func,a.ref,a.mask),this.current=a,this.dirty=!1)}}class yt extends Xt{getDefault(){const a=this.gl;return[a.KEEP,a.KEEP,a.KEEP]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||a[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(a[0],a[1],a[2]),this.current=a,this.dirty=!1)}}class rt extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=a,this.dirty=!1}}class ti extends Xt{getDefault(){return[0,1]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||this.dirty)&&(this.gl.depthRange(a[0],a[1]),this.current=a,this.dirty=!1)}}class Ni extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=a,this.dirty=!1}}class qi extends Xt{getDefault(){return this.gl.LESS}set(a){(a!==this.current||this.dirty)&&(this.gl.depthFunc(a),this.current=a,this.dirty=!1)}}class en extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.BLEND):m.disable(m.BLEND),this.current=a,this.dirty=!1}}class $t extends Xt{getDefault(){const a=this.gl;return[a.ONE,a.ZERO]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||this.dirty)&&(this.gl.blendFunc(a[0],a[1]),this.current=a,this.dirty=!1)}}class at extends Xt{getDefault(){return i.Color.transparent}set(a){const m=this.current;(a.r!==m.r||a.g!==m.g||a.b!==m.b||a.a!==m.a||this.dirty)&&(this.gl.blendColor(a.r,a.g,a.b,a.a),this.current=a,this.dirty=!1)}}class ii extends Xt{getDefault(){return this.gl.FUNC_ADD}set(a){(a!==this.current||this.dirty)&&(this.gl.blendEquation(a),this.current=a,this.dirty=!1)}}class hn extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;a?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=a,this.dirty=!1}}class Xi extends Xt{getDefault(){return this.gl.BACK}set(a){(a!==this.current||this.dirty)&&(this.gl.cullFace(a),this.current=a,this.dirty=!1)}}class on extends Xt{getDefault(){return this.gl.CCW}set(a){(a!==this.current||this.dirty)&&(this.gl.frontFace(a),this.current=a,this.dirty=!1)}}class Cn extends Xt{getDefault(){return null}set(a){(a!==this.current||this.dirty)&&(this.gl.useProgram(a),this.current=a,this.dirty=!1)}}class Tn extends Xt{getDefault(){return this.gl.TEXTURE0}set(a){(a!==this.current||this.dirty)&&(this.gl.activeTexture(a),this.current=a,this.dirty=!1)}}class nr extends Xt{getDefault(){const a=this.gl;return[0,0,a.drawingBufferWidth,a.drawingBufferHeight]}set(a){const m=this.current;(a[0]!==m[0]||a[1]!==m[1]||a[2]!==m[2]||a[3]!==m[3]||this.dirty)&&(this.gl.viewport(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class Ii extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,a),this.current=a,this.dirty=!1}}class bn extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,a),this.current=a,this.dirty=!1}}class Ot extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindTexture(m.TEXTURE_2D,a),this.current=a,this.dirty=!1}}class wi extends Xt{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,a),this.current=a,this.dirty=!1}}class Wi extends Xt{getDefault(){return null}set(a){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,a),this.current=a,this.dirty=!1}}class Ui extends Xt{constructor(a){super(a),this.vao=a.extVertexArrayObject}getDefault(){return null}set(a){this.vao&&(a!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(a),this.current=a,this.dirty=!1)}}class Pn extends Xt{getDefault(){return 4}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,a),this.current=a,this.dirty=!1}}class qn extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a),this.current=a,this.dirty=!1}}class Hr extends Xt{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a),this.current=a,this.dirty=!1}}class fr extends Xt{constructor(a,m){super(a),this.context=a,this.parent=m}getDefault(){return null}}class kr extends fr{setDirty(){this.dirty=!0}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,a,0),this.current=a,this.dirty=!1}}class Qn extends fr{attachment(){return this.gl.DEPTH_ATTACHMENT}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferRenderbuffer(m.FRAMEBUFFER,this.attachment(),m.RENDERBUFFER,a),this.current=a,this.dirty=!1}}class Rs extends Qn{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class ot{constructor(a,m,b,S){this.context=a,this.width=m,this.height=b;const P=this.framebuffer=a.gl.createFramebuffer();this.colorAttachment=new kr(a,P),S&&(this.depthAttachment=new Qn(a,P))}destroy(){const a=this.context.gl,m=this.colorAttachment.get();if(m&&a.deleteTexture(m),this.depthAttachment){const b=this.depthAttachment.get();b&&a.deleteRenderbuffer(b)}a.deleteFramebuffer(this.framebuffer)}}class Ee{constructor(a){this.gl=a,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new _i(this),this.clearDepth=new fi(this),this.clearStencil=new Gi(this),this.colorMask=new wn(this),this.depthMask=new zi(this),this.stencilMask=new Gn(this),this.stencilFunc=new kn(this),this.stencilOp=new yt(this),this.stencilTest=new rt(this),this.depthRange=new ti(this),this.depthTest=new Ni(this),this.depthFunc=new qi(this),this.blend=new en(this),this.blendFunc=new $t(this),this.blendColor=new at(this),this.blendEquation=new ii(this),this.cullFace=new hn(this),this.cullFaceSide=new Xi(this),this.frontFace=new on(this),this.program=new Cn(this),this.activeTexture=new Tn(this),this.viewport=new nr(this),this.bindFramebuffer=new Ii(this),this.bindRenderbuffer=new bn(this),this.bindTexture=new Ot(this),this.bindVertexBuffer=new wi(this),this.bindElementBuffer=new Wi(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ui(this),this.pixelStoreUnpack=new Pn(this),this.pixelStoreUnpackPremultiplyAlpha=new qn(this),this.pixelStoreUnpackFlipY=new Hr(this),this.extTextureFilterAnisotropic=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=a.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=a.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=a.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=a.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.extTextureHalfFloat=a.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(a.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=a.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=a.getExtension("OES_standard_derivatives"),this.extTimerQuery=a.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(a,m){return new Qt(this,a,m)}createVertexBuffer(a,m,b){return new Ft(this,a,m,b)}createRenderbuffer(a,m,b){const S=this.gl,P=S.createRenderbuffer();return this.bindRenderbuffer.set(P),S.renderbufferStorage(S.RENDERBUFFER,a,m,b),this.bindRenderbuffer.set(null),P}createFramebuffer(a,m,b){return new ot(this,a,m,b)}clear({color:a,depth:m,stencil:b}){const S=this.gl;let P=0;a&&(P|=S.COLOR_BUFFER_BIT,this.clearColor.set(a),this.colorMask.set([!0,!0,!0,!0])),m!==void 0&&(P|=S.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),b!==void 0&&(P|=S.STENCIL_BUFFER_BIT,this.clearStencil.set(b),this.stencilMask.set(255)),S.clear(P)}setCullFace(a){a.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(a.mode),this.frontFace.set(a.frontFace))}setDepthMode(a){a.func!==this.gl.ALWAYS||a.mask?(this.depthTest.set(!0),this.depthFunc.set(a.func),this.depthMask.set(a.mask),this.depthRange.set(a.range)):this.depthTest.set(!1)}setStencilMode(a){a.test.func!==this.gl.ALWAYS||a.mask?(this.stencilTest.set(!0),this.stencilMask.set(a.mask),this.stencilOp.set([a.fail,a.depthFail,a.pass]),this.stencilFunc.set({func:a.test.func,ref:a.ref,mask:a.test.mask})):this.stencilTest.set(!1)}setColorMode(a){C(a.blendFunction,i.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(a.blendFunction),this.blendColor.set(a.blendColor)),this.colorMask.set(a.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Pe extends i.Evented{constructor(a,m,b,S){super(),this.id=a,this.dispatcher=b,this.setEventedParent(S),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},m),i.extend(this,i.pick(m,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Nt(this._options,this.map._requestManager,null,null,(a,m)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new i.ErrorEvent(a)):m&&(i.extend(this,m),m.bounds&&(this.tileBounds=new Gt(m.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(m.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(a,m){const b=i.exported.devicePixelRatio>=2,S=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),b,this.tileSize);a.request=i.getImage(this.map._requestManager.transformRequest(S,i.ResourceType.Tile),(P,H,W,ee)=>(delete a.request,a.aborted?(a.state="unloaded",m(null)):P?(a.state="errored",m(P)):H?(this.map._refreshExpiredTiles&&a.setExpiryData({cacheControl:W,expires:ee}),a.setTexture(H,this.map.painter),a.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),void m(null)):m(null)))}static loadTileData(a,m,b){a.setTexture(m,b)}static unloadTileData(a,m){a.texture&&m.saveTileTexture(a.texture)}abortTile(a,m){a.request&&(a.request.cancel(),delete a.request),m()}unloadTile(a,m){a.texture&&this.map.painter.saveTileTexture(a.texture),m()}hasTransition(){return!1}}let ct;function wt(x,a,m,b,S,P,H,W){const ee=[x,m,S,a,b,P,1,1,1],pe=[H,W,1],fe=i.adjoint([],ee),[Me,Ne,st]=i.transformMat3(pe,pe,i.transpose(fe,fe));return i.multiply$1(ee,[Me,0,0,0,Ne,0,0,0,st],ee)}class X extends i.Evented{constructor(a,m,b,S){super(),this.id=a,this.dispatcher=b,this.coordinates=m.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(S),this.options=m,this._dirty=!1}load(a,m){this._loaded=m||!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(b,S)=>{if(this._imageRequest=null,this._loaded=!0,b)this.fire(new i.ErrorEvent(b));else if(S){const{HTMLImageElement:P}=i.window;this.image=S instanceof P?i.exported.getImageData(S):S,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,a&&(this.coordinates=a),this._finishLoading()}})}loaded(){return this._loaded}updateImage(a){return this.image&&a.url?(this._imageRequest&&a.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=a.url,this.load(a.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(a){this.coordinates=a,this._boundsArray=void 0;const m=a.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(b){let S=1/0,P=1/0,H=-1/0,W=-1/0;for(const Me of b)S=Math.min(S,Me.x),P=Math.min(P,Me.y),H=Math.max(H,Me.x),W=Math.max(W,Me.y);const ee=Math.max(H-S,W-P),pe=Math.max(0,Math.floor(-Math.log(ee)/Math.LN2)),fe=Math.pow(2,pe);return new i.CanonicalTileID(pe,Math.floor((S+H)/2*fe),Math.floor((P+W)/2*fe))}(m),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(a){for(const ee in this.tiles){const pe=this.tiles[ee];pe.state!=="loaded"&&(pe.state="loaded",pe.texture=this.texture)}if(this._boundsArray)return;const m=i.tileTransform(this.tileID,this.map.transform.projection),[b,S,P,H]=this.coordinates.map(ee=>{const pe=m.projection.project(ee[0],ee[1]);return i.getTilePoint(m,pe)._round()});this.perspectiveTransform=function(ee,pe,fe,Me,Ne,st,it,lt,qe,Ye){const dt=wt(0,0,ee,0,0,pe,ee,pe),ht=wt(fe,Me,Ne,st,it,lt,qe,Ye);return i.multiply$1(ht,i.adjoint(dt,dt),ht),[ht[6]/ht[8]*ee/i.EXTENT,ht[7]/ht[8]*pe/i.EXTENT]}(this.width,this.height,b.x,b.y,S.x,S.y,H.x,H.y,P.x,P.y);const W=this._boundsArray=new i.StructArrayLayout4i8;W.emplaceBack(b.x,b.y,0,0),W.emplaceBack(S.x,S.y,i.EXTENT,0),W.emplaceBack(H.x,H.y,0,i.EXTENT),W.emplaceBack(P.x,P.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=a.createVertexBuffer(W,i.boundsAttributes.members),this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const a=this.map.painter.context,m=a.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new i.Texture(a,this.image,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(a)}loadTile(a,m){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={},m(null)):(a.state="errored",m(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const j={vector:class extends i.Evented{constructor(x,a,m,b){if(super(),this.id=x,this.dispatcher=m,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(a,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},a),this._collectResourceTiming=a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(b),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(x){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,m=this.map._worldview;this._tileJSONRequest=Nt(this._options,this.map._requestManager,a,m,(b,S)=>{this._tileJSONRequest=null,this._loaded=!0,b?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new i.ErrorEvent(b))):S&&(i.extend(this,S),S.bounds&&(this.tileBounds=new Gt(S.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(S.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),x&&x(b)})}loaded(){return this._loaded}hasTile(x){return!this.tileBounds||this.tileBounds.contains(x.canonical)}onAdd(x){this.map=x,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>{const x=this.map.style._getSourceCaches(this.id);for(const a of x)a.clearTiles()})}setSourceProperty(x){x(),this.reload()}setTiles(x){return this._options.tiles=x,this.reload(),this}setUrl(x){return this.url=x,this._options.url=x,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return i.extend({},this._options)}loadTile(x,a){const m=this.map._requestManager.normalizeTileURL(x.tileID.canonical.url(this.tiles,this.scheme)),b={request:this.map._requestManager.transformRequest(m,i.ResourceType.Tile),data:void 0,uid:x.uid,tileID:x.tileID,tileZoom:x.tileZoom,zoom:x.tileID.overscaledZ,tileSize:this.tileSize*x.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:x.isSymbolTile};if(b.request.collectResourceTiming=this._collectResourceTiming,x.actor&&x.state!=="expired")x.state==="loading"?x.reloadCallback=a:x.request=x.actor.send("reloadTile",b,S.bind(this));else if(x.actor=this._tileWorkers[m]=this._tileWorkers[m]||this.dispatcher.getActor(),this.dispatcher.ready)x.request=x.actor.send("loadTile",b,S.bind(this),void 0,!0);else{const P=i.loadVectorTile.call({deduped:this._deduped},b,(H,W)=>{H||!W?S.call(this,H):(b.data={cacheControl:W.cacheControl,expires:W.expires,rawData:W.rawData.slice(0)},x.actor&&x.actor.send("loadTile",b,S.bind(this),void 0,!0))},!0);x.request={cancel:P}}function S(P,H){return delete x.request,x.aborted?a(null):P&&P.status!==404?a(P):(H&&H.resourceTiming&&(x.resourceTiming=H.resourceTiming),this.map._refreshExpiredTiles&&H&&x.setExpiryData(H),x.loadVectorData(H,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),a(null),void(x.reloadCallback&&(this.loadTile(x,x.reloadCallback),x.reloadCallback=null)))}}abortTile(x){x.request&&(x.request.cancel(),delete x.request),x.actor&&x.actor.send("abortTile",{uid:x.uid,type:this.type,source:this.id})}unloadTile(x){x.unloadVectorData(),x.actor&&x.actor.send("removeTile",{uid:x.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}},raster:Pe,"raster-dem":class extends Pe{constructor(x,a,m,b){super(x,a,m,b),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox"}loadTile(x,a){const m=this.map._requestManager.normalizeTileURL(x.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function b(S,P){S&&(x.state="errored",a(S)),P&&(x.dem=P,x.dem.onDeserialize(),x.needsHillshadePrepare=!0,x.needsDEMTextureUpload=!0,x.state="loaded",a(null))}x.request=i.getImage(this.map._requestManager.transformRequest(m,i.ResourceType.Tile),function(S,P,H,W){if(delete x.request,x.aborted)x.state="unloaded",a(null);else if(S)x.state="errored",a(S);else if(P){this.map._refreshExpiredTiles&&x.setExpiryData({cacheControl:H,expires:W});const ee=i.window.ImageBitmap&&P instanceof i.window.ImageBitmap&&(ct==null&&(ct=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&typeof i.window.createImageBitmap=="function"),ct),pe=1-(P.width-i.prevPowerOfTwo(P.width))/2;pe<1||x.neighboringTiles||(x.neighboringTiles=this._getNeighboringTiles(x.tileID));const fe=ee?P:i.exported.getImageData(P,pe),Me={uid:x.uid,coord:x.tileID,source:this.id,rawImageData:fe,encoding:this.encoding,padding:pe};x.actor&&x.state!=="expired"||(x.actor=this.dispatcher.getActor(),x.actor.send("loadDEMTile",Me,b.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(x){const a=x.canonical,m=Math.pow(2,a.z),b=(a.x-1+m)%m,S=a.x===0?x.wrap-1:x.wrap,P=(a.x+1+m)%m,H=a.x+1===m?x.wrap+1:x.wrap,W={};return W[new i.OverscaledTileID(x.overscaledZ,S,a.z,b,a.y).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,H,a.z,P,a.y).key]={backfilled:!1},a.y>0&&(W[new i.OverscaledTileID(x.overscaledZ,S,a.z,b,a.y-1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,x.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,H,a.z,P,a.y-1).key]={backfilled:!1}),a.y+1<m&&(W[new i.OverscaledTileID(x.overscaledZ,S,a.z,b,a.y+1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,x.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},W[new i.OverscaledTileID(x.overscaledZ,H,a.z,P,a.y+1).key]={backfilled:!1}),W}unloadTile(x){x.demTexture&&this.map.painter.saveTileTexture(x.demTexture),x.fbo&&(x.fbo.destroy(),delete x.fbo),x.dem&&delete x.dem,delete x.neighboringTiles,x.state="unloaded"}},geojson:class extends i.Evented{constructor(x,a,m,b){super(),this.id=x,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=m.getActor(),this.setEventedParent(b),this._data=a.data,this._options=i.extend({},a),this._collectResourceTiming=a.collectResourceTiming,a.maxzoom!==void 0&&(this.maxzoom=a.maxzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const S=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(a.buffer!==void 0?a.buffer:128)*S,tolerance:(a.tolerance!==void 0?a.tolerance:.375)*S,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:a.clusterMaxZoom!==void 0?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:i.EXTENT,radius:(a.clusterRadius!==void 0?a.clusterRadius:50)*S,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter},a.workerOptions)}onAdd(x){this.map=x,this.setData(this._data)}setData(x){return this._data=x,this._updateWorkerData(),this}getClusterExpansionZoom(x,a){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:x,source:this.id},a),this}getClusterChildren(x,a){return this.actor.send("geojson.getClusterChildren",{clusterId:x,source:this.id},a),this}getClusterLeaves(x,a,m,b){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:x,limit:a,offset:m},b),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.Event("dataloading",{dataType:"source"})),this._loaded=!1;const x=i.extend({},this.workerOptions),a=this._data;typeof a=="string"?(x.request=this.map._requestManager.transformRequest(i.exported.resolveURL(a),i.ResourceType.Source),x.request.collectResourceTiming=this._collectResourceTiming):x.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,x,(m,b)=>{if(this._loaded=!0,this._pendingLoad=null,m)this.fire(new i.ErrorEvent(m));else{const S={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&b&&b.resourceTiming&&b.resourceTiming[this.id]&&(S.resourceTiming=b.resourceTiming[this.id]),this.fire(new i.Event("data",S)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(x,a){const m=x.actor?"reloadTile":"loadTile";x.actor=this.actor,x.request=this.actor.send(m,{type:this.type,uid:x.uid,tileID:x.tileID,tileZoom:x.tileZoom,zoom:x.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(b,S)=>(delete x.request,x.unloadVectorData(),x.aborted?a(null):b?a(b):(x.loadVectorData(S,this.map.painter,m==="reloadTile"),a(null))),void 0,m==="loadTile")}abortTile(x){x.request&&(x.request.cancel(),delete x.request),x.aborted=!0}unloadTile(x){x.unloadVectorData(),this.actor.send("removeTile",{uid:x.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends X{constructor(x,a,m,b){super(x,a,m,b),this.roundZoom=!0,this.type="video",this.options=a}load(){this._loaded=!1;const x=this.options;this.urls=[];for(const a of x.urls)this.urls.push(this.map._requestManager.transformRequest(a,i.ResourceType.Source).url);i.getVideo(this.urls,(a,m)=>{this._loaded=!0,a?this.fire(new i.ErrorEvent(a)):m&&(this.video=m,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(x){if(this.video){const a=this.video.seekable;x<a.start(0)||x>a.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=x}}getVideo(){return this.video}onAdd(x){this.map||(this.map=x,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const x=this.map.painter.context,a=x.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(x,this.video,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(x)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:X,canvas:class extends X{constructor(x,a,m,b){super(x,a,m,b),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some(S=>!Array.isArray(S)||S.length!==2||S.some(P=>typeof P!="number"))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${x}`,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 i.ErrorEvent(new i.ValidationError(`sources.${x}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(x){this.map=x,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let x=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,x=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,x=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context;this.texture?(x||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(a,this.canvas,a.gl.RGBA,{premultiply:!0}),this._prepareData(a)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const x of[this.canvas.width,this.canvas.height])if(isNaN(x)||x<=0)return!0;return!1}},custom:class extends i.Evented{constructor(x,a,m,b){super(),this.id=x,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=a,this.setEventedParent(b),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Gt(this._implementation.bounds,this.minzoom,this.maxzoom)),a.update=this._update.bind(this),a.clearTiles=this._clearTiles.bind(this),a.coveringTiles=this._coveringTiles.bind(this),i.extend(this,i.pick(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(x){this._map=x,this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(x),this.load()}onRemove(x){this._implementation.onRemove&&this._implementation.onRemove(x)}hasTile(x){if(this._implementation.hasTile){const{x:a,y:m,z:b}=x.canonical;return this._implementation.hasTile({x:a,y:m,z:b})}return!this.tileBounds||this.tileBounds.contains(x.canonical)}loadTile(x,a){const{x:m,y:b,z:S}=x.tileID.canonical,P=new i.window.AbortController;x.request=Promise.resolve(this._implementation.loadTile({x:m,y:b,z:S},{signal:P.signal})).then(function(H){return delete x.request,x.aborted?(x.state="unloaded",a(null)):H===void 0?(x.state="errored",a(null)):H===null?(this.loadTileData(x,{width:this.tileSize,height:this.tileSize,data:null}),x.state="loaded",a(null)):function(W){return W instanceof i.window.ImageData||W instanceof i.window.HTMLCanvasElement||W instanceof i.window.ImageBitmap||W instanceof i.window.HTMLImageElement}(H)?(this.loadTileData(x,H),x.state="loaded",void a(null)):(x.state="errored",a(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(H=>{H.code!==20&&(x.state="errored",a(H))}),x.request.cancel=()=>P.abort()}loadTileData(x,a){Pe.loadTileData(x,a,this._map.painter)}unloadTileData(x){Pe.unloadTileData(x,this._map.painter)}unloadTile(x,a){if(this.unloadTileData(x),this._implementation.unloadTile){const{x:m,y:b,z:S}=x.tileID.canonical;this._implementation.unloadTile({x:m,y:b,z:S})}a()}abortTile(x,a){x.request&&x.request.cancel&&(x.request.cancel(),delete x.request),a()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(x=>({x:x.canonical.x,y:x.canonical.y,z:x.canonical.z}))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}}},ie=function(x,a,m,b){const S=new j[a.type](x,a,m,b);if(S.id!==x)throw new Error(`Expected Source id to be ${x} instead of ${S.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],S),S};function ne(x,a){const m=i.identity([]);return i.scale(m,m,[.5*x.width,.5*-x.height,1]),i.translate(m,m,[1,-1,0]),i.multiply(m,m,x.calculateProjMatrix(a.toUnwrapped())),Float32Array.from(m)}function de(x,a,m,b,S,P,H,W=!1){const ee=x.tilesIn(b,H,W);ee.sort(tt);const pe=[];for(const Me of ee)pe.push({wrappedTileID:Me.tile.tileID.wrapped().key,queryResults:Me.tile.queryRenderedFeatures(a,m,x._state,Me,S,P,ne(x.transform,Me.tile.tileID),W)});const fe=function(Me){const Ne={},st={};for(const it of Me){const lt=it.queryResults,qe=it.wrappedTileID,Ye=st[qe]=st[qe]||{};for(const dt in lt){const ht=lt[dt],Bt=Ye[dt]=Ye[dt]||{},Pt=Ne[dt]=Ne[dt]||[];for(const It of ht)Bt[It.featureIndex]||(Bt[It.featureIndex]=!0,Pt.push(It))}}return Ne}(pe);for(const Me in fe)fe[Me].forEach(Ne=>{const st=Ne.feature,it=st.layer;it&&it.type!=="background"&&it.type!=="sky"&&(st.source=it.source,it["source-layer"]&&(st.sourceLayer=it["source-layer"]),st.state=st.id!==void 0?x.getFeatureState(it["source-layer"],st.id):{})});return fe}function Ue(x,a){const m=x.getRenderableIds().map(P=>x.getTileByID(P)),b=[],S={};for(let P=0;P<m.length;P++){const H=m[P],W=H.tileID.canonical.key;S[W]||(S[W]=!0,H.querySourceFeatures(b,a))}return b}function tt(x,a){const m=x.tileID,b=a.tileID;return m.overscaledZ-b.overscaledZ||m.canonical.y-b.canonical.y||m.wrap-b.wrap||m.canonical.x-b.canonical.x}function He(){return $l.workerClass!=null?new $l.workerClass:new i.window.Worker($l.workerUrl)}const et="mapboxgl_preloaded_worker_pool";class pt{constructor(){this.active={}}acquire(a){if(!this.workers)for(this.workers=[];this.workers.length<pt.workerCount;)this.workers.push(new He);return this.active[a]=!0,this.workers.slice()}release(a){delete this.active[a],this.numActive()===0&&(this.workers.forEach(m=>{m.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[et]}numActive(){return Object.keys(this.active).length}}let Lt;function jt(){return Lt||(Lt=new pt),Lt}function Wt(x,a){const m={};for(const b in x)b!=="ref"&&(m[b]=x[b]);return i.refProperties.forEach(b=>{b in a&&(m[b]=a[b])}),m}function ki(x){x=x.slice();const a=Object.create(null);for(let m=0;m<x.length;m++)a[x[m].id]=x[m];for(let m=0;m<x.length;m++)"ref"in x[m]&&(x[m]=Wt(x[m],a[x[m].ref]));return x}pt.workerCount=2;const bi={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function Oi(x,a,m){m.push({command:bi.addSource,args:[x,a[x]]})}function Yi(x,a,m){a.push({command:bi.removeSource,args:[x]}),m[x]=!0}function tn(x,a,m,b){Yi(x,m,b),Oi(x,a,m)}function rr(x,a,m){let b;for(b in x[m])if(x[m].hasOwnProperty(b)&&b!=="data"&&!C(x[m][b],a[m][b]))return!1;for(b in a[m])if(a[m].hasOwnProperty(b)&&b!=="data"&&!C(x[m][b],a[m][b]))return!1;return!0}function yn(x,a,m,b,S,P){let H;for(H in a=a||{},x=x||{})x.hasOwnProperty(H)&&(C(x[H],a[H])||m.push({command:P,args:[b,H,a[H],S]}));for(H in a)a.hasOwnProperty(H)&&!x.hasOwnProperty(H)&&(C(x[H],a[H])||m.push({command:P,args:[b,H,a[H],S]}))}function Yt(x){return x.id}function sr(x,a){return x[a.id]=a,x}class Yn{constructor(a,m){this.reset(a,m)}reset(a,m){this.points=a||[],this._distances=[0];for(let b=1;b<this.points.length;b++)this._distances[b]=this._distances[b-1]+this.points[b].dist(this.points[b-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(m||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(a){if(this.points.length===1)return this.points[0];a=i.clamp(a,0,1);let m=1,b=this._distances[m];const S=a*this.paddedLength+this.padding;for(;b<S&&m<this._distances.length;)b=this._distances[++m];const P=m-1,H=this._distances[P],W=b-H,ee=W>0?(S-H)/W:0;return this.points[P].mult(1-ee).add(this.points[m].mult(ee))}}class Wr{constructor(a,m,b){const S=this.boxCells=[],P=this.circleCells=[];this.xCellCount=Math.ceil(a/b),this.yCellCount=Math.ceil(m/b);for(let H=0;H<this.xCellCount*this.yCellCount;H++)S.push([]),P.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=a,this.height=m,this.xScale=this.xCellCount/a,this.yScale=this.yCellCount/m,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(a,m,b,S,P){this._forEachCell(m,b,S,P,this._insertBoxCell,this.boxUid++),this.boxKeys.push(a),this.bboxes.push(m),this.bboxes.push(b),this.bboxes.push(S),this.bboxes.push(P)}insertCircle(a,m,b,S){this._forEachCell(m-S,b-S,m+S,b+S,this._insertCircleCell,this.circleUid++),this.circleKeys.push(a),this.circles.push(m),this.circles.push(b),this.circles.push(S)}_insertBoxCell(a,m,b,S,P,H){this.boxCells[P].push(H)}_insertCircleCell(a,m,b,S,P,H){this.circleCells[P].push(H)}_query(a,m,b,S,P,H){if(b<0||a>this.width||S<0||m>this.height)return!P&&[];const W=[];if(a<=0&&m<=0&&this.width<=b&&this.height<=S){if(P)return!0;for(let ee=0;ee<this.boxKeys.length;ee++)W.push({key:this.boxKeys[ee],x1:this.bboxes[4*ee],y1:this.bboxes[4*ee+1],x2:this.bboxes[4*ee+2],y2:this.bboxes[4*ee+3]});for(let ee=0;ee<this.circleKeys.length;ee++){const pe=this.circles[3*ee],fe=this.circles[3*ee+1],Me=this.circles[3*ee+2];W.push({key:this.circleKeys[ee],x1:pe-Me,y1:fe-Me,x2:pe+Me,y2:fe+Me})}return H?W.filter(H):W}return this._forEachCell(a,m,b,S,this._queryCell,W,{hitTest:P,seenUids:{box:{},circle:{}}},H),P?W.length>0:W}_queryCircle(a,m,b,S,P){const H=a-b,W=a+b,ee=m-b,pe=m+b;if(W<0||H>this.width||pe<0||ee>this.height)return!S&&[];const fe=[];return this._forEachCell(H,ee,W,pe,this._queryCellCircle,fe,{hitTest:S,circle:{x:a,y:m,radius:b},seenUids:{box:{},circle:{}}},P),S?fe.length>0:fe}query(a,m,b,S,P){return this._query(a,m,b,S,!1,P)}hitTest(a,m,b,S,P){return this._query(a,m,b,S,!0,P)}hitTestCircle(a,m,b,S){return this._queryCircle(a,m,b,!0,S)}_queryCell(a,m,b,S,P,H,W,ee){const pe=W.seenUids,fe=this.boxCells[P];if(fe!==null){const Ne=this.bboxes;for(const st of fe)if(!pe.box[st]){pe.box[st]=!0;const it=4*st;if(a<=Ne[it+2]&&m<=Ne[it+3]&&b>=Ne[it+0]&&S>=Ne[it+1]&&(!ee||ee(this.boxKeys[st]))){if(W.hitTest)return H.push(!0),!0;H.push({key:this.boxKeys[st],x1:Ne[it],y1:Ne[it+1],x2:Ne[it+2],y2:Ne[it+3]})}}}const Me=this.circleCells[P];if(Me!==null){const Ne=this.circles;for(const st of Me)if(!pe.circle[st]){pe.circle[st]=!0;const it=3*st;if(this._circleAndRectCollide(Ne[it],Ne[it+1],Ne[it+2],a,m,b,S)&&(!ee||ee(this.circleKeys[st]))){if(W.hitTest)return H.push(!0),!0;{const lt=Ne[it],qe=Ne[it+1],Ye=Ne[it+2];H.push({key:this.circleKeys[st],x1:lt-Ye,y1:qe-Ye,x2:lt+Ye,y2:qe+Ye})}}}}}_queryCellCircle(a,m,b,S,P,H,W,ee){const pe=W.circle,fe=W.seenUids,Me=this.boxCells[P];if(Me!==null){const st=this.bboxes;for(const it of Me)if(!fe.box[it]){fe.box[it]=!0;const lt=4*it;if(this._circleAndRectCollide(pe.x,pe.y,pe.radius,st[lt+0],st[lt+1],st[lt+2],st[lt+3])&&(!ee||ee(this.boxKeys[it])))return H.push(!0),!0}}const Ne=this.circleCells[P];if(Ne!==null){const st=this.circles;for(const it of Ne)if(!fe.circle[it]){fe.circle[it]=!0;const lt=3*it;if(this._circlesCollide(st[lt],st[lt+1],st[lt+2],pe.x,pe.y,pe.radius)&&(!ee||ee(this.circleKeys[it])))return H.push(!0),!0}}}_forEachCell(a,m,b,S,P,H,W,ee){const pe=this._convertToXCellCoord(a),fe=this._convertToYCellCoord(m),Me=this._convertToXCellCoord(b),Ne=this._convertToYCellCoord(S);for(let st=pe;st<=Me;st++)for(let it=fe;it<=Ne;it++)if(P.call(this,a,m,b,S,this.xCellCount*it+st,H,W,ee))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,m,b,S,P,H){const W=S-a,ee=P-m,pe=b+H;return pe*pe>W*W+ee*ee}_circleAndRectCollide(a,m,b,S,P,H,W){const ee=(H-S)/2,pe=Math.abs(a-(S+ee));if(pe>ee+b)return!1;const fe=(W-P)/2,Me=Math.abs(m-(P+fe));if(Me>fe+b)return!1;if(pe<=ee||Me<=fe)return!0;const Ne=pe-ee,st=Me-fe;return Ne*Ne+st*st<=b*b}}const mr=Math.tan(85*Math.PI/180);function Mr(x,a,m,b,S,P,H){const W=i.create();if(m)if(P.name==="globe"){const ee=i.calculateGlobeLabelMatrix(S,a);i.multiply(W,W,ee)}else{const ee=Ge([],H);W[0]=ee[0],W[1]=ee[1],W[4]=ee[2],W[5]=ee[3],b||i.rotateZ(W,W,S.angle)}else i.multiply(W,S.labelPlaneMatrix,x);return W}function Oo(x,a,m,b,S,P,H){const W=Mr(x,a,m,b,S,P,H);return P.name==="globe"&&m||(W[2]=W[6]=W[10]=W[14]=0),W}function zs(x,a,m,b,S,P,H){if(m){if(P.name==="globe"){const W=Mr(x,a,m,b,S,P,H);return i.invert(W,W),i.multiply(W,x,W),W}{const W=i.clone(x),ee=i.identity([]);return ee[0]=H[0],ee[1]=H[1],ee[4]=H[2],ee[5]=H[3],i.multiply(W,W,ee),b||i.rotateZ(W,W,-S.angle),W}}return S.glCoordMatrix}function or(x,a,m,b){const S=[x,a,m,1];m?i.transformMat4$1(S,S,b):cs(S,S,b);const P=S[3];return S[0]/=P,S[1]/=P,S[2]/=P,S}function rn(x,a){return Math.min(.5+x/a*.5,1.5)}function cr(x,a){const m=x[0]/x[3],b=x[1]/x[3];return m>=-a[0]&&m<=a[0]&&b>=-a[1]&&b<=a[1]}function Ar(x,a,m,b,S,P,H,W,ee,pe){const fe=m.transform,Me=b?x.textSizeData:x.iconSizeData,Ne=i.evaluateSizeForZoom(Me,m.transform.zoom),st=fe.projection.name==="globe",it=[256/m.width*2+1,256/m.height*2+1],lt=b?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;lt.clear();let qe=null;st&&(qe=b?x.text.globeExtVertexArray:x.icon.globeExtVertexArray);const Ye=x.lineVertexArray,dt=b?x.text.placedSymbolArray:x.icon.placedSymbolArray,ht=m.transform.width/m.transform.height;let Bt,Pt=!1;for(let It=0;It<dt.length;It++){const Ht=dt.get(It),{numGlyphs:hi,writingMode:si}=Ht;if(si!==i.WritingMode.vertical||Pt||Bt===i.WritingMode.horizontal||(Pt=!0),Bt=si,(Ht.hidden||si===i.WritingMode.vertical)&&!Pt){qs(hi,lt);continue}Pt=!1;const qt=new i.pointGeometry(Ht.tileAnchorX,Ht.tileAnchorY);let{x:ji,y:Kt,z:Ci}=fe.projection.projectTilePoint(qt.x,qt.y,pe.canonical);if(ee){const[Hn,Mn,$n]=ee(qt);ji+=Hn,Kt+=Mn,Ci+=$n}const di=[ji,Kt,Ci,1];if(i.transformMat4$1(di,di,a),!cr(di,it)){qs(hi,lt);continue}const Ri=rn(m.transform.cameraToCenterDistance,di[3]),Ai=i.evaluateSizeForFeature(Me,Ne,Ht),Mi=H?Ai/Ri:Ai*Ri,$i=or(ji,Kt,Ci,S);if($i[3]<=0){qs(hi,lt);continue}let Jt={};const pi=H?null:ee,In=dr(Ht,Mi,!1,W,a,S,P,x.glyphOffsetArray,Ye,lt,qe,$i,qt,Jt,ht,pi,fe.projection,pe,H);Pt=In.useVertical,pi&&In.needsFlipping&&(Jt={}),(In.notEnoughRoom||Pt||In.needsFlipping&&dr(Ht,Mi,!0,W,a,S,P,x.glyphOffsetArray,Ye,lt,qe,$i,qt,Jt,ht,pi,fe.projection,pe,H).notEnoughRoom)&&qs(hi,lt)}b?(x.text.dynamicLayoutVertexBuffer.updateData(lt),qe&&x.text.globeExtVertexBuffer.updateData(qe)):(x.icon.dynamicLayoutVertexBuffer.updateData(lt),qe&&x.icon.globeExtVertexBuffer.updateData(qe))}function aa(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt){const{lineStartIndex:qe,glyphStartIndex:Ye,segment:dt}=W,ht=Ye+W.numGlyphs,Bt=qe+W.lineLength,Pt=a.getoffsetX(Ye),It=a.getoffsetX(ht-1),Ht=ll(x*Pt,m,b,S,P,H,dt,qe,Bt,ee,pe,fe,Me,Ne,!0,st,it,lt);if(!Ht)return null;const hi=ll(x*It,m,b,S,P,H,dt,qe,Bt,ee,pe,fe,Me,Ne,!0,st,it,lt);return hi?{first:Ht,last:hi}:null}function al(x,a,m,b){return x===i.WritingMode.horizontal&&Math.abs(b)>Math.abs(m)?{useVertical:!0}:x===i.WritingMode.vertical?b>0?{needsFlipping:!0}:null:a!==0&&function(S,P){return S===0||Math.abs(P/S)>mr}(m,b)?a===1?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function dr(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt,qe,Ye,dt){const ht=a/24,Bt=x.lineOffsetX*ht,Pt=x.lineOffsetY*ht,{lineStartIndex:It,glyphStartIndex:Ht,numGlyphs:hi,segment:si,writingMode:qt,flipState:ji}=x,Kt=It+x.lineLength,Ci=di=>{if(fe){const[$i,Jt,pi]=di.up,In=pe.length;i.updateGlobeVertexNormal(fe,In+0,$i,Jt,pi),i.updateGlobeVertexNormal(fe,In+1,$i,Jt,pi),i.updateGlobeVertexNormal(fe,In+2,$i,Jt,pi),i.updateGlobeVertexNormal(fe,In+3,$i,Jt,pi)}const[Ri,Ai,Mi]=di.point;i.addDynamicAttributes(pe,Ri,Ai,Mi,di.angle)};if(hi>1){const di=aa(ht,W,Bt,Pt,m,Me,Ne,x,ee,P,st,lt,!1,qe,Ye,dt);if(!di)return{notEnoughRoom:!0};if(b&&!m){let[Ri,Ai,Mi]=di.first.point,[$i,Jt,pi]=di.last.point;[Ri,Ai]=or(Ri,Ai,Mi,H),[$i,Jt]=or($i,Jt,pi,H);const In=al(qt,ji,($i-Ri)*it,Jt-Ai);if(x.flipState=In&&In.needsFlipping?1:2,In)return In}Ci(di.first);for(let Ri=Ht+1;Ri<Ht+hi-1;Ri++){const Ai=ll(ht*W.getoffsetX(Ri),Bt,Pt,m,Me,Ne,si,It,Kt,ee,P,st,lt,!1,!1,qe,Ye,dt);if(!Ai)return pe.length-=4*(Ri-Ht),{notEnoughRoom:!0};Ci(Ai)}Ci(di.last)}else{if(b&&!m){const Ri=or(Ne.x,Ne.y,0,S),Ai=It+si+1,Mi=new i.pointGeometry(ee.getx(Ai),ee.gety(Ai)),$i=or(Mi.x,Mi.y,0,S),Jt=$i[3]>0?$i:Rl(Ne,Mi,Ri,1,S,void 0,qe,Ye.canonical),pi=al(qt,ji,(Jt[0]-Ri[0])*it,Jt[1]-Ri[1]);if(x.flipState=pi&&pi.needsFlipping?1:2,pi)return pi}const di=ll(ht*W.getoffsetX(Ht),Bt,Pt,m,Me,Ne,si,It,Kt,ee,P,st,lt,!1,!1,qe,Ye,dt);if(!di)return{notEnoughRoom:!0};Ci(di)}return{}}function Ul(x,a,m,b,S){const{x:P,y:H,z:W}=b.projectTilePoint(x.x,x.y,a);if(!S)return or(P,H,W,m);const[ee,pe,fe]=S(x);return or(P+ee,H+pe,W+fe,m)}function Rl(x,a,m,b,S,P,H,W){const ee=Ul(x.sub(a)._unit()._add(x),W,S,H,P);return i.sub(ee,m,ee),i.normalize(ee,ee),i.scaleAndAdd(ee,m,ee,b)}function ll(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt,qe,Ye){const dt=b?x-a:x+a;let ht=dt>0?1:-1,Bt=0;b&&(ht*=-1,Bt=Math.PI),ht<0&&(Bt+=Math.PI);let Pt=W+H+(ht>0?0:1)|0,It=S,Ht=S,hi=0,si=0;const qt=Math.abs(dt),ji=[],Kt=[];let Ci=P,di=Ci;const Ri=()=>Rl(di,Ci,Ht,qt-hi+1,fe,Ne,lt,qe.canonical);for(;hi+si<=qt;){if(Pt+=ht,Pt<W||Pt>=ee)return null;if(Ht=It,di=Ci,ji.push(Ht),st&&Kt.push(di),Ci=new i.pointGeometry(pe.getx(Pt),pe.gety(Pt)),It=Me[Pt],!It){const $n=Ul(Ci,qe.canonical,fe,lt,Ne);It=$n[3]>0?Me[Pt]=$n:Ri()}hi+=si,si=i.distance(Ht,It)}it&&Ne&&(Me[Pt]&&(It=Ri(),si=i.distance(Ht,It)),Me[Pt]=It);const Ai=(qt-hi)/si,Mi=Ci.sub(di)._mult(Ai)._add(di),$i=i.sub([],It,Ht),Jt=i.scaleAndAdd([],Ht,$i,Ai);let pi=[0,0,1],In=$i[0],Hn=$i[1];if(Ye&&(pi=lt.upVector(qe.canonical,Mi.x,Mi.y),pi[0]!==0||pi[1]!==0||pi[2]!==1)){const $n=[pi[2],0,-pi[0]],lr=i.cross([],pi,$n);i.normalize($n,$n),i.normalize(lr,lr),In=i.dot($i,$n),Hn=i.dot($i,lr)}if(m){const $n=i.cross([],pi,$i);i.normalize($n,$n),i.scaleAndAdd(Jt,Jt,$n,m*ht)}const Mn=Bt+Math.atan2(Hn,In);return ji.push(Jt),st&&Kt.push(Mi),{point:Jt,angle:Mn,path:ji,tilePath:Kt,up:pi}}function qs(x,a){const m=a.length,b=m+4*x;a.resize(b),a.float32.fill(-1/0,4*m,4*b)}function cs(x,a,m){const b=a[0],S=a[1];return x[0]=m[0]*b+m[4]*S+m[12],x[1]=m[1]*b+m[5]*S+m[13],x[3]=m[3]*b+m[7]*S+m[15],x}const ho=100;class cl{constructor(a,m,b=new Wr(a.width+200,a.height+200,25),S=new Wr(a.width+200,a.height+200,25)){this.transform=a,this.grid=b,this.ignoredGrid=S,this.pitchfactor=Math.cos(a._pitch)*a.cameraToCenterDistance,this.screenRightBoundary=a.width+ho,this.screenBottomBoundary=a.height+ho,this.gridRightBoundary=a.width+200,this.gridBottomBoundary=a.height+200,this.fogState=m}placeCollisionBox(a,m,b,S,P,H,W,ee){let pe=b.projectedAnchorX,fe=b.projectedAnchorY,Me=b.projectedAnchorZ;const Ne=b.elevation,st=b.tileID,it=a.getProjection();if(Ne&&st){const[It,Ht,hi]=it.upVector(st.canonical,b.tileAnchorX,b.tileAnchorY),si=it.upVectorScale(st.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;pe+=It*Ne*si,fe+=Ht*Ne*si,Me+=hi*Ne*si}const lt=this.projectAndGetPerspectiveRatio(W,pe,fe,Me,b.tileID,it.name==="globe"||!!Ne||this.transform.pitch>0,it),qe=H*lt.perspectiveRatio,Ye=(b.x1*m+S.x-b.padding)*qe+lt.point.x,dt=(b.y1*m+S.y-b.padding)*qe+lt.point.y,ht=(b.x2*m+S.x+b.padding)*qe+lt.point.x,Bt=(b.y2*m+S.y+b.padding)*qe+lt.point.y,Pt=lt.perspectiveRatio<=.55||lt.occluded;return!this.isInsideGrid(Ye,dt,ht,Bt)||!P&&this.grid.hitTest(Ye,dt,ht,Bt,ee)||Pt?{box:[],offscreen:!1,occluded:lt.occluded}:{box:[Ye,dt,ht,Bt],offscreen:this.isOffscreen(Ye,dt,ht,Bt),occluded:!1}}placeCollisionCircles(a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt){const qe=[],Ye=this.transform.elevation,dt=a.getProjection(),ht=Ye?Ye.getAtTileOffsetFunc(lt,this.transform.center.lat,this.transform.worldSize,dt):null,Bt=new i.pointGeometry(b.tileAnchorX,b.tileAnchorY);let{x:Pt,y:It,z:Ht}=dt.projectTilePoint(Bt.x,Bt.y,lt.canonical);if(ht){const[Mi,$i,Jt]=ht(Bt);Pt+=Mi,It+=$i,Ht+=Jt}const hi=dt.name==="globe",si=this.projectAndGetPerspectiveRatio(W,Pt,It,Ht,lt,hi||!!Ye||this.transform.pitch>0,dt),{perspectiveRatio:qt}=si,ji=(Me?H/qt:H*qt)/i.ONE_EM,Kt=or(Pt,It,Ht,ee),Ci=si.signedDistanceFromCamera>0?aa(ji,P,b.lineOffsetX*ji,b.lineOffsetY*ji,!1,Kt,Bt,b,S,ee,{},Ye&&!Me?ht:null,Me&&!!Ye,dt,lt,Me):null;let di=!1,Ri=!1,Ai=!0;if(Ci&&!si.occluded){const Mi=.5*st*qt+it,$i=new i.pointGeometry(-100,-100),Jt=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),pi=new Yn,{first:In,last:Hn}=Ci,Mn=In.path.length;let $n=[];for(let _n=Mn-1;_n>=1;_n--)$n.push(In.path[_n]);for(let _n=1;_n<Hn.path.length;_n++)$n.push(Hn.path[_n]);const lr=2.5*Mi;pe&&($n=$n.map(([_n,Dr,Or],Nr)=>(ht&&!hi&&(Or=ht(Nr<Mn-1?In.tilePath[Mn-1-Nr]:Hn.tilePath[Nr-Mn+2])[2]),or(_n,Dr,Or,pe))),$n.some(_n=>_n[3]<=0)&&($n=[]));let On=[];if($n.length>0){let _n=1/0,Dr=-1/0,Or=1/0,Nr=-1/0;for(const Qr of $n)_n=Math.min(_n,Qr[0]),Or=Math.min(Or,Qr[1]),Dr=Math.max(Dr,Qr[0]),Nr=Math.max(Nr,Qr[1]);Dr>=$i.x&&_n<=Jt.x&&Nr>=$i.y&&Or<=Jt.y&&(On=[$n.map(Qr=>new i.pointGeometry(Qr[0],Qr[1]))],(_n<$i.x||Dr>Jt.x||Or<$i.y||Nr>Jt.y)&&(On=i.clipLine(On,$i.x,$i.y,Jt.x,Jt.y)))}for(const _n of On){pi.reset(_n,.25*Mi);let Dr=0;Dr=pi.length<=.5*Mi?1:Math.ceil(pi.paddedLength/lr)+1;for(let Or=0;Or<Dr;Or++){const Nr=Or/Math.max(Dr-1,1),Qr=pi.lerp(Nr),go=Qr.x+ho,Ca=Qr.y+ho;qe.push(go,Ca,Mi,0);const jo=go-Mi,vs=Ca-Mi,_r=go+Mi,Xr=Ca+Mi;if(Ai=Ai&&this.isOffscreen(jo,vs,_r,Xr),Ri=Ri||this.isInsideGrid(jo,vs,_r,Xr),!m&&this.grid.hitTestCircle(go,Ca,Mi,Ne)&&(di=!0,!fe))return{circles:[],offscreen:!1,collisionDetected:di,occluded:!1}}}}return{circles:!fe&&di||!Ri?[]:qe,offscreen:Ai,collisionDetected:di,occluded:si.occluded}}queryRenderedSymbols(a){if(a.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const m=[];let b=1/0,S=1/0,P=-1/0,H=-1/0;for(const fe of a){const Me=new i.pointGeometry(fe.x+ho,fe.y+ho);b=Math.min(b,Me.x),S=Math.min(S,Me.y),P=Math.max(P,Me.x),H=Math.max(H,Me.y),m.push(Me)}const W=this.grid.query(b,S,P,H).concat(this.ignoredGrid.query(b,S,P,H)),ee={},pe={};for(const fe of W){const Me=fe.key;if(ee[Me.bucketInstanceId]===void 0&&(ee[Me.bucketInstanceId]={}),ee[Me.bucketInstanceId][Me.featureIndex])continue;const Ne=[new i.pointGeometry(fe.x1,fe.y1),new i.pointGeometry(fe.x2,fe.y1),new i.pointGeometry(fe.x2,fe.y2),new i.pointGeometry(fe.x1,fe.y2)];i.polygonIntersectsPolygon(m,Ne)&&(ee[Me.bucketInstanceId][Me.featureIndex]=!0,pe[Me.bucketInstanceId]===void 0&&(pe[Me.bucketInstanceId]=[]),pe[Me.bucketInstanceId].push(Me.featureIndex))}return pe}insertCollisionBox(a,m,b,S,P){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:b,featureIndex:S,collisionGroupID:P},a[0],a[1],a[2],a[3])}insertCollisionCircles(a,m,b,S,P){const H=m?this.ignoredGrid:this.grid,W={bucketInstanceId:b,featureIndex:S,collisionGroupID:P};for(let ee=0;ee<a.length;ee+=4)H.insertCircle(W,a[ee],a[ee+1],a[ee+2])}projectAndGetPerspectiveRatio(a,m,b,S,P,H,W){const ee=[m,b,S,1];let pe=!1;if(S||this.transform.pitch>0){i.transformMat4$1(ee,ee,a);const Me=W.name==="globe";this.fogState&&P&&!Me&&(pe=function(st,it,lt,qe,Ye,dt){const ht=dt.calculateFogTileMatrix(Ye),Bt=[it,lt,qe];return i.transformMat4(Bt,Bt,ht),Oe(st,Bt,dt.pitch,dt._fov)}(this.fogState,m,b,S,P.toUnwrapped(),this.transform)>.9)}else cs(ee,ee,a);const fe=ee[3];return{point:new i.pointGeometry((ee[0]/fe+1)/2*this.transform.width+ho,(-ee[1]/fe+1)/2*this.transform.height+ho),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(W)/fe*.5,1.5),signedDistanceFromCamera:fe,occluded:H&&ee[2]>fe||pe}}isOffscreen(a,m,b,S){return b<ho||a>=this.screenRightBoundary||S<ho||m>this.screenBottomBoundary}isInsideGrid(a,m,b,S){return b>=0&&a<this.gridRightBoundary&&S>=0&&m<this.gridBottomBoundary}getViewportMatrix(){const a=i.identity([]);return i.translate(a,a,[-100,-100,0]),a}}function Oa(x,a,m){const b=a.createTileMatrix(x,x.worldSize,m.toUnwrapped());return i.multiply(new Float32Array(16),x.projMatrix,b)}function zl(x,a,m){if(a.projection.name===m.projection.name)return x.projMatrix;const b=m.clone();return b.setProjection(a.projection),Oa(b,a.getProjection(),x)}function kl(x,a,m){return a.name===m.projection.name?x.projMatrix:Oa(m,a,x)}class Ol{constructor(a,m,b,S){this.opacity=a?Math.max(0,Math.min(1,a.opacity+(a.placed?m:-m))):S&&b?1:0,this.placed=b}isHidden(){return this.opacity===0&&!this.placed}}class Na{constructor(a,m,b,S,P,H=!1){this.text=new Ol(a?a.text:null,m,b,P),this.icon=new Ol(a?a.icon:null,m,S,P),this.clipped=H}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Nl{constructor(a,m,b,S=!1){this.text=a,this.icon=m,this.skipFade=b,this.clipped=S}}class Ql{constructor(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}}class is{constructor(a,m,b,S,P){this.bucketInstanceId=a,this.featureIndex=m,this.sourceLayerIndex=b,this.bucketIndex=S,this.tileID=P}}class Ys{constructor(a){this.crossSourceCollisions=a,this.maxGroupID=0,this.collisionGroups={}}get(a){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[a]){const m=++this.maxGroupID;this.collisionGroups[a]={ID:m,predicate:b=>b.collisionGroupID===m}}return this.collisionGroups[a]}}function ps(x,a,m,b,S){const{horizontalAlign:P,verticalAlign:H}=i.getAnchorAlignment(x),W=-(P-.5)*a,ee=-(H-.5)*m,pe=i.evaluateVariableOffset(x,b);return new i.pointGeometry(W+pe[0]*S,ee+pe[1]*S)}function Rc(x,a,m,b,S){const P=new i.pointGeometry(x,a);return m&&P._rotate(b?S:-S),P}class Eh{constructor(a,m,b,S,P){this.transform=a.clone(),this.projection=a.projection.name,this.collisionIndex=new cl(this.transform,P),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Ys(b),this.collisionCircleArrays={},this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(a,m,b,S){const P=b.getBucket(m),H=b.latestFeatureIndex;if(!P||!H||m.id!==P.layerIds[0])return;const W=P.layers[0].layout,ee=b.collisionBoxArray,pe=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),fe=b.tileSize/i.EXTENT,Me=b.tileID.toUnwrapped();this.transform.setProjection(P.projection);const Ne=(st=b.tileID,it=P.getProjection(),lt=this.transform,it.name===this.projection?lt.calculateProjMatrix(st.toUnwrapped()):Oa(lt,it,st));var st,it,lt;const qe=W.get("text-pitch-alignment")==="map",Ye=W.get("text-rotation-alignment")==="map";m.compileFilter();const dt=m.dynamicFilter(),ht=m.dynamicFilterNeedsFeature(),Bt=this.transform.calculatePixelsToTileUnitsMatrix(b),Pt=Oo(Ne,b.tileID.canonical,qe,Ye,this.transform,P.getProjection(),Bt);let It=null;if(qe){const si=zs(Ne,b.tileID.canonical,qe,Ye,this.transform,P.getProjection(),Bt);It=i.multiply([],this.transform.labelPlaneMatrix,si)}let Ht=null;dt&&b.latestFeatureIndex&&(Ht={unwrappedTileID:Me,dynamicFilter:dt,dynamicFilterNeedsFeature:ht,featureIndex:b.latestFeatureIndex}),this.retainedQueryData[P.bucketInstanceId]=new is(P.bucketInstanceId,H,P.sourceLayerIndex,P.index,b.tileID);const hi={bucket:P,layout:W,posMatrix:Ne,textLabelPlaneMatrix:Pt,labelToScreenMatrix:It,clippingData:Ht,scale:pe,textPixelRatio:fe,holdingForFade:b.holdingForFade(),collisionBoxArray:ee,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(P.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(P.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(P.sourceID)};if(S)for(const si of P.sortKeyRanges){const{sortKey:qt,symbolInstanceStart:ji,symbolInstanceEnd:Kt}=si;a.push({sortKey:qt,symbolInstanceStart:ji,symbolInstanceEnd:Kt,parameters:hi})}else a.push({symbolInstanceStart:0,symbolInstanceEnd:P.symbolInstances.length,parameters:hi})}attemptAnchorPlacement(a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt,qe,Ye,dt){const{textOffset0:ht,textOffset1:Bt,crossTileID:Pt}=Ne,It=[ht,Bt],Ht=ps(a,b,S,It,P),hi=this.collisionIndex.placeCollisionBox(it,P,m,Rc(Ht.x,Ht.y,H,W,this.transform.angle),Me,ee,pe,fe.predicate);if(qe){const si=it.getSymbolInstanceIconSize(dt,this.transform.zoom,Ne.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(it,si,qe,Rc(Ht.x,Ht.y,H,W,this.transform.angle),Me,ee,pe,fe.predicate).box.length===0)return}if(hi.box.length>0){let si;return this.prevPlacement&&this.prevPlacement.variableOffsets[Pt]&&this.prevPlacement.placements[Pt]&&this.prevPlacement.placements[Pt].text&&(si=this.prevPlacement.variableOffsets[Pt].anchor),this.variableOffsets[Pt]={textOffset:It,width:b,height:S,anchor:a,textScale:P,prevAnchor:si},this.markUsedJustification(it,a,Ne,lt),it.allowVerticalPlacement&&(this.markUsedOrientation(it,lt,Ne),this.placedOrientations[Pt]=lt),{shift:Ht,placedGlyphBoxes:hi}}}placeLayerBucketPart(a,m,b,S){const{bucket:P,layout:H,posMatrix:W,textLabelPlaneMatrix:ee,labelToScreenMatrix:pe,clippingData:fe,textPixelRatio:Me,holdingForFade:Ne,collisionBoxArray:st,partiallyEvaluatedTextSize:it,partiallyEvaluatedIconSize:lt,collisionGroup:qe}=a.parameters,Ye=H.get("text-optional"),dt=H.get("icon-optional"),ht=H.get("text-allow-overlap"),Bt=H.get("icon-allow-overlap"),Pt=H.get("text-rotation-alignment")==="map",It=H.get("text-pitch-alignment")==="map",Ht=H.get("icon-text-fit")!=="none",hi=H.get("symbol-z-order")==="viewport-y";this.transform.setProjection(P.projection);let si=ht&&(Bt||!P.hasIconData()||dt),qt=Bt&&(ht||!P.hasTextData()||Ye);!P.collisionArrays&&st&&P.deserializeCollisionBoxes(st),b&&S&&P.updateCollisionDebugBuffers(this.transform.zoom,st);const ji=(Kt,Ci,di)=>{const{crossTileID:Ri,numVerticalGlyphVertices:Ai}=Kt;if(fe){const _r={zoom:this.transform.zoom,pitch:this.transform.pitch};let Xr=null;if(fe.dynamicFilterNeedsFeature){const Fr=this.retainedQueryData[P.bucketInstanceId];Xr=fe.featureIndex.loadFeature({featureIndex:Kt.featureIndex,bucketIndex:Fr.bucketIndex,sourceLayerIndex:Fr.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,fe.dynamicFilter)(_r,Xr,this.retainedQueryData[P.bucketInstanceId].tileID.canonical,new i.pointGeometry(Kt.tileAnchorX,Kt.tileAnchorY),this.transform.calculateDistanceTileData(fe.unwrappedTileID)))return this.placements[Ri]=new Nl(!1,!1,!1,!0),void(m[Ri]=!0)}if(m[Ri])return;if(Ne)return void(this.placements[Ri]=new Nl(!1,!1,!1));let Mi=!1,$i=!1,Jt=!0,pi=!1,In=!1,Hn=null,Mn={box:null,offscreen:null,occluded:null},$n={box:null,offscreen:null,occluded:null},lr=null,On=null,_n=null,Dr=0,Or=0,Nr=0;di.textFeatureIndex?Dr=di.textFeatureIndex:Kt.useRuntimeCollisionCircles&&(Dr=Kt.featureIndex),di.verticalTextFeatureIndex&&(Or=di.verticalTextFeatureIndex);const Qr=_r=>{_r.tileID=this.retainedQueryData[P.bucketInstanceId].tileID;const Xr=this.transform.elevation;(Xr||_r.elevation)&&(_r.elevation=Xr?Xr.getAtTileOffset(_r.tileID,_r.tileAnchorX,_r.tileAnchorY):0)},go=di.textBox;if(go){Qr(go);const _r=Fr=>{let Fs=i.WritingMode.horizontal;if(P.allowVerticalPlacement&&!Fr&&this.prevPlacement){const eo=this.prevPlacement.placedOrientations[Ri];eo&&(this.placedOrientations[Ri]=eo,Fs=eo,this.markUsedOrientation(P,Fs,Kt))}return Fs},Xr=(Fr,Fs)=>{if(P.allowVerticalPlacement&&Ai>0&&di.verticalTextBox){for(const eo of P.writingModes)if(eo===i.WritingMode.vertical?(Mn=Fs(),$n=Mn):Mn=Fr(),Mn&&Mn.box&&Mn.box.length)break}else Mn=Fr()};if(H.get("text-variable-anchor")){let Fr=H.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ri]){const ns=this.prevPlacement.variableOffsets[Ri];Fr.indexOf(ns.anchor)>0&&(Fr=Fr.filter(Io=>Io!==ns.anchor),Fr.unshift(ns.anchor))}const Fs=(ns,Io,Bu)=>{const ja=P.getSymbolInstanceTextSize(it,Kt,this.transform.zoom,Ci),_o=(ns.x2-ns.x1)*ja+2*ns.padding,Ea=(ns.y2-ns.y1)*ja+2*ns.padding,vl=Ht&&!Bt?Io:null;vl&&Qr(vl);let Zl={box:[],offscreen:!1,occluded:!1};const $h=ht?2*Fr.length:Fr.length;for(let Zh=0;Zh<$h;++Zh){const Ka=this.attemptAnchorPlacement(Fr[Zh%Fr.length],ns,_o,Ea,ja,Pt,It,Me,W,qe,Zh>=Fr.length,Kt,Ci,P,Bu,vl,it,lt);if(Ka&&(Zl=Ka.placedGlyphBoxes,Zl&&Zl.box&&Zl.box.length)){Mi=!0,Hn=Ka.shift;break}}return Zl};Xr(()=>Fs(go,di.iconBox,i.WritingMode.horizontal),()=>{const ns=di.verticalTextBox;return ns&&Qr(ns),P.allowVerticalPlacement&&!(Mn&&Mn.box&&Mn.box.length)&&Ai>0&&ns?Fs(ns,di.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),Mn&&(Mi=Mn.box,Jt=Mn.offscreen,pi=Mn.occluded);const eo=_r(Mn&&Mn.box);if(!Mi&&this.prevPlacement){const ns=this.prevPlacement.variableOffsets[Ri];ns&&(this.variableOffsets[Ri]=ns,this.markUsedJustification(P,ns.anchor,Kt,eo))}}else{const Fr=(Fs,eo)=>{const ns=P.getSymbolInstanceTextSize(it,Kt,this.transform.zoom,Ci),Io=this.collisionIndex.placeCollisionBox(P,ns,Fs,new i.pointGeometry(0,0),ht,Me,W,qe.predicate);return Io&&Io.box&&Io.box.length&&(this.markUsedOrientation(P,eo,Kt),this.placedOrientations[Ri]=eo),Io};Xr(()=>Fr(go,i.WritingMode.horizontal),()=>{const Fs=di.verticalTextBox;return P.allowVerticalPlacement&&Ai>0&&Fs?(Qr(Fs),Fr(Fs,i.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),_r(Mn&&Mn.box&&Mn.box.length)}}if(lr=Mn,Mi=lr&&lr.box&&lr.box.length>0,Jt=lr&&lr.offscreen,pi=lr&&lr.occluded,Kt.useRuntimeCollisionCircles){const _r=P.text.placedSymbolArray.get(Kt.centerJustifiedTextSymbolIndex>=0?Kt.centerJustifiedTextSymbolIndex:Kt.verticalPlacedTextSymbolIndex),Xr=i.evaluateSizeForFeature(P.textSizeData,it,_r),Fr=H.get("text-padding");On=this.collisionIndex.placeCollisionCircles(P,ht,_r,P.lineVertexArray,P.glyphOffsetArray,Xr,W,ee,pe,b,It,qe.predicate,Kt.collisionCircleDiameter*Xr/i.ONE_EM,Fr,this.retainedQueryData[P.bucketInstanceId].tileID),Mi=ht||On.circles.length>0&&!On.collisionDetected,Jt=Jt&&On.offscreen,pi=On.occluded}if(di.iconFeatureIndex&&(Nr=di.iconFeatureIndex),di.iconBox){const _r=Xr=>{Qr(Xr);const Fr=Ht&&Hn?Rc(Hn.x,Hn.y,Pt,It,this.transform.angle):new i.pointGeometry(0,0),Fs=P.getSymbolInstanceIconSize(lt,this.transform.zoom,Kt.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(P,Fs,Xr,Fr,Bt,Me,W,qe.predicate)};$n&&$n.box&&$n.box.length&&di.verticalIconBox?(_n=_r(di.verticalIconBox),$i=_n.box.length>0):(_n=_r(di.iconBox),$i=_n.box.length>0),Jt=Jt&&_n.offscreen,In=_n.occluded}const Ca=Ye||Kt.numHorizontalGlyphVertices===0&&Ai===0,jo=dt||Kt.numIconVertices===0;if(Ca||jo?jo?Ca||($i=$i&&Mi):Mi=$i&&Mi:$i=Mi=$i&&Mi,Mi&&lr&&lr.box&&this.collisionIndex.insertCollisionBox(lr.box,H.get("text-ignore-placement"),P.bucketInstanceId,$n&&$n.box&&Or?Or:Dr,qe.ID),$i&&_n&&this.collisionIndex.insertCollisionBox(_n.box,H.get("icon-ignore-placement"),P.bucketInstanceId,Nr,qe.ID),On&&(Mi&&this.collisionIndex.insertCollisionCircles(On.circles,H.get("text-ignore-placement"),P.bucketInstanceId,Dr,qe.ID),b)){const _r=P.bucketInstanceId;let Xr=this.collisionCircleArrays[_r];Xr===void 0&&(Xr=this.collisionCircleArrays[_r]=new Ql);for(let Fr=0;Fr<On.circles.length;Fr+=4)Xr.circles.push(On.circles[Fr+0]),Xr.circles.push(On.circles[Fr+1]),Xr.circles.push(On.circles[Fr+2]),Xr.circles.push(On.collisionDetected?1:0)}const vs=P.projection.name!=="globe";si=si&&(vs||!pi),qt=qt&&(vs||!In),this.placements[Ri]=new Nl(Mi||si,$i||qt,Jt||P.justReloaded),m[Ri]=!0};if(hi){const Kt=P.getSortedSymbolIndexes(this.transform.angle);for(let Ci=Kt.length-1;Ci>=0;--Ci){const di=Kt[Ci];ji(P.symbolInstances.get(di),di,P.collisionArrays[di])}}else for(let Kt=a.symbolInstanceStart;Kt<a.symbolInstanceEnd;Kt++)ji(P.symbolInstances.get(Kt),Kt,P.collisionArrays[Kt]);if(b&&P.bucketInstanceId in this.collisionCircleArrays){const Kt=this.collisionCircleArrays[P.bucketInstanceId];i.invert(Kt.invProjMatrix,W),Kt.viewportMatrix=this.collisionIndex.getViewportMatrix()}P.justReloaded=!1}markUsedJustification(a,m,b,S){const{leftJustifiedTextSymbolIndex:P,centerJustifiedTextSymbolIndex:H,rightJustifiedTextSymbolIndex:W,verticalPlacedTextSymbolIndex:ee,crossTileID:pe}=b,fe=i.getAnchorJustification(m),Me=S===i.WritingMode.vertical?ee:fe==="left"?P:fe==="center"?H:fe==="right"?W:-1;P>=0&&(a.text.placedSymbolArray.get(P).crossTileID=Me>=0&&P!==Me?0:pe),H>=0&&(a.text.placedSymbolArray.get(H).crossTileID=Me>=0&&H!==Me?0:pe),W>=0&&(a.text.placedSymbolArray.get(W).crossTileID=Me>=0&&W!==Me?0:pe),ee>=0&&(a.text.placedSymbolArray.get(ee).crossTileID=Me>=0&&ee!==Me?0:pe)}markUsedOrientation(a,m,b){const S=m===i.WritingMode.horizontal||m===i.WritingMode.horizontalOnly?m:0,P=m===i.WritingMode.vertical?m:0,{leftJustifiedTextSymbolIndex:H,centerJustifiedTextSymbolIndex:W,rightJustifiedTextSymbolIndex:ee,verticalPlacedTextSymbolIndex:pe}=b,fe=a.text.placedSymbolArray;H>=0&&(fe.get(H).placedOrientation=S),W>=0&&(fe.get(W).placedOrientation=S),ee>=0&&(fe.get(ee).placedOrientation=S),pe>=0&&(fe.get(pe).placedOrientation=P)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let b=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const S=m?m.symbolFadeChange(a):1,P=m?m.opacities:{},H=m?m.variableOffsets:{},W=m?m.placedOrientations:{};for(const ee in this.placements){const pe=this.placements[ee],fe=P[ee];fe?(this.opacities[ee]=new Na(fe,S,pe.text,pe.icon,null,pe.clipped),b=b||pe.text!==fe.text.placed||pe.icon!==fe.icon.placed):(this.opacities[ee]=new Na(null,S,pe.text,pe.icon,pe.skipFade,pe.clipped),b=b||pe.text||pe.icon)}for(const ee in P){const pe=P[ee];if(!this.opacities[ee]){const fe=new Na(pe,S,!1,!1);fe.isHidden()||(this.opacities[ee]=fe,b=b||pe.text.placed||pe.icon.placed)}}for(const ee in H)this.variableOffsets[ee]||!this.opacities[ee]||this.opacities[ee].isHidden()||(this.variableOffsets[ee]=H[ee]);for(const ee in W)this.placedOrientations[ee]||!this.opacities[ee]||this.opacities[ee].isHidden()||(this.placedOrientations[ee]=W[ee]);b?this.lastPlacementChangeTime=a:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:a)}updateLayerOpacities(a,m){const b={};for(const S of m){const P=S.getBucket(a);P&&S.latestFeatureIndex&&a.id===P.layerIds[0]&&this.updateBucketOpacities(P,b,S.collisionBoxArray)}}updateBucketOpacities(a,m,b){a.hasTextData()&&a.text.opacityVertexArray.clear(),a.hasIconData()&&a.icon.opacityVertexArray.clear(),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexArray.clear(),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexArray.clear();const S=a.layers[0].layout,P=!!a.layers[0].dynamicFilter(),H=new Na(null,0,!1,!1,!0),W=S.get("text-allow-overlap"),ee=S.get("icon-allow-overlap"),pe=S.get("text-variable-anchor"),fe=S.get("text-rotation-alignment")==="map",Me=S.get("text-pitch-alignment")==="map",Ne=S.get("icon-text-fit")!=="none",st=new Na(null,0,W&&(ee||!a.hasIconData()||S.get("icon-optional")),ee&&(W||!a.hasTextData()||S.get("text-optional")),!0);!a.collisionArrays&&b&&(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData())&&a.deserializeCollisionBoxes(b);const it=(qe,Ye,dt)=>{for(let ht=0;ht<Ye/4;ht++)qe.opacityVertexArray.emplaceBack(dt)};let lt=0;for(let qe=0;qe<a.symbolInstances.length;qe++){const Ye=a.symbolInstances.get(qe),{numHorizontalGlyphVertices:dt,numVerticalGlyphVertices:ht,crossTileID:Bt,numIconVertices:Pt}=Ye;let It=this.opacities[Bt];m[Bt]?It=H:It||(It=st,this.opacities[Bt]=It),m[Bt]=!0;const Ht=dt>0||ht>0,hi=Pt>0,si=this.placedOrientations[Bt],qt=si===i.WritingMode.vertical,ji=si===i.WritingMode.horizontal||si===i.WritingMode.horizontalOnly;if(!Ht&&!hi||It.isHidden()||lt++,Ht){const Kt=er(It.text);it(a.text,dt,qt?ac:Kt),it(a.text,ht,ji?ac:Kt);const Ci=It.text.isHidden(),{leftJustifiedTextSymbolIndex:di,centerJustifiedTextSymbolIndex:Ri,rightJustifiedTextSymbolIndex:Ai,verticalPlacedTextSymbolIndex:Mi}=Ye,$i=a.text.placedSymbolArray,Jt=Ci||qt?1:0;di>=0&&($i.get(di).hidden=Jt),Ri>=0&&($i.get(Ri).hidden=Jt),Ai>=0&&($i.get(Ai).hidden=Jt),Mi>=0&&($i.get(Mi).hidden=Ci||ji?1:0);const pi=this.variableOffsets[Bt];pi&&this.markUsedJustification(a,pi.anchor,Ye,si);const In=this.placedOrientations[Bt];In&&(this.markUsedJustification(a,"left",Ye,In),this.markUsedOrientation(a,In,Ye))}if(hi){const Kt=er(It.icon),{placedIconSymbolIndex:Ci,verticalPlacedIconSymbolIndex:di}=Ye,Ri=a.icon.placedSymbolArray,Ai=It.icon.isHidden()?1:0;Ci>=0&&(it(a.icon,Pt,qt?ac:Kt),Ri.get(Ci).hidden=Ai),di>=0&&(it(a.icon,Ye.numVerticalIconVertices,ji?ac:Kt),Ri.get(di).hidden=Ai)}if(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData()){const Kt=a.collisionArrays[qe];if(Kt){let Ci=new i.pointGeometry(0,0),di=!0;if(Kt.textBox||Kt.verticalTextBox){if(pe){const Ai=this.variableOffsets[Bt];Ai?(Ci=ps(Ai.anchor,Ai.width,Ai.height,Ai.textOffset,Ai.textScale),fe&&Ci._rotate(Me?this.transform.angle:-this.transform.angle)):di=!1}P&&(di=!It.clipped),Kt.textBox&&ks(a.textCollisionBox.collisionVertexArray,It.text.placed,!di||qt,Ci.x,Ci.y),Kt.verticalTextBox&&ks(a.textCollisionBox.collisionVertexArray,It.text.placed,!di||ji,Ci.x,Ci.y)}const Ri=di&&Boolean(!ji&&Kt.verticalIconBox);Kt.iconBox&&ks(a.iconCollisionBox.collisionVertexArray,It.icon.placed,Ri,Ne?Ci.x:0,Ne?Ci.y:0),Kt.verticalIconBox&&ks(a.iconCollisionBox.collisionVertexArray,It.icon.placed,!Ri,Ne?Ci.x:0,Ne?Ci.y:0)}}}if(a.fullyClipped=lt===0,a.sortFeatures(this.transform.angle),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder),a.hasTextData()&&a.text.opacityVertexBuffer&&a.text.opacityVertexBuffer.updateData(a.text.opacityVertexArray),a.hasIconData()&&a.icon.opacityVertexBuffer&&a.icon.opacityVertexBuffer.updateData(a.icon.opacityVertexArray),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexBuffer&&a.iconCollisionBox.collisionVertexBuffer.updateData(a.iconCollisionBox.collisionVertexArray),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexBuffer&&a.textCollisionBox.collisionVertexBuffer.updateData(a.textCollisionBox.collisionVertexArray),a.bucketInstanceId in this.collisionCircleArrays){const qe=this.collisionCircleArrays[a.bucketInstanceId];a.placementInvProjMatrix=qe.invProjMatrix,a.placementViewportMatrix=qe.viewportMatrix,a.collisionCircleArray=qe.circles,delete this.collisionCircleArrays[a.bucketInstanceId]}}symbolFadeChange(a){return this.fadeDuration===0?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(a,m){const b=this.zoomAtLastRecencyCheck===m?1-this.zoomAdjustment(m):1;return this.zoomAtLastRecencyCheck=m,this.commitTime+this.fadeDuration*b>a}setStale(){this.stale=!0}}function ks(x,a,m,b,S){x.emplaceBack(a?1:0,m?1:0,b||0,S||0),x.emplaceBack(a?1:0,m?1:0,b||0,S||0),x.emplaceBack(a?1:0,m?1:0,b||0,S||0),x.emplaceBack(a?1:0,m?1:0,b||0,S||0)}const No=Math.pow(2,25),JA=Math.pow(2,24),fu=Math.pow(2,17),Bs=Math.pow(2,16),sc=Math.pow(2,9),Th=Math.pow(2,8),oc=Math.pow(2,1);function er(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;const a=x.placed?1:0,m=Math.floor(127*x.opacity);return m*No+a*JA+m*fu+a*Bs+m*sc+a*Th+m*oc+a}const ac=0;class Ju{constructor(a){this._sortAcrossTiles=a.layout.get("symbol-z-order")!=="viewport-y"&&a.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(a,m,b,S,P){const H=this._bucketParts;for(;this._currentTileIndex<a.length;)if(m.getBucketParts(H,S,a[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,P())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,H.sort((W,ee)=>W.sortKey-ee.sortKey));this._currentPartIndex<H.length;){const W=H[this._currentPartIndex];if(m.placeLayerBucketPart(W,this._seenCrossTileIDs,b,W.symbolInstanceStart===0),this._currentPartIndex++,P())return!0}return!1}}class Qo{constructor(a,m,b,S,P,H,W,ee){this.placement=new Eh(a,P,H,W,ee),this._currentPlacementIndex=m.length-1,this._forceFullPlacement=b,this._showCollisionBoxes=S,this._done=!1}isDone(){return this._done}continuePlacement(a,m,b){const S=i.exported.now(),P=()=>{const H=i.exported.now()-S;return!this._forceFullPlacement&&H>2};for(;this._currentPlacementIndex>=0;){const H=m[a[this._currentPlacementIndex]],W=this.placement.collisionIndex.transform.zoom;if(H.type==="symbol"&&(!H.minzoom||H.minzoom<=W)&&(!H.maxzoom||H.maxzoom>W)){if(this._inProgressLayer||(this._inProgressLayer=new Ju(H)),this._inProgressLayer.continuePlacement(b[H.source],this.placement,this._showCollisionBoxes,H,P))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const hl=512/i.EXTENT/2;class Sh{constructor(a,m,b){this.tileID=a,this.indexedSymbolInstances={},this.bucketInstanceId=b;for(let S=0;S<m.length;S++){const P=m.get(S),H=P.key;this.indexedSymbolInstances[H]||(this.indexedSymbolInstances[H]=[]),this.indexedSymbolInstances[H].push({crossTileID:P.crossTileID,coord:this.getScaledCoordinates(P,a)})}}getScaledCoordinates(a,m){const b=hl/Math.pow(2,m.canonical.z-this.tileID.canonical.z);return{x:Math.floor((m.canonical.x*i.EXTENT+a.tileAnchorX)*b),y:Math.floor((m.canonical.y*i.EXTENT+a.tileAnchorY)*b)}}findMatches(a,m,b){const S=this.tileID.canonical.z<m.canonical.z?1:Math.pow(2,this.tileID.canonical.z-m.canonical.z);for(let P=0;P<a.length;P++){const H=a.get(P);if(H.crossTileID)continue;const W=this.indexedSymbolInstances[H.key];if(!W)continue;const ee=this.getScaledCoordinates(H,m);for(const pe of W)if(Math.abs(pe.coord.x-ee.x)<=S&&Math.abs(pe.coord.y-ee.y)<=S&&!b[pe.crossTileID]){b[pe.crossTileID]=!0,H.crossTileID=pe.crossTileID;break}}}}class Vo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Mh{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(a){const m=Math.round((a-this.lng)/360);if(m!==0)for(const b in this.indexes){const S=this.indexes[b],P={};for(const H in S){const W=S[H];W.tileID=W.tileID.unwrapTo(W.tileID.wrap+m),P[W.tileID.key]=W}this.indexes[b]=P}this.lng=a}addBucket(a,m,b){if(this.indexes[a.overscaledZ]&&this.indexes[a.overscaledZ][a.key]){if(this.indexes[a.overscaledZ][a.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(a.overscaledZ,this.indexes[a.overscaledZ][a.key])}for(let P=0;P<m.symbolInstances.length;P++)m.symbolInstances.get(P).crossTileID=0;this.usedCrossTileIDs[a.overscaledZ]||(this.usedCrossTileIDs[a.overscaledZ]={});const S=this.usedCrossTileIDs[a.overscaledZ];for(const P in this.indexes){const H=this.indexes[P];if(Number(P)>a.overscaledZ)for(const W in H){const ee=H[W];ee.tileID.isChildOf(a)&&ee.findMatches(m.symbolInstances,a,S)}else{const W=H[a.scaledTo(Number(P)).key];W&&W.findMatches(m.symbolInstances,a,S)}}for(let P=0;P<m.symbolInstances.length;P++){const H=m.symbolInstances.get(P);H.crossTileID||(H.crossTileID=b.generate(),S[H.crossTileID]=!0)}return this.indexes[a.overscaledZ]===void 0&&(this.indexes[a.overscaledZ]={}),this.indexes[a.overscaledZ][a.key]=new Sh(a,m.symbolInstances,m.bucketInstanceId),!0}removeBucketCrossTileIDs(a,m){for(const b in m.indexedSymbolInstances)for(const S of m.indexedSymbolInstances[b])delete this.usedCrossTileIDs[a][S.crossTileID]}removeStaleBuckets(a){let m=!1;for(const b in this.indexes){const S=this.indexes[b];for(const P in S)a[S[P].bucketInstanceId]||(this.removeBucketCrossTileIDs(b,S[P]),delete S[P],m=!0)}return m}}class Qa{constructor(){this.layerIndexes={},this.crossTileIDs=new Vo,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(a,m,b,S){let P=this.layerIndexes[a.id];P===void 0&&(P=this.layerIndexes[a.id]=new Mh);let H=!1;const W={};S.name!=="globe"&&P.handleWrapJump(b);for(const ee of m){const pe=ee.getBucket(a);pe&&a.id===pe.layerIds[0]&&(pe.bucketInstanceId||(pe.bucketInstanceId=++this.maxBucketInstanceId),P.addBucket(ee.tileID,pe,this.crossTileIDs)&&(H=!0),W[pe.bucketInstanceId]=!0)}return P.removeStaleBuckets(W)&&(H=!0),H}pruneUnusedLayers(a){const m={};a.forEach(b=>{m[b]=!0});for(const b in this.layerIndexes)m[b]||delete this.layerIndexes[b]}}const lc=(x,a)=>i.emitValidationErrors(x,a&&a.filter(m=>m.identifier!=="source.canvas")),mu=i.pick(bi,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Vl=i.pick(bi,["setCenter","setZoom","setBearing","setPitch"]),ya={version:8,layers:[],sources:{}},zc={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Ws extends i.Evented{constructor(a,m={}){super(),this.map=a,this.dispatcher=new Ke(jt(),this),this.imageManager=new li,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(a._requestManager,m.localFontFamily?i.LocalGlyphMode.all:m.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,m.localFontFamily||m.localIdeographFontFamily),this.crossTileSymbolIndex=new Qa,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const b=this;this._rtlTextPluginCallback=Ws.registerForPluginStateChange(S=>{b.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:S.pluginStatus,pluginURL:S.pluginURL},(P,H)=>{if(i.triggerPluginCompletionEvent(P),H&&H.every(W=>W))for(const W in b._sourceCaches){const ee=b._sourceCaches[W],pe=ee.getSource().type;pe!=="vector"&&pe!=="geojson"||ee.reload()}})}),this.on("data",S=>{if(S.dataType!=="source"||S.sourceDataType!=="metadata")return;const P=this.getSource(S.sourceId);if(P&&P.vectorLayerIds)for(const H in this._layers){const W=this._layers[H];W.source===P.id&&this._validateLayer(W)}})}loadURL(a,m={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const b=typeof m.validate=="boolean"?m.validate:!i.isMapboxURL(a);a=this.map._requestManager.normalizeStyleURL(a,m.accessToken);const S=this.map._requestManager.transformRequest(a,i.ResourceType.Style);this._request=i.getJSON(S,(P,H)=>{this._request=null,P?this.fire(new i.ErrorEvent(P)):H&&this._load(H,b)})}loadJSON(a,m={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(a,m.validate!==!1)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(ya,!1)}_updateLayerCount(a,m){const b=m?1:-1;a.is3D()&&(this._num3DLayers+=b),a.type==="circle"&&(this._numCircleLayers+=b),a.type==="symbol"&&(this._numSymbolLayers+=b)}_load(a,m){if(m&&lc(this,i.validateStyle(a)))return;this._loaded=!0,this.stylesheet=i.clone$1(a),this._updateMapProjection();for(const S in a.sources)this.addSource(S,a.sources[S],{validate:!1});this._changed=!1,a.sprite?this._loadSprite(a.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(a.glyphs);const b=ki(this.stylesheet.layers);this._order=b.map(S=>S.id),this._layers={},this._serializedLayers={};for(let S of b)S=i.createStyleLayer(S),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S,this._serializedLayers[S.id]=S.serialize(),this._updateLayerCount(S,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new le(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}setProjection(a){a?this.stylesheet.projection=a:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(a){this._spriteRequest=function(m,b,S){let P,H,W;const ee=i.exported.devicePixelRatio>1?"@2x":"";let pe=i.getJSON(b.transformRequest(b.normalizeSpriteURL(m,ee,".json"),i.ResourceType.SpriteJSON),(Ne,st)=>{pe=null,W||(W=Ne,P=st,Me())}),fe=i.getImage(b.transformRequest(b.normalizeSpriteURL(m,ee,".png"),i.ResourceType.SpriteImage),(Ne,st)=>{fe=null,W||(W=Ne,H=st,Me())});function Me(){if(W)S(W);else if(P&&H){const Ne=i.exported.getImageData(H),st={};for(const it in P){const{width:lt,height:qe,x:Ye,y:dt,sdf:ht,pixelRatio:Bt,stretchX:Pt,stretchY:It,content:Ht}=P[it],hi=new i.RGBAImage({width:lt,height:qe});i.RGBAImage.copy(Ne,hi,{x:Ye,y:dt},{x:0,y:0},{width:lt,height:qe}),st[it]={data:hi,pixelRatio:Bt,sdf:ht,stretchX:Pt,stretchY:It,content:Ht}}S(null,st)}}return{cancel(){pe&&(pe.cancel(),pe=null),fe&&(fe.cancel(),fe=null)}}}(a,this.map._requestManager,(m,b)=>{if(this._spriteRequest=null,m)this.fire(new i.ErrorEvent(m));else if(b)for(const S in b)this.imageManager.addImage(S,b[S]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(a){const m=this.getSource(a.source);if(!m)return;const b=a.sourceLayer;b&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(b)===-1)&&this.fire(new i.ErrorEvent(new Error(`Source layer "${b}" does not exist on source "${m.id}" as specified by style layer "${a.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(a){const m=[];for(const b of a){const S=this._layers[b];S.type!=="custom"&&m.push(S.serialize())}return m}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const a in this._layers)if(this._layers[a].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(a){return!!this.terrain&&zc[a.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(a){if(!this._loaded)return;const m=this._changed;if(this._changed){const S=Object.keys(this._updatedLayers),P=Object.keys(this._removedLayers);(S.length||P.length)&&this._updateWorkerLayers(S,P);for(const H in this._updatedSources){const W=this._updatedSources[H];W==="reload"?this._reloadSource(H):W==="clear"&&this._clearSource(H)}this._updateTilesForChangedImages();for(const H in this._updatedPaintProps)this._layers[H].updateTransitions(a);this.light.updateTransitions(a),this.fog&&this.fog.updateTransitions(a),this._resetUpdates()}const b={};for(const S in this._sourceCaches){const P=this._sourceCaches[S];b[S]=P.used,P.used=!1}for(const S of this._order){const P=this._layers[S];if(P.recalculate(a,this._availableImages),!P.isHidden(a.zoom)){const W=this._getLayerSourceCache(P);W&&(W.used=!0)}const H=this.map.painter;if(H){const W=P.getProgramIds();if(!W)continue;const ee=P.getProgramConfiguration(a.zoom);for(const pe of W)H.useProgram(pe,ee)}}for(const S in b){const P=this._sourceCaches[S];b[S]!==P.used&&P.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:P.getSource().id}))}this.light.recalculate(a),this.terrain&&this.terrain.recalculate(a),this.fog&&this.fog.recalculate(a),this.z=a.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),m&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const m in this._sourceCaches)this._sourceCaches[m].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateWorkerLayers(a,m){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(a),removedIds:m})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(a){if(this._checkLoaded(),lc(this,i.validateStyle(a)))return!1;(a=i.clone$1(a)).layers=ki(a.layers);const m=function(S,P){if(!S)return[{command:bi.setStyle,args:[P]}];let H=[];try{if(!C(S.version,P.version))return[{command:bi.setStyle,args:[P]}];C(S.center,P.center)||H.push({command:bi.setCenter,args:[P.center]}),C(S.zoom,P.zoom)||H.push({command:bi.setZoom,args:[P.zoom]}),C(S.bearing,P.bearing)||H.push({command:bi.setBearing,args:[P.bearing]}),C(S.pitch,P.pitch)||H.push({command:bi.setPitch,args:[P.pitch]}),C(S.sprite,P.sprite)||H.push({command:bi.setSprite,args:[P.sprite]}),C(S.glyphs,P.glyphs)||H.push({command:bi.setGlyphs,args:[P.glyphs]}),C(S.transition,P.transition)||H.push({command:bi.setTransition,args:[P.transition]}),C(S.light,P.light)||H.push({command:bi.setLight,args:[P.light]}),C(S.fog,P.fog)||H.push({command:bi.setFog,args:[P.fog]}),C(S.projection,P.projection)||H.push({command:bi.setProjection,args:[P.projection]});const W={},ee=[];(function(Me,Ne,st,it){let lt;for(lt in Ne=Ne||{},Me=Me||{})Me.hasOwnProperty(lt)&&(Ne.hasOwnProperty(lt)||Yi(lt,st,it));for(lt in Ne)Ne.hasOwnProperty(lt)&&(Me.hasOwnProperty(lt)?C(Me[lt],Ne[lt])||(Me[lt].type==="geojson"&&Ne[lt].type==="geojson"&&rr(Me,Ne,lt)?st.push({command:bi.setGeoJSONSourceData,args:[lt,Ne[lt].data]}):tn(lt,Ne,st,it)):Oi(lt,Ne,st))})(S.sources,P.sources,ee,W);const pe=[];S.layers&&S.layers.forEach(Me=>{Me.source&&W[Me.source]?H.push({command:bi.removeLayer,args:[Me.id]}):pe.push(Me)});let fe=S.terrain;fe&&W[fe.source]&&(H.push({command:bi.setTerrain,args:[void 0]}),fe=void 0),H=H.concat(ee),C(fe,P.terrain)||H.push({command:bi.setTerrain,args:[P.terrain]}),function(Me,Ne,st){Ne=Ne||[];const it=(Me=Me||[]).map(Yt),lt=Ne.map(Yt),qe=Me.reduce(sr,{}),Ye=Ne.reduce(sr,{}),dt=it.slice(),ht=Object.create(null);let Bt,Pt,It,Ht,hi,si,qt;for(Bt=0,Pt=0;Bt<it.length;Bt++)It=it[Bt],Ye.hasOwnProperty(It)?Pt++:(st.push({command:bi.removeLayer,args:[It]}),dt.splice(dt.indexOf(It,Pt),1));for(Bt=0,Pt=0;Bt<lt.length;Bt++)It=lt[lt.length-1-Bt],dt[dt.length-1-Bt]!==It&&(qe.hasOwnProperty(It)?(st.push({command:bi.removeLayer,args:[It]}),dt.splice(dt.lastIndexOf(It,dt.length-Pt),1)):Pt++,si=dt[dt.length-Bt],st.push({command:bi.addLayer,args:[Ye[It],si]}),dt.splice(dt.length-Bt,0,It),ht[It]=!0);for(Bt=0;Bt<lt.length;Bt++)if(It=lt[Bt],Ht=qe[It],hi=Ye[It],!ht[It]&&!C(Ht,hi))if(C(Ht.source,hi.source)&&C(Ht["source-layer"],hi["source-layer"])&&C(Ht.type,hi.type)){for(qt in yn(Ht.layout,hi.layout,st,It,null,bi.setLayoutProperty),yn(Ht.paint,hi.paint,st,It,null,bi.setPaintProperty),C(Ht.filter,hi.filter)||st.push({command:bi.setFilter,args:[It,hi.filter]}),C(Ht.minzoom,hi.minzoom)&&C(Ht.maxzoom,hi.maxzoom)||st.push({command:bi.setLayerZoomRange,args:[It,hi.minzoom,hi.maxzoom]}),Ht)Ht.hasOwnProperty(qt)&&qt!=="layout"&&qt!=="paint"&&qt!=="filter"&&qt!=="metadata"&&qt!=="minzoom"&&qt!=="maxzoom"&&(qt.indexOf("paint.")===0?yn(Ht[qt],hi[qt],st,It,qt.slice(6),bi.setPaintProperty):C(Ht[qt],hi[qt])||st.push({command:bi.setLayerProperty,args:[It,qt,hi[qt]]}));for(qt in hi)hi.hasOwnProperty(qt)&&!Ht.hasOwnProperty(qt)&&qt!=="layout"&&qt!=="paint"&&qt!=="filter"&&qt!=="metadata"&&qt!=="minzoom"&&qt!=="maxzoom"&&(qt.indexOf("paint.")===0?yn(Ht[qt],hi[qt],st,It,qt.slice(6),bi.setPaintProperty):C(Ht[qt],hi[qt])||st.push({command:bi.setLayerProperty,args:[It,qt,hi[qt]]}))}else st.push({command:bi.removeLayer,args:[It]}),si=dt[dt.lastIndexOf(It)+1],st.push({command:bi.addLayer,args:[hi,si]})}(pe,P.layers,H)}catch(W){console.warn("Unable to compute style diff:",W),H=[{command:bi.setStyle,args:[P]}]}return H}(this.serialize(),a).filter(S=>!(S.command in Vl));if(m.length===0)return!1;const b=m.filter(S=>!(S.command in mu));if(b.length>0)throw new Error(`Unimplemented: ${b.map(S=>S.command).join(", ")}.`);return m.forEach(S=>{S.command!=="setTransition"&&S.command!=="setProjection"&&this[S.command].apply(this,S.args)}),this.stylesheet=a,this._updateMapProjection(),!0}addImage(a,m){return this.getImage(a)?this.fire(new i.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(a,m),this._afterImageUpdated(a),this)}updateImage(a,m){this.imageManager.updateImage(a,m)}getImage(a){return this.imageManager.getImage(a)}removeImage(a){return this.getImage(a)?(this.imageManager.removeImage(a),this._afterImageUpdated(a),this):this.fire(new i.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(a){this._availableImages=this.imageManager.listImages(),this._changedImages[a]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(a,m,b={}){if(this._checkLoaded(),this.getSource(a)!==void 0)throw new Error("There is already a source with this ID");if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(i.validateSource,`sources.${a}`,m,null,b))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const S=ie(a,m,this.dispatcher,this);S.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(a),source:S.serialize(),sourceId:a}));const P=H=>{const W=(H?"symbol:":"other:")+a,ee=this._sourceCaches[W]=new i.SourceCache(W,S,H);(H?this._symbolSourceCaches:this._otherSourceCaches)[a]=ee,ee.style=this,ee.onAdd(this.map)};P(!1),m.type!=="vector"&&m.type!=="geojson"||P(!0),S.onAdd&&S.onAdd(this.map),this._changed=!0}removeSource(a){this._checkLoaded();const m=this.getSource(a);if(!m)throw new Error("There is no source with this ID");for(const S in this._layers)if(this._layers[S].source===a)return this.fire(new i.ErrorEvent(new Error(`Source "${a}" cannot be removed while layer "${S}" is using it.`)));if(this.terrain&&this.terrain.get().source===a)return this.fire(new i.ErrorEvent(new Error(`Source "${a}" cannot be removed while terrain is using it.`)));const b=this._getSourceCaches(a);for(const S of b)delete this._sourceCaches[S.id],delete this._updatedSources[S.id],S.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:S.getSource().id})),S.setEventedParent(null),S.clearTiles();return delete this._otherSourceCaches[a],delete this._symbolSourceCaches[a],m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(a,m){this._checkLoaded(),this.getSource(a).setData(m),this._changed=!0}getSource(a){const m=this._getSourceCache(a);return m&&m.getSource()}_getSources(){const a=[];for(const m in this._otherSourceCaches){const b=this._getSourceCache(m);b&&a.push(b.getSource())}return a}addLayer(a,m,b={}){this._checkLoaded();const S=a.id;if(this.getLayer(S))return void this.fire(new i.ErrorEvent(new Error(`Layer with id "${S}" already exists on this map`)));let P;if(a.type==="custom"){if(lc(this,i.validateCustomStyleLayer(a)))return;P=i.createStyleLayer(a)}else{if(typeof a.source=="object"&&(this.addSource(S,a.source),a=i.clone$1(a),a=i.extend(a,{source:S})),this._validate(i.validateLayer,`layers.${S}`,a,{arrayIndex:-1},b))return;P=i.createStyleLayer(a),this._validateLayer(P),P.setEventedParent(this,{layer:{id:S}}),this._serializedLayers[P.id]=P.serialize(),this._updateLayerCount(P,!0)}const H=m?this._order.indexOf(m):this._order.length;if(m&&H===-1)return void this.fire(new i.ErrorEvent(new Error(`Layer with id "${m}" does not exist on this map.`)));this._order.splice(H,0,S),this._layerOrderChanged=!0,this._layers[S]=P;const W=this._getLayerSourceCache(P);if(this._removedLayers[S]&&P.source&&W&&P.type!=="custom"){const ee=this._removedLayers[S];delete this._removedLayers[S],ee.type!==P.type?this._updatedSources[P.source]="clear":(this._updatedSources[P.source]="reload",W.pause())}this._updateLayer(P),P.onAdd&&P.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(a,m){if(this._checkLoaded(),this._changed=!0,!this._layers[a])return void this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be moved.`)));if(a===m)return;const b=this._order.indexOf(a);this._order.splice(b,1);const S=m?this._order.indexOf(m):this._order.length;m&&S===-1?this.fire(new i.ErrorEvent(new Error(`Layer with id "${m}" does not exist on this map.`))):(this._order.splice(S,0,a),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(a){this._checkLoaded();const m=this._layers[a];if(!m)return void this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be removed.`)));m.setEventedParent(null),this._updateLayerCount(m,!1);const b=this._order.indexOf(a);this._order.splice(b,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[a]=m,delete this._layers[a],delete this._serializedLayers[a],delete this._updatedLayers[a],delete this._updatedPaintProps[a],m.onRemove&&m.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(a){return this._layers[a]}hasLayer(a){return a in this._layers}hasLayerType(a){for(const m in this._layers)if(this._layers[m].type===a)return!0;return!1}setLayerZoomRange(a,m,b){this._checkLoaded();const S=this.getLayer(a);S?S.minzoom===m&&S.maxzoom===b||(m!=null&&(S.minzoom=m),b!=null&&(S.maxzoom=b),this._updateLayer(S)):this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(a,m,b={}){this._checkLoaded();const S=this.getLayer(a);if(S){if(!C(S.filter,m))return m==null?(S.filter=void 0,void this._updateLayer(S)):void(this._validate(i.validateFilter,`layers.${S.id}.filter`,m,{layerType:S.type},b)||(S.filter=i.clone$1(m),this._updateLayer(S)))}else this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be filtered.`)))}getFilter(a){const m=this.getLayer(a);return m&&i.clone$1(m.filter)}setLayoutProperty(a,m,b,S={}){this._checkLoaded();const P=this.getLayer(a);P?C(P.getLayoutProperty(m),b)||(P.setLayoutProperty(m,b,S),this._updateLayer(P)):this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(a,m){const b=this.getLayer(a);if(b)return b.getLayoutProperty(m);this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style.`)))}setPaintProperty(a,m,b,S={}){this._checkLoaded();const P=this.getLayer(a);P?C(P.getPaintProperty(m),b)||(P.setPaintProperty(m,b,S)&&this._updateLayer(P),this._changed=!0,this._updatedPaintProps[a]=!0):this.fire(new i.ErrorEvent(new Error(`The layer '${a}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(a,m){const b=this.getLayer(a);return b&&b.getPaintProperty(m)}setFeatureState(a,m){this._checkLoaded();const b=a.source,S=a.sourceLayer,P=this.getSource(b);if(!P)return void this.fire(new i.ErrorEvent(new Error(`The source '${b}' does not exist in the map's style.`)));const H=P.type;if(H==="geojson"&&S)return void this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(H==="vector"&&!S)return void this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));a.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided.")));const W=this._getSourceCaches(b);for(const ee of W)ee.setFeatureState(S,a.id,m)}removeFeatureState(a,m){this._checkLoaded();const b=a.source,S=this.getSource(b);if(!S)return void this.fire(new i.ErrorEvent(new Error(`The source '${b}' does not exist in the map's style.`)));const P=S.type,H=P==="vector"?a.sourceLayer:void 0;if(P==="vector"&&!H)return void this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof a.id!="string"&&typeof a.id!="number")return void this.fire(new i.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const W=this._getSourceCaches(b);for(const ee of W)ee.removeFeatureState(H,a.id,m)}getFeatureState(a){this._checkLoaded();const m=a.source,b=a.sourceLayer,S=this.getSource(m);if(S){if(S.type!=="vector"||b)return a.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(m)[0].getFeatureState(b,a.id);this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error(`The source '${m}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const a={};for(const m in this._sourceCaches){const b=this._sourceCaches[m].getSource();a[b.id]||(a[b.id]=b.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:a,layers:this._serializeLayers(this._order)},m=>m!==void 0)}_updateLayer(a){this._updatedLayers[a.id]=!0;const m=this._getLayerSourceCache(a);a.source&&!this._updatedSources[a.source]&&m&&m.getSource().type!=="raster"&&(this._updatedSources[a.source]="reload",m.pause()),this._changed=!0,a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(a){const m=H=>this._layers[H].type==="fill-extrusion",b={},S=[];for(let H=this._order.length-1;H>=0;H--){const W=this._order[H];if(m(W)){b[W]=H;for(const ee of a){const pe=ee[W];if(pe)for(const fe of pe)S.push(fe)}}}S.sort((H,W)=>W.intersectionZ-H.intersectionZ);const P=[];for(let H=this._order.length-1;H>=0;H--){const W=this._order[H];if(m(W))for(let ee=S.length-1;ee>=0;ee--){const pe=S[ee].feature;if(b[pe.layer.id]<H)break;P.push(pe),S.pop()}else for(const ee of a){const pe=ee[W];if(pe)for(const fe of pe)P.push(fe.feature)}}return P}queryRenderedFeatures(a,m,b){m&&m.filter&&this._validate(i.validateFilter,"queryRenderedFeatures.filter",m.filter,null,m);const S={};if(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const ee of m.layers){const pe=this._layers[ee];if(!pe)return this.fire(new i.ErrorEvent(new Error(`The layer '${ee}' does not exist in the map's style and cannot be queried for features.`))),[];S[pe.source]=!0}}const P=[];m.availableImages=this._availableImages;const H=m&&m.layers?m.layers.some(ee=>{const pe=this.getLayer(ee);return pe&&pe.is3D()}):this.has3DLayers(),W=vt.createFromScreenPoints(a,b);for(const ee in this._sourceCaches){const pe=this._sourceCaches[ee].getSource().id;m.layers&&!S[pe]||P.push(de(this._sourceCaches[ee],this._layers,this._serializedLayers,W,m,b,H,!!this.map._showQueryGeometry))}return this.placement&&P.push(function(ee,pe,fe,Me,Ne,st,it){const lt={},qe=st.queryRenderedSymbols(Me),Ye=[];for(const dt of Object.keys(qe).map(Number))Ye.push(it[dt]);Ye.sort(tt);for(const dt of Ye){const ht=dt.featureIndex.lookupSymbolFeatures(qe[dt.bucketInstanceId],pe,dt.bucketIndex,dt.sourceLayerIndex,Ne.filter,Ne.layers,Ne.availableImages,ee);for(const Bt in ht){const Pt=lt[Bt]=lt[Bt]||[],It=ht[Bt];It.sort((Ht,hi)=>{const si=dt.featureSortOrder;if(si){const qt=si.indexOf(Ht.featureIndex);return si.indexOf(hi.featureIndex)-qt}return hi.featureIndex-Ht.featureIndex});for(const Ht of It)Pt.push(Ht)}}for(const dt in lt)lt[dt].forEach(ht=>{const Bt=ht.feature,Pt=fe(ee[dt]).getFeatureState(Bt.layer["source-layer"],Bt.id);Bt.source=Bt.layer.source,Bt.layer["source-layer"]&&(Bt.sourceLayer=Bt.layer["source-layer"]),Bt.state=Pt});return lt}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),W.screenGeometry,m,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(P)}querySourceFeatures(a,m){m&&m.filter&&this._validate(i.validateFilter,"querySourceFeatures.filter",m.filter,null,m);const b=this._getSourceCaches(a);let S=[];for(const P of b)S=S.concat(Ue(P,m));return S}addSourceType(a,m,b){return Ws.getSourceType(a)?b(new Error(`A source type called "${a}" already exists.`)):(Ws.setSourceType(a,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:m.workerSourceURL},b):b(null,null))}getLight(){return this.light.getLight()}setLight(a,m={}){this._checkLoaded();const b=this.light.getLight();let S=!1;for(const H in a)if(!C(a[H],b[H])){S=!0;break}if(!S)return;const P=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(a,m),this.light.updateTransitions(P)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(a,m=1){if(this._checkLoaded(),!a)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(m===1){if(typeof a.source=="object"){const b="terrain-dem-src";this.addSource(b,a.source),a=i.clone$1(a),a=i.extend(a,{source:b})}if(this._validate(i.validateTerrain,"terrain",a))return}if(!this.terrain||this.terrain&&m!==this.terrain.drapeRenderMode)this._createTerrain(a,m);else{const b=this.terrain,S=b.get();for(const P of Object.keys(i.spec.terrain))!a.hasOwnProperty(P)&&i.spec.terrain[P].default&&(a[P]=i.spec.terrain[P].default);for(const P in a)if(!C(a[P],S[P])){b.set(a),this.stylesheet.terrain=a;const H=this._setTransitionParameters({duration:0});b.updateTransitions(H);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(a){const m=this.fog=new Se(a,this.map.transform);this.stylesheet.fog=a;const b=this._setTransitionParameters({duration:0});m.updateTransitions(b)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(a){if(this._checkLoaded(),!a)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const m=this.fog,b=m.get();Object.keys(a).length===0&&m.set(a);for(const S in a)if(!C(a[S],b[S])){m.set(a),this.stylesheet.fog=a;const P=this._setTransitionParameters({duration:0});m.updateTransitions(P);break}}else this._createFog(a);this._markersNeedUpdate=!0}_setTransitionParameters(a){return{now:i.exported.now(),transition:i.extend(a,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const a=this._order.filter(b=>this.isLayerDraped(this._layers[b])),m=this._order.filter(b=>!this.isLayerDraped(this._layers[b]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...m)}_createTerrain(a,m){const b=this.terrain=new Re(a,m);this.stylesheet.terrain=a,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const S=this._setTransitionParameters({duration:0});b.updateTransitions(S)}_force3DLayerUpdate(){for(const a in this._layers){const m=this._layers[a];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const a in this._layers){const m=this._layers[a];m.type==="symbol"&&this._updateLayer(m)}}_validate(a,m,b,S,P={}){return(!P||P.validate!==!1)&&lc(this,a.call(i.validateStyle,i.extend({key:m,style:this.serialize(),value:b,styleSpec:i.spec},S)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const a in this._layers)this._layers[a].setEventedParent(null);for(const a in this._sourceCaches)this._sourceCaches[a].clearTiles(),this._sourceCaches[a].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(a){const m=this._getSourceCaches(a);for(const b of m)b.clearTiles()}_reloadSource(a){const m=this._getSourceCaches(a);for(const b of m)b.resume(),b.reload()}_reloadSources(){for(const a of this._getSources())a.reload&&a.reload()}_updateSources(a){for(const m in this._sourceCaches)this._sourceCaches[m].update(a)}_generateCollisionBoxes(){for(const a in this._sourceCaches){const m=this._sourceCaches[a];m.resume(),m.reload()}}_updatePlacement(a,m,b,S,P=!1){let H=!1,W=!1;const ee={};for(const pe of this._order){const fe=this._layers[pe];if(fe.type!=="symbol")continue;if(!ee[fe.source]){const Ne=this._getLayerSourceCache(fe);if(!Ne)continue;ee[fe.source]=Ne.getRenderableIds(!0).map(st=>Ne.getTileByID(st)).sort((st,it)=>it.tileID.overscaledZ-st.tileID.overscaledZ||(st.tileID.isLessThan(it.tileID)?-1:1))}const Me=this.crossTileSymbolIndex.addLayer(fe,ee[fe.source],a.center.lng,a.projection);H=H||Me}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),P=P||this._layerOrderChanged||b===0,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(P||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),a.zoom))&&(this.pauseablePlacement=new Qo(a,this._order,P,m,b,S,this.placement,this.fog&&a.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ee),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),W=!0),H&&this.pauseablePlacement.placement.setStale()),W||H)for(const pe of this._order){const fe=this._layers[pe];fe.type==="symbol"&&this.placement.updateLayerOpacities(fe,ee[fe.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}getImages(a,m,b){this.imageManager.getImages(m.icons,b),this._updateTilesForChangedImages();const S=P=>{P&&P.setDependencies(m.tileID.key,m.type,m.icons)};S(this._otherSourceCaches[m.source]),S(this._symbolSourceCaches[m.source])}getGlyphs(a,m,b){this.glyphManager.getGlyphs(m.stacks,b)}getResource(a,m,b){return i.makeRequest(m,b)}_getSourceCache(a){return this._otherSourceCaches[a]}_getLayerSourceCache(a){return a.type==="symbol"?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}_getSourceCaches(a){const m=[];return this._otherSourceCaches[a]&&m.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&m.push(this._symbolSourceCaches[a]),m}_isSourceCacheLoaded(a){const m=this._getSourceCaches(a);return m.length===0?(this.fire(new i.ErrorEvent(new Error(`There is no source with ID '${a}'`))),!1):m.every(b=>b.loaded())}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Ws.getSourceType=function(x){return j[x]},Ws.setSourceType=function(x,a){j[x]=a},Ws.registerForPluginStateChange=i.registerForPluginStateChange;var cc=`
  3665. #define EPSILON 0.0000001
  3666. #define PI 3.141592653589793
  3667. #define EXTENT 8192.0
  3668. #define HALF_PI PI/2.0
  3669. #define QUARTER_PI PI/4.0
  3670. #define RAD_TO_DEG 180.0/PI
  3671. #define DEG_TO_RAD PI/180.0
  3672. #define GLOBE_RADIUS EXTENT/PI/2.0`,kc="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",eA=`
  3673. #define ELEVATION_SCALE 7.0
  3674. #define ELEVATION_OFFSET 450.0
  3675. #ifdef PROJECTION_GLOBE_VIEW
  3676. uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
  3677. mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
  3678. #else
  3679. vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
  3680. #endif
  3681. #ifdef TERRAIN
  3682. #ifdef TERRAIN_DEM_FLOAT_FORMAT
  3683. uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;
  3684. #else
  3685. uniform sampler2D u_dem;uniform sampler2D u_dem_prev;
  3686. #endif
  3687. uniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {
  3688. #ifdef TERRAIN_DEM_FLOAT_FORMAT
  3689. vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;
  3690. #else
  3691. float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));
  3692. #ifdef TERRAIN_DEM_NEAREST_FILTER
  3693. return u_exaggeration*tl;
  3694. #endif
  3695. float tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
  3696. #endif
  3697. }float prevElevation(vec2 apos) {
  3698. #ifdef TERRAIN_DEM_FLOAT_FORMAT
  3699. vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;
  3700. #else
  3701. float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
  3702. #endif
  3703. }
  3704. #ifdef TERRAIN_VERTEX_MORPHING
  3705. float elevation(vec2 apos) {
  3706. #ifdef ZERO_EXAGGERATION
  3707. return 0.0;
  3708. #endif
  3709. float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
  3710. #else
  3711. float elevation(vec2 apos) {
  3712. #ifdef ZERO_EXAGGERATION
  3713. return 0.0;
  3714. #endif
  3715. return currentElevation(apos);}
  3716. #endif
  3717. highp float unpack_depth(highp vec4 rgba_depth)
  3718. {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(
  3719. unpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))
  3720. );return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {
  3721. #ifdef TERRAIN_DEM_FLOAT_FORMAT
  3722. float tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;
  3723. #else
  3724. vec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);
  3725. #endif
  3726. return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
  3727. #else
  3728. float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }
  3729. #endif`,hc=`#ifdef FOG
  3730. uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
  3731. #endif`,gu=`#ifdef FOG
  3732. uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
  3733. mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
  3734. #endif`;let ed={},_u={};const Ih=[];ul(cc,Ih),ul(eA,Ih),ul(hc,Ih),ul(gu,Ih),ed=Ir("",eA),_u=Ir(gu,hc);const tA=Ir(`
  3735. highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)
  3736. {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}`,`
  3737. float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
  3738. #ifdef PROJECTION_GLOBE_VIEW
  3739. vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
  3740. #ifndef PROJECTED_POS_ON_VIEWPORT
  3741. float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
  3742. #else
  3743. return vec3(0.0);
  3744. #endif
  3745. }vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
  3746. #endif
  3747. vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
  3748. unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
  3749. );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.`),td=cc,uc=`
  3750. #ifdef GL_ES
  3751. precision mediump float;
  3752. #else
  3753. #if !defined(lowp)
  3754. #define lowp
  3755. #endif
  3756. #if !defined(mediump)
  3757. #define mediump
  3758. #endif
  3759. #if !defined(highp)
  3760. #define highp
  3761. #endif
  3762. #endif`;var Oc={background:Ir(`uniform vec4 u_color;uniform float u_opacity;
  3763. #ifdef LIGHTING_3D_MODE
  3764. varying vec4 v_color;
  3765. #endif
  3766. void main() {vec4 out_color;
  3767. #ifdef LIGHTING_3D_MODE
  3768. out_color=v_color;
  3769. #else
  3770. out_color=u_color;
  3771. #endif
  3772. #ifdef FOG
  3773. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  3774. #endif
  3775. gl_FragColor=out_color*u_opacity;
  3776. #ifdef OVERDRAW_INSPECTOR
  3777. gl_FragColor=vec4(1.0);
  3778. #endif
  3779. }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
  3780. #ifdef LIGHTING_3D_MODE
  3781. uniform vec4 u_color;varying vec4 v_color;
  3782. #endif
  3783. void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
  3784. #ifdef LIGHTING_3D_MODE
  3785. v_color=apply_lighting(u_color);
  3786. #endif
  3787. #ifdef FOG
  3788. v_fog_pos=fog_position(a_pos);
  3789. #endif
  3790. }`),backgroundPattern:Ir(`uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);
  3791. #ifdef LIGHTING_3D_MODE
  3792. out_color=apply_lighting(out_color);
  3793. #endif
  3794. #ifdef FOG
  3795. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  3796. #endif
  3797. gl_FragColor=out_color*u_opacity;
  3798. #ifdef OVERDRAW_INSPECTOR
  3799. gl_FragColor=vec4(1.0);
  3800. #endif
  3801. }`,`uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);
  3802. #ifdef FOG
  3803. v_fog_pos=fog_position(a_pos);
  3804. #endif
  3805. }`),circle:Ir(`varying vec3 v_data;varying float v_visibility;
  3806. #pragma mapbox: define highp vec4 color
  3807. #pragma mapbox: define mediump float radius
  3808. #pragma mapbox: define lowp float blur
  3809. #pragma mapbox: define lowp float opacity
  3810. #pragma mapbox: define highp vec4 stroke_color
  3811. #pragma mapbox: define mediump float stroke_width
  3812. #pragma mapbox: define lowp float stroke_opacity
  3813. void main() {
  3814. #pragma mapbox: initialize highp vec4 color
  3815. #pragma mapbox: initialize mediump float radius
  3816. #pragma mapbox: initialize lowp float blur
  3817. #pragma mapbox: initialize lowp float opacity
  3818. #pragma mapbox: initialize highp vec4 stroke_color
  3819. #pragma mapbox: initialize mediump float stroke_width
  3820. #pragma mapbox: initialize lowp float stroke_opacity
  3821. vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
  3822. antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
  3823. );vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
  3824. #ifdef LIGHTING_3D_MODE
  3825. out_color=apply_lighting(out_color);
  3826. #endif
  3827. #ifdef FOG
  3828. out_color=fog_apply_premultiplied(out_color,v_fog_pos);
  3829. #endif
  3830. gl_FragColor=out_color*(v_visibility*opacity_t);
  3831. #ifdef OVERDRAW_INSPECTOR
  3832. gl_FragColor=vec4(1.0);
  3833. #endif
  3834. }`,`#define NUM_VISIBILITY_RINGS 2
  3835. #define INV_SQRT2 0.70710678
  3836. #define ELEVATION_BIAS 0.0001
  3837. #define NUM_SAMPLES_PER_RING 16
  3838. uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;
  3839. #ifdef PROJECTION_GLOBE_VIEW
  3840. attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
  3841. #endif
  3842. varying vec3 v_data;varying float v_visibility;
  3843. #pragma mapbox: define highp vec4 color
  3844. #pragma mapbox: define mediump float radius
  3845. #pragma mapbox: define lowp float blur
  3846. #pragma mapbox: define lowp float opacity
  3847. #pragma mapbox: define highp vec4 stroke_color
  3848. #pragma mapbox: define mediump float stroke_width
  3849. #pragma mapbox: define lowp float stroke_opacity
  3850. vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
  3851. #if defined(TERRAIN)
  3852. return elevation(pos)+ELEVATION_BIAS;
  3853. #else
  3854. return 0.0;
  3855. #endif
  3856. }vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
  3857. #ifdef PITCH_WITH_MAP
  3858. #ifdef PROJECTION_GLOBE_VIEW
  3859. return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
  3860. #else
  3861. return u_matrix*( world_center+vec4(sample_offset,0,0) );
  3862. #endif
  3863. #else
  3864. return projected_center+vec4(sample_offset,0,0);
  3865. #endif
  3866. }float get_sample_step() {
  3867. #ifdef PITCH_WITH_MAP
  3868. return 2.0*PI/float(NUM_SAMPLES_PER_RING);
  3869. #else
  3870. return PI/float(NUM_SAMPLES_PER_RING);
  3871. #endif
  3872. }void main(void) {
  3873. #pragma mapbox: initialize highp vec4 color
  3874. #pragma mapbox: initialize mediump float radius
  3875. #pragma mapbox: initialize lowp float blur
  3876. #pragma mapbox: initialize lowp float opacity
  3877. #pragma mapbox: initialize highp vec4 stroke_color
  3878. #pragma mapbox: initialize mediump float stroke_width
  3879. #pragma mapbox: initialize lowp float stroke_opacity
  3880. vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
  3881. #ifdef PROJECTION_GLOBE_VIEW
  3882. vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
  3883. #else
  3884. surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
  3885. #endif
  3886. vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
  3887. #ifdef PITCH_WITH_MAP
  3888. #ifdef SCALE_WITH_MAP
  3889. view_scale=1.0;
  3890. #else
  3891. view_scale=projected_center.w/u_camera_to_center_distance;
  3892. #endif
  3893. #else
  3894. #ifdef SCALE_WITH_MAP
  3895. view_scale=u_camera_to_center_distance;
  3896. #else
  3897. view_scale=projected_center.w;
  3898. #endif
  3899. #endif
  3900. gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
  3901. #ifdef TERRAIN
  3902. float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
  3903. #ifdef PITCH_WITH_MAP
  3904. float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
  3905. #else
  3906. occlusion_world_center=world_center;occlusion_projected_center=projected_center;
  3907. #endif
  3908. for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
  3909. #else
  3910. visibility=1.0;
  3911. #endif
  3912. #ifdef PROJECTION_GLOBE_VIEW
  3913. visibility=1.0;
  3914. #endif
  3915. v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
  3916. #ifdef FOG
  3917. v_fog_pos=fog_position(world_center.xyz);
  3918. #endif
  3919. }`),clippingMask:Ir("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ir(`uniform highp float u_intensity;varying vec2 v_extrude;
  3920. #pragma mapbox: define highp float weight
  3921. #define GAUSS_COEF 0.3989422804014327
  3922. void main() {
  3923. #pragma mapbox: initialize highp float weight
  3924. float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
  3925. #ifdef FOG
  3926. if (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
  3927. #endif
  3928. #ifdef OVERDRAW_INSPECTOR
  3929. gl_FragColor=vec4(1.0);
  3930. #endif
  3931. }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;
  3932. #ifdef PROJECTION_GLOBE_VIEW
  3933. attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
  3934. #endif
  3935. varying vec2 v_extrude;
  3936. #pragma mapbox: define highp float weight
  3937. #pragma mapbox: define mediump float radius
  3938. const highp float ZERO=1.0/255.0/16.0;
  3939. #define GAUSS_COEF 0.3989422804014327
  3940. void main(void) {
  3941. #pragma mapbox: initialize highp float weight
  3942. #pragma mapbox: initialize mediump float radius
  3943. vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
  3944. #ifdef PROJECTION_GLOBE_VIEW
  3945. vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
  3946. #else
  3947. pos=vec3(tilePos+extrude,elevation(tilePos));
  3948. #endif
  3949. gl_Position=u_matrix*vec4(pos,1);
  3950. #ifdef FOG
  3951. v_fog_pos=fog_position(pos);
  3952. #endif
  3953. }`),heatmapTexture:Ir(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
  3954. #ifdef OVERDRAW_INSPECTOR
  3955. gl_FragColor=vec4(0.0);
  3956. #endif
  3957. }`,"attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Ir("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
  3958. 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Ir("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}",`attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
  3959. mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
  3960. 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Ir("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}",`attribute vec2 a_pos;
  3961. #ifdef PROJECTION_GLOBE_VIEW
  3962. attribute vec3 a_pos_3;
  3963. #endif
  3964. varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
  3965. #ifdef PROJECTION_GLOBE_VIEW
  3966. gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
  3967. #else
  3968. gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
  3969. #endif
  3970. }`),fill:Ir(`#pragma mapbox: define highp vec4 color
  3971. #pragma mapbox: define lowp float opacity
  3972. void main() {
  3973. #pragma mapbox: initialize highp vec4 color
  3974. #pragma mapbox: initialize lowp float opacity
  3975. vec4 out_color=color;
  3976. #ifdef LIGHTING_3D_MODE
  3977. out_color=apply_lighting(out_color);
  3978. #endif
  3979. #ifdef FOG
  3980. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  3981. #endif
  3982. gl_FragColor=out_color*opacity;
  3983. #ifdef OVERDRAW_INSPECTOR
  3984. gl_FragColor=vec4(1.0);
  3985. #endif
  3986. }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
  3987. #pragma mapbox: define highp vec4 color
  3988. #pragma mapbox: define lowp float opacity
  3989. void main() {
  3990. #pragma mapbox: initialize highp vec4 color
  3991. #pragma mapbox: initialize lowp float opacity
  3992. gl_Position=u_matrix*vec4(a_pos,0,1);
  3993. #ifdef FOG
  3994. v_fog_pos=fog_position(a_pos);
  3995. #endif
  3996. }`),fillOutline:Ir(`varying vec2 v_pos;
  3997. #pragma mapbox: define highp vec4 outline_color
  3998. #pragma mapbox: define lowp float opacity
  3999. void main() {
  4000. #pragma mapbox: initialize highp vec4 outline_color
  4001. #pragma mapbox: initialize lowp float opacity
  4002. float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
  4003. #ifdef LIGHTING_3D_MODE
  4004. out_color=apply_lighting(out_color);
  4005. #endif
  4006. #ifdef FOG
  4007. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  4008. #endif
  4009. gl_FragColor=out_color*(alpha*opacity);
  4010. #ifdef OVERDRAW_INSPECTOR
  4011. gl_FragColor=vec4(1.0);
  4012. #endif
  4013. }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
  4014. #pragma mapbox: define highp vec4 outline_color
  4015. #pragma mapbox: define lowp float opacity
  4016. void main() {
  4017. #pragma mapbox: initialize highp vec4 outline_color
  4018. #pragma mapbox: initialize lowp float opacity
  4019. gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
  4020. #ifdef FOG
  4021. v_fog_pos=fog_position(a_pos);
  4022. #endif
  4023. }`),fillOutlinePattern:Ir(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;
  4024. #pragma mapbox: define lowp float opacity
  4025. #pragma mapbox: define lowp vec4 pattern
  4026. void main() {
  4027. #pragma mapbox: initialize lowp float opacity
  4028. #pragma mapbox: initialize mediump vec4 pattern
  4029. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);
  4030. #ifdef LIGHTING_3D_MODE
  4031. out_color=apply_lighting(out_color);
  4032. #endif
  4033. #ifdef FOG
  4034. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  4035. #endif
  4036. gl_FragColor=out_color*(alpha*opacity);
  4037. #ifdef OVERDRAW_INSPECTOR
  4038. gl_FragColor=vec4(1.0);
  4039. #endif
  4040. }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;
  4041. #pragma mapbox: define lowp float opacity
  4042. #pragma mapbox: define lowp vec4 pattern
  4043. #pragma mapbox: define lowp float pixel_ratio
  4044. void main() {
  4045. #pragma mapbox: initialize lowp float opacity
  4046. #pragma mapbox: initialize mediump vec4 pattern
  4047. #pragma mapbox: initialize lowp float pixel_ratio
  4048. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
  4049. #ifdef FOG
  4050. v_fog_pos=fog_position(a_pos);
  4051. #endif
  4052. }`),fillPattern:Ir(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;
  4053. #pragma mapbox: define lowp float opacity
  4054. #pragma mapbox: define lowp vec4 pattern
  4055. void main() {
  4056. #pragma mapbox: initialize lowp float opacity
  4057. #pragma mapbox: initialize mediump vec4 pattern
  4058. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);
  4059. #ifdef LIGHTING_3D_MODE
  4060. out_color=apply_lighting(out_color);
  4061. #endif
  4062. #ifdef FOG
  4063. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  4064. #endif
  4065. gl_FragColor=out_color*opacity;
  4066. #ifdef OVERDRAW_INSPECTOR
  4067. gl_FragColor=vec4(1.0);
  4068. #endif
  4069. }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;
  4070. #pragma mapbox: define lowp float opacity
  4071. #pragma mapbox: define lowp vec4 pattern
  4072. #pragma mapbox: define lowp float pixel_ratio
  4073. void main() {
  4074. #pragma mapbox: initialize lowp float opacity
  4075. #pragma mapbox: initialize mediump vec4 pattern
  4076. #pragma mapbox: initialize lowp float pixel_ratio
  4077. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
  4078. #ifdef FOG
  4079. v_fog_pos=fog_position(a_pos);
  4080. #endif
  4081. }`),fillExtrusion:Ir(`varying vec4 v_color;
  4082. #ifdef RENDER_SHADOWS
  4083. varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;
  4084. #endif
  4085. #ifdef FAUX_AO
  4086. uniform lowp vec2 u_ao;varying vec3 v_ao;
  4087. #endif
  4088. #ifdef ZERO_ROOF_RADIUS
  4089. varying vec4 v_roof_color;
  4090. #endif
  4091. #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
  4092. varying highp vec3 v_normal;
  4093. #endif
  4094. void main() {
  4095. #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
  4096. vec3 normal=v_normal;
  4097. #endif
  4098. float z;vec4 color;
  4099. #ifdef ZERO_ROOF_RADIUS
  4100. z=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);
  4101. #else
  4102. color=v_color;
  4103. #endif
  4104. #ifdef FAUX_AO
  4105. float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
  4106. #ifdef ZERO_ROOF_RADIUS
  4107. concave*=(1.0-z);
  4108. #endif
  4109. float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;
  4110. #endif
  4111. #ifdef RENDER_SHADOWS
  4112. #ifdef ZERO_ROOF_RADIUS
  4113. normal=mix(normal,vec3(0.0,0.0,1.0),z);
  4114. #endif
  4115. color.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);
  4116. #endif
  4117. #ifdef FOG
  4118. color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
  4119. #endif
  4120. gl_FragColor=color;
  4121. #ifdef OVERDRAW_INSPECTOR
  4122. gl_FragColor=vec4(1.0);
  4123. #endif
  4124. }`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;
  4125. #ifdef PROJECTION_GLOBE_VIEW
  4126. attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
  4127. #endif
  4128. varying vec4 v_color;
  4129. #ifdef RENDER_SHADOWS
  4130. uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;
  4131. #endif
  4132. #ifdef ZERO_ROOF_RADIUS
  4133. varying vec4 v_roof_color;
  4134. #endif
  4135. #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
  4136. varying highp vec3 v_normal;
  4137. #endif
  4138. #ifdef FAUX_AO
  4139. uniform lowp vec2 u_ao;varying vec3 v_ao;
  4140. #endif
  4141. #pragma mapbox: define highp float base
  4142. #pragma mapbox: define highp float height
  4143. #pragma mapbox: define highp vec4 color
  4144. void main() {
  4145. #pragma mapbox: initialize highp float base
  4146. #pragma mapbox: initialize highp float height
  4147. #pragma mapbox: initialize highp vec4 color
  4148. vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
  4149. #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)
  4150. v_normal=normal;
  4151. #endif
  4152. base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
  4153. #if defined(HAS_CENTROID) || defined(TERRAIN)
  4154. centroid_pos=a_centroid_pos;
  4155. #endif
  4156. float ele=0.0;float h=0.0;float c_ele;vec3 pos;
  4157. #ifdef TERRAIN
  4158. bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);
  4159. #else
  4160. h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
  4161. #endif
  4162. #ifdef PROJECTION_GLOBE_VIEW
  4163. float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
  4164. #endif
  4165. float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);
  4166. #ifdef RENDER_SHADOWS
  4167. v_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;
  4168. #endif
  4169. float NdotL=0.0;float colorvalue=0.0;
  4170. #ifdef LIGHTING_3D_MODE
  4171. NdotL=calculate_NdotL(normal);
  4172. #else
  4173. colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);
  4174. #endif
  4175. if (normal.y !=0.0) {float r=0.84;
  4176. #ifndef LIGHTING_3D_MODE
  4177. r=mix(0.7,0.98,1.0-u_lightintensity);
  4178. #endif
  4179. NdotL*=(
  4180. (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);
  4181. #ifdef FAUX_AO
  4182. float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
  4183. #ifdef TERRAIN
  4184. top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
  4185. #endif
  4186. v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
  4187. #ifdef PROJECTION_GLOBE_VIEW
  4188. top_height+=u_height_lift;
  4189. #endif
  4190. gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
  4191. #endif
  4192. #ifdef LIGHTING_3D_MODE
  4193. v_color=apply_lighting(color,NdotL);
  4194. #else
  4195. v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));
  4196. #endif
  4197. v_color*=u_opacity;
  4198. #ifdef ZERO_ROOF_RADIUS
  4199. v_roof_color=vec4(0.0,0.0,0.0,1.0);
  4200. #ifdef LIGHTING_3D_MODE
  4201. v_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));
  4202. #else
  4203. float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));
  4204. #endif
  4205. v_roof_color*=u_opacity;
  4206. #endif
  4207. #ifdef FOG
  4208. v_fog_pos=fog_position(pos);
  4209. #endif
  4210. }`),fillExtrusionPattern:Ir(`uniform vec2 u_texsize;uniform sampler2D u_image;
  4211. #ifdef FAUX_AO
  4212. uniform lowp vec2 u_ao;varying vec3 v_ao;
  4213. #endif
  4214. #ifdef LIGHTING_3D_MODE
  4215. varying float v_NdotL;
  4216. #endif
  4217. varying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;
  4218. #pragma mapbox: define lowp float base
  4219. #pragma mapbox: define lowp float height
  4220. #pragma mapbox: define lowp vec4 pattern
  4221. #pragma mapbox: define lowp float pixel_ratio
  4222. void main() {
  4223. #pragma mapbox: initialize lowp float base
  4224. #pragma mapbox: initialize lowp float height
  4225. #pragma mapbox: initialize mediump vec4 pattern
  4226. #pragma mapbox: initialize lowp float pixel_ratio
  4227. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);
  4228. #ifdef LIGHTING_3D_MODE
  4229. out_color=apply_lighting(out_color,v_NdotL)*u_opacity;
  4230. #else
  4231. out_color=out_color*v_lighting;
  4232. #endif
  4233. #ifdef FAUX_AO
  4234. float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
  4235. #endif
  4236. #ifdef FOG
  4237. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  4238. #endif
  4239. gl_FragColor=out_color;
  4240. #ifdef OVERDRAW_INSPECTOR
  4241. gl_FragColor=vec4(1.0);
  4242. #endif
  4243. }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;
  4244. #ifdef PROJECTION_GLOBE_VIEW
  4245. attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
  4246. #endif
  4247. varying vec2 v_pos;varying vec4 v_lighting;
  4248. #ifdef FAUX_AO
  4249. uniform lowp vec2 u_ao;varying vec3 v_ao;
  4250. #endif
  4251. #ifdef LIGHTING_3D_MODE
  4252. varying float v_NdotL;
  4253. #endif
  4254. #pragma mapbox: define lowp float base
  4255. #pragma mapbox: define lowp float height
  4256. #pragma mapbox: define lowp vec4 pattern
  4257. #pragma mapbox: define lowp float pixel_ratio
  4258. void main() {
  4259. #pragma mapbox: initialize lowp float base
  4260. #pragma mapbox: initialize lowp float height
  4261. #pragma mapbox: initialize mediump vec4 pattern
  4262. #pragma mapbox: initialize lowp float pixel_ratio
  4263. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
  4264. #if defined(HAS_CENTROID) || defined(TERRAIN)
  4265. centroid_pos=a_centroid_pos;
  4266. #endif
  4267. float ele=0.0;float h=z;vec3 p;float c_ele;
  4268. #ifdef TERRAIN
  4269. bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);
  4270. #else
  4271. p=vec3(pos_nx.xy,z);
  4272. #endif
  4273. #ifdef PROJECTION_GLOBE_VIEW
  4274. float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
  4275. #endif
  4276. float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
  4277. ? pos_nx.xy
  4278. : vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
  4279. #ifdef LIGHTING_3D_MODE
  4280. NdotL=calculate_NdotL(normal);
  4281. #else
  4282. NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
  4283. #endif
  4284. if (normal.y !=0.0) {float r=0.84;
  4285. #ifndef LIGHTING_3D_MODE
  4286. r=mix(0.7,0.98,1.0-u_lightintensity);
  4287. #endif
  4288. NdotL*=(
  4289. (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
  4290. #ifdef FAUX_AO
  4291. float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
  4292. #ifdef TERRAIN
  4293. top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
  4294. #endif
  4295. v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
  4296. #ifdef PROJECTION_GLOBE_VIEW
  4297. top_height+=u_height_lift;
  4298. #endif
  4299. gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
  4300. #endif
  4301. #ifdef LIGHTING_3D_MODE
  4302. v_NdotL=NdotL;
  4303. #else
  4304. v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
  4305. #endif
  4306. #ifdef FOG
  4307. v_fog_pos=fog_position(p);
  4308. #endif
  4309. }`),hillshadePrepare:Ir(`#ifdef GL_ES
  4310. precision highp float;
  4311. #endif
  4312. uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {
  4313. #ifdef TERRAIN_DEM_FLOAT_FORMAT
  4314. return texture2D(u_image,coord).a/4.0;
  4315. #else
  4316. vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;
  4317. #endif
  4318. }void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
  4319. (c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
  4320. )/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(
  4321. deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
  4322. #ifdef OVERDRAW_INSPECTOR
  4323. gl_FragColor=vec4(1.0);
  4324. #endif
  4325. }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ir(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
  4326. #ifdef LIGHTING_3D_MODE
  4327. gl_FragColor=apply_lighting(gl_FragColor);
  4328. #endif
  4329. #ifdef FOG
  4330. gl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));
  4331. #endif
  4332. #ifdef OVERDRAW_INSPECTOR
  4333. gl_FragColor=vec4(1.0);
  4334. #endif
  4335. }`,`uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
  4336. #ifdef FOG
  4337. v_fog_pos=fog_position(a_pos);
  4338. #endif
  4339. }`),line:Ir(`uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;
  4340. #ifdef RENDER_LINE_DASH
  4341. uniform sampler2D u_dash_image;varying vec2 v_tex;
  4342. #endif
  4343. #ifdef RENDER_LINE_GRADIENT
  4344. uniform sampler2D u_gradient_image;
  4345. #endif
  4346. uniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
  4347. #pragma mapbox: define highp vec4 color
  4348. #pragma mapbox: define lowp float floorwidth
  4349. #pragma mapbox: define lowp vec4 dash
  4350. #pragma mapbox: define lowp float blur
  4351. #pragma mapbox: define lowp float opacity
  4352. float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
  4353. #pragma mapbox: initialize highp vec4 color
  4354. #pragma mapbox: initialize lowp float floorwidth
  4355. #pragma mapbox: initialize lowp vec4 dash
  4356. #pragma mapbox: initialize lowp float blur
  4357. #pragma mapbox: initialize lowp float opacity
  4358. 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);
  4359. #ifdef RENDER_LINE_DASH
  4360. float sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);
  4361. #endif
  4362. highp vec4 out_color;
  4363. #ifdef RENDER_LINE_GRADIENT
  4364. out_color=texture2D(u_gradient_image,v_uv.xy);
  4365. #else
  4366. out_color=color;
  4367. #endif
  4368. #ifdef RENDER_LINE_TRIM_OFFSET
  4369. highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);}}
  4370. #endif
  4371. #ifdef LIGHTING_3D_MODE
  4372. out_color=apply_lighting(out_color);
  4373. #endif
  4374. #ifdef FOG
  4375. out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
  4376. #endif
  4377. #ifdef RENDER_LINE_ALPHA_DISCARD
  4378. if (alpha < u_alpha_discard_threshold) {discard;}
  4379. #endif
  4380. #ifdef RENDER_LINE_BORDER
  4381. float edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);
  4382. #ifdef RENDER_LINE_BORDER_AUTO
  4383. float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}
  4384. #else
  4385. out_color.rgb=mix(u_border_color.rgb,out_color.rgb,smoothAlpha);
  4386. #endif
  4387. }
  4388. #endif
  4389. gl_FragColor=out_color*(alpha*opacity);
  4390. #ifdef OVERDRAW_INSPECTOR
  4391. gl_FragColor=vec4(1.0);
  4392. #endif
  4393. }`,`
  4394. #define EXTRUDE_SCALE 0.015873016
  4395. attribute vec2 a_pos_normal;attribute vec4 a_data;
  4396. #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
  4397. attribute highp vec4 a_packed;
  4398. #endif
  4399. #ifdef RENDER_LINE_DASH
  4400. attribute float a_linesofar;
  4401. #endif
  4402. uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;
  4403. #ifdef RENDER_LINE_DASH
  4404. uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;
  4405. #endif
  4406. #ifdef RENDER_LINE_GRADIENT
  4407. uniform float u_image_height;
  4408. #endif
  4409. #pragma mapbox: define highp vec4 color
  4410. #pragma mapbox: define lowp float floorwidth
  4411. #pragma mapbox: define lowp vec4 dash
  4412. #pragma mapbox: define lowp float blur
  4413. #pragma mapbox: define lowp float opacity
  4414. #pragma mapbox: define mediump float gapwidth
  4415. #pragma mapbox: define lowp float offset
  4416. #pragma mapbox: define mediump float width
  4417. void main() {
  4418. #pragma mapbox: initialize highp vec4 color
  4419. #pragma mapbox: initialize lowp float floorwidth
  4420. #pragma mapbox: initialize lowp vec4 dash
  4421. #pragma mapbox: initialize lowp float blur
  4422. #pragma mapbox: initialize lowp float opacity
  4423. #pragma mapbox: initialize mediump float gapwidth
  4424. #pragma mapbox: initialize lowp float offset
  4425. #pragma mapbox: initialize mediump float width
  4426. float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
  4427. #ifndef RENDER_TO_TEXTURE
  4428. float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
  4429. #else
  4430. v_gamma_scale=1.0;
  4431. #endif
  4432. #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
  4433. float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];
  4434. #ifdef RENDER_LINE_GRADIENT
  4435. highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);
  4436. #else
  4437. v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
  4438. #endif
  4439. #endif
  4440. #ifdef RENDER_LINE_DASH
  4441. float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);
  4442. #endif
  4443. v_width2=vec2(outset,inset);
  4444. #ifdef FOG
  4445. v_fog_pos=fog_position(pos);
  4446. #endif
  4447. }`),linePattern:Ir(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
  4448. #pragma mapbox: define lowp vec4 pattern
  4449. #pragma mapbox: define lowp float pixel_ratio
  4450. #pragma mapbox: define lowp float blur
  4451. #pragma mapbox: define lowp float opacity
  4452. void main() {
  4453. #pragma mapbox: initialize mediump vec4 pattern
  4454. #pragma mapbox: initialize lowp float pixel_ratio
  4455. #pragma mapbox: initialize lowp float blur
  4456. #pragma mapbox: initialize lowp float opacity
  4457. vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);
  4458. #ifdef LIGHTING_3D_MODE
  4459. color=apply_lighting(color);
  4460. #endif
  4461. #ifdef FOG
  4462. color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
  4463. #endif
  4464. gl_FragColor=color*(alpha*opacity);
  4465. #ifdef OVERDRAW_INSPECTOR
  4466. gl_FragColor=vec4(1.0);
  4467. #endif
  4468. }`,`
  4469. #define scale 0.015873016
  4470. attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
  4471. #pragma mapbox: define lowp float blur
  4472. #pragma mapbox: define lowp float opacity
  4473. #pragma mapbox: define lowp float offset
  4474. #pragma mapbox: define mediump float gapwidth
  4475. #pragma mapbox: define mediump float width
  4476. #pragma mapbox: define lowp float floorwidth
  4477. #pragma mapbox: define lowp vec4 pattern
  4478. #pragma mapbox: define lowp float pixel_ratio
  4479. void main() {
  4480. #pragma mapbox: initialize lowp float blur
  4481. #pragma mapbox: initialize lowp float opacity
  4482. #pragma mapbox: initialize lowp float offset
  4483. #pragma mapbox: initialize mediump float gapwidth
  4484. #pragma mapbox: initialize mediump float width
  4485. #pragma mapbox: initialize lowp float floorwidth
  4486. #pragma mapbox: initialize mediump vec4 pattern
  4487. #pragma mapbox: initialize lowp float pixel_ratio
  4488. float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
  4489. #ifndef RENDER_TO_TEXTURE
  4490. float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
  4491. #else
  4492. v_gamma_scale=1.0;
  4493. #endif
  4494. v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;
  4495. #ifdef FOG
  4496. v_fog_pos=fog_position(pos);
  4497. #endif
  4498. }`),raster:Ir(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(
  4499. 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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
  4500. #ifdef LIGHTING_3D_MODE
  4501. out_color=apply_lighting(out_color);
  4502. #endif
  4503. #ifdef FOG
  4504. out_color=fog_dither(fog_apply(out_color,v_fog_pos));
  4505. #endif
  4506. gl_FragColor=vec4(out_color*color.a,color.a);
  4507. #ifdef OVERDRAW_INSPECTOR
  4508. gl_FragColor=vec4(1.0);
  4509. #endif
  4510. }`,`uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;
  4511. #ifdef FOG
  4512. v_fog_pos=fog_position(a_pos);
  4513. #endif
  4514. }`),symbolIcon:Ir(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
  4515. #pragma mapbox: define lowp float opacity
  4516. void main() {
  4517. #pragma mapbox: initialize lowp float opacity
  4518. lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
  4519. #ifdef OVERDRAW_INSPECTOR
  4520. gl_FragColor=vec4(1.0);
  4521. #endif
  4522. }`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;
  4523. #ifdef PROJECTION_GLOBE_VIEW
  4524. attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;
  4525. #endif
  4526. 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 bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;
  4527. #ifdef PROJECTION_GLOBE_VIEW
  4528. uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
  4529. #endif
  4530. varying vec2 v_tex;varying float v_fade_opacity;
  4531. #pragma mapbox: define lowp float opacity
  4532. void main() {
  4533. #pragma mapbox: initialize lowp float opacity
  4534. vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
  4535. #ifdef PROJECTION_GLOBE_VIEW
  4536. mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
  4537. #else
  4538. world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
  4539. #endif
  4540. vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
  4541. camera_to_anchor_distance/u_camera_to_center_distance :
  4542. u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
  4543. 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;
  4544. #ifdef PROJECTION_GLOBE_VIEW
  4545. vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
  4546. #else
  4547. offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
  4548. #endif
  4549. vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
  4550. #ifdef PROJECTION_GLOBE_VIEW
  4551. vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
  4552. #else
  4553. projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
  4554. #endif
  4555. 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
  4556. #ifdef TERRAIN
  4557. #ifdef PITCH_WITH_MAP_TERRAIN
  4558. vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
  4559. #endif
  4560. #endif
  4561. float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;
  4562. #ifdef PROJECTION_GLOBE_VIEW
  4563. vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
  4564. #else
  4565. gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
  4566. #endif
  4567. float projection_transition_fade=1.0;
  4568. #if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
  4569. projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
  4570. #endif
  4571. v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}`),symbolSDF:Ir(`#define SDF_PX 8.0
  4572. uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
  4573. #pragma mapbox: define highp vec4 fill_color
  4574. #pragma mapbox: define highp vec4 halo_color
  4575. #pragma mapbox: define lowp float opacity
  4576. #pragma mapbox: define lowp float halo_width
  4577. #pragma mapbox: define lowp float halo_blur
  4578. void main() {
  4579. #pragma mapbox: initialize highp vec4 fill_color
  4580. #pragma mapbox: initialize highp vec4 halo_color
  4581. #pragma mapbox: initialize lowp float opacity
  4582. #pragma mapbox: initialize lowp float halo_width
  4583. #pragma mapbox: initialize lowp float halo_blur
  4584. float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
  4585. #ifdef OVERDRAW_INSPECTOR
  4586. gl_FragColor=vec4(1.0);
  4587. #endif
  4588. }`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;
  4589. #ifdef PROJECTION_GLOBE_VIEW
  4590. attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;
  4591. #endif
  4592. uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;
  4593. #ifdef PROJECTION_GLOBE_VIEW
  4594. uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
  4595. #endif
  4596. varying vec2 v_data0;varying vec3 v_data1;
  4597. #pragma mapbox: define highp vec4 fill_color
  4598. #pragma mapbox: define highp vec4 halo_color
  4599. #pragma mapbox: define lowp float opacity
  4600. #pragma mapbox: define lowp float halo_width
  4601. #pragma mapbox: define lowp float halo_blur
  4602. void main() {
  4603. #pragma mapbox: initialize highp vec4 fill_color
  4604. #pragma mapbox: initialize highp vec4 halo_color
  4605. #pragma mapbox: initialize lowp float opacity
  4606. #pragma mapbox: initialize lowp float halo_width
  4607. #pragma mapbox: initialize lowp float halo_blur
  4608. vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
  4609. #ifdef PROJECTION_GLOBE_VIEW
  4610. mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
  4611. #else
  4612. world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
  4613. #endif
  4614. vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
  4615. camera_to_anchor_distance/u_camera_to_center_distance :
  4616. u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
  4617. 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;
  4618. #ifdef PROJECTION_GLOBE_VIEW
  4619. vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
  4620. #else
  4621. offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
  4622. #endif
  4623. vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
  4624. #ifdef PROJECTION_GLOBE_VIEW
  4625. vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
  4626. #else
  4627. projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
  4628. #endif
  4629. 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);
  4630. #ifdef TERRAIN
  4631. #ifdef PITCH_WITH_MAP_TERRAIN
  4632. vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
  4633. #endif
  4634. #endif
  4635. float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;
  4636. #ifdef PROJECTION_GLOBE_VIEW
  4637. vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
  4638. #else
  4639. gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
  4640. #endif
  4641. float gamma_scale=gl_Position.w;float projection_transition_fade=1.0;
  4642. #if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
  4643. projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
  4644. #endif
  4645. vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}`),symbolTextAndIcon:Ir(`#define SDF_PX 8.0
  4646. #define SDF 1.0
  4647. #define ICON 0.0
  4648. uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
  4649. #pragma mapbox: define highp vec4 fill_color
  4650. #pragma mapbox: define highp vec4 halo_color
  4651. #pragma mapbox: define lowp float opacity
  4652. #pragma mapbox: define lowp float halo_width
  4653. #pragma mapbox: define lowp float halo_blur
  4654. void main() {
  4655. #pragma mapbox: initialize highp vec4 fill_color
  4656. #pragma mapbox: initialize highp vec4 halo_color
  4657. #pragma mapbox: initialize lowp float opacity
  4658. #pragma mapbox: initialize lowp float halo_width
  4659. #pragma mapbox: initialize lowp float halo_blur
  4660. float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
  4661. #ifdef OVERDRAW_INSPECTOR
  4662. gl_FragColor=vec4(1.0);
  4663. #endif
  4664. return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
  4665. #ifdef OVERDRAW_INSPECTOR
  4666. gl_FragColor=vec4(1.0);
  4667. #endif
  4668. }`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;
  4669. #ifdef PROJECTION_GLOBE_VIEW
  4670. attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;
  4671. #endif
  4672. uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;
  4673. #ifdef PROJECTION_GLOBE_VIEW
  4674. uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
  4675. #endif
  4676. varying vec4 v_data0;varying vec4 v_data1;
  4677. #pragma mapbox: define highp vec4 fill_color
  4678. #pragma mapbox: define highp vec4 halo_color
  4679. #pragma mapbox: define lowp float opacity
  4680. #pragma mapbox: define lowp float halo_width
  4681. #pragma mapbox: define lowp float halo_blur
  4682. void main() {
  4683. #pragma mapbox: initialize highp vec4 fill_color
  4684. #pragma mapbox: initialize highp vec4 halo_color
  4685. #pragma mapbox: initialize lowp float opacity
  4686. #pragma mapbox: initialize lowp float halo_width
  4687. #pragma mapbox: initialize lowp float halo_blur
  4688. vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
  4689. #ifdef PROJECTION_GLOBE_VIEW
  4690. mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
  4691. #else
  4692. world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
  4693. #endif
  4694. vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
  4695. camera_to_anchor_distance/u_camera_to_center_distance :
  4696. u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
  4697. 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
  4698. #ifdef PROJECTION_GLOBE_VIEW
  4699. vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
  4700. #else
  4701. projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
  4702. #endif
  4703. 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);
  4704. #ifdef TERRAIN
  4705. #ifdef PITCH_WITH_MAP_TERRAIN
  4706. vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
  4707. #endif
  4708. #endif
  4709. float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;
  4710. #ifdef PROJECTION_GLOBE_VIEW
  4711. vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
  4712. #else
  4713. gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));
  4714. #endif
  4715. float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;
  4716. #if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
  4717. projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
  4718. #endif
  4719. v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}`),terrainRaster:Ir(`uniform sampler2D u_image0;varying vec2 v_pos0;
  4720. #ifdef FOG
  4721. varying float v_fog_opacity;
  4722. #endif
  4723. #ifdef RENDER_SHADOWS
  4724. varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;
  4725. #endif
  4726. void main() {vec4 color=texture2D(u_image0,v_pos0);
  4727. #ifdef RENDER_SHADOWS
  4728. color.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);
  4729. #endif
  4730. #ifdef FOG
  4731. #ifdef ZERO_EXAGGERATION
  4732. color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
  4733. #else
  4734. color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
  4735. #endif
  4736. #endif
  4737. gl_FragColor=color;
  4738. #ifdef TERRAIN_WIREFRAME
  4739. gl_FragColor=vec4(1.0,0.0,0.0,0.8);
  4740. #endif
  4741. #ifdef OVERDRAW_INSPECTOR
  4742. gl_FragColor=vec4(1.0);
  4743. #endif
  4744. }`,`uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;
  4745. #ifdef FOG
  4746. varying float v_fog_opacity;
  4747. #endif
  4748. #ifdef RENDER_SHADOWS
  4749. uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;
  4750. #endif
  4751. const float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;
  4752. #ifdef TERRAIN_WIREFRAME
  4753. elevation+=u_skirt_height*u_skirt_height*wireframeOffset;
  4754. #endif
  4755. vec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
  4756. #ifdef FOG
  4757. #ifdef ZERO_EXAGGERATION
  4758. v_fog_pos=fog_position(decodedPos);
  4759. #else
  4760. v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
  4761. #endif
  4762. #endif
  4763. #ifdef RENDER_SHADOWS
  4764. vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;
  4765. #endif
  4766. }`),terrainDepth:Ir(`#ifdef GL_ES
  4767. precision highp float;
  4768. #endif
  4769. varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:Ir(`
  4770. varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
  4771. cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;
  4772. #ifdef FOG
  4773. sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
  4774. #endif
  4775. sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);
  4776. #ifdef OVERDRAW_INSPECTOR
  4777. gl_FragColor=vec4(1.0);
  4778. #endif
  4779. }`,kc),skyboxGradient:Ir(`varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));
  4780. #ifdef FOG
  4781. color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
  4782. #endif
  4783. color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;
  4784. #ifdef OVERDRAW_INSPECTOR
  4785. gl_FragColor=vec4(1.0);
  4786. #endif
  4787. }`,kc),skyboxCapture:Ir(`
  4788. varying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;
  4789. #ifdef GL_ES
  4790. precision highp float;
  4791. #endif
  4792. #define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)
  4793. #define BETA_M vec3(21e-6,21e-6,21e-6)
  4794. #define MIE_G 0.76
  4795. #define DENSITY_HEIGHT_SCALE_R 8000.0
  4796. #define DENSITY_HEIGHT_SCALE_M 1200.0
  4797. #define PLANET_RADIUS 6360e3
  4798. #define ATMOSPHERE_RADIUS 6420e3
  4799. #define SAMPLE_STEPS 10
  4800. #define DENSITY_STEPS 4
  4801. float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}`,"attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Ir(`uniform sampler2D u_image0;varying vec2 v_pos0;
  4802. #ifndef FOG
  4803. uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
  4804. #endif
  4805. void main() {vec4 color;
  4806. #ifdef CUSTOM_ANTIALIASING
  4807. vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
  4808. mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);
  4809. #else
  4810. color=texture2D(u_image0,v_pos0);
  4811. #endif
  4812. #ifdef FOG
  4813. color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
  4814. #endif
  4815. gl_FragColor=color;
  4816. #ifdef TERRAIN_WIREFRAME
  4817. gl_FragColor=vec4(1.0,0.0,0.0,0.8);
  4818. #endif
  4819. #ifdef OVERDRAW_INSPECTOR
  4820. gl_FragColor=vec4(1.0);
  4821. #endif
  4822. }`,`uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;
  4823. #ifdef GLOBE_POLES
  4824. attribute vec3 a_globe_pos;attribute vec2 a_uv;
  4825. #else
  4826. attribute vec2 a_pos;
  4827. #endif
  4828. varying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {
  4829. #ifdef GLOBE_POLES
  4830. vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
  4831. #else
  4832. float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
  4833. #endif
  4834. v_pos0=uv;vec2 tile_pos=uv*EXTENT;
  4835. #ifdef GLOBE_POLES
  4836. vec3 up_vector=normalize(globe_pos)*u_tile_up_scale;
  4837. #else
  4838. vec3 up_vector=elevationVector(tile_pos);
  4839. #endif
  4840. float height=elevation(tile_pos);
  4841. #ifdef TERRAIN_WIREFRAME
  4842. height+=wireframeOffset;
  4843. #endif
  4844. globe_pos+=up_vector*height;
  4845. #ifdef GLOBE_POLES
  4846. vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
  4847. #else
  4848. vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
  4849. #endif
  4850. gl_Position=u_proj_matrix*interpolated_pos;
  4851. #ifdef FOG
  4852. v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
  4853. #endif
  4854. }`),globeAtmosphere:Ir(`uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
  4855. #ifdef PROJECTION_GLOBE_VIEW
  4856. globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}
  4857. #endif
  4858. highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
  4859. 0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;
  4860. #ifdef PROJECTION_GLOBE_VIEW
  4861. highp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
  4862. PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
  4863. #else
  4864. horizon_angle=horizon_angle_mercator;
  4865. #endif
  4866. horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:
  4867. (n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:
  4868. uv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}`,`attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
  4869. mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
  4870. mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`)};function ul(x,a){const m=x.replace(/\s*\/\/[^\n]*\n/g,`
  4871. `).split(`
  4872. `);for(let b of m)if(b=b.trim(),b[0]==="#"&&b.includes("if")&&!b.includes("endif")){b=b.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const S=b.split(" ");for(const P of S)a.includes(P)||a.push(P)}}function Ir(x,a){const m=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,b=a.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),S={},P=[...Ih];return ul(x,P),ul(a,P),{fragmentSource:x=x.replace(m,(H,W,ee,pe,fe)=>(S[fe]=!0,W==="define"?`
  4873. #ifndef HAS_UNIFORM_u_${fe}
  4874. varying ${ee} ${pe} ${fe};
  4875. #else
  4876. uniform ${ee} ${pe} u_${fe};
  4877. #endif
  4878. `:`
  4879. #ifdef HAS_UNIFORM_u_${fe}
  4880. ${ee} ${pe} ${fe} = u_${fe};
  4881. #endif
  4882. `)),vertexSource:a=a.replace(m,(H,W,ee,pe,fe)=>{const Me=pe==="float"?"vec2":"vec4",Ne=fe.match(/color/)?"color":Me;return S[fe]?W==="define"?`
  4883. #ifndef HAS_UNIFORM_u_${fe}
  4884. uniform lowp float u_${fe}_t;
  4885. attribute ${ee} ${Me} a_${fe};
  4886. varying ${ee} ${pe} ${fe};
  4887. #else
  4888. uniform ${ee} ${pe} u_${fe};
  4889. #endif
  4890. `:Ne==="vec4"?`
  4891. #ifndef HAS_UNIFORM_u_${fe}
  4892. ${fe} = a_${fe};
  4893. #else
  4894. ${ee} ${pe} ${fe} = u_${fe};
  4895. #endif
  4896. `:`
  4897. #ifndef HAS_UNIFORM_u_${fe}
  4898. ${fe} = unpack_mix_${Ne}(a_${fe}, u_${fe}_t);
  4899. #else
  4900. ${ee} ${pe} ${fe} = u_${fe};
  4901. #endif
  4902. `:W==="define"?`
  4903. #ifndef HAS_UNIFORM_u_${fe}
  4904. uniform lowp float u_${fe}_t;
  4905. attribute ${ee} ${Me} a_${fe};
  4906. #else
  4907. uniform ${ee} ${pe} u_${fe};
  4908. #endif
  4909. `:Ne==="vec4"?`
  4910. #ifndef HAS_UNIFORM_u_${fe}
  4911. ${ee} ${pe} ${fe} = a_${fe};
  4912. #else
  4913. ${ee} ${pe} ${fe} = u_${fe};
  4914. #endif
  4915. `:`
  4916. #ifndef HAS_UNIFORM_u_${fe}
  4917. ${ee} ${pe} ${fe} = unpack_mix_${Ne}(a_${fe}, u_${fe}_t);
  4918. #else
  4919. ${ee} ${pe} ${fe} = u_${fe};
  4920. #endif
  4921. `}),staticAttributes:b,usedDefines:P}}class Ac{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(a,m,b,S,P,H,W){this.context=a;let ee=this.boundPaintVertexBuffers.length!==S.length;for(let fe=0;!ee&&fe<S.length;fe++)this.boundPaintVertexBuffers[fe]!==S[fe]&&(ee=!0);let pe=this.boundDynamicVertexBuffers.length!==W.length;for(let fe=0;!pe&&fe<W.length;fe++)this.boundDynamicVertexBuffers[fe]!==W[fe]&&(pe=!0);if(!a.extVertexArrayObject||!this.vao||this.boundProgram!==m||this.boundLayoutVertexBuffer!==b||ee||pe||this.boundIndexBuffer!==P||this.boundVertexOffset!==H)this.freshBind(m,b,S,P,H,W);else{a.bindVertexArrayOES.set(this.vao);for(const fe of W)fe&&fe.bind();P&&P.dynamicDraw&&P.bind()}}freshBind(a,m,b,S,P,H){let W;const ee=a.numAttributes,pe=this.context,fe=pe.gl;if(pe.extVertexArrayObject)this.vao&&this.destroy(),this.vao=pe.extVertexArrayObject.createVertexArrayOES(),pe.bindVertexArrayOES.set(this.vao),W=0,this.boundProgram=a,this.boundLayoutVertexBuffer=m,this.boundPaintVertexBuffers=b,this.boundIndexBuffer=S,this.boundVertexOffset=P,this.boundDynamicVertexBuffers=H;else{W=pe.currentNumAttributes||0;for(let Me=ee;Me<W;Me++)fe.disableVertexAttribArray(Me)}m.enableAttributes(fe,a),m.bind(),m.setVertexAttribPointers(fe,a,P);for(const Me of b)Me.enableAttributes(fe,a),Me.bind(),Me.setVertexAttribPointers(fe,a,P);for(const Me of H)Me&&(Me.enableAttributes(fe,a),Me.bind(),Me.setVertexAttribPointers(fe,a,P));S&&S.bind(),pe.currentNumAttributes=ee}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Nc(x,a){const m=Math.pow(2,a.canonical.z),b=a.canonical.y;return[new i.MercatorCoordinate(0,b/m).toLngLat().lat,new i.MercatorCoordinate(0,(b+1)/m).toLngLat().lat]}function yu(x,a,m,b,S,P,H){const W=x.context,ee=W.gl,pe=m.fbo;if(!pe)return;x.prepareDrawTile();const fe=x.useProgram("hillshade");W.activeTexture.set(ee.TEXTURE0),ee.bindTexture(ee.TEXTURE_2D,pe.colorAttachment.get());const Me=((lt,qe,Ye,dt)=>{const ht=Ye.paint.get("hillshade-shadow-color"),Bt=Ye.paint.get("hillshade-highlight-color"),Pt=Ye.paint.get("hillshade-accent-color");let It=Ye.paint.get("hillshade-illumination-direction")*(Math.PI/180);Ye.paint.get("hillshade-illumination-anchor")==="viewport"&&(It-=lt.transform.angle);const Ht=!lt.options.moving;return{u_matrix:dt||lt.transform.calculateProjMatrix(qe.tileID.toUnwrapped(),Ht),u_image:0,u_latrange:Nc(0,qe.tileID),u_light:[Ye.paint.get("hillshade-exaggeration"),It],u_shadow:ht,u_highlight:Bt,u_accent:Pt}})(x,m,b,x.terrain?a.projMatrix:null);x.prepareDrawProgram(W,fe,a.toUnwrapped());const{tileBoundsBuffer:Ne,tileBoundsIndexBuffer:st,tileBoundsSegments:it}=x.getTileBoundsBuffers(m);fe.draw(W,ee.TRIANGLES,S,P,H,i.CullFaceMode.disabled,Me,b.id,Ne,st,it)}function Al(x,a,m){if(!a.needsDEMTextureUpload)return;const b=x.context,S=b.gl;b.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||x.getTileTexture(m.stride);const P=m.getPixels();a.demTexture?a.demTexture.update(P,{premultiply:!1}):a.demTexture=new i.Texture(b,P,S.RGBA,{premultiply:!1}),a.needsDEMTextureUpload=!1}function Va(x,a,m,b,S,P){const H=x.context,W=H.gl;if(!a.dem)return;const ee=a.dem;if(H.activeTexture.set(W.TEXTURE1),Al(x,a,ee),!a.demTexture)return;a.demTexture.bind(W.NEAREST,W.CLAMP_TO_EDGE);const pe=ee.dim;H.activeTexture.set(W.TEXTURE0);let fe=a.fbo;if(!fe){const it=new i.Texture(H,{width:pe,height:pe,data:null},W.RGBA);it.bind(W.LINEAR,W.CLAMP_TO_EDGE),fe=a.fbo=H.createFramebuffer(pe,pe,!0),fe.colorAttachment.set(it.texture)}H.bindFramebuffer.set(fe.framebuffer),H.viewport.set([0,0,pe,pe]);const{tileBoundsBuffer:Me,tileBoundsIndexBuffer:Ne,tileBoundsSegments:st}=x.getMercatorTileBoundsBuffers();x.useProgram("hillshadePrepare").draw(H,W.TRIANGLES,b,S,P,i.CullFaceMode.disabled,((it,lt)=>{const qe=lt.stride,Ye=i.create();return i.ortho(Ye,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(Ye,Ye,[0,-i.EXTENT,0]),{u_matrix:Ye,u_image:1,u_dimension:[qe,qe],u_zoom:it.overscaledZ,u_unpack:lt.unpackVector}})(a.tileID,ee),m.id,Me,Ne,st),a.needsHillshadePrepare=!1}const Qc=x=>({u_matrix:new i.UniformMatrix4f(x),u_image0:new i.Uniform1i(x),u_skirt_height:new i.Uniform1f(x)}),dl=(x,a)=>({u_matrix:x,u_image0:0,u_skirt_height:a}),qr=(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st)=>({u_proj_matrix:Float32Array.from(x),u_globe_matrix:a,u_normalize_matrix:Float32Array.from(b),u_merc_matrix:m,u_zoom_transition:S,u_merc_center:P,u_image0:0,u_frustum_tl:H,u_frustum_tr:W,u_frustum_br:ee,u_frustum_bl:pe,u_globe_pos:fe,u_globe_radius:Me,u_viewport:Ne,u_grid_matrix:st?Float32Array.from(st):new Float32Array(9)});function Fh(x,a){return x!=null&&a!=null&&!(!x.hasData()||!a.hasData())&&x.demTexture!=null&&a.demTexture!=null&&x.tileID.key!==a.tileID.key}const hr=new class{constructor(){this.operations={}}newMorphing(x,a,m,b,S){if(x in this.operations){const P=this.operations[x];P.to.tileID.key!==m.tileID.key&&(P.queued=m)}else this.operations[x]={startTime:b,phase:0,duration:S,from:a,to:m,queued:null}}getMorphValuesForProxy(x){if(!(x in this.operations))return null;const a=this.operations[x];return{from:a.from,to:a.to,phase:a.phase}}update(x){for(const a in this.operations){const m=this.operations[a];for(m.phase=(x-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,x)){delete this.operations[a];break}}}_nextOp(x,a){return!!x.queued&&(x.from=x.to,x.to=x.queued,x.queued=null,x.phase=0,x.startTime=a,!0)}_validOp(x){return x.from.hasData()&&x.to.hasData()}},Br={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function jr(x,a){const m=1<<x.z;return!a&&(x.x===0||x.x===m-1)||x.y===0||x.y===m-1}const $r=x=>({u_matrix:x});function Hl(x,a,m,b,S){if(S>0){const P=i.exported.now(),H=(P-x.timeAdded)/S,W=a?(P-a.timeAdded)/S:-1,ee=m.getSource(),pe=b.coveringZoomLevel({tileSize:ee.tileSize,roundZoom:ee.roundZoom}),fe=!a||Math.abs(a.tileID.overscaledZ-pe)>Math.abs(x.tileID.overscaledZ-pe),Me=fe&&x.refreshedUponExpiration?1:i.clamp(fe?H:1-W,0,1);return x.refreshedUponExpiration&&H>=1&&(x.refreshedUponExpiration=!1),a?{opacity:1,mix:1-Me}:{opacity:Me,mix:0}}return{opacity:1,mix:0}}class gr extends i.SourceCache{constructor(a){const m={type:"raster-dem",maxzoom:a.transform.maxZoom},b=new Ke(jt(),null),S=ie("mock-dem",m,b,a.style);super("mock-dem",S,!1),S.setEventedParent(this),this._sourceLoaded=!0}_loadTile(a,m){a.state="loaded",m(null)}}class xu extends i.SourceCache{constructor(a){const m=ie("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},new Ke(jt(),null),a.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=a,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(a,m,b){if(a.freezeTileCoverage)return;this.transform=a;const S=a.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((P,H)=>{if(P[H.key]="",!this._tiles[H.key]){const W=new i.Tile(H,this._source.tileSize*H.overscaleFactor(),a.tileZoom);W.state="loaded",this._tiles[H.key]=W}return P},{});for(const P in this._tiles)P in S||(this.freeFBO(P),this._tiles[P].unloadVectorData(),delete this._tiles[P])}freeFBO(a){const m=this.proxyCachedFBO[a];if(m!==void 0){const b=Object.values(m);this.renderCachePool.push(...b),delete this.proxyCachedFBO[a]}}deallocRenderCache(){this.renderCache.forEach(a=>a.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class iA extends i.OverscaledTileID{constructor(a,m,b){super(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y),this.proxyTileKey=m,this.projMatrix=b}}class nA extends i.Elevation{constructor(a,m){super(),this.painter=a,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[b,S,P]=function(ee){const pe=new i.StructArrayLayout4i8,fe=new i.StructArrayLayout3ui6,Me=131;pe.reserve(17161),fe.reserve(33800);const Ne=i.EXTENT/128,st=i.EXTENT+Ne/2,it=st+Ne;for(let qe=-Ne;qe<it;qe+=Ne)for(let Ye=-Ne;Ye<it;Ye+=Ne){const dt=Ye<0||Ye>st||qe<0||qe>st?24575:0,ht=i.clamp(Math.round(Ye),0,i.EXTENT),Bt=i.clamp(Math.round(qe),0,i.EXTENT);pe.emplaceBack(ht+dt,Bt,ht,Bt)}const lt=(qe,Ye)=>{const dt=Ye*Me+qe;fe.emplaceBack(dt+1,dt,dt+Me),fe.emplaceBack(dt+Me,dt+Me+1,dt+1)};for(let qe=1;qe<129;qe++)for(let Ye=1;Ye<129;Ye++)lt(Ye,qe);return[0,129].forEach(qe=>{for(let Ye=0;Ye<130;Ye++)lt(Ye,qe),lt(qe,Ye)}),[pe,fe,32768]}(),H=a.context;this.gridBuffer=H.createVertexBuffer(b,i.boundsAttributes.members),this.gridIndexBuffer=H.createIndexBuffer(S),this.gridSegments=i.SegmentVector.simpleSegment(0,0,b.length,S.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,b.length,P),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new xu(m.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,i.EXTENT,0,i.EXTENT,0,1);const W=H.gl;this._overlapStencilMode=new i.StencilMode({func:W.GEQUAL,mask:255},0,255,W.KEEP,W.KEEP,W.REPLACE),this._previousZoom=a.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=m,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new gr(m.map)}set style(a){a.on("data",this._onStyleDataEvent.bind(this)),a.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=a,this._checkRenderCacheEfficiency()}update(a,m,b){if(a&&a.terrain){this._style!==a&&(this.style=a),this.enabled=!0;const S=a.terrain.properties;this.sourceCache=a.terrain.drapeRenderMode===0?this._mockSourceCache:a._getSourceCache(S.get("source")),this._exaggeration=S.get("exaggeration");const P=()=>{this.sourceCache.used&&i.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
  4922. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const H=this.getScaledDemTileSize();this.sourceCache.update(m,H,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,P(),this._initializing=!0),P(),m.updateElevation(!0,b),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(a){this._findCoveringTileCache[a]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const a=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||a.efficiency!==100&&i.warnOnce(`Terrain render cache efficiency is not optimal (${a.efficiency}%) and performance
  4923. may be affected negatively, consider placing all background, fill and line layers before layer
  4924. with id '${a.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&a.dataType==="source"?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):a.dataType==="style"&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(a){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const m=this.proxySourceCache,b=this.painter.transform;this._initializing&&(this._initializing=b._centerAltitude===0&&this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(b.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const S=this.proxyCoords=m.getIds().map(ee=>{const pe=m.getTileByID(ee).tileID;return pe.projMatrix=b.calculateProjMatrix(pe.toUnwrapped()),pe});(function(ee,pe){const fe=pe.transform.pointCoordinate(pe.transform.getCameraPoint()),Me=new i.pointGeometry(fe.x,fe.y);ee.sort((Ne,st)=>{if(st.overscaledZ-Ne.overscaledZ)return st.overscaledZ-Ne.overscaledZ;const it=new i.pointGeometry(Ne.canonical.x+(1<<Ne.canonical.z)*Ne.wrap,Ne.canonical.y),lt=new i.pointGeometry(st.canonical.x+(1<<st.canonical.z)*st.wrap,st.canonical.y),qe=Me.mult(1<<Ne.canonical.z);return qe.x-=.5,qe.y-=.5,qe.distSqr(it)-qe.distSqr(lt)})})(S,this.painter),this._previousZoom=b.zoom;const P=this.proxyToSource||{};this.proxyToSource={},S.forEach(ee=>{this.proxyToSource[ee.key]={}}),this.terrainTileForTile={};const H=this._style._sourceCaches;for(const ee in H){const pe=H[ee];if(!pe.used||(pe!==this.sourceCache&&this.resetTileLookupCache(pe.id),this._setupProxiedCoordsForOrtho(pe,a[ee],P),pe.usedForTerrain))continue;const fe=a[ee];pe.getSource().reparseOverscaled&&this._assignTerrainTiles(fe)}this.proxiedCoords[m.id]=S.map(ee=>new iA(ee,ee.key,this.orthoMatrix)),this._assignTerrainTiles(S),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(P),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();const W={};this._visibleDemTiles=[];for(const ee of this.proxyCoords){const pe=this.terrainTileForTile[ee.key];if(!pe)continue;const fe=pe.tileID.key;fe in W||(this._visibleDemTiles.push(pe),W[fe]=fe)}}_assignTerrainTiles(a){this._initializing||a.forEach(m=>{if(this.terrainTileForTile[m.key])return;const b=this._findTileCoveringTileID(m,this.sourceCache);b&&(this.terrainTileForTile[m.key]=b)})}_prepareDEMTextures(){const a=this.painter.context,m=a.gl;for(const b in this.terrainTileForTile){const S=this.terrainTileForTile[b],P=S.dem;!P||S.demTexture&&!S.needsDEMTextureUpload||(a.activeTexture.set(m.TEXTURE1),Al(this.painter,S,P))}}_prepareDemTileUniforms(a,m,b,S){if(!m||m.demTexture==null)return!1;const P=a.tileID.canonical,H=Math.pow(2,m.tileID.canonical.z-P.z),W=S||"";return b[`u_dem_tl${W}`]=[P.x*H%1,P.y*H%1],b[`u_dem_scale${W}`]=H,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const a=this.painter.context,m=a.gl;if(!this._emptyDepthBufferTexture){const b=new i.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new i.Texture(a,b,m.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const m=this._visibleDemTiles.reduce((b,S)=>{if(!S.dem)return b;const P=S.dem.tree.minimums[0];return P>0&&a++,b+P},0);return a?m/a:0}_updateEmptyDEMTexture(){const a=this.painter.context,m=a.gl;a.activeTexture.set(m.TEXTURE2);const b=this._getLoadedAreaMinimum(),S=new i.RGBAImage({width:1,height:1},new Uint8Array(i.DEMData.pack(b,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let P=this._emptyDEMTexture;return P?P.update(S,{premultiply:!1}):P=this._emptyDEMTexture=new i.Texture(a,S,m.RGBA,{premultiply:!1}),P}setupElevationDraw(a,m,b){const S=this.painter.context,P=S.gl,H=(W=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(W),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var W;H.u_dem_size=this.sourceCache.getSource().tileSize,H.u_exaggeration=this.exaggeration();let ee=null,pe=null,fe=1;if(b&&b.morphing&&this._useVertexMorphing){const Me=b.morphing.srcDemTile,Ne=b.morphing.dstDemTile;fe=b.morphing.phase,Me&&Ne&&(this._prepareDemTileUniforms(a,Me,H,"_prev")&&(pe=Me),this._prepareDemTileUniforms(a,Ne,H)&&(ee=Ne))}if(pe&&ee?(S.activeTexture.set(P.TEXTURE2),ee.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE,P.NEAREST),S.activeTexture.set(P.TEXTURE4),pe.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE,P.NEAREST),H.u_dem_lerp=fe):(ee=this.terrainTileForTile[a.tileID.key],S.activeTexture.set(P.TEXTURE2),(this._prepareDemTileUniforms(a,ee,H)?ee.demTexture:this.emptyDEMTexture).bind(P.NEAREST,P.CLAMP_TO_EDGE)),S.activeTexture.set(P.TEXTURE3),b&&b.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE),this._depthFBO&&(H.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE),H.u_depth_size_inv=[1,1]),b&&b.useMeterToDem&&ee){const Me=(1<<ee.tileID.canonical.z)*i.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;H.u_meter_to_dem=Me}if(b&&b.labelPlaneMatrixInv&&(H.u_label_plane_matrix_inv=b.labelPlaneMatrixInv),m.setTerrainUniformValues(S,H),this.painter.transform.projection.name==="globe"){const Me=this.globeUniformValues(this.painter.transform,a.tileID.canonical,b&&b.useDenormalizedUpVectorScale);m.setGlobeUniformValues(S,Me)}}globeUniformValues(a,m,b){const S=a.projection;return{u_tile_tl_up:S.upVector(m,0,0),u_tile_tr_up:S.upVector(m,i.EXTENT,0),u_tile_br_up:S.upVector(m,i.EXTENT,i.EXTENT),u_tile_bl_up:S.upVector(m,0,i.EXTENT),u_tile_up_scale:b?i.GLOBE_METERS_TO_ECEF:S.upVectorScale(m,a.center.lat,a.worldSize).metersToTile}}renderToBackBuffer(a){const m=this.painter,b=this.painter.context;a.length!==0&&(b.bindFramebuffer.set(null),b.viewport.set([0,0,m.width,m.height]),m.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(S,P,H,W,ee){if(S.transform.projection.name==="globe")(function(pe,fe,Me,Ne,st){const it=pe.context,lt=it.gl;let qe,Ye;const dt=pe.options.showTerrainWireframe?2:0,ht=pe.transform,Bt=i.globeUseCustomAntiAliasing(pe,it,ht),Pt=(Ri,Ai)=>{if(Ye===Ri)return;const Mi=[Br[Ri],"PROJECTION_GLOBE_VIEW"];Bt&&Mi.push("CUSTOM_ANTIALIASING"),Ai&&Mi.push(Br[dt]),qe=pe.useProgram("globeRaster",null,Mi),Ye=Ri},It=pe.colorModeForRenderPass(),Ht=new i.DepthMode(lt.LEQUAL,i.DepthMode.ReadWrite,pe.depthRangeFor3D);hr.update(st);const hi=i.calculateGlobeMercatorMatrix(ht),si=[i.mercatorXfromLng(ht.center.lng),i.mercatorYfromLat(ht.center.lat)],qt=dt?[!1,!0]:[!1],ji=pe.globeSharedBuffers,Kt=[ht.width*i.exported.devicePixelRatio,ht.height*i.exported.devicePixelRatio],Ci=Float32Array.from(ht.globeMatrix),di={useDenormalizedUpVectorScale:!0};if(qt.forEach(Ri=>{Ye=-1;const Ai=Ri?lt.LINES:lt.TRIANGLES;for(const Mi of Ne){const $i=Me.getTile(Mi),Jt=i.StencilMode.disabled,pi=fe.prevTerrainTileForTile[Mi.key],In=fe.terrainTileForTile[Mi.key];Fh(pi,In)&&hr.newMorphing(Mi.key,pi,In,st,250),it.activeTexture.set(lt.TEXTURE0),$i.texture.bind(lt.LINEAR,lt.CLAMP_TO_EDGE);const Hn=hr.getMorphValuesForProxy(Mi.key),Mn=Hn?1:0;Hn&&i.extend$1(di,{morphing:{srcDemTile:Hn.from,dstDemTile:Hn.to,phase:i.easeCubicInOut(Hn.phase)}});const $n=i.tileCornersToBounds(Mi.canonical),lr=i.getLatitudinalLod($n.getCenter().lat),On=i.getGridMatrix(Mi.canonical,$n,lr,ht.worldSize/ht._pixelsPerMercatorPixel),_n=i.globeNormalizeECEF(i.globeTileBounds(Mi.canonical)),Dr=qr(ht.projMatrix,Ci,hi,_n,i.globeToMercatorTransition(ht.zoom),si,ht.frustumCorners.TL,ht.frustumCorners.TR,ht.frustumCorners.BR,ht.frustumCorners.BL,ht.globeCenterInViewSpace,ht.globeRadius,Kt,On);if(Pt(Mn,Ri),fe.setupElevationDraw($i,qe,di),pe.prepareDrawProgram(it,qe,Mi.toUnwrapped()),ji){const[Or,Nr,Qr]=Ri?ji.getWirefameBuffers(pe.context,lr):ji.getGridBuffers(lr);qe.draw(it,Ai,Ht,Jt,It,i.CullFaceMode.backCCW,Dr,"globe_raster",Or,Nr,Qr)}}}),ji){const Ri=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Bt&&Ri.push("CUSTOM_ANTIALIASING"),qe=pe.useProgram("globeRaster",null,Ri);for(const Ai of Ne){const{x:Mi,y:$i,z:Jt}=Ai.canonical,pi=$i===0,In=$i===(1<<Jt)-1,[Hn,Mn,$n,lr]=ji.getPoleBuffers(Jt);if(lr&&(pi||In)){const On=Me.getTile(Ai);it.activeTexture.set(lt.TEXTURE0),On.texture.bind(lt.LINEAR,lt.CLAMP_TO_EDGE);let _n=i.globePoleMatrixForTile(Jt,Mi,ht);const Dr=i.globeNormalizeECEF(i.globeTileBounds(Ai.canonical)),Or=(Nr,Qr)=>Nr.draw(it,lt.TRIANGLES,Ht,i.StencilMode.disabled,It,i.CullFaceMode.disabled,qr(ht.projMatrix,_n,_n,Dr,0,si,ht.frustumCorners.TL,ht.frustumCorners.TR,ht.frustumCorners.BR,ht.frustumCorners.BL,ht.globeCenterInViewSpace,ht.globeRadius,Kt),"globe_pole_raster",Qr,$n,lr);fe.setupElevationDraw(On,qe,di),pe.prepareDrawProgram(it,qe,Ai.toUnwrapped()),pi&&Or(qe,Hn),In&&(_n=i.scale(i.create(),_n,[1,-1,1]),Or(qe,Mn))}}}})(S,P,H,W,ee);else{const pe=S.context,fe=pe.gl;let Me,Ne;const st=S.options.showTerrainWireframe?2:0,it=(ht,Bt)=>{if(Ne===ht)return;const Pt=[Br[ht]];Bt&&Pt.push(Br[st]),Me=S.useProgram("terrainRaster",null,Pt),Ne=ht},lt=S.colorModeForRenderPass(),qe=new i.DepthMode(fe.LEQUAL,i.DepthMode.ReadWrite,S.depthRangeFor3D);hr.update(ee);const Ye=S.transform,dt=6*Math.pow(1.5,22-Ye.zoom)*P.exaggeration();(st?[!1,!0]:[!1]).forEach(ht=>{Ne=-1;const Bt=ht?fe.LINES:fe.TRIANGLES,[Pt,It]=ht?P.getWirefameBuffer():[P.gridIndexBuffer,P.gridSegments];for(const Ht of W){const hi=H.getTile(Ht),si=i.StencilMode.disabled,qt=P.prevTerrainTileForTile[Ht.key],ji=P.terrainTileForTile[Ht.key];Fh(qt,ji)&&hr.newMorphing(Ht.key,qt,ji,ee,250),pe.activeTexture.set(fe.TEXTURE0),hi.texture.bind(fe.LINEAR,fe.CLAMP_TO_EDGE,fe.LINEAR_MIPMAP_NEAREST);const Kt=hr.getMorphValuesForProxy(Ht.key),Ci=Kt?1:0;let di;Kt&&(di={morphing:{srcDemTile:Kt.from,dstDemTile:Kt.to,phase:i.easeCubicInOut(Kt.phase)}});const Ri=dl(Ht.projMatrix,jr(Ht.canonical,Ye.renderWorldCopies)?dt/10:dt);it(Ci,ht),P.setupElevationDraw(hi,Me,di),S.prepareDrawProgram(pe,Me,Ht.toUnwrapped()),Me.draw(pe,Bt,qe,si,lt,i.CullFaceMode.backCCW,Ri,"terrain_raster",P.gridBuffer,Pt,It)}})}}(m,this,this.proxySourceCache,a,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),a.splice(0,a.length))}renderBatch(a){if(this._drapedRenderBatches.length===0)return a+1;this.renderingToTexture=!0;const m=this.painter,b=this.painter.context,S=this.proxySourceCache,P=this.proxiedCoords[S.id],H=this._drapedRenderBatches.shift(),W=[],ee=m.style.order;let pe=0;for(const fe of P){const Me=S.getTileByID(fe.proxyTileKey),Ne=S.proxyCachedFBO[fe.key]?S.proxyCachedFBO[fe.key][a]:void 0,st=Ne!==void 0?S.renderCache[Ne]:this.pool[pe++],it=Ne!==void 0;if(Me.texture=st.tex,it&&!st.dirty){W.push(Me.tileID);continue}let lt;b.bindFramebuffer.set(st.fb.framebuffer),this.renderedToTile=!1,st.dirty&&(b.clear({color:i.Color.transparent,stencil:0}),st.dirty=!1);for(let qe=H.start;qe<=H.end;++qe){const Ye=m.style._layers[ee[qe]];if(Ye.isHidden(m.transform.zoom))continue;const dt=m.style._getLayerSourceCache(Ye),ht=dt?this.proxyToSource[fe.key][dt.id]:[fe];if(!ht)continue;const Bt=ht;b.viewport.set([0,0,st.fb.width,st.fb.height]),lt!==(dt?dt.id:null)&&(this._setupStencil(st,ht,Ye,dt),lt=dt?dt.id:null),m.renderLayer(m,dt,Ye,Bt)}this.renderedToTile?(st.dirty=!0,W.push(Me.tileID)):it||--pe,pe===5&&(pe=0,this.renderToBackBuffer(W))}return this.renderToBackBuffer(W),this.renderingToTexture=!1,b.bindFramebuffer.set(null),b.viewport.set([0,0,m.width,m.height]),H.end+1}postRender(){}renderCacheEfficiency(a){const m=a.order.length;if(m===0)return{efficiency:100};let b,S=0,P=0,H=!1;for(let W=0;W<m;++W){const ee=a._layers[a.order[W]];this._style.isLayerDraped(ee)?(H&&++S,++P):H||(H=!0,b=ee.id)}return P===0?{efficiency:100}:{efficiency:100*(1-S/P),firstUndrapedLayer:b}}getMinElevationBelowMSL(){let a=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{a=Math.min(a,m.dem.tree.minimums[0])}),a===0?a:(a-30)*this._exaggeration}raycast(a,m,b){if(!this._visibleDemTiles)return null;const S=this._visibleDemTiles.filter(P=>P.dem).map(P=>{const H=P.tileID,W=1<<H.overscaledZ,{x:ee,y:pe}=H.canonical,fe=ee/W,Me=(ee+1)/W,Ne=pe/W,st=(pe+1)/W;return{minx:fe,miny:Ne,maxx:Me,maxy:st,t:P.dem.tree.raycastRoot(fe,Ne,Me,st,a,m,b),tile:P}});S.sort((P,H)=>(P.t!==null?P.t:Number.MAX_VALUE)-(H.t!==null?H.t:Number.MAX_VALUE));for(const P of S){if(P.t==null)return null;const H=P.tile.dem.tree.raycast(P.minx,P.miny,P.maxx,P.maxy,a,m,b);if(H!=null)return H}return null}_createFBO(){const a=this.painter.context,m=a.gl,b=this.drapeBufferSize;a.activeTexture.set(m.TEXTURE0);const S=new i.Texture(a,{width:b[0],height:b[1],data:null},m.RGBA);S.bind(m.LINEAR,m.CLAMP_TO_EDGE);const P=a.createFramebuffer(b[0],b[1],!1);return P.colorAttachment.set(S.texture),P.depthAttachment=new Rs(a,P.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=a.createRenderbuffer(a.gl.DEPTH_STENCIL,b[0],b[1]),this._stencilRef=0,P.depthAttachment.set(this._sharedDepthStencil),a.clear({stencil:0})):P.depthAttachment.set(this._sharedDepthStencil),a.extTextureFilterAnisotropic&&!a.extTextureFilterAnisotropicForceOff&&m.texParameterf(m.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax),{fb:P,tex:S,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.light&&this._style.light.hasTransition())return!0;for(const a in this._style._sourceCaches)if(this._style._sourceCaches[a].hasTransition())return!0;return this._style.order.some(a=>{const m=this._style._layers[a],b=m.isHidden(this.painter.transform.zoom);return m.type!=="custom"&&!b&&m.hasTransition()})}_clearRasterFadeFromRenderCache(){let a=!1;for(const m in this._style._sourceCaches)if(this._style._sourceCaches[m]._source instanceof Pe){a=!0;break}if(a)for(let m=0;m<this._style.order.length;++m){const b=this._style._layers[this._style.order[m]],S=b.isHidden(this.painter.transform.zoom),P=this._style._getLayerSourceCache(b);if(b.type!=="raster"||S||!P)continue;const H=b.paint.get("raster-fade-duration");for(const W of this.proxyCoords){const ee=this.proxyToSource[W.key][P.id];if(ee)for(const pe of ee){const fe=Hl(P.getTile(pe),P.findLoadedParent(pe,0),P,this.painter.transform,H);(fe.opacity!==1||fe.mix!==0)&&this._clearRenderCacheForTile(P.id,pe)}}}}_setupDrapedRenderBatches(){const a=this._style.order,m=a.length;if(m===0)return;const b=[];let S,P=0,H=this._style._layers[a[P]];for(;!this._style.isLayerDraped(H)&&H.isHidden(this.painter.transform.zoom)&&++P<m;)H=this._style._layers[a[P]];for(;P<m;++P){const W=this._style._layers[a[P]];W.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(W)?S===void 0&&(S=P):S!==void 0&&(b.push({start:S,end:P-1}),S=void 0))}S!==void 0&&b.push({start:S,end:P-1}),this._drapedRenderBatches=b}_setupRenderCache(a){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const H=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let W=0;W<H.length;++W){const ee=Object.values(H[W]);m.renderCachePool.push(...ee)}}return}this._clearRasterFadeFromRenderCache();const b=this.proxyCoords,S=this._tilesDirty;for(let H=b.length-1;H>=0;H--){const W=b[H];if(m.getTileByID(W.key),m.proxyCachedFBO[W.key]!==void 0){const ee=a[W.key],pe=this.proxyToSource[W.key];let fe=0;for(const Me in pe){const Ne=pe[Me],st=ee[Me];if(!st||st.length!==Ne.length||Ne.some((it,lt)=>it!==st[lt]||S[Me]&&S[Me].hasOwnProperty(it.key))){fe=-1;break}++fe}for(const Me in m.proxyCachedFBO[W.key])m.renderCache[m.proxyCachedFBO[W.key][Me]].dirty=fe<0||fe!==Object.values(ee).length}}const P=[...this._drapedRenderBatches];P.sort((H,W)=>W.end-W.start-(H.end-H.start));for(const H of P)for(const W of b){if(m.proxyCachedFBO[W.key])continue;let ee=m.renderCachePool.pop();ee===void 0&&m.renderCache.length<50&&(ee=m.renderCache.length,m.renderCache.push(this._createFBO())),ee!==void 0&&(m.proxyCachedFBO[W.key]={},m.proxyCachedFBO[W.key][H.start]=ee,m.renderCache[ee].dirty=!0)}this._tilesDirty={}}_setupStencil(a,m,b,S){if(!S||!this._sourceTilesOverlap[S.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const P=this.painter.context,H=P.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let W;if(b.isTileClipped())W=m.length,this._overlapStencilMode.test={func:H.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(m[0].overscaledZ>m[m.length-1].overscaledZ))return void(this._overlapStencilType=!1);W=1,this._overlapStencilMode.test={func:H.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+W>255&&(P.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=W,this._overlapStencilMode.ref=this._stencilRef,b.isTileClipped()&&this._renderTileClippingMasks(m,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(a){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[a.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(a,m){const b=this.painter,S=this.painter.context,P=S.gl;b._tileClippingMaskIDs={},S.setColorMode(i.ColorMode.disabled),S.setDepthMode(i.DepthMode.disabled);const H=b.useProgram("clippingMask");for(const W of a){const ee=b._tileClippingMaskIDs[W.key]=--m;H.draw(S,P.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:P.ALWAYS,mask:0},ee,255,P.KEEP,P.KEEP,P.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,$r(W.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(a){const m=this.painter.transform;if(a.x<0||a.x>m.width||a.y<0||a.y>m.height)return null;const b=[a.x,a.y,1,1];i.transformMat4$1(b,b,m.pixelMatrixInverse),i.scale$1(b,b,1/b[3]),b[0]/=m.worldSize,b[1]/=m.worldSize;const S=m._camera.position,P=i.mercatorZfromAltitude(1,m.center.lat),H=[S[0],S[1],S[2]/P,0],W=i.subtract([],b.slice(0,3),H);i.normalize(W,W);const ee=this.raycast(H,W,this._exaggeration);return ee!==null&&ee?(i.scaleAndAdd(H,H,W,ee),H[3]=H[2],H[2]*=P,H):null}drawDepth(){const a=this.painter,m=a.context,b=this.proxySourceCache,S=Math.ceil(a.width),P=Math.ceil(a.height);if(!this._depthFBO||this._depthFBO.width===S&&this._depthFBO.height===P||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const H=m.gl,W=m.createFramebuffer(S,P,!0);m.activeTexture.set(H.TEXTURE0);const ee=new i.Texture(m,{width:S,height:P,data:null},H.RGBA);ee.bind(H.NEAREST,H.CLAMP_TO_EDGE),W.colorAttachment.set(ee.texture);const pe=m.createRenderbuffer(m.gl.DEPTH_COMPONENT16,S,P);W.depthAttachment.set(pe),this._depthFBO=W,this._depthTexture=ee}m.bindFramebuffer.set(this._depthFBO.framebuffer),m.viewport.set([0,0,S,P]),function(H,W,ee,pe){if(H.transform.projection.name==="globe")return;const fe=H.context,Me=fe.gl;fe.clear({depth:1});const Ne=H.useProgram("terrainDepth"),st=new i.DepthMode(Me.LESS,i.DepthMode.ReadWrite,H.depthRangeFor3D);for(const it of pe){const lt=ee.getTile(it),qe=dl(it.projMatrix,0);W.setupElevationDraw(lt,Ne),Ne.draw(fe,Me.TRIANGLES,st,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,qe,"terrain_depth",W.gridBuffer,W.gridIndexBuffer,W.gridNoSkirtSegments)}}(a,this,b,this.proxyCoords)}_setupProxiedCoordsForOrtho(a,m,b){if(a.getSource()instanceof X)return this._setupProxiedCoordsForImageSource(a,m,b);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const S=this.proxiedCoords[a.id]=[],P=this.proxyCoords;for(let W=0;W<P.length;W++){const ee=P[W],pe=this._findTileCoveringTileID(ee,a);if(pe){const fe=this._createProxiedId(ee,pe,b[ee.key]&&b[ee.key][a.id]);S.push(fe),this.proxyToSource[ee.key][a.id]=[fe]}}let H=!1;for(let W=0;W<m.length;W++){const ee=a.getTile(m[W]);if(!ee||!ee.hasData())continue;const pe=this._findTileCoveringTileID(ee.tileID,this.proxySourceCache);if(pe&&pe.tileID.canonical.z!==ee.tileID.canonical.z){const fe=this.proxyToSource[pe.tileID.key][a.id],Me=this._createProxiedId(pe.tileID,ee,b[pe.tileID.key]&&b[pe.tileID.key][a.id]);fe?fe.splice(fe.length-1,0,Me):this.proxyToSource[pe.tileID.key][a.id]=[Me],S.push(Me),H=!0}}this._sourceTilesOverlap[a.id]=H}_setupProxiedCoordsForImageSource(a,m,b){if(!a.getSource().loaded())return;const S=this.proxiedCoords[a.id]=[],P=this.proxyCoords,H=a.getSource(),W=new i.pointGeometry(H.tileID.x,H.tileID.y)._div(1<<H.tileID.z),ee=H.coordinates.map(i.MercatorCoordinate.fromLngLat).reduce((fe,Me)=>(fe.min.x=Math.min(fe.min.x,Me.x-W.x),fe.min.y=Math.min(fe.min.y,Me.y-W.y),fe.max.x=Math.max(fe.max.x,Me.x-W.x),fe.max.y=Math.max(fe.max.y,Me.y-W.y),fe),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),pe=(fe,Me)=>{const Ne=fe.wrap+fe.canonical.x/(1<<fe.canonical.z),st=fe.canonical.y/(1<<fe.canonical.z),it=i.EXTENT/(1<<fe.canonical.z),lt=Me.wrap+Me.canonical.x/(1<<Me.canonical.z),qe=Me.canonical.y/(1<<Me.canonical.z);return Ne+it<lt+ee.min.x||Ne>lt+ee.max.x||st+it<qe+ee.min.y||st>qe+ee.max.y};for(let fe=0;fe<P.length;fe++){const Me=P[fe];for(let Ne=0;Ne<m.length;Ne++){const st=a.getTile(m[Ne]);if(!st||!st.hasData()||pe(Me,st.tileID))continue;const it=this._createProxiedId(Me,st,b[Me.key]&&b[Me.key][a.id]),lt=this.proxyToSource[Me.key][a.id];lt?lt.push(it):this.proxyToSource[Me.key][a.id]=[it],S.push(it)}}}_createProxiedId(a,m,b){let S=this.orthoMatrix;if(b){const P=b.find(H=>H.key===m.tileID.key);if(P)return P}if(m.tileID.key!==a.key){const P=a.canonical.z-m.tileID.canonical.z;let H,W,ee;S=i.create();const pe=m.tileID.wrap-a.wrap<<a.overscaledZ;P>0?(H=i.EXTENT>>P,W=H*((m.tileID.canonical.x<<P)-a.canonical.x+pe),ee=H*((m.tileID.canonical.y<<P)-a.canonical.y)):(H=i.EXTENT<<-P,W=i.EXTENT*(m.tileID.canonical.x-(a.canonical.x+pe<<-P)),ee=i.EXTENT*(m.tileID.canonical.y-(a.canonical.y<<-P))),i.ortho(S,0,H,0,H,0,1),i.translate(S,S,[W,ee,0])}return new iA(m.tileID,a.key,S)}_findTileCoveringTileID(a,m){let b=m.getTile(a);if(b&&b.hasData())return b;const S=this._findCoveringTileCache[m.id],P=S[a.key];if(b=P?m.getTileByID(P):null,b&&b.hasData()||P===null)return b;let H=b?b.tileID:a,W=H.overscaledZ;const ee=m.getSource().minzoom,pe=[];if(!P){const Me=m.getSource().maxzoom;if(a.canonical.z>=Me){const Ne=a.canonical.z-Me;m.getSource().reparseOverscaled?(W=Math.max(a.canonical.z+2,m.transform.tileZoom),H=new i.OverscaledTileID(W,a.wrap,Me,a.canonical.x>>Ne,a.canonical.y>>Ne)):Ne!==0&&(W=Me,H=new i.OverscaledTileID(W,a.wrap,Me,a.canonical.x>>Ne,a.canonical.y>>Ne))}H.key!==a.key&&(pe.push(H.key),b=m.getTile(H))}const fe=Me=>{pe.forEach(Ne=>{S[Ne]=Me}),pe.length=0};for(W-=1;W>=ee&&(!b||!b.hasData());W--){b&&fe(b.tileID.key);const Me=H.calculateScaledKey(W);if(b=m.getTileByID(Me),b&&b.hasData())break;const Ne=S[Me];if(Ne===null)break;Ne===void 0?pe.push(Me):b=m.getTileByID(Ne)}return fe(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(a,m){let b=this._tilesDirty[a];b||(b=this._tilesDirty[a]={}),b[m.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const a=function(m){let b=0;const S=new i.StructArrayLayout2ui4,P=131;for(let H=1;H<129;H++){for(let W=1;W<129;W++)b=H*P+W,S.emplaceBack(b,b+1),S.emplaceBack(b,b+P),S.emplaceBack(b+1,b+P),H===128&&S.emplaceBack(b+P,b+P+1);S.emplaceBack(b+1,b+1+P)}return S}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(a),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,a.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class rA{static cacheKey(a,m,b,S){let P=`${m}${S?S.cacheKey:""}`;for(const H of b)a.usedDefines.includes(H)&&(P+=`/${H}`);return P}constructor(a,m,b,S,P,H){const W=a.gl;this.program=W.createProgram();const ee=function(qe){const Ye=[];for(let dt=0;dt<qe.length;dt++){if(qe[dt]===null)continue;const ht=qe[dt].split(" ");Ye.push(ht.pop())}return Ye}(b.staticAttributes),pe=S?S.getBinderAttributes():[],fe=ee.concat(pe);let Me=S?S.defines():[];Me=Me.concat(H.map(qe=>`#define ${qe}`));const Ne=Me.concat(a.extStandardDerivatives?`#extension GL_OES_standard_derivatives : enable
  4925. `.concat(uc):uc,uc,td,tA.fragmentSource,_u.fragmentSource,b.fragmentSource).join(`
  4926. `),st=Me.concat(`
  4927. #ifdef GL_ES
  4928. precision highp float;
  4929. #else
  4930. #if !defined(lowp)
  4931. #define lowp
  4932. #endif
  4933. #if !defined(mediump)
  4934. #define mediump
  4935. #endif
  4936. #if !defined(highp)
  4937. #define highp
  4938. #endif
  4939. #endif`,td,tA.vertexSource,_u.vertexSource,ed.vertexSource,b.vertexSource).join(`
  4940. `),it=W.createShader(W.FRAGMENT_SHADER);if(W.isContextLost())return void(this.failedToCreate=!0);W.shaderSource(it,Ne),W.compileShader(it),W.attachShader(this.program,it);const lt=W.createShader(W.VERTEX_SHADER);if(W.isContextLost())this.failedToCreate=!0;else{W.shaderSource(lt,st),W.compileShader(lt),W.attachShader(this.program,lt),this.attributes={},this.numAttributes=fe.length;for(let qe=0;qe<this.numAttributes;qe++)fe[qe]&&(W.bindAttribLocation(this.program,qe,fe[qe]),this.attributes[fe[qe]]=qe);W.linkProgram(this.program),W.deleteShader(lt),W.deleteShader(it),this.fixedUniforms=P(a),this.binderUniforms=S?S.getUniforms(a):[],H.includes("TERRAIN")&&(this.terrainUniforms=(qe=>({u_dem:new i.Uniform1i(qe),u_dem_prev:new i.Uniform1i(qe),u_dem_unpack:new i.Uniform4f(qe),u_dem_tl:new i.Uniform2f(qe),u_dem_scale:new i.Uniform1f(qe),u_dem_tl_prev:new i.Uniform2f(qe),u_dem_scale_prev:new i.Uniform1f(qe),u_dem_size:new i.Uniform1f(qe),u_dem_lerp:new i.Uniform1f(qe),u_exaggeration:new i.Uniform1f(qe),u_depth:new i.Uniform1i(qe),u_depth_size_inv:new i.Uniform2f(qe),u_meter_to_dem:new i.Uniform1f(qe),u_label_plane_matrix_inv:new i.UniformMatrix4f(qe)}))(a)),H.includes("GLOBE")&&(this.globeUniforms=(qe=>({u_tile_tl_up:new i.Uniform3f(qe),u_tile_tr_up:new i.Uniform3f(qe),u_tile_br_up:new i.Uniform3f(qe),u_tile_bl_up:new i.Uniform3f(qe),u_tile_up_scale:new i.Uniform1f(qe)}))(a)),H.includes("FOG")&&(this.fogUniforms=(qe=>({u_fog_matrix:new i.UniformMatrix4f(qe),u_fog_range:new i.Uniform2f(qe),u_fog_color:new i.Uniform4f(qe),u_fog_horizon_blend:new i.Uniform1f(qe),u_fog_temporal_offset:new i.Uniform1f(qe),u_frustum_tl:new i.Uniform3f(qe),u_frustum_tr:new i.Uniform3f(qe),u_frustum_br:new i.Uniform3f(qe),u_frustum_bl:new i.Uniform3f(qe),u_globe_pos:new i.Uniform3f(qe),u_globe_radius:new i.Uniform1f(qe),u_globe_transition:new i.Uniform1f(qe),u_is_globe:new i.Uniform1i(qe),u_viewport:new i.Uniform2f(qe)}))(a))}}setTerrainUniformValues(a,m){if(!this.terrainUniforms)return;const b=this.terrainUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const S in m)b[S]&&b[S].set(this.program,S,m[S])}}setGlobeUniformValues(a,m){if(!this.globeUniforms)return;const b=this.globeUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const S in m)b[S]&&b[S].set(this.program,S,m[S])}}setFogUniformValues(a,m){if(!this.fogUniforms)return;const b=this.fogUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const S in m)b[S].set(this.program,S,m[S])}}draw(a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt){const qe=a.gl;if(this.failedToCreate)return;a.program.set(this.program),a.setDepthMode(b),a.setStencilMode(S),a.setColorMode(P),a.setCullFace(H);for(const dt of Object.keys(this.fixedUniforms))this.fixedUniforms[dt].set(this.program,dt,W[dt]);it&&it.setUniforms(this.program,a,this.binderUniforms,Ne,{zoom:st});const Ye={[qe.LINES]:2,[qe.TRIANGLES]:3,[qe.LINE_STRIP]:1}[m];for(const dt of Me.get()){const ht=dt.vaos||(dt.vaos={});(ht[ee]||(ht[ee]=new Ac)).bind(a,this,pe,it?it.getPaintVertexBuffers():[],fe,dt.vertexOffset,lt||[]),qe.drawElements(m,dt.primitiveLength*Ye,qe.UNSIGNED_SHORT,dt.primitiveOffset*Ye*2)}}}function dc(x,a){const m=Math.pow(2,a.tileID.overscaledZ),b=a.tileSize*Math.pow(2,x.transform.tileZoom)/m,S=b*(a.tileID.canonical.x+a.tileID.wrap*m),P=b*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_tile_units_to_pixels:1/nt(a,1,x.transform.tileZoom),u_pixel_coord_upper:[S>>16,P>>16],u_pixel_coord_lower:[65535&S,65535&P]}}const Vc=i.create(),Hc=(x,a,m,b,S,P,H,W,ee,pe,fe)=>{const Me=a.style.light,Ne=Me.properties.get("position"),st=[Ne.x,Ne.y,Ne.z],it=i.create$1();Me.properties.get("anchor")==="viewport"&&(i.fromRotation(it,-a.transform.angle),i.transformMat3(st,st,it));const lt=Me.properties.get("color"),qe=a.transform,Ye={u_matrix:x,u_lightpos:st,u_lightintensity:Me.properties.get("intensity"),u_lightcolor:[lt.r,lt.g,lt.b],u_vertical_gradient:+m,u_opacity:b,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Vc,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:S,u_edge_radius:P};return qe.projection.name==="globe"&&(Ye.u_tile_id=[H.canonical.x,H.canonical.y,1<<H.canonical.z],Ye.u_zoom_transition=ee,Ye.u_inv_rot_matrix=fe,Ye.u_merc_center=pe,Ye.u_up_dir=qe.projection.upVector(new i.CanonicalTileID(0,0,0),pe[0]*i.EXTENT,pe[1]*i.EXTENT),Ye.u_height_lift=W),Ye},Lh=(x,a,m,b,S,P,H,W,ee,pe,fe,Me)=>{const Ne=Hc(x,a,m,b,S,P,H,ee,pe,fe,Me),st={u_height_factor:-Math.pow(2,H.overscaledZ)/W.tileSize/8};return i.extend(Ne,dc(a,W),st)},Gc=x=>({u_matrix:x}),Dh=(x,a,m)=>i.extend(Gc(x),dc(a,m)),Wc=(x,a)=>({u_matrix:x,u_world:a}),jc=(x,a,m,b)=>i.extend(Dh(x,a,m),{u_world:b}),la=i.create(),sA=(x,a,m,b,S,P)=>{const H=x.transform,W=H.projection.name==="globe";let ee;if(P.paint.get("circle-pitch-alignment")==="map")if(W){const fe=i.globePixelsToTileUnits(H.zoom,a.canonical)*H._pixelsPerMercatorPixel;ee=Float32Array.from([fe,0,0,fe])}else ee=H.calculatePixelsToTileUnitsMatrix(m);else ee=new Float32Array([H.pixelsToGLUnits[0],0,0,H.pixelsToGLUnits[1]]);const pe={u_camera_to_center_distance:H.cameraToCenterDistance,u_matrix:x.translatePosMatrix(a.projMatrix,m,P.paint.get("circle-translate"),P.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:ee,u_inv_rot_matrix:la,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(W){pe.u_inv_rot_matrix=b,pe.u_merc_center=S,pe.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],pe.u_zoom_transition=i.globeToMercatorTransition(H.zoom);const fe=S[0]*i.EXTENT,Me=S[1]*i.EXTENT;pe.u_up_dir=H.projection.upVector(new i.CanonicalTileID(0,0,0),fe,Me)}return pe},oA=x=>{const a=[];return x.paint.get("circle-pitch-alignment")==="map"&&a.push("PITCH_WITH_MAP"),x.paint.get("circle-pitch-scale")==="map"&&a.push("SCALE_WITH_MAP"),a},Kc=(x,a,m,b)=>{const S=i.EXTENT/m.tileSize;return{u_matrix:x,u_camera_to_center_distance:a.getCameraToCenterDistance(b),u_extrude_scale:[a.pixelsToGLUnits[0]/S,a.pixelsToGLUnits[1]/S]}},ca=(x,a,m=1)=>({u_matrix:x,u_color:a,u_overlay:0,u_overlay_scale:m}),$c=i.create(),pl=(x,a,m,b,S,P,H)=>{const W=x.transform,ee=W.projection.name==="globe",pe=ee?i.globePixelsToTileUnits(W.zoom,a.canonical)*W._pixelsPerMercatorPixel:nt(m,1,P),fe={u_matrix:a.projMatrix,u_extrude_scale:pe,u_intensity:H,u_inv_rot_matrix:$c,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(ee){fe.u_inv_rot_matrix=b,fe.u_merc_center=S,fe.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],fe.u_zoom_transition=i.globeToMercatorTransition(W.zoom);const Me=S[0]*i.EXTENT,Ne=S[1]*i.EXTENT;fe.u_up_dir=W.projection.upVector(new i.CanonicalTileID(0,0,0),Me,Ne)}return fe},aA=(x,a,m,b,S,P,H)=>{const W=x.transform,ee=W.calculatePixelsToTileUnitsMatrix(a);return{u_matrix:vu(x,a,m,b),u_pixels_to_tile_units:ee,u_device_pixel_ratio:P,u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:S,u_texsize:Gl(m)?a.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Ph(a,x.transform),u_alpha_discard_threshold:0,u_trim_offset:H}},Ho=(x,a,m,b,S)=>{const P=x.transform;return{u_matrix:vu(x,a,m,b),u_texsize:a.imageAtlasTexture.size,u_pixels_to_tile_units:P.calculatePixelsToTileUnitsMatrix(a),u_device_pixel_ratio:S,u_image:0,u_tile_units_to_pixels:Ph(a,P),u_units_to_pixels:[1/P.pixelsToGLUnits[0],1/P.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Ph(x,a){return 1/nt(x,1,a.tileZoom)}function vu(x,a,m,b){return x.translatePosMatrix(b||a.tileID.projMatrix,a,m.paint.get("line-translate"),m.paint.get("line-translate-anchor"))}function Gl(x){const a=x.paint.get("line-dasharray").value;return a.value||a.kind!=="constant"}const wu=(x,a,m,b,S,P)=>{return{u_matrix:x,u_tl_parent:a,u_scale_parent:m,u_fade_t:b.mix,u_opacity:b.opacity*S.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:S.paint.get("raster-brightness-min"),u_brightness_high:S.paint.get("raster-brightness-max"),u_saturation_factor:(W=S.paint.get("raster-saturation"),W>0?1-1/(1.001-W):-W),u_contrast_factor:(H=S.paint.get("raster-contrast"),H>0?1/(1-H):1+H),u_spin_weights:Zc(S.paint.get("raster-hue-rotate")),u_perspective_transform:P};var H,W};function Zc(x){x*=Math.PI/180;const a=Math.sin(x),m=Math.cos(x);return[(2*m+1)/3,(-Math.sqrt(3)*a-m+1)/3,(Math.sqrt(3)*a-m+1)/3]}const Xc=i.create(),fl=(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt)=>{const qe=S.transform,Ye={u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:qe.cameraToCenterDistance,u_rotate_symbol:+m,u_aspect_ratio:qe.width/qe.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:H,u_coord_matrix:W,u_is_text:+ee,u_pitch_with_map:+b,u_texsize:pe,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Xc,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Xc,u_up_vector:[0,-1,0]};return lt.name==="globe"&&(Ye.u_tile_id=[fe.canonical.x,fe.canonical.y,1<<fe.canonical.z],Ye.u_zoom_transition=Me,Ye.u_inv_rot_matrix=st,Ye.u_merc_center=Ne,Ye.u_camera_forward=qe._camera.forward(),Ye.u_ecef_origin=i.globeECEFOrigin(qe.globeMatrix,fe.toUnwrapped()),Ye.u_tile_matrix=Float32Array.from(qe.globeMatrix),Ye.u_up_vector=it),Ye},qc=(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt,qe)=>i.extend(fl(x,a,m,b,S,P,H,W,ee,pe,Me,Ne,st,it,lt,qe),{u_gamma_scale:b?S.transform.cameraToCenterDistance*Math.cos(S.terrain?0:S.transform._pitch):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+fe}),Uh=(x,a,m,b,S,P,H,W,ee,pe,fe,Me,Ne,st,it,lt)=>i.extend(qc(x,a,m,b,S,P,H,W,!0,ee,!0,fe,Me,Ne,st,it,lt),{u_texsize_icon:pe,u_texture_icon:1}),Rh=(x,a,m)=>({u_matrix:x,u_opacity:a,u_color:m}),bu=(x,a,m,b,S)=>i.extend(function(P,H,W){const ee=H.imageManager.getPattern(P.toString()),{width:pe,height:fe}=H.imageManager.getPixelSize(),Me=Math.pow(2,W.tileID.overscaledZ),Ne=W.tileSize*Math.pow(2,H.transform.tileZoom)/Me,st=Ne*(W.tileID.canonical.x+W.tileID.wrap*Me),it=Ne*W.tileID.canonical.y;return{u_image:0,u_pattern_tl:ee.tl,u_pattern_br:ee.br,u_texsize:[pe,fe],u_pattern_size:ee.displaySize,u_tile_units_to_pixels:1/nt(W,1,H.transform.tileZoom),u_pixel_coord_upper:[st>>16,it>>16],u_pixel_coord_lower:[65535&st,65535&it]}}(b,m,S),{u_matrix:x,u_opacity:a}),id={fillExtrusion:x=>({u_matrix:new i.UniformMatrix4f(x),u_lightpos:new i.Uniform3f(x),u_lightintensity:new i.Uniform1f(x),u_lightcolor:new i.Uniform3f(x),u_vertical_gradient:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x),u_edge_radius:new i.Uniform1f(x),u_ao:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_up_dir:new i.Uniform3f(x),u_height_lift:new i.Uniform1f(x)}),fillExtrusionPattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_lightpos:new i.Uniform3f(x),u_lightintensity:new i.Uniform1f(x),u_lightcolor:new i.Uniform3f(x),u_vertical_gradient:new i.Uniform1f(x),u_height_factor:new i.Uniform1f(x),u_edge_radius:new i.Uniform1f(x),u_ao:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_up_dir:new i.Uniform3f(x),u_height_lift:new i.Uniform1f(x),u_image:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x)}),fill:x=>({u_matrix:new i.UniformMatrix4f(x)}),fillPattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_image:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x)}),fillOutline:x=>({u_matrix:new i.UniformMatrix4f(x),u_world:new i.Uniform2f(x)}),fillOutlinePattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_world:new i.Uniform2f(x),u_image:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x)}),circle:x=>({u_camera_to_center_distance:new i.Uniform1f(x),u_extrude_scale:new i.UniformMatrix2f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_up_dir:new i.Uniform3f(x)}),collisionBox:x=>({u_matrix:new i.UniformMatrix4f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_extrude_scale:new i.Uniform2f(x)}),collisionCircle:x=>({u_matrix:new i.UniformMatrix4f(x),u_inv_matrix:new i.UniformMatrix4f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_viewport_size:new i.Uniform2f(x)}),debug:x=>({u_color:new i.UniformColor(x),u_matrix:new i.UniformMatrix4f(x),u_overlay:new i.Uniform1i(x),u_overlay_scale:new i.Uniform1f(x)}),clippingMask:x=>({u_matrix:new i.UniformMatrix4f(x)}),heatmap:x=>({u_extrude_scale:new i.Uniform1f(x),u_intensity:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_up_dir:new i.Uniform3f(x)}),heatmapTexture:x=>({u_image:new i.Uniform1i(x),u_color_ramp:new i.Uniform1i(x),u_opacity:new i.Uniform1f(x)}),hillshade:x=>({u_matrix:new i.UniformMatrix4f(x),u_image:new i.Uniform1i(x),u_latrange:new i.Uniform2f(x),u_light:new i.Uniform2f(x),u_shadow:new i.UniformColor(x),u_highlight:new i.UniformColor(x),u_accent:new i.UniformColor(x)}),hillshadePrepare:x=>({u_matrix:new i.UniformMatrix4f(x),u_image:new i.Uniform1i(x),u_dimension:new i.Uniform2f(x),u_zoom:new i.Uniform1f(x),u_unpack:new i.Uniform4f(x)}),line:x=>({u_matrix:new i.UniformMatrix4f(x),u_pixels_to_tile_units:new i.UniformMatrix2f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_units_to_pixels:new i.Uniform2f(x),u_dash_image:new i.Uniform1i(x),u_gradient_image:new i.Uniform1i(x),u_image_height:new i.Uniform1f(x),u_texsize:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x),u_alpha_discard_threshold:new i.Uniform1f(x),u_trim_offset:new i.Uniform2f(x)}),linePattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_texsize:new i.Uniform2f(x),u_pixels_to_tile_units:new i.UniformMatrix2f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_image:new i.Uniform1i(x),u_units_to_pixels:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x),u_alpha_discard_threshold:new i.Uniform1f(x)}),raster:x=>({u_matrix:new i.UniformMatrix4f(x),u_tl_parent:new i.Uniform2f(x),u_scale_parent:new i.Uniform1f(x),u_fade_t:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x),u_image0:new i.Uniform1i(x),u_image1:new i.Uniform1i(x),u_brightness_low:new i.Uniform1f(x),u_brightness_high:new i.Uniform1f(x),u_saturation_factor:new i.Uniform1f(x),u_contrast_factor:new i.Uniform1f(x),u_spin_weights:new i.Uniform3f(x),u_perspective_transform:new i.Uniform2f(x)}),symbolIcon:x=>({u_is_size_zoom_constant:new i.Uniform1i(x),u_is_size_feature_constant:new i.Uniform1i(x),u_size_t:new i.Uniform1f(x),u_size:new i.Uniform1f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_rotate_symbol:new i.Uniform1i(x),u_aspect_ratio:new i.Uniform1f(x),u_fade_change:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_label_plane_matrix:new i.UniformMatrix4f(x),u_coord_matrix:new i.UniformMatrix4f(x),u_is_text:new i.Uniform1i(x),u_pitch_with_map:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_camera_forward:new i.Uniform3f(x),u_tile_matrix:new i.UniformMatrix4f(x),u_up_vector:new i.Uniform3f(x),u_ecef_origin:new i.Uniform3f(x),u_texture:new i.Uniform1i(x)}),symbolSDF:x=>({u_is_size_zoom_constant:new i.Uniform1i(x),u_is_size_feature_constant:new i.Uniform1i(x),u_size_t:new i.Uniform1f(x),u_size:new i.Uniform1f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_rotate_symbol:new i.Uniform1i(x),u_aspect_ratio:new i.Uniform1f(x),u_fade_change:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_label_plane_matrix:new i.UniformMatrix4f(x),u_coord_matrix:new i.UniformMatrix4f(x),u_is_text:new i.Uniform1i(x),u_pitch_with_map:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_texture:new i.Uniform1i(x),u_gamma_scale:new i.Uniform1f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_tile_id:new i.Uniform3f(x),u_zoom_transition:new i.Uniform1f(x),u_inv_rot_matrix:new i.UniformMatrix4f(x),u_merc_center:new i.Uniform2f(x),u_camera_forward:new i.Uniform3f(x),u_tile_matrix:new i.UniformMatrix4f(x),u_up_vector:new i.Uniform3f(x),u_ecef_origin:new i.Uniform3f(x),u_is_halo:new i.Uniform1i(x)}),symbolTextAndIcon:x=>({u_is_size_zoom_constant:new i.Uniform1i(x),u_is_size_feature_constant:new i.Uniform1i(x),u_size_t:new i.Uniform1f(x),u_size:new i.Uniform1f(x),u_camera_to_center_distance:new i.Uniform1f(x),u_rotate_symbol:new i.Uniform1i(x),u_aspect_ratio:new i.Uniform1f(x),u_fade_change:new i.Uniform1f(x),u_matrix:new i.UniformMatrix4f(x),u_label_plane_matrix:new i.UniformMatrix4f(x),u_coord_matrix:new i.UniformMatrix4f(x),u_is_text:new i.Uniform1i(x),u_pitch_with_map:new i.Uniform1i(x),u_texsize:new i.Uniform2f(x),u_texsize_icon:new i.Uniform2f(x),u_texture:new i.Uniform1i(x),u_texture_icon:new i.Uniform1i(x),u_gamma_scale:new i.Uniform1f(x),u_device_pixel_ratio:new i.Uniform1f(x),u_is_halo:new i.Uniform1i(x)}),background:x=>({u_matrix:new i.UniformMatrix4f(x),u_opacity:new i.Uniform1f(x),u_color:new i.UniformColor(x)}),backgroundPattern:x=>({u_matrix:new i.UniformMatrix4f(x),u_opacity:new i.Uniform1f(x),u_image:new i.Uniform1i(x),u_pattern_tl:new i.Uniform2f(x),u_pattern_br:new i.Uniform2f(x),u_texsize:new i.Uniform2f(x),u_pattern_size:new i.Uniform2f(x),u_pixel_coord_upper:new i.Uniform2f(x),u_pixel_coord_lower:new i.Uniform2f(x),u_tile_units_to_pixels:new i.Uniform1f(x)}),terrainRaster:Qc,terrainDepth:Qc,skybox:x=>({u_matrix:new i.UniformMatrix4f(x),u_sun_direction:new i.Uniform3f(x),u_cubemap:new i.Uniform1i(x),u_opacity:new i.Uniform1f(x),u_temporal_offset:new i.Uniform1f(x)}),skyboxGradient:x=>({u_matrix:new i.UniformMatrix4f(x),u_color_ramp:new i.Uniform1i(x),u_center_direction:new i.Uniform3f(x),u_radius:new i.Uniform1f(x),u_opacity:new i.Uniform1f(x),u_temporal_offset:new i.Uniform1f(x)}),skyboxCapture:x=>({u_matrix_3f:new i.UniformMatrix3f(x),u_sun_direction:new i.Uniform3f(x),u_sun_intensity:new i.Uniform1f(x),u_color_tint_r:new i.Uniform4f(x),u_color_tint_m:new i.Uniform4f(x),u_luminance:new i.Uniform1f(x)}),globeRaster:x=>({u_proj_matrix:new i.UniformMatrix4f(x),u_globe_matrix:new i.UniformMatrix4f(x),u_normalize_matrix:new i.UniformMatrix4f(x),u_merc_matrix:new i.UniformMatrix4f(x),u_zoom_transition:new i.Uniform1f(x),u_merc_center:new i.Uniform2f(x),u_image0:new i.Uniform1i(x),u_grid_matrix:new i.UniformMatrix3f(x),u_frustum_tl:new i.Uniform3f(x),u_frustum_tr:new i.Uniform3f(x),u_frustum_br:new i.Uniform3f(x),u_frustum_bl:new i.Uniform3f(x),u_globe_pos:new i.Uniform3f(x),u_globe_radius:new i.Uniform1f(x),u_viewport:new i.Uniform2f(x)}),globeAtmosphere:x=>({u_frustum_tl:new i.Uniform3f(x),u_frustum_tr:new i.Uniform3f(x),u_frustum_br:new i.Uniform3f(x),u_frustum_bl:new i.Uniform3f(x),u_horizon:new i.Uniform1f(x),u_transition:new i.Uniform1f(x),u_fadeout_range:new i.Uniform1f(x),u_color:new i.Uniform4f(x),u_high_color:new i.Uniform4f(x),u_space_color:new i.Uniform4f(x),u_star_intensity:new i.Uniform1f(x),u_star_density:new i.Uniform1f(x),u_star_size:new i.Uniform1f(x),u_temporal_offset:new i.Uniform1f(x),u_horizon_angle:new i.Uniform1f(x),u_rotation_matrix:new i.UniformMatrix4f(x)})};let pc;function fc(x,a,m,b,S,P,H){const W=x.context,ee=W.gl,pe=x.transform,fe=x.useProgram("collisionBox"),Me=[];let Ne=0,st=0;for(let Bt=0;Bt<b.length;Bt++){const Pt=b[Bt],It=a.getTile(Pt),Ht=It.getBucket(m);if(!Ht)continue;const hi=zl(Pt,Ht,pe);let si=hi;S[0]===0&&S[1]===0||(si=x.translatePosMatrix(hi,It,S,P));const qt=H?Ht.textCollisionBox:Ht.iconCollisionBox,ji=Ht.collisionCircleArray;if(ji.length>0){const Kt=i.create(),Ci=si;i.mul(Kt,Ht.placementInvProjMatrix,pe.glCoordMatrix),i.mul(Kt,Kt,Ht.placementViewportMatrix),Me.push({circleArray:ji,circleOffset:st,transform:Ci,invTransform:Kt,projection:Ht.getProjection()}),Ne+=ji.length/4,st=Ne}qt&&(x.terrain&&x.terrain.setupElevationDraw(It,fe),fe.draw(W,ee.LINES,i.DepthMode.disabled,i.StencilMode.disabled,x.colorModeForRenderPass(),i.CullFaceMode.disabled,Kc(si,pe,It,Ht.getProjection()),m.id,qt.layoutVertexBuffer,qt.indexBuffer,qt.segments,null,pe.zoom,null,[qt.collisionVertexBuffer,qt.collisionVertexBufferExt]))}if(!H||!Me.length)return;const it=x.useProgram("collisionCircle"),lt=new i.StructArrayLayout2f1f2i16;lt.resize(4*Ne),lt._trim();let qe=0;for(const Bt of Me)for(let Pt=0;Pt<Bt.circleArray.length/4;Pt++){const It=4*Pt,Ht=Bt.circleArray[It+0],hi=Bt.circleArray[It+1],si=Bt.circleArray[It+2],qt=Bt.circleArray[It+3];lt.emplace(qe++,Ht,hi,si,qt,0),lt.emplace(qe++,Ht,hi,si,qt,1),lt.emplace(qe++,Ht,hi,si,qt,2),lt.emplace(qe++,Ht,hi,si,qt,3)}(!pc||pc.length<2*Ne)&&(pc=function(Bt){const Pt=2*Bt,It=new i.StructArrayLayout3ui6;It.resize(Pt),It._trim();for(let Ht=0;Ht<Pt;Ht++){const hi=6*Ht;It.uint16[hi+0]=4*Ht+0,It.uint16[hi+1]=4*Ht+1,It.uint16[hi+2]=4*Ht+2,It.uint16[hi+3]=4*Ht+2,It.uint16[hi+4]=4*Ht+3,It.uint16[hi+5]=4*Ht+0}return It}(Ne));const Ye=W.createIndexBuffer(pc,!0),dt=W.createVertexBuffer(lt,i.collisionCircleLayout.members,!0);for(const Bt of Me){const Pt={u_matrix:Bt.transform,u_inv_matrix:Bt.invTransform,u_camera_to_center_distance:(ht=pe).getCameraToCenterDistance(Bt.projection),u_viewport_size:[ht.width,ht.height]};it.draw(W,ee.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,x.colorModeForRenderPass(),i.CullFaceMode.disabled,Pt,m.id,dt,Ye,i.SegmentVector.simpleSegment(0,2*Bt.circleOffset,Bt.circleArray.length,Bt.circleArray.length/2),null,pe.zoom)}var ht;dt.destroy(),Ye.destroy()}const Yc=i.create();function zh({width:x,height:a,anchor:m,textOffset:b,textScale:S},P){const{horizontalAlign:H,verticalAlign:W}=i.getAnchorAlignment(m),ee=-(H-.5)*x,pe=-(W-.5)*a,fe=i.evaluateVariableOffset(m,b);return new i.pointGeometry((ee/S+fe[0])*P,(pe/S+fe[1])*P)}function Jc(x,a,m,b,S,P,H,W,ee,pe,fe){const Me=x.text.placedSymbolArray,Ne=x.text.dynamicLayoutVertexArray,st=x.icon.dynamicLayoutVertexArray,it={},lt=x.getProjection(),qe=kl(W,lt,P),Ye=P.elevation,dt=lt.upVectorScale(W.canonical,P.center.lat,P.worldSize).metersToTile;Ne.clear();for(let ht=0;ht<Me.length;ht++){const Bt=Me.get(ht),{tileAnchorX:Pt,tileAnchorY:It,numGlyphs:Ht}=Bt,hi=x.allowVerticalPlacement&&!Bt.placedOrientation,si=Bt.hidden||!Bt.crossTileID||hi?null:b[Bt.crossTileID];if(si){let qt=0,ji=0,Kt=0;if(Ye){const In=Ye?Ye.getAtTileOffset(W,Pt,It):0,[Hn,Mn,$n]=lt.upVector(W.canonical,Pt,It);qt=In*Hn*dt,ji=In*Mn*dt,Kt=In*$n*dt}let[Ci,di,Ri,Ai]=or(Bt.projectedAnchorX+qt,Bt.projectedAnchorY+ji,Bt.projectedAnchorZ+Kt,m?qe:H);const Mi=rn(P.getCameraToCenterDistance(lt),Ai);let $i=S.evaluateSizeForFeature(x.textSizeData,pe,Bt)*Mi/i.ONE_EM;m&&($i*=x.tilePixelRatio/ee);const Jt=zh(si,$i);m?({x:Ci,y:di,z:Ri}=lt.projectTilePoint(Pt+Jt.x,It+Jt.y,W.canonical),[Ci,di,Ri]=or(Ci+qt,di+ji,Ri+Kt,H)):(a&&Jt._rotate(-P.angle),Ci+=Jt.x,di+=Jt.y,Ri=0);const pi=x.allowVerticalPlacement&&Bt.placedOrientation===i.WritingMode.vertical?Math.PI/2:0;for(let In=0;In<Ht;In++)i.addDynamicAttributes(Ne,Ci,di,Ri,pi);fe&&Bt.associatedIconIndex>=0&&(it[Bt.associatedIconIndex]={x:Ci,y:di,z:Ri,angle:pi})}else qs(Ht,Ne)}if(fe){st.clear();const ht=x.icon.placedSymbolArray;for(let Bt=0;Bt<ht.length;Bt++){const Pt=ht.get(Bt),{numGlyphs:It}=Pt,Ht=it[Bt];if(Pt.hidden||!Ht)qs(It,st);else{const{x:hi,y:si,z:qt,angle:ji}=Ht;for(let Kt=0;Kt<It;Kt++)i.addDynamicAttributes(st,hi,si,qt,ji)}}x.icon.dynamicLayoutVertexBuffer.updateData(st)}x.text.dynamicLayoutVertexBuffer.updateData(Ne)}function So(x,a,m){return m.iconsInText&&a?"symbolTextAndIcon":x?"symbolSDF":"symbolIcon"}function xa(x,a,m,b,S,P,H,W,ee,pe,fe,Me){const Ne=x.context,st=Ne.gl,it=x.transform,lt=W==="map",qe=ee==="map",Ye=lt&&m.layout.get("symbol-placement")!=="point",dt=lt&&!qe&&!Ye,ht=m.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Bt=!1;const Pt=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),It=[i.mercatorXfromLng(it.center.lng),i.mercatorYfromLat(it.center.lat)],Ht=m.layout.get("text-variable-anchor"),hi=it.projection.name==="globe",si=[],qt=[0,-1,0];let ji=qt;!hi&&!it.mercatorFromTransition||lt||(ji=function(Kt){const Ci=Kt._camera.getWorldToCamera(Kt.worldSize,1),di=i.multiply([],Ci,Kt.globeMatrix);i.invert(di,di);const Ri=[0,0,0],Ai=[0,1,0,0];return i.transformMat4$1(Ai,Ai,di),Ri[0]=Ai[0],Ri[1]=Ai[1],Ri[2]=Ai[2],i.normalize(Ri,Ri),Ri}(it));for(const Kt of b){const Ci=a.getTile(Kt),di=Ci.getBucket(m);if(!di||di.projection.name==="mercator"&&hi)continue;const Ri=S?di.text:di.icon;if(!Ri||di.fullyClipped||!Ri.segments.get().length)continue;const Ai=Ri.programConfigurations.get(m.id),Mi=S||di.sdfIcons,$i=S?di.textSizeData:di.iconSizeData,Jt=qe||it.pitch!==0,pi=i.evaluateSizeForZoom($i,it.zoom);let In,Hn,Mn,$n,lr=[0,0],On=null;if(S){if(Hn=Ci.glyphAtlasTexture,Mn=st.LINEAR,In=Ci.glyphAtlasTexture.size,di.iconsInText){lr=Ci.imageAtlasTexture.size,On=Ci.imageAtlasTexture;const Ea=$i.kind==="composite"||$i.kind==="camera";$n=Jt||x.options.rotating||x.options.zooming||Ea?st.LINEAR:st.NEAREST}}else{const Ea=m.layout.get("icon-size").constantOr(0)!==1||di.iconsNeedLinear;Hn=Ci.imageAtlasTexture,Mn=Mi||x.options.rotating||x.options.zooming||Ea||Jt?st.LINEAR:st.NEAREST,In=Ci.imageAtlasTexture.size}const _n=di.projection.name==="globe",Dr=_n?ji:qt,Or=_n?i.globeToMercatorTransition(it.zoom):0,Nr=kl(Kt,di.getProjection(),it),Qr=it.calculatePixelsToTileUnitsMatrix(Ci),go=Mr(Nr,Ci.tileID.canonical,qe,lt,it,di.getProjection(),Qr),Ca=x.terrain&&qe&&Ye?i.invert(i.create(),go):Yc,jo=zs(Nr,Ci.tileID.canonical,qe,lt,it,di.getProjection(),Qr),vs=Ht&&di.hasTextData(),_r=m.layout.get("icon-text-fit")!=="none"&&vs&&di.hasIconData();if(Ye){const Ea=it.elevation,vl=Ea?Ea.getAtTileOffsetFunc(Kt,it.center.lat,it.worldSize,di.getProjection()):null,Zl=Oo(Nr,Ci.tileID.canonical,qe,lt,it,di.getProjection(),Qr);Ar(di,Nr,x,S,Zl,jo,qe,pe,vl,Kt)}const Xr=Ye||S&&Ht||_r,Fr=x.translatePosMatrix(Nr,Ci,P,H),Fs=Xr?Yc:go,eo=x.translatePosMatrix(jo,Ci,P,H,!0),ns=di.getProjection().createInversionMatrix(it,Kt.canonical),Io=[];x.terrainRenderModeElevated()&&qe&&Io.push("PITCH_WITH_MAP_TERRAIN"),_n&&Io.push("PROJECTION_GLOBE_VIEW"),Xr&&Io.push("PROJECTED_POS_ON_VIEWPORT");const Bu=Mi&&m.paint.get(S?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ja;ja=Mi?di.iconsInText?Uh($i.kind,pi,dt,qe,x,Fr,Fs,eo,In,lr,Kt,Or,It,ns,Dr,di.getProjection()):qc($i.kind,pi,dt,qe,x,Fr,Fs,eo,S,In,!0,Kt,Or,It,ns,Dr,di.getProjection()):fl($i.kind,pi,dt,qe,x,Fr,Fs,eo,S,In,Kt,Or,It,ns,Dr,di.getProjection());const _o={program:x.useProgram(So(Mi,S,di),Ai,Io),buffers:Ri,uniformValues:ja,atlasTexture:Hn,atlasTextureIcon:On,atlasInterpolation:Mn,atlasInterpolationIcon:$n,isSDF:Mi,hasHalo:Bu,tile:Ci,labelPlaneMatrixInv:Ca};if(ht&&di.canOverlap){Bt=!0;const Ea=Ri.segments.get();for(const vl of Ea)si.push({segments:new i.SegmentVector([vl]),sortKey:vl.sortKey,state:_o})}else si.push({segments:Ri.segments,sortKey:0,state:_o})}Bt&&si.sort((Kt,Ci)=>Kt.sortKey-Ci.sortKey);for(const Kt of si){const Ci=Kt.state;if(x.terrain&&x.terrain.setupElevationDraw(Ci.tile,Ci.program,{useDepthForOcclusion:!hi,labelPlaneMatrixInv:Ci.labelPlaneMatrixInv}),Ne.activeTexture.set(st.TEXTURE0),Ci.atlasTexture.bind(Ci.atlasInterpolation,st.CLAMP_TO_EDGE),Ci.atlasTextureIcon&&(Ne.activeTexture.set(st.TEXTURE1),Ci.atlasTextureIcon&&Ci.atlasTextureIcon.bind(Ci.atlasInterpolationIcon,st.CLAMP_TO_EDGE)),Ci.isSDF){const di=Ci.uniformValues;Ci.hasHalo&&(di.u_is_halo=1,Mo(Ci.buffers,Kt.segments,m,x,Ci.program,Pt,fe,Me,di)),di.u_is_halo=0}Mo(Ci.buffers,Kt.segments,m,x,Ci.program,Pt,fe,Me,Ci.uniformValues)}}function Mo(x,a,m,b,S,P,H,W,ee){const pe=b.context,fe=[x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer,x.globeExtVertexBuffer];S.draw(pe,pe.gl.TRIANGLES,P,H,W,i.CullFaceMode.disabled,ee,m.id,x.layoutVertexBuffer,x.indexBuffer,a,m.paint,b.transform.zoom,x.programConfigurations.get(m.id),fe)}function nd(x,a,m,b,S,P,H){const W=x.context.gl,ee=m.paint.get("fill-pattern"),pe=ee&&ee.constantOr(1);let fe,Me,Ne,st,it;H?(Me=pe&&!m.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=W.LINES):(Me=pe?"fillPattern":"fill",fe=W.TRIANGLES);for(const lt of b){const qe=a.getTile(lt);if(pe&&!qe.patternsLoaded())continue;const Ye=qe.getBucket(m);if(!Ye)continue;x.prepareDrawTile();const dt=Ye.programConfigurations.get(m.id),ht=x.useProgram(Me,dt);pe&&(x.context.activeTexture.set(W.TEXTURE0),qe.imageAtlasTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE),dt.updatePaintBuffers());const Bt=ee.constantOr(null);if(Bt&&qe.imageAtlas){const It=qe.imageAtlas.patternPositions[Bt.toString()];It&&dt.setConstantPatternPositions(It)}const Pt=x.translatePosMatrix(lt.projMatrix,qe,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));if(H){st=Ye.indexBuffer2,it=Ye.segments2;const It=x.terrain&&x.terrain.renderingToTexture?x.terrain.drapeBufferSize:[W.drawingBufferWidth,W.drawingBufferHeight];Ne=Me==="fillOutlinePattern"&&pe?jc(Pt,x,qe,It):Wc(Pt,It)}else st=Ye.indexBuffer,it=Ye.segments,Ne=pe?Dh(Pt,x,qe):Gc(Pt);x.prepareDrawProgram(x.context,ht,lt.toUnwrapped()),ht.draw(x.context,fe,S,x.stencilModeForClipping(lt),P,i.CullFaceMode.disabled,Ne,m.id,Ye.layoutVertexBuffer,st,it,m.paint,x.transform.zoom,dt)}}function Ha(x,a,m,b,S,P,H){const W=x.context,ee=W.gl,pe=x.transform,fe=m.paint.get("fill-extrusion-pattern"),Me=fe.constantOr(1),Ne=m.paint.get("fill-extrusion-opacity"),st=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),m.paint.get("fill-extrusion-ambient-occlusion-radius")],it=m.layout.get("fill-extrusion-edge-radius"),lt=pe.projection.name==="globe"?i.fillExtrusionHeightLift():0,qe=pe.projection.name==="globe",Ye=qe?i.globeToMercatorTransition(pe.zoom):0,dt=[i.mercatorXfromLng(pe.center.lng),i.mercatorYfromLat(pe.center.lat)],ht=[];qe&&(ht.push("PROJECTION_GLOBE_VIEW"),x.style.terrainSetForDrapingOnly()&&ht.push("TERRAIN")),st[0]>0&&ht.push("FAUX_AO");for(const Bt of b){const Pt=a.getTile(Bt),It=Pt.getBucket(m);if(!It||It.projection.name!==pe.projection.name)continue;const Ht=It.programConfigurations.get(m.id),hi=x.useProgram(Me?"fillExtrusionPattern":"fillExtrusion",Ht,ht);if(x.terrain){const Ri=x.terrain;if(x.style.terrainSetForDrapingOnly())Ri.setupElevationDraw(Pt,hi,{useMeterToDem:!0});else{if(!It.enableTerrain)continue;if(Ri.setupElevationDraw(Pt,hi,{useMeterToDem:!0}),rd(W,a,Bt,It,m,Ri),!It.centroidVertexBuffer){const Ai=hi.attributes.a_centroid_pos;Ai!==void 0&&ee.vertexAttrib2f(Ai,0,0)}}}Me&&(x.context.activeTexture.set(ee.TEXTURE0),Pt.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),Ht.updatePaintBuffers());const si=fe.constantOr(null);if(si&&Pt.imageAtlas){const Ri=Pt.imageAtlas.patternPositions[si.toString()];Ri&&Ht.setConstantPatternPositions(Ri)}const qt=x.translatePosMatrix(Bt.projMatrix,Pt,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),ji=pe.projection.createInversionMatrix(pe,Bt.canonical),Kt=m.paint.get("fill-extrusion-vertical-gradient"),Ci=Me?Lh(qt,x,Kt,Ne,st,it,Bt,Pt,lt,Ye,dt,ji):Hc(qt,x,Kt,Ne,st,it,Bt,lt,Ye,dt,ji);x.prepareDrawProgram(W,hi,Bt.toUnwrapped());const di=[];x.terrain&&di.push(It.centroidVertexBuffer),qe&&di.push(It.layoutVertexExtBuffer),hi.draw(W,W.gl.TRIANGLES,S,P,H,i.CullFaceMode.backCCW,Ci,m.id,It.layoutVertexBuffer,It.indexBuffer,It.segments,m.paint,x.transform.zoom,Ht,di)}}function rd(x,a,m,b,S,P){const H=[Ye=>{let dt=Ye.canonical.x-1,ht=Ye.wrap;return dt<0&&(dt=(1<<Ye.canonical.z)-1,ht--),new i.OverscaledTileID(Ye.overscaledZ,ht,Ye.canonical.z,dt,Ye.canonical.y)},Ye=>{let dt=Ye.canonical.x+1,ht=Ye.wrap;return dt===1<<Ye.canonical.z&&(dt=0,ht++),new i.OverscaledTileID(Ye.overscaledZ,ht,Ye.canonical.z,dt,Ye.canonical.y)},Ye=>new i.OverscaledTileID(Ye.overscaledZ,Ye.wrap,Ye.canonical.z,Ye.canonical.x,(Ye.canonical.y===0?1<<Ye.canonical.z:Ye.canonical.y)-1),Ye=>new i.OverscaledTileID(Ye.overscaledZ,Ye.wrap,Ye.canonical.z,Ye.canonical.x,Ye.canonical.y===(1<<Ye.canonical.z)-1?0:Ye.canonical.y+1)],W=Ye=>{const dt=a.getSource().minzoom,ht=Pt=>{const It=a.getTileByID(Pt);if(It&&It.hasData())return It.getBucket(S)},Bt=[0,-1,1];for(const Pt of Bt){if(Ye.overscaledZ+Pt<dt)continue;const It=ht(Ye.calculateScaledKey(Ye.overscaledZ+Pt));if(It)return It}},ee=[0,0,0],pe=(Ye,dt)=>(ee[0]=Math.min(Ye.min.y,dt.min.y),ee[1]=Math.max(Ye.max.y,dt.max.y),ee[2]=i.EXTENT-dt.min.x>Ye.max.x?dt.min.x-i.EXTENT:Ye.max.x,ee),fe=(Ye,dt)=>(ee[0]=Math.min(Ye.min.x,dt.min.x),ee[1]=Math.max(Ye.max.x,dt.max.x),ee[2]=i.EXTENT-dt.min.y>Ye.max.y?dt.min.y-i.EXTENT:Ye.max.y,ee),Me=[(Ye,dt)=>pe(Ye,dt),(Ye,dt)=>pe(dt,Ye),(Ye,dt)=>fe(Ye,dt),(Ye,dt)=>fe(dt,Ye)],Ne=new i.pointGeometry(0,0);let st,it,lt;const qe=(Ye,dt,ht,Bt,Pt)=>{const It=[[Bt?ht:Ye,Bt?Ye:ht,0],[Bt?ht:dt,Bt?dt:ht,0]],Ht=Pt<0?i.EXTENT+Pt:Pt,hi=[Bt?Ht:(Ye+dt)/2,Bt?(Ye+dt)/2:Ht,0];return ht===0&&Pt<0||ht!==0&&Pt>0?P.getForTilePoints(lt,[hi],!0,it):It.push(hi),P.getForTilePoints(m,It,!0,st),Math.max(It[0][2],It[1][2],hi[2])/P.exaggeration()};for(let Ye=0;Ye<4;Ye++){const dt=(Ye<2?1:5)-Ye,ht=b.borders[Ye];if(ht.length===0)continue;const Bt=lt=H[Ye](m),Pt=W(Bt);if(!(Pt&&Pt instanceof i.FillExtrusionBucket&&Pt.enableTerrain)||b.borderDoneWithNeighborZ[Ye]===Pt.canonical.z&&Pt.borderDoneWithNeighborZ[dt]===b.canonical.z||(it=P.findDEMTileFor(Bt),!it||!it.dem))continue;if(!st){const si=P.findDEMTileFor(m);if(!si||!si.dem)return;st=si}const It=Pt.borders[dt];let Ht=0;const hi=Pt.borderDoneWithNeighborZ[dt]!==b.canonical.z;if(b.canonical.z===Pt.canonical.z){for(let si=0;si<ht.length;si++){const qt=b.featuresOnBorder[ht[si]],ji=qt.borders[Ye];let Kt;for(;Ht<It.length&&(Kt=Pt.featuresOnBorder[It[Ht]],!(Kt.borders[dt][1]>ji[0]+3));)hi&&Pt.encodeCentroid(void 0,Kt,!1),Ht++;if(Kt&&Ht<It.length){const Ci=Ht;let di=0;for(;!(Kt.borders[dt][0]>ji[1]-3)&&(di++,++Ht!==It.length);)Kt=Pt.featuresOnBorder[It[Ht]];if(Kt=Pt.featuresOnBorder[It[Ci]],qt.intersectsCount()>1||Kt.intersectsCount()>1||di!==1){di!==1&&(Ht=Ci),b.encodeCentroid(void 0,qt,!1),hi&&Pt.encodeCentroid(void 0,Kt,!1);continue}const Ri=Me[Ye](qt,Kt),Ai=Ye%2?i.EXTENT-1:0;Ne.x=qe(Ri[0],Math.min(i.EXTENT-1,Ri[1]),Ai,Ye<2,Ri[2]),Ne.y=0,b.encodeCentroid(Ne,qt,!1),hi&&Pt.encodeCentroid(Ne,Kt,!1)}else b.encodeCentroid(void 0,qt,!1)}b.borderDoneWithNeighborZ[Ye]=Pt.canonical.z,b.needsCentroidUpdate=!0,hi&&(Pt.borderDoneWithNeighborZ[dt]=b.canonical.z,Pt.needsCentroidUpdate=!0)}else{for(const si of ht)b.encodeCentroid(void 0,b.featuresOnBorder[si],!1);if(hi){for(const si of It)Pt.encodeCentroid(void 0,Pt.featuresOnBorder[si],!1);Pt.borderDoneWithNeighborZ[dt]=b.canonical.z,Pt.needsCentroidUpdate=!0}b.borderDoneWithNeighborZ[Ye]=Pt.canonical.z,b.needsCentroidUpdate=!0}}(b.needsCentroidUpdate||!b.centroidVertexBuffer&&b.centroidVertexArray.length!==0)&&b.uploadCentroid(x)}const ml=new i.Color(1,0,0,1),kh=new i.Color(0,1,0,1),Oh=new i.Color(0,0,1,1),lA=new i.Color(1,0,1,1),sd=new i.Color(0,1,1,1);function Nh(x,a,m){const b=x.context,S=x.transform,P=b.gl,H=S.projection.name==="globe",W=H?["PROJECTION_GLOBE_VIEW"]:null;let ee=m.projMatrix;if(H&&i.globeToMercatorTransition(S.zoom)>0){const qt=i.transitionTileAABBinECEF(m.canonical,S),ji=i.globeDenormalizeECEF(qt);ee=i.multiply(new Float32Array(16),S.globeMatrix,ji),i.multiply(ee,S.projMatrix,ee)}const pe=x.useProgram("debug",null,W),fe=a.getTileByID(m.key);x.terrain&&x.terrain.setupElevationDraw(fe,pe);const Me=i.DepthMode.disabled,Ne=i.StencilMode.disabled,st=x.colorModeForRenderPass(),it="$debug";b.activeTexture.set(P.TEXTURE0),x.emptyTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),H?fe._makeGlobeTileDebugBuffers(x.context,S):fe._makeDebugTileBoundsBuffers(x.context,S.projection);const lt=fe._tileDebugBuffer||x.debugBuffer,qe=fe._tileDebugIndexBuffer||x.debugIndexBuffer,Ye=fe._tileDebugSegments||x.debugSegments;pe.draw(b,P.LINE_STRIP,Me,Ne,st,i.CullFaceMode.disabled,ca(ee,i.Color.red),it,lt,qe,Ye,null,null,null,[fe._globeTileDebugBorderBuffer]);const dt=fe.latestRawTileData,ht=Math.floor((dt&&dt.byteLength||0)/1024),Bt=a.getTile(m).tileSize,Pt=512/Math.min(Bt,512)*(m.overscaledZ/S.zoom)*.5;let It=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(It+=` => ${m.overscaledZ}`),It+=` ${ht}kb`,function(qt,ji){qt.initDebugOverlayCanvas();const Kt=qt.debugOverlayCanvas,Ci=qt.context.gl,di=qt.debugOverlayCanvas.getContext("2d");di.clearRect(0,0,Kt.width,Kt.height),di.shadowColor="white",di.shadowBlur=2,di.lineWidth=1.5,di.strokeStyle="white",di.textBaseline="top",di.font="bold 36px Open Sans, sans-serif",di.fillText(ji,5,5),di.strokeText(ji,5,5),qt.debugOverlayTexture.update(Kt),qt.debugOverlayTexture.bind(Ci.LINEAR,Ci.CLAMP_TO_EDGE)}(x,It);const Ht=fe._tileDebugTextBuffer||x.debugBuffer,hi=fe._tileDebugTextIndexBuffer||x.quadTriangleIndexBuffer,si=fe._tileDebugTextSegments||x.debugSegments;pe.draw(b,P.TRIANGLES,Me,Ne,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,ca(ee,i.Color.transparent,Pt),it,Ht,hi,si,null,null,null,[fe._globeTileDebugTextBuffer])}function mc(x,a,m,b){pn(x,0,a+m/2,x.transform.width,m,b)}function ha(x,a,m,b){pn(x,a-m/2,0,m,x.transform.height,b)}function pn(x,a,m,b,S,P){const H=x.context,W=H.gl;W.enable(W.SCISSOR_TEST),W.scissor(a*i.exported.devicePixelRatio,m*i.exported.devicePixelRatio,b*i.exported.devicePixelRatio,S*i.exported.devicePixelRatio),H.clear({color:P}),W.disable(W.SCISSOR_TEST)}const eh=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Wl}=eh;function Os(x,a,m,b){x.emplaceBack(a,m,b)}class gl{constructor(a){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,Os(this.vertexArray,-1,-1,1),Os(this.vertexArray,1,-1,1),Os(this.vertexArray,-1,1,1),Os(this.vertexArray,1,1,1),Os(this.vertexArray,-1,-1,-1),Os(this.vertexArray,1,-1,-1),Os(this.vertexArray,-1,1,-1),Os(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=a.createVertexBuffer(this.vertexArray,Wl),this.indexBuffer=a.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function un(x,a,m,b,S,P){const H=x.gl,W=a.paint.get("sky-atmosphere-color"),ee=a.paint.get("sky-atmosphere-halo-color"),pe=a.paint.get("sky-atmosphere-sun-intensity"),fe=((Me,Ne,st,it,lt)=>({u_matrix_3f:Me,u_sun_direction:Ne,u_sun_intensity:st,u_color_tint_r:[it.r,it.g,it.b,it.a],u_color_tint_m:[lt.r,lt.g,lt.b,lt.a],u_luminance:5e-5}))(i.fromMat4(i.create$1(),b),S,pe,W,ee);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+P,a.skyboxTexture,0),m.draw(x,H.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,fe,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}const th=i.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ur{constructor(a){const m=new i.StructArrayLayout5f20;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const b=new i.StructArrayLayout3ui6;b.emplaceBack(0,1,2),b.emplaceBack(2,3,0),this.vertexBuffer=a.createVertexBuffer(m,th.members),this.indexBuffer=a.createIndexBuffer(b),this.segments=i.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const gc={symbol:function(x,a,m,b,S){if(x.renderPass!=="translucent")return;const P=i.StencilMode.disabled,H=x.colorModeForRenderPass();m.layout.get("text-variable-anchor")&&function(W,ee,pe,fe,Me,Ne,st){const it=ee.transform,lt=Me==="map",qe=Ne==="map";for(const Ye of W){const dt=fe.getTile(Ye),ht=dt.getBucket(pe);if(!ht||!ht.text||!ht.text.segments.get().length)continue;const Bt=i.evaluateSizeForZoom(ht.textSizeData,it.zoom),Pt=kl(Ye,ht.getProjection(),it),It=it.calculatePixelsToTileUnitsMatrix(dt),Ht=Mr(Pt,dt.tileID.canonical,qe,lt,it,ht.getProjection(),It),hi=pe.layout.get("icon-text-fit")!=="none"&&ht.hasIconData();if(Bt){const si=Math.pow(2,it.zoom-dt.tileID.overscaledZ);Jc(ht,lt,qe,st,i.symbolSize,it,Ht,Ye,si,Bt,hi)}}}(b,x,m,a,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),S),m.paint.get("icon-opacity").constantOr(1)!==0&&xa(x,a,m,b,!1,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),m.layout.get("icon-rotation-alignment"),m.layout.get("icon-pitch-alignment"),m.layout.get("icon-keep-upright"),P,H),m.paint.get("text-opacity").constantOr(1)!==0&&xa(x,a,m,b,!0,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),m.layout.get("text-keep-upright"),P,H),a.map.showCollisionBoxes&&(fc(x,a,m,b,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),fc(x,a,m,b,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(x,a,m,b){if(x.renderPass!=="translucent")return;const S=m.paint.get("circle-opacity"),P=m.paint.get("circle-stroke-width"),H=m.paint.get("circle-stroke-opacity"),W=m.layout.get("circle-sort-key").constantOr(1)!==void 0;if(S.constantOr(1)===0&&(P.constantOr(1)===0||H.constantOr(1)===0))return;const ee=x.context,pe=ee.gl,fe=x.transform,Me=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),Ne=i.StencilMode.disabled,st=x.colorModeForRenderPass(),it=fe.projection.name==="globe",lt=[i.mercatorXfromLng(fe.center.lng),i.mercatorYfromLat(fe.center.lat)],qe=[];for(let dt=0;dt<b.length;dt++){const ht=b[dt],Bt=a.getTile(ht),Pt=Bt.getBucket(m);if(!Pt||Pt.projection.name!==fe.projection.name)continue;const It=Pt.programConfigurations.get(m.id),Ht=oA(m);it&&Ht.push("PROJECTION_GLOBE_VIEW");const hi=x.useProgram("circle",It,Ht),si=Pt.layoutVertexBuffer,qt=Pt.globeExtVertexBuffer,ji=Pt.indexBuffer,Kt=fe.projection.createInversionMatrix(fe,ht.canonical),Ci={programConfiguration:It,program:hi,layoutVertexBuffer:si,globeExtVertexBuffer:qt,indexBuffer:ji,uniformValues:sA(x,ht,Bt,Kt,lt,m),tile:Bt};if(W){const di=Pt.segments.get();for(const Ri of di)qe.push({segments:new i.SegmentVector([Ri]),sortKey:Ri.sortKey,state:Ci})}else qe.push({segments:Pt.segments,sortKey:0,state:Ci})}W&&qe.sort((dt,ht)=>dt.sortKey-ht.sortKey);const Ye={useDepthForOcclusion:!it};for(const dt of qe){const{programConfiguration:ht,program:Bt,layoutVertexBuffer:Pt,globeExtVertexBuffer:It,indexBuffer:Ht,uniformValues:hi,tile:si}=dt.state,qt=dt.segments;x.terrain&&x.terrain.setupElevationDraw(si,Bt,Ye),x.prepareDrawProgram(ee,Bt,si.tileID.toUnwrapped()),Bt.draw(ee,pe.TRIANGLES,Me,Ne,st,i.CullFaceMode.disabled,hi,m.id,Pt,Ht,qt,m.paint,fe.zoom,ht,[It])}},heatmap:function(x,a,m,b){if(m.paint.get("heatmap-opacity")!==0)if(x.renderPass==="offscreen"){const S=x.context,P=S.gl,H=i.StencilMode.disabled,W=new i.ColorMode([P.ONE,P.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(st,it,lt,qe){const Ye=st.gl,dt=it.width*qe,ht=it.height*qe;st.activeTexture.set(Ye.TEXTURE1),st.viewport.set([0,0,dt,ht]);let Bt=lt.heatmapFbo;if(!Bt||Bt&&(Bt.width!==dt||Bt.height!==ht)){Bt&&Bt.destroy();const Pt=Ye.createTexture();Ye.bindTexture(Ye.TEXTURE_2D,Pt),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_WRAP_S,Ye.CLAMP_TO_EDGE),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_WRAP_T,Ye.CLAMP_TO_EDGE),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_MIN_FILTER,Ye.LINEAR),Ye.texParameteri(Ye.TEXTURE_2D,Ye.TEXTURE_MAG_FILTER,Ye.LINEAR),Bt=lt.heatmapFbo=st.createFramebuffer(dt,ht,!1),function(It,Ht,hi,si,qt,ji){const Kt=It.gl;Kt.texImage2D(Kt.TEXTURE_2D,0,Kt.RGBA,qt,ji,0,Kt.RGBA,It.extRenderToTextureHalfFloat?It.extTextureHalfFloat.HALF_FLOAT_OES:Kt.UNSIGNED_BYTE,null),si.colorAttachment.set(hi)}(st,0,Pt,Bt,dt,ht)}else Ye.bindTexture(Ye.TEXTURE_2D,Bt.colorAttachment.get()),st.bindFramebuffer.set(Bt.framebuffer)})(S,x,m,x.transform.projection.name==="globe"?.5:.25),S.clear({color:i.Color.transparent});const ee=x.transform,pe=ee.projection.name==="globe",fe=pe?["PROJECTION_GLOBE_VIEW"]:null,Me=pe?i.CullFaceMode.frontCCW:i.CullFaceMode.disabled,Ne=[i.mercatorXfromLng(ee.center.lng),i.mercatorYfromLat(ee.center.lat)];for(let st=0;st<b.length;st++){const it=b[st];if(a.hasRenderableParent(it))continue;const lt=a.getTile(it),qe=lt.getBucket(m);if(!qe||qe.projection.name!==ee.projection.name)continue;const Ye=qe.programConfigurations.get(m.id),dt=x.useProgram("heatmap",Ye,fe),{zoom:ht}=x.transform;x.terrain&&x.terrain.setupElevationDraw(lt,dt),x.prepareDrawProgram(S,dt,it.toUnwrapped());const Bt=ee.projection.createInversionMatrix(ee,it.canonical);dt.draw(S,P.TRIANGLES,i.DepthMode.disabled,H,W,Me,pl(x,it,lt,Bt,Ne,ht,m.paint.get("heatmap-intensity")),m.id,qe.layoutVertexBuffer,qe.indexBuffer,qe.segments,m.paint,x.transform.zoom,Ye,pe?[qe.globeExtVertexBuffer]:null)}S.viewport.set([0,0,x.width,x.height])}else x.renderPass==="translucent"&&(x.context.setColorMode(x.colorModeForRenderPass()),function(S,P){const H=S.context,W=H.gl,ee=P.heatmapFbo;if(!ee)return;H.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,ee.colorAttachment.get()),H.activeTexture.set(W.TEXTURE1);let pe=P.colorRampTexture;pe||(pe=P.colorRampTexture=new i.Texture(H,P.colorRamp,W.RGBA)),pe.bind(W.LINEAR,W.CLAMP_TO_EDGE),S.useProgram("heatmapTexture").draw(H,W.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,S.colorModeForRenderPass(),i.CullFaceMode.disabled,((fe,Me,Ne,st)=>({u_image:0,u_color_ramp:1,u_opacity:Me.paint.get("heatmap-opacity")}))(0,P),P.id,S.viewportBuffer,S.quadTriangleIndexBuffer,S.viewportSegments,P.paint,S.transform.zoom)}(x,m))},line:function(x,a,m,b){if(x.renderPass!=="translucent")return;const S=m.paint.get("line-opacity"),P=m.paint.get("line-width");if(S.constantOr(1)===0||P.constantOr(1)===0)return;const H=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),W=x.colorModeForRenderPass(),ee=x.terrain&&x.terrain.renderingToTexture?1:i.exported.devicePixelRatio,pe=m.paint.get("line-dasharray"),fe=pe.constantOr(1),Me=m.layout.get("line-cap"),Ne=m.paint.get("line-pattern"),st=Ne.constantOr(1),it=m.paint.get("line-gradient"),lt=st?"linePattern":"line",qe=x.context,Ye=qe.gl,dt=(Bt=>{const Pt=[];Gl(Bt)&&Pt.push("RENDER_LINE_DASH"),Bt.paint.get("line-gradient")&&Pt.push("RENDER_LINE_GRADIENT");const It=Bt.paint.get("line-trim-offset");It[0]===0&&It[1]===0||Pt.push("RENDER_LINE_TRIM_OFFSET");const Ht=Bt.paint.get("line-pattern").constantOr(1),hi=Bt.paint.get("line-opacity").constantOr(1)!==1;return!Ht&&hi&&Pt.push("RENDER_LINE_ALPHA_DISCARD"),Pt})(m);let ht=dt.includes("RENDER_LINE_ALPHA_DISCARD");x.terrain&&x.terrain.clipOrMaskOverlapStencilType()&&(ht=!1);for(const Bt of b){const Pt=a.getTile(Bt);if(st&&!Pt.patternsLoaded())continue;const It=Pt.getBucket(m);if(!It)continue;x.prepareDrawTile();const Ht=It.programConfigurations.get(m.id),hi=x.useProgram(lt,Ht,dt),si=Ne.constantOr(null);if(si&&Pt.imageAtlas){const Mi=Pt.imageAtlas.patternPositions[si.toString()];Mi&&Ht.setConstantPatternPositions(Mi)}const qt=pe.constantOr(null),ji=Me.constantOr(null);if(!st&&qt&&ji&&Pt.lineAtlas){const Mi=Pt.lineAtlas.getDash(qt,ji);Mi&&Ht.setConstantPatternPositions(Mi)}let[Kt,Ci]=m.paint.get("line-trim-offset");(ji==="round"||ji==="square")&&Kt!==Ci&&(Kt===0&&(Kt-=1),Ci===1&&(Ci+=1));const di=x.terrain?Bt.projMatrix:null,Ri=st?Ho(x,Pt,m,di,ee):aA(x,Pt,m,di,It.lineClipsArray.length,ee,[Kt,Ci]);if(it){const Mi=It.gradients[m.id];let $i=Mi.texture;if(m.gradientVersion!==Mi.version){let Jt=256;if(m.stepInterpolant){const pi=a.getSource().maxzoom,In=Bt.canonical.z===pi?Math.ceil(1<<x.transform.maxZoom-Bt.canonical.z):1;Jt=i.clamp(i.nextPowerOfTwo(It.maxLineLength/i.EXTENT*1024*In),256,qe.maxTextureSize)}Mi.gradient=i.renderColorRamp({expression:m.gradientExpression(),evaluationKey:"lineProgress",resolution:Jt,image:Mi.gradient||void 0,clips:It.lineClipsArray}),Mi.texture?Mi.texture.update(Mi.gradient):Mi.texture=new i.Texture(qe,Mi.gradient,Ye.RGBA),Mi.version=m.gradientVersion,$i=Mi.texture}qe.activeTexture.set(Ye.TEXTURE1),$i.bind(m.stepInterpolant?Ye.NEAREST:Ye.LINEAR,Ye.CLAMP_TO_EDGE)}fe&&(qe.activeTexture.set(Ye.TEXTURE0),Pt.lineAtlasTexture.bind(Ye.LINEAR,Ye.REPEAT),Ht.updatePaintBuffers()),st&&(qe.activeTexture.set(Ye.TEXTURE0),Pt.imageAtlasTexture.bind(Ye.LINEAR,Ye.CLAMP_TO_EDGE),Ht.updatePaintBuffers()),x.prepareDrawProgram(qe,hi,Bt.toUnwrapped());const Ai=Mi=>{hi.draw(qe,Ye.TRIANGLES,H,Mi,W,i.CullFaceMode.disabled,Ri,m.id,It.layoutVertexBuffer,It.indexBuffer,It.segments,m.paint,x.transform.zoom,Ht,[It.layoutVertexBuffer2])};if(ht){const Mi=x.stencilModeForClipping(Bt).ref;Mi===0&&x.terrain&&qe.clear({stencil:0});const $i={func:Ye.EQUAL,mask:255};Ri.u_alpha_discard_threshold=.8,Ai(new i.StencilMode($i,Mi,255,Ye.KEEP,Ye.KEEP,Ye.INVERT)),Ri.u_alpha_discard_threshold=0,Ai(new i.StencilMode($i,Mi,255,Ye.KEEP,Ye.KEEP,Ye.KEEP))}else Ai(x.stencilModeForClipping(Bt))}ht&&(x.resetStencilClippingMasks(),x.terrain&&qe.clear({stencil:0}))},fill:function(x,a,m,b){const S=m.paint.get("fill-color"),P=m.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const H=x.colorModeForRenderPass(),W=m.paint.get("fill-pattern"),ee=x.opaquePassEnabledForLayer()&&!W.constantOr(1)&&S.constantOr(i.Color.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===ee){const pe=x.depthModeForSublayer(1,x.renderPass==="opaque"?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);nd(x,a,m,b,pe,H,!1)}if(x.renderPass==="translucent"&&m.paint.get("fill-antialias")){const pe=x.depthModeForSublayer(m.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);nd(x,a,m,b,pe,H,!0)}},"fill-extrusion":function(x,a,m,b){const S=m.paint.get("fill-extrusion-opacity");if(S!==0&&x.renderPass==="translucent"){const P=new i.DepthMode(x.context.gl.LEQUAL,i.DepthMode.ReadWrite,x.depthRangeFor3D);if(S!==1||m.paint.get("fill-extrusion-pattern").constantOr(1))Ha(x,a,m,b,P,i.StencilMode.disabled,i.ColorMode.disabled),Ha(x,a,m,b,P,x.stencilModeFor3D(),x.colorModeForRenderPass()),x.resetStencilClippingMasks();else{const H=x.colorModeForRenderPass();Ha(x,a,m,b,P,i.StencilMode.disabled,H)}}},hillshade:function(x,a,m,b){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const S=x.context,P=x.depthModeForSublayer(0,i.DepthMode.ReadOnly),H=x.colorModeForRenderPass(),W=x.terrain&&x.terrain.renderingToTexture,[ee,pe]=x.renderPass!=="translucent"||W?[{},b]:x.stencilConfigForOverlap(b);for(const fe of pe){const Me=a.getTile(fe);if(Me.needsHillshadePrepare&&x.renderPass==="offscreen")Va(x,Me,m,P,i.StencilMode.disabled,H);else if(x.renderPass==="translucent"){const Ne=W&&x.terrain?x.terrain.stencilModeForRTTOverlap(fe):ee[fe.overscaledZ];yu(x,fe,Me,m,P,Ne,H)}}S.viewport.set([0,0,x.width,x.height]),x.resetStencilClippingMasks()},raster:function(x,a,m,b,S,P){if(x.renderPass!=="translucent"||m.paint.get("raster-opacity")===0||!b.length)return;const H=x.context,W=H.gl,ee=a.getSource(),pe=x.useProgram("raster"),fe=x.colorModeForRenderPass(),Me=x.terrain&&x.terrain.renderingToTexture,[Ne,st]=ee instanceof X||Me?[{},b]:x.stencilConfigForOverlap(b),it=st[st.length-1].overscaledZ,lt=!x.options.moving;for(const qe of st){const Ye=Me?i.DepthMode.disabled:x.depthModeForSublayer(qe.overscaledZ-it,m.paint.get("raster-opacity")===1?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,W.LESS),dt=qe.toUnwrapped(),ht=a.getTile(qe);if(Me&&(!ht||!ht.hasData()))continue;const Bt=Me?qe.projMatrix:x.transform.calculateProjMatrix(dt,lt),Pt=x.terrain&&Me?x.terrain.stencilModeForRTTOverlap(qe):Ne[qe.overscaledZ],It=P?0:m.paint.get("raster-fade-duration");ht.registerFadeDuration(It);const Ht=a.findLoadedParent(qe,0),hi=Hl(ht,Ht,a,x.transform,It);let si,qt;x.terrain&&x.terrain.prepareDrawTile();const ji=m.paint.get("raster-resampling")==="nearest"?W.NEAREST:W.LINEAR;H.activeTexture.set(W.TEXTURE0),ht.texture.bind(ji,W.CLAMP_TO_EDGE),H.activeTexture.set(W.TEXTURE1),Ht?(Ht.texture.bind(ji,W.CLAMP_TO_EDGE),si=Math.pow(2,Ht.tileID.overscaledZ-ht.tileID.overscaledZ),qt=[ht.tileID.canonical.x*si%1,ht.tileID.canonical.y*si%1]):ht.texture.bind(ji,W.CLAMP_TO_EDGE);const Kt=wu(Bt,qt||[0,0],si||1,hi,m,ee instanceof X?ee.perspectiveTransform:[0,0]);if(x.prepareDrawProgram(H,pe,dt),ee instanceof X)ee.boundsBuffer&&ee.boundsSegments&&pe.draw(H,W.TRIANGLES,Ye,i.StencilMode.disabled,fe,i.CullFaceMode.disabled,Kt,m.id,ee.boundsBuffer,x.quadTriangleIndexBuffer,ee.boundsSegments);else{const{tileBoundsBuffer:Ci,tileBoundsIndexBuffer:di,tileBoundsSegments:Ri}=x.getTileBoundsBuffers(ht);pe.draw(H,W.TRIANGLES,Ye,Pt,fe,i.CullFaceMode.disabled,Kt,m.id,Ci,di,Ri)}}x.resetStencilClippingMasks()},background:function(x,a,m,b){const S=m.paint.get("background-color"),P=m.paint.get("background-opacity");if(P===0)return;const H=x.context,W=H.gl,ee=x.transform,pe=ee.tileSize,fe=m.paint.get("background-pattern");if(x.isPatternMissing(fe))return;const Me=!fe&&S.a===1&&P===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==Me)return;const Ne=i.StencilMode.disabled,st=x.depthModeForSublayer(0,Me==="opaque"?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),it=x.colorModeForRenderPass(),lt=x.useProgram(fe?"backgroundPattern":"background");let qe,Ye=b;Ye||(qe=x.getBackgroundTiles(),Ye=Object.values(qe).map(dt=>dt.tileID)),fe&&(H.activeTexture.set(W.TEXTURE0),x.imageManager.bind(x.context));for(const dt of Ye){const ht=dt.toUnwrapped(),Bt=b?dt.projMatrix:x.transform.calculateProjMatrix(ht);x.prepareDrawTile();const Pt=a?a.getTile(dt):qe?qe[dt.key]:new i.Tile(dt,pe,ee.zoom,x),It=fe?bu(Bt,P,x,fe,{tileID:dt,tileSize:pe}):Rh(Bt,P,S);x.prepareDrawProgram(H,lt,ht);const{tileBoundsBuffer:Ht,tileBoundsIndexBuffer:hi,tileBoundsSegments:si}=x.getTileBoundsBuffers(Pt);lt.draw(H,W.TRIANGLES,st,Ne,it,i.CullFaceMode.disabled,It,m.id,Ht,hi,si)}},sky:function(x,a,m){const b=x.transform,S=b.projection.name==="mercator"||b.projection.name==="globe"?1:i.smoothstep(7,8,b.zoom),P=m.paint.get("sky-opacity")*S;if(P===0)return;const H=x.context,W=m.paint.get("sky-type"),ee=new i.DepthMode(H.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),pe=x.frameCounter/1e3%1;W==="atmosphere"?x.renderPass==="offscreen"?m.needsSkyboxCapture(x)&&(function(fe,Me,Ne,st){const it=fe.context,lt=it.gl;let qe=Me.skyboxFbo;if(!qe){qe=Me.skyboxFbo=it.createFramebuffer(32,32,!1),Me.skyboxGeometry=new gl(it),Me.skyboxTexture=it.gl.createTexture(),lt.bindTexture(lt.TEXTURE_CUBE_MAP,Me.skyboxTexture),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_WRAP_S,lt.CLAMP_TO_EDGE),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_WRAP_T,lt.CLAMP_TO_EDGE),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_MIN_FILTER,lt.LINEAR),lt.texParameteri(lt.TEXTURE_CUBE_MAP,lt.TEXTURE_MAG_FILTER,lt.LINEAR);for(let Bt=0;Bt<6;++Bt)lt.texImage2D(lt.TEXTURE_CUBE_MAP_POSITIVE_X+Bt,0,lt.RGBA,32,32,0,lt.RGBA,lt.UNSIGNED_BYTE,null)}it.bindFramebuffer.set(qe.framebuffer),it.viewport.set([0,0,32,32]);const Ye=Me.getCenter(fe,!0),dt=fe.useProgram("skyboxCapture"),ht=new Float64Array(16);i.identity(ht),i.rotateY(ht,ht,.5*-Math.PI),un(it,Me,dt,ht,Ye,0),i.identity(ht),i.rotateY(ht,ht,.5*Math.PI),un(it,Me,dt,ht,Ye,1),i.identity(ht),i.rotateX(ht,ht,.5*-Math.PI),un(it,Me,dt,ht,Ye,2),i.identity(ht),i.rotateX(ht,ht,.5*Math.PI),un(it,Me,dt,ht,Ye,3),i.identity(ht),un(it,Me,dt,ht,Ye,4),i.identity(ht),i.rotateY(ht,ht,Math.PI),un(it,Me,dt,ht,Ye,5),it.viewport.set([0,0,fe.width,fe.height])}(x,m),m.markSkyboxValid(x)):x.renderPass==="sky"&&function(fe,Me,Ne,st,it){const lt=fe.context,qe=lt.gl,Ye=fe.transform,dt=fe.useProgram("skybox");lt.activeTexture.set(qe.TEXTURE0),qe.bindTexture(qe.TEXTURE_CUBE_MAP,Me.skyboxTexture);const ht=((Bt,Pt,It,Ht,hi)=>({u_matrix:Bt,u_sun_direction:Pt,u_cubemap:0,u_opacity:Ht,u_temporal_offset:hi}))(Ye.skyboxMatrix,Me.getCenter(fe,!1),0,st,it);fe.prepareDrawProgram(lt,dt),dt.draw(lt,qe.TRIANGLES,Ne,i.StencilMode.disabled,fe.colorModeForRenderPass(),i.CullFaceMode.backCW,ht,"skybox",Me.skyboxGeometry.vertexBuffer,Me.skyboxGeometry.indexBuffer,Me.skyboxGeometry.segment)}(x,m,ee,P,pe):W==="gradient"&&x.renderPass==="sky"&&function(fe,Me,Ne,st,it){const lt=fe.context,qe=lt.gl,Ye=fe.transform,dt=fe.useProgram("skyboxGradient");Me.skyboxGeometry||(Me.skyboxGeometry=new gl(lt)),lt.activeTexture.set(qe.TEXTURE0);let ht=Me.colorRampTexture;ht||(ht=Me.colorRampTexture=new i.Texture(lt,Me.colorRamp,qe.RGBA)),ht.bind(qe.LINEAR,qe.CLAMP_TO_EDGE);const Bt=((Pt,It,Ht,hi,si)=>({u_matrix:Pt,u_color_ramp:0,u_center_direction:It,u_radius:i.degToRad(Ht),u_opacity:hi,u_temporal_offset:si}))(Ye.skyboxMatrix,Me.getCenter(fe,!1),Me.paint.get("sky-gradient-radius"),st,it);fe.prepareDrawProgram(lt,dt),dt.draw(lt,qe.TRIANGLES,Ne,i.StencilMode.disabled,fe.colorModeForRenderPass(),i.CullFaceMode.backCW,Bt,"skyboxGradient",Me.skyboxGeometry.vertexBuffer,Me.skyboxGeometry.indexBuffer,Me.skyboxGeometry.segment)}(x,m,ee,P,pe)},debug:function(x,a,m){for(let b=0;b<m.length;b++)Nh(x,a,m[b])},custom:function(x,a,m){const b=x.context,S=m.implementation;if(x.transform.projection.unsupportedLayers&&x.transform.projection.unsupportedLayers.includes("custom"))i.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if(x.renderPass==="offscreen"){const P=S.prerender;P&&(x.setCustomLayerDefaults(),b.setColorMode(x.colorModeForRenderPass()),P.call(S,b.gl,x.transform.customLayerMatrix()),b.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),b.setColorMode(x.colorModeForRenderPass()),b.setStencilMode(i.StencilMode.disabled);const P=S.renderingMode==="3d"?new i.DepthMode(x.context.gl.LEQUAL,i.DepthMode.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,i.DepthMode.ReadOnly);b.setDepthMode(P),S.render(b.gl,x.transform.customLayerMatrix()),b.setDirty(),x.setBaseState(),b.bindFramebuffer.set(null)}}};class cA{constructor(a,m){this.context=new Ee(a),this.transform=m,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Qa,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(a,m){const b=!!a&&!!a.terrain&&this.transform.projection.supportsTerrain;if(!(b||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new nA(this,a));const S=this._terrain;this.transform.elevation=b?S:null,S.update(a,this.transform,m)}_updateFog(a){const m=a.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[b,S]=m.getFovAdjustedRange(this.transform._fov);if(b>S)return void(this.transform.fogCullDistSq=null);const P=b+.78*(S-b);this.transform.fogCullDistSq=P*P}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(a,m){if(this.width=a*i.exported.devicePixelRatio,this.height=m*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const b of this.style.order)this.style._layers[b].resize()}setup(){const a=this.context,m=new i.StructArrayLayout2i4;m.emplaceBack(0,0),m.emplaceBack(i.EXTENT,0),m.emplaceBack(0,i.EXTENT),m.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=a.createVertexBuffer(m,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const b=new i.StructArrayLayout2i4;b.emplaceBack(0,0),b.emplaceBack(i.EXTENT,0),b.emplaceBack(0,i.EXTENT),b.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=a.createVertexBuffer(b,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const S=new i.StructArrayLayout2i4;S.emplaceBack(-1,-1),S.emplaceBack(1,-1),S.emplaceBack(-1,1),S.emplaceBack(1,1),this.viewportBuffer=a.createVertexBuffer(S,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const P=new i.StructArrayLayout4i8;P.emplaceBack(0,0,0,0),P.emplaceBack(i.EXTENT,0,i.EXTENT,0),P.emplaceBack(0,i.EXTENT,0,i.EXTENT),P.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=a.createVertexBuffer(P,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const H=new i.StructArrayLayout3ui6;H.emplaceBack(0,1,2),H.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=a.createIndexBuffer(H);const W=new i.StructArrayLayout1ui2;for(const pe of[0,1,3,2,0])W.emplaceBack(pe);this.debugIndexBuffer=a.createIndexBuffer(W),this.emptyTexture=new i.Texture(a,new i.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),a.gl.RGBA),this.identityMat=i.create();const ee=this.context.gl;this.stencilClearMode=new i.StencilMode({func:ee.ALWAYS,mask:0},0,255,ee.ZERO,ee.ZERO,ee.ZERO),this.loadTimeStamps.push(i.window.performance.now()),this.atmosphereBuffer=new Ur(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const a=this.context,m=a.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(a,m.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,$r(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(a,m,b){if(!m||this.currentStencilSource===m.id||!a.isTileClipped()||!b||b.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let W=!1;for(const ee of b)if(this._tileClippingMaskIDs[ee.key]===void 0){W=!0;break}if(!W)return}this.currentStencilSource=m.id;const S=this.context,P=S.gl;this.nextStencilID+b.length>256&&this.clearStencil(),S.setColorMode(i.ColorMode.disabled),S.setDepthMode(i.DepthMode.disabled);const H=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const W of b){const ee=m.getTile(W),pe=this._tileClippingMaskIDs[W.key]=this.nextStencilID++,{tileBoundsBuffer:fe,tileBoundsIndexBuffer:Me,tileBoundsSegments:Ne}=this.getTileBoundsBuffers(ee);H.draw(S,P.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:P.ALWAYS,mask:0},pe,255,P.KEEP,P.KEEP,P.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,$r(W.projMatrix),"$clipping",fe,Me,Ne)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const a=this.nextStencilID++,m=this.context.gl;return new i.StencilMode({func:m.NOTEQUAL,mask:255},a,255,m.KEEP,m.KEEP,m.REPLACE)}stencilModeForClipping(a){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(a);const m=this.context.gl;return new i.StencilMode({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[a.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(a){const m=this.context.gl,b=a.sort((H,W)=>W.overscaledZ-H.overscaledZ),S=b[b.length-1].overscaledZ,P=b[0].overscaledZ-S+1;if(P>1){this.currentStencilSource=void 0,this.nextStencilID+P>256&&this.clearStencil();const H={};for(let W=0;W<P;W++)H[W+S]=new i.StencilMode({func:m.GEQUAL,mask:255},W+this.nextStencilID,255,m.KEEP,m.KEEP,m.REPLACE);return this.nextStencilID+=P,[H,b]}return[{[S]:i.StencilMode.disabled},b]}colorModeForRenderPass(){const a=this.context.gl;return this._showOverdrawInspector?new i.ColorMode([a.CONSTANT_COLOR,a.ONE],new i.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?i.ColorMode.unblended:i.ColorMode.alphaBlended}depthModeForSublayer(a,m,b){if(!this.opaquePassEnabledForLayer())return i.DepthMode.disabled;const S=1-((1+this.currentLayer)*this.numSublayers+a)*this.depthEpsilon;return new i.DepthMode(b||this.context.gl.LEQUAL,m,[S,S])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(a,m){this.style=a,this.options=m,this.imageManager=a.imageManager,this.glyphManager=a.glyphManager,this.symbolFadeChange=a.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();const b=this.style.order,S=this.style._sourceCaches;for(const ee in S){const pe=S[ee];pe.used&&pe.prepare(this.context)}const P={},H={},W={};for(const ee in S){const pe=S[ee];P[ee]=pe.getVisibleCoordinates(),H[ee]=P[ee].slice().reverse(),W[ee]=pe.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let ee=0;ee<b.length;ee++)if(this.style._layers[b[ee]].is3D()){this.opaquePassCutoff=ee;break}if(this.terrain&&(this.terrain.updateTileBinding(W),this.opaquePassCutoff=0),this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new i.GlobeSharedBuffers(this.context)),i.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";for(const ee of b){const pe=this.style._layers[ee],fe=a._getLayerSourceCache(pe);if(!pe.hasOffscreenPass()||pe.isHidden(this.transform.zoom))continue;const Me=fe?H[fe.id]:void 0;(pe.type==="custom"||pe.isSky()||Me&&Me.length)&&this.renderLayer(this,fe,pe,Me)}if(this.depthRangeFor3D=[0,1-(a.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:m.showOverdrawInspector?i.Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=m.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=b.length-1;this.currentLayer>=0;this.currentLayer--){const ee=this.style._layers[b[this.currentLayer]],pe=a._getLayerSourceCache(ee);if(ee.isSky())continue;const fe=pe?H[pe.id]:void 0;this._renderTileClippingMasks(ee,pe,fe),this.renderLayer(this,pe,ee,fe)}if(this.style.fog&&this.transform.projection.supportsFog&&function(ee,pe){const fe=ee.context,Me=fe.gl,Ne=ee.transform,st=new i.DepthMode(Me.LEQUAL,i.DepthMode.ReadOnly,[0,1]),it=ee.useProgram("globeAtmosphere",null,Ne.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),lt=i.globeToMercatorTransition(Ne.zoom),qe=pe.properties.get("color").toArray01(),Ye=pe.properties.get("high-color").toArray01(),dt=pe.properties.get("space-color").toArray01PremultipliedAlpha(),ht=i.identity$1([]);i.rotateY$1(ht,ht,-i.degToRad(Ne._center.lng)),i.rotateX$1(ht,ht,i.degToRad(Ne._center.lat)),i.rotateZ$1(ht,ht,Ne.angle),i.rotateX$1(ht,ht,-Ne._pitch);const Bt=i.fromQuat(new Float32Array(16),ht),Pt=i.mapValue(pe.properties.get("star-intensity"),0,1,0,.25),It=5e-4,Ht=i.mapValue(pe.properties.get("horizon-blend"),0,1,It,.25),hi=i.globeUseCustomAntiAliasing(ee,fe,Ne)&&Ht===It?Ne.worldSize/(2*Math.PI*1.025)-1:Ne.globeRadius,si=ee.frameCounter/1e3%1,qt=i.length(Ne.globeCenterInViewSpace),ji=Math.sqrt(Math.pow(qt,2)-Math.pow(hi,2)),Kt=Math.acos(ji/qt),Ci=((Ri,Ai,Mi,$i,Jt,pi,In,Hn,Mn,$n,lr,On,_n,Dr)=>({u_frustum_tl:Ri,u_frustum_tr:Ai,u_frustum_br:Mi,u_frustum_bl:$i,u_horizon:Jt,u_transition:pi,u_fadeout_range:In,u_color:Hn,u_high_color:Mn,u_space_color:$n,u_star_intensity:lr,u_star_size:5*i.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:On,u_horizon_angle:_n,u_rotation_matrix:Dr}))(Ne.frustumCorners.TL,Ne.frustumCorners.TR,Ne.frustumCorners.BR,Ne.frustumCorners.BL,Ne.frustumCorners.horizon,lt,Ht,qe,Ye,dt,Pt,si,Kt,Bt);ee.prepareDrawProgram(fe,it);const di=ee.atmosphereBuffer;di&&it.draw(fe,Me.TRIANGLES,st,i.StencilMode.disabled,i.ColorMode.alphaBlended,i.CullFaceMode.backCW,Ci,"skybox",di.vertexBuffer,di.indexBuffer,di.segments)}(this,this.style.fog),this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||this.transform.projection.name!=="globe")&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<b.length;this.currentLayer++){const ee=this.style._layers[b[this.currentLayer]],pe=a._getLayerSourceCache(ee);ee.isSky()&&this.renderLayer(this,pe,ee,pe?H[pe.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<b.length;){const ee=this.style._layers[b[this.currentLayer]],pe=a._getLayerSourceCache(ee);if(ee.isSky()){++this.currentLayer;continue}if(this.terrain&&this.style.isLayerDraped(ee)){if(ee.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer);continue}const fe=pe?(ee.type==="symbol"?W:H)[pe.id]:void 0;this._renderTileClippingMasks(ee,pe,pe?P[pe.id]:void 0),this.renderLayer(this,pe,ee,fe),++this.currentLayer}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let ee=null;i.values(this.style._layers).forEach(pe=>{const fe=a._getLayerSourceCache(pe);fe&&!pe.isHidden(this.transform.zoom)&&(!ee||ee.getSource().maxzoom<fe.getSource().maxzoom)&&(ee=fe)}),ee&&this.options.showTileBoundaries&&gc.debug(this,ee,ee.getVisibleCoordinates())}this.options.showPadding&&function(ee){const pe=ee.transform.padding;mc(ee,ee.transform.height-(pe.top||0),3,ml),mc(ee,pe.bottom||0,3,kh),ha(ee,pe.left||0,3,Oh),ha(ee,ee.transform.width-(pe.right||0),3,lA);const fe=ee.transform.centerPoint;(function(Me,Ne,st,it){pn(Me,Ne-1,st-10,2,20,it),pn(Me,Ne-10,st-1,20,2,it)})(ee,fe.x,ee.transform.height-fe.y,sd)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(i.window.performance.now()),this.saveCanvasCopy())}}renderLayer(a,m,b,S){b.isHidden(this.transform.zoom)||(b.type==="background"||b.type==="sky"||b.type==="custom"||S&&S.length)&&(this.id=b.id,this.gpuTimingStart(b),a.transform.projection.unsupportedLayers&&a.transform.projection.unsupportedLayers.includes(b.type)||gc[b.type](a,m,b,S,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(a){if(!this.options.gpuTiming)return;const m=this.context.extTimerQuery;let b=this.gpuTimers[a.id];b||(b=this.gpuTimers[a.id]={calls:0,cpuTime:0,query:m.createQueryEXT()}),b.calls++,m.beginQueryEXT(m.TIME_ELAPSED_EXT,b.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const a=this.context.extTimerQuery,m=a.createQueryEXT();this.deferredRenderGpuTimeQueries.push(m),a.beginQueryEXT(a.TIME_ELAPSED_EXT,m)}}gpuTimingDeferredRenderEnd(){if(!this.options.gpuTimingDeferredRender)return;const a=this.context.extTimerQuery;a.endQueryEXT(a.TIME_ELAPSED_EXT)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const a=this.context.extTimerQuery;a.endQueryEXT(a.TIME_ELAPSED_EXT)}collectGpuTimers(){const a=this.gpuTimers;return this.gpuTimers={},a}collectDeferredRenderGpuQueries(){const a=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],a}queryGpuTimers(a){const m={};for(const b in a){const S=a[b],P=this.context.extTimerQuery,H=P.getQueryObjectEXT(S.query,P.QUERY_RESULT_EXT)/1e6;P.deleteQueryEXT(S.query),m[b]=H}return m}queryGpuTimeDeferredRender(a){if(!this.options.gpuTimingDeferredRender)return 0;const m=this.context.extTimerQuery;let b=0;for(const S of a)b+=m.getQueryObjectEXT(S,m.QUERY_RESULT_EXT)/1e6,m.deleteQueryEXT(S);return b}translatePosMatrix(a,m,b,S,P){if(!b[0]&&!b[1])return a;const H=P?S==="map"?this.transform.angle:0:S==="viewport"?-this.transform.angle:0;if(H){const pe=Math.sin(H),fe=Math.cos(H);b=[b[0]*fe-b[1]*pe,b[0]*pe+b[1]*fe]}const W=[P?b[0]:nt(m,b[0],this.transform.zoom),P?b[1]:nt(m,b[1],this.transform.zoom),0],ee=new Float32Array(16);return i.translate(ee,a,W),ee}saveTileTexture(a){const m=this._tileTextures[a.size[0]];m?m.push(a):this._tileTextures[a.size[0]]=[a]}getTileTexture(a){const m=this._tileTextures[a];return m&&m.length>0?m.pop():null}isPatternMissing(a){return a===null||a!==void 0&&!this.imageManager.getPattern(a.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const a=this.terrain&&this.terrain.renderingToTexture,m=this.terrain&&this.terrain.exaggeration()===0,b=this.style&&this.style.fog,S=[];return this.terrainRenderModeElevated()&&S.push("TERRAIN"),this.transform.projection.name==="globe"&&S.push("GLOBE"),m&&S.push("ZERO_EXAGGERATION"),b&&!a&&b.getOpacity(this.transform.pitch)!==0&&S.push("FOG"),a&&S.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&S.push("OVERDRAW_INSPECTOR"),S}useProgram(a,m,b){this.cache=this.cache||{};const S=b||[],P=this.currentGlobalDefines().concat(S),H=rA.cacheKey(Oc[a],a,P,m);return this.cache[H]||(this.cache[H]=new rA(this.context,a,Oc[a],m,id[a],P)),this.cache[H]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(a,m,b){if(this.terrain&&this.terrain.renderingToTexture)return;const S=this.style.fog;if(S){const P=S.getOpacity(this.transform.pitch),H=((W,ee,pe,fe,Me,Ne,st,it,lt,qe,Ye)=>{const dt=W.transform,ht=ee.properties.get("color").toArray01();ht[3]=fe;const Bt=W.frameCounter/1e3%1;return{u_fog_matrix:pe?dt.calculateFogTileMatrix(pe):W.identityMat,u_fog_range:ee.getFovAdjustedRange(dt._fov),u_fog_color:ht,u_fog_horizon_blend:ee.properties.get("horizon-blend"),u_fog_temporal_offset:Bt,u_frustum_tl:Me,u_frustum_tr:Ne,u_frustum_br:st,u_frustum_bl:it,u_globe_pos:lt,u_globe_radius:qe,u_viewport:Ye,u_globe_transition:i.globeToMercatorTransition(dt.zoom),u_is_globe:+(dt.projection.name==="globe")}})(this,S,b,P,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.exported.devicePixelRatio,this.transform.height*i.exported.devicePixelRatio]);m.setFogUniformValues(a,H)}}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const a=this.context.gl,m=a.createTexture();return a.bindTexture(a.TEXTURE_2D,m),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),m}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&a.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const a=this._backgroundTiles,m=this._backgroundTiles={},b=this.transform.coveringTiles({tileSize:512});for(const S of b)m[S.key]=a[S.key]||new i.Tile(S,512,this.transform.tileZoom,this);return m}clearBackgroundTiles(){this._backgroundTiles={}}}class Qh{constructor(a=0,m=0,b=0,S=0){if(isNaN(a)||a<0||isNaN(m)||m<0||isNaN(b)||b<0||isNaN(S)||S<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=m,this.left=b,this.right=S}interpolate(a,m,b){return m.top!=null&&a.top!=null&&(this.top=i.number(a.top,m.top,b)),m.bottom!=null&&a.bottom!=null&&(this.bottom=i.number(a.bottom,m.bottom,b)),m.left!=null&&a.left!=null&&(this.left=i.number(a.left,m.left,b)),m.right!=null&&a.right!=null&&(this.right=i.number(a.right,m.right,b)),this}getCenter(a,m){const b=i.clamp((this.left+a-this.right)/2,0,a),S=i.clamp((this.top+m-this.bottom)/2,0,m);return new i.pointGeometry(b,S)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new Qh(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function _c(x,a){const m=i.getColumn(x,3);i.fromQuat(x,a),i.setColumn(x,3,m)}function hA(x,a){const m=i.identity$1([]);return i.rotateZ$1(m,m,-a),i.rotateX$1(m,m,-x),m}function uA(x,a){const m=[x[0],x[1],0],b=[a[0],a[1],0];if(i.length(m)>=1e-15){const H=i.normalize([],m);i.scale$2(b,H,i.dot(b,H)),a[0]=b[0],a[1]=b[1]}const S=i.cross([],a,x);if(i.len(S)<1e-15)return null;const P=Math.atan2(-S[1],S[0]);return hA(Math.atan2(Math.sqrt(x[0]*x[0]+x[1]*x[1]),-x[2]),P)}class Vh{constructor(a,m){this.position=a,this.orientation=m}get position(){return this._position}set position(a){if(a){const m=a instanceof i.MercatorCoordinate?a:new i.MercatorCoordinate(a[0],a[1],a[2]);this._renderWorldCopies&&(m.x=i.wrap(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(a,m){if(this.orientation=null,!this.position)return;const b=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(a)):0,S=this.position,P=i.MercatorCoordinate.fromLngLat(a,b),H=[P.x-S.x,P.y-S.y,P.z-S.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=uA(H,m)}setPitchBearing(a,m){this.orientation=hA(i.degToRad(a),i.degToRad(-m))}}class Hh{constructor(a,m){this._transform=i.identity([]),this.orientation=m,this.position=a}get mercatorPosition(){const a=this.position;return new i.MercatorCoordinate(a[0],a[1],a[2])}get position(){const a=i.getColumn(this._transform,3);return[a[0],a[1],a[2]]}set position(a){var m;a&&i.setColumn(this._transform,3,[(m=a)[0],m[1],m[2],1])}get orientation(){return this._orientation}set orientation(a){this._orientation=a||i.identity$1([]),a&&_c(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),m=this.right();return{bearing:Math.atan2(-m[1],m[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,m){this._orientation=hA(a,m),_c(this._transform,this._orientation)}forward(){const a=i.getColumn(this._transform,2);return[-a[0],-a[1],-a[2]]}up(){const a=i.getColumn(this._transform,1);return[-a[0],-a[1],-a[2]]}right(){const a=i.getColumn(this._transform,0);return[a[0],a[1],a[2]]}getCameraToWorld(a,m){const b=new Float64Array(16);return i.invert(b,this.getWorldToCamera(a,m)),b}getWorldToCameraPosition(a,m,b){const S=this.position;i.scale$2(S,S,-a);const P=new Float64Array(16);return i.fromScaling(P,[b,b,b]),i.translate(P,P,S),P[10]*=m,P}getWorldToCamera(a,m){const b=new Float64Array(16),S=new Float64Array(4),P=this.position;return i.conjugate(S,this._orientation),i.scale$2(P,P,-a),i.fromQuat(b,S),i.translate(b,b,P),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=m,b[9]*=m,b[10]*=m,b[11]*=m,b}getCameraToClipPerspective(a,m,b,S){const P=new Float64Array(16);return i.perspective(P,a,m,b,S),P}getDistanceToElevation(a,m=!1){const b=a===0?0:i.mercatorZfromAltitude(a,m?i.latFromMercatorY(this.position[1]):this.position[1]),S=this.forward();return(b-this.position[2])/S[2]}clone(){return new Hh([...this.position],[...this.orientation])}}function ih(x,a){const m=Ms(x.projection,x.zoom,x.width,x.height),b=function(P,H,W,ee,pe){const fe=new i.LngLat(W.lng-180*fo,W.lat),Me=new i.LngLat(W.lng+180*fo,W.lat),Ne=P.project(fe.lng,fe.lat),st=P.project(Me.lng,Me.lat),it=-Math.atan2(st.y-Ne.y,st.x-Ne.x),lt=i.MercatorCoordinate.fromLngLat(W);lt.y=i.clamp(lt.y,-.999975,.999975);const qe=lt.toLngLat(),Ye=P.project(qe.lng,qe.lat),dt=i.MercatorCoordinate.fromLngLat(qe);dt.x+=fo;const ht=dt.toLngLat(),Bt=P.project(ht.lng,ht.lat),Pt=jl(Bt.x-Ye.x,Bt.y-Ye.y,it),It=i.MercatorCoordinate.fromLngLat(qe);It.y+=fo;const Ht=It.toLngLat(),hi=P.project(Ht.lng,Ht.lat),si=jl(hi.x-Ye.x,hi.y-Ye.y,it),qt=Math.abs(Pt.x)/Math.abs(si.y),ji=i.identity([]);i.rotateZ(ji,ji,-it*(1-(pe?0:ee)));const Kt=i.identity([]);return i.scale(Kt,Kt,[1,1-(1-qt)*ee,1]),Kt[4]=-si.x/si.y*ee,i.rotateZ(Kt,Kt,it),i.multiply(Kt,ji,Kt),Kt}(x.projection,0,x.center,m,a),S=yc(x);return i.scale(b,b,[S,S,1]),b}function yc(x){const a=x.projection,m=Ms(x.projection,x.zoom,x.width,x.height),b=Gh(a,x.center),S=Gh(a,i.LngLat.convert(a.center));return Math.pow(2,b*m+(1-m)*S)}function Ms(x,a,m,b,S=1/0){const P=x.range;if(!P)return 0;const H=Math.min(S,Math.max(m,b)),W=Math.log(H/1024)/Math.LN2;return i.smoothstep(P[0]+W,P[1]+W,a)}const fo=1/4e4;function Gh(x,a){const m=i.clamp(a.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),b=new i.LngLat(a.lng-180*fo,m),S=new i.LngLat(a.lng+180*fo,m),P=x.project(b.lng,m),H=x.project(S.lng,m),W=i.MercatorCoordinate.fromLngLat(b),ee=i.MercatorCoordinate.fromLngLat(S),pe=H.x-P.x,fe=H.y-P.y,Me=ee.x-W.x,Ne=ee.y-W.y,st=Math.sqrt((Me*Me+Ne*Ne)/(pe*pe+fe*fe));return Math.log(st)/Math.LN2}function jl(x,a,m){const b=Math.cos(m),S=Math.sin(m);return{x:x*b-a*S,y:x*S+a*b}}class Kl{constructor(a,m,b,S,P,H,W){this.tileSize=512,this._renderWorldCopies=P===void 0||P,this._minZoom=a||0,this._maxZoom=m||22,this._minPitch=b==null?0:b,this._maxPitch=S==null?60:S,this.setProjection(H),this.setMaxBounds(W),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Qh,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Hh,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const a=new Kl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,a.tileSize=this.tileSize,a.mercatorFromTransition=this.mercatorFromTransition,a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._seaLevelZoom=this._seaLevelZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a.frustumCorners=this.frustumCorners,a}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(a,m=!1){const b=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||b)&&this._updateCameraOnTerrain(),(a||b)&&this._constrainCamera(m),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels"])}setProjection(a){this.projectionOptions=a||{name:"mercator"};const m=this.projection?this.getProjection():void 0;this.projection=i.getProjection(this.projectionOptions);const b=!C(m,this.getProjection());return b&&this._calcMatrices(),this.mercatorFromTransition=!1,b}setMercatorFromTransition(){const a=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.getProjection({name:"mercator"});const m=a!==this.projection.name;return m&&this._calcMatrices(),m}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(a){a===void 0?a=!0:a===null&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return i.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(a){const m=-a*Math.PI/180;var b;this.angle!==m&&(this._unmodified=!1,this.angle=m,this._calcMatrices(),this.rotationMatrix=(b=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(b[1]=0,b[2]=0),b[0]=1,b[3]=1,b),function(S,P,H){var W=P[0],ee=P[1],pe=P[2],fe=P[3],Me=Math.sin(H),Ne=Math.cos(H);S[0]=W*Ne+pe*Me,S[1]=ee*Ne+fe*Me,S[2]=W*-Me+pe*Ne,S[3]=ee*-Me+fe*Ne}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(a){const m=i.clamp(a,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==m&&(this._unmodified=!1,this._pitch=m,this._calcMatrices())}get aspect(){return this.width/this.height}get fovX(){return this._fov}get fovY(){const a=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/a)}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=i.degToRad(a),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(a){const m=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==m&&(this._unmodified=!1,this._setZoom(m),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const a=this._elevation;this._centerAltitude=a.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=a.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const a=this._elevation,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],b=this.horizonLineFromTop();let S=0,P=0;for(let H=0;H<m.length;H++){const W=new i.pointGeometry(m[H][0]*this.width,b+m[H][1]*(this.height-b)),ee=a.pointCoordinate(W);if(!ee)continue;const pe=1/Math.hypot(ee[0]-this._camera.position[0],ee[1]-this._camera.position[1]);S+=ee[3]*pe,P+=pe}return P===0?NaN:S/P}get center(){return this._center}set center(a){a.lat===this._center.lat&&a.lng===this._center.lng||(this._unmodified=!1,this._center=a,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const a=this._seaLevelZoom,m=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),b=this.pixelsPerMeter/this.worldSize*m,S=this._mercatorZfromZoom(a),P=this._mercatorZfromZoom(this._maxZoom),H=Math.max(S-b,P);this._setZoom(this._zoomFromMercatorZ(H))}get padding(){return this._edgeInsets.toJSON()}set padding(a){this._edgeInsets.equals(a)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,a,1),this._calcMatrices())}computeZoomRelativeTo(a){const m=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,a.toAltitude()));let b;b=a.z<this._camera.position[2]?[m.x,m.y,m.z]:[a.x,a.y,a.z];const S=i.length(i.sub([],this._camera.position,b));return i.clamp(this._zoomFromMercatorZ(S),this._minZoom,this._maxZoom)}setFreeCameraOptions(a){if(!this.height||!a.position&&!a.orientation)return;this._updateCameraState();let m=!1;if(a.orientation&&!i.exactEquals(a.orientation,this._camera.orientation)&&(m=this._setCameraOrientation(a.orientation)),a.position){const b=[a.position.x,a.position.y,a.position.z];i.exactEquals$1(b,this._camera.position)||(this._setCameraPosition(b),m=!0)}m&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const a=this._camera.position,m=new Vh;return m.position=new i.MercatorCoordinate(a[0],a[1],a[2]),m.orientation=this._camera.orientation,m._elevation=this.elevation,m._renderWorldCopies=this.renderWorldCopies,m}_setCameraOrientation(a){if(!i.length$1(a))return!1;i.normalize$1(a,a);const m=i.transformQuat([],[0,0,-1],a),b=i.transformQuat([],[0,-1,0],a);if(b[2]<0)return!1;const S=uA(m,b);return!!S&&(this._camera.orientation=S,!0)}_setCameraPosition(a){const m=this.zoomScale(this.minZoom)*this.tileSize,b=this.zoomScale(this.maxZoom)*this.tileSize,S=this.cameraToCenterDistance;a[2]=i.clamp(a[2],S/b,S/m),this._camera.position=a}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(a){return this._edgeInsets.equals(a)}interpolatePadding(a,m,b){this._unmodified=!1,this._edgeInsets.interpolate(a,m,b),this._constrain(),this._calcMatrices()}coveringZoomLevel(a){const m=(a.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/a.tileSize));return Math.max(0,m)}getVisibleUnwrappedCoordinates(a){const m=[new i.UnwrappedTileID(0,a)];if(this.renderWorldCopies){const b=this.pointCoordinate(new i.pointGeometry(0,0)),S=this.pointCoordinate(new i.pointGeometry(this.width,0)),P=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),H=this.pointCoordinate(new i.pointGeometry(0,this.height)),W=Math.floor(Math.min(b.x,S.x,P.x,H.x)),ee=Math.floor(Math.max(b.x,S.x,P.x,H.x)),pe=1;for(let fe=W-pe;fe<=ee+pe;fe++)fe!==0&&m.push(new i.UnwrappedTileID(fe,a))}return m}coveringTiles(a){let m=this.coveringZoomLevel(a);const b=m,S=this.elevation&&!a.isTerrainDEM,P=this.projection.name==="mercator";if(a.minzoom!==void 0&&m<a.minzoom)return[];a.maxzoom!==void 0&&m>a.maxzoom&&(m=a.maxzoom);const H=this.locationCoordinate(this.center),W=this.center.lat,ee=1<<m,pe=[ee*H.x,ee*H.y,0],fe=this.projection.name==="globe",Me=!fe,Ne=i.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m,Me),st=fe?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),it=ee*i.mercatorZfromAltitude(1,this.center.lat),lt=this._camera.position[2]/i.mercatorZfromAltitude(1,this.center.lat),qe=[ee*st.x,ee*st.y,lt*(Me?1:it)],Ye=this.cameraToCenterDistance/a.tileSize*(a.roundZoom?1:.502),dt=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?m:0,ht=a.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,Bt=a.isTerrainDEM?-ht:this._elevation?this._elevation.getMinElevationBelowMSL():0,Pt=this.projection.isReprojectedInTileSpace?yc(this):1,It=Ai=>{const $i=new i.MercatorCoordinate(Ai.x+25e-6,Ai.y,Ai.z),Jt=new i.MercatorCoordinate(Ai.x,Ai.y+25e-6,Ai.z),pi=Ai.toLngLat(),In=$i.toLngLat(),Hn=Jt.toLngLat(),Mn=this.locationCoordinate(pi),$n=this.locationCoordinate(In),lr=this.locationCoordinate(Hn),On=Math.hypot($n.x-Mn.x,$n.y-Mn.y),_n=Math.hypot(lr.x-Mn.x,lr.y-Mn.y);return Math.sqrt(On*_n)*Pt/25e-6},Ht=Ai=>{const Mi=ht,$i=Bt;return{aabb:i.tileAABB(this,ee,0,0,0,Ai,$i,Mi,this.projection),zoom:0,x:0,y:0,minZ:$i,maxZ:Mi,wrap:Ai,fullyVisible:!1}},hi=[];let si=[];const qt=m,ji=a.reparseOverscaled?b:m,Kt=Ai=>Ai*Ai,Ci=Kt((lt-this._centerAltitude)*it),di=Ai=>{if(!this._elevation||!Ai.tileID||!P)return;const Mi=this._elevation.getMinMaxForTile(Ai.tileID),$i=Ai.aabb;Mi?($i.min[2]=Mi.min,$i.max[2]=Mi.max,$i.center[2]=($i.min[2]+$i.max[2])/2):(Ai.shouldSplit=Ri(Ai),Ai.shouldSplit||($i.min[2]=$i.max[2]=$i.center[2]=this._centerAltitude))},Ri=Ai=>{if(Ai.zoom<dt)return!0;if(Ai.zoom===qt)return!1;if(Ai.shouldSplit!=null)return Ai.shouldSplit;const Mi=Ai.aabb.distanceX(qe),$i=Ai.aabb.distanceY(qe);let Jt=Ci,pi=1;if(fe){Jt=Kt(Ai.aabb.distanceZ(qe));const Mn=Math.pow(2,Ai.zoom),$n=i.latFromMercatorY((Ai.y+1)/Mn),lr=i.latFromMercatorY(Ai.y/Mn),On=Math.min(Math.max(W,$n),lr),_n=i.circumferenceAtLatitude(On)/i.circumferenceAtLatitude(W);if(pi=On===W?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,_n/this._mercatorScaleRatio),this.zoom<=i.GLOBE_ZOOM_THRESHOLD_MIN&&Ai.zoom===qt-1&&_n>=.9)return!0}else if(S&&(Jt=Kt(Ai.aabb.distanceZ(qe)*it)),this.projection.isReprojectedInTileSpace&&b<=5){const Mn=Math.pow(2,Ai.zoom),$n=It(new i.MercatorCoordinate((Ai.x+.5)/Mn,(Ai.y+.5)/Mn));pi=$n>.85?1:$n}const In=Mi*Mi+$i*$i+Jt,Hn=Kt((1<<qt-Ai.zoom)*Ye*pi*((Mn,$n)=>{if($n*Kt(.707)<Mn)return 1;const lr=Math.sqrt($n/Mn);return lr/(1.4144271570014144+(Math.pow(1.1,lr-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(Jt,Ci),In));return In<Hn};if(this.renderWorldCopies)for(let Ai=1;Ai<=3;Ai++)hi.push(Ht(-Ai)),hi.push(Ht(Ai));for(hi.push(Ht(0));hi.length>0;){const Ai=hi.pop(),Mi=Ai.x,$i=Ai.y;let Jt=Ai.fullyVisible;if(!Jt){const pi=Ai.aabb.intersects(Ne);if(pi===0)continue;Jt=pi===2}if(Ai.zoom!==qt&&Ri(Ai))for(let pi=0;pi<4;pi++){const In=(Mi<<1)+pi%2,Hn=($i<<1)+(pi>>1),Mn={aabb:P?Ai.aabb.quadrant(pi):i.tileAABB(this,ee,Ai.zoom+1,In,Hn,Ai.wrap,Ai.minZ,Ai.maxZ,this.projection),zoom:Ai.zoom+1,x:In,y:Hn,wrap:Ai.wrap,fullyVisible:Jt,tileID:void 0,shouldSplit:void 0,minZ:Ai.minZ,maxZ:Ai.maxZ};S&&!fe&&(Mn.tileID=new i.OverscaledTileID(Ai.zoom+1===qt?ji:Ai.zoom+1,Ai.wrap,Ai.zoom+1,In,Hn),di(Mn)),hi.push(Mn)}else{const pi=Ai.zoom===qt?ji:Ai.zoom;if(a.minzoom&&a.minzoom>pi)continue;const In=pe[0]-(.5+Mi+(Ai.wrap<<Ai.zoom))*(1<<m-Ai.zoom),Hn=pe[1]-.5-$i,Mn=Ai.tileID?Ai.tileID:new i.OverscaledTileID(pi,Ai.wrap,Ai.zoom,Mi,$i);si.push({tileID:Mn,distanceSq:In*In+Hn*Hn})}}if(this.fogCullDistSq){const Ai=this.fogCullDistSq,Mi=this.horizonLineFromTop();si=si.filter($i=>{const Jt=[0,0,0,1],pi=[i.EXTENT,i.EXTENT,0,1],In=this.calculateFogTileMatrix($i.tileID.toUnwrapped());i.transformMat4$1(Jt,Jt,In),i.transformMat4$1(pi,pi,In);const Hn=i.getAABBPointSquareDist(Jt,pi);if(Hn===0)return!0;let Mn=!1;const $n=this._elevation;if($n&&Hn>Ai&&Mi!==0){const lr=this.calculateProjMatrix($i.tileID.toUnwrapped());let On;a.isTerrainDEM||(On=$n.getMinMaxForTile($i.tileID)),On||(On={min:Bt,max:ht});const _n=i.furthestTileCorner(this.rotation),Dr=[_n[0]*i.EXTENT,_n[1]*i.EXTENT,On.max];i.transformMat4(Dr,Dr,lr),Mn=(1-Dr[1])*this.height*.5<Mi}return Hn<Ai||Mn})}return si.sort((Ai,Mi)=>Ai.distanceSq-Mi.distanceSq).map(Ai=>Ai.tileID)}resize(a,m){this.width=a,this.height=m,this.pixelsToGLUnits=[2/a,-2/m],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(a){const m=i.clamp(a.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),b=this.projection.project(a.lng,m);return new i.pointGeometry(b.x*this.worldSize,b.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(a,m){let b,S;const P=this.centerPoint;if(this.projection.name==="globe"){const W=this.worldSize;b=(m.x-P.x)/W,S=(m.y-P.y)/W}else{const W=this.pointCoordinate(m),ee=this.pointCoordinate(P);b=W.x-ee.x,S=W.y-ee.y}const H=this.locationCoordinate(a);this.setLocation(new i.MercatorCoordinate(H.x-b,H.y-S))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a){return this.projection.locationPoint(this,a)}locationPoint3D(a){return this.projection.locationPoint(this,a,!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a){return this.coordinateLocation(this.pointCoordinate3D(a))}locationCoordinate(a,m){const b=m?i.mercatorZfromAltitude(m,a.lat):void 0,S=this.projection.project(a.lng,a.lat);return new i.MercatorCoordinate(S.x,S.y,b)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(a,m){const b=m!=null?m:this._centerAltitude,S=[a.x,a.y,0,1],P=[a.x,a.y,1,1];i.transformMat4$1(S,S,this.pixelMatrixInverse),i.transformMat4$1(P,P,this.pixelMatrixInverse);const H=P[3];i.scale$1(S,S,1/S[3]),i.scale$1(P,P,1/H);const W=S[2],ee=P[2];return{p0:S,p1:P,t:W===ee?0:(b-W)/(ee-W)}}screenPointToMercatorRay(a){const m=[a.x,a.y,0,1],b=[a.x,a.y,1,1];return i.transformMat4$1(m,m,this.pixelMatrixInverse),i.transformMat4$1(b,b,this.pixelMatrixInverse),i.scale$1(m,m,1/m[3]),i.scale$1(b,b,1/b[3]),m[2]=i.mercatorZfromAltitude(m[2],this._center.lat)*this.worldSize,b[2]=i.mercatorZfromAltitude(b[2],this._center.lat)*this.worldSize,i.scale$1(m,m,1/this.worldSize),i.scale$1(b,b,1/this.worldSize),new i.Ray([m[0],m[1],m[2]],i.normalize([],i.sub([],b,m)))}rayIntersectionCoordinate(a){const{p0:m,p1:b,t:S}=a,P=i.mercatorZfromAltitude(m[2],this._center.lat),H=i.mercatorZfromAltitude(b[2],this._center.lat);return new i.MercatorCoordinate(i.number(m[0],b[0],S)/this.worldSize,i.number(m[1],b[1],S)/this.worldSize,i.number(P,H,S))}pointCoordinate(a,m=this._centerAltitude){return this.projection.pointCoordinate(this,a.x,a.y,m)}pointCoordinate3D(a){if(!this.elevation)return this.pointCoordinate(a);let m=this.projection.pointCoordinate3D(this,a.x,a.y);if(m)return new i.MercatorCoordinate(m[0],m[1],m[2]);let b=0,S=this.horizonLineFromTop();if(a.y>S)return this.pointCoordinate(a);const P=.02*S,H=a.clone();for(let W=0;W<10&&S-b>P;W++){H.y=i.number(b,S,.66);const ee=this.projection.pointCoordinate3D(this,H.x,H.y);ee?(S=H.y,m=ee):b=H.y}return m?new i.MercatorCoordinate(m[0],m[1],m[2]):this.pointCoordinate(a)}isPointAboveHorizon(a){return this.projection.isPointAboveHorizon(this,a)}_coordinatePoint(a,m){const b=m&&this.elevation?this.elevation.getAtPointOrZero(a,this._centerAltitude):this._centerAltitude,S=[a.x*this.worldSize,a.y*this.worldSize,b+a.toAltitude(),1];return i.transformMat4$1(S,S,this.pixelMatrix),S[3]>0?new i.pointGeometry(S[0]/S[3],S[1]/S[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getGlobeBounds(){const{top:a,left:m}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,S=this.width-this._edgeInsets.right,P=this.pointCoordinate3D(new i.pointGeometry(m,a)),H=this.pointCoordinate3D(new i.pointGeometry(S,a)),W=this.pointCoordinate3D(new i.pointGeometry(S,b)),ee=this.pointCoordinate3D(new i.pointGeometry(m,b));let pe=Math.min(P.x,ee.x),fe=Math.max(H.x,W.x),Me=Math.min(P.y,H.y),Ne=Math.max(ee.y,W.y);const st=Math.pow(2,-this.zoom)/16,it=(It,Ht,hi,si)=>{const qt=(It+hi)/2,ji=(Ht+si)/2,Kt=new i.pointGeometry(qt,ji),Ci=this.pointCoordinate3D(Kt),di=Math.max(0,pe-Ci.x,Me-Ci.y,Ci.x-fe,Ci.y-Ne);pe=Math.min(pe,Ci.x),fe=Math.max(fe,Ci.x),Me=Math.min(Me,Ci.y),Ne=Math.max(Ne,Ci.y),di>st&&(it(It,Ht,qt,ji),it(qt,ji,hi,si))};it(m,a,S,a),it(S,a,S,b),it(S,b,m,b),it(m,b,m,a);const[lt,qe]=i.polesInViewport(this),Ye=lt||qe,dt=lt?90:i.latFromMercatorY(Me),ht=Ye?180:i.lngFromMercatorX(fe),Bt=qe?-90:i.latFromMercatorY(Ne),Pt=Ye?-180:i.lngFromMercatorX(pe);return new i.LngLatBounds(new i.LngLat(Pt,Bt),new i.LngLat(ht,dt))}_getBounds(a,m){if(this.projection.name==="globe")return this._getGlobeBounds();const b=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),S=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),P=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),H=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let W=this.pointCoordinate(b,a),ee=this.pointCoordinate(S,a);const pe=this.pointCoordinate(P,m),fe=this.pointCoordinate(H,m),Me=(Ne,st)=>(st.y-Ne.y)/(st.x-Ne.x);return W.y>1&&ee.y>=0?W=new i.MercatorCoordinate((1-fe.y)/Me(fe,W)+fe.x,1):W.y<0&&ee.y<=1&&(W=new i.MercatorCoordinate(-fe.y/Me(fe,W)+fe.x,0)),ee.y>1&&W.y>=0?ee=new i.MercatorCoordinate((1-pe.y)/Me(pe,ee)+pe.x,1):ee.y<0&&W.y<=1&&(ee=new i.MercatorCoordinate(-pe.y/Me(pe,ee)+pe.x,0)),new i.LngLatBounds().extend(this.coordinateLocation(W)).extend(this.coordinateLocation(ee)).extend(this.coordinateLocation(fe)).extend(this.coordinateLocation(pe))}_getBounds3D(){const a=this.elevation;if(!a.visibleDemTiles.length||a.isUsingMockSource())return this._getBounds(0,0);const m=a.visibleDemTiles.reduce((b,S)=>{if(S.dem){const P=S.dem.tree;b.min=Math.min(b.min,P.minimums[0]),b.max=Math.max(b.max,P.maximums[0])}return b},{min:Number.MAX_VALUE,max:0});return this._getBounds(m.min*a.exaggeration(),m.max*a.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(a=!0){const m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,b=this.height/2-m*(1-this._horizonShift);return a?Math.max(0,b):b}getMaxBounds(){return this.maxBounds}setMaxBounds(a){this.maxBounds=a,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,a&&(this.minLat=a.getSouth(),this.maxLat=a.getNorth(),this.minLng=a.getWest(),this.maxLng=a.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=i.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=i.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=i.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(a,m){return this.projection.createTileMatrix(this,m,a)}calculateDistanceTileData(a){const m=a.key,b=this._distanceTileDataCache;if(b[m])return b[m];const S=a.canonical,P=1/this.height,H=this.cameraWorldSize,W=H/this.zoomScale(S.z),ee=(S.x+Math.pow(2,S.z)*a.wrap)*W,pe=S.y*W,fe=this.point;fe.x*=H/this.worldSize,fe.y*=H/this.worldSize;const Me=this.angle,Ne=Math.sin(-Me),st=-Math.cos(-Me);return b[m]={bearing:[Ne,st],center:[(fe.x-ee)*P,(fe.y-pe)*P],scale:W/i.EXTENT*P},b[m]}calculateFogTileMatrix(a){const m=a.key,b=this._fogTileMatrixCache;if(b[m])return b[m];const S=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,a);return i.multiply(S,this.worldToFogMatrix,S),b[m]=new Float32Array(S),b[m]}calculateProjMatrix(a,m=!1){const b=a.key,S=m?this._alignedProjMatrixCache:this._projMatrixCache;if(S[b])return S[b];const P=this.calculatePosMatrix(a,this.worldSize);return i.multiply(P,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:m?this.alignedProjMatrix:this.projMatrix,P),S[b]=new Float32Array(P),S[b]}calculatePixelsToTileUnitsMatrix(a){const m=a.tileID.key,b=this._pixelsToTileUnitsCache;if(b[m])return b[m];const S=function(P,H){const{scale:W}=P.tileTransform,ee=W*i.EXTENT/(P.tileSize*Math.pow(2,H.zoom-P.tileID.overscaledZ+P.tileID.canonical.z));return pe=new Float32Array(4),Ne=(fe=H.inverseAdjustmentMatrix)[1],st=fe[2],it=fe[3],qe=(Me=[ee,ee])[1],pe[0]=fe[0]*(lt=Me[0]),pe[1]=Ne*lt,pe[2]=st*qe,pe[3]=it*qe,pe;var pe,fe,Me,Ne,st,it,lt,qe}(a,this);return b[m]=S,b[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const a=this._elevation;this._updateCameraState();const m=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,b=this._computeCameraPosition(m),S=this._camera.forward(),P=i.mercatorZfromAltitude(1,this._center.lat);b[2]/=P,S[2]/=P,i.normalize(S,S);const H=a.raycast(b,S,a.exaggeration());if(H){const W=i.scaleAndAdd([],b,S,H),ee=new i.MercatorCoordinate(W[0],W[1],i.mercatorZfromAltitude(W[2],i.latFromMercatorY(W[1]))),pe=(ee.z+i.length([ee.x-b[0],ee.y-b[1],ee.z-b[2]*P]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(pe),this._centerAltitude=ee.toAltitude(),this._center=this.coordinateLocation(ee),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(a=!1){if(!this._elevation)return;const m=this._elevation,b=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,S=this._computeCameraPosition(b),P=m.getAtPointOrZero(new i.MercatorCoordinate(...S)),H=this.pixelsPerMeter/this.worldSize*P,W=this._minimumHeightOverTerrain(),ee=S[2]-H;if(ee<=W)if(ee<0||a){const pe=this.locationCoordinate(this._center,this._centerAltitude),fe=[S[0],S[1],pe.z-S[2]],Me=i.length(fe);fe[2]-=(W-ee)/this._pixelsPerMercatorPixel;const Ne=i.length(fe);if(Ne===0)return;i.scale$2(fe,fe,Me/Ne*this._pixelsPerMercatorPixel),this._camera.position=[S[0],S[1],pe.z*this._pixelsPerMercatorPixel-fe[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const a=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||a){const Ne=this.center;return Ne.lat=i.clamp(Ne.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!a)&&(Ne.lng=i.clamp(Ne.lng,this.minLng,this.maxLng)),this.center=Ne,void(this._constraining=!1)}const m=this._unmodified,{x:b,y:S}=this.point;let P=0,H=b,W=S;const ee=this.width/2,pe=this.height/2,fe=this.worldMinY*this.scale,Me=this.worldMaxY*this.scale;if(S-pe<fe&&(W=fe+pe),S+pe>Me&&(W=Me-pe),Me-fe<this.height&&(P=Math.max(P,this.height/(Me-fe)),W=(Me+fe)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const Ne=this.worldMinX*this.scale,st=this.worldMaxX*this.scale,it=this.worldSize/2-(Ne+st)/2;H=(b+it+this.worldSize)%this.worldSize-it,H-ee<Ne&&(H=Ne+ee),H+ee>st&&(H=st-ee),st-Ne<this.width&&(P=Math.max(P,this.width/(st-Ne)),H=(st+Ne)/2)}H===b&&W===S||(this.center=this.unproject(new i.pointGeometry(H,W))),P&&(this.zoom+=this.scaleZoom(P)),this._constrainCamera(),this._unmodified=m,this._constraining=!1}_minZoomForBounds(){let a=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(a=Math.max(a,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),a}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const a=this.centerOffset,m=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=i.mercatorZfromAltitude(1,this.center.lat)/i.mercatorZfromAltitude(1,i.GLOBE_SCALE_MATCH_LATITUDE));const b=Ms(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,b),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const S=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?m:1),P=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);P[8]=2*-a.x/this.width,P[9]=2*a.y/this.height;let H=i.mul([],P,S);if(this.projection.isReprojectedInTileSpace){const Pt=this.locationCoordinate(this.center),It=i.identity([]);i.translate(It,It,[Pt.x*this.worldSize,Pt.y*this.worldSize,0]),i.multiply(It,It,ih(this)),i.translate(It,It,[-Pt.x*this.worldSize,-Pt.y*this.worldSize,0]),i.multiply(H,H,It),this.inverseAdjustmentMatrix=function(Ht){const hi=ih(Ht,!0);return Ge([],[hi[0],hi[1],hi[4],hi[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=i.scale([],H,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=H,this.invProjMatrix=i.invert(new Float64Array(16),this.projMatrix);const W=i.invert([],P);this.frustumCorners=i.FrustumCorners.fromInvProjectionMatrix(W,this.horizonLineFromTop(),this.height);const ee=new Float32Array(16);i.identity(ee),i.scale(ee,ee,[1,-1,1]),i.rotateX(ee,ee,this._pitch),i.rotateZ(ee,ee,this.angle);const pe=i.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),fe=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;pe[8]=2*-a.x/this.width,pe[9]=2*(a.y+fe)/this.height,this.skyboxMatrix=i.multiply(ee,pe,ee);const Me=this.point,Ne=Me.x,st=Me.y,it=this.width%2/2,lt=this.height%2/2,qe=Math.cos(this.angle),Ye=Math.sin(this.angle),dt=Ne-Math.round(Ne)+qe*it+Ye*lt,ht=st-Math.round(st)+qe*lt+Ye*it,Bt=new Float64Array(H);if(i.translate(Bt,Bt,[dt>.5?dt-1:dt,ht>.5?ht-1:ht,0]),this.alignedProjMatrix=Bt,H=i.create(),i.scale(H,H,[this.width/2,-this.height/2,1]),i.translate(H,H,[1,-1,0]),this.labelPlaneMatrix=H,H=i.create(),i.scale(H,H,[1,-1,1]),i.translate(H,H,[-1,-1,0]),i.scale(H,H,[2/this.width,2/this.height,1]),this.glCoordMatrix=H,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},H=i.invert(new Float64Array(16),this.pixelMatrix),!H)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=H,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=i.calculateGlobeMatrix(this);const Pt=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.transformMat4(Pt,Pt,S),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=H;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const a=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,b=this._camera.position,S=1/this.height/this._pixelsPerMercatorPixel,P=[a,a,m];i.scale$2(P,P,S),i.scale$2(b,b,-1),i.multiply$2(b,b,P);const H=i.create();i.translate(H,H,b),i.scale(H,H,P),this.mercatorFogMatrix=H,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(a,m,S)}_computeCameraPosition(a){const m=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),S=this.point,P=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-a/this.worldSize*this._centerAltitude;return[S.x/this.worldSize-b[0]*P,S.y/this.worldSize-b[1]*P,a/this.worldSize*this._centerAltitude-b[2]*P]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(a){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),b=this._camera.position[2],S=a[2];let P=1;this.projection.wrap&&(this.center=this.center.wrap()),S>0&&(P=Math.min((m-b)/S,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,a,P),this._updateStateFromCamera()}_updateStateFromCamera(){const a=this._camera.position,m=this._camera.forward(),{pitch:b,bearing:S}=this._camera.getPitchBearing(),P=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,H=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),W=Math.max((a[2]-P)/Math.cos(b),H),ee=this._zoomFromMercatorZ(W);i.scaleAndAdd(a,a,m,W),this._pitch=i.clamp(b,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(S,-Math.PI,Math.PI),this._setZoom(i.clamp(ee,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.MercatorCoordinate(a[0],a[1],a[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min((this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(a*this.tileSize))}zoomFromMercatorZAdjusted(a){const m=H=>{const W=this.getCameraToCenterDistance(this.projection,H);return this.scaleZoom(W/(a*this.tileSize))};let b,S=m(this.zoom),P=Math.abs(S-m(S));for(;b!==P;)S=m(S),b=P,P=Math.abs(S-m(S));return S}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(a,m){const b=Math.min(a.x,m.x),S=Math.max(a.x,m.x),P=Math.min(a.y,m.y),H=Math.max(a.y,m.y);if(P<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const W=[new i.pointGeometry(b,P),new i.pointGeometry(S,H),new i.pointGeometry(b,H),new i.pointGeometry(S,P)],ee=this.renderWorldCopies?-3:0,pe=this.renderWorldCopies?4:1;for(const fe of W){const Me=this.pointRayIntersection(fe);if(Me.t<0)return!0;const Ne=this.rayIntersectionCoordinate(Me);if(Ne.x<ee||Ne.y<0||Ne.x>pe||Ne.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(a,m){const b=i.length(i.sub([],this._camera.position,a)),S=this._zoomFromMercatorZ(b)+m;return b-this._mercatorZfromZoom(S)}getCameraPoint(){if(this.projection.name==="globe"){const a=function([m,b,S],P){const H=[m,b,S,1];i.transformMat4$1(H,H,P);const W=H[3]=Math.max(H[3],1e-6);return H[0]/=W,H[1]/=W,H[2]/=W,H}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.pointGeometry(a[0],a[1])}{const a=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,a))}}getCameraToCenterDistance(a,m=this.zoom){const b=Ms(a,m,this.width,this.height,1024),S=a.pixelSpaceConversion(this.center.lat,this.worldSize,b);return .5/Math.tan(.5*this._fov)*this.height*S}getWorldToCameraMatrix(){const a=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&i.multiply(a,a,this.globeMatrix),a}}function _l(x,a){let m=!1,b=null;const S=()=>{b=null,m&&(x(),b=setTimeout(S,a),m=!1)};return()=>(m=!0,b||S(),b)}class An{constructor(a){this._hashName=a&&encodeURIComponent(a),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=_l(this._updateHashUnthrottled.bind(this),300)}addTo(a){return this._map=a,i.window.addEventListener("hashchange",this._onHashChange,!1),a.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),i.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const a=this._map;if(!a)return"";const m=xs(a);if(this._hashName){const b=this._hashName;let S=!1;const P=i.window.location.hash.slice(1).split("&").map(H=>{const W=H.split("=")[0];return W===b?(S=!0,`${W}=${m}`):H}).filter(H=>H);return S||P.push(`${b}=${m}`),`#${P.join("&")}`}return`#${m}`}_getCurrentHash(){const a=i.window.location.hash.replace("#","");if(this._hashName){let m;return a.split("&").map(b=>b.split("=")).forEach(b=>{b[0]===this._hashName&&(m=b)}),(m&&m[1]||"").split("/")}return a.split("/")}_onHashChange(){const a=this._map;if(!a)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(b=>isNaN(b))){const b=a.dragRotate.isEnabled()&&a.touchZoomRotate.isEnabled()?+(m[3]||0):a.getBearing();return a.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:b,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){const a=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,a)}}function xs(x,a){const m=x.getCenter(),b=Math.round(100*x.getZoom())/100,S=Math.ceil((b*Math.LN2+Math.log(512/360/.5))/Math.LN10),P=Math.pow(10,S),H=Math.round(m.lng*P)/P,W=Math.round(m.lat*P)/P,ee=x.getBearing(),pe=x.getPitch();let fe=a?`/${H}/${W}/${b}`:`${b}/${W}/${H}`;return(ee||pe)&&(fe+="/"+Math.round(10*ee)/10),pe&&(fe+=`/${Math.round(pe)}`),fe}const Zr={linearity:.3,easing:i.bezier(0,0,.3,1)},nh=i.extend({deceleration:2500,maxSpeed:1400},Zr),Wh=i.extend({deceleration:20,maxSpeed:1400},Zr),xc=i.extend({deceleration:1e3,maxSpeed:360},Zr),AA=i.extend({deceleration:1e3,maxSpeed:90},Zr);class jh{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(a){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:a})}_drainInertiaBuffer(){const a=this._inertiaBuffer,m=i.exported.now();for(;a.length>0&&m-a[0].time>160;)a.shift()}_onMoveEnd(a){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const m={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:P}of this._inertiaBuffer)m.zoom+=P.zoomDelta||0,m.bearing+=P.bearingDelta||0,m.pitch+=P.pitchDelta||0,P.panDelta&&m.pan._add(P.panDelta),P.around&&(m.around=P.around),P.pinchAround&&(m.pinchAround=P.pinchAround);const b=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,S={};if(m.pan.mag()){const P=uo(m.pan.mag(),b,i.extend({},nh,a||{}));S.offset=m.pan.mult(P.amount/m.pan.mag()),S.center=this._map.transform.center,rh(S,P)}if(m.zoom){const P=uo(m.zoom,b,Wh);S.zoom=this._map.transform.zoom+P.amount,rh(S,P)}if(m.bearing){const P=uo(m.bearing,b,xc);S.bearing=this._map.transform.bearing+i.clamp(P.amount,-179,179),rh(S,P)}if(m.pitch){const P=uo(m.pitch,b,AA);S.pitch=this._map.transform.pitch+P.amount,rh(S,P)}if(S.zoom||S.bearing){const P=m.pinchAround===void 0?m.around:m.pinchAround;S.around=P?this._map.unproject(P):this._map.getCenter()}return this.clear(),S.noMoveStart=!0,S}}function rh(x,a){(!x.duration||x.duration<a.duration)&&(x.duration=a.duration,x.easing=a.easing)}function uo(x,a,m){const{maxSpeed:b,linearity:S,deceleration:P}=m,H=i.clamp(x*S/(a/1e3),-b,b),W=Math.abs(H)/(P*S);return{easing:m.easing,duration:1e3*W,amount:H*(W/2)}}class Js extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,m,b,S={}){const P=me(m.getCanvasContainer(),b),H=m.unproject(P);super(a,i.extend({point:P,lngLat:H,originalEvent:b},S)),this._defaultPrevented=!1,this.target=m}}class Fn extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,m,b){const S=a==="touchend"?b.changedTouches:b.touches,P=De(m.getCanvasContainer(),S),H=P.map(ee=>m.unproject(ee)),W=P.reduce((ee,pe,fe,Me)=>ee.add(pe.div(Me.length)),new i.pointGeometry(0,0));super(a,{points:P,point:W,lngLats:H,lngLat:m.unproject(W),originalEvent:b}),this._defaultPrevented=!1}}class Vn extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,m,b){super(a,{originalEvent:b}),this._defaultPrevented=!1}}class sh{constructor(a,m){this._map=a,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(a){return this._firePreventable(new Vn(a.type,this._map,a))}mousedown(a,m){return this._mousedownPos=m,this._firePreventable(new Js(a.type,this._map,a))}mouseup(a){this._map.fire(new Js(a.type,this._map,a))}preclick(a){const m=i.extend({},a);m.type="preclick",this._map.fire(new Js(m.type,this._map,m))}click(a,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(a),this._map.fire(new Js(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new Js(a.type,this._map,a))}mouseover(a){this._map.fire(new Js(a.type,this._map,a))}mouseout(a){this._map.fire(new Js(a.type,this._map,a))}touchstart(a){return this._firePreventable(new Fn(a.type,this._map,a))}touchmove(a){this._map.fire(new Fn(a.type,this._map,a))}touchend(a){this._map.fire(new Fn(a.type,this._map,a))}touchcancel(a){this._map.fire(new Fn(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class dA{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(a){this._map.fire(new Js(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Js("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new Js(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yl{constructor(a,m){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,m){this.isEnabled()&&a.shiftKey&&a.button===0&&(ae(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(a,m){if(!this._active)return;const b=m,S=this._startPos,P=this._lastPos;if(!S||!P||P.equals(b)||!this._box&&b.dist(S)<this._clickTolerance)return;this._lastPos=b,this._box||(this._box=z("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",a));const H=Math.min(S.x,b.x),W=Math.max(S.x,b.x),ee=Math.min(S.y,b.y),pe=Math.max(S.y,b.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${H}px,${ee}px)`,this._box.style.width=W-H+"px",this._box.style.height=pe-ee+"px")})}mouseupWindow(a,m){if(!this._active)return;const b=this._startPos,S=m;if(b&&a.button===0){if(this.reset(),we(),b.x!==S.x||b.y!==S.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:a})),{cameraAnimation:P=>P.fitScreenCoordinates(b,S,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",a)}}keydown(a){this._active&&a.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),ce(),delete this._startPos,delete this._lastPos}_fireEvent(a,m){return this._map.fire(new i.Event(a,{originalEvent:m}))}}function Cs(x,a){const m={};for(let b=0;b<x.length;b++)m[x[b].identifier]=a[b];return m}class Ga{constructor(a){this.reset(),this.numTouches=a.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(a,m,b){(this.centroid||b.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=a.timeStamp),b.length===this.numTouches&&(this.centroid=function(S){const P=new i.pointGeometry(0,0);for(const H of S)P._add(H);return P.div(S.length)}(m),this.touches=Cs(b,m)))}touchmove(a,m,b){if(this.aborted||!this.centroid)return;const S=Cs(b,m);for(const P in this.touches){const H=this.touches[P],W=S[P];(!W||W.dist(H)>30)&&(this.aborted=!0)}}touchend(a,m,b){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),b.length===0){const S=!this.aborted&&this.centroid;if(this.reset(),S)return S}}}class Go{constructor(a){this.singleTap=new Ga(a),this.numTaps=a.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(a,m,b){this.singleTap.touchstart(a,m,b)}touchmove(a,m,b){this.singleTap.touchmove(a,m,b)}touchend(a,m,b){const S=this.singleTap.touchend(a,m,b);if(S){const P=a.timeStamp-this.lastTime<500,H=!this.lastTap||this.lastTap.dist(S)<30;if(P&&H||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=S,this.count===this.numTaps)return this.reset(),S}}}class pA{constructor(){this._zoomIn=new Go({numTouches:1,numTaps:2}),this._zoomOut=new Go({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,m,b){this._zoomIn.touchstart(a,m,b),this._zoomOut.touchstart(a,m,b)}touchmove(a,m,b){this._zoomIn.touchmove(a,m,b),this._zoomOut.touchmove(a,m,b)}touchend(a,m,b){const S=this._zoomIn.touchend(a,m,b),P=this._zoomOut.touchend(a,m,b);return S?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:H=>H.easeTo({duration:300,zoom:H.getZoom()+1,around:H.unproject(S)},{originalEvent:a})}):P?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:H=>H.easeTo({duration:300,zoom:H.getZoom()-1,around:H.unproject(P)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const va={0:1,2:2};class hs{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(a,m){return!1}_move(a,m){return{}}mousedown(a,m){if(this._lastPoint)return;const b=Je(a);this._correctButton(a,b)&&(this._lastPoint=m,this._eventButton=b)}mousemoveWindow(a,m){const b=this._lastPoint;if(b){if(a.preventDefault(),this._eventButton!=null&&function(S,P){const H=va[P];return S.buttons===void 0||(S.buttons&H)!==H}(a,this._eventButton))this.reset();else if(this._moved||!(m.dist(b)<this._clickTolerance))return this._moved=!0,this._lastPoint=m,this._move(b,m)}}mouseupWindow(a){this._lastPoint&&Je(a)===this._eventButton&&(this._moved&&we(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Is extends hs{mousedown(a,m){super.mousedown(a,m),this._lastPoint&&(this._active=!0)}_correctButton(a,m){return m===0&&!a.ctrlKey}_move(a,m){return{around:m,panDelta:m.sub(a)}}}class Kh extends hs{_correctButton(a,m){return m===0&&a.ctrlKey||m===2}_move(a,m){const b=.8*(m.x-a.x);if(b)return this._active=!0,{bearingDelta:b}}contextmenu(a){a.preventDefault()}}class xl extends hs{_correctButton(a,m){return m===0&&a.ctrlKey||m===2}_move(a,m){const b=-.5*(m.y-a.y);if(b)return this._active=!0,{pitchDelta:b}}contextmenu(a){a.preventDefault()}}class M{constructor(a,m){this._map=a,this._el=a.getCanvasContainer(),this._minTouches=1,this._clickTolerance=m.clickTolerance||1,this.reset(),i.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0)}touchstart(a,m,b){return this._calculateTransform(a,m,b)}touchmove(a,m,b){if(this._active&&!(b.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(b.length===1&&!i.isFullscreen())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return a.cancelable&&a.preventDefault(),this._calculateTransform(a,m,b)}}touchend(a,m,b){this._calculateTransform(a,m,b),this._active&&b.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(a,m,b){b.length>0&&(this._active=!0);const S=Cs(b,m),P=new i.pointGeometry(0,0),H=new i.pointGeometry(0,0);let W=0;for(const pe in S){const fe=S[pe],Me=this._touches[pe];Me&&(P._add(fe),H._add(fe.sub(Me)),W++,S[pe]=fe)}if(this._touches=S,W<this._minTouches||!H.mag())return;const ee=H.div(W);return this._sum._add(ee),this._sum.mag()<this._clickTolerance?void 0:{around:P.div(W),panDelta:ee}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=z("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class h{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(a){}_move(a,m,b){return{}}touchstart(a,m,b){this._firstTwoTouches||b.length<2||(this._firstTwoTouches=[b[0].identifier,b[1].identifier],this._start([m[0],m[1]]))}touchmove(a,m,b){const S=this._firstTwoTouches;if(!S)return;a.preventDefault();const[P,H]=S,W=_(b,m,P),ee=_(b,m,H);if(!W||!ee)return;const pe=this._aroundCenter?null:W.add(ee).div(2);return this._move([W,ee],pe,a)}touchend(a,m,b){if(!this._firstTwoTouches)return;const[S,P]=this._firstTwoTouches,H=_(b,m,S),W=_(b,m,P);H&&W||(this._active&&we(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&a.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function _(x,a,m){for(let b=0;b<x.length;b++)if(x[b].identifier===m)return a[b]}function T(x,a){return Math.log(x/a)/Math.LN2}class F extends h{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(a){this._startDistance=this._distance=a[0].dist(a[1])}_move(a,m){const b=this._distance;if(this._distance=a[0].dist(a[1]),this._active||!(Math.abs(T(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:T(this._distance,b),pinchAround:m}}}function O(x,a){return 180*x.angleWith(a)/Math.PI}class K extends h{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,m){const b=this._vector;if(this._vector=a[0].sub(a[1]),b&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:O(this._vector,b),pinchAround:m}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const m=25/(Math.PI*this._minDiameter)*360,b=this._startVector;if(!b)return!1;const S=O(a,b);return Math.abs(S)<m}}function oe(x){return Math.abs(x.y)>Math.abs(x.x)}class ue extends h{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(a){this._lastPoints=a,oe(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,m,b){const S=this._lastPoints;if(!S)return;const P=a[0].sub(S[0]),H=a[1].sub(S[1]);return this._map._cooperativeGestures&&!i.isFullscreen()&&b.touches.length<3||(this._valid=this.gestureBeginsVertically(P,H,b.timeStamp),!this._valid)?void 0:(this._lastPoints=a,this._active=!0,{pitchDelta:(P.y+H.y)/2*-.5})}gestureBeginsVertically(a,m,b){if(this._valid!==void 0)return this._valid;const S=a.mag()>=2,P=m.mag()>=2;if(!S&&!P)return;if(!S||!P)return this._firstMove==null&&(this._firstMove=b),b-this._firstMove<100&&void 0;const H=a.y>0==m.y>0;return oe(a)&&oe(m)&&H}}const ve={panStep:100,bearingStep:15,pitchStep:10};class Te{constructor(){const a=ve;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let m=0,b=0,S=0,P=0,H=0;switch(a.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:a.shiftKey?b=-1:(a.preventDefault(),P=-1);break;case 39:a.shiftKey?b=1:(a.preventDefault(),P=1);break;case 38:a.shiftKey?S=1:(a.preventDefault(),H=-1);break;case 40:a.shiftKey?S=-1:(a.preventDefault(),H=1);break;default:return}return this._rotationDisabled&&(b=0,S=0),{cameraAnimation:W=>{const ee=W.getZoom();W.easeTo({duration:300,easeId:"keyboardHandler",easing:ze,zoom:m?Math.round(ee)+m*(a.shiftKey?2:1):ee,bearing:W.getBearing()+b*this._bearingStep,pitch:W.getPitch()+S*this._pitchStep,offset:[-P*this._panStep,-H*this._panStep],center:W.getCenter()},{originalEvent:a})}}}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 ze(x){return x*(2-x)}const je=4.000244140625;class bt{constructor(a,m){this._map=a,this._el=a.getCanvasContainer(),this._handler=m,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&a.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(a){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(a.ctrlKey||a.metaKey||this.isZooming()||i.isFullscreen()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=a.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*a.deltaY:a.deltaY;const b=i.exported.now(),S=b-(this._lastWheelEventTime||0);this._lastWheelEventTime=b,m!==0&&m%je==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":S>400?(this._type=null,this._lastValue=m,this._timeout=setTimeout(this._onTimeout,40,a)):this._type||(this._type=Math.abs(S*m)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,m+=this._lastValue)),a.shiftKey&&m&&(m/=4),this._type&&(this._lastWheelEvent=a,this._delta-=m,this._active||this._start(a)),a.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const m=me(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:m,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const a=this._map.transform;this._type==="wheel"&&a.projection.wrap&&(a._center.lng>=180||a._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const m=()=>a._terrainEnabled()&&this._aroundCoord?a.computeZoomRelativeTo(this._aroundCoord):a.zoom;if(this._delta!==0){const ee=this._type==="wheel"&&Math.abs(this._delta)>je?this._wheelZoomRate:this._defaultZoomRate;let pe=2/(1+Math.exp(-Math.abs(this._delta*ee)));this._delta<0&&pe!==0&&(pe=1/pe);const fe=m(),Me=Math.pow(2,fe),Ne=typeof this._targetZoom=="number"?a.zoomScale(this._targetZoom):Me;this._targetZoom=Math.min(a.maxZoom,Math.max(a.minZoom,a.scaleZoom(Ne*pe))),this._type==="wheel"&&(this._startZoom=fe,this._easing=this._smoothOutEasing(200)),this._delta=0}const b=typeof this._targetZoom=="number"?this._targetZoom:m(),S=this._startZoom,P=this._easing;let H,W=!1;if(this._type==="wheel"&&S&&P){const ee=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),pe=P(ee);H=i.number(S,b,pe),ee<1?this._frameId||(this._frameId=!0):W=!0}else H=b,W=!0;return this._active=!0,W&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!W,zoomDelta:H-m(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(a){let m=i.ease;if(this._prevEase){const b=this._prevEase,S=(i.exported.now()-b.start)/b.duration,P=b.easing(S+.01)-b.easing(S),H=.27/Math.sqrt(P*P+1e-4)*.01,W=Math.sqrt(.0729-H*H);m=i.bezier(H,W,.25,1)}return this._prevEase={start:i.exported.now(),duration:a,easing:m},m}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=z("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class mt{constructor(a,m){this._clickZoom=a,this._tapZoom=m}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 gt{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,m){return a.preventDefault(),{cameraAnimation:b=>{b.easeTo({duration:300,zoom:b.getZoom()+(a.shiftKey?-1:1),around:b.unproject(m)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vt{constructor(){this._tap=new Go({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(a,m,b){this._swipePoint||(this._tapTime&&a.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?b.length>0&&(this._swipePoint=m[0],this._swipeTouch=b[0].identifier):this._tap.touchstart(a,m,b))}touchmove(a,m,b){if(this._tapTime){if(this._swipePoint){if(b[0].identifier!==this._swipeTouch)return;const S=m[0],P=S.y-this._swipePoint.y;return this._swipePoint=S,a.preventDefault(),this._active=!0,{zoomDelta:P/128}}}else this._tap.touchmove(a,m,b)}touchend(a,m,b){this._tapTime?this._swipePoint&&b.length===0&&this.reset():this._tap.touchend(a,m,b)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zt{constructor(a,m,b){this._el=a,this._mousePan=m,this._touchPan=b}enable(a){this._inertiaOptions=a||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ni{constructor(a,m,b){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=m,this._mousePitch=b}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class St{constructor(a,m,b,S){this._el=a,this._touchZoom=m,this._touchRotate=b,this._tapDragZoom=S,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const zt=x=>x.zoom||x.drag||x.pitch||x.rotate;class ai extends i.Event{}class Ei{constructor(){this.constants=[1,1,.01],this.radius=0}setup(a,m){const b=i.sub([],m,a);this.radius=i.length(b[2]<0?i.div([],b,this.constants):[b[0],b[1],0])}projectRay(a){i.div(a,a,this.constants),i.normalize(a,a),i.mul$1(a,a,this.constants);const m=i.scale$2([],a,this.radius);if(m[2]>0){const b=i.scale$2([],[0,0,1],i.dot(m,[0,0,1])),S=i.scale$2([],i.normalize([],[m[0],m[1],0]),this.radius),P=i.add([],m,i.scale$2([],i.sub([],i.add([],S,b),m),2));m[0]=P[0],m[1]=P[1]}return m}}function Bi(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class Hi{constructor(a,m){this._map=a,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new jh(a),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Ei,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),i.bindAll(["handleEvent","handleWindowEvent"],this);const b=this._el;this._listeners=[[b,"touchstart",{passive:!0}],[b,"touchmove",{passive:!1}],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1}],[b,"keyup",void 0],[b,"wheel",{passive:!1}],[b,"contextmenu",void 0],[i.window,"blur",void 0]];for(const[S,P,H]of this._listeners)S.addEventListener(P,S===i.window.document?this.handleWindowEvent:this.handleEvent,H)}destroy(){for(const[a,m,b]of this._listeners)a.removeEventListener(m,a===i.window.document?this.handleWindowEvent:this.handleEvent,b)}_addDefaultHandlers(a){const m=this._map,b=m.getCanvasContainer();this._add("mapEvent",new sh(m,a));const S=m.boxZoom=new yl(m,a);this._add("boxZoom",S);const P=new pA,H=new gt;m.doubleClickZoom=new mt(H,P),this._add("tapZoom",P),this._add("clickZoom",H);const W=new Vt;this._add("tapDragZoom",W);const ee=m.touchPitch=new ue(m);this._add("touchPitch",ee);const pe=new Kh(a),fe=new xl(a);m.dragRotate=new ni(a,pe,fe),this._add("mouseRotate",pe,["mousePitch"]),this._add("mousePitch",fe,["mouseRotate"]);const Me=new Is(a),Ne=new M(m,a);m.dragPan=new Zt(b,Me,Ne),this._add("mousePan",Me),this._add("touchPan",Ne,["touchZoom","touchRotate"]);const st=new K,it=new F;m.touchZoomRotate=new St(b,it,st,W),this._add("touchRotate",st,["touchPan","touchZoom"]),this._add("touchZoom",it,["touchPan","touchRotate"]),this._add("blockableMapEvent",new dA(m));const lt=m.scrollZoom=new bt(m,this);this._add("scrollZoom",lt,["mousePan"]);const qe=m.keyboard=new Te;this._add("keyboard",qe);for(const Ye of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])a.interactive&&a[Ye]&&m[Ye].enable(a[Ye])}_add(a,m,b){this._handlers.push({handlerName:a,handler:m,allowed:b}),this._handlersById[a]=m}stop(a){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!zt(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(a,m,b){for(const S in a)if(S!==b&&(!m||m.indexOf(S)<0))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(a){const m=[];for(const b of a)this._el.contains(b.target)&&m.push(b);return m}handleEvent(a,m){this._updatingCamera=!0;const b=a.type==="renderFrame",S=b?void 0:a,P={needsRenderFrame:!1},H={},W={},ee=a.touches?this._getMapTouches(a.touches):void 0,pe=ee?De(this._el,ee):b?void 0:me(this._el,a);for(const{handlerName:Ne,handler:st,allowed:it}of this._handlers){if(!st.isEnabled())continue;let lt;this._blockedByActive(W,it,Ne)?st.reset():st[m||a.type]&&(lt=st[m||a.type](a,pe,ee),this.mergeHandlerResult(P,H,lt,Ne,S),lt&&lt.needsRenderFrame&&this._triggerRenderFrame()),(lt||st.isActive())&&(W[Ne]=st)}const fe={};for(const Ne in this._previousActiveHandlers)W[Ne]||(fe[Ne]=S);this._previousActiveHandlers=W,(Object.keys(fe).length||Bi(P))&&(this._changes.push([P,H,fe]),this._triggerRenderFrame()),(Object.keys(W).length||Bi(P))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Me}=P;Me&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Me(this._map))}mergeHandlerResult(a,m,b,S,P){if(!b)return;i.extend(a,b);const H={handlerName:S,originalEvent:b.originalEvent||P};b.zoomDelta!==void 0&&(m.zoom=H),b.panDelta!==void 0&&(m.drag=H),b.pitchDelta!==void 0&&(m.pitch=H),b.bearingDelta!==void 0&&(m.rotate=H)}_applyChanges(){const a={},m={},b={};for(const[S,P,H]of this._changes)S.panDelta&&(a.panDelta=(a.panDelta||new i.pointGeometry(0,0))._add(S.panDelta)),S.zoomDelta&&(a.zoomDelta=(a.zoomDelta||0)+S.zoomDelta),S.bearingDelta&&(a.bearingDelta=(a.bearingDelta||0)+S.bearingDelta),S.pitchDelta&&(a.pitchDelta=(a.pitchDelta||0)+S.pitchDelta),S.around!==void 0&&(a.around=S.around),S.aroundCoord!==void 0&&(a.aroundCoord=S.aroundCoord),S.pinchAround!==void 0&&(a.pinchAround=S.pinchAround),S.noInertia&&(a.noInertia=S.noInertia),i.extend(m,P),i.extend(b,H);this._updateMapTransform(a,m,b),this._changes=[]}_updateMapTransform(a,m,b){const S=this._map,P=S.transform,H=dt=>[dt.x,dt.y,dt.z];if((dt=>{const ht=this._eventsInProgress.drag;return ht&&!this._handlersById[ht.handlerName].isActive()})()&&!Bi(a)){const dt=P.zoom;P.cameraElevationReference="sea",P.recenterOnTerrain(),P.cameraElevationReference="ground",dt!==P.zoom&&this._map._update(!0)}if(P._isCameraConstrained&&S._stop(!0),!Bi(a))return void this._fireEvents(m,b,!0);let{panDelta:W,zoomDelta:ee,bearingDelta:pe,pitchDelta:fe,around:Me,aroundCoord:Ne,pinchAround:st}=a;P._isCameraConstrained&&(ee>0&&(ee=0),P._isCameraConstrained=!1),st!==void 0&&(Me=st),(dt=>m.drag&&!this._eventsInProgress.drag)()&&Me&&(this._dragOrigin=H(P.pointCoordinate3D(Me)),this._trackingEllipsoid.setup(P._camera.position,this._dragOrigin)),P.cameraElevationReference="sea",S._stop(!0),Me=Me||S.transform.centerPoint,pe&&(P.bearing+=pe),fe&&(P.pitch+=fe),P._updateCameraState();const it=[0,0,0];if(W)if(P.projection.name==="mercator"){const dt=this._trackingEllipsoid.projectRay(P.screenPointToMercatorRay(Me).dir),ht=this._trackingEllipsoid.projectRay(P.screenPointToMercatorRay(Me.sub(W)).dir);it[0]=ht[0]-dt[0],it[1]=ht[1]-dt[1]}else{const dt=P.pointCoordinate(Me);if(P.projection.name==="globe"){W=W.rotate(-P.angle);const ht=P._pixelsPerMercatorPixel/P.worldSize;it[0]=-W.x*i.mercatorScale(i.latFromMercatorY(dt.y))*ht,it[1]=-W.y*i.mercatorScale(P.center.lat)*ht}else{const ht=P.pointCoordinate(Me.sub(W));dt&&ht&&(it[0]=ht.x-dt.x,it[1]=ht.y-dt.y)}}const lt=P.zoom,qe=[0,0,0];if(ee){const dt=H(Ne||P.pointCoordinate3D(Me)),ht={dir:i.normalize([],i.sub([],dt,P._camera.position))};if(ht.dir[2]<0){const Bt=P.zoomDeltaToMovement(dt,ee);i.scale$2(qe,ht.dir,Bt)}}const Ye=i.add(it,it,qe);P._translateCameraConstrained(Ye),ee&&Math.abs(P.zoom-lt)>1e-4&&P.recenterOnTerrain(),P.cameraElevationReference="ground",this._map._update(),a.noInertia||this._inertia.record(a),this._fireEvents(m,b,!0)}_fireEvents(a,m,b){const S=zt(this._eventsInProgress),P=zt(a),H={};for(const fe in a){const{originalEvent:Me}=a[fe];this._eventsInProgress[fe]||(H[`${fe}start`]=Me),this._eventsInProgress[fe]=a[fe]}!S&&P&&this._fireEvent("movestart",P.originalEvent);for(const fe in H)this._fireEvent(fe,H[fe]);P&&this._fireEvent("move",P.originalEvent);for(const fe in a){const{originalEvent:Me}=a[fe];this._fireEvent(fe,Me)}const W={};let ee;for(const fe in this._eventsInProgress){const{handlerName:Me,originalEvent:Ne}=this._eventsInProgress[fe];this._handlersById[Me].isActive()||(delete this._eventsInProgress[fe],ee=m[Me]||Ne,W[`${fe}end`]=ee)}for(const fe in W)this._fireEvent(fe,W[fe]);const pe=zt(this._eventsInProgress);if(b&&(S||P)&&!pe){this._updatingCamera=!0;const fe=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),Me=Ne=>Ne!==0&&-this._bearingSnap<Ne&&Ne<this._bearingSnap;fe?(Me(fe.bearing||this._map.getBearing())&&(fe.bearing=0),this._map.easeTo(fe,{originalEvent:ee})):(this._map.fire(new i.Event("moveend",{originalEvent:ee})),Me(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(a,m){this._map.fire(new i.Event(a,m?{originalEvent:m}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(a=>{this._frameId=void 0,this.handleEvent(new ai("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const vi="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class xn extends i.Evented{constructor(a,m){super(),this._moving=!1,this._zooming=!1,this.transform=a,this._bearingSnap=m.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(a,m){return this.jumpTo({center:a},m)}panBy(a,m,b){return a=i.pointGeometry.convert(a).mult(-1),this.panTo(this.transform.center,i.extend({offset:a},m),b)}panTo(a,m,b){return this.easeTo(i.extend({center:a},m),b)}getZoom(){return this.transform.zoom}setZoom(a,m){return this.jumpTo({zoom:a},m),this}zoomTo(a,m,b){return this.easeTo(i.extend({zoom:a},m),b)}zoomIn(a,m){return this.zoomTo(this.getZoom()+1,a,m),this}zoomOut(a,m){return this.zoomTo(this.getZoom()-1,a,m),this}getBearing(){return this.transform.bearing}setBearing(a,m){return this.jumpTo({bearing:a},m),this}getPadding(){return this.transform.padding}setPadding(a,m){return this.jumpTo({padding:a},m),this}rotateTo(a,m,b){return this.easeTo(i.extend({bearing:a},m),b)}resetNorth(a,m){return this.rotateTo(0,i.extend({duration:1e3},a),m),this}resetNorthPitch(a,m){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},a),m),this}snapToNorth(a,m){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(a,m):this}getPitch(){return this.transform.pitch}setPitch(a,m){return this.jumpTo({pitch:a},m),this}cameraForBounds(a,m){a=i.LngLatBounds.convert(a);const b=m&&m.bearing||0,S=m&&m.pitch||0,P=a.getNorthWest(),H=a.getSouthEast();return this._cameraForBounds(this.transform,P,H,b,S,m)}_extendCameraOptions(a){const m={top:0,bottom:0,right:0,left:0};if(typeof(a=i.extend({padding:m,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const b=a.padding;a.padding={top:b,bottom:b,right:b,left:b}}return a.padding=i.extend(m,a.padding),a}_minimumAABBFrustumDistance(a,m){const b=m.max[0]-m.min[0],S=m.max[1]-m.min[1];return b/S>a.aspect?b/(2*Math.tan(.5*a.fovX)*a.aspect):S/(2*Math.tan(.5*a.fovY)*a.aspect)}_cameraForBoundsOnGlobe(a,m,b,S,P,H){const W=a.clone(),ee=this._extendCameraOptions(H);W.bearing=S,W.pitch=P;const pe=i.LngLat.convert(m),fe=i.LngLat.convert(b),Me=.5*(pe.lat+fe.lat),Ne=.5*(pe.lng+fe.lng),st=i.latLngToECEF(Me,Ne),it=i.normalize([],st),lt=i.normalize([],i.cross([],it,[0,1,0])),qe=i.cross([],lt,it),Ye=[lt[0],lt[1],lt[2],0,qe[0],qe[1],qe[2],0,it[0],it[1],it[2],0,0,0,0,1],dt=[st,i.latLngToECEF(pe.lat,pe.lng),i.latLngToECEF(fe.lat,pe.lng),i.latLngToECEF(fe.lat,fe.lng),i.latLngToECEF(pe.lat,fe.lng),i.latLngToECEF(Me,pe.lng),i.latLngToECEF(Me,fe.lng),i.latLngToECEF(pe.lat,Ne),i.latLngToECEF(fe.lat,Ne)];let ht=i.Aabb.fromPoints(dt.map(Jt=>[i.dot(lt,Jt),i.dot(qe,Jt),i.dot(it,Jt)]));const Bt=i.transformMat4([],ht.center,Ye);i.squaredLength(Bt)===0&&i.set(Bt,0,0,1),i.normalize(Bt,Bt),i.scale$2(Bt,Bt,i.GLOBE_RADIUS),W.center=i.ecefToLatLng(Bt);const Pt=W.getWorldToCameraMatrix(),It=i.invert(new Float64Array(16),Pt);ht=i.Aabb.applyTransform(ht,i.multiply([],Pt,Ye)),i.transformMat4(Bt,Bt,Pt);const Ht=.5*(ht.max[2]-ht.min[2]),hi=this._minimumAABBFrustumDistance(W,ht),si=i.scale$2([],[0,0,1],Ht),qt=i.add(si,Bt,si),ji=hi+(W.pitch===0?0:i.distance(Bt,qt)),Kt=W.globeCenterInViewSpace,Ci=i.sub([],Bt,[Kt[0],Kt[1],Kt[2]]);i.normalize(Ci,Ci),i.scale$2(Ci,Ci,ji);const di=i.add([],Bt,Ci);i.transformMat4(di,di,It);const Ri=i.earthRadius/i.GLOBE_RADIUS,Ai=i.length(di),Mi=i.mercatorZfromAltitude(Ai*Ri-i.earthRadius,0),$i=Math.min(W.zoomFromMercatorZAdjusted(Mi),ee.maxZoom);return $i>.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(W.setProjection({name:"mercator"}),W.zoom=$i,this._cameraForBounds(W,m,b,S,P,H)):{center:W.center,zoom:$i,bearing:S,pitch:P}}queryTerrainElevation(a,m){const b=this.transform.elevation;return b?(m=i.extend({},{exaggerated:!0},m),b.getAtPoint(i.MercatorCoordinate.fromLngLat(a),null,m.exaggerated)):null}_cameraForBounds(a,m,b,S,P,H){if(a.projection.name==="globe")return this._cameraForBoundsOnGlobe(a,m,b,S,P,H);const W=a.clone(),ee=this._extendCameraOptions(H),pe=W.padding;W.bearing=S,W.pitch=P;const fe=i.LngLat.convert(m),Me=i.LngLat.convert(b),Ne=new i.LngLat(fe.lng,Me.lat),st=new i.LngLat(Me.lng,fe.lat),it=W.project(fe),lt=W.project(Me),qe=this.queryTerrainElevation(fe),Ye=this.queryTerrainElevation(Me),dt=this.queryTerrainElevation(Ne),ht=this.queryTerrainElevation(st),Bt=[[it.x,it.y,Math.min(qe||0,Ye||0,dt||0,ht||0)],[lt.x,lt.y,Math.max(qe||0,Ye||0,dt||0,ht||0)]];let Pt=i.Aabb.fromPoints(Bt);const It=W.getWorldToCameraMatrix(),Ht=i.invert(new Float64Array(16),It);Pt=i.Aabb.applyTransform(Pt,It);const hi=i.sub([],Pt.max,Pt.min),si=pe.left||0,qt=pe.right||0,ji=pe.bottom||0,Kt=pe.top||0,{left:Ci,right:di,top:Ri,bottom:Ai}=ee.padding,Mi=.5*(si+qt),$i=.5*(Kt+ji),Jt=Math.min(W.scaleZoom(W.scale*Math.min((W.width-(si+qt+Ci+di))/hi[0],(W.height-(ji+Kt+Ai+Ri))/hi[1])),ee.maxZoom),pi=W.scale/W.zoomScale(Jt);Pt=new i.Aabb([Pt.min[0]-(Ci+Mi)*pi,Pt.min[1]-(Ai+$i)*pi,Pt.min[2]],[Pt.max[0]+(di+Mi)*pi,Pt.max[1]+(Ri+$i)*pi,Pt.max[2]]);const In=.5*hi[2],Hn=this._minimumAABBFrustumDistance(W,Pt),Mn=[0,0,1,0];i.transformMat4$1(Mn,Mn,It),i.normalize$2(Mn,Mn);const $n=i.scale$2([],Mn,Hn+In),lr=i.add([],Pt.center,$n),On=(typeof ee.offset.x=="number"&&typeof ee.offset.y=="number"?new i.pointGeometry(ee.offset.x,ee.offset.y):i.pointGeometry.convert(ee.offset)).rotate(-i.degToRad(S));Pt.center[0]-=On.x*pi,Pt.center[1]+=On.y*pi,i.transformMat4(Pt.center,Pt.center,Ht),i.transformMat4(lr,lr,Ht);const _n=[Pt.center[0],Pt.center[1],lr[2]*W.pixelsPerMeter];i.scale$2(_n,_n,1/W.worldSize);const Dr=i.lngFromMercatorX(_n[0]),Or=i.latFromMercatorY(_n[1]),Nr=Math.min(W._zoomFromMercatorZ(_n[2]),ee.maxZoom),Qr=new i.LngLat(Dr,Or);return W.mercatorFromTransition&&Nr<.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(W.setProjection({name:"globe"}),W.zoom=Nr,this._cameraForBounds(W,m,b,S,P,H)):{center:Qr,zoom:Nr,bearing:S,pitch:P}}fitBounds(a,m,b){const S=this.cameraForBounds(a,m);return this._fitInternal(S,m,b)}fitScreenCoordinates(a,m,b,S,P){const H=i.pointGeometry.convert(a),W=i.pointGeometry.convert(m),ee=new i.pointGeometry(Math.min(H.x,W.x),Math.min(H.y,W.y)),pe=new i.pointGeometry(Math.max(H.x,W.x),Math.max(H.y,W.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(H,W))return this;const fe=this.transform.pointLocation3D(ee),Me=this.transform.pointLocation3D(pe),Ne=this.transform.pointLocation3D(new i.pointGeometry(ee.x,pe.y)),st=this.transform.pointLocation3D(new i.pointGeometry(pe.x,ee.y)),it=[Math.min(fe.lng,Me.lng,Ne.lng,st.lng),Math.min(fe.lat,Me.lat,Ne.lat,st.lat)],lt=[Math.max(fe.lng,Me.lng,Ne.lng,st.lng),Math.max(fe.lat,Me.lat,Ne.lat,st.lat)],qe=S&&S.pitch?S.pitch:this.getPitch(),Ye=this._cameraForBounds(this.transform,it,lt,b,qe,S);return this._fitInternal(Ye,S,P)}_fitInternal(a,m,b){return a?(delete(m=i.extend(a,m)).padding,m.linear?this.easeTo(m,b):this.flyTo(m,b)):this}jumpTo(a,m){this.stop();const b=a.preloadOnly?this.transform.clone():this.transform;let S=!1,P=!1,H=!1;return"zoom"in a&&b.zoom!==+a.zoom&&(S=!0,b.zoom=+a.zoom),a.center!==void 0&&(b.center=i.LngLat.convert(a.center)),"bearing"in a&&b.bearing!==+a.bearing&&(P=!0,b.bearing=+a.bearing),"pitch"in a&&b.pitch!==+a.pitch&&(H=!0,b.pitch=+a.pitch),a.padding==null||b.isPaddingEqual(a.padding)||(b.padding=a.padding),a.preloadOnly?(this._preloadTiles(b),this):(this.fire(new i.Event("movestart",m)).fire(new i.Event("move",m)),S&&this.fire(new i.Event("zoomstart",m)).fire(new i.Event("zoom",m)).fire(new i.Event("zoomend",m)),P&&this.fire(new i.Event("rotatestart",m)).fire(new i.Event("rotate",m)).fire(new i.Event("rotateend",m)),H&&this.fire(new i.Event("pitchstart",m)).fire(new i.Event("pitch",m)).fire(new i.Event("pitchend",m)),this.fire(new i.Event("moveend",m)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.warnOnce(vi),this.transform.getFreeCameraOptions()}setFreeCameraOptions(a,m){const b=this.transform;if(!b.projection.supportsFreeCamera)return i.warnOnce(vi),this;this.stop();const S=b.zoom,P=b.pitch,H=b.bearing;b.setFreeCameraOptions(a);const W=S!==b.zoom,ee=P!==b.pitch,pe=H!==b.bearing;return this.fire(new i.Event("movestart",m)).fire(new i.Event("move",m)),W&&this.fire(new i.Event("zoomstart",m)).fire(new i.Event("zoom",m)).fire(new i.Event("zoomend",m)),pe&&this.fire(new i.Event("rotatestart",m)).fire(new i.Event("rotate",m)).fire(new i.Event("rotateend",m)),ee&&this.fire(new i.Event("pitchstart",m)).fire(new i.Event("pitch",m)).fire(new i.Event("pitchend",m)),this.fire(new i.Event("moveend",m)),this}easeTo(a,m){this._stop(!1,a.easeId),((a=i.extend({offset:[0,0],duration:500,easing:i.ease},a)).animate===!1||!a.essential&&i.exported.prefersReducedMotion)&&(a.duration=0);const b=this.transform,S=this.getZoom(),P=this.getBearing(),H=this.getPitch(),W=this.getPadding(),ee="zoom"in a?+a.zoom:S,pe="bearing"in a?this._normalizeBearing(a.bearing,P):P,fe="pitch"in a?+a.pitch:H,Me="padding"in a?a.padding:b.padding,Ne=i.pointGeometry.convert(a.offset);let st,it,lt;if(b.projection.name==="globe"){const si=i.MercatorCoordinate.fromLngLat(b.center),qt=Ne.rotate(-b.angle);si.x+=qt.x/b.worldSize,si.y+=qt.y/b.worldSize;const ji=si.toLngLat(),Kt=i.LngLat.convert(a.center||ji);this._normalizeCenter(Kt),st=b.centerPoint.add(qt),it=new i.pointGeometry(si.x,si.y).mult(b.worldSize),lt=new i.pointGeometry(i.mercatorXfromLng(Kt.lng),i.mercatorYfromLat(Kt.lat)).mult(b.worldSize).sub(it)}else{st=b.centerPoint.add(Ne);const si=b.pointLocation(st),qt=i.LngLat.convert(a.center||si);this._normalizeCenter(qt),it=b.project(si),lt=b.project(qt).sub(it)}const qe=b.zoomScale(ee-S);let Ye,dt;a.around&&(Ye=i.LngLat.convert(a.around),dt=b.locationPoint(Ye));const ht=this._zooming||ee!==S,Bt=this._rotating||P!==pe,Pt=this._pitching||fe!==H,It=!b.isPaddingEqual(Me),Ht=si=>qt=>{if(ht&&(si.zoom=i.number(S,ee,qt)),Bt&&(si.bearing=i.number(P,pe,qt)),Pt&&(si.pitch=i.number(H,fe,qt)),It&&(si.interpolatePadding(W,Me,qt),st=si.centerPoint.add(Ne)),Ye)si.setLocationAtPoint(Ye,dt);else{const ji=si.zoomScale(si.zoom-S),Kt=ee>S?Math.min(2,qe):Math.max(.5,qe),Ci=Math.pow(Kt,1-qt),di=si.unproject(it.add(lt.mult(qt*Ci)).mult(ji));si.setLocationAtPoint(si.renderWorldCopies?di.wrap():di,st)}return a.preloadOnly||this._fireMoveEvents(m),si};if(a.preloadOnly){const si=this._emulate(Ht,a.duration,b);return this._preloadTiles(si),this}const hi={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=ht,this._rotating=Bt,this._pitching=Pt,this._padding=It,this._easeId=a.easeId,this._prepareEase(m,a.noMoveStart,hi),this._ease(Ht(b),si=>{b.recenterOnTerrain(),this._afterEase(m,si)},a),this}_prepareEase(a,m,b={}){this._moving=!0,this.transform.cameraElevationReference="sea",m||b.moving||this.fire(new i.Event("movestart",a)),this._zooming&&!b.zooming&&this.fire(new i.Event("zoomstart",a)),this._rotating&&!b.rotating&&this.fire(new i.Event("rotatestart",a)),this._pitching&&!b.pitching&&this.fire(new i.Event("pitchstart",a))}_fireMoveEvents(a){this.fire(new i.Event("move",a)),this._zooming&&this.fire(new i.Event("zoom",a)),this._rotating&&this.fire(new i.Event("rotate",a)),this._pitching&&this.fire(new i.Event("pitch",a))}_afterEase(a,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const b=this._zooming,S=this._rotating,P=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,b&&this.fire(new i.Event("zoomend",a)),S&&this.fire(new i.Event("rotateend",a)),P&&this.fire(new i.Event("pitchend",a)),this.fire(new i.Event("moveend",a))}flyTo(a,m){if(!a.essential&&i.exported.prefersReducedMotion){const Jt=i.pick(a,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Jt,m)}this.stop(),a=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},a);const b=this.transform,S=this.getZoom(),P=this.getBearing(),H=this.getPitch(),W=this.getPadding(),ee="zoom"in a?i.clamp(+a.zoom,b.minZoom,b.maxZoom):S,pe="bearing"in a?this._normalizeBearing(a.bearing,P):P,fe="pitch"in a?+a.pitch:H,Me="padding"in a?a.padding:b.padding,Ne=b.zoomScale(ee-S),st=i.pointGeometry.convert(a.offset);let it=b.centerPoint.add(st);const lt=b.pointLocation(it),qe=i.LngLat.convert(a.center||lt);this._normalizeCenter(qe);const Ye=b.project(lt),dt=b.project(qe).sub(Ye);let ht=a.curve;const Bt=Math.max(b.width,b.height),Pt=Bt/Ne,It=dt.mag();if("minZoom"in a){const Jt=i.clamp(Math.min(a.minZoom,S,ee),b.minZoom,b.maxZoom),pi=Bt/b.zoomScale(Jt-S);ht=Math.sqrt(pi/It*2)}const Ht=ht*ht;function hi(Jt){const pi=(Pt*Pt-Bt*Bt+(Jt?-1:1)*Ht*Ht*It*It)/(2*(Jt?Pt:Bt)*Ht*It);return Math.log(Math.sqrt(pi*pi+1)-pi)}function si(Jt){return(Math.exp(Jt)-Math.exp(-Jt))/2}function qt(Jt){return(Math.exp(Jt)+Math.exp(-Jt))/2}const ji=hi(0);let Kt=function(Jt){return qt(ji)/qt(ji+ht*Jt)},Ci=function(Jt){return Bt*((qt(ji)*(si(pi=ji+ht*Jt)/qt(pi))-si(ji))/Ht)/It;var pi},di=(hi(1)-ji)/ht;if(Math.abs(It)<1e-6||!isFinite(di)){if(Math.abs(Bt-Pt)<1e-6)return this.easeTo(a,m);const Jt=Pt<Bt?-1:1;di=Math.abs(Math.log(Pt/Bt))/ht,Ci=function(){return 0},Kt=function(pi){return Math.exp(Jt*ht*pi)}}a.duration="duration"in a?+a.duration:1e3*di/("screenSpeed"in a?+a.screenSpeed/ht:+a.speed),a.maxDuration&&a.duration>a.maxDuration&&(a.duration=0);const Ri=P!==pe,Ai=fe!==H,Mi=!b.isPaddingEqual(Me),$i=Jt=>pi=>{const In=pi*di,Hn=1/Kt(In);Jt.zoom=pi===1?ee:S+Jt.scaleZoom(Hn),Ri&&(Jt.bearing=i.number(P,pe,pi)),Ai&&(Jt.pitch=i.number(H,fe,pi)),Mi&&(Jt.interpolatePadding(W,Me,pi),it=Jt.centerPoint.add(st));const Mn=pi===1?qe:Jt.unproject(Ye.add(dt.mult(Ci(In))).mult(Hn));return Jt.setLocationAtPoint(Jt.renderWorldCopies?Mn.wrap():Mn,it),Jt._updateCameraOnTerrain(),a.preloadOnly||this._fireMoveEvents(m),Jt};if(a.preloadOnly){const Jt=this._emulate($i,a.duration,b);return this._preloadTiles(Jt),this}return this._zooming=!0,this._rotating=Ri,this._pitching=Ai,this._padding=Mi,this._prepareEase(m,!1),this._ease($i(b),()=>this._afterEase(m),a),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(a,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const b=this._onEaseEnd;this._onEaseEnd=void 0,b.call(this,m)}if(!a){const b=this.handlers;b&&b.stop(!1)}return this}_ease(a,m,b){b.animate===!1||b.duration===0?(a(1),m()):(this._easeStart=i.exported.now(),this._easeOptions=b,this._onEaseFrame=a,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const a=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(a)),a<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(a,m){a=i.wrap(a,-180,180);const b=Math.abs(a-m);return Math.abs(a-360-m)<b&&(a-=360),Math.abs(a+360-m)<b&&(a+=360),a}_normalizeCenter(a){const m=this.transform;if(!m.renderWorldCopies||m.maxBounds)return;const b=a.lng-m.center.lng;a.lng+=b>180?-360:b<-180?360:0}_emulate(a,m,b){const S=Math.ceil(15*m/1e3),P=[],H=a(b.clone());for(let W=0;W<=S;W++){const ee=H(W/S);P.push(ee.clone())}return P}}class cn{constructor(a={}){this.options=a,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(a){const m=this.options&&this.options.compact;return this._map=a,this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=z("button","mapboxgl-ctrl-attrib-button",this._container),z("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=z("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),m&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),m===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(a,m){const b=this._map._getUIString(`AttributionControl.${m}`);a.setAttribute("aria-label",b),a.removeAttribute("title"),a.firstElementChild&&a.firstElementChild.setAttribute("title",b)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let a=this._editLink;a||(a=this._editLink=this._container.querySelector(".mapbox-improve-map"));const m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(a){const b=m.reduce((S,P,H)=>(P.value&&(S+=`${P.key}=${P.value}${H<m.length-1?"&":""}`),S),"?");a.href=`${i.config.FEEDBACK_URL}/${b}#${xs(this._map,!0)}`,a.rel="noopener nofollow",this._setElementTitle(a,"MapFeedback")}}_updateData(a){!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let a=[];if(this._map.style.stylesheet){const S=this._map.style.stylesheet;this.styleOwner=S.owner,this.styleId=S.id}const m=this._map.style._sourceCaches;for(const S in m){const P=m[S];if(P.used){const H=P.getSource();H.attribution&&a.indexOf(H.attribution)<0&&a.push(H.attribution)}}a.sort((S,P)=>S.length-P.length),a=a.filter((S,P)=>{for(let H=P+1;H<a.length;H++)if(a[H].indexOf(S)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a]:a.unshift(this.options.customAttribution));const b=a.join(" | ");b!==this._attribHTML&&(this._attribHTML=b,a.length?(this._innerContainer.innerHTML=b,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Bn{constructor(){i.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(a){this._map=a,this._container=z("div","mapboxgl-ctrl");const m=z("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(a){a&&a.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(Object.entries(a).length===0)return!0;for(const m in a){const b=a[m].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const m=a[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const m=++this._id;return this._queue.push({callback:a,id:m,cancelled:!1}),m}remove(a){const m=this._currentlyRunning,b=m?this._queue.concat(m):this._queue;for(const S of b)if(S.id===a)return void(S.cancelled=!0)}run(a=0){const m=this._currentlyRunning=this._queue;this._queue=[];for(const b of m)if(!b.cancelled&&(b.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function ur(x,a,m){if(x=new i.LngLat(x.lng,x.lat),a){const b=new i.LngLat(x.lng-360,x.lat),S=new i.LngLat(x.lng+360,x.lat),P=360*Math.ceil(Math.abs(x.lng-m.center.lng)/360),H=m.locationPoint(x).distSqr(a),W=a.x<0||a.y<0||a.x>m.width||a.y>m.height;m.locationPoint(b).distSqr(a)<H&&(W||Math.abs(b.lng-m.center.lng)<P)?x=b:m.locationPoint(S).distSqr(a)<H&&(W||Math.abs(S.lng-m.center.lng)<P)&&(x=S)}for(;Math.abs(x.lng-m.center.lng)>180;){const b=m.locationPoint(x);if(b.x>=0&&b.y>=0&&b.x<=m.width&&b.y<=m.height)break;x.lng>m.center.lng?x.lng-=360:x.lng+=360}return x}const Un={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Lr extends i.Evented{constructor(a,m){if(super(),(a instanceof i.window.HTMLElement||m)&&(a=i.extend({element:a},m)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=a&&a.anchor||"center",this._color=a&&a.color||"#3FB1CE",this._scale=a&&a.scale||1,this._draggable=a&&a.draggable||!1,this._clickTolerance=a&&a.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=a&&a.rotation||0,this._rotationAlignment=a&&a.rotationAlignment||"auto",this._pitchAlignment=a&&a.pitchAlignment&&a.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=a&&a.occludedOpacity||.2,a&&a.element)this._element=a.element,this._offset=i.pointGeometry.convert(a&&a.offset||[0,0]);else{this._defaultMarker=!0,this._element=z("div");const S=41,P=27,H=G("svg",{display:"block",height:S*this._scale+"px",width:P*this._scale+"px",viewBox:`0 0 ${P} ${S}`},this._element),W=G("radialGradient",{id:"shadowGradient"},G("defs",{},H));G("stop",{offset:"10%","stop-opacity":.4},W),G("stop",{offset:"100%","stop-opacity":.05},W),G("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},H),G("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},H),G("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},H),G("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},H),this._offset=i.pointGeometry.convert(a&&a.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",S=>{S.preventDefault()}),this._element.addEventListener("mousedown",S=>{S.preventDefault()});const b=this._element.classList;for(const S in Un)b.remove(`mapboxgl-marker-anchor-${S}`);b.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),a.on("click",this._onMapClick)),this}remove(){const a=this._map;return a&&(a.off("click",this._onMapClick),a.off("move",this._updateMoving),a.off("moveend",this._update),a.off("mousedown",this._addDragHandler),a.off("touchstart",this._addDragHandler),a.off("mouseup",this._onUp),a.off("touchend",this._onUp),a.off("mousemove",this._onMove),a.off("touchmove",this._onMove),a.off("remove",this._clearFadeTimer),a._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=i.LngLat.convert(a),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(a){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),a){if(!("offset"in a.options)){const S=Math.sqrt(Math.pow(13.5,2)/2);a.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[S,-1*(38.1-13.5+S)],"bottom-right":[-S,-1*(38.1-13.5+S)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=a,a._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(a){const m=a.code,b=a.charCode||a.keyCode;m!=="Space"&&m!=="Enter"&&b!==32&&b!==13||this.togglePopup()}_onMapClick(a){const m=a.originalEvent.target,b=this._element;this._popup&&(m===b||b.contains(m))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a?(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(a.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const a=this._map,m=this._pos;if(!a||!m)return!1;const b=a.unproject(m),S=a.getFreeCameraOptions();if(!S.position)return!1;const P=S.position.toLngLat();return P.distanceTo(b)<.9*P.distanceTo(this._lngLat)}_evaluateOpacity(){const a=this._map;if(!a)return;const m=this._pos;if(!m||m.x<0||m.x>a.transform.width||m.y<0||m.y>a.transform.height)return void this._clearFadeTimer();const b=a.unproject(m);let S;a._showingGlobe()&&i.isLngLatBehindGlobe(a.transform,this._lngLat)?S=0:(S=1-a._queryFogOpacity(b),a.transform._terrainEnabled()&&a.getTerrain()&&this._behindTerrain()&&(S*=this._occludedOpacity)),this._element.style.opacity=`${S}`,this._element.style.pointerEvents=S>0?"auto":"none",this._popup&&this._popup._setOpacity(S),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const a=this._pos;if(!a||!this._map)return;const m=this._offset.mult(this._scale);this._element.style.transform=`
  4941. translate(${a.x}px,${a.y}px)
  4942. ${Un[this._anchor]}
  4943. ${this._calculateXYTransform()} ${this._calculateZTransform()}
  4944. translate(${m.x}px,${m.y}px)
  4945. `}_calculateXYTransform(){const a=this._pos,m=this._map,b=this.getPitchAlignment();if(!m||!a||b!=="map")return"";if(!m._showingGlobe()){const ee=m.getPitch();return ee?`rotateX(${ee}deg)`:""}const S=i.radToDeg(i.globeTiltAtLngLat(m.transform,this._lngLat)),P=a.sub(i.globeCenterToScreenPoint(m.transform)),H=Math.abs(P.x)+Math.abs(P.y);if(H===0)return"";const W=S/H;return`rotateX(${-P.y*W}deg) rotateY(${P.x*W}deg)`}_calculateZTransform(){const a=this._pos,m=this._map;if(!m||!a)return"";let b=0;const S=this.getRotationAlignment();if(S==="map")if(m._showingGlobe()){const P=m.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),H=m.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(P);b=i.radToDeg(Math.atan2(H.y,H.x))-90}else b=-m.getBearing();else if(S==="horizon"){const P=i.smoothstep(4,6,m.getZoom()),H=i.globeCenterToScreenPoint(m.transform);H.y+=P*m.transform.height;const W=a.sub(H),ee=i.radToDeg(Math.atan2(W.y,W.x));b=(ee>90?ee-270:ee+90)*(1-P)}return b+=this._rotation,b?`rotateZ(${b}deg)`:""}_update(a){i.window.cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=ur(this._lngLat,this._pos,m.transform)),this._pos=m.project(this._lngLat),a===!0?this._updateFrameId=i.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(a){return this._offset=i.pointGeometry.convert(a),this._update(),this}_onMove(a){const m=this._map;if(!m)return;const b=this._pointerdownPos,S=this._positionDelta;if(b&&S){if(!this._isDragging){const P=this._clickTolerance||m._clickTolerance;if(a.point.dist(b)<P)return;this._isDragging=!0}this._pos=a.point.sub(S),this._lngLat=m.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const a=this._map;a&&(a.off("mousemove",this._onMove),a.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(a){const m=this._map,b=this._pos;m&&b&&this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(b),this._pointerdownPos=a.point,this._state="pending",m.on("mousemove",this._onMove),m.on("touchmove",this._onMove),m.once("mouseup",this._onUp),m.once("touchend",this._onUp))}setDraggable(a){this._draggable=!!a;const m=this._map;return m&&(a?(m.on("mousedown",this._addDragHandler),m.on("touchstart",this._addDragHandler)):(m.off("mousedown",this._addDragHandler),m.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(a){return this._occludedOpacity=a||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Rr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Cr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Er(x=new i.pointGeometry(0,0),a="bottom"){if(typeof x=="number"){const m=Math.round(Math.sqrt(.5*Math.pow(x,2)));switch(a){case"top":return new i.pointGeometry(0,x);case"top-left":return new i.pointGeometry(m,m);case"top-right":return new i.pointGeometry(-m,m);case"bottom":return new i.pointGeometry(0,-x);case"bottom-left":return new i.pointGeometry(m,-m);case"bottom-right":return new i.pointGeometry(-m,-m);case"left":return new i.pointGeometry(x,0);case"right":return new i.pointGeometry(-x,0)}return new i.pointGeometry(0,0)}return x instanceof i.pointGeometry||Array.isArray(x)?i.pointGeometry.convert(x):i.pointGeometry.convert(x[a]||[0,0])}class Gr{constructor(a){this.jumpTo(a)}getValue(a){if(a<=this._startTime)return this._start;if(a>=this._endTime)return this._end;const m=i.easeCubicInOut((a-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(a,m,b){this._start=this.getValue(m),this._end=a,this._startTime=m,this._endTime=m+b}}const js={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},wa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},ua={showCompass:!0,showZoom:!0,visualizePitch:!1};class ba{constructor(a,m,b=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new Kh({clickTolerance:a.dragRotate._mouseRotate._clickTolerance}),this.map=a,b&&(this.mousePitch=new xl({clickTolerance:a.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(a,m){this.mouseRotate.mousedown(a,m),this.mousePitch&&this.mousePitch.mousedown(a,m),ae()}move(a,m){const b=this.map,S=this.mouseRotate.mousemoveWindow(a,m),P=S&&S.bearingDelta;if(P&&b.setBearing(b.getBearing()+P),this.mousePitch){const H=this.mousePitch.mousemoveWindow(a,m),W=H&&H.pitchDelta;W&&b.setPitch(b.getPitch()+W)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart,{passive:!1}),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ce(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(a){this.down(i.extend({},a,{ctrlKey:!0,preventDefault:()=>a.preventDefault()}),me(this.element,a)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,me(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){a.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=De(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){a.targetTouches.length!==1?this.reset():(this._lastPos=De(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){a.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const Wa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Wo={maxWidth:100,unit:"metric"};function mo(x,a,m){const b=Ba(a),S=b/a,P={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[m];this._map._requestDomTask(()=>{this._container.style.width=x*S+"px",this._container.innerHTML=`${b}&nbsp;${P}`})}function Ba(x){const a=Math.pow(10,`${Math.floor(x)}`.length-1);let m=x/a;return m=m>=10?10:m>=5?5:m>=3?3:m>=2?2:m>=1?1:function(b){const S=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*S)/S}(m),a*m}const $l={version:i.version,supported:D,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends xn{constructor(x){if(i.LivePerformanceUtils.mark(i.PerformanceMarkers.create),(x=i.extend({},wa,x)).minZoom!=null&&x.maxZoom!=null&&x.minZoom>x.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(x.minPitch!=null&&x.maxPitch!=null&&x.minPitch>x.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(x.minPitch!=null&&x.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(x.maxPitch!=null&&x.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(x.antialias&&i.isSafariWithAntialiasingBug(i.window)&&(x.antialias=!1,i.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Kl(x.minZoom,x.maxZoom,x.minPitch,x.maxPitch,x.renderWorldCopies),x),this._interactive=x.interactive,this._minTileCacheSize=x.minTileCacheSize,this._maxTileCacheSize=x.maxTileCacheSize,this._failIfMajorPerformanceCaveat=x.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=x.preserveDrawingBuffer,this._antialias=x.antialias,this._trackResize=x.trackResize,this._bearingSnap=x.bearingSnap,this._refreshExpiredTiles=x.refreshExpiredTiles,this._fadeDuration=x.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=x.crossSourceCollisions,this._collectResourceTiming=x.collectResourceTiming,this._optimizeForTerrain=x.optimizeForTerrain,this._language=this._parseLanguage(x.language),this._worldview=x.worldview,this._renderTaskQueue=new tr,this._domRenderTaskQueue=new tr,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.uniqueId(),this._locale=i.extend({},js,x.locale),this._clickTolerance=x.clickTolerance,this._cooperativeGestures=x.cooperativeGestures,this._performanceMetricsCollection=x.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Gr(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new i.RequestManager(x.transformRequest,x.accessToken,x.testMode),this._silenceAuthErrors=!!x.testMode,typeof x.container=="string"){if(this._container=i.window.document.getElementById(x.container),!this._container)throw new Error(`Container '${x.container}' not found.`)}else{if(!(x.container instanceof i.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=x.container}if(this._container.childNodes.length>0&&i.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),x.maxBounds&&this.setMaxBounds(x.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),i.window!==void 0&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new Hi(this,x),this._localFontFamily=x.localFontFamily,this._localIdeographFontFamily=x.localIdeographFontFamily,x.style&&this.setStyle(x.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),x.projection&&this.setProjection(x.projection),this._hash=x.hash&&new An(typeof x.hash=="string"&&x.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:x.center,zoom:x.zoom,bearing:x.bearing,pitch:x.pitch}),x.bounds&&(this.resize(),this.fitBounds(x.bounds,i.extend({},x.fitBoundsOptions,{duration:0})))),this.resize(),x.attributionControl&&this.addControl(new cn({customAttribution:x.customAttribution})),this._logoControl=new Bn,this.addControl(this._logoControl,x.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new i.Event(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new i.Event(`${a.dataType}dataloading`,a))})}_getMapId(){return this._mapId}addControl(x,a){if(a===void 0&&(a=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const m=x.onAdd(this);this._controls.push(x);const b=this._controlPositions[a];return a.indexOf("bottom")!==-1?b.insertBefore(m,b.firstChild):b.appendChild(m),this}removeControl(x){if(!x||!x.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const a=this._controls.indexOf(x);return a>-1&&this._controls.splice(a,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(x){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const a=!this._moving;return a&&this.fire(new i.Event("movestart",x)).fire(new i.Event("move",x)),this.fire(new i.Event("resize",x)),a&&this.fire(new i.Event("moveend",x)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(x){return this.transform.setMaxBounds(i.LngLatBounds.convert(x)),this._update()}setMinZoom(x){if((x=x==null?-2:x)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()<x?this.setZoom(x):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(x){if((x=x==null?22:x)>=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x?this.setZoom(x):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x==null?0:x)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()<x?this.setPitch(x):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(x){if((x=x==null?85:x)>85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x?this.setPitch(x):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(x){return x==="auto"?i.window.navigator.language:Array.isArray(x)?x.length===0?void 0:x.map(a=>a==="auto"?i.window.navigator.language:a):x}setLanguage(x){const a=this._parseLanguage(x);if(!this.style||a===this._language)return this;this._language=a,this.style._reloadSources();for(const m of this._controls)m._setLanguage&&m._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(x){return this.style&&x!==this._worldview?(this._worldview=x,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(x){return this._lazyInitEmptyStyle(),x?typeof x=="string"&&(x={name:x}):x=null,this._useExplicitProjection=!!x,this._prioritizeAndUpdateProjection(x,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const x=this.transform,a=x.projection.name;let m;a==="globe"&&x.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?(x.setMercatorFromTransition(),m=!0):a==="mercator"&&x.zoom<i.GLOBE_ZOOM_THRESHOLD_MAX&&(x.setProjection({name:"globe"}),m=!0),m&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(x,a){return this._updateProjection(x||a||{name:"mercator"})}_updateProjection(x){let a;if(a=x.name==="globe"&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(x),this.style.applyProjectionUpdate(),a){this.painter.clearBackgroundTiles();for(const m in this.style._sourceCaches)this.style._sourceCaches[m].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(x){return this.transform.locationPoint3D(i.LngLat.convert(x))}unproject(x){return this.transform.pointLocation3D(i.pointGeometry.convert(x))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(x,a,m){if(x==="mouseenter"||x==="mouseover"){let b=!1;const S=H=>{const W=a.filter(pe=>this.getLayer(pe)),ee=W.length?this.queryRenderedFeatures(H.point,{layers:W}):[];ee.length?b||(b=!0,m.call(this,new Js(x,this,H.originalEvent,{features:ee}))):b=!1},P=()=>{b=!1};return{layers:new Set(a),listener:m,delegates:{mousemove:S,mouseout:P}}}if(x==="mouseleave"||x==="mouseout"){let b=!1;const S=H=>{const W=a.filter(ee=>this.getLayer(ee));(W.length?this.queryRenderedFeatures(H.point,{layers:W}):[]).length?b=!0:b&&(b=!1,m.call(this,new Js(x,this,H.originalEvent)))},P=H=>{b&&(b=!1,m.call(this,new Js(x,this,H.originalEvent)))};return{layers:new Set(a),listener:m,delegates:{mousemove:S,mouseout:P}}}{const b=S=>{const P=a.filter(W=>this.getLayer(W)),H=P.length?this.queryRenderedFeatures(S.point,{layers:P}):[];H.length&&(S.features=H,m.call(this,S),delete S.features)};return{layers:new Set(a),listener:m,delegates:{[x]:b}}}}on(x,a,m){if(m===void 0)return super.on(x,a);Array.isArray(a)||(a=[a]);const b=this._createDelegatedListener(x,a,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(b);for(const S in b.delegates)this.on(S,b.delegates[S]);return this}once(x,a,m){if(m===void 0)return super.once(x,a);Array.isArray(a)||(a=[a]);const b=this._createDelegatedListener(x,a,m);for(const S in b.delegates)this.once(S,b.delegates[S]);return this}off(x,a,m){if(m===void 0)return super.off(x,a);a=new Set(Array.isArray(a)?a:[a]);const b=(P,H)=>{if(P.size!==H.size)return!1;for(const W of P)if(!H.has(W))return!1;return!0},S=this._delegatedListeners?this._delegatedListeners[x]:void 0;return S&&(P=>{for(let H=0;H<P.length;H++){const W=P[H];if(W.listener===m&&b(W.layers,a)){for(const ee in W.delegates)this.off(ee,W.delegates[ee]);return P.splice(H,1),this}}})(S),this}queryRenderedFeatures(x,a){return this.style?(a!==void 0||x===void 0||x instanceof i.pointGeometry||Array.isArray(x)||(a=x,x=void 0),this.style.queryRenderedFeatures(x=x||[[0,0],[this.transform.width,this.transform.height]],a=a||{},this.transform)):[]}querySourceFeatures(x,a){return this.style.querySourceFeatures(x,a)}setStyle(x,a){return(a=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},a)).diff!==!1&&a.localIdeographFontFamily===this._localIdeographFontFamily&&a.localFontFamily===this._localFontFamily&&this.style&&x?(this._diffStyle(x,a),this):(this._localIdeographFontFamily=a.localIdeographFontFamily,this._localFontFamily=a.localFontFamily,this._updateStyle(x,a))}_getUIString(x){const a=this._locale[x];if(a==null)throw new Error(`Missing UI string '${x}'`);return a}_updateStyle(x,a){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),x&&(this.style=new Ws(this,a||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x):this.style.loadJSON(x)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ws(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,a){if(typeof x=="string"){const m=this._requestManager.normalizeStyleURL(x),b=this._requestManager.transformRequest(m,i.ResourceType.Style);i.getJSON(b,(S,P)=>{S?this.fire(new i.ErrorEvent(S)):P&&this._updateDiff(P,a)})}else typeof x=="object"&&this._updateDiff(x,a)}_updateDiff(x,a){try{this.style.setState(x)&&this._update(!0)}catch(m){i.warnOnce(`Unable to perform style diff: ${m.message||m.error||m}. Rebuilding the style from scratch.`),this._updateStyle(x,a)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(i.warnOnce("There is no style added to the map."),!1)}addSource(x,a){return this._lazyInitEmptyStyle(),this.style.addSource(x,a),this._update(!0)}isSourceLoaded(x){return!!this.style&&this.style._isSourceCacheLoaded(x)}areTilesLoaded(){const x=this.style&&this.style._sourceCaches;for(const a in x){const m=x[a]._tiles;for(const b in m){const S=m[b];if(S.state!=="loaded"&&S.state!=="errored")return!1}}return!0}addSourceType(x,a,m){this._lazyInitEmptyStyle(),this.style.addSourceType(x,a,m)}removeSource(x){return this.style.removeSource(x),this._updateTerrain(),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,a,{pixelRatio:m=1,sdf:b=!1,stretchX:S,stretchY:P,content:H}={}){if(this._lazyInitEmptyStyle(),a instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&a instanceof i.window.ImageBitmap){const{width:W,height:ee,data:pe}=i.exported.getImageData(a);this.style.addImage(x,{data:new i.RGBAImage({width:W,height:ee},pe),pixelRatio:m,stretchX:S,stretchY:P,content:H,sdf:b,version:0})}else if(a.width===void 0||a.height===void 0)this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:W,height:ee}=a,pe=a;this.style.addImage(x,{data:new i.RGBAImage({width:W,height:ee},new Uint8Array(pe.data)),pixelRatio:m,stretchX:S,stretchY:P,content:H,sdf:b,version:0,userImage:pe}),pe.onAdd&&pe.onAdd(this,x)}}updateImage(x,a){const m=this.style.getImage(x);if(!m)return void this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const b=a instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&a instanceof i.window.ImageBitmap?i.exported.getImageData(a):a,{width:S,height:P}=b;S!==void 0&&P!==void 0?S===m.data.width&&P===m.data.height?(m.data.replace(b.data,!(a instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&a instanceof i.window.ImageBitmap)),this.style.updateImage(x,m)):this.fire(new i.ErrorEvent(new Error(`The width and height of the updated image (${S}, ${P})
  4946. must be that same as the previous version of the image
  4947. (${m.data.width}, ${m.data.height})`))):this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new i.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x,a){i.getImage(this._requestManager.transformRequest(x,i.ResourceType.Image),(m,b)=>{a(m,b instanceof i.window.HTMLImageElement?i.exported.getImageData(b):b)})}listImages(){return this.style.listImages()}addLayer(x,a){return this._lazyInitEmptyStyle(),this.style.addLayer(x,a),this._update(!0)}moveLayer(x,a){return this.style.moveLayer(x,a),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}setLayerZoomRange(x,a,m){return this.style.setLayerZoomRange(x,a,m),this._update(!0)}setFilter(x,a,m={}){return this.style.setFilter(x,a,m),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,a,m,b={}){return this.style.setPaintProperty(x,a,m,b),this._update(!0)}getPaintProperty(x,a){return this.style.getPaintProperty(x,a)}setLayoutProperty(x,a,m,b={}){return this.style.setLayoutProperty(x,a,m,b),this._update(!0)}getLayoutProperty(x,a){return this.style.getLayoutProperty(x,a)}setLight(x,a={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,a),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(x){return this._lazyInitEmptyStyle(),!x&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(x),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(x){return this._lazyInitEmptyStyle(),this.style.setFog(x),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(x){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(x),this.transform):0}setFeatureState(x,a){return this.style.setFeatureState(x,a),this._update()}removeFeatureState(x,a){return this.style.removeFeatureState(x,a),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}_updateContainerDimensions(){if(!this._container)return;const x=this._container.getBoundingClientRect().width||400,a=this._container.getBoundingClientRect().height||300;let m,b,S,P=this._container;for(;P&&(!b||!S);){const H=i.window.getComputedStyle(P).transform;H&&H!=="none"&&(m=H.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(b=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(S=m[3])),P=P.parentElement}this._containerWidth=b?Math.abs(x/b):x,this._containerHeight=S?Math.abs(a/S):a}_detectMissingCSS(){i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&i.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const x=this._container;x.classList.add("mapboxgl-map"),(this._missingCSSCanary=z("div","mapboxgl-canary",x)).style.visibility="hidden",this._detectMissingCSS();const a=this._canvasContainer=z("div","mapboxgl-canvas-container",x);this._interactive&&a.classList.add("mapboxgl-interactive"),this._canvas=z("canvas","mapboxgl-canvas",a),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const m=this._controlContainer=z("div","mapboxgl-control-container",x),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(S=>{b[S]=z("div",`mapboxgl-ctrl-${S}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,a){const m=i.exported.devicePixelRatio||1;this._canvas.width=m*Math.ceil(x),this._canvas.height=m*Math.ceil(a),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${a}px`}_addMarker(x){this._markers.push(x)}_removeMarker(x){const a=this._markers.indexOf(x);a!==-1&&this._markers.splice(a,1)}_addPopup(x){this._popups.push(x)}_removePopup(x){const a=this._popups.indexOf(x);a!==-1&&this._popups.splice(a,1)}_setupPainter(){const x=i.extend({},D.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl",x)||this._canvas.getContext("experimental-webgl",x);a?(i.storeAuthState(a,!0),this.painter=new cA(a,this.transform),this.on("data",m=>{m.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(a)):this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(x){x.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:x}))}_contextRestored(x){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:x}))}_onMapScroll(x){if(x.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_requestDomTask(x){!this.loaded()||this.loaded()&&!this.isMoving()?x():this._domRenderTaskQueue.add(x)}_render(x){let a;const m=this.painter.context.extTimerQuery,b=i.exported.now();if(this.listens("gpu-timing-frame")&&(a=m.createQueryEXT(),m.beginQueryEXT(m.TIME_ELAPSED_EXT,a)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],i.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],i.window.performance.now())),this._renderTaskQueue.run(x),this._domRenderTaskQueue.run(x),this._removed)return;this._updateProjectionTransition();const S=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const W=this.transform.zoom,ee=this.transform.pitch,pe=i.exported.now(),fe=new i.EvaluationParameters(W,{now:pe,fadeDuration:S,pitch:ee,transition:this.style.getTransition()});this.style.update(fe)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let P=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),P=this._updateAverageElevation(b),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):P=this._updateAverageElevation(b),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,S,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:S,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),a){const W=i.exported.now()-b;m.endQueryEXT(m.TIME_ELAPSED_EXT,a),setTimeout(()=>{const ee=m.getQueryObjectEXT(a,m.QUERY_RESULT_EXT)/1e6;m.deleteQueryEXT(a),this.fire(new i.Event("gpu-timing-frame",{cpuTime:W,gpuTime:ee})),i.window.performance.mark("frame-gpu",{startTime:b,detail:{gpuTime:ee}})},50)}if(this.listens("gpu-timing-layer")){const W=this.painter.collectGpuTimers();setTimeout(()=>{const ee=this.painter.queryGpuTimers(W);this.fire(new i.Event("gpu-timing-layer",{layerTimes:ee}))},50)}if(this.listens("gpu-timing-deferred-render")){const W=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const ee=this.painter.queryGpuTimeDeferredRender(W);this.fire(new i.Event("gpu-timing-deferred-render",{gpuTime:ee}))},50)}const H=this._sourcesDirty||this._styleDirty||this._placementDirty||P;if(H||this._repaint)this.triggerRepaint();else{const W=!this.isMoving()&&this.loaded();if(W&&(P=this._updateAverageElevation(b,!0)),P)this.triggerRepaint();else if(this._triggerFrame(!1),W&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const ee=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:ee})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||H||(this._fullyLoaded=!0,i.LivePerformanceUtils.mark(i.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&i.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(x){for(const a of this._markers)x&&!this.getRenderWorldCopies()&&(a._lngLat=a._lngLat.wrap()),a._update();for(const a of this._popups)!x||this.getRenderWorldCopies()||a._trackPointer||(a._lngLat=a._lngLat.wrap()),a._update()}_updateAverageElevation(x,a=!1){const m=b=>(this.transform.averageElevation=b,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);if((a||x-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(x)){const b=this.transform.averageElevation;let S=this.transform.sampleAverageElevation(),P=!1;this.transform.elevation&&(P=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(S)?S=0:this._averageElevationLastSampledAt=x;const H=Math.abs(b-S);if(H>1){if(this._isInitialLoad||P)return this._averageElevation.jumpTo(S),m(S);this._averageElevation.easeTo(S,x,300)}else if(H>1e-4)return this._averageElevation.jumpTo(S),m(S)}return!!this._averageElevation.isEasing(x)&&m(this._averageElevation.getValue(x))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,x=>{if(x&&(x.message===i.AUTH_ERR_MSG||x.status===401)){const a=this.painter.context.gl;i.storeAuthState(a,!1),this._logoControl instanceof Bn&&this._logoControl._updateLogo(),a&&a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){const x=this._isDragging();this.painter.updateTerrain(this.style,x)}_calculateSpeedIndex(){const x=this.painter.canvasCopy(),a=this.painter.getCanvasCopiesAndTimestamps();a.timeStamps.push(performance.now());const m=this.painter.context.gl,b=m.createFramebuffer();function S(P){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,P,0);const H=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,H),H}return m.bindFramebuffer(m.FRAMEBUFFER,b),this._canvasPixelComparison(S(x),a.canvasCopies.map(S),a.timeStamps)}_canvasPixelComparison(x,a,m){let b=m[1]-m[0];const S=x.length/4;for(let P=0;P<a.length;P++){const H=a[P];let W=0;for(let ee=0;ee<H.length;ee+=4)H[ee]===x[ee]&&H[ee+1]===x[ee+1]&&H[ee+2]===x[ee+2]&&H[ee+3]===x[ee+3]&&(W+=1);b+=(m[P+2]-m[P+1])*(1-W/S)}return b}remove(){this._hash&&this._hash.remove();for(const a of this._controls)a.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),i.window!==void 0&&(i.window.removeEventListener("resize",this._onWindowResize,!1),i.window.removeEventListener("orientationchange",this._onWindowResize,!1),i.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.removeEventListener("online",this._onWindowOnline,!1),i.window.removeEventListener("visibilitychange",this._onVisibilityChange,!1));const x=this.painter.context.gl.getExtension("WEBGL_lose_context");x&&x.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),i.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new i.Event("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(x){this._renderNextFrame=this._renderNextFrame||x,this.style&&!this._frame&&(this._frame=i.exported.frame(a=>{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(a)}))}_preloadTiles(x){const a=this.style?Object.values(this.style._sourceCaches):[];return i.asyncAll(a,(m,b)=>m._preloadTiles(x,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(x){this._trackResize&&this.resize({originalEvent:x})._update()}_onVisibilityChange(){i.window.document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(x){this._showTerrainWireframe!==x&&(this._showTerrainWireframe=x,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(x){this._speedIndexTiming!==x&&(this._speedIndexTiming=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(x){this._showTileAABBs!==x&&(this._showTileAABBs=x,x&&this._update())}_setCacheLimits(x,a){i.setCacheLimits(x,a)}get version(){return i.version}},NavigationControl:class{constructor(x){this.options=i.extend({},ua,x),this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>{this._map&&this._map.zoomIn({},{originalEvent:a})}),z("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>{this._map&&this._map.zoomOut({},{originalEvent:a})}),z("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{const m=this._map;m&&(this.options.visualizePitch?m.resetNorthPitch({},{originalEvent:a}):m.resetNorth({},{originalEvent:a}))}),this._compassIcon=z("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const x=this._map;if(!x)return;const a=x.getZoom(),m=a===x.getMaxZoom(),b=a===x.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=b,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",b.toString())}_rotateCompassArrow(){const x=this._map;if(!x)return;const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(x.transform.pitch*(Math.PI/180)),.5)}) rotateX(${x.transform.pitch}deg) rotateZ(${x.transform.angle*(180/Math.PI)}deg)`:`rotate(${x.transform.angle*(180/Math.PI)}deg)`;x._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(x){return this._map=x,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),x.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&x.on("pitch",this._rotateCompassArrow),x.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ba(x,this._compass,this.options.visualizePitch)),this._container}onRemove(){const x=this._map;x&&(this._container.remove(),this.options.showZoom&&x.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&x.off("pitch",this._rotateCompassArrow),x.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(x,a){const m=z("button",x,this._container);return m.type="button",m.addEventListener("click",a),m}_setButtonTitle(x,a){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${a}`);x.setAttribute("aria-label",m),x.firstElementChild&&x.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends i.Evented{constructor(x){super(),this.options=i.extend({geolocation:i.window.navigator.geolocation},Wa,x),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=_l(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(x){return this._map=x,this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(x){const a=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,x(m)};this._supportsGeolocation!==void 0?x(this._supportsGeolocation):i.window.navigator.permissions!==void 0?i.window.navigator.permissions.query({name:"geolocation"}).then(m=>a(m.state!=="denied")).catch(()=>a()):a()}_isOutOfMapMaxBounds(x){const a=this._map.getMaxBounds(),m=x.coords;return!!a&&(m.longitude<a.getWest()||m.longitude>a.getEast()||m.latitude<a.getSouth()||m.latitude>a.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(x){if(this._map){if(this._isOutOfMapMaxBounds(x))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",x)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=x,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(x),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(x),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",x)),this._finish()}}_updateCamera(x){const a=new i.LngLat(x.coords.longitude,x.coords.latitude),m=x.coords.accuracy,b=this._map.getBearing(),S=i.extend({bearing:b},this.options.fitBoundsOptions);this._map.fitBounds(a.toBounds(m),S,{geolocateSource:!0})}_updateMarker(x){if(x){const a=new i.LngLat(x.coords.longitude,x.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=x.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const x=this._map.transform,a=i.mercatorZfromAltitude(1,x._center.lat)*x.worldSize,m=Math.ceil(2*this._accuracy*a);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(x){if(this._map){if(this.options.trackUserLocation)if(x.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(x.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",x)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(x){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=z("button","mapboxgl-ctrl-geolocate",this._container),z("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",x===!1){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=z("div","mapboxgl-user-location"),this._dotElement.appendChild(z("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(z("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Lr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=z("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Lr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",a=>{a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a.originalEvent&&a.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}}_onDeviceOrientation(x){this._userLocationDotMarker&&(x.webkitCompassHeading?this._heading=x.webkitCompassHeading:x.absolute===!0&&(this._heading=-1*x.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let x;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(x={maximumAge:6e5,timeout:0},this._noTimeout=!0):(x=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,x),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const x=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};i.window.DeviceMotionEvent!==void 0&&typeof i.window.DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(a=>{a==="granted"&&x()}).catch(console.error):x()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientation),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:cn,ScaleControl:class{constructor(x){this.options=i.extend({},Wo,x),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch{return!1}}()||(this._setScale=mo.bind(this)),i.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const x=this.options.maxWidth||100,a=this._map,m=a._containerHeight/2,b=a._containerWidth/2-x/2,S=a.unproject([b,m]),P=a.unproject([b+x,m]),H=S.distanceTo(P);if(this.options.unit==="imperial"){const W=3.2808*H;W>5280?this._setScale(x,W/5280,"mile"):this._setScale(x,W,"foot")}else this.options.unit==="nautical"?this._setScale(x,H/1852,"nautical-mile"):H>=1e3?this._setScale(x,H/1e3,"kilometer"):this._setScale(x,H,"meter")}_setScale(x,a,m){const b=Ba(a),S=b/a;this._map._requestDomTask(()=>{this._container.style.width=x*S+"px",this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:m}).format(b):`${b}&nbsp;nm`})}onAdd(x){return this._map=x,this._language=x.getLanguage(),this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-scale",x.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(x){this._language=x,this._update()}setUnit(x){this.options.unit=x,this._update()}},FullscreenControl:class{constructor(x){this._fullscreen=!1,x&&x.container&&(x.container instanceof i.window.HTMLElement?this._container=x.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){const x=this._fullscreenButton=z("button","mapboxgl-ctrl-fullscreen",this._controlContainer);z("span","mapboxgl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",x)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(x){super(),this.options=i.extend(Object.create(Rr),x),i.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(x&&x.className?x.className.trim().split(/\s+/):[])}addTo(x){return this._map&&this.remove(),this._map=x,this.options.closeOnClick&&x.on("preclick",this._onClose),this.options.closeOnMove&&x.on("move",this._onClose),x.on("remove",this.remove),this._update(),x._addPopup(this),this._focusFirstElement(),this._trackPointer?(x.on("mousemove",this._onMouseEvent),x.on("mouseup",this._onMouseEvent),x._canvasContainer.classList.add("mapboxgl-track-pointer")):x.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const x=this._map;return x&&(x.off("move",this._update),x.off("move",this._onClose),x.off("preclick",this._onClose),x.off("click",this._onClose),x.off("remove",this.remove),x.off("mousemove",this._onMouseEvent),x.off("mouseup",this._onMouseEvent),x.off("drag",this._onMouseEvent),x._canvasContainer&&x._canvasContainer.classList.remove("mapboxgl-track-pointer"),x._removePopup(this),this._map=void 0),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(x){this._lngLat=i.LngLat.convert(x),this._pos=null,this._trackPointer=!1,this._update();const a=this._map;return a&&(a.on("move",this._update),a.off("mousemove",this._onMouseEvent),a._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const x=this._map;return x&&(x.off("move",this._update),x.on("mousemove",this._onMouseEvent),x.on("drag",this._onMouseEvent),x._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(x){return this.setDOMContent(i.window.document.createTextNode(x))}setHTML(x){const a=i.window.document.createDocumentFragment(),m=i.window.document.createElement("body");let b;for(m.innerHTML=x;b=m.firstChild,b;)a.appendChild(b);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){let a=this._content;if(a)for(;a.hasChildNodes();)a.firstChild&&a.removeChild(a.firstChild);else a=this._content=z("div","mapboxgl-popup-content",this._container||void 0);if(a.appendChild(x),this.options.closeButton){const m=this._closeButton=z("button","mapboxgl-popup-close-button",a);m.type="button",m.setAttribute("aria-label","Close popup"),m.setAttribute("aria-hidden","true"),m.innerHTML="&#215;",m.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(x){return this._classList.add(x),this._updateClassList(),this}removeClassName(x){return this._classList.delete(x),this._updateClassList(),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){let a;return this._classList.delete(x)?a=!1:(this._classList.add(x),a=!0),this._updateClassList(),a}_onMouseEvent(x){this._update(x.point)}_getAnchor(x){if(this.options.anchor)return this.options.anchor;const a=this._map,m=this._container,b=this._pos;if(!a||!m||!b)return"bottom";const S=m.offsetWidth,P=m.offsetHeight,H=b.x<S/2,W=b.x>a.transform.width-S/2;if(b.y+x<P)return H?"top-left":W?"top-right":"top";if(b.y>a.transform.height-P){if(H)return"bottom-left";if(W)return"bottom-right"}return H?"left":W?"right":"bottom"}_updateClassList(){const x=this._container;if(!x)return;const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),x.className=a.join(" ")}_update(x){const a=this._map,m=this._content;if(!a||!this._lngLat&&!this._trackPointer||!m)return;let b=this._container;if(b||(b=this._container=z("div","mapboxgl-popup",a.getContainer()),this._tip=z("div","mapboxgl-popup-tip",b),b.appendChild(m)),this.options.maxWidth&&b.style.maxWidth!==this.options.maxWidth&&(b.style.maxWidth=this.options.maxWidth),a.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ur(this._lngLat,this._pos,a.transform)),!this._trackPointer||x){const S=this._pos=this._trackPointer&&x?x:a.project(this._lngLat),P=Er(this.options.offset),H=this._anchor=this._getAnchor(P.y),W=Er(this.options.offset,H),ee=S.add(W).round();a._requestDomTask(()=>{this._container&&H&&(this._container.style.transform=`${Un[H]} translate(${ee.x}px,${ee.y}px)`)})}if(!this._marker&&a._showingGlobe()){const S=i.isLngLatBehindGlobe(a.transform,this._lngLat)?0:1;this._setOpacity(S)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const x=this._container.querySelector(Cr);x&&x.focus()}_onClose(){this.remove()}_setOpacity(x){this._container&&(this._container.style.opacity=`${x}`),this._content&&(this._content.style.pointerEvents=x?"auto":"none")}},Marker:Lr,Style:Ws,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:Vh,Evented:i.Evented,config:i.config,prewarm:function(){jt().acquire(et)},clearPrewarmedResources:function(){const x=Lt;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(et),Lt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(x){i.config.ACCESS_TOKEN=x},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(x){i.config.API_URL=x},get workerCount(){return pt.workerCount},set workerCount(x){pt.workerCount=x},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(x){i.config.MAX_PARALLEL_IMAGE_REQUESTS=x},clearStorage(x){i.clearTileCache(x)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return $l});var y=c;return y})})(UF);const Em=UF.exports,bV=`
  4948. varying vec2 vUv;
  4949. varying vec3 v3;
  4950. varying vec3 v_color;
  4951. attribute vec3 color;
  4952. void main(){
  4953. v_color = color;
  4954. vUv = uv;
  4955. // v3 = vec3((position.x+1.0) /2.0,(position.y+1.0) /2.0,(position.z+1.0) /2.0);
  4956. // v3 = vec3((position.x+1.0) /2.0,(position.y+1.0) /2.0,(position.z+1.0) /2.0);
  4957. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  4958. }
  4959. `,BV=`
  4960. varying vec2 vUv;
  4961. varying vec3 v3;
  4962. uniform float iTime;
  4963. uniform float opacity;
  4964. uniform vec3 color;
  4965. varying vec3 v_color;
  4966. void main(){
  4967. vec2 uv = vUv;
  4968. // vec3 vv3 = vec3((v3.x+1.0) /2.0,(v3.y+1.0) /2.0,(v3.z+1.0) /2.0);
  4969. // v3.x = (v3.x + 1.0) / 2.0;
  4970. // float time = iTime * 0.3 + 0.0*0.01;
  4971. // // To create the BG pattern
  4972. // vec3 wave_color = vec3(0.0);
  4973. // // To create the waves
  4974. // float wave_width = 0.01;
  4975. // // uv.y -= 0.5;
  4976. //
  4977. // for(float i = 0.0; i < 1.0; i++) {
  4978. //
  4979. // // uv.y += cos(i * 2.0 + iTime ) > 0.0 ? sin(i * 2.0 + iTime ) : -sin(i * 2.0 + iTime ) ;
  4980. // // \u63A7\u5236\u7EBF\u6761\u8FD0\u52A8\u65B9\u5F0F\u3002 sin \u5185\u90E8\u63A7\u5236\u901F\u5EA6 \u5916\u9762\u63A7\u5236\u5E45\u5EA6
  4981. // // uv.y += sin(i * 2.3 + iTime ) * 0.5 + 0.0 ; // 0 => 0.3 ,uv.y \u662F0-1\u533A\u95F4\u5185
  4982. // // uv.y += 1.5;
  4983. // // | uv.y | < 0.293 \u9010\u6B65\u663E\u793A > 0.293 \u9010\u6B65\u9690\u85CF
  4984. // // uv.y = 0.293;
  4985. // // \u63A7\u5236\u7EBF\u6761\u5BBD\u5EA6
  4986. // wave_width = abs(1.0 / (40.0 * uv.y));
  4987. // wave_color = vec3(wave_width , wave_width * 3.9, wave_width * 4.5);
  4988. // }
  4989. //
  4990. // float random = ((wave_color.r + wave_color.g + wave_color.b) / 4.0) - 0.2;
  4991. // // gl_FragColor = vec4(wave_color, random);
  4992. // // uv.y += 0.5;
  4993. // gl_FragColor = vec4(uv.y,0.0,0.0,1.0);
  4994. gl_FragColor = vec4(v_color,opacity);
  4995. }
  4996. `;function CV(u){let e=[];return u.features.forEach(function(t){const r={geo:[],name:t.properties.name};r.name,e.push(r);const c=0;t.geometry.type==="Polygon"?(r.geo[0]=[],t.geometry.coordinates[0].forEach((p=[0,1,2])=>{p[0]=Em.MercatorCoordinate.fromLngLat(p,c).x,p[1]=Em.MercatorCoordinate.fromLngLat(p,c).y,p[2]=Em.MercatorCoordinate.fromLngLat(p,c).z,r.geo[0].push(new Di(p[0],p[1]))})):t.geometry.type==="MultiPolygon"&&t.geometry.coordinates.forEach((p,y)=>{r.geo[y]=[],p[0].forEach(i=>{i[0]=Em.MercatorCoordinate.fromLngLat(i,c).x,i[1]=Em.MercatorCoordinate.fromLngLat(i,c).y,i[2]=Em.MercatorCoordinate.fromLngLat(i,c).z,r.geo[y].push(new ft(i[0],i[1],i[2]))})})}),e}function Jw(u){let e=new Hs;return e.name="geojson",CV(u)}var ic=63710088e-1,zF={centimeters:ic*100,centimetres:ic*100,degrees:ic/111325,feet:ic*3.28084,inches:ic*39.37,kilometers:ic/1e3,kilometres:ic/1e3,meters:ic,metres:ic,miles:ic/1609.344,millimeters:ic*1e3,millimetres:ic*1e3,nauticalmiles:ic/1852,radians:1,yards:ic*1.0936};function EV(u,e,t){t===void 0&&(t={});var r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=u,r}function TV(u,e,t){if(t===void 0&&(t={}),!u)throw new Error("coordinates is required");if(!Array.isArray(u))throw new Error("coordinates must be an Array");if(u.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!nS(u[0])||!nS(u[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:u};return EV(r,e,t)}function SV(u,e){e===void 0&&(e="kilometers");var t=zF[e];if(!t)throw new Error(e+" units is invalid");return u*t}function MV(u,e){e===void 0&&(e="kilometers");var t=zF[e];if(!t)throw new Error(e+" units is invalid");return u/t}function _2(u){var e=u%(2*Math.PI);return e*180/Math.PI}function hu(u){var e=u%360;return e*Math.PI/180}function nS(u){return!isNaN(u)&&u!==null&&!Array.isArray(u)}function ry(u){if(!u)throw new Error("coord is required");if(!Array.isArray(u)){if(u.type==="Feature"&&u.geometry!==null&&u.geometry.type==="Point")return u.geometry.coordinates;if(u.type==="Point")return u.coordinates}if(Array.isArray(u)&&u.length>=2&&!Array.isArray(u[0])&&!Array.isArray(u[1]))return u;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function kF(u,e,t){t===void 0&&(t={});var r=ry(u),c=ry(e),p=hu(c[1]-r[1]),y=hu(c[0]-r[0]),i=hu(r[1]),C=hu(c[1]),D=Math.pow(Math.sin(p/2),2)+Math.pow(Math.sin(y/2),2)*Math.cos(i)*Math.cos(C);return SV(2*Math.atan2(Math.sqrt(D),Math.sqrt(1-D)),t.units)}function IV(u,e,t,r){r===void 0&&(r={});var c=ry(u),p=hu(c[0]),y=hu(c[1]),i=hu(t),C=MV(e,r.units),D=Math.asin(Math.sin(y)*Math.cos(C)+Math.cos(y)*Math.sin(C)*Math.cos(i)),R=p+Math.atan2(Math.sin(i)*Math.sin(C)*Math.cos(y),Math.cos(C)-Math.sin(y)*Math.sin(D)),Q=_2(R),z=_2(D);return TV([Q,z],r.properties)}function OF(u,e,t){if(t===void 0&&(t={}),t.final===!0)return FV(u,e);var r=ry(u),c=ry(e),p=hu(r[0]),y=hu(c[0]),i=hu(r[1]),C=hu(c[1]),D=Math.sin(y-p)*Math.cos(C),R=Math.cos(i)*Math.sin(C)-Math.sin(i)*Math.cos(C)*Math.cos(y-p);return _2(Math.atan2(D,R))}function FV(u,e){var t=OF(e,u);return t=(t+180)%360,t}function LV(u,e){var t=kF(u,e),r=OF(u,e),c=IV(u,t/2,r);return c}var yv={exports:{}};/*!
  4997. * Knockout JavaScript library v3.5.1
  4998. * (c) The Knockout.js team - http://knockoutjs.com/
  4999. * License: MIT (http://www.opensource.org/licenses/mit-license.php)
  5000. */(function(u,e){(function(){(function(t){var r=this||(0,eval)("this"),c=r.document,p=r.navigator,y=r.jQuery,i=r.JSON;y||typeof jQuery>"u"||(y=jQuery),function(C){C(u.exports||e)}(function(C,D){function R(te,le){return te===null||typeof te in ae?te===le:!1}function Q(te,le){var ye;return function(){ye||(ye=B.a.setTimeout(function(){ye=t,te()},le))}}function z(te,le){var ye;return function(){clearTimeout(ye),ye=B.a.setTimeout(te,le)}}function G(te,le){le&&le!=="change"?le==="beforeChange"?this.pc(te):this.gb(te,le):this.qc(te)}function J(te,le){le!==null&&le.s&&le.s()}function Y(te,le){var ye=this.qd,xe=ye[De];xe.ra||(this.Qb&&this.mb[le]?(ye.uc(le,te,this.mb[le]),this.mb[le]=null,--this.Qb):xe.I[le]||ye.uc(le,te,xe.J?{da:te}:ye.$c(te)),te.Ja&&te.gd())}var B=typeof C<"u"?C:{};B.b=function(te,le){for(var ye=te.split("."),xe=B,Re=0;Re<ye.length-1;Re++)xe=xe[ye[Re]];xe[ye[ye.length-1]]=le},B.L=function(te,le,ye){te[le]=ye},B.version="3.5.1",B.b("version",B.version),B.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},B.a=function(){function te(be,At){for(var ut in be)Re.call(be,ut)&&At(ut,be[ut])}function le(be,At){if(At)for(var ut in At)Re.call(At,ut)&&(be[ut]=At[ut]);return be}function ye(be,At){return be.__proto__=At,be}function xe(be,At,ut,Nt){var Gt=be[At].match(nt)||[];B.a.D(ut.match(nt),function(Qt){B.a.Na(Gt,Qt,Nt)}),be[At]=Gt.join(" ")}var Re=Object.prototype.hasOwnProperty,Oe={__proto__:[]}instanceof Array,We=typeof Symbol=="function",Ve={},Qe={};Ve[p&&/Firefox\/2/i.test(p.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],Ve.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),te(Ve,function(be,At){if(At.length)for(var ut=0,Nt=At.length;ut<Nt;ut++)Qe[At[ut]]=be});var Se={propertychange:!0},Ke=c&&function(){for(var be=3,At=c.createElement("div"),ut=At.getElementsByTagName("i");At.innerHTML="<!--[if gt IE "+ ++be+"]><i></i><![endif]-->",ut[0];);return 4<be?be:t}(),nt=/\S+/g,vt;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(be,At,ut){for(var Nt=0,Gt=be.length;Nt<Gt;Nt++)At.call(ut,be[Nt],Nt,be)},A:typeof Array.prototype.indexOf=="function"?function(be,At){return Array.prototype.indexOf.call(be,At)}:function(be,At){for(var ut=0,Nt=be.length;ut<Nt;ut++)if(be[ut]===At)return ut;return-1},Lb:function(be,At,ut){for(var Nt=0,Gt=be.length;Nt<Gt;Nt++)if(At.call(ut,be[Nt],Nt,be))return be[Nt];return t},Pa:function(be,At){var ut=B.a.A(be,At);0<ut?be.splice(ut,1):ut===0&&be.shift()},wc:function(be){var At=[];return be&&B.a.D(be,function(ut){0>B.a.A(At,ut)&&At.push(ut)}),At},Mb:function(be,At,ut){var Nt=[];if(be)for(var Gt=0,Qt=be.length;Gt<Qt;Gt++)Nt.push(At.call(ut,be[Gt],Gt));return Nt},jb:function(be,At,ut){var Nt=[];if(be)for(var Gt=0,Qt=be.length;Gt<Qt;Gt++)At.call(ut,be[Gt],Gt)&&Nt.push(be[Gt]);return Nt},Nb:function(be,At){if(At instanceof Array)be.push.apply(be,At);else for(var ut=0,Nt=At.length;ut<Nt;ut++)be.push(At[ut]);return be},Na:function(be,At,ut){var Nt=B.a.A(B.a.bc(be),At);0>Nt?ut&&be.push(At):ut||be.splice(Nt,1)},Ba:Oe,extend:le,setPrototypeOf:ye,Ab:Oe?ye:le,P:te,Ga:function(be,At,ut){if(!be)return be;var Nt={},Gt;for(Gt in be)Re.call(be,Gt)&&(Nt[Gt]=At.call(ut,be[Gt],Gt,be));return Nt},Tb:function(be){for(;be.firstChild;)B.removeNode(be.firstChild)},Yb:function(be){be=B.a.la(be);for(var At=(be[0]&&be[0].ownerDocument||c).createElement("div"),ut=0,Nt=be.length;ut<Nt;ut++)At.appendChild(B.oa(be[ut]));return At},Ca:function(be,At){for(var ut=0,Nt=be.length,Gt=[];ut<Nt;ut++){var Qt=be[ut].cloneNode(!0);Gt.push(At?B.oa(Qt):Qt)}return Gt},va:function(be,At){if(B.a.Tb(be),At)for(var ut=0,Nt=At.length;ut<Nt;ut++)be.appendChild(At[ut])},Xc:function(be,At){var ut=be.nodeType?[be]:be;if(0<ut.length){for(var Nt=ut[0],Gt=Nt.parentNode,Qt=0,Ct=At.length;Qt<Ct;Qt++)Gt.insertBefore(At[Qt],Nt);for(Qt=0,Ct=ut.length;Qt<Ct;Qt++)B.removeNode(ut[Qt])}},Ua:function(be,At){if(be.length){for(At=At.nodeType===8&&At.parentNode||At;be.length&&be[0].parentNode!==At;)be.splice(0,1);for(;1<be.length&&be[be.length-1].parentNode!==At;)be.length--;if(1<be.length){var ut=be[0],Nt=be[be.length-1];for(be.length=0;ut!==Nt;)be.push(ut),ut=ut.nextSibling;be.push(Nt)}}return be},Zc:function(be,At){7>Ke?be.setAttribute("selected",At):be.selected=At},Db:function(be){return be===null||be===t?"":be.trim?be.trim():be.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(be,At){return be=be||"",At.length>be.length?!1:be.substring(0,At.length)===At},vd:function(be,At){if(be===At)return!0;if(be.nodeType===11)return!1;if(At.contains)return At.contains(be.nodeType!==1?be.parentNode:be);if(At.compareDocumentPosition)return(At.compareDocumentPosition(be)&16)==16;for(;be&&be!=At;)be=be.parentNode;return!!be},Sb:function(be){return B.a.vd(be,be.ownerDocument.documentElement)},kd:function(be){return!!B.a.Lb(be,B.a.Sb)},R:function(be){return be&&be.tagName&&be.tagName.toLowerCase()},Ac:function(be){return B.onError?function(){try{return be.apply(this,arguments)}catch(At){throw B.onError&&B.onError(At),At}}:be},setTimeout:function(be,At){return setTimeout(B.a.Ac(be),At)},Gc:function(be){setTimeout(function(){throw B.onError&&B.onError(be),be},0)},B:function(be,At,ut){var Nt=B.a.Ac(ut);if(ut=Se[At],B.options.useOnlyNativeEvents||ut||!y)if(ut||typeof be.addEventListener!="function")if(typeof be.attachEvent<"u"){var Gt=function(Ct){Nt.call(be,Ct)},Qt="on"+At;be.attachEvent(Qt,Gt),B.a.K.za(be,function(){be.detachEvent(Qt,Gt)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else be.addEventListener(At,Nt,!1);else vt||(vt=typeof y(be).on=="function"?"on":"bind"),y(be)[vt](At,Nt)},Fb:function(be,At){if(!be||!be.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var ut;if(B.a.R(be)==="input"&&be.type&&At.toLowerCase()=="click"?(ut=be.type,ut=ut=="checkbox"||ut=="radio"):ut=!1,B.options.useOnlyNativeEvents||!y||ut)if(typeof c.createEvent=="function")if(typeof be.dispatchEvent=="function")ut=c.createEvent(Qe[At]||"HTMLEvents"),ut.initEvent(At,!0,!0,r,0,0,0,0,0,!1,!1,!1,!1,0,be),be.dispatchEvent(ut);else throw Error("The supplied element doesn't support dispatchEvent");else if(ut&&be.click)be.click();else if(typeof be.fireEvent<"u")be.fireEvent("on"+At);else throw Error("Browser doesn't support triggering events");else y(be).trigger(At)},f:function(be){return B.O(be)?be():be},bc:function(be){return B.O(be)?be.v():be},Eb:function(be,At,ut){var Nt;At&&(typeof be.classList=="object"?(Nt=be.classList[ut?"add":"remove"],B.a.D(At.match(nt),function(Gt){Nt.call(be.classList,Gt)})):typeof be.className.baseVal=="string"?xe(be.className,"baseVal",At,ut):xe(be,"className",At,ut))},Bb:function(be,At){var ut=B.a.f(At);(ut===null||ut===t)&&(ut="");var Nt=B.h.firstChild(be);!Nt||Nt.nodeType!=3||B.h.nextSibling(Nt)?B.h.va(be,[be.ownerDocument.createTextNode(ut)]):Nt.data=ut,B.a.Ad(be)},Yc:function(be,At){if(be.name=At,7>=Ke)try{var ut=be.name.replace(/[&<>'"]/g,function(Nt){return"&#"+Nt.charCodeAt(0)+";"});be.mergeAttributes(c.createElement("<input name='"+ut+"'/>"),!1)}catch{}},Ad:function(be){9<=Ke&&(be=be.nodeType==1?be:be.parentNode,be.style&&(be.style.zoom=be.style.zoom))},wd:function(be){if(Ke){var At=be.style.width;be.style.width=0,be.style.width=At}},Pd:function(be,At){be=B.a.f(be),At=B.a.f(At);for(var ut=[],Nt=be;Nt<=At;Nt++)ut.push(Nt);return ut},la:function(be){for(var At=[],ut=0,Nt=be.length;ut<Nt;ut++)At.push(be[ut]);return At},Da:function(be){return We?Symbol(be):be},Zd:Ke===6,$d:Ke===7,W:Ke,Lc:function(be,At){for(var ut=B.a.la(be.getElementsByTagName("input")).concat(B.a.la(be.getElementsByTagName("textarea"))),Nt=typeof At=="string"?function(Ct){return Ct.name===At}:function(Ct){return At.test(Ct.name)},Gt=[],Qt=ut.length-1;0<=Qt;Qt--)Nt(ut[Qt])&&Gt.push(ut[Qt]);return Gt},Nd:function(be){return typeof be=="string"&&(be=B.a.Db(be))?i&&i.parse?i.parse(be):new Function("return "+be)():null},hc:function(be,At,ut){if(!i||!i.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return i.stringify(B.a.f(be),At,ut)},Od:function(be,At,ut){ut=ut||{};var Nt=ut.params||{},Gt=ut.includeFields||this.Jc,Qt=be;if(typeof be=="object"&&B.a.R(be)==="form")for(var Qt=be.action,Ct=Gt.length-1;0<=Ct;Ct--)for(var Ft=B.a.Lc(be,Gt[Ct]),Xt=Ft.length-1;0<=Xt;Xt--)Nt[Ft[Xt].name]=Ft[Xt].value;At=B.a.f(At);var _i=c.createElement("form");_i.style.display="none",_i.action=Qt,_i.method="post";for(var fi in At)be=c.createElement("input"),be.type="hidden",be.name=fi,be.value=B.a.hc(B.a.f(At[fi])),_i.appendChild(be);te(Nt,function(Gi,wn){var zi=c.createElement("input");zi.type="hidden",zi.name=Gi,zi.value=wn,_i.appendChild(zi)}),c.body.appendChild(_i),ut.submitter?ut.submitter(_i):_i.submit(),setTimeout(function(){_i.parentNode.removeChild(_i)},0)}}}(),B.b("utils",B.a),B.b("utils.arrayForEach",B.a.D),B.b("utils.arrayFirst",B.a.Lb),B.b("utils.arrayFilter",B.a.jb),B.b("utils.arrayGetDistinctValues",B.a.wc),B.b("utils.arrayIndexOf",B.a.A),B.b("utils.arrayMap",B.a.Mb),B.b("utils.arrayPushAll",B.a.Nb),B.b("utils.arrayRemoveItem",B.a.Pa),B.b("utils.cloneNodes",B.a.Ca),B.b("utils.createSymbolOrString",B.a.Da),B.b("utils.extend",B.a.extend),B.b("utils.fieldsIncludedWithJsonPost",B.a.Jc),B.b("utils.getFormFields",B.a.Lc),B.b("utils.objectMap",B.a.Ga),B.b("utils.peekObservable",B.a.bc),B.b("utils.postJson",B.a.Od),B.b("utils.parseJson",B.a.Nd),B.b("utils.registerEventHandler",B.a.B),B.b("utils.stringifyJson",B.a.hc),B.b("utils.range",B.a.Pd),B.b("utils.toggleDomNodeCssClass",B.a.Eb),B.b("utils.triggerEvent",B.a.Fb),B.b("utils.unwrapObservable",B.a.f),B.b("utils.objectForEach",B.a.P),B.b("utils.addOrRemoveItem",B.a.Na),B.b("utils.setTextContent",B.a.Bb),B.b("unwrap",B.a.f),Function.prototype.bind||(Function.prototype.bind=function(te){var le=this;if(arguments.length===1)return function(){return le.apply(te,arguments)};var ye=Array.prototype.slice.call(arguments,1);return function(){var xe=ye.slice(0);return xe.push.apply(xe,arguments),le.apply(te,xe)}}),B.a.g=new function(){var te=0,le="__ko__"+new Date().getTime(),ye={},xe,Re;return B.a.W?(xe=function(Oe,We){var Ve=Oe[le];if(!Ve||Ve==="null"||!ye[Ve]){if(!We)return t;Ve=Oe[le]="ko"+te++,ye[Ve]={}}return ye[Ve]},Re=function(Oe){var We=Oe[le];return We?(delete ye[We],Oe[le]=null,!0):!1}):(xe=function(Oe,We){var Ve=Oe[le];return!Ve&&We&&(Ve=Oe[le]={}),Ve},Re=function(Oe){return Oe[le]?(delete Oe[le],!0):!1}),{get:function(Oe,We){var Ve=xe(Oe,!1);return Ve&&Ve[We]},set:function(Oe,We,Ve){(Oe=xe(Oe,Ve!==t))&&(Oe[We]=Ve)},Ub:function(Oe,We,Ve){return Oe=xe(Oe,!0),Oe[We]||(Oe[We]=Ve)},clear:Re,Z:function(){return te+++le}}},B.b("utils.domData",B.a.g),B.b("utils.domData.clear",B.a.g.clear),B.a.K=new function(){function te(We,Ve){var Qe=B.a.g.get(We,xe);return Qe===t&&Ve&&(Qe=[],B.a.g.set(We,xe,Qe)),Qe}function le(We){var Ve=te(We,!1);if(Ve)for(var Ve=Ve.slice(0),Qe=0;Qe<Ve.length;Qe++)Ve[Qe](We);B.a.g.clear(We),B.a.K.cleanExternalData(We),Oe[We.nodeType]&&ye(We.childNodes,!0)}function ye(We,Ve){for(var Qe=[],Se,Ke=0;Ke<We.length;Ke++)if((!Ve||We[Ke].nodeType===8)&&(le(Qe[Qe.length]=Se=We[Ke]),We[Ke]!==Se))for(;Ke--&&B.a.A(Qe,We[Ke])==-1;);}var xe=B.a.g.Z(),Re={1:!0,8:!0,9:!0},Oe={1:!0,9:!0};return{za:function(We,Ve){if(typeof Ve!="function")throw Error("Callback must be a function");te(We,!0).push(Ve)},yb:function(We,Ve){var Qe=te(We,!1);Qe&&(B.a.Pa(Qe,Ve),Qe.length==0&&B.a.g.set(We,xe,t))},oa:function(We){return B.u.G(function(){Re[We.nodeType]&&(le(We),Oe[We.nodeType]&&ye(We.getElementsByTagName("*")))}),We},removeNode:function(We){B.oa(We),We.parentNode&&We.parentNode.removeChild(We)},cleanExternalData:function(We){y&&typeof y.cleanData=="function"&&y.cleanData([We])}}},B.oa=B.a.K.oa,B.removeNode=B.a.K.removeNode,B.b("cleanNode",B.oa),B.b("removeNode",B.removeNode),B.b("utils.domNodeDisposal",B.a.K),B.b("utils.domNodeDisposal.addDisposeCallback",B.a.K.za),B.b("utils.domNodeDisposal.removeDisposeCallback",B.a.K.yb),function(){var te=[0,"",""],le=[1,"<table>","</table>"],ye=[3,"<table><tbody><tr>","</tr></tbody></table>"],xe=[1,"<select multiple='multiple'>","</select>"],Re={thead:le,tbody:le,tfoot:le,tr:[2,"<table><tbody>","</tbody></table>"],td:ye,th:ye,option:xe,optgroup:xe},Oe=8>=B.a.W;B.a.ua=function(We,Ve){var Qe;if(y){if(y.parseHTML)Qe=y.parseHTML(We,Ve)||[];else if((Qe=y.clean([We],Ve))&&Qe[0]){for(var Se=Qe[0];Se.parentNode&&Se.parentNode.nodeType!==11;)Se=Se.parentNode;Se.parentNode&&Se.parentNode.removeChild(Se)}}else{(Qe=Ve)||(Qe=c);var Se=Qe.parentWindow||Qe.defaultView||r,Ke=B.a.Db(We).toLowerCase(),nt=Qe.createElement("div"),vt;for(vt=(Ke=Ke.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&Re[Ke[1]]||te,Ke=vt[0],vt="ignored<div>"+vt[1]+We+vt[2]+"</div>",typeof Se.innerShiv=="function"?nt.appendChild(Se.innerShiv(vt)):(Oe&&Qe.body.appendChild(nt),nt.innerHTML=vt,Oe&&nt.parentNode.removeChild(nt));Ke--;)nt=nt.lastChild;Qe=B.a.la(nt.lastChild.childNodes)}return Qe},B.a.Md=function(We,Ve){var Qe=B.a.ua(We,Ve);return Qe.length&&Qe[0].parentElement||B.a.Yb(Qe)},B.a.fc=function(We,Ve){if(B.a.Tb(We),Ve=B.a.f(Ve),Ve!==null&&Ve!==t)if(typeof Ve!="string"&&(Ve=Ve.toString()),y)y(We).html(Ve);else for(var Qe=B.a.ua(Ve,We.ownerDocument),Se=0;Se<Qe.length;Se++)We.appendChild(Qe[Se])}}(),B.b("utils.parseHtmlFragment",B.a.ua),B.b("utils.setHtml",B.a.fc),B.aa=function(){function te(ye,xe){if(ye){if(ye.nodeType==8){var Re=B.aa.Uc(ye.nodeValue);Re!=null&&xe.push({ud:ye,Kd:Re})}else if(ye.nodeType==1)for(var Re=0,Oe=ye.childNodes,We=Oe.length;Re<We;Re++)te(Oe[Re],xe)}}var le={};return{Xb:function(ye){if(typeof ye!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var xe=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return le[xe]=ye,"<!--[ko_memo:"+xe+"]-->"},bd:function(ye,xe){var Re=le[ye];if(Re===t)throw Error("Couldn't find any memo with ID "+ye+". Perhaps it's already been unmemoized.");try{return Re.apply(null,xe||[]),!0}finally{delete le[ye]}},cd:function(ye,xe){var Re=[];te(ye,Re);for(var Oe=0,We=Re.length;Oe<We;Oe++){var Ve=Re[Oe].ud,Qe=[Ve];xe&&B.a.Nb(Qe,xe),B.aa.bd(Re[Oe].Kd,Qe),Ve.nodeValue="",Ve.parentNode&&Ve.parentNode.removeChild(Ve)}},Uc:function(ye){return(ye=ye.match(/^\[ko_memo\:(.*?)\]$/))?ye[1]:null}}}(),B.b("memoization",B.aa),B.b("memoization.memoize",B.aa.Xb),B.b("memoization.unmemoize",B.aa.bd),B.b("memoization.parseMemoText",B.aa.Uc),B.b("memoization.unmemoizeDomNodeAndDescendants",B.aa.cd),B.na=function(){function te(){if(Re){for(var Ve=Re,Qe=0,Se;We<Re;)if(Se=xe[We++]){if(We>Ve){if(5e3<=++Qe){We=Re,B.a.Gc(Error("'Too much recursion' after processing "+Qe+" task groups."));break}Ve=Re}try{Se()}catch(Ke){B.a.Gc(Ke)}}}}function le(){te(),We=Re=xe.length=0}var ye,xe=[],Re=0,Oe=1,We=0;return r.MutationObserver?ye=function(Ve){var Qe=c.createElement("div");return new MutationObserver(Ve).observe(Qe,{attributes:!0}),function(){Qe.classList.toggle("foo")}}(le):ye=c&&"onreadystatechange"in c.createElement("script")?function(Ve){var Qe=c.createElement("script");Qe.onreadystatechange=function(){Qe.onreadystatechange=null,c.documentElement.removeChild(Qe),Qe=null,Ve()},c.documentElement.appendChild(Qe)}:function(Ve){setTimeout(Ve,0)},{scheduler:ye,zb:function(Ve){return Re||B.na.scheduler(le),xe[Re++]=Ve,Oe++},cancel:function(Ve){Ve=Ve-(Oe-Re),Ve>=We&&Ve<Re&&(xe[Ve]=null)},resetForTesting:function(){var Ve=Re-We;return We=Re=xe.length=0,Ve},Sd:te}}(),B.b("tasks",B.na),B.b("tasks.schedule",B.na.zb),B.b("tasks.runEarly",B.na.Sd),B.Ta={throttle:function(te,le){te.throttleEvaluation=le;var ye=null;return B.$({read:te,write:function(xe){clearTimeout(ye),ye=B.a.setTimeout(function(){te(xe)},le)}})},rateLimit:function(te,le){var ye,xe,Re;typeof le=="number"?ye=le:(ye=le.timeout,xe=le.method),te.Hb=!1,Re=typeof xe=="function"?xe:xe=="notifyWhenChangesStop"?z:Q,te.ub(function(Oe){return Re(Oe,ye,le)})},deferred:function(te,le){if(le!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");te.Hb||(te.Hb=!0,te.ub(function(ye){var xe,Re=!1;return function(){if(!Re){B.na.cancel(xe),xe=B.na.zb(ye);try{Re=!0,te.notifySubscribers(t,"dirty")}finally{Re=!1}}}}))},notify:function(te,le){te.equalityComparer=le=="always"?null:R}};var ae={undefined:1,boolean:1,number:1,string:1};B.b("extenders",B.Ta),B.ic=function(te,le,ye){this.da=te,this.lc=le,this.mc=ye,this.Ib=!1,this.fb=this.Jb=null,B.L(this,"dispose",this.s),B.L(this,"disposeWhenNodeIsRemoved",this.l)},B.ic.prototype.s=function(){this.Ib||(this.fb&&B.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},B.ic.prototype.l=function(te){this.Jb=te,B.a.K.za(te,this.fb=this.s.bind(this))},B.T=function(){B.a.Ab(this,ce),ce.qb(this)};var ce={qb:function(te){te.U={change:[]},te.sc=1},subscribe:function(te,le,ye){var xe=this;ye=ye||"change";var Re=new B.ic(xe,le?te.bind(le):te,function(){B.a.Pa(xe.U[ye],Re),xe.hb&&xe.hb(ye)});return xe.Qa&&xe.Qa(ye),xe.U[ye]||(xe.U[ye]=[]),xe.U[ye].push(Re),Re},notifySubscribers:function(te,le){if(le=le||"change",le==="change"&&this.Gb(),this.Wa(le)){var ye=le==="change"&&this.ed||this.U[le].slice(0);try{B.u.xc();for(var xe=0,Re;Re=ye[xe];++xe)Re.Ib||Re.lc(te)}finally{B.u.end()}}},ob:function(){return this.sc},Dd:function(te){return this.ob()!==te},Gb:function(){++this.sc},ub:function(te){var le=this,ye=B.O(le),xe,Re,Oe,We,Ve;le.gb||(le.gb=le.notifySubscribers,le.notifySubscribers=G);var Qe=te(function(){le.Ja=!1,ye&&We===le&&(We=le.nc?le.nc():le());var Se=Re||Ve&&le.sb(Oe,We);Ve=Re=xe=!1,Se&&le.gb(Oe=We)});le.qc=function(Se,Ke){Ke&&le.Ja||(Ve=!Ke),le.ed=le.U.change.slice(0),le.Ja=xe=!0,We=Se,Qe()},le.pc=function(Se){xe||(Oe=Se,le.gb(Se,"beforeChange"))},le.rc=function(){Ve=!0},le.gd=function(){le.sb(Oe,le.v(!0))&&(Re=!0)}},Wa:function(te){return this.U[te]&&this.U[te].length},Bd:function(te){if(te)return this.U[te]&&this.U[te].length||0;var le=0;return B.a.P(this.U,function(ye,xe){ye!=="dirty"&&(le+=xe.length)}),le},sb:function(te,le){return!this.equalityComparer||!this.equalityComparer(te,le)},toString:function(){return"[object Object]"},extend:function(te){var le=this;return te&&B.a.P(te,function(ye,xe){var Re=B.Ta[ye];typeof Re=="function"&&(le=Re(le,xe)||le)}),le}};B.L(ce,"init",ce.qb),B.L(ce,"subscribe",ce.subscribe),B.L(ce,"extend",ce.extend),B.L(ce,"getSubscriptionsCount",ce.Bd),B.a.Ba&&B.a.setPrototypeOf(ce,Function.prototype),B.T.fn=ce,B.Qc=function(te){return te!=null&&typeof te.subscribe=="function"&&typeof te.notifySubscribers=="function"},B.b("subscribable",B.T),B.b("isSubscribable",B.Qc),B.S=B.u=function(){function te(Oe){ye.push(xe),xe=Oe}function le(){xe=ye.pop()}var ye=[],xe,Re=0;return{xc:te,end:le,cc:function(Oe){if(xe){if(!B.Qc(Oe))throw Error("Only subscribable things can act as dependencies");xe.od.call(xe.pd,Oe,Oe.fd||(Oe.fd=++Re))}},G:function(Oe,We,Ve){try{return te(),Oe.apply(We,Ve||[])}finally{le()}},qa:function(){if(xe)return xe.o.qa()},Va:function(){if(xe)return xe.o.Va()},Ya:function(){if(xe)return xe.Ya},o:function(){if(xe)return xe.o}}}(),B.b("computedContext",B.S),B.b("computedContext.getDependenciesCount",B.S.qa),B.b("computedContext.getDependencies",B.S.Va),B.b("computedContext.isInitial",B.S.Ya),B.b("computedContext.registerDependency",B.S.cc),B.b("ignoreDependencies",B.Yd=B.u.G);var Ae=B.a.Da("_latestValue");B.ta=function(te){function le(){return 0<arguments.length?(le.sb(le[Ae],arguments[0])&&(le.ya(),le[Ae]=arguments[0],le.xa()),this):(B.u.cc(le),le[Ae])}return le[Ae]=te,B.a.Ba||B.a.extend(le,B.T.fn),B.T.fn.qb(le),B.a.Ab(le,we),B.options.deferUpdates&&B.Ta.deferred(le,!0),le};var we={equalityComparer:R,v:function(){return this[Ae]},xa:function(){this.notifySubscribers(this[Ae],"spectate"),this.notifySubscribers(this[Ae])},ya:function(){this.notifySubscribers(this[Ae],"beforeChange")}};B.a.Ba&&B.a.setPrototypeOf(we,B.T.fn);var me=B.ta.Ma="__ko_proto__";we[me]=B.ta,B.O=function(te){if((te=typeof te=="function"&&te[me])&&te!==we[me]&&te!==B.o.fn[me])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!te},B.Za=function(te){return typeof te=="function"&&(te[me]===we[me]||te[me]===B.o.fn[me]&&te.Nc)},B.b("observable",B.ta),B.b("isObservable",B.O),B.b("isWriteableObservable",B.Za),B.b("isWritableObservable",B.Za),B.b("observable.fn",we),B.L(we,"peek",we.v),B.L(we,"valueHasMutated",we.xa),B.L(we,"valueWillMutate",we.ya),B.Ha=function(te){if(te=te||[],typeof te!="object"||!("length"in te))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return te=B.ta(te),B.a.Ab(te,B.Ha.fn),te.extend({trackArrayChanges:!0})},B.Ha.fn={remove:function(te){for(var le=this.v(),ye=[],xe=typeof te!="function"||B.O(te)?function(We){return We===te}:te,Re=0;Re<le.length;Re++){var Oe=le[Re];if(xe(Oe)){if(ye.length===0&&this.ya(),le[Re]!==Oe)throw Error("Array modified during remove; cannot remove item");ye.push(Oe),le.splice(Re,1),Re--}}return ye.length&&this.xa(),ye},removeAll:function(te){if(te===t){var le=this.v(),ye=le.slice(0);return this.ya(),le.splice(0,le.length),this.xa(),ye}return te?this.remove(function(xe){return 0<=B.a.A(te,xe)}):[]},destroy:function(te){var le=this.v(),ye=typeof te!="function"||B.O(te)?function(Oe){return Oe===te}:te;this.ya();for(var xe=le.length-1;0<=xe;xe--){var Re=le[xe];ye(Re)&&(Re._destroy=!0)}this.xa()},destroyAll:function(te){return te===t?this.destroy(function(){return!0}):te?this.destroy(function(le){return 0<=B.a.A(te,le)}):[]},indexOf:function(te){var le=this();return B.a.A(le,te)},replace:function(te,le){var ye=this.indexOf(te);0<=ye&&(this.ya(),this.v()[ye]=le,this.xa())},sorted:function(te){var le=this().slice(0);return te?le.sort(te):le.sort()},reversed:function(){return this().slice(0).reverse()}},B.a.Ba&&B.a.setPrototypeOf(B.Ha.fn,B.ta.fn),B.a.D("pop push reverse shift sort splice unshift".split(" "),function(te){B.Ha.fn[te]=function(){var le=this.v();this.ya(),this.zc(le,te,arguments);var ye=le[te].apply(le,arguments);return this.xa(),ye===le?this:ye}}),B.a.D(["slice"],function(te){B.Ha.fn[te]=function(){var le=this();return le[te].apply(le,arguments)}}),B.Pc=function(te){return B.O(te)&&typeof te.remove=="function"&&typeof te.push=="function"},B.b("observableArray",B.Ha),B.b("isObservableArray",B.Pc),B.Ta.trackArrayChanges=function(te,le){function ye(){function nt(){if(Ve){var vt=[].concat(te.v()||[]),be;te.Wa("arrayChange")&&((!Re||1<Ve)&&(Re=B.a.Pb(Qe,vt,te.Ob)),be=Re),Qe=vt,Re=null,Ve=0,be&&be.length&&te.notifySubscribers(be,"arrayChange")}}xe?nt():(xe=!0,We=te.subscribe(function(){++Ve},null,"spectate"),Qe=[].concat(te.v()||[]),Re=null,Oe=te.subscribe(nt))}if(te.Ob={},le&&typeof le=="object"&&B.a.extend(te.Ob,le),te.Ob.sparse=!0,!te.zc){var xe=!1,Re=null,Oe,We,Ve=0,Qe,Se=te.Qa,Ke=te.hb;te.Qa=function(nt){Se&&Se.call(te,nt),nt==="arrayChange"&&ye()},te.hb=function(nt){Ke&&Ke.call(te,nt),nt!=="arrayChange"||te.Wa("arrayChange")||(Oe&&Oe.s(),We&&We.s(),We=Oe=null,xe=!1,Qe=t)},te.zc=function(nt,vt,be){function At(_i,fi,Gi){return ut[ut.length]={status:_i,value:fi,index:Gi}}if(xe&&!Ve){var ut=[],Nt=nt.length,Gt=be.length,Qt=0;switch(vt){case"push":Qt=Nt;case"unshift":for(vt=0;vt<Gt;vt++)At("added",be[vt],Qt+vt);break;case"pop":Qt=Nt-1;case"shift":Nt&&At("deleted",nt[Qt],Qt);break;case"splice":vt=Math.min(Math.max(0,0>be[0]?Nt+be[0]:be[0]),Nt);for(var Nt=Gt===1?Nt:Math.min(vt+(be[1]||0),Nt),Gt=vt+Gt-2,Qt=Math.max(Nt,Gt),Ct=[],Ft=[],Xt=2;vt<Qt;++vt,++Xt)vt<Nt&&Ft.push(At("deleted",nt[vt],vt)),vt<Gt&&Ct.push(At("added",be[Xt],vt));B.a.Kc(Ft,Ct);break;default:return}Re=ut}}}};var De=B.a.Da("_state");B.o=B.$=function(te,le,ye){function xe(){if(0<arguments.length){if(typeof Re=="function")Re.apply(Oe.nb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}return Oe.ra||B.u.cc(xe),(Oe.ka||Oe.J&&xe.Xa())&&xe.ha(),Oe.X}if(typeof te=="object"?ye=te:(ye=ye||{},te&&(ye.read=te)),typeof ye.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var Re=ye.write,Oe={X:t,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:ye.read,nb:le||ye.owner,l:ye.disposeWhenNodeIsRemoved||ye.l||null,Sa:ye.disposeWhen||ye.Sa,Rb:null,I:{},V:0,Ic:null};return xe[De]=Oe,xe.Nc=typeof Re=="function",B.a.Ba||B.a.extend(xe,B.T.fn),B.T.fn.qb(xe),B.a.Ab(xe,Je),ye.pure?(Oe.wb=!0,Oe.J=!0,B.a.extend(xe,Fe)):ye.deferEvaluation&&B.a.extend(xe,Ge),B.options.deferUpdates&&B.Ta.deferred(xe,!0),Oe.l&&(Oe.jc=!0,Oe.l.nodeType||(Oe.l=null)),Oe.J||ye.deferEvaluation||xe.ha(),Oe.l&&xe.ja()&&B.a.K.za(Oe.l,Oe.Rb=function(){xe.s()}),xe};var Je={equalityComparer:R,qa:function(){return this[De].V},Va:function(){var te=[];return B.a.P(this[De].I,function(le,ye){te[ye.Ka]=ye.da}),te},Vb:function(te){if(!this[De].V)return!1;var le=this.Va();return B.a.A(le,te)!==-1?!0:!!B.a.Lb(le,function(ye){return ye.Vb&&ye.Vb(te)})},uc:function(te,le,ye){if(this[De].wb&&le===this)throw Error("A 'pure' computed must not be called recursively");this[De].I[te]=ye,ye.Ka=this[De].V++,ye.La=le.ob()},Xa:function(){var te,le,ye=this[De].I;for(te in ye)if(Object.prototype.hasOwnProperty.call(ye,te)&&(le=ye[te],this.Ia&&le.da.Ja||le.da.Dd(le.La)))return!0},Jd:function(){this.Ia&&!this[De].rb&&this.Ia(!1)},ja:function(){var te=this[De];return te.ka||0<te.V},Rd:function(){this.Ja?this[De].ka&&(this[De].sa=!0):this.Hc()},$c:function(te){if(te.Hb){var le=te.subscribe(this.Jd,this,"dirty"),ye=te.subscribe(this.Rd,this);return{da:te,s:function(){le.s(),ye.s()}}}return te.subscribe(this.Hc,this)},Hc:function(){var te=this,le=te.throttleEvaluation;le&&0<=le?(clearTimeout(this[De].Ic),this[De].Ic=B.a.setTimeout(function(){te.ha(!0)},le)):te.Ia?te.Ia(!0):te.ha(!0)},ha:function(te){var le=this[De],ye=le.Sa,xe=!1;if(!le.rb&&!le.ra){if(le.l&&!B.a.Sb(le.l)||ye&&ye()){if(!le.jc){this.s();return}}else le.jc=!1;le.rb=!0;try{xe=this.zd(te)}finally{le.rb=!1}return xe}},zd:function(te){var le=this[De],xe=!1,ye=le.wb?t:!le.V,xe={qd:this,mb:le.I,Qb:le.V};B.u.xc({pd:xe,od:Y,o:this,Ya:ye}),le.I={},le.V=0;var Re=this.yd(le,xe);return le.V?xe=this.sb(le.X,Re):(this.s(),xe=!0),xe&&(le.J?this.Gb():this.notifySubscribers(le.X,"beforeChange"),le.X=Re,this.notifySubscribers(le.X,"spectate"),!le.J&&te&&this.notifySubscribers(le.X),this.rc&&this.rc()),ye&&this.notifySubscribers(le.X,"awake"),xe},yd:function(te,le){try{var ye=te.Wc;return te.nb?ye.call(te.nb):ye()}finally{B.u.end(),le.Qb&&!te.J&&B.a.P(le.mb,J),te.sa=te.ka=!1}},v:function(te){var le=this[De];return(le.ka&&(te||!le.V)||le.J&&this.Xa())&&this.ha(),le.X},ub:function(te){B.T.fn.ub.call(this,te),this.nc=function(){return this[De].J||(this[De].sa?this.ha():this[De].ka=!1),this[De].X},this.Ia=function(le){this.pc(this[De].X),this[De].ka=!0,le&&(this[De].sa=!0),this.qc(this,!le)}},s:function(){var te=this[De];!te.J&&te.I&&B.a.P(te.I,function(le,ye){ye.s&&ye.s()}),te.l&&te.Rb&&B.a.K.yb(te.l,te.Rb),te.I=t,te.V=0,te.ra=!0,te.sa=!1,te.ka=!1,te.J=!1,te.l=t,te.Sa=t,te.Wc=t,this.Nc||(te.nb=t)}},Fe={Qa:function(te){var le=this,ye=le[De];if(!ye.ra&&ye.J&&te=="change"){if(ye.J=!1,ye.sa||le.Xa())ye.I=null,ye.V=0,le.ha()&&le.Gb();else{var xe=[];B.a.P(ye.I,function(Re,Oe){xe[Oe.Ka]=Re}),B.a.D(xe,function(Re,Oe){var We=ye.I[Re],Ve=le.$c(We.da);Ve.Ka=Oe,Ve.La=We.La,ye.I[Re]=Ve}),le.Xa()&&le.ha()&&le.Gb()}ye.ra||le.notifySubscribers(ye.X,"awake")}},hb:function(te){var le=this[De];le.ra||te!="change"||this.Wa("change")||(B.a.P(le.I,function(ye,xe){xe.s&&(le.I[ye]={da:xe.da,Ka:xe.Ka,La:xe.La},xe.s())}),le.J=!0,this.notifySubscribers(t,"asleep"))},ob:function(){var te=this[De];return te.J&&(te.sa||this.Xa())&&this.ha(),B.T.fn.ob.call(this)}},Ge={Qa:function(te){te!="change"&&te!="beforeChange"||this.v()}};B.a.Ba&&B.a.setPrototypeOf(Je,B.T.fn);var Et=B.ta.Ma;Je[Et]=B.o,B.Oc=function(te){return typeof te=="function"&&te[Et]===Je[Et]},B.Fd=function(te){return B.Oc(te)&&te[De]&&te[De].wb},B.b("computed",B.o),B.b("dependentObservable",B.o),B.b("isComputed",B.Oc),B.b("isPureComputed",B.Fd),B.b("computed.fn",Je),B.L(Je,"peek",Je.v),B.L(Je,"dispose",Je.s),B.L(Je,"isActive",Je.ja),B.L(Je,"getDependenciesCount",Je.qa),B.L(Je,"getDependencies",Je.Va),B.xb=function(te,le){return typeof te=="function"?B.o(te,le,{pure:!0}):(te=B.a.extend({},te),te.pure=!0,B.o(te,le))},B.b("pureComputed",B.xb),function(){function te(xe,Re,Oe){if(Oe=Oe||new ye,xe=Re(xe),typeof xe!="object"||xe===null||xe===t||xe instanceof RegExp||xe instanceof Date||xe instanceof String||xe instanceof Number||xe instanceof Boolean)return xe;var We=xe instanceof Array?[]:{};return Oe.save(xe,We),le(xe,function(Ve){var Qe=Re(xe[Ve]);switch(typeof Qe){case"boolean":case"number":case"string":case"function":We[Ve]=Qe;break;case"object":case"undefined":var Se=Oe.get(Qe);We[Ve]=Se!==t?Se:te(Qe,Re,Oe)}}),We}function le(xe,Re){if(xe instanceof Array){for(var Oe=0;Oe<xe.length;Oe++)Re(Oe);typeof xe.toJSON=="function"&&Re("toJSON")}else for(Oe in xe)Re(Oe)}function ye(){this.keys=[],this.values=[]}B.ad=function(xe){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return te(xe,function(Re){for(var Oe=0;B.O(Re)&&10>Oe;Oe++)Re=Re();return Re})},B.toJSON=function(xe,Re,Oe){return xe=B.ad(xe),B.a.hc(xe,Re,Oe)},ye.prototype={constructor:ye,save:function(xe,Re){var Oe=B.a.A(this.keys,xe);0<=Oe?this.values[Oe]=Re:(this.keys.push(xe),this.values.push(Re))},get:function(xe){return xe=B.a.A(this.keys,xe),0<=xe?this.values[xe]:t}}}(),B.b("toJS",B.ad),B.b("toJSON",B.toJSON),B.Wd=function(te,le,ye){function xe(Re){var Oe=B.xb(te,ye).extend({ma:"always"}),We=Oe.subscribe(function(Ve){Ve&&(We.s(),Re(Ve))});return Oe.notifySubscribers(Oe.v()),We}return typeof Promise!="function"||le?xe(le.bind(ye)):new Promise(xe)},B.b("when",B.Wd),function(){B.w={M:function(te){switch(B.a.R(te)){case"option":return te.__ko__hasDomDataOptionValue__===!0?B.a.g.get(te,B.c.options.$b):7>=B.a.W?te.getAttributeNode("value")&&te.getAttributeNode("value").specified?te.value:te.text:te.value;case"select":return 0<=te.selectedIndex?B.w.M(te.options[te.selectedIndex]):t;default:return te.value}},cb:function(te,le,ye){switch(B.a.R(te)){case"option":typeof le=="string"?(B.a.g.set(te,B.c.options.$b,t),"__ko__hasDomDataOptionValue__"in te&&delete te.__ko__hasDomDataOptionValue__,te.value=le):(B.a.g.set(te,B.c.options.$b,le),te.__ko__hasDomDataOptionValue__=!0,te.value=typeof le=="number"?le:"");break;case"select":(le===""||le===null)&&(le=t);for(var xe=-1,Re=0,Oe=te.options.length,We;Re<Oe;++Re)if(We=B.w.M(te.options[Re]),We==le||We===""&&le===t){xe=Re;break}(ye||0<=xe||le===t&&1<te.size)&&(te.selectedIndex=xe,B.a.W===6&&B.a.setTimeout(function(){te.selectedIndex=xe},0));break;default:(le===null||le===t)&&(le=""),te.value=le}}}}(),B.b("selectExtensions",B.w),B.b("selectExtensions.readValue",B.w.M),B.b("selectExtensions.writeValue",B.w.cb),B.m=function(){function te(Ve){Ve=B.a.Db(Ve),Ve.charCodeAt(0)===123&&(Ve=Ve.slice(1,-1)),Ve+=`
  5001. ,`;var Qe=[],Se=Ve.match(xe),Ke,nt=[],vt=0;if(1<Se.length){for(var be=0,At;At=Se[be];++be){var ut=At.charCodeAt(0);if(ut===44){if(0>=vt){Qe.push(Ke&&nt.length?{key:Ke,value:nt.join("")}:{unknown:Ke||nt.join("")}),Ke=vt=0,nt=[];continue}}else if(ut===58){if(!vt&&!Ke&&nt.length===1){Ke=nt.pop();continue}}else{if(ut===47&&1<At.length&&(At.charCodeAt(1)===47||At.charCodeAt(1)===42))continue;ut===47&&be&&1<At.length?(ut=Se[be-1].match(Re))&&!Oe[ut[0]]&&(Ve=Ve.substr(Ve.indexOf(At)+1),Se=Ve.match(xe),be=-1,At="/"):ut===40||ut===123||ut===91?++vt:ut===41||ut===125||ut===93?--vt:Ke||nt.length||ut!==34&&ut!==39||(At=At.slice(1,-1))}nt.push(At)}if(0<vt)throw Error("Unbalanced parentheses, braces, or brackets")}return Qe}var le=["true","false","null","undefined"],ye=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,xe=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
  5002. |/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),Re=/[\])"'A-Za-z0-9_$]+$/,Oe={in:1,return:1,typeof:1},We={};return{Ra:[],wa:We,ac:te,vb:function(Ve,Qe){function Se(ut,Nt){var Gt;if(!be){var Qt=B.getBindingHandler(ut);if(Qt&&Qt.preprocess&&!(Nt=Qt.preprocess(Nt,ut,Se)))return;(Qt=We[ut])&&(Gt=Nt,0<=B.a.A(le,Gt)?Gt=!1:(Qt=Gt.match(ye),Gt=Qt===null?!1:Qt[1]?"Object("+Qt[1]+")"+Qt[2]:Gt),Qt=Gt),Qt&&nt.push("'"+(typeof We[ut]=="string"?We[ut]:ut)+"':function(_z){"+Gt+"=_z}")}vt&&(Nt="function(){return "+Nt+" }"),Ke.push("'"+ut+"':"+Nt)}Qe=Qe||{};var Ke=[],nt=[],vt=Qe.valueAccessors,be=Qe.bindingParams,At=typeof Ve=="string"?te(Ve):Ve;return B.a.D(At,function(ut){Se(ut.key||ut.unknown,ut.value)}),nt.length&&Se("_ko_property_writers","{"+nt.join(",")+" }"),Ke.join(",")},Id:function(Ve,Qe){for(var Se=0;Se<Ve.length;Se++)if(Ve[Se].key==Qe)return!0;return!1},eb:function(Ve,Qe,Se,Ke,nt){Ve&&B.O(Ve)?!B.Za(Ve)||nt&&Ve.v()===Ke||Ve(Ke):(Ve=Qe.get("_ko_property_writers"))&&Ve[Se]&&Ve[Se](Ke)}}}(),B.b("expressionRewriting",B.m),B.b("expressionRewriting.bindingRewriteValidators",B.m.Ra),B.b("expressionRewriting.parseObjectLiteral",B.m.ac),B.b("expressionRewriting.preProcessBindings",B.m.vb),B.b("expressionRewriting._twoWayBindings",B.m.wa),B.b("jsonExpressionRewriting",B.m),B.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",B.m.vb),function(){function te(Se){return Se.nodeType==8&&Oe.test(Re?Se.text:Se.nodeValue)}function le(Se){return Se.nodeType==8&&We.test(Re?Se.text:Se.nodeValue)}function ye(Se,Ke){for(var nt=Se,vt=1,be=[];nt=nt.nextSibling;){if(le(nt)&&(B.a.g.set(nt,Qe,!0),vt--,vt===0))return be;be.push(nt),te(nt)&&vt++}if(!Ke)throw Error("Cannot find closing comment tag to match: "+Se.nodeValue);return null}function xe(Se,Ke){var nt=ye(Se,Ke);return nt?0<nt.length?nt[nt.length-1].nextSibling:Se.nextSibling:null}var Re=c&&c.createComment("test").text==="<!--test-->",Oe=Re?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,We=Re?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,Ve={ul:!0,ol:!0},Qe="__ko_matchedEndComment__";B.h={ea:{},childNodes:function(Se){return te(Se)?ye(Se):Se.childNodes},Ea:function(Se){if(te(Se)){Se=B.h.childNodes(Se);for(var Ke=0,nt=Se.length;Ke<nt;Ke++)B.removeNode(Se[Ke])}else B.a.Tb(Se)},va:function(Se,Ke){if(te(Se)){B.h.Ea(Se);for(var nt=Se.nextSibling,vt=0,be=Ke.length;vt<be;vt++)nt.parentNode.insertBefore(Ke[vt],nt)}else B.a.va(Se,Ke)},Vc:function(Se,Ke){var nt;te(Se)?(nt=Se.nextSibling,Se=Se.parentNode):nt=Se.firstChild,nt?Ke!==nt&&Se.insertBefore(Ke,nt):Se.appendChild(Ke)},Wb:function(Se,Ke,nt){nt?(nt=nt.nextSibling,te(Se)&&(Se=Se.parentNode),nt?Ke!==nt&&Se.insertBefore(Ke,nt):Se.appendChild(Ke)):B.h.Vc(Se,Ke)},firstChild:function(Se){if(te(Se))return!Se.nextSibling||le(Se.nextSibling)?null:Se.nextSibling;if(Se.firstChild&&le(Se.firstChild))throw Error("Found invalid end comment, as the first child of "+Se);return Se.firstChild},nextSibling:function(Se){if(te(Se)&&(Se=xe(Se)),Se.nextSibling&&le(Se.nextSibling)){var Ke=Se.nextSibling;if(le(Ke)&&!B.a.g.get(Ke,Qe))throw Error("Found end comment without a matching opening comment, as child of "+Se);return null}return Se.nextSibling},Cd:te,Vd:function(Se){return(Se=(Re?Se.text:Se.nodeValue).match(Oe))?Se[1]:null},Sc:function(Se){if(Ve[B.a.R(Se)]){var Ke=Se.firstChild;if(Ke)do if(Ke.nodeType===1){var nt;nt=Ke.firstChild;var vt=null;if(nt)do if(vt)vt.push(nt);else if(te(nt)){var be=xe(nt,!0);be?nt=be:vt=[nt]}else le(nt)&&(vt=[nt]);while(nt=nt.nextSibling);if(nt=vt)for(vt=Ke.nextSibling,be=0;be<nt.length;be++)vt?Se.insertBefore(nt[be],vt):Se.appendChild(nt[be])}while(Ke=Ke.nextSibling)}}}}(),B.b("virtualElements",B.h),B.b("virtualElements.allowedBindings",B.h.ea),B.b("virtualElements.emptyNode",B.h.Ea),B.b("virtualElements.insertAfter",B.h.Wb),B.b("virtualElements.prepend",B.h.Vc),B.b("virtualElements.setDomNodeChildren",B.h.va),function(){B.ga=function(){this.nd={}},B.a.extend(B.ga.prototype,{nodeHasBindings:function(te){switch(te.nodeType){case 1:return te.getAttribute("data-bind")!=null||B.j.getComponentNameForNode(te);case 8:return B.h.Cd(te);default:return!1}},getBindings:function(te,le){var ye=this.getBindingsString(te,le),ye=ye?this.parseBindingsString(ye,le,te):null;return B.j.tc(ye,te,le,!1)},getBindingAccessors:function(te,le){var ye=this.getBindingsString(te,le),ye=ye?this.parseBindingsString(ye,le,te,{valueAccessors:!0}):null;return B.j.tc(ye,te,le,!0)},getBindingsString:function(te){switch(te.nodeType){case 1:return te.getAttribute("data-bind");case 8:return B.h.Vd(te);default:return null}},parseBindingsString:function(te,le,ye,xe){try{var Re=this.nd,Oe=te+(xe&&xe.valueAccessors||""),We;if(!(We=Re[Oe])){var Ve,Qe="with($context){with($data||{}){return{"+B.m.vb(te,xe)+"}}}";Ve=new Function("$context","$element",Qe),We=Re[Oe]=Ve}return We(le,ye)}catch(Se){throw Se.message=`Unable to parse bindings.
  5003. Bindings value: `+te+`
  5004. Message: `+Se.message,Se}}}),B.ga.instance=new B.ga}(),B.b("bindingProvider",B.ga),function(){function te(Qt){var Ct=(Qt=B.a.g.get(Qt,Gt))&&Qt.N;Ct&&(Qt.N=null,Ct.Tc())}function le(Qt,Ct,Ft){this.node=Qt,this.yc=Ct,this.kb=[],this.H=!1,Ct.N||B.a.K.za(Qt,te),Ft&&Ft.N&&(Ft.N.kb.push(Qt),this.Kb=Ft)}function ye(Qt){return function(){return Qt}}function xe(Qt){return Qt()}function Re(Qt){return B.a.Ga(B.u.G(Qt),function(Ct,Ft){return function(){return Qt()[Ft]}})}function Oe(Qt,Ct,Ft){return typeof Qt=="function"?Re(Qt.bind(null,Ct,Ft)):B.a.Ga(Qt,ye)}function We(Qt,Ct){return Re(this.getBindings.bind(this,Qt,Ct))}function Ve(Qt,Ct){var Ft=B.h.firstChild(Ct);if(Ft){var Xt,_i=B.ga.instance,fi=_i.preprocessNode;if(fi){for(;Xt=Ft;)Ft=B.h.nextSibling(Xt),fi.call(_i,Xt);Ft=B.h.firstChild(Ct)}for(;Xt=Ft;)Ft=B.h.nextSibling(Xt),Qe(Qt,Xt)}B.i.ma(Ct,B.i.H)}function Qe(Qt,Ct){var Ft=Qt,Xt=Ct.nodeType===1;Xt&&B.h.Sc(Ct),(Xt||B.ga.instance.nodeHasBindings(Ct))&&(Ft=Ke(Ct,null,Qt).bindingContextForDescendants),Ft&&!ut[B.a.R(Ct)]&&Ve(Ft,Ct)}function Se(Qt){var Ct=[],Ft={},Xt=[];return B.a.P(Qt,function _i(fi){if(!Ft[fi]){var Gi=B.getBindingHandler(fi);Gi&&(Gi.after&&(Xt.push(fi),B.a.D(Gi.after,function(wn){if(Qt[wn]){if(B.a.A(Xt,wn)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Xt.join(", "));_i(wn)}}),Xt.length--),Ct.push({key:fi,Mc:Gi})),Ft[fi]=!0}}),Ct}function Ke(Qt,Ct,Ft){var Xt=B.a.g.Ub(Qt,Gt,{}),_i=Xt.hd;if(!Ct){if(_i)throw Error("You cannot apply bindings multiple times to the same element.");Xt.hd=!0}_i||(Xt.context=Ft),Xt.Zb||(Xt.Zb={});var fi;if(Ct&&typeof Ct!="function")fi=Ct;else{var Gi=B.ga.instance,wn=Gi.getBindingAccessors||We,zi=B.$(function(){return(fi=Ct?Ct(Ft,Qt):wn.call(Gi,Qt,Ft))&&(Ft[vt]&&Ft[vt](),Ft[At]&&Ft[At]()),fi},null,{l:Qt});fi&&zi.ja()||(zi=null)}var Gn=Ft,kn;if(fi){var yt=function(){return B.a.Ga(zi?zi():fi,xe)},rt=zi?function(ti){return function(){return xe(zi()[ti])}}:function(ti){return fi[ti]};yt.get=function(ti){return fi[ti]&&xe(rt(ti))},yt.has=function(ti){return ti in fi},B.i.H in fi&&B.i.subscribe(Qt,B.i.H,function(){var ti=(0,fi[B.i.H])();if(ti){var Ni=B.h.childNodes(Qt);Ni.length&&ti(Ni,B.Ec(Ni[0]))}}),B.i.pa in fi&&(Gn=B.i.Cb(Qt,Ft),B.i.subscribe(Qt,B.i.pa,function(){var ti=(0,fi[B.i.pa])();ti&&B.h.firstChild(Qt)&&ti(Qt)})),Xt=Se(fi),B.a.D(Xt,function(ti){var Ni=ti.Mc.init,qi=ti.Mc.update,en=ti.key;if(Qt.nodeType===8&&!B.h.ea[en])throw Error("The binding '"+en+"' cannot be used with virtual elements");try{typeof Ni=="function"&&B.u.G(function(){var $t=Ni(Qt,rt(en),yt,Gn.$data,Gn);if($t&&$t.controlsDescendantBindings){if(kn!==t)throw Error("Multiple bindings ("+kn+" and "+en+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");kn=en}}),typeof qi=="function"&&B.$(function(){qi(Qt,rt(en),yt,Gn.$data,Gn)},null,{l:Qt})}catch($t){throw $t.message='Unable to process binding "'+en+": "+fi[en]+`"
  5005. Message: `+$t.message,$t}})}return Xt=kn===t,{shouldBindDescendants:Xt,bindingContextForDescendants:Xt&&Gn}}function nt(Qt,Ct){return Qt&&Qt instanceof B.fa?Qt:new B.fa(Qt,t,t,Ct)}var vt=B.a.Da("_subscribable"),be=B.a.Da("_ancestorBindingInfo"),At=B.a.Da("_dataDependency");B.c={};var ut={script:!0,textarea:!0,template:!0};B.getBindingHandler=function(Qt){return B.c[Qt]};var Nt={};B.fa=function(Qt,Ct,Ft,Xt,_i){function fi(){var rt=Gn?zi():zi,ti=B.a.f(rt);return Ct?(B.a.extend(Gi,Ct),be in Ct&&(Gi[be]=Ct[be])):(Gi.$parents=[],Gi.$root=ti,Gi.ko=B),Gi[vt]=kn,wn?ti=Gi.$data:(Gi.$rawData=rt,Gi.$data=ti),Ft&&(Gi[Ft]=ti),Xt&&Xt(Gi,Ct,ti),Ct&&Ct[vt]&&!B.S.o().Vb(Ct[vt])&&Ct[vt](),yt&&(Gi[At]=yt),Gi.$data}var Gi=this,wn=Qt===Nt,zi=wn?t:Qt,Gn=typeof zi=="function"&&!B.O(zi),kn,yt=_i&&_i.dataDependency;_i&&_i.exportDependencies?fi():(kn=B.xb(fi),kn.v(),kn.ja()?kn.equalityComparer=null:Gi[vt]=t)},B.fa.prototype.createChildContext=function(Qt,Ct,Ft,Xt){if(!Xt&&Ct&&typeof Ct=="object"&&(Xt=Ct,Ct=Xt.as,Ft=Xt.extend),Ct&&Xt&&Xt.noChildContext){var _i=typeof Qt=="function"&&!B.O(Qt);return new B.fa(Nt,this,null,function(fi){Ft&&Ft(fi),fi[Ct]=_i?Qt():Qt},Xt)}return new B.fa(Qt,this,Ct,function(fi,Gi){fi.$parentContext=Gi,fi.$parent=Gi.$data,fi.$parents=(Gi.$parents||[]).slice(0),fi.$parents.unshift(fi.$parent),Ft&&Ft(fi)},Xt)},B.fa.prototype.extend=function(Qt,Ct){return new B.fa(Nt,this,null,function(Ft){B.a.extend(Ft,typeof Qt=="function"?Qt(Ft):Qt)},Ct)};var Gt=B.a.g.Z();le.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},le.prototype.sd=function(Qt){B.a.Pa(this.kb,Qt),!this.kb.length&&this.H&&this.Cc()},le.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,B.a.K.yb(this.node,te),B.i.ma(this.node,B.i.pa),this.Tc())},B.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(Qt,Ct,Ft,Xt,_i){var fi=B.a.g.Ub(Qt,Gt,{});return fi.Fa||(fi.Fa=new B.T),_i&&_i.notifyImmediately&&fi.Zb[Ct]&&B.u.G(Ft,Xt,[Qt]),fi.Fa.subscribe(Ft,Xt,Ct)},ma:function(Qt,Ct){var Ft=B.a.g.get(Qt,Gt);if(Ft&&(Ft.Zb[Ct]=!0,Ft.Fa&&Ft.Fa.notifySubscribers(Qt,Ct),Ct==B.i.H)){if(Ft.N)Ft.N.Cc();else if(Ft.N===t&&Ft.Fa&&Ft.Fa.Wa(B.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(Qt,Ct){var Ft=B.a.g.Ub(Qt,Gt,{});return Ft.N||(Ft.N=new le(Qt,Ft,Ct[be])),Ct[be]==Ft?Ct:Ct.extend(function(Xt){Xt[be]=Ft})}},B.Td=function(Qt){return(Qt=B.a.g.get(Qt,Gt))&&Qt.context},B.ib=function(Qt,Ct,Ft){return Qt.nodeType===1&&B.h.Sc(Qt),Ke(Qt,Ct,nt(Ft))},B.ld=function(Qt,Ct,Ft){return Ft=nt(Ft),B.ib(Qt,Oe(Ct,Ft,Qt),Ft)},B.Oa=function(Qt,Ct){Ct.nodeType!==1&&Ct.nodeType!==8||Ve(nt(Qt),Ct)},B.vc=function(Qt,Ct,Ft){if(!y&&r.jQuery&&(y=r.jQuery),2>arguments.length){if(Ct=c.body,!Ct)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!Ct||Ct.nodeType!==1&&Ct.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");Qe(nt(Qt,Ft),Ct)},B.Dc=function(Qt){return!Qt||Qt.nodeType!==1&&Qt.nodeType!==8?t:B.Td(Qt)},B.Ec=function(Qt){return(Qt=B.Dc(Qt))?Qt.$data:t},B.b("bindingHandlers",B.c),B.b("bindingEvent",B.i),B.b("bindingEvent.subscribe",B.i.subscribe),B.b("bindingEvent.startPossiblyAsyncContentBinding",B.i.Cb),B.b("applyBindings",B.vc),B.b("applyBindingsToDescendants",B.Oa),B.b("applyBindingAccessorsToNode",B.ib),B.b("applyBindingsToNode",B.ld),B.b("contextFor",B.Dc),B.b("dataFor",B.Ec)}(),function(te){function le(We,Ve){var Qe=Object.prototype.hasOwnProperty.call(Re,We)?Re[We]:te,Se;Qe?Qe.subscribe(Ve):(Qe=Re[We]=new B.T,Qe.subscribe(Ve),ye(We,function(Ke,nt){var vt=!(!nt||!nt.synchronous);Oe[We]={definition:Ke,Gd:vt},delete Re[We],Se||vt?Qe.notifySubscribers(Ke):B.na.zb(function(){Qe.notifySubscribers(Ke)})}),Se=!0)}function ye(We,Ve){xe("getConfig",[We],function(Qe){Qe?xe("loadComponent",[We,Qe],function(Se){Ve(Se,Qe)}):Ve(null,null)})}function xe(We,Ve,Qe,Se){Se||(Se=B.j.loaders.slice(0));var Ke=Se.shift();if(Ke){var nt=Ke[We];if(nt){var vt=!1;if(nt.apply(Ke,Ve.concat(function(be){vt?Qe(null):be!==null?Qe(be):xe(We,Ve,Qe,Se)}))!==te&&(vt=!0,!Ke.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else xe(We,Ve,Qe,Se)}else Qe(null)}var Re={},Oe={};B.j={get:function(We,Ve){var Qe=Object.prototype.hasOwnProperty.call(Oe,We)?Oe[We]:te;Qe?Qe.Gd?B.u.G(function(){Ve(Qe.definition)}):B.na.zb(function(){Ve(Qe.definition)}):le(We,Ve)},Bc:function(We){delete Oe[We]},oc:xe},B.j.loaders=[],B.b("components",B.j),B.b("components.get",B.j.get),B.b("components.clearCachedDefinition",B.j.Bc)}(),function(){function te(Qe,Se,Ke,nt){function vt(){--At===0&&nt(be)}var be={},At=2,ut=Ke.template;Ke=Ke.viewModel,ut?Re(Se,ut,function(Nt){B.j.oc("loadTemplate",[Qe,Nt],function(Gt){be.template=Gt,vt()})}):vt(),Ke?Re(Se,Ke,function(Nt){B.j.oc("loadViewModel",[Qe,Nt],function(Gt){be[Ve]=Gt,vt()})}):vt()}function le(Qe,Se,Ke){if(typeof Se=="function")Ke(function(vt){return new Se(vt)});else if(typeof Se[Ve]=="function")Ke(Se[Ve]);else if("instance"in Se){var nt=Se.instance;Ke(function(){return nt})}else"viewModel"in Se?le(Qe,Se.viewModel,Ke):Qe("Unknown viewModel value: "+Se)}function ye(Qe){switch(B.a.R(Qe)){case"script":return B.a.ua(Qe.text);case"textarea":return B.a.ua(Qe.value);case"template":if(xe(Qe.content))return B.a.Ca(Qe.content.childNodes)}return B.a.Ca(Qe.childNodes)}function xe(Qe){return r.DocumentFragment?Qe instanceof DocumentFragment:Qe&&Qe.nodeType===11}function Re(Qe,Se,Ke){typeof Se.require=="string"?D||r.require?(D||r.require)([Se.require],function(nt){nt&&typeof nt=="object"&&nt.Xd&&nt.default&&(nt=nt.default),Ke(nt)}):Qe("Uses require, but no AMD loader is present"):Ke(Se)}function Oe(Qe){return function(Se){throw Error("Component '"+Qe+"': "+Se)}}var We={};B.j.register=function(Qe,Se){if(!Se)throw Error("Invalid configuration for "+Qe);if(B.j.tb(Qe))throw Error("Component "+Qe+" is already registered");We[Qe]=Se},B.j.tb=function(Qe){return Object.prototype.hasOwnProperty.call(We,Qe)},B.j.unregister=function(Qe){delete We[Qe],B.j.Bc(Qe)},B.j.Fc={getConfig:function(Qe,Se){Se(B.j.tb(Qe)?We[Qe]:null)},loadComponent:function(Qe,Se,Ke){var nt=Oe(Qe);Re(nt,Se,function(vt){te(Qe,nt,vt,Ke)})},loadTemplate:function(Qe,Se,Ke){if(Qe=Oe(Qe),typeof Se=="string")Ke(B.a.ua(Se));else if(Se instanceof Array)Ke(Se);else if(xe(Se))Ke(B.a.la(Se.childNodes));else if(Se.element)if(Se=Se.element,r.HTMLElement?Se instanceof HTMLElement:Se&&Se.tagName&&Se.nodeType===1)Ke(ye(Se));else if(typeof Se=="string"){var nt=c.getElementById(Se);nt?Ke(ye(nt)):Qe("Cannot find element with ID "+Se)}else Qe("Unknown element type: "+Se);else Qe("Unknown template value: "+Se)},loadViewModel:function(Qe,Se,Ke){le(Oe(Qe),Se,Ke)}};var Ve="createViewModel";B.b("components.register",B.j.register),B.b("components.isRegistered",B.j.tb),B.b("components.unregister",B.j.unregister),B.b("components.defaultLoader",B.j.Fc),B.j.loaders.push(B.j.Fc),B.j.dd=We}(),function(){function te(ye,xe){var Re=ye.getAttribute("params");if(Re){var Re=le.parseBindingsString(Re,xe,ye,{valueAccessors:!0,bindingParams:!0}),Re=B.a.Ga(Re,function(Ve){return B.o(Ve,null,{l:ye})}),Oe=B.a.Ga(Re,function(Ve){var Qe=Ve.v();return Ve.ja()?B.o({read:function(){return B.a.f(Ve())},write:B.Za(Qe)&&function(Se){Ve()(Se)},l:ye}):Qe});return Object.prototype.hasOwnProperty.call(Oe,"$raw")||(Oe.$raw=Re),Oe}return{$raw:{}}}B.j.getComponentNameForNode=function(ye){var xe=B.a.R(ye);if(B.j.tb(xe)&&(xe.indexOf("-")!=-1||""+ye=="[object HTMLUnknownElement]"||8>=B.a.W&&ye.tagName===xe))return xe},B.j.tc=function(ye,xe,Re,Oe){if(xe.nodeType===1){var We=B.j.getComponentNameForNode(xe);if(We){if(ye=ye||{},ye.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var Ve={name:We,params:te(xe,Re)};ye.component=Oe?function(){return Ve}:Ve}}return ye};var le=new B.ga;9>B.a.W&&(B.j.register=function(ye){return function(xe){return ye.apply(this,arguments)}}(B.j.register),c.createDocumentFragment=function(ye){return function(){var xe=ye();return B.j.dd,xe}}(c.createDocumentFragment))}(),function(){function te(xe,Re,Oe){if(Re=Re.template,!Re)throw Error("Component '"+xe+"' has no template");xe=B.a.Ca(Re),B.h.va(Oe,xe)}function le(xe,Re,Oe){var We=xe.createViewModel;return We?We.call(xe,Re,Oe):Re}var ye=0;B.c.component={init:function(xe,Re,Oe,We,Ve){function Qe(){var be=Se&&Se.dispose;typeof be=="function"&&be.call(Se),nt&&nt.s(),Ke=Se=nt=null}var Se,Ke,nt,vt=B.a.la(B.h.childNodes(xe));return B.h.Ea(xe),B.a.K.za(xe,Qe),B.o(function(){var be=B.a.f(Re()),At,ut;if(typeof be=="string"?At=be:(At=B.a.f(be.name),ut=B.a.f(be.params)),!At)throw Error("No component name specified");var Nt=B.i.Cb(xe,Ve),Gt=Ke=++ye;B.j.get(At,function(Qt){if(Ke===Gt){if(Qe(),!Qt)throw Error("Unknown component '"+At+"'");te(At,Qt,xe);var Ct=le(Qt,ut,{element:xe,templateNodes:vt});Qt=Nt.createChildContext(Ct,{extend:function(Ft){Ft.$component=Ct,Ft.$componentTemplateNodes=vt}}),Ct&&Ct.koDescendantsComplete&&(nt=B.i.subscribe(xe,B.i.pa,Ct.koDescendantsComplete,Ct)),Se=Ct,B.Oa(Qt,xe)}})},null,{l:xe}),{controlsDescendantBindings:!0}}},B.h.ea.component=!0}();var li={class:"className",for:"htmlFor"};B.c.attr={update:function(te,le){var ye=B.a.f(le())||{};B.a.P(ye,function(xe,Re){Re=B.a.f(Re);var Oe=xe.indexOf(":"),Oe="lookupNamespaceURI"in te&&0<Oe&&te.lookupNamespaceURI(xe.substr(0,Oe)),We=Re===!1||Re===null||Re===t;We?Oe?te.removeAttributeNS(Oe,xe):te.removeAttribute(xe):Re=Re.toString(),8>=B.a.W&&xe in li?(xe=li[xe],We?te.removeAttribute(xe):te[xe]=Re):We||(Oe?te.setAttributeNS(Oe,xe,Re):te.setAttribute(xe,Re)),xe==="name"&&B.a.Yc(te,We?"":Re)})}},function(){B.c.checked={after:["value","attr"],init:function(te,le,ye){function xe(){var be=te.checked,At=Oe();if(!B.S.Ya()&&(be||!Ve&&!B.S.qa())){var ut=B.u.G(le);if(Se){var Nt=Ke?ut.v():ut,Gt=vt;vt=At,Gt!==At?be&&(B.a.Na(Nt,At,!0),B.a.Na(Nt,Gt,!1)):B.a.Na(Nt,At,be),Ke&&B.Za(ut)&&ut(Nt)}else We&&(At===t?At=be:be||(At=t)),B.m.eb(ut,ye,"checked",At,!0)}}function Re(){var be=B.a.f(le()),At=Oe();Se?(te.checked=0<=B.a.A(be,At),vt=At):te.checked=We&&At===t?!!be:Oe()===be}var Oe=B.xb(function(){if(ye.has("checkedValue"))return B.a.f(ye.get("checkedValue"));if(nt)return ye.has("value")?B.a.f(ye.get("value")):te.value}),We=te.type=="checkbox",Ve=te.type=="radio";if(We||Ve){var Qe=le(),Se=We&&B.a.f(Qe)instanceof Array,Ke=!(Se&&Qe.push&&Qe.splice),nt=Ve||Se,vt=Se?Oe():t;Ve&&!te.name&&B.c.uniqueName.init(te,function(){return!0}),B.o(xe,null,{l:te}),B.a.B(te,"click",xe),B.o(Re,null,{l:te}),Qe=t}}},B.m.wa.checked=!0,B.c.checkedValue={update:function(te,le){te.value=B.a.f(le())}}}(),B.c.class={update:function(te,le){var ye=B.a.Db(B.a.f(le()));B.a.Eb(te,te.__ko__cssValue,!1),te.__ko__cssValue=ye,B.a.Eb(te,ye,!0)}},B.c.css={update:function(te,le){var ye=B.a.f(le());ye!==null&&typeof ye=="object"?B.a.P(ye,function(xe,Re){Re=B.a.f(Re),B.a.Eb(te,xe,Re)}):B.c.class.update(te,le)}},B.c.enable={update:function(te,le){var ye=B.a.f(le());ye&&te.disabled?te.removeAttribute("disabled"):ye||te.disabled||(te.disabled=!0)}},B.c.disable={update:function(te,le){B.c.enable.update(te,function(){return!B.a.f(le())})}},B.c.event={init:function(te,le,ye,xe,Re){var Oe=le()||{};B.a.P(Oe,function(We){typeof We=="string"&&B.a.B(te,We,function(Ve){var Qe,Se=le()[We];if(Se){try{var Ke=B.a.la(arguments);xe=Re.$data,Ke.unshift(xe),Qe=Se.apply(xe,Ke)}finally{Qe!==!0&&(Ve.preventDefault?Ve.preventDefault():Ve.returnValue=!1)}ye.get(We+"Bubble")===!1&&(Ve.cancelBubble=!0,Ve.stopPropagation&&Ve.stopPropagation())}})})}},B.c.foreach={Rc:function(te){return function(){var le=te(),ye=B.a.bc(le);return!ye||typeof ye.length=="number"?{foreach:le,templateEngine:B.ba.Ma}:(B.a.f(le),{foreach:ye.data,as:ye.as,noChildContext:ye.noChildContext,includeDestroyed:ye.includeDestroyed,afterAdd:ye.afterAdd,beforeRemove:ye.beforeRemove,afterRender:ye.afterRender,beforeMove:ye.beforeMove,afterMove:ye.afterMove,templateEngine:B.ba.Ma})}},init:function(te,le){return B.c.template.init(te,B.c.foreach.Rc(le))},update:function(te,le,ye,xe,Re){return B.c.template.update(te,B.c.foreach.Rc(le),ye,xe,Re)}},B.m.Ra.foreach=!1,B.h.ea.foreach=!0,B.c.hasfocus={init:function(te,le,ye){function xe(We){te.__ko_hasfocusUpdating=!0;var Ve=te.ownerDocument;if("activeElement"in Ve){var Qe;try{Qe=Ve.activeElement}catch{Qe=Ve.body}We=Qe===te}Ve=le(),B.m.eb(Ve,ye,"hasfocus",We,!0),te.__ko_hasfocusLastValue=We,te.__ko_hasfocusUpdating=!1}var Re=xe.bind(null,!0),Oe=xe.bind(null,!1);B.a.B(te,"focus",Re),B.a.B(te,"focusin",Re),B.a.B(te,"blur",Oe),B.a.B(te,"focusout",Oe),te.__ko_hasfocusLastValue=!1},update:function(te,le){var ye=!!B.a.f(le());te.__ko_hasfocusUpdating||te.__ko_hasfocusLastValue===ye||(ye?te.focus():te.blur(),!ye&&te.__ko_hasfocusLastValue&&te.ownerDocument.body.focus(),B.u.G(B.a.Fb,null,[te,ye?"focusin":"focusout"]))}},B.m.wa.hasfocus=!0,B.c.hasFocus=B.c.hasfocus,B.m.wa.hasFocus="hasfocus",B.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(te,le){B.a.fc(te,le())}},function(){function te(le,ye,xe){B.c[le]={init:function(Re,Oe,We,Ve,Qe){var Se,Ke,nt={},vt,be,At;if(ye){Ve=We.get("as");var ut=We.get("noChildContext");At=!(Ve&&ut),nt={as:Ve,noChildContext:ut,exportDependencies:At}}return be=(vt=We.get("completeOn")=="render")||We.has(B.i.pa),B.o(function(){var Nt=B.a.f(Oe()),Gt=!xe!=!Nt,Qt=!Ke,Ct;(At||Gt!==Se)&&(be&&(Qe=B.i.Cb(Re,Qe)),Gt&&((!ye||At)&&(nt.dataDependency=B.S.o()),Ct=ye?Qe.createChildContext(typeof Nt=="function"?Nt:Oe,nt):B.S.qa()?Qe.extend(null,nt):Qe),Qt&&B.S.qa()&&(Ke=B.a.Ca(B.h.childNodes(Re),!0)),Gt?(Qt||B.h.va(Re,B.a.Ca(Ke)),B.Oa(Ct,Re)):(B.h.Ea(Re),vt||B.i.ma(Re,B.i.H)),Se=Gt)},null,{l:Re}),{controlsDescendantBindings:!0}}},B.m.Ra[le]=!1,B.h.ea[le]=!0}te("if"),te("ifnot",!1,!0),te("with",!0)}(),B.c.let={init:function(te,le,ye,xe,Re){return le=Re.extend(le),B.Oa(le,te),{controlsDescendantBindings:!0}}},B.h.ea.let=!0;var xi={};B.c.options={init:function(te){if(B.a.R(te)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<te.length;)te.remove(0);return{controlsDescendantBindings:!0}},update:function(te,le,ye){function xe(){return B.a.jb(te.options,function(ut){return ut.selected})}function Re(ut,Nt,Gt){var Qt=typeof Nt;return Qt=="function"?Nt(ut):Qt=="string"?ut[Nt]:Gt}function Oe(ut,Nt){if(be&&Se)B.i.ma(te,B.i.H);else if(vt.length){var Gt=0<=B.a.A(vt,B.w.M(Nt[0]));B.a.Zc(Nt[0],Gt),be&&!Gt&&B.u.G(B.a.Fb,null,[te,"change"])}}var We=te.multiple,Ve=te.length!=0&&We?te.scrollTop:null,Qe=B.a.f(le()),Se=ye.get("valueAllowUnset")&&ye.has("value"),Ke=ye.get("optionsIncludeDestroyed");le={};var nt,vt=[];Se||(We?vt=B.a.Mb(xe(),B.w.M):0<=te.selectedIndex&&vt.push(B.w.M(te.options[te.selectedIndex]))),Qe&&(typeof Qe.length>"u"&&(Qe=[Qe]),nt=B.a.jb(Qe,function(ut){return Ke||ut===t||ut===null||!B.a.f(ut._destroy)}),ye.has("optionsCaption")&&(Qe=B.a.f(ye.get("optionsCaption")),Qe!==null&&Qe!==t&&nt.unshift(xi)));var be=!1;if(le.beforeRemove=function(ut){te.removeChild(ut)},Qe=Oe,ye.has("optionsAfterRender")&&typeof ye.get("optionsAfterRender")=="function"&&(Qe=function(ut,Nt){Oe(0,Nt),B.u.G(ye.get("optionsAfterRender"),null,[Nt[0],ut!==xi?ut:t])}),B.a.ec(te,nt,function(ut,Nt,Gt){return Gt.length&&(vt=!Se&&Gt[0].selected?[B.w.M(Gt[0])]:[],be=!0),Nt=te.ownerDocument.createElement("option"),ut===xi?(B.a.Bb(Nt,ye.get("optionsCaption")),B.w.cb(Nt,t)):(Gt=Re(ut,ye.get("optionsValue"),ut),B.w.cb(Nt,B.a.f(Gt)),ut=Re(ut,ye.get("optionsText"),Gt),B.a.Bb(Nt,ut)),[Nt]},le,Qe),!Se){var At;We?At=vt.length&&xe().length<vt.length:At=vt.length&&0<=te.selectedIndex?B.w.M(te.options[te.selectedIndex])!==vt[0]:vt.length||0<=te.selectedIndex,At&&B.u.G(B.a.Fb,null,[te,"change"])}(Se||B.S.Ya())&&B.i.ma(te,B.i.H),B.a.wd(te),Ve&&20<Math.abs(Ve-te.scrollTop)&&(te.scrollTop=Ve)}},B.c.options.$b=B.a.g.Z(),B.c.selectedOptions={init:function(te,le,ye){function xe(){var We=le(),Ve=[];B.a.D(te.getElementsByTagName("option"),function(Qe){Qe.selected&&Ve.push(B.w.M(Qe))}),B.m.eb(We,ye,"selectedOptions",Ve)}function Re(){var We=B.a.f(le()),Ve=te.scrollTop;We&&typeof We.length=="number"&&B.a.D(te.getElementsByTagName("option"),function(Qe){var Se=0<=B.a.A(We,B.w.M(Qe));Qe.selected!=Se&&B.a.Zc(Qe,Se)}),te.scrollTop=Ve}if(B.a.R(te)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var Oe;B.i.subscribe(te,B.i.H,function(){Oe?xe():(B.a.B(te,"change",xe),Oe=B.o(Re,null,{l:te}))},null,{notifyImmediately:!0})},update:function(){}},B.m.wa.selectedOptions=!0,B.c.style={update:function(te,le){var ye=B.a.f(le()||{});B.a.P(ye,function(xe,Re){if(Re=B.a.f(Re),(Re===null||Re===t||Re===!1)&&(Re=""),y)y(te).css(xe,Re);else if(/^--/.test(xe))te.style.setProperty(xe,Re);else{xe=xe.replace(/-(\w)/g,function(We,Ve){return Ve.toUpperCase()});var Oe=te.style[xe];te.style[xe]=Re,Re===Oe||te.style[xe]!=Oe||isNaN(Re)||(te.style[xe]=Re+"px")}})}},B.c.submit={init:function(te,le,ye,xe,Re){if(typeof le()!="function")throw Error("The value for a submit binding must be a function");B.a.B(te,"submit",function(Oe){var We,Ve=le();try{We=Ve.call(Re.$data,te)}finally{We!==!0&&(Oe.preventDefault?Oe.preventDefault():Oe.returnValue=!1)}})}},B.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(te,le){B.a.Bb(te,le())}},B.h.ea.text=!0,function(){if(r&&r.navigator){var te=function(nt){if(nt)return parseFloat(nt[1])},le=r.navigator.userAgent,ye,xe,Re,Oe,We;(ye=r.opera&&r.opera.version&&parseInt(r.opera.version()))||(We=te(le.match(/Edge\/([^ ]+)$/)))||te(le.match(/Chrome\/([^ ]+)/))||(xe=te(le.match(/Version\/([^ ]+) Safari/)))||(Re=te(le.match(/Firefox\/([^ ]+)/)))||(Oe=B.a.W||te(le.match(/MSIE ([^ ]+)/)))||(Oe=te(le.match(/rv:([^ )]+)/)))}if(8<=Oe&&10>Oe)var Ve=B.a.g.Z(),Qe=B.a.g.Z(),Se=function(nt){var vt=this.activeElement;(vt=vt&&B.a.g.get(vt,Qe))&&vt(nt)},Ke=function(nt,vt){var be=nt.ownerDocument;B.a.g.get(be,Ve)||(B.a.g.set(be,Ve,!0),B.a.B(be,"selectionchange",Se)),B.a.g.set(nt,Qe,vt)};B.c.textInput={init:function(nt,vt,be){function At(fi,Gi){B.a.B(nt,fi,Gi)}function ut(){var fi=B.a.f(vt());(fi===null||fi===t)&&(fi=""),Ft!==t&&fi===Ft?B.a.setTimeout(ut,4):nt.value!==fi&&(_i=!0,nt.value=fi,_i=!1,Qt=nt.value)}function Nt(){Ct||(Ft=nt.value,Ct=B.a.setTimeout(Gt,4))}function Gt(){clearTimeout(Ct),Ft=Ct=t;var fi=nt.value;Qt!==fi&&(Qt=fi,B.m.eb(vt(),be,"textInput",fi))}var Qt=nt.value,Ct,Ft,Xt=B.a.W==9?Nt:Gt,_i=!1;Oe&&At("keypress",Gt),11>Oe&&At("propertychange",function(fi){_i||fi.propertyName!=="value"||Xt()}),Oe==8&&(At("keyup",Gt),At("keydown",Gt)),Ke&&(Ke(nt,Xt),At("dragend",Nt)),(!Oe||9<=Oe)&&At("input",Xt),5>xe&&B.a.R(nt)==="textarea"?(At("keydown",Nt),At("paste",Nt),At("cut",Nt)):11>ye?At("keydown",Nt):4>Re?(At("DOMAutoComplete",Gt),At("dragdrop",Gt),At("drop",Gt)):We&&nt.type==="number"&&At("keydown",Nt),At("change",Gt),At("blur",Gt),B.o(ut,null,{l:nt})}},B.m.wa.textInput=!0,B.c.textinput={preprocess:function(nt,vt,be){be("textInput",nt)}}}(),B.c.uniqueName={init:function(te,le){if(le()){var ye="ko_unique_"+ ++B.c.uniqueName.rd;B.a.Yc(te,ye)}}},B.c.uniqueName.rd=0,B.c.using={init:function(te,le,ye,xe,Re){var Oe;return ye.has("as")&&(Oe={as:ye.get("as"),noChildContext:ye.get("noChildContext")}),le=Re.createChildContext(le,Oe),B.Oa(le,te),{controlsDescendantBindings:!0}}},B.h.ea.using=!0,B.c.value={init:function(te,le,ye){var xe=B.a.R(te),Re=xe=="input";if(!Re||te.type!="checkbox"&&te.type!="radio"){var Oe=[],We=ye.get("valueUpdate"),Ve=!1,Qe=null;We&&(typeof We=="string"?Oe=[We]:Oe=B.a.wc(We),B.a.Pa(Oe,"change"));var Se=function(){Qe=null,Ve=!1;var vt=le(),be=B.w.M(te);B.m.eb(vt,ye,"value",be)};!B.a.W||!Re||te.type!="text"||te.autocomplete=="off"||te.form&&te.form.autocomplete=="off"||B.a.A(Oe,"propertychange")!=-1||(B.a.B(te,"propertychange",function(){Ve=!0}),B.a.B(te,"focus",function(){Ve=!1}),B.a.B(te,"blur",function(){Ve&&Se()})),B.a.D(Oe,function(vt){var be=Se;B.a.Ud(vt,"after")&&(be=function(){Qe=B.w.M(te),B.a.setTimeout(Se,0)},vt=vt.substring(5)),B.a.B(te,vt,be)});var Ke;if(Ke=Re&&te.type=="file"?function(){var vt=B.a.f(le());vt===null||vt===t||vt===""?te.value="":B.u.G(Se)}:function(){var vt=B.a.f(le()),be=B.w.M(te);Qe!==null&&vt===Qe?B.a.setTimeout(Ke,0):(vt!==be||be===t)&&(xe==="select"?(be=ye.get("valueAllowUnset"),B.w.cb(te,vt,be),be||vt===B.w.M(te)||B.u.G(Se)):B.w.cb(te,vt))},xe==="select"){var nt;B.i.subscribe(te,B.i.H,function(){nt?ye.get("valueAllowUnset")?Ke():Se():(B.a.B(te,"change",Se),nt=B.o(Ke,null,{l:te}))},null,{notifyImmediately:!0})}else B.a.B(te,"change",Se),B.o(Ke,null,{l:te})}else B.ib(te,{checkedValue:le})},update:function(){}},B.m.wa.value=!0,B.c.visible={update:function(te,le){var ye=B.a.f(le()),xe=te.style.display!="none";ye&&!xe?te.style.display="":!ye&&xe&&(te.style.display="none")}},B.c.hidden={update:function(te,le){B.c.visible.update(te,function(){return!B.a.f(le())})}},function(te){B.c[te]={init:function(le,ye,xe,Re,Oe){return B.c.event.init.call(this,le,function(){var We={};return We[te]=ye(),We},xe,Re,Oe)}}}("click"),B.ca=function(){},B.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},B.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},B.ca.prototype.makeTemplateSource=function(te,le){if(typeof te=="string"){le=le||c;var ye=le.getElementById(te);if(!ye)throw Error("Cannot find template with ID "+te);return new B.C.F(ye)}if(te.nodeType==1||te.nodeType==8)return new B.C.ia(te);throw Error("Unknown template type: "+te)},B.ca.prototype.renderTemplate=function(te,le,ye,xe){return te=this.makeTemplateSource(te,xe),this.renderTemplateSource(te,le,ye,xe)},B.ca.prototype.isTemplateRewritten=function(te,le){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(te,le).data("isRewritten")},B.ca.prototype.rewriteTemplate=function(te,le,ye){te=this.makeTemplateSource(te,ye),le=le(te.text()),te.text(le),te.data("isRewritten",!0)},B.b("templateEngine",B.ca),B.kc=function(){function te(xe,Re,Oe,We){xe=B.m.ac(xe);for(var Ve=B.m.Ra,Qe=0;Qe<xe.length;Qe++){var Se=xe[Qe].key;if(Object.prototype.hasOwnProperty.call(Ve,Se)){var Ke=Ve[Se];if(typeof Ke=="function"){if(Se=Ke(xe[Qe].value))throw Error(Se)}else if(!Ke)throw Error("This template engine does not support the '"+Se+"' binding within its templates")}}return Oe="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+B.m.vb(xe,{valueAccessors:!0})+" } })()},'"+Oe.toLowerCase()+"')",We.createJavaScriptEvaluatorBlock(Oe)+Re}var le=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,ye=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(xe,Re,Oe){Re.isTemplateRewritten(xe,Oe)||Re.rewriteTemplate(xe,function(We){return B.kc.Ld(We,Re)},Oe)},Ld:function(xe,Re){return xe.replace(le,function(Oe,We,Ve,Qe,Se){return te(Se,We,Ve,Re)}).replace(ye,function(Oe,We){return te(We,"<!-- ko -->","#comment",Re)})},md:function(xe,Re){return B.aa.Xb(function(Oe,We){var Ve=Oe.nextSibling;Ve&&Ve.nodeName.toLowerCase()===Re&&B.ib(Ve,xe,We)})}}}(),B.b("__tr_ambtns",B.kc.md),function(){B.C={},B.C.F=function(ye){if(this.F=ye){var xe=B.a.R(ye);this.ab=xe==="script"?1:xe==="textarea"?2:xe=="template"&&ye.content&&ye.content.nodeType===11?3:4}},B.C.F.prototype.text=function(){var ye=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[ye];var xe=arguments[0];ye==="innerHTML"?B.a.fc(this.F,xe):this.F[ye]=xe};var te=B.a.g.Z()+"_";B.C.F.prototype.data=function(ye){if(arguments.length===1)return B.a.g.get(this.F,te+ye);B.a.g.set(this.F,te+ye,arguments[1])};var le=B.a.g.Z();B.C.F.prototype.nodes=function(){var ye=this.F;if(arguments.length==0){var xe=B.a.g.get(ye,le)||{},Re=xe.lb||(this.ab===3?ye.content:this.ab===4?ye:t);if(!Re||xe.jd){var Oe=this.text();Oe&&Oe!==xe.bb&&(Re=B.a.Md(Oe,ye.ownerDocument),B.a.g.set(ye,le,{lb:Re,bb:Oe,jd:!0}))}return Re}xe=arguments[0],this.ab!==t&&this.text(""),B.a.g.set(ye,le,{lb:xe})},B.C.ia=function(ye){this.F=ye},B.C.ia.prototype=new B.C.F,B.C.ia.prototype.constructor=B.C.ia,B.C.ia.prototype.text=function(){if(arguments.length==0){var ye=B.a.g.get(this.F,le)||{};return ye.bb===t&&ye.lb&&(ye.bb=ye.lb.innerHTML),ye.bb}B.a.g.set(this.F,le,{bb:arguments[0]})},B.b("templateSources",B.C),B.b("templateSources.domElement",B.C.F),B.b("templateSources.anonymousTemplate",B.C.ia)}(),function(){function te(Qe,Se,Ke){var nt;for(Se=B.h.nextSibling(Se);Qe&&(nt=Qe)!==Se;)Qe=B.h.nextSibling(nt),Ke(nt,Qe)}function le(Qe,Se){if(Qe.length){var Ke=Qe[0],nt=Qe[Qe.length-1],vt=Ke.parentNode,be=B.ga.instance,At=be.preprocessNode;if(At){if(te(Ke,nt,function(ut,Nt){var Gt=ut.previousSibling,Qt=At.call(be,ut);Qt&&(ut===Ke&&(Ke=Qt[0]||Nt),ut===nt&&(nt=Qt[Qt.length-1]||Gt))}),Qe.length=0,!Ke)return;Ke===nt?Qe.push(Ke):(Qe.push(Ke,nt),B.a.Ua(Qe,vt))}te(Ke,nt,function(ut){ut.nodeType!==1&&ut.nodeType!==8||B.vc(Se,ut)}),te(Ke,nt,function(ut){ut.nodeType!==1&&ut.nodeType!==8||B.aa.cd(ut,[Se])}),B.a.Ua(Qe,vt)}}function ye(Qe){return Qe.nodeType?Qe:0<Qe.length?Qe[0]:null}function xe(Qe,Se,Ke,nt,vt){vt=vt||{};var be=(Qe&&ye(Qe)||Ke||{}).ownerDocument,At=vt.templateEngine||Oe;if(B.kc.xd(Ke,At,be),Ke=At.renderTemplate(Ke,nt,vt,be),typeof Ke.length!="number"||0<Ke.length&&typeof Ke[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(be=!1,Se){case"replaceChildren":B.h.va(Qe,Ke),be=!0;break;case"replaceNode":B.a.Xc(Qe,Ke),be=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+Se)}return be&&(le(Ke,nt),vt.afterRender&&B.u.G(vt.afterRender,null,[Ke,nt[vt.as||"$data"]]),Se=="replaceChildren"&&B.i.ma(Qe,B.i.H)),Ke}function Re(Qe,Se,Ke){return B.O(Qe)?Qe():typeof Qe=="function"?Qe(Se,Ke):Qe}var Oe;B.gc=function(Qe){if(Qe!=t&&!(Qe instanceof B.ca))throw Error("templateEngine must inherit from ko.templateEngine");Oe=Qe},B.dc=function(Qe,Se,Ke,nt,vt){if(Ke=Ke||{},(Ke.templateEngine||Oe)==t)throw Error("Set a template engine before calling renderTemplate");if(vt=vt||"replaceChildren",nt){var be=ye(nt);return B.$(function(){var ut=Se&&Se instanceof B.fa?Se:new B.fa(Se,null,null,null,{exportDependencies:!0}),At=Re(Qe,ut.$data,ut),ut=xe(nt,vt,At,ut,Ke);vt=="replaceNode"&&(nt=ut,be=ye(nt))},null,{Sa:function(){return!be||!B.a.Sb(be)},l:be&&vt=="replaceNode"?be.parentNode:be})}return B.aa.Xb(function(At){B.dc(Qe,Se,Ke,At,"replaceNode")})},B.Qd=function(Qe,Se,Ke,nt,vt){function be(Ft,Xt){B.u.G(B.a.ec,null,[nt,Ft,ut,Ke,At,Xt]),B.i.ma(nt,B.i.H)}function At(Ft,Xt){le(Xt,Nt),Ke.afterRender&&Ke.afterRender(Xt,Ft),Nt=null}function ut(Ft,Xt){Nt=vt.createChildContext(Ft,{as:Gt,noChildContext:Ke.noChildContext,extend:function(fi){fi.$index=Xt,Gt&&(fi[Gt+"Index"]=Xt)}});var _i=Re(Qe,Ft,Nt);return xe(nt,"ignoreTargetNode",_i,Nt,Ke)}var Nt,Gt=Ke.as,Qt=Ke.includeDestroyed===!1||B.options.foreachHidesDestroyed&&!Ke.includeDestroyed;if(Qt||Ke.beforeRemove||!B.Pc(Se))return B.$(function(){var Ft=B.a.f(Se)||[];typeof Ft.length>"u"&&(Ft=[Ft]),Qt&&(Ft=B.a.jb(Ft,function(Xt){return Xt===t||Xt===null||!B.a.f(Xt._destroy)})),be(Ft)},null,{l:nt});be(Se.v());var Ct=Se.subscribe(function(Ft){be(Se(),Ft)},null,"arrayChange");return Ct.l(nt),Ct};var We=B.a.g.Z(),Ve=B.a.g.Z();B.c.template={init:function(Qe,Se){var Ke=B.a.f(Se());if(typeof Ke=="string"||"name"in Ke)B.h.Ea(Qe);else if("nodes"in Ke){if(Ke=Ke.nodes||[],B.O(Ke))throw Error('The "nodes" option must be a plain, non-observable array.');var nt=Ke[0]&&Ke[0].parentNode;nt&&B.a.g.get(nt,Ve)||(nt=B.a.Yb(Ke),B.a.g.set(nt,Ve,!0)),new B.C.ia(Qe).nodes(nt)}else if(Ke=B.h.childNodes(Qe),0<Ke.length)nt=B.a.Yb(Ke),new B.C.ia(Qe).nodes(nt);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(Qe,Se,Ke,nt,vt){var be=Se();Se=B.a.f(be),Ke=!0,nt=null,typeof Se=="string"?Se={}:(be="name"in Se?Se.name:Qe,"if"in Se&&(Ke=B.a.f(Se.if)),Ke&&"ifnot"in Se&&(Ke=!B.a.f(Se.ifnot)),Ke&&!be&&(Ke=!1)),"foreach"in Se?nt=B.Qd(be,Ke&&Se.foreach||[],Se,Qe,vt):Ke?(Ke=vt,"data"in Se&&(Ke=vt.createChildContext(Se.data,{as:Se.as,noChildContext:Se.noChildContext,exportDependencies:!0})),nt=B.dc(be,Ke,Se,Qe)):B.h.Ea(Qe),vt=nt,(Se=B.a.g.get(Qe,We))&&typeof Se.s=="function"&&Se.s(),B.a.g.set(Qe,We,!vt||vt.ja&&!vt.ja()?t:vt)}},B.m.Ra.template=function(Qe){return Qe=B.m.ac(Qe),Qe.length==1&&Qe[0].unknown||B.m.Id(Qe,"name")?null:"This template engine does not support anonymous templates nested within its templates"},B.h.ea.template=!0}(),B.b("setTemplateEngine",B.gc),B.b("renderTemplate",B.dc),B.a.Kc=function(te,le,ye){if(te.length&&le.length){var xe,Re,Oe,We,Ve;for(xe=Re=0;(!ye||xe<ye)&&(We=te[Re]);++Re){for(Oe=0;Ve=le[Oe];++Oe)if(We.value===Ve.value){We.moved=Ve.index,Ve.moved=We.index,le.splice(Oe,1),xe=Oe=0;break}xe+=Oe}}},B.a.Pb=function(){function te(le,ye,xe,Re,Oe){var We=Math.min,Ve=Math.max,Qe=[],Se,Ke=le.length,nt,vt=ye.length,be=vt-Ke||1,At=Ke+vt+1,ut,Nt,Gt;for(Se=0;Se<=Ke;Se++)for(Nt=ut,Qe.push(ut=[]),Gt=We(vt,Se+be),nt=Ve(0,Se-1);nt<=Gt;nt++)ut[nt]=nt?Se?le[Se-1]===ye[nt-1]?Nt[nt-1]:We(Nt[nt]||At,ut[nt-1]||At)+1:nt+1:Se+1;for(We=[],Ve=[],be=[],Se=Ke,nt=vt;Se||nt;)vt=Qe[Se][nt]-1,nt&&vt===Qe[Se][nt-1]?Ve.push(We[We.length]={status:xe,value:ye[--nt],index:nt}):Se&&vt===Qe[Se-1][nt]?be.push(We[We.length]={status:Re,value:le[--Se],index:Se}):(--nt,--Se,Oe.sparse||We.push({status:"retained",value:ye[nt]}));return B.a.Kc(be,Ve,!Oe.dontLimitMoves&&10*Ke),We.reverse()}return function(le,ye,xe){return xe=typeof xe=="boolean"?{dontLimitMoves:xe}:xe||{},le=le||[],ye=ye||[],le.length<ye.length?te(le,ye,"added","deleted",xe):te(ye,le,"deleted","added",xe)}}(),B.b("utils.compareArrays",B.a.Pb),function(){function te(xe,Re,Oe,We,Ve){var Qe=[],Se=B.$(function(){var Ke=Re(Oe,Ve,B.a.Ua(Qe,xe))||[];0<Qe.length&&(B.a.Xc(Qe,Ke),We&&B.u.G(We,null,[Oe,Ke,Ve])),Qe.length=0,B.a.Nb(Qe,Ke)},null,{l:xe,Sa:function(){return!B.a.kd(Qe)}});return{Y:Qe,$:Se.ja()?Se:t}}var le=B.a.g.Z(),ye=B.a.g.Z();B.a.ec=function(xe,Re,Oe,We,Ve,Qe){function Se(ti){_i={Aa:ti,pb:B.ta(Nt++)},At.push(_i),be||Xt.push(_i)}function Ke(ti){_i=vt[ti],Nt!==_i.pb.v()&&Ft.push(_i),_i.pb(Nt++),B.a.Ua(_i.Y,xe),At.push(_i)}function nt(ti,Ni){if(ti)for(var qi=0,en=Ni.length;qi<en;qi++)B.a.D(Ni[qi].Y,function($t){ti($t,qi,Ni[qi].Aa)})}Re=Re||[],typeof Re.length>"u"&&(Re=[Re]),We=We||{};var vt=B.a.g.get(xe,le),be=!vt,At=[],ut=0,Nt=0,Gt=[],Qt=[],Ct=[],Ft=[],Xt=[],_i,fi=0;if(be)B.a.D(Re,Se);else{if(!Qe||vt&&vt._countWaitingForRemove){var Gi=B.a.Mb(vt,function(ti){return ti.Aa});Qe=B.a.Pb(Gi,Re,{dontLimitMoves:We.dontLimitMoves,sparse:!0})}for(var Gi=0,wn,zi,Gn;wn=Qe[Gi];Gi++)switch(zi=wn.moved,Gn=wn.index,wn.status){case"deleted":for(;ut<Gn;)Ke(ut++);zi===t&&(_i=vt[ut],_i.$&&(_i.$.s(),_i.$=t),B.a.Ua(_i.Y,xe).length&&(We.beforeRemove&&(At.push(_i),fi++,_i.Aa===ye?_i=null:Ct.push(_i)),_i&&Gt.push.apply(Gt,_i.Y))),ut++;break;case"added":for(;Nt<Gn;)Ke(ut++);zi!==t?(Qt.push(At.length),Ke(zi)):Se(wn.value)}for(;Nt<Re.length;)Ke(ut++);At._countWaitingForRemove=fi}B.a.g.set(xe,le,At),nt(We.beforeMove,Ft),B.a.D(Gt,We.beforeRemove?B.oa:B.removeNode);var kn,yt,rt;try{rt=xe.ownerDocument.activeElement}catch{}if(Qt.length)for(;(Gi=Qt.shift())!=t;){for(_i=At[Gi],kn=t;Gi;)if((yt=At[--Gi].Y)&&yt.length){kn=yt[yt.length-1];break}for(Re=0;ut=_i.Y[Re];kn=ut,Re++)B.h.Wb(xe,ut,kn)}for(Gi=0;_i=At[Gi];Gi++){for(_i.Y||B.a.extend(_i,te(xe,Oe,_i.Aa,Ve,_i.pb)),Re=0;ut=_i.Y[Re];kn=ut,Re++)B.h.Wb(xe,ut,kn);!_i.Ed&&Ve&&(Ve(_i.Aa,_i.Y,_i.pb),_i.Ed=!0,kn=_i.Y[_i.Y.length-1])}for(rt&&xe.ownerDocument.activeElement!=rt&&rt.focus(),nt(We.beforeRemove,Ct),Gi=0;Gi<Ct.length;++Gi)Ct[Gi].Aa=ye;nt(We.afterMove,Ft),nt(We.afterAdd,Xt)}}(),B.b("utils.setDomNodeChildrenFromArrayMapping",B.a.ec),B.ba=function(){this.allowTemplateRewriting=!1},B.ba.prototype=new B.ca,B.ba.prototype.constructor=B.ba,B.ba.prototype.renderTemplateSource=function(te,le,ye,xe){return(le=!(9>B.a.W)&&te.nodes?te.nodes():null)?B.a.la(le.cloneNode(!0).childNodes):(te=te.text(),B.a.ua(te,xe))},B.ba.Ma=new B.ba,B.gc(B.ba.Ma),B.b("nativeTemplateEngine",B.ba),function(){B.$a=function(){var le=this.Hd=function(){if(!y||!y.tmpl)return 0;try{if(0<=y.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch{}return 1}();this.renderTemplateSource=function(ye,xe,Re,Oe){if(Oe=Oe||c,Re=Re||{},2>le)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var We=ye.data("precompiled");return We||(We=ye.text()||"",We=y.template(null,"{{ko_with $item.koBindingContext}}"+We+"{{/ko_with}}"),ye.data("precompiled",We)),ye=[xe.$data],xe=y.extend({koBindingContext:xe},Re.templateOptions),xe=y.tmpl(We,ye,xe),xe.appendTo(Oe.createElement("div")),y.fragments={},xe},this.createJavaScriptEvaluatorBlock=function(ye){return"{{ko_code ((function() { return "+ye+" })()) }}"},this.addTemplate=function(ye,xe){c.write("<script type='text/html' id='"+ye+"'>"+xe+"<\/script>")},0<le&&(y.tmpl.tag.ko_code={open:"__.push($1 || '');"},y.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},B.$a.prototype=new B.ca,B.$a.prototype.constructor=B.$a;var te=new B.$a;0<te.Hd&&B.gc(te),B.b("jqueryTmplTemplateEngine",B.$a)}()})})()})()})(yv,yv.exports);const{sin:Lc,cos:DV,sqrt:bB,abs:xv,PI:Ll}=Math,rS=6378245,sS=.006693421622965823;function NF(u,e){return u>=72.004&&u<=137.8347&&e>=.8293&&e<=55.8271}function PV(u,e){let t=-100+2*u+3*e+.2*e*e+.1*u*e+.2*bB(xv(u));return t+=(20*Lc(6*u*Ll)+20*Lc(2*u*Ll))*2/3,t+=(20*Lc(e*Ll)+40*Lc(e/3*Ll))*2/3,t+=(160*Lc(e/12*Ll)+320*Lc(e*Ll/30))*2/3,t}function UV(u,e){let t=300+u+2*e+.1*u*u+.1*u*e+.1*bB(xv(u));return t+=(20*Lc(6*u*Ll)+20*Lc(2*u*Ll))*2/3,t+=(20*Lc(u*Ll)+40*Lc(u/3*Ll))*2/3,t+=(150*Lc(u/12*Ll)+300*Lc(u/30*Ll))*2/3,t}function RV(u,e){let t=UV(u-105,e-35),r=PV(u-105,e-35);const c=e/180*Ll;let p=Lc(c);p=1-sS*p*p;const y=bB(p);return t=t*180/(rS/y*DV(c)*Ll),r=r*180/(rS*(1-sS)/(p*y)*Ll),[t,r]}function ip(u){const[e,t]=u;if(!NF(e,t))return[e,t];const r=RV(e,t);return[e+r[0],t+r[1]]}function $m(u){const[e,t]=u;if(!NF(e,t))return[e,t];let[r,c]=[e,t],p=ip([r,c]),y=p[0]-e,i=p[1]-t;for(;xv(y)>1e-6||xv(i)>1e-6;)r-=y,c-=i,p=ip([r,c]),y=p[0]-e,i=p[1]-t;return[r,c]}const{sin:vv,cos:wv,atan2:QF,sqrt:VF,PI:zV}=Math,bv=zV*3e3/180;function Vm(u){const[e,t]=u,r=e-.0065,c=t-.006,p=VF(r*r+c*c)-2e-5*vv(c*bv),y=QF(c,r)-3e-6*wv(r*bv),i=p*wv(y),C=p*vv(y);return[i,C]}function Zm(u){const[e,t]=u,r=e,c=t,p=VF(r*r+c*c)+2e-5*vv(c*bv),y=QF(c,r)+3e-6*wv(r*bv),i=p*wv(y)+.0065,C=p*vv(y)+.006;return[i,C]}const oS=180/Math.PI,aS=Math.PI/180,Bv=6378137,Qd=20037508342789244e-9;function Ux(u){return[u[0]*oS/Bv,(Math.PI*.5-2*Math.atan(Math.exp(-u[1]/Bv)))*oS]}function e1(u){const e=Math.abs(u[0])<=180?u[0]:u[0]-(u[0]<0?-1:1)*360,t=[Bv*e*aS,Bv*Math.log(Math.tan(Math.PI*.25+.5*u[1]*aS))];return t[0]>Qd&&(t[0]=Qd),t[0]<-Qd&&(t[0]=-Qd),t[1]>Qd&&(t[1]=Qd),t[1]<-Qd&&(t[1]=-Qd),t}const{abs:y2}=Math,lS=[1289059486e-2,836237787e-2,5591021,348198983e-2,167804312e-2,0],cS=[75,60,45,30,15,0],kV=[[1410526172116255e-23,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,173379812e-1],[-7435856389565537e-24,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,1026014486e-2],[-3030883460898826e-23,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,685681737e-2],[-1981981304930552e-23,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,448277706e-2],[309191371068437e-23,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,25551644e-1],[2890871144776878e-24,8983055095805407e-21,-3068298e-14,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],OV=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,6477955746671607e-7,-4082003173641316e-6,1077490566351142e-5,-1517187553151559e-5,1205306533862167e-5,-5124939663577472e-6,9133119359512032e-7,67.5],[.00337398766765,111320.7020202162,4481351045890365e-9,-2339375119931662e-8,7968221547186455e-8,-1159649932797253e-7,9723671115602145e-8,-4366194633752821e-8,8477230501135234e-9,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837749470245e-9,992013.7397791013,-122195221711287e-8,1340652697009075e-9,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758690035394e-9,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]];function HF(u,e,t){const r=y2(e)/t[9];let c=t[0]+t[1]*y2(u),p=t[2]+t[3]*r+t[4]*r**2+t[5]*r**3+t[6]*r**4+t[7]*r**5+t[8]*r**6;return c*=u<0?-1:1,p*=e<0?-1:1,[c,p]}function t1(u){const[e,t]=u;let r=[];for(let c=0;c<cS.length;c++)if(y2(t)>cS[c]){r=OV[c];break}return HF(e,t,r)}function Rx(u){const[e,t]=u;let r=[];for(let c=0;c<lS.length;c++)if(t>=lS[c]){r=kV[c];break}return HF(e,t,r)}function Vd(u,e){if(!u)throw new Error(e)}function GF(u){return!!u&&Object.prototype.toString.call(u)==="[object Array]"}function hS(u){return!isNaN(Number(u))&&u!==null&&!GF(u)}function Ch(...u){const e=u.length-1;return function(...t){let r=e,c=u[e].apply(null,t);for(;r--;)c=u[r].call(null,c);return c}}function WF(u,e,t=!1){if(u===null)return;let r,c,p,y,i,C,D,R=0,Q=0,z;const{type:G}=u,J=G==="FeatureCollection",Y=G==="Feature",B=J?u.features.length:1;for(let ae=0;ae<B;ae++){D=J?u.features[ae].geometry:Y?u.geometry:u,z=D?D.type==="GeometryCollection":!1,i=z?D.geometries.length:1;for(let ce=0;ce<i;ce++){let Ae=0,we=0;if(y=z?D.geometries[ce]:D,y===null)continue;const me=y.type;switch(R=t&&(me==="Polygon"||me==="MultiPolygon")?1:0,me){case null:break;case"Point":if(C=y.coordinates,e(C,Q,ae,Ae,we)===!1)return!1;Q++,Ae++;break;case"LineString":case"MultiPoint":for(C=y.coordinates,r=0;r<C.length;r++){if(e(C[r],Q,ae,Ae,we)===!1)return!1;Q++,me==="MultiPoint"&&Ae++}me==="LineString"&&Ae++;break;case"Polygon":case"MultiLineString":for(C=y.coordinates,r=0;r<C.length;r++){for(c=0;c<C[r].length-R;c++){if(e(C[r][c],Q,ae,Ae,we)===!1)return!1;Q++}me==="MultiLineString"&&Ae++,me==="Polygon"&&we++}me==="Polygon"&&Ae++;break;case"MultiPolygon":for(C=y.coordinates,r=0;r<C.length;r++){for(we=0,c=0;c<C[r].length;c++){for(p=0;p<C[r][c].length-R;p++){if(e(C[r][c][p],Q,ae,Ae,we)===!1)return!1;Q++}we++}Ae++}break;case"GeometryCollection":for(r=0;r<y.geometries.length;r++)if(WF(y.geometries[r],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}var x2=(u=>(u.WGS84="WGS84",u.WGS1984="WGS84",u.EPSG4326="WGS84",u.GCJ02="GCJ02",u.AMap="GCJ02",u.BD09="BD09",u.BD09LL="BD09",u.Baidu="BD09",u.BMap="BD09",u.BD09MC="BD09MC",u.BD09Meter="BD09MC",u.EPSG3857="EPSG3857",u.EPSG900913="EPSG3857",u.EPSG102100="EPSG3857",u.WebMercator="EPSG3857",u.WM="EPSG3857",u))(x2||{});const NV={to:{GCJ02:ip,BD09:Ch(Zm,ip),BD09MC:Ch(t1,Zm,ip),EPSG3857:e1}},QV={to:{WGS84:$m,BD09:Zm,BD09MC:Ch(t1,Zm),EPSG3857:Ch(e1,$m)}},VV={to:{WGS84:Ch($m,Vm),GCJ02:Vm,EPSG3857:Ch(e1,$m,Vm),BD09MC:t1}},HV={to:{WGS84:Ux,GCJ02:Ch(ip,Ux),BD09:Ch(Zm,ip,Ux),BD09MC:Ch(t1,Zm,ip,Ux)}},GV={to:{WGS84:Ch($m,Vm,Rx),GCJ02:Ch(Vm,Rx),EPSG3857:Ch(e1,$m,Vm,Rx),BD09:Rx}},WV={WGS84:NV,GCJ02:QV,BD09:VV,EPSG3857:HV,BD09MC:GV};function jV(u,e,t){if(Vd(!!u,"The args[0] input coordinate is required"),Vd(!!e,"The args[1] original coordinate system is required"),Vd(!!t,"The args[2] target coordinate system is required"),e===t)return u;const r=WV[e];Vd(!!r,`Invalid original coordinate system: ${e}`);const c=r.to[t];Vd(!!c,`Invalid target coordinate system: ${t}`);const p=typeof u;if(Vd(p==="string"||p==="object",`Invalid input coordinate type: ${p}`),p==="string")try{u=JSON.parse(u)}catch{throw new Error(`Invalid input coordinate: ${u}`)}let y=!1;GF(u)&&(Vd(u.length>=2,`Invalid input coordinate: ${u}`),Vd(hS(u[0])&&hS(u[1]),`Invalid input coordinate: ${u}`),u=u.map(Number),y=!0);const i=c;return y?i(u):(WF(u,C=>{[C[0],C[1]]=i(C)}),u)}const eb={...x2,CRSTypes:x2,transform:jV},KV=function(u){let e=document.createElement("div");e.innerHTML=u;let t=document.createDocumentFragment();for(;e.firstChild;)t.appendChild(e.firstChild);return t},$V=`
  5006. uniform sampler2D texture;
  5007. varying float opacity;
  5008. varying vec3 vexColor;
  5009. void main(){
  5010. gl_FragColor = vec4(vexColor,opacity);
  5011. gl_FragColor = gl_FragColor * texture2D(texture,gl_PointCoord);
  5012. // gl_FragColor = vec4(1.0,0.0,0.0,1.0);
  5013. }
  5014. `,ZV=`
  5015. attribute float size;
  5016. attribute vec4 colors;
  5017. varying float opacity;
  5018. varying vec3 vexColor;
  5019. void main(){
  5020. vexColor.x = colors.r;
  5021. vexColor.y = colors.g;
  5022. vexColor.z = colors.b;
  5023. //w\u5206\u91CF\u4E3A\u900F\u660E\u5EA6
  5024. opacity = colors.w;
  5025. vec4 mvPosition = modelViewMatrix * vec4(position,1.0);
  5026. gl_PointSize = size;
  5027. gl_Position = projectionMatrix * mvPosition;
  5028. }
  5029. `;class XV{constructor({vecs:e,num:t,size:r,color:c,speed:p=2e3}){Qi(this,"speed");Qi(this,"color");Qi(this,"sizes");Qi(this,"vecs");Qi(this,"num");Qi(this,"size");Qi(this,"spline");Qi(this,"particleSystem");Qi(this,"tween");this.vecs=e,this.num=t,this.speed=p,this.size=r,this.spline=new $_(e),this.color=c,this.initFlyTrack()}initFlyTrack(){let e=this.spline.getPoints(this.num);const t=new br().setFromPoints(e),r=new ra({color:16777215});r.transparent=!0,r.opacity=.3;const c=new Ku(t,r);this.particleSystem=new Hs,this.particleSystem.name="flyline_particle_system",this.particleSystem.add(c)}start(){const e=this.spline.getPoints(this.num),t=e.length*4,r=e.length,c=new Float32Array(t),p=new Float32Array(r),y=new br().setFromPoints(e);for(let G=0,J=0;G<t;G+=4,J++)c[G]=this.color.r,c[G+1]=this.color.g,c[G+2]=this.color.b,c[G+3]=(G+3)/r,p[J]=this.size*(J/r);const i={texture:{value:new JI(this.createSpriteCanvas(this.size)),type:"t2"}};y.setAttribute("colors",new As(c,4)),y.setAttribute("size",new As(p,1));const C=new ko({uniforms:i,vertexShader:ZV,fragmentShader:$V,transparent:!0,depthTest:!1}),D=new q2(y,C);D.name="partLinePoints",this.particleSystem.add(D);const R=5e3,Q=this.num,z={start:0,end:Q};this.tween=this.tweenAnimate(z,{start:R-Q*5,end:R},this.speed*10,null,()=>{let G=[],J=Math.round(z.start),Y=Math.floor(z.end);for(let B=J;B<=Y&&B<=R;B++)G=G.concat(this.spline.getPointAt(B/R).toArray());y.attributes.position=new As(new Float32Array(G),3)},()=>{}),this.tween.repeat(1/0).start()}stop(){this.tween.stop()}tweenAnimate(e,t,r,c,p,y){let i=c||k_.Easing.Linear.None,C=new k_.Tween(e).to(t,r).easing(i);return p&&C.onUpdate(()=>p()),y&&C.onComplete(()=>y()),C}createSpriteCanvas(e){const t=document.createElement("canvas");t.width=t.height=e;const r=t.getContext("2d");return r!=null&&(r.fillStyle="rgba(255,255,255,.0)",r.beginPath(),r.arc(e/2,e/2,e/2,0,Math.PI*2),r.fillStyle="white",r.fill(),r.closePath()),t}}const qV=(u,e)=>{let t=LV(u,e).geometry.coordinates,r,c=0;const p=Math.max(u[0],e[0]),y=Math.min(u[0],e[0]);t[0]>y&&t[0]<p?r=t[0]:t[0]<y?r=y+t[0]:t[0]>p&&(r=t[0]-p);const i=Math.max(u[1],e[1]),C=Math.min(u[1],e[1]);return t[1]>C&&t[1]<i?c=t[1]:t[1]<C?c=C:t[1]>i&&(c=i),[r,c]},v2={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
  5030. varying vec2 vUv;
  5031. void main() {
  5032. vUv = uv;
  5033. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  5034. }`,fragmentShader:`
  5035. uniform float opacity;
  5036. uniform sampler2D tDiffuse;
  5037. varying vec2 vUv;
  5038. void main() {
  5039. gl_FragColor = texture2D( tDiffuse, vUv );
  5040. gl_FragColor.a *= opacity;
  5041. }`};class Cy{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const YV=new dy(-1,1,1,-1,0,1),BB=new br;BB.setAttribute("position",new jn([-1,3,0,-1,-1,0,3,-1,0],3));BB.setAttribute("uv",new jn([0,2,0,0,2,0],2));class jF{constructor(e){this._mesh=new us(BB,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,YV)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class CB extends Cy{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ko?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=mf.clone(e.uniforms),this.material=new ko({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new jF(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class uS extends Cy{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){const c=e.getContext(),p=e.state;p.buffers.color.setMask(!1),p.buffers.depth.setMask(!1),p.buffers.color.setLocked(!0),p.buffers.depth.setLocked(!0);let y,i;this.inverse?(y=0,i=1):(y=1,i=0),p.buffers.stencil.setTest(!0),p.buffers.stencil.setOp(c.REPLACE,c.REPLACE,c.REPLACE),p.buffers.stencil.setFunc(c.ALWAYS,y,4294967295),p.buffers.stencil.setClear(i),p.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),p.buffers.color.setLocked(!1),p.buffers.depth.setLocked(!1),p.buffers.stencil.setLocked(!1),p.buffers.stencil.setFunc(c.EQUAL,1,4294967295),p.buffers.stencil.setOp(c.KEEP,c.KEEP,c.KEEP),p.buffers.stencil.setLocked(!0)}}class JV extends Cy{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class tb{constructor(e,t){if(this.renderer=e,t===void 0){const r=e.getSize(new Di);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,t=new rl(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new CB(v2),this.clock=new Jv}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;for(let c=0,p=this.passes.length;c<p;c++){const y=this.passes[c];if(y.enabled!==!1){if(y.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(c),y.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),y.needsSwap){if(r){const i=this.renderer.getContext(),C=this.renderer.state.buffers.stencil;C.setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),C.setFunc(i.EQUAL,1,4294967295)}this.swapBuffers()}uS!==void 0&&(y instanceof uS?r=!0:y instanceof JV&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new Di);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,c=this._height*this._pixelRatio;this.renderTarget1.setSize(r,c),this.renderTarget2.setSize(r,c);for(let p=0;p<this.passes.length;p++)this.passes[p].setSize(r,c)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class AS extends Cy{constructor(e,t,r,c,p){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=c,this.clearAlpha=p!==void 0?p:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Dn}render(e,t,r){const c=e.autoClear;e.autoClear=!1;let p,y;this.overrideMaterial!==void 0&&(y=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),p=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,p),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=y),e.autoClear=c}}const dS={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Dn(0)},defaultOpacity:{value:0}},vertexShader:`
  5042. varying vec2 vUv;
  5043. void main() {
  5044. vUv = uv;
  5045. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  5046. }`,fragmentShader:`
  5047. uniform sampler2D tDiffuse;
  5048. uniform vec3 defaultColor;
  5049. uniform float defaultOpacity;
  5050. uniform float luminosityThreshold;
  5051. uniform float smoothWidth;
  5052. varying vec2 vUv;
  5053. void main() {
  5054. vec4 texel = texture2D( tDiffuse, vUv );
  5055. vec3 luma = vec3( 0.299, 0.587, 0.114 );
  5056. float v = dot( texel.xyz, luma );
  5057. vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
  5058. float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
  5059. gl_FragColor = mix( outputColor, texel, alpha );
  5060. }`},Ev=class extends Cy{constructor(t,r,c,p){super();Qi(this,"strength");Qi(this,"radius");Qi(this,"threshold");Qi(this,"resolution");Qi(this,"clearColor");Qi(this,"renderTargetsHorizontal");Qi(this,"renderTargetsVertical");Qi(this,"nMips");Qi(this,"renderTargetBright");Qi(this,"highPassUniforms");Qi(this,"materialHighPassFilter");Qi(this,"separableBlurMaterials");Qi(this,"compositeMaterial");Qi(this,"bloomTintColors");Qi(this,"copyUniforms");Qi(this,"materialCopy");Qi(this,"_oldClearColor");Qi(this,"oldClearAlpha");Qi(this,"basic");Qi(this,"fsQuad");this.strength=r!==void 0?r:1,this.radius=c,this.threshold=p,this.resolution=t!==void 0?new Di(t.x,t.y):new Di(256,256),this.clearColor=new Dn(0,0,0);const y={minFilter:Xs,magFilter:Xs,format:Dl};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),C=Math.round(this.resolution.y/2);this.renderTargetBright=new rl(i,C,y),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let G=0;G<this.nMips;G++){const J=new rl(i,C,y);J.texture.name="UnrealBloomPass.h"+G,J.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(J);const Y=new rl(i,C,y);Y.texture.name="UnrealBloomPass.v"+G,Y.texture.generateMipmaps=!1,this.renderTargetsVertical.push(Y),i=Math.round(i/2),C=Math.round(C/2)}dS===void 0&&console.error("THREE.UnrealBloomPass relies on LuminosityHighPassShader");const D=dS;this.highPassUniforms=mf.clone(D.uniforms),this.highPassUniforms.luminosityThreshold.value=p,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new ko({uniforms:this.highPassUniforms,vertexShader:D.vertexShader,fragmentShader:D.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const R=[3,5,7,9,11];i=Math.round(this.resolution.x/2),C=Math.round(this.resolution.y/2);for(let G=0;G<this.nMips;G++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(R[G])),this.separableBlurMaterials[G].uniforms.texSize.value=new Di(i,C),i=Math.round(i/2),C=Math.round(C/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=r,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const Q=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=Q,this.bloomTintColors=[new ft(1,1,1),new ft(1,1,1),new ft(1,1,1),new ft(1,1,1),new ft(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,v2===void 0&&console.error("THREE.UnrealBloomPass relies on CopyShader");const z=v2;this.copyUniforms=mf.clone(z.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new ko({uniforms:this.copyUniforms,vertexShader:z.vertexShader,fragmentShader:z.fragmentShader,blending:hv,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Dn,this.oldClearAlpha=1,this.basic=new za,this.fsQuad=new jF(null)}dispose(){for(let t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}setSize(t,r){let c=Math.round(t/2),p=Math.round(r/2);this.renderTargetBright.setSize(c,p);for(let y=0;y<this.nMips;y++)this.renderTargetsHorizontal[y].setSize(c,p),this.renderTargetsVertical[y].setSize(c,p),this.separableBlurMaterials[y].uniforms.texSize.value=new Di(c,p),c=Math.round(c/2),p=Math.round(p/2)}render(t,r,c,p,y){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();const i=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),y&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=c.texture,t.setRenderTarget(null),t.clear(),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=c.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);let C=this.renderTargetBright;for(let D=0;D<this.nMips;D++)this.fsQuad.material=this.separableBlurMaterials[D],this.separableBlurMaterials[D].uniforms.colorTexture.value=C.texture,this.separableBlurMaterials[D].uniforms.direction.value=Ev.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[D]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[D].uniforms.colorTexture.value=this.renderTargetsHorizontal[D].texture,this.separableBlurMaterials[D].uniforms.direction.value=Ev.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[D]),t.clear(),this.fsQuad.render(t),C=this.renderTargetsVertical[D];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,y&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(c),this.fsQuad.render(t)),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=i}getSeperableBlurMaterial(t){return new ko({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new Di(.5,.5)},direction:{value:new Di(.5,.5)}},vertexShader:`varying vec2 vUv;
  5061. void main() {
  5062. vUv = uv;
  5063. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  5064. }`,fragmentShader:`#include <common>
  5065. varying vec2 vUv;
  5066. uniform sampler2D colorTexture;
  5067. uniform vec2 texSize;
  5068. uniform vec2 direction;
  5069. float gaussianPdf(in float x, in float sigma) {
  5070. return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
  5071. }
  5072. void main() {
  5073. vec2 invSize = 1.0 / texSize; float fSigma = float(SIGMA); float weightSum = gaussianPdf(0.0, fSigma); float alphaSum = 0.0; vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum; for( int i = 1; i < KERNEL_RADIUS; i ++ ) { float x = float(i); float w = gaussianPdf(x, fSigma); vec2 uvOffset = direction * invSize * x; vec4 sample1 = texture2D( colorTexture, vUv + uvOffset); vec4 sample2 = texture2D( colorTexture, vUv - uvOffset); diffuseSum += (sample1.rgb + sample2.rgb) * w; alphaSum += (sample1.a + sample2.a) * w; weightSum += 2.0 * w; } gl_FragColor = vec4(diffuseSum/weightSum, alphaSum/weightSum);
  5074. }`})}getCompositeMaterial(t){return new ko({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
  5075. void main() {
  5076. vUv = uv;
  5077. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  5078. }`,fragmentShader:`varying vec2 vUv;
  5079. uniform sampler2D blurTexture1;
  5080. uniform sampler2D blurTexture2;
  5081. uniform sampler2D blurTexture3;
  5082. uniform sampler2D blurTexture4;
  5083. uniform sampler2D blurTexture5;
  5084. uniform sampler2D dirtTexture;
  5085. uniform float bloomStrength;
  5086. uniform float bloomRadius;
  5087. uniform float bloomFactors[NUM_MIPS];
  5088. uniform vec3 bloomTintColors[NUM_MIPS];
  5089. float lerpBloomFactor(const in float factor) {
  5090. float mirrorFactor = 1.2 - factor;
  5091. return mix(factor, mirrorFactor, bloomRadius);
  5092. }
  5093. void main() {
  5094. gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
  5095. lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
  5096. lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
  5097. lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
  5098. lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
  5099. }`})}};let qd=Ev;Qi(qd,"BlurDirectionX"),Qi(qd,"BlurDirectionY");qd.BlurDirectionX=new Di(1,0);qd.BlurDirectionY=new Di(0,1);const eH={uniforms:{tDiffuse:{value:null},resolution:{value:new Di(1/1024,1/512)}},vertexShader:`
  5100. varying vec2 vUv;
  5101. void main() {
  5102. vUv = uv;
  5103. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  5104. }`,fragmentShader:`
  5105. precision highp float;
  5106. uniform sampler2D tDiffuse;
  5107. uniform vec2 resolution;
  5108. varying vec2 vUv;
  5109. // FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)
  5110. //----------------------------------------------------------------------------------
  5111. // File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag
  5112. // SDK Version: v3.00
  5113. // Email: gameworks@nvidia.com
  5114. // Site: http://developer.nvidia.com/
  5115. //
  5116. // Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
  5117. //
  5118. // Redistribution and use in source and binary forms, with or without
  5119. // modification, are permitted provided that the following conditions
  5120. // are met:
  5121. // * Redistributions of source code must retain the above copyright
  5122. // notice, this list of conditions and the following disclaimer.
  5123. // * Redistributions in binary form must reproduce the above copyright
  5124. // notice, this list of conditions and the following disclaimer in the
  5125. // documentation and/or other materials provided with the distribution.
  5126. // * Neither the name of NVIDIA CORPORATION nor the names of its
  5127. // contributors may be used to endorse or promote products derived
  5128. // from this software without specific prior written permission.
  5129. //
  5130. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
  5131. // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  5132. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  5133. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  5134. // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  5135. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  5136. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  5137. // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  5138. // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  5139. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  5140. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5141. //
  5142. //----------------------------------------------------------------------------------
  5143. #ifndef FXAA_DISCARD
  5144. //
  5145. // Only valid for PC OpenGL currently.
  5146. // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
  5147. //
  5148. // 1 = Use discard on pixels which don't need AA.
  5149. // For APIs which enable concurrent TEX+ROP from same surface.
  5150. // 0 = Return unchanged color on pixels which don't need AA.
  5151. //
  5152. #define FXAA_DISCARD 0
  5153. #endif
  5154. /*--------------------------------------------------------------------------*/
  5155. #define FxaaTexTop(t, p) texture2D(t, p, -100.0)
  5156. #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)
  5157. /*--------------------------------------------------------------------------*/
  5158. #define NUM_SAMPLES 5
  5159. // assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
  5160. float contrast( vec4 a, vec4 b ) {
  5161. vec4 diff = abs( a - b );
  5162. return max( max( max( diff.r, diff.g ), diff.b ), diff.a );
  5163. }
  5164. /*============================================================================
  5165. FXAA3 QUALITY - PC
  5166. ============================================================================*/
  5167. /*--------------------------------------------------------------------------*/
  5168. vec4 FxaaPixelShader(
  5169. vec2 posM,
  5170. sampler2D tex,
  5171. vec2 fxaaQualityRcpFrame,
  5172. float fxaaQualityEdgeThreshold,
  5173. float fxaaQualityinvEdgeThreshold
  5174. ) {
  5175. vec4 rgbaM = FxaaTexTop(tex, posM);
  5176. vec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);
  5177. vec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);
  5178. vec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);
  5179. vec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);
  5180. // . S .
  5181. // W M E
  5182. // . N .
  5183. bool earlyExit = max( max( max(
  5184. contrast( rgbaM, rgbaN ),
  5185. contrast( rgbaM, rgbaS ) ),
  5186. contrast( rgbaM, rgbaE ) ),
  5187. contrast( rgbaM, rgbaW ) )
  5188. < fxaaQualityEdgeThreshold;
  5189. // . 0 .
  5190. // 0 0 0
  5191. // . 0 .
  5192. #if (FXAA_DISCARD == 1)
  5193. if(earlyExit) FxaaDiscard;
  5194. #else
  5195. if(earlyExit) return rgbaM;
  5196. #endif
  5197. float contrastN = contrast( rgbaM, rgbaN );
  5198. float contrastS = contrast( rgbaM, rgbaS );
  5199. float contrastE = contrast( rgbaM, rgbaE );
  5200. float contrastW = contrast( rgbaM, rgbaW );
  5201. float relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );
  5202. relativeVContrast *= fxaaQualityinvEdgeThreshold;
  5203. bool horzSpan = relativeVContrast > 0.;
  5204. // . 1 .
  5205. // 0 0 0
  5206. // . 1 .
  5207. // 45 deg edge detection and corners of objects, aka V/H contrast is too similar
  5208. if( abs( relativeVContrast ) < .3 ) {
  5209. // locate the edge
  5210. vec2 dirToEdge;
  5211. dirToEdge.x = contrastE > contrastW ? 1. : -1.;
  5212. dirToEdge.y = contrastS > contrastN ? 1. : -1.;
  5213. // . 2 . . 1 .
  5214. // 1 0 2 ~= 0 0 1
  5215. // . 1 . . 0 .
  5216. // tap 2 pixels and see which ones are "outside" the edge, to
  5217. // determine if the edge is vertical or horizontal
  5218. vec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);
  5219. float matchAlongH = contrast( rgbaM, rgbaAlongH );
  5220. // . 1 .
  5221. // 0 0 1
  5222. // . 0 H
  5223. vec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);
  5224. float matchAlongV = contrast( rgbaM, rgbaAlongV );
  5225. // V 1 .
  5226. // 0 0 1
  5227. // . 0 .
  5228. relativeVContrast = matchAlongV - matchAlongH;
  5229. relativeVContrast *= fxaaQualityinvEdgeThreshold;
  5230. if( abs( relativeVContrast ) < .3 ) { // 45 deg edge
  5231. // 1 1 .
  5232. // 0 0 1
  5233. // . 0 1
  5234. // do a simple blur
  5235. return mix(
  5236. rgbaM,
  5237. (rgbaN + rgbaS + rgbaE + rgbaW) * .25,
  5238. .4
  5239. );
  5240. }
  5241. horzSpan = relativeVContrast > 0.;
  5242. }
  5243. if(!horzSpan) rgbaN = rgbaW;
  5244. if(!horzSpan) rgbaS = rgbaE;
  5245. // . 0 . 1
  5246. // 1 0 1 -> 0
  5247. // . 0 . 1
  5248. bool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );
  5249. if(!pairN) rgbaN = rgbaS;
  5250. vec2 offNP;
  5251. offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
  5252. offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
  5253. bool doneN = false;
  5254. bool doneP = false;
  5255. float nDist = 0.;
  5256. float pDist = 0.;
  5257. vec2 posN = posM;
  5258. vec2 posP = posM;
  5259. int iterationsUsed = 0;
  5260. int iterationsUsedN = 0;
  5261. int iterationsUsedP = 0;
  5262. for( int i = 0; i < NUM_SAMPLES; i++ ) {
  5263. iterationsUsed = i;
  5264. float increment = float(i + 1);
  5265. if(!doneN) {
  5266. nDist += increment;
  5267. posN = posM + offNP * nDist;
  5268. vec4 rgbaEndN = FxaaTexTop(tex, posN.xy);
  5269. doneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );
  5270. iterationsUsedN = i;
  5271. }
  5272. if(!doneP) {
  5273. pDist += increment;
  5274. posP = posM - offNP * pDist;
  5275. vec4 rgbaEndP = FxaaTexTop(tex, posP.xy);
  5276. doneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );
  5277. iterationsUsedP = i;
  5278. }
  5279. if(doneN || doneP) break;
  5280. }
  5281. if ( !doneP && !doneN ) return rgbaM; // failed to find end of edge
  5282. float dist = min(
  5283. doneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,
  5284. doneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.
  5285. );
  5286. // hacky way of reduces blurriness of mostly diagonal edges
  5287. // but reduces AA quality
  5288. dist = pow(dist, .5);
  5289. dist = 1. - dist;
  5290. return mix(
  5291. rgbaM,
  5292. rgbaN,
  5293. dist * .5
  5294. );
  5295. }
  5296. void main() {
  5297. const float edgeDetectionQuality = .2;
  5298. const float invEdgeDetectionQuality = 1. / edgeDetectionQuality;
  5299. gl_FragColor = FxaaPixelShader(
  5300. vUv,
  5301. tDiffuse,
  5302. resolution,
  5303. edgeDetectionQuality, // [0,1] contrast needed, otherwise early discard
  5304. invEdgeDetectionQuality
  5305. );
  5306. }
  5307. `},tH=`
  5308. varying vec2 vUv;
  5309. void main() {
  5310. vUv = uv;
  5311. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  5312. }
  5313. `,iH=`
  5314. uniform sampler2D baseTexture;
  5315. uniform sampler2D bloomTexture;
  5316. varying vec2 vUv;
  5317. void main() {
  5318. gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );
  5319. }
  5320. `,nH=u=>{const e=window.innerWidth||1,t=window.innerHeight||1,r={minFilter:Xs,magFilter:Xs,format:Dl,stencilBuffer:!1},c=new rl(e,t,r),p=new tb(u.renderer);p.renderToScreen=!1;const y=new AS(u.scene,u.camera),i=sH(p,u);p.addPass(y),p.addPass(i);const C=new tb(u.renderer,c),D=oH(p),R=rH(u);C.addPass(y),C.addPass(D),C.addPass(R);const Q=new tb(u.renderer),z=new AS(u.scene,u.camera),G=new qd(new Di(window.innerWidth,window.innerHeight),1.5,.4,.85);return Q.addPass(z),Q.addPass(G),{bloomComposer:p,finalComposer:C,composerOther:Q}};function rH(u){let e=new CB(eH);const t=u.renderer.getPixelRatio();return e.material.uniforms.resolution.value.x=1/(window.innerWidth*t),e.material.uniforms.resolution.value.y=1/(window.innerHeight*t),e.renderToScreen=!0,e.material.transparent=!0,e}function sH(u,e){var p;const t={exposure:1,bloomThreshold:.3,bloomStrength:1.5,bloomRadius:.1,scene:"Scene with Glow"},r=new qd(new Di(window.innerWidth,window.innerHeight),15e-5,4e-4,85e-5);r.threshold=t.bloomThreshold,r.strength=t.bloomStrength,r.radius=t.bloomRadius;const c=(p=e.gui)==null?void 0:p.addFolder("bloomPass");return c.add(t,"exposure",.1,2).onChange(function(y){e.renderer.toneMappingExposure=Math.pow(y,4)}),c.add(t,"bloomThreshold",0,1).onChange(function(y){r.threshold=Number(y)}),c.add(t,"bloomStrength",0,10).onChange(function(y){r.strength=Number(y)}),c.add(t,"bloomRadius",0,1).step(.01).onChange(function(y){r.radius=Number(y)}),r}function oH(u){const e=new ko({uniforms:{baseTexture:{value:null},bloomTexture:{value:u.renderTarget2.texture}},vertexShader:tH,fragmentShader:iH,defines:{}}),t=new CB(e,"baseTexture");return t.needsSwap=!0,t}function aH(u,e,t){return r=>{(r.isMesh||r.isSprite)&&u.test(r.layers)===!1&&(r.isSprite?(e[r.uuid]=r.material,r.material=new py({color:"#000"})):(e[r.uuid]=r.material,r.material=t))}}function lH(u){return e=>{u[e.uuid]&&(e.material=u[e.uuid],delete u[e.uuid])}}const pS=u=>{const e=new uy;return e.set(u),e.currentLayerNum=u,e};class EB{constructor(e=0,t=0){EB.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,c=e.elements;return this.x=c[0]*t+c[3]*r+c[6],this.y=c[1]*t+c[4]*r+c[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),c=Math.sin(t),p=this.x-e.x,y=this.y-e.y;return this.x=p*r-y*c+e.x,this.y=p*c+y*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const fS={type:"change"},ib={type:"start"},mS={type:"end"};class cH extends Xu{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new ft,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:jp.ROTATE,MIDDLE:jp.DOLLY,RIGHT:jp.PAN},this.touches={ONE:Kp.ROTATE,TWO:Kp.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return i.phi},this.getAzimuthalAngle=function(){return i.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(at){at.addEventListener("keydown",kn),this._domElementKeyEvents=at},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(fS),r.update(),p=c.NONE},this.update=function(){const at=new ft,ii=new sl().setFromUnitVectors(e.up,new ft(0,1,0)),hn=ii.clone().invert(),Xi=new ft,on=new sl,Cn=2*Math.PI;return function(){const nr=r.object.position;at.copy(nr).sub(r.target),at.applyQuaternion(ii),i.setFromVector3(at),r.autoRotate&&p===c.NONE&&Ge(Je()),r.enableDamping?(i.theta+=C.theta*r.dampingFactor,i.phi+=C.phi*r.dampingFactor):(i.theta+=C.theta,i.phi+=C.phi);let Ii=r.minAzimuthAngle,bn=r.maxAzimuthAngle;return isFinite(Ii)&&isFinite(bn)&&(Ii<-Math.PI?Ii+=Cn:Ii>Math.PI&&(Ii-=Cn),bn<-Math.PI?bn+=Cn:bn>Math.PI&&(bn-=Cn),Ii<=bn?i.theta=Math.max(Ii,Math.min(bn,i.theta)):i.theta=i.theta>(Ii+bn)/2?Math.max(Ii,i.theta):Math.min(bn,i.theta)),i.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,i.phi)),i.makeSafe(),i.radius*=D,i.radius=Math.max(r.minDistance,Math.min(r.maxDistance,i.radius)),r.enableDamping===!0?r.target.addScaledVector(R,r.dampingFactor):r.target.add(R),at.setFromSpherical(i),at.applyQuaternion(hn),nr.copy(r.target).add(at),r.object.lookAt(r.target),r.enableDamping===!0?(C.theta*=1-r.dampingFactor,C.phi*=1-r.dampingFactor,R.multiplyScalar(1-r.dampingFactor)):(C.set(0,0,0),R.set(0,0,0)),D=1,Q||Xi.distanceToSquared(r.object.position)>y||8*(1-on.dot(r.object.quaternion))>y?(r.dispatchEvent(fS),Xi.copy(r.object.position),on.copy(r.object.quaternion),Q=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",ti),r.domElement.removeEventListener("pointerdown",Xt),r.domElement.removeEventListener("pointercancel",Gi),r.domElement.removeEventListener("wheel",Gn),r.domElement.removeEventListener("pointermove",_i),r.domElement.removeEventListener("pointerup",fi),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",kn)};const r=this,c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let p=c.NONE;const y=1e-6,i=new m2,C=new m2;let D=1;const R=new ft;let Q=!1;const z=new Di,G=new Di,J=new Di,Y=new Di,B=new Di,ae=new Di,ce=new Di,Ae=new Di,we=new Di,me=[],De={};function Je(){return 2*Math.PI/60/60*r.autoRotateSpeed}function Fe(){return Math.pow(.95,r.zoomSpeed)}function Ge(at){C.theta-=at}function Et(at){C.phi-=at}const li=function(){const at=new ft;return function(hn,Xi){at.setFromMatrixColumn(Xi,0),at.multiplyScalar(-hn),R.add(at)}}(),xi=function(){const at=new ft;return function(hn,Xi){r.screenSpacePanning===!0?at.setFromMatrixColumn(Xi,1):(at.setFromMatrixColumn(Xi,0),at.crossVectors(r.object.up,at)),at.multiplyScalar(hn),R.add(at)}}(),te=function(){const at=new ft;return function(hn,Xi){const on=r.domElement;if(r.object.isPerspectiveCamera){const Cn=r.object.position;at.copy(Cn).sub(r.target);let Tn=at.length();Tn*=Math.tan(r.object.fov/2*Math.PI/180),li(2*hn*Tn/on.clientHeight,r.object.matrix),xi(2*Xi*Tn/on.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(li(hn*(r.object.right-r.object.left)/r.object.zoom/on.clientWidth,r.object.matrix),xi(Xi*(r.object.top-r.object.bottom)/r.object.zoom/on.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function le(at){r.object.isPerspectiveCamera?D/=at:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*at)),r.object.updateProjectionMatrix(),Q=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function ye(at){r.object.isPerspectiveCamera?D*=at:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/at)),r.object.updateProjectionMatrix(),Q=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function xe(at){z.set(at.clientX,at.clientY)}function Re(at){ce.set(at.clientX,at.clientY)}function Oe(at){Y.set(at.clientX,at.clientY)}function We(at){G.set(at.clientX,at.clientY),J.subVectors(G,z).multiplyScalar(r.rotateSpeed);const ii=r.domElement;Ge(2*Math.PI*J.x/ii.clientHeight),Et(2*Math.PI*J.y/ii.clientHeight),z.copy(G),r.update()}function Ve(at){Ae.set(at.clientX,at.clientY),we.subVectors(Ae,ce),we.y>0?le(Fe()):we.y<0&&ye(Fe()),ce.copy(Ae),r.update()}function Qe(at){B.set(at.clientX,at.clientY),ae.subVectors(B,Y).multiplyScalar(r.panSpeed),te(ae.x,ae.y),Y.copy(B),r.update()}function Se(at){at.deltaY<0?ye(Fe()):at.deltaY>0&&le(Fe()),r.update()}function Ke(at){let ii=!1;switch(at.code){case r.keys.UP:at.ctrlKey||at.metaKey||at.shiftKey?Et(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(0,r.keyPanSpeed),ii=!0;break;case r.keys.BOTTOM:at.ctrlKey||at.metaKey||at.shiftKey?Et(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(0,-r.keyPanSpeed),ii=!0;break;case r.keys.LEFT:at.ctrlKey||at.metaKey||at.shiftKey?Ge(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(r.keyPanSpeed,0),ii=!0;break;case r.keys.RIGHT:at.ctrlKey||at.metaKey||at.shiftKey?Ge(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):te(-r.keyPanSpeed,0),ii=!0;break}ii&&(at.preventDefault(),r.update())}function nt(){if(me.length===1)z.set(me[0].pageX,me[0].pageY);else{const at=.5*(me[0].pageX+me[1].pageX),ii=.5*(me[0].pageY+me[1].pageY);z.set(at,ii)}}function vt(){if(me.length===1)Y.set(me[0].pageX,me[0].pageY);else{const at=.5*(me[0].pageX+me[1].pageX),ii=.5*(me[0].pageY+me[1].pageY);Y.set(at,ii)}}function be(){const at=me[0].pageX-me[1].pageX,ii=me[0].pageY-me[1].pageY,hn=Math.sqrt(at*at+ii*ii);ce.set(0,hn)}function At(){r.enableZoom&&be(),r.enablePan&&vt()}function ut(){r.enableZoom&&be(),r.enableRotate&&nt()}function Nt(at){if(me.length==1)G.set(at.pageX,at.pageY);else{const hn=$t(at),Xi=.5*(at.pageX+hn.x),on=.5*(at.pageY+hn.y);G.set(Xi,on)}J.subVectors(G,z).multiplyScalar(r.rotateSpeed);const ii=r.domElement;Ge(2*Math.PI*J.x/ii.clientHeight),Et(2*Math.PI*J.y/ii.clientHeight),z.copy(G)}function Gt(at){if(me.length===1)B.set(at.pageX,at.pageY);else{const ii=$t(at),hn=.5*(at.pageX+ii.x),Xi=.5*(at.pageY+ii.y);B.set(hn,Xi)}ae.subVectors(B,Y).multiplyScalar(r.panSpeed),te(ae.x,ae.y),Y.copy(B)}function Qt(at){const ii=$t(at),hn=at.pageX-ii.x,Xi=at.pageY-ii.y,on=Math.sqrt(hn*hn+Xi*Xi);Ae.set(0,on),we.set(0,Math.pow(Ae.y/ce.y,r.zoomSpeed)),le(we.y),ce.copy(Ae)}function Ct(at){r.enableZoom&&Qt(at),r.enablePan&&Gt(at)}function Ft(at){r.enableZoom&&Qt(at),r.enableRotate&&Nt(at)}function Xt(at){r.enabled!==!1&&(me.length===0&&(r.domElement.setPointerCapture(at.pointerId),r.domElement.addEventListener("pointermove",_i),r.domElement.addEventListener("pointerup",fi)),Ni(at),at.pointerType==="touch"?yt(at):wn(at))}function _i(at){r.enabled!==!1&&(at.pointerType==="touch"?rt(at):zi(at))}function fi(at){qi(at),me.length===0&&(r.domElement.releasePointerCapture(at.pointerId),r.domElement.removeEventListener("pointermove",_i),r.domElement.removeEventListener("pointerup",fi)),r.dispatchEvent(mS),p=c.NONE}function Gi(at){qi(at)}function wn(at){let ii;switch(at.button){case 0:ii=r.mouseButtons.LEFT;break;case 1:ii=r.mouseButtons.MIDDLE;break;case 2:ii=r.mouseButtons.RIGHT;break;default:ii=-1}switch(ii){case jp.DOLLY:if(r.enableZoom===!1)return;Re(at),p=c.DOLLY;break;case jp.ROTATE:if(at.ctrlKey||at.metaKey||at.shiftKey){if(r.enablePan===!1)return;Oe(at),p=c.PAN}else{if(r.enableRotate===!1)return;xe(at),p=c.ROTATE}break;case jp.PAN:if(at.ctrlKey||at.metaKey||at.shiftKey){if(r.enableRotate===!1)return;xe(at),p=c.ROTATE}else{if(r.enablePan===!1)return;Oe(at),p=c.PAN}break;default:p=c.NONE}p!==c.NONE&&r.dispatchEvent(ib)}function zi(at){switch(p){case c.ROTATE:if(r.enableRotate===!1)return;We(at);break;case c.DOLLY:if(r.enableZoom===!1)return;Ve(at);break;case c.PAN:if(r.enablePan===!1)return;Qe(at);break}}function Gn(at){r.enabled===!1||r.enableZoom===!1||p!==c.NONE||(at.preventDefault(),r.dispatchEvent(ib),Se(at),r.dispatchEvent(mS))}function kn(at){r.enabled===!1||r.enablePan===!1||Ke(at)}function yt(at){switch(en(at),me.length){case 1:switch(r.touches.ONE){case Kp.ROTATE:if(r.enableRotate===!1)return;nt(),p=c.TOUCH_ROTATE;break;case Kp.PAN:if(r.enablePan===!1)return;vt(),p=c.TOUCH_PAN;break;default:p=c.NONE}break;case 2:switch(r.touches.TWO){case Kp.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;At(),p=c.TOUCH_DOLLY_PAN;break;case Kp.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ut(),p=c.TOUCH_DOLLY_ROTATE;break;default:p=c.NONE}break;default:p=c.NONE}p!==c.NONE&&r.dispatchEvent(ib)}function rt(at){switch(en(at),p){case c.TOUCH_ROTATE:if(r.enableRotate===!1)return;Nt(at),r.update();break;case c.TOUCH_PAN:if(r.enablePan===!1)return;Gt(at),r.update();break;case c.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ct(at),r.update();break;case c.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ft(at),r.update();break;default:p=c.NONE}}function ti(at){r.enabled!==!1&&at.preventDefault()}function Ni(at){me.push(at)}function qi(at){delete De[at.pointerId];for(let ii=0;ii<me.length;ii++)if(me[ii].pointerId==at.pointerId){me.splice(ii,1);return}}function en(at){let ii=De[at.pointerId];ii===void 0&&(ii=new Di,De[at.pointerId]=ii),ii.set(at.pageX,at.pageY)}function $t(at){const ii=at.pointerId===me[0].pointerId?me[1]:me[0];return De[ii.pointerId]}r.domElement.addEventListener("contextmenu",ti),r.domElement.addEventListener("pointerdown",Xt),r.domElement.addEventListener("pointercancel",Gi),r.domElement.addEventListener("wheel",Gn,{passive:!1}),this.update()}}class hH extends ls{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const Tm=new ft,gS=new ar,_S=new ar,yS=new ft,xS=new ft;class uH{constructor(e={}){const t=this;let r,c,p,y;const i={objects:new WeakMap},C=e.element!==void 0?e.element:document.createElement("div");C.style.overflow="hidden",this.domElement=C,this.getSize=function(){return{width:r,height:c}},this.render=function(G,J){G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),J.parent===null&&J.matrixWorldAutoUpdate===!0&&J.updateMatrixWorld(),gS.copy(J.matrixWorldInverse),_S.multiplyMatrices(J.projectionMatrix,gS),D(G,G,J),z(G)},this.setSize=function(G,J){r=G,c=J,p=r/2,y=c/2,C.style.width=G+"px",C.style.height=J+"px"};function D(G,J,Y){if(G.isCSS2DObject){Tm.setFromMatrixPosition(G.matrixWorld),Tm.applyMatrix4(_S);const B=G.visible===!0&&Tm.z>=-1&&Tm.z<=1&&G.layers.test(Y.layers)===!0;if(G.element.style.display=B===!0?"":"none",B===!0){G.onBeforeRender(t,J,Y);const ce=G.element;ce.style.transform="translate(-50%,-50%) translate("+(Tm.x*p+p)+"px,"+(-Tm.y*y+y)+"px)",ce.parentNode!==C&&C.appendChild(ce),G.onAfterRender(t,J,Y)}const ae={distanceToCameraSquared:R(Y,G)};i.objects.set(G,ae)}for(let B=0,ae=G.children.length;B<ae;B++)D(G.children[B],J,Y)}function R(G,J){return yS.setFromMatrixPosition(G.matrixWorld),xS.setFromMatrixPosition(J.matrixWorld),yS.distanceToSquared(xS)}function Q(G){const J=[];return G.traverse(function(Y){Y.isCSS2DObject&&J.push(Y)}),J}function z(G){const J=Q(G).sort(function(B,ae){if(B.renderOrder!==ae.renderOrder)return ae.renderOrder-B.renderOrder;const ce=i.objects.get(B).distanceToCameraSquared,Ae=i.objects.get(ae).distanceToCameraSquared;return ce-Ae}),Y=J.length;for(let B=0,ae=J.length;B<ae;B++)J[B].element.style.zIndex=Y-B}}}En.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Di(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Fl.line={uniforms:mf.merge([En.common,En.fog,En.line]),vertexShader:`
  5321. #include <common>
  5322. #include <color_pars_vertex>
  5323. #include <fog_pars_vertex>
  5324. #include <logdepthbuf_pars_vertex>
  5325. #include <clipping_planes_pars_vertex>
  5326. uniform float linewidth;
  5327. uniform vec2 resolution;
  5328. attribute vec3 instanceStart;
  5329. attribute vec3 instanceEnd;
  5330. attribute vec3 instanceColorStart;
  5331. attribute vec3 instanceColorEnd;
  5332. #ifdef WORLD_UNITS
  5333. varying vec4 worldPos;
  5334. varying vec3 worldStart;
  5335. varying vec3 worldEnd;
  5336. #ifdef USE_DASH
  5337. varying vec2 vUv;
  5338. #endif
  5339. #else
  5340. varying vec2 vUv;
  5341. #endif
  5342. #ifdef USE_DASH
  5343. uniform float dashScale;
  5344. attribute float instanceDistanceStart;
  5345. attribute float instanceDistanceEnd;
  5346. varying float vLineDistance;
  5347. #endif
  5348. void trimSegment( const in vec4 start, inout vec4 end ) {
  5349. // trim end segment so it terminates between the camera plane and the near plane
  5350. // conservative estimate of the near plane
  5351. float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
  5352. float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
  5353. float nearEstimate = - 0.5 * b / a;
  5354. float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
  5355. end.xyz = mix( start.xyz, end.xyz, alpha );
  5356. }
  5357. void main() {
  5358. #ifdef USE_COLOR
  5359. vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
  5360. #endif
  5361. #ifdef USE_DASH
  5362. vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
  5363. vUv = uv;
  5364. #endif
  5365. float aspect = resolution.x / resolution.y;
  5366. // camera space
  5367. vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
  5368. vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
  5369. #ifdef WORLD_UNITS
  5370. worldStart = start.xyz;
  5371. worldEnd = end.xyz;
  5372. #else
  5373. vUv = uv;
  5374. #endif
  5375. // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
  5376. // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
  5377. // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
  5378. // perhaps there is a more elegant solution -- WestLangley
  5379. bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
  5380. if ( perspective ) {
  5381. if ( start.z < 0.0 && end.z >= 0.0 ) {
  5382. trimSegment( start, end );
  5383. } else if ( end.z < 0.0 && start.z >= 0.0 ) {
  5384. trimSegment( end, start );
  5385. }
  5386. }
  5387. // clip space
  5388. vec4 clipStart = projectionMatrix * start;
  5389. vec4 clipEnd = projectionMatrix * end;
  5390. // ndc space
  5391. vec3 ndcStart = clipStart.xyz / clipStart.w;
  5392. vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
  5393. // direction
  5394. vec2 dir = ndcEnd.xy - ndcStart.xy;
  5395. // account for clip-space aspect ratio
  5396. dir.x *= aspect;
  5397. dir = normalize( dir );
  5398. #ifdef WORLD_UNITS
  5399. // get the offset direction as perpendicular to the view vector
  5400. vec3 worldDir = normalize( end.xyz - start.xyz );
  5401. vec3 offset;
  5402. if ( position.y < 0.5 ) {
  5403. offset = normalize( cross( start.xyz, worldDir ) );
  5404. } else {
  5405. offset = normalize( cross( end.xyz, worldDir ) );
  5406. }
  5407. // sign flip
  5408. if ( position.x < 0.0 ) offset *= - 1.0;
  5409. float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
  5410. // don't extend the line if we're rendering dashes because we
  5411. // won't be rendering the endcaps
  5412. #ifndef USE_DASH
  5413. // extend the line bounds to encompass endcaps
  5414. start.xyz += - worldDir * linewidth * 0.5;
  5415. end.xyz += worldDir * linewidth * 0.5;
  5416. // shift the position of the quad so it hugs the forward edge of the line
  5417. offset.xy -= dir * forwardOffset;
  5418. offset.z += 0.5;
  5419. #endif
  5420. // endcaps
  5421. if ( position.y > 1.0 || position.y < 0.0 ) {
  5422. offset.xy += dir * 2.0 * forwardOffset;
  5423. }
  5424. // adjust for linewidth
  5425. offset *= linewidth * 0.5;
  5426. // set the world position
  5427. worldPos = ( position.y < 0.5 ) ? start : end;
  5428. worldPos.xyz += offset;
  5429. // project the worldpos
  5430. vec4 clip = projectionMatrix * worldPos;
  5431. // shift the depth of the projected points so the line
  5432. // segments overlap neatly
  5433. vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
  5434. clip.z = clipPose.z * clip.w;
  5435. #else
  5436. vec2 offset = vec2( dir.y, - dir.x );
  5437. // undo aspect ratio adjustment
  5438. dir.x /= aspect;
  5439. offset.x /= aspect;
  5440. // sign flip
  5441. if ( position.x < 0.0 ) offset *= - 1.0;
  5442. // endcaps
  5443. if ( position.y < 0.0 ) {
  5444. offset += - dir;
  5445. } else if ( position.y > 1.0 ) {
  5446. offset += dir;
  5447. }
  5448. // adjust for linewidth
  5449. offset *= linewidth;
  5450. // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
  5451. offset /= resolution.y;
  5452. // select end
  5453. vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
  5454. // back to clip space
  5455. offset *= clip.w;
  5456. clip.xy += offset;
  5457. #endif
  5458. gl_Position = clip;
  5459. vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
  5460. #include <logdepthbuf_vertex>
  5461. #include <clipping_planes_vertex>
  5462. #include <fog_vertex>
  5463. }
  5464. `,fragmentShader:`
  5465. uniform vec3 diffuse;
  5466. uniform float opacity;
  5467. uniform float linewidth;
  5468. #ifdef USE_DASH
  5469. uniform float dashOffset;
  5470. uniform float dashSize;
  5471. uniform float gapSize;
  5472. #endif
  5473. varying float vLineDistance;
  5474. #ifdef WORLD_UNITS
  5475. varying vec4 worldPos;
  5476. varying vec3 worldStart;
  5477. varying vec3 worldEnd;
  5478. #ifdef USE_DASH
  5479. varying vec2 vUv;
  5480. #endif
  5481. #else
  5482. varying vec2 vUv;
  5483. #endif
  5484. #include <common>
  5485. #include <color_pars_fragment>
  5486. #include <fog_pars_fragment>
  5487. #include <logdepthbuf_pars_fragment>
  5488. #include <clipping_planes_pars_fragment>
  5489. vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
  5490. float mua;
  5491. float mub;
  5492. vec3 p13 = p1 - p3;
  5493. vec3 p43 = p4 - p3;
  5494. vec3 p21 = p2 - p1;
  5495. float d1343 = dot( p13, p43 );
  5496. float d4321 = dot( p43, p21 );
  5497. float d1321 = dot( p13, p21 );
  5498. float d4343 = dot( p43, p43 );
  5499. float d2121 = dot( p21, p21 );
  5500. float denom = d2121 * d4343 - d4321 * d4321;
  5501. float numer = d1343 * d4321 - d1321 * d4343;
  5502. mua = numer / denom;
  5503. mua = clamp( mua, 0.0, 1.0 );
  5504. mub = ( d1343 + d4321 * ( mua ) ) / d4343;
  5505. mub = clamp( mub, 0.0, 1.0 );
  5506. return vec2( mua, mub );
  5507. }
  5508. void main() {
  5509. #include <clipping_planes_fragment>
  5510. #ifdef USE_DASH
  5511. if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
  5512. if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
  5513. #endif
  5514. float alpha = opacity;
  5515. #ifdef WORLD_UNITS
  5516. // Find the closest points on the view ray and the line segment
  5517. vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
  5518. vec3 lineDir = worldEnd - worldStart;
  5519. vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
  5520. vec3 p1 = worldStart + lineDir * params.x;
  5521. vec3 p2 = rayEnd * params.y;
  5522. vec3 delta = p1 - p2;
  5523. float len = length( delta );
  5524. float norm = len / linewidth;
  5525. #ifndef USE_DASH
  5526. #ifdef USE_ALPHA_TO_COVERAGE
  5527. float dnorm = fwidth( norm );
  5528. alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
  5529. #else
  5530. if ( norm > 0.5 ) {
  5531. discard;
  5532. }
  5533. #endif
  5534. #endif
  5535. #else
  5536. #ifdef USE_ALPHA_TO_COVERAGE
  5537. // artifacts appear on some hardware if a derivative is taken within a conditional
  5538. float a = vUv.x;
  5539. float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
  5540. float len2 = a * a + b * b;
  5541. float dlen = fwidth( len2 );
  5542. if ( abs( vUv.y ) > 1.0 ) {
  5543. alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
  5544. }
  5545. #else
  5546. if ( abs( vUv.y ) > 1.0 ) {
  5547. float a = vUv.x;
  5548. float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
  5549. float len2 = a * a + b * b;
  5550. if ( len2 > 1.0 ) discard;
  5551. }
  5552. #endif
  5553. #endif
  5554. vec4 diffuseColor = vec4( diffuse, alpha );
  5555. #include <logdepthbuf_fragment>
  5556. #include <color_fragment>
  5557. gl_FragColor = vec4( diffuseColor.rgb, alpha );
  5558. #include <tonemapping_fragment>
  5559. #include <encodings_fragment>
  5560. #include <fog_fragment>
  5561. #include <premultiplied_alpha_fragment>
  5562. }
  5563. `};class Cv extends ko{constructor(e){super({type:"LineMaterial",uniforms:mf.clone(Fl.line.uniforms),vertexShader:Fl.line.vertexShader,fragmentShader:Fl.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const vS=new qu,zx=new ft;class KF extends _B{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(r),this.setAttribute("position",new jn(e,3)),this.setAttribute("uv",new jn(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const r=new _v(t,6,1);return this.setAttribute("instanceStart",new Dc(r,3,0)),this.setAttribute("instanceEnd",new Dc(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const r=new _v(t,6,1);return this.setAttribute("instanceColorStart",new Dc(r,3,0)),this.setAttribute("instanceColorEnd",new Dc(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new sB(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qu);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),vS.setFromBufferAttribute(t),this.boundingBox.union(vS))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new XA),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let c=0;for(let p=0,y=e.count;p<y;p++)zx.fromBufferAttribute(e,p),c=Math.max(c,r.distanceToSquared(zx)),zx.fromBufferAttribute(t,p),c=Math.max(c,r.distanceToSquared(zx));this.boundingSphere.radius=Math.sqrt(c),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class w2 extends KF{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,r=new Float32Array(2*t);for(let c=0;c<t;c+=3)r[2*c]=e[c],r[2*c+1]=e[c+1],r[2*c+2]=e[c+2],r[2*c+3]=e[c+3],r[2*c+4]=e[c+4],r[2*c+5]=e[c+5];return super.setPositions(r),this}setColors(e){const t=e.length-3,r=new Float32Array(2*t);for(let c=0;c<t;c+=3)r[2*c]=e[c],r[2*c+1]=e[c+1],r[2*c+2]=e[c+2],r[2*c+3]=e[c+3],r[2*c+4]=e[c+4],r[2*c+5]=e[c+5];return super.setColors(r),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}const wS=new ft,bS=new ft,Da=new as,Pa=new as,ku=new as,nb=new ft,rb=new ar,Ua=new EF,BS=new ft,kx=new qu,Ox=new XA,Ou=new as;let Qu,pf;function CS(u,e,t){return Ou.set(0,0,-e,1).applyMatrix4(u.projectionMatrix),Ou.multiplyScalar(1/Ou.w),Ou.x=pf/t.width,Ou.y=pf/t.height,Ou.applyMatrix4(u.projectionMatrixInverse),Ou.multiplyScalar(1/Ou.w),Math.abs(Math.max(Ou.x,Ou.y))}function AH(u,e){const t=u.matrixWorld,r=u.geometry,c=r.attributes.instanceStart,p=r.attributes.instanceEnd,y=Math.min(r.instanceCount,c.count);for(let i=0,C=y;i<C;i++){Ua.start.fromBufferAttribute(c,i),Ua.end.fromBufferAttribute(p,i),Ua.applyMatrix4(t);const D=new ft,R=new ft;Qu.distanceSqToSegment(Ua.start,Ua.end,R,D),R.distanceTo(D)<pf*.5&&e.push({point:R,pointOnLine:D,distance:Qu.origin.distanceTo(R),object:u,face:null,faceIndex:i,uv:null,uv2:null})}}function dH(u,e,t){const r=e.projectionMatrix,p=u.material.resolution,y=u.matrixWorld,i=u.geometry,C=i.attributes.instanceStart,D=i.attributes.instanceEnd,R=Math.min(i.instanceCount,C.count),Q=-e.near;Qu.at(1,ku),ku.w=1,ku.applyMatrix4(e.matrixWorldInverse),ku.applyMatrix4(r),ku.multiplyScalar(1/ku.w),ku.x*=p.x/2,ku.y*=p.y/2,ku.z=0,nb.copy(ku),rb.multiplyMatrices(e.matrixWorldInverse,y);for(let z=0,G=R;z<G;z++){if(Da.fromBufferAttribute(C,z),Pa.fromBufferAttribute(D,z),Da.w=1,Pa.w=1,Da.applyMatrix4(rb),Pa.applyMatrix4(rb),Da.z>Q&&Pa.z>Q)continue;if(Da.z>Q){const Ae=Da.z-Pa.z,we=(Da.z-Q)/Ae;Da.lerp(Pa,we)}else if(Pa.z>Q){const Ae=Pa.z-Da.z,we=(Pa.z-Q)/Ae;Pa.lerp(Da,we)}Da.applyMatrix4(r),Pa.applyMatrix4(r),Da.multiplyScalar(1/Da.w),Pa.multiplyScalar(1/Pa.w),Da.x*=p.x/2,Da.y*=p.y/2,Pa.x*=p.x/2,Pa.y*=p.y/2,Ua.start.copy(Da),Ua.start.z=0,Ua.end.copy(Pa),Ua.end.z=0;const Y=Ua.closestPointToPointParameter(nb,!0);Ua.at(Y,BS);const B=PI.lerp(Da.z,Pa.z,Y),ae=B>=-1&&B<=1,ce=nb.distanceTo(BS)<pf*.5;if(ae&&ce){Ua.start.fromBufferAttribute(C,z),Ua.end.fromBufferAttribute(D,z),Ua.start.applyMatrix4(y),Ua.end.applyMatrix4(y);const Ae=new ft,we=new ft;Qu.distanceSqToSegment(Ua.start,Ua.end,we,Ae),t.push({point:we,pointOnLine:Ae,distance:Qu.origin.distanceTo(we),object:u,face:null,faceIndex:z,uv:null,uv2:null})}}}class pH extends us{constructor(e=new KF,t=new Cv({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,c=new Float32Array(2*t.count);for(let y=0,i=0,C=t.count;y<C;y++,i+=2)wS.fromBufferAttribute(t,y),bS.fromBufferAttribute(r,y),c[i]=i===0?0:c[i-1],c[i+1]=c[i]+wS.distanceTo(bS);const p=new _v(c,2,1);return e.setAttribute("instanceDistanceStart",new Dc(p,1,0)),e.setAttribute("instanceDistanceEnd",new Dc(p,1,1)),this}raycast(e,t){const r=this.material.worldUnits,c=e.camera;c===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const p=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Qu=e.ray;const y=this.matrixWorld,i=this.geometry,C=this.material;pf=C.linewidth+p,i.boundingSphere===null&&i.computeBoundingSphere(),Ox.copy(i.boundingSphere).applyMatrix4(y);let D;if(r)D=pf*.5;else{const Q=Math.max(c.near,Ox.distanceToPoint(Qu.origin));D=CS(c,Q,C.resolution)}if(Ox.radius+=D,Qu.intersectsSphere(Ox)===!1)return;i.boundingBox===null&&i.computeBoundingBox(),kx.copy(i.boundingBox).applyMatrix4(y);let R;if(r)R=pf*.5;else{const Q=Math.max(c.near,kx.distanceToPoint(Qu.origin));R=CS(c,Q,C.resolution)}kx.expandByScalar(R),Qu.intersectsBox(kx)!==!1&&(r?AH(this,t):dH(this,c,t))}}class ES extends pH{constructor(e=new w2,t=new Cv({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const fH={version:8,glyphs:"//localhost/fonts/{fontstack}/{range}.pbf",sources:{openmaptiles:{type:"vector",url:JSON.stringify({tiles:["//localhost/data/v3/{z}/{x}/{y}.pbf"],name:"OpenMapTiles",format:"pbf",basename:"2017-07-03_planet_z0_z14.mbtiles",id:"openmaptiles",center:[-12.2168,28.6135,4],maxzoom:14,minzoom:0,pixel_scale:"256",vector_layers:[],version:"3.6.1",maskLevel:"8",bounds:[-180,-85.0511,180,85.0511],planettime:"1499040000000",tilejson:"2.0.0"})}},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(69,81,110,0.0)"}}]};/**
  5564. * lil-gui
  5565. * https://lil-gui.georgealways.com
  5566. * @version 0.17.0
  5567. * @author George Michael Brower
  5568. * @license MIT
  5569. */class Wu{constructor(e,t,r,c,p="div"){this.parent=e,this.object=t,this.property=r,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(c),this.$name=document.createElement("div"),this.$name.classList.add("name"),Wu.nextNameID=Wu.nextNameID||0,this.$name.id="lil-gui-name-"+ ++Wu.nextNameID,this.$widget=document.createElement(p),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(r)}name(e){return this._name=e,this.$name.innerHTML=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled||(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e)),this}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.object[this.property]=e,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class mH extends Wu{constructor(e,t,r){super(e,t,r,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function b2(u){let e,t;return(e=u.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=u.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=u.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!t&&"#"+t}const gH={isPrimitive:!0,match:u=>typeof u=="string",fromHexString:b2,toHexString:b2},sy={isPrimitive:!0,match:u=>typeof u=="number",fromHexString:u=>parseInt(u.substring(1),16),toHexString:u=>"#"+u.toString(16).padStart(6,0)},_H={isPrimitive:!1,match:Array.isArray,fromHexString(u,e,t=1){const r=sy.fromHexString(u);e[0]=(r>>16&255)/255*t,e[1]=(r>>8&255)/255*t,e[2]=(255&r)/255*t},toHexString:([u,e,t],r=1)=>sy.toHexString(u*(r=255/r)<<16^e*r<<8^t*r<<0)},yH={isPrimitive:!1,match:u=>Object(u)===u,fromHexString(u,e,t=1){const r=sy.fromHexString(u);e.r=(r>>16&255)/255*t,e.g=(r>>8&255)/255*t,e.b=(255&r)/255*t},toHexString:({r:u,g:e,b:t},r=1)=>sy.toHexString(u*(r=255/r)<<16^e*r<<8^t*r<<0)},xH=[gH,sy,_H,yH];class vH extends Wu{constructor(e,t,r,c){var p;super(e,t,r,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(p=this.initialValue,xH.find(y=>y.match(p))),this._rgbScale=c,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const y=b2(this.$text.value);y&&this._setValueFromHexString(y)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class sb extends Wu{constructor(e,t,r){super(e,t,r,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",c=>{c.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class wH extends Wu{constructor(e,t,r,c,p,y){super(e,t,r,"number"),this._initInput(),this.min(c),this.max(p);const i=y!==void 0;this.step(i?y:this._getImplicitStep(),i),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=R=>{const Q=parseFloat(this.$input.value);isNaN(Q)||(this._snapClampSetValue(Q+R),this.$input.value=this.getValue())};let t,r,c,p,y,i=!1;const C=R=>{if(i){const Q=R.clientX-t,z=R.clientY-r;Math.abs(z)>5?(R.preventDefault(),this.$input.blur(),i=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(Q)>5&&D()}if(!i){const Q=R.clientY-c;y-=Q*this._step*this._arrowKeyMultiplier(R),p+y>this._max?y=this._max-p:p+y<this._min&&(y=this._min-p),this._snapClampSetValue(p+y)}c=R.clientY},D=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",D)};this.$input.addEventListener("input",()=>{let R=parseFloat(this.$input.value);isNaN(R)||(this._stepExplicit&&(R=this._snap(R)),this.setValue(this._clamp(R)))}),this.$input.addEventListener("keydown",R=>{R.code==="Enter"&&this.$input.blur(),R.code==="ArrowUp"&&(R.preventDefault(),e(this._step*this._arrowKeyMultiplier(R))),R.code==="ArrowDown"&&(R.preventDefault(),e(this._step*this._arrowKeyMultiplier(R)*-1))}),this.$input.addEventListener("wheel",R=>{this._inputFocused&&(R.preventDefault(),e(this._step*this._normalizeMouseWheel(R)))},{passive:!1}),this.$input.addEventListener("mousedown",R=>{t=R.clientX,r=c=R.clientY,i=!0,p=this.getValue(),y=0,window.addEventListener("mousemove",C),window.addEventListener("mouseup",D)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=z=>{const G=this.$slider.getBoundingClientRect();let J=(Y=z,B=G.left,ae=G.right,ce=this._min,Ae=this._max,(Y-B)/(ae-B)*(Ae-ce)+ce);var Y,B,ae,ce,Ae;this._snapClampSetValue(J)},t=z=>{e(z.clientX)},r=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",r)};let c,p,y=!1;const i=z=>{z.preventDefault(),this._setDraggingStyle(!0),e(z.touches[0].clientX),y=!1},C=z=>{if(y){const G=z.touches[0].clientX-c,J=z.touches[0].clientY-p;Math.abs(G)>Math.abs(J)?i(z):(window.removeEventListener("touchmove",C),window.removeEventListener("touchend",D))}else z.preventDefault(),e(z.touches[0].clientX)},D=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",C),window.removeEventListener("touchend",D)},R=this._callOnFinishChange.bind(this);let Q;this.$slider.addEventListener("mousedown",z=>{this._setDraggingStyle(!0),e(z.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",r)}),this.$slider.addEventListener("touchstart",z=>{z.touches.length>1||(this._hasScrollBar?(c=z.touches[0].clientX,p=z.touches[0].clientY,y=!0):i(z),window.addEventListener("touchmove",C,{passive:!1}),window.addEventListener("touchend",D))},{passive:!1}),this.$slider.addEventListener("wheel",z=>{if(Math.abs(z.deltaX)<Math.abs(z.deltaY)&&this._hasScrollBar)return;z.preventDefault();const G=this._normalizeMouseWheel(z)*this._step;this._snapClampSetValue(this.getValue()+G),this.$input.value=this.getValue(),clearTimeout(Q),Q=setTimeout(R,400)},{passive:!1})}_setDraggingStyle(e,t="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle("lil-gui-"+t,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:t,deltaY:r}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(t=0,r=-e.wheelDelta/120,r*=this._stepExplicit?1:10),t+-r}_arrowKeyMultiplier(e){let t=this._stepExplicit?1:10;return e.shiftKey?t*=10:e.altKey&&(t/=10),t}_snap(e){const t=Math.round(e/this._step)*this._step;return parseFloat(t.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class bH extends Wu{constructor(e,t,r,c){super(e,t,r,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(c)?c:Object.values(c),this._names=Array.isArray(c)?c:Object.keys(c),this._names.forEach(p=>{const y=document.createElement("option");y.innerHTML=p,this.$select.appendChild(y)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}}class BH extends Wu{constructor(e,t,r){super(e,t,r,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",c=>{c.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let TS=!1;class TB{constructor({parent:e,autoPlace:t=e===void 0,container:r,width:c,title:p="Controls",injectStyles:y=!0,touchStyles:i=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",C=>{C.code!=="Enter"&&C.code!=="Space"||(C.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(p),i&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!TS&&y&&(function(C){const D=document.createElement("style");D.innerHTML=C;const R=document.querySelector("head link[rel=stylesheet], head style");R?document.head.insertBefore(D,R):document.head.appendChild(D)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"\u2195";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"\u25BE";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"\u25B8"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"\u2713";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),TS=!0),r?r.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),c&&this.domElement.style.setProperty("--width",c+"px"),this.domElement.addEventListener("keydown",C=>C.stopPropagation()),this.domElement.addEventListener("keyup",C=>C.stopPropagation())}add(e,t,r,c,p){if(Object(r)===r)return new bH(this,e,t,r);const y=e[t];switch(typeof y){case"number":return new wH(this,e,t,r,c,p);case"boolean":return new mH(this,e,t);case"string":return new BH(this,e,t);case"function":return new sb(this,e,t)}console.error(`gui.add failed
  5570. property:`,t,`
  5571. object:`,e,`
  5572. value:`,y)}addColor(e,t,r=1){return new vH(this,e,t,r)}addFolder(e){return new TB({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(r=>{r instanceof sb||r._name in e.controllers&&r.load(e.controllers[r._name])}),t&&e.folders&&this.folders.forEach(r=>{r._title in e.folders&&r.load(e.folders[r._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(r=>{if(!(r instanceof sb)){if(r._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${r._name}"`);t.controllers[r._name]=r.save()}}),e&&this.folders.forEach(r=>{if(r._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${r._title}"`);t.folders[r._title]=r.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const r=p=>{p.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",r))};this.$children.addEventListener("transitionend",r);const c=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=c+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}function ob(u,e){return function(){u.side=parseInt(u.side),u.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.normal.needsUpdate=!0,e.attributes.color.needsUpdate=!0}}window.THREE=PF;window.maplibre=bR;const tf=class{constructor(){Qi(this,"containerDom");Qi(this,"_s",1.5);Qi(this,"map");Qi(this,"THREE",PF);Qi(this,"meterUnit");Qi(this,"computeRatio",1e4);Qi(this,"mapConfig",{container:null,style:fH,center:{lng:126.89350996267854,lat:42.87516601384456},zoom:6.848587811931847,pitch:60,maxBounds:[[-179,-85],[179,85]],antialias:!0});Qi(this,"camera");Qi(this,"cameraTransform");Qi(this,"scene");Qi(this,"renderer");Qi(this,"labelRenderer");Qi(this,"gui");Qi(this,"controls");Qi(this,"effectComposer");Qi(this,"clock");Qi(this,"zoomScale");Qi(this,"objGroup",new Hs);Qi(this,"lightGroup",new Hs);Qi(this,"helperGroup",new Hs);Qi(this,"usefulObjGroup",new Hs);Qi(this,"cityMarkerGroup",new Hs);Qi(this,"flyLineGroup",new Hs);Qi(this,"tubeGroup",new Hs);Qi(this,"labelGroup",new Hs);Qi(this,"tubeMirrorGroup",new Hs);Qi(this,"mirrorGroup",new Hs);Qi(this,"basicRenderLayer",pS(0));Qi(this,"bloomRenderLayer",pS(2));Qi(this,"centerPosition",[119.71302336052571,31.74532248901521]);Qi(this,"depth",5e4);Qi(this,"canTouchMesh",[]);Qi(this,"markerList",[{name:"\u6D59\u6C5F",text:"\u6D59\u6C5F",position:[120.083297793,29.178829535]},{name:"\u676D\u5DDE",text:"\u676D\u5DDE",position:[120.19,30.26]},{name:"\u4E91\u5357",text:"\u4E91\u5357",position:[101.485787956,24.975218524]},{name:"\u65B0\u7586",text:"\u65B0\u7586",position:[85.209356427,41.118465291]},{name:"\u5185\u8499\u53E4",text:"\u5185\u8499\u53E4",position:[113.94832120696813,43.095300371726864]}]);Qi(this,"LineData",[{fromName:"\u65B0\u7586",toName:"\u6D59\u6C5F",describe:""},{fromName:"\u65B0\u7586",toName:"\u676D\u5DDE",describe:""},{fromName:"\u5185\u8499\u53E4",toName:"\u676D\u5DDE",describe:""}]);Qi(this,"uniforms_of_geojson",{iTime:{type:"f",value:0},opacity:{type:"f",value:1}});Qi(this,"uniforms",{iTime:{type:"f",value:1}});Qi(this,"users",{});Qi(this,"config",{});Qi(this,"mouseLocation",yv.exports.observable({lngLat:{lng:this.centerPosition[0],lat:this.centerPosition[1]}}));Qi(this,"modelHigherZ",8e-4);Qi(this,"modelTopZ",6e-4);Qi(this,"modelMiddleZ",48e-5);Qi(this,"modelBottomZ",2e-4);Qi(this,"renderType");window.threeMap=this,this.cityMarkerGroup.name="CityMarker_Group",this.usefulObjGroup.name="Userful_Group",this.lightGroup.name="Light_Group",this.helperGroup.name="Helper_Group",this.objGroup.name="Obj_Group",this.flyLineGroup.name="FlyLine_Group",this.flyLineGroup.position.z=this.modelHigherZ,this.tubeGroup.name="Tube_Group",this.tubeGroup.position.z=this.modelHigherZ,this.labelGroup.name="Label_Group",this.mirrorGroup.name="Mirror_Group",this.tubeMirrorGroup.name="Mirror_Group",this.usefulObjGroup.add(this.cityMarkerGroup),this.usefulObjGroup.add(this.flyLineGroup),this.usefulObjGroup.add(this.tubeGroup),this.usefulObjGroup.add(this.labelGroup),this.objGroup.add(this.mirrorGroup),this.objGroup.add(this.tubeMirrorGroup),this.objGroup.add(this.helperGroup),this.objGroup.add(this.lightGroup),this.objGroup.add(this.usefulObjGroup),window.is=this,window.addEventListener("resize",this.onWindowResize.bind(this),!1)}static GetInstance(){return tf._instance==null&&(tf._instance=new tf),tf._instance}onWindowResize(){var e,t,r,c,p,y,i;(e=this.map)==null||e.resize(),(t=this.labelRenderer)==null||t.setSize(window.innerWidth,window.innerHeight),(r=this.renderer)==null||r.setSize(window.innerWidth,window.innerHeight),(p=(c=this.effectComposer)==null?void 0:c.bloomComposer)==null||p.setSize(window.innerWidth,window.innerHeight),(i=(y=this.effectComposer)==null?void 0:y.finalComposer)==null||i.setSize(window.innerWidth,window.innerHeight)}async Bootstrap(e,t){return this.renderType=t,new Promise(async r=>{fetch("/gis/static/threeMap/set.json").then(c=>c.json()).then(c=>{if(c&&(this.mapConfig=c.map),!e)throw new Error("\u5BB9\u5668\u4E0D\u5B58\u5728");return this.containerDom=document.querySelector(e),t==="map"?(this.mapConfig.container=this.containerDom,Ml.exports.accessToken="pk.eyJ1IjoiaWFtc2VlIiwiYSI6ImNrMWxsZzlnbjA2Ym8zbnBjenA5d2c1ZzAifQ.Y0cmxYFTIIAlHi2eBApGsg",this.map=new Ml.exports.Map(Object.assign(this.mapConfig,{})),this.map.on("load",async()=>{this.freshZoomScale(),await this.initThreeLayer(),r(this)})):t==="threejs"&&(this.initThreeCtx(),this.renderThreeCtx(),r(this)),window.map=this,parent.window.map=this,this})})}addUITempalte(){const t=KV(`
  5573. <div id="mouse-location" data-bind="text:mouseLocation().lngLat.lng + ',' + mouseLocation().lngLat.lat"
  5574. class="pointer-events-none"
  5575. style="position: absolute;left:4px;bottom:2px;background-color: #000000;box-shadow: 0 -4px 0 -4px white;
  5576. color: white; padding: 4px 4px;display: flex;align-items: center;justify-content: center;
  5577. line-height: 1;border-radius: 2px;font-weight: bold;font-size: 14px">
  5578. </div>
  5579. `),r=Array.from(t.childNodes).filter(c=>c.nodeType===1||c.nodeType===8);this.containerDom.append(t),r.forEach(c=>{yv.exports.applyBindings(this,c)})}getLocation(){let e={lng:null,lat:null,source:null};return new Promise((t,r)=>{if("geolocation"in navigator){let p={enableHighAccuracy:!0,maximumAge:0,timeout:6e3};navigator.geolocation.getCurrentPosition(y=>{e.lng=y.coords.longitude,e.lat=y.coords.latitude,e.source="browser",t(e)},function(y){console.warn("\u83B7\u53D6\u4F4D\u7F6E\u5931\u8D25\uFF1A"+y.message)},p)}else r("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u83B7\u53D6\u5730\u7406\u4F4D\u7F6E");(()=>{const p="soSkgyGBsSKvMuLcvwhoMXVkaLU43y3X";let y=document.createElement("script");y.src=`https://api.map.baidu.com/api?v=3.0&ak=${p}&callback=baiduApiInit`,document.body.appendChild(y),window.baiduApiInit=function(){const i=window.BMap;i.AK=p,new i.Geolocation().getCurrentPosition(function(D){if(this.getStatus()===(window==null?void 0:window.BMAP_STATUS_SUCCESS)){const R=eb.transform([D.point.lng,D.point.lat],eb.BD09,eb.WGS84);e={lng:R[0],lat:R[1],source:"BMap"},t(e)}else console.warn("BMap failed:"+this.getStatus()),r("BMap failed:"+this.getStatus())})}})()})}freshZoomScale(){var t;let e=5.5/(((t=this.map)==null?void 0:t.getZoom())||1);e=e*e,this.zoomScale=e>12?12:e}initThreeLayer(){return new Promise(e=>{const t={id:"threejs_base_layer",type:"custom",renderingMode:"3d",onAdd:(r,c)=>{this.initThreeCtx(r,c),e(!0)},render:(r,c)=>{this.renderThreeCtx(c)}};this.map.addLayer(t)})}initThreeCtx(e,t){this.gui=new TB({name:"My GUI",width:300,closed:!0}),this.clock=new Jv,this.scene=new K2,this.camera=new _a(28,window.innerWidth/window.innerHeight,1e-5,1e6);const r=this.scene.position.clone();this.camera.lookAt(r);let c=this.gui.addFolder("camera");if(c.add(this.camera.position,"x",-1,1),c.add(this.camera.position,"y",-1,1),c.add(this.camera.position,"z",-1,1),c.add(this.camera,"fov",0,100),c=this.gui.addFolder("lookVec3"),c.add(r,"x",-1,1).onChange(()=>this.camera.lookAt(r)),c.add(r,"y",-1,1).onChange(()=>this.camera.lookAt(r)),c.add(r,"z",-1,1).onChange(()=>this.camera.lookAt(r)),this.labelRenderer=new uH,this.labelRenderer.setSize(window.innerWidth,window.innerHeight),this.labelRenderer.domElement.style.position="absolute",this.labelRenderer.domElement.style.pointerEvents="none",this.labelRenderer.domElement.style.top="0px",this.labelRenderer.domElement.id="labelRenderer",this.containerDom.append(this.labelRenderer.domElement),this.renderType==="map"){const C=this.map.getCenter(),D=Ml.exports.MercatorCoordinate.fromLngLat(C,0),{x:R,y:Q,z}=D;this.meterUnit=D.meterInMercatorCoordinateUnits();const G=new ar().makeScale(this.meterUnit,this.meterUnit,-this.meterUnit),J=new ar().multiplyMatrices(new ar().makeRotationX(.5*Math.PI),new ar().makeRotationY(Math.PI));this.cameraTransform=new ar().multiplyMatrices(G,J).setPosition(R,Q,z),this.renderer=new fv({canvas:e.getCanvas(),context:t,antialias:!0,alpha:!0})}else this.camera.position.set(0,10,15),this.renderer=new fv({alpha:!0,antialias:!0}),this.containerDom.appendChild(this.renderer.domElement),this.controls=new cH(this.camera,this.renderer.domElement),this.controls.addEventListener("change",()=>{});this.renderer.setClearColor(16711680,0),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.toneMapping=U2,this.renderer.outputEncoding=Ts,this.renderer.autoClear=!1,this.scene.add(this.objGroup);const{bloomComposer:p,finalComposer:y,composerOther:i}=nH(this);this.effectComposer={bloomComposer:p,finalComposer:y,composerOther:i},this.initThreeHelper(),this.initEvent()}renderThreeCtx(e){var r,c,p;this.renderType==="map"?(this.camera.projectionMatrix=new ar().fromArray(e),this.map.triggerRepaint()):(requestAnimationFrame(this.renderThreeCtx.bind(this)),this.controls.update()),(c=(r=this.renderer)==null?void 0:r.state)==null||c.reset(),this.uniforms.iTime.value+=.05,this.labelRenderer.render(this.scene,this.camera);const t={};if(this.effectComposer.bloomComposer){const y=new za({color:"black"});this.scene.traverse(aH(this.bloomRenderLayer,t,y)),this.effectComposer.bloomComposer.render(),this.scene.traverse(lH(t)),this.effectComposer.finalComposer.render()}else this.renderer.render(this.scene,this.camera);k_.update(),this.freshZoomScale(),(p=this.scene.getObjectByName("CityMarker_Group"))==null||p.traverse(y=>{if(y.isMesh){y.rotateZ(.05),y.scale.set(this.zoomScale,this.zoomScale,this.zoomScale);let i=!1;if(y.name.indexOf("marker_ground")>-1){let C=this.zoomScale;C<-1&&(C*=2);let D=1.8;C=C>D?D:C,y.s<=C/5?i=!1:y.s>=C*2&&(i=!0),i?y.s=C/10:y.s+=.008*C,y.scale.set(y.s*y.scale.x,y.s*y.scale.y,y.s*y.scale.z),y.material.opacity=(C*D-y.s)/C}}}),this.uniforms_of_geojson.iTime.value+=.05}initEvent(){addEventListener("click",()=>{document.querySelectorAll("#map3dTag.mapboxgl-marker").forEach(c=>{c.remove()});const t=this.choose(event);let r="";if(Array.isArray(t)&&t.length>0){r=t[0].object.name,t[0].object;const c=r.split("_of_")[1];this.markerList.find(p=>p.name===c)}})}choose(e){var Q,z,G;let t=e.clientX,r=e.clientY;const c=((Q=this.map)==null?void 0:Q.getCanvas())||this.containerDom,p=(z=c==null?void 0:c.getBoundingClientRect())==null?void 0:z.x,y=(G=c==null?void 0:c.getBoundingClientRect())==null?void 0:G.y;t=t-(p||0),r=r-(y||0);const i=t/c.offsetWidth*2-1,C=-(r/c.offsetHeight)*2+1,D=new p2;if(this.renderType==="map"){const J=new ar().getInverse(this.camera.projectionMatrix),Y=new ft().applyMatrix4(J),ae=new ft(i,C,1).applyMatrix4(J).clone().sub(Y).normalize();D.set(Y,ae)}else D.setFromCamera(new Di(i,C),this.camera);const R=D.intersectObjects(this.canTouchMesh);if(window.console.log("intersects",R),!this.map&&Array.isArray(R)&&R[0]){const J=R[0].point;console.log("lookAt",J),this.camera.lookAt(J)}return R}initThreeHelper(){const e=new LF(10);this.helperGroup.add(e);const t=new IF(this.camera);t.name="camera_helper",this.helperGroup.add(t);const r=new mB(16777215);r.name="directionalLight";const c=new MF(r,20,16777215);c.name="directionalLight_helper";const p=new gB(16777215,.75);p.name="ambientLight",this.lightGroup.add(p);let y=this.gui.addFolder("ambientLight");y.add(p,"intensity",0,1),y.addColor(p,"color").onChange(function(J){p.color.setStyle(J)});const i=new bF;i.name="ambientLightProbe",this.helperGroup.add(i);const C=16777215,D=1048575,R=new dB(C,D,.9);R.name="hemiLight",R.position.set(.5,.5,.5),this.lightGroup.add(R),y=this.gui.addFolder("hemiLight"),y.add(R.position,"x",0,1),y.add(R.position,"y",0,1),y.add(R.position,"z",0,1),y.add(R,"intensity",0,1),y.addColor(R,"color").onChange(function(J){R.color.setStyle(J)}),y.addColor(R,"groundColor").onChange(function(J){R.color.setStyle(J)});const Q=new SF(R,.2,16777215);Q.name="hemiLight_helper",this.helperGroup.add(Q);const z=new p2,G=new FF(z.ray.direction,z.ray.origin,.5,16773360);G.name="arrHelper",this.helperGroup.add(G),this.helperGroup.visible=!0}async initThreeGeoJSON(){return new Promise(e=>{let t=new Hs;t.name="GeoJSON";let r=new ra({color:new Dn("rgb(12, 96, 168)")});const c=R=>{Jw(R).forEach((z,G)=>{z.geo.forEach(J=>{const Y=[];J.forEach((ce,Ae)=>{Y.push(new ft(ce.x,ce.y,ce.z))});const B=new br().setFromPoints(Y);if(new mv(B,r).position.setZ(this.modelTopZ),z.name==="\u5409\u6797\u7701"){const ce=[],Ae=[];J.forEach((Et,li)=>{ce.push(Et.x,Et.y,Et.z),Ae.push(255,0,0),Ae.push(255,0,0),Ae.push(255,0,0)});const we=new w2;we.setPositions(ce),we.setColors(Ae);const me=new EB;this.renderer.getSize(me);const De=new Cv({color:"rgb(11,61,240)",linewidth:.0025,vertexColors:!1,dashed:!1,alphaToCoverage:!1,transparent:!0,opacity:1,side:ga}),Je=new ES(we,De);Je.position.setZ(this.modelTopZ),Je.name="FATLINE_JL_BOUND",Je.material.depthTest=!0,Je.material.depthWrite=!1,Je.renderOrder=20,Je.layers.enable(this.bloomRenderLayer.currentLayerNum);const Fe=Je.clone();Fe.material=Je.material.clone(),Fe.material.linewidth=.0015,Fe.material.opacity=.2,Fe.position.setZ(this.modelTopZ-1e-6),Fe.name="FATLINE2_JL_BOUND",t.add(Je);const Ge=this.buildFence(J,z.name);t.add(Ge)}})})},p=R=>{r=new ra({color:"rgb(11, 93, 162)"});const Q=Jw(R),z=new Hs;z.name="boundaryGroup",z.position.setZ(this.modelTopZ+1e-6),Q.forEach((G,J)=>{G.geo.forEach((Y,B)=>{const ae=[];Y.forEach((we,me)=>{ae.push(new ft(we.x,we.y,we.z))});const ce=new br().setFromPoints(ae);r=new ra({color:new Dn("rgb(11, 93, 162)"),transparent:!0,opacity:.6});const Ae=new mv(ce,r);Ae.name=`jl_bount_road@${J}-${B}`,z.add(Ae)})}),t.add(z)},y=R=>{Jw(R).forEach((z,G)=>{z.geo.forEach(J=>{const Y=[];if(J.forEach((B,ae)=>{Y.push(new ft(B.x,B.y,B.z))}),z.name==="\u94C1\u5CAD\u5E02"){const B=this.buildFence(J,z.name);t.add(B)}})})};let i=fetch("static/threeMap/JL_BOUND.json"),C=fetch("static/threeMap/JL.json"),D=fetch("static/threeMap/TL_BOUND.json");Promise.all([i,C,D]).then(R=>Promise.all(R.map(Q=>Q.json()))).then(R=>{c({features:[R[0]]}),p(R[1]),y({features:[R[2]]}),this.addMeshHelper(t),this.usefulObjGroup.add(t),e(!0)})})}initThreeCityMarkers(){const e=new Im,t=p=>{const y=Ml.exports.MercatorCoordinate.fromLngLat({lng:p.position[0],lat:p.position[1]}),i=e.load("./static/threeMap/\u7AEF\u70B9\u6807\u6CE8.png"),C=new za({color:65535,map:i,transparent:!0,side:ga,depthWrite:!1}),D=new xf(.002,.002),R=new us(D,C);return R.position.copy(y),R.s=this.zoomScale*Math.random(),R.name=`marker_ground_of_${p.name}`,R.position.z=this.modelTopZ+1e-4,R},r=p=>{const y=Ml.exports.MercatorCoordinate.fromLngLat({lng:p.position[0],lat:p.position[1]}),i=new gf(3/this.computeRatio,6/this.computeRatio,4);i.rotateX(-Math.PI/2);const C=new gv({color:4283863220}),D=new us(i,C),R=new gf(2/this.computeRatio,5/this.computeRatio,4);R.rotateX(-Math.PI/2);const Q=new gv({color:4292870143}),z=new us(R,Q),G=new Hs;return D.name=`marker_head_outer_of_${p.name}`,z.name=`marker_head_inner_of_${p.name}`,G.add(D),G.add(z),G.position.copy(y),G.position.z=this.modelHigherZ+1e-4,G.name=`marker_head_of_${p.name}`,G.name=`marker_head_of_${p.name}`,G},c=this.cityMarkerGroup;c.name="CityMarker_Group",this.markerList.forEach(async p=>{if(!p.noIdent)try{const y=new Hs,i=t(p);i.name=`marker_ground_of_${p.name}`;const C=r(p);y.add(i),y.add(C),y.name=`markerPoint_of_${p.name}`,c.add(y),this.cityMarkerGroup.add(y),this.addMeshHelper(y)}catch{}})}initThreeUserSprites(){this.scene;const e=new Hs;e.name="userSpriteGroup";const t=this.markerList[0],r=new py({color:Math.random()*16777215}),c=new $2(r),p=Ml.exports.MercatorCoordinate.fromLngLat({lng:t.position[0],lat:t.position[1]});c.name="sprite_test",p.z=1.0013,c.position.copy(p),c.scale.set(.001,.001,.001),c.position.z=.003+this.depth/1e8,this.addMeshHelper(c),e.add(c)}initThreeFlyLineLayer(){const e=this.flyLineGroup,t=(r,c)=>{const p=kF(r.position,c.position),y=qV(r.position,c.position),i=Ml.exports.MercatorCoordinate.fromLngLat({lng:r.position[0],lat:r.position[1]}),C=Ml.exports.MercatorCoordinate.fromLngLat({lng:y[0],lat:y[1]}),D=Ml.exports.MercatorCoordinate.fromLngLat({lng:c.position[0],lat:c.position[1]}),R=[new ft(i.x,i.y,i.z),new ft(C.x,C.y,p/2e5),new ft(D.x,D.y,D.z)];try{const Q=new Hs;Q.name=`FlyLine_Group_${r.name}_to_${c.name}`;for(let z=1;z<=1;z++){let G=Math.trunc(p/1e3)+100;const J=new XV({vecs:R,num:G,size:5,color:{r:133/255,g:187/255,b:237/255},speed:Math.random()*z*1500+p/20});J.start(),Q.add(J.particleSystem)}e.add(Q)}catch{}};Array.isArray(this.LineData)&&this.LineData.length>=1&&this.LineData.forEach(r=>{let c=r.toName;c=this.markerList.find(y=>y.name===c);let p=r.fromName;p=this.markerList.find(y=>y.name===p),p&&c&&t(p,c)})}initThreeTubeLayer(e,t,r,c=64,p=6e-5,y=64,i=!1){const{visible:C,type:D}=r||{};if(D==="Dotted-Line"){const R=[];t.forEach(we=>{const me=Ml.exports.MercatorCoordinate.fromLngLat({lng:we[0],lat:we[1]});R.push(new ft(me.x,me.y,me.z))});const Q=[],z=[],G=new $_(R),J=Math.round(12*R.length),Y=new ft,B=new Dn;for(let we=0,me=J;we<me;we++){const De=we/me;G.getPoint(De,Y),Q.push(Y.x,Y.y,Y.z),B.setRGB(0,0,0),z.push(B.r,B.g,B.b)}const ae=new w2().setPositions(Q);ae.setColors(z);const ce=new Cv({color:4278320893,linewidth:.005,gapSize:2e-4,dashSize:3e-4,vertexColors:!1,dashed:!0,alphaToCoverage:!1,transparent:!0,side:ga}),Ae=new ES(ae,ce);Ae.name=e,Ae.computeLineDistances(),this.flyLineGroup.add(Ae),C===!1&&(Ae.visible=!1)}else{const R=[];t.forEach(J=>{const Y=Ml.exports.MercatorCoordinate.fromLngLat({lng:J[0],lat:J[1]});R.push(new ft(Y.x,Y.y,Y.z))});const Q=new ig(new $_(R,!1),c,p,y,i),z=new za({color:4278320893,opacity:1,transparent:!0}),G=new us(Q,z);G.name=e,this.addMeshHelper(G),this.tubeGroup.add(G),C===!1&&(G.visible=!1)}}initThreeReflector(){const e=new DF(.052,.052,200,200),t=new aB({color:"rgba(7,46,130,1)",transparent:!0,opacity:1,shininess:11114,side:ga,depthTest:!0}),r=new us(e,t);r.name="floorMesh",r.position.set(.8448865555555555,.369164230229972,this.modelBottomZ),r.renderOrder=1,this.addMeshHelper(r),this.objGroup.add(r)}addMeshHelper(e){const t=[];if(e instanceof us||e instanceof Ku){const r=new g2(e,16711680);r.name=`${e.name}_helper`,t.push(r)}else e instanceof Hs&&e.traverse(r=>{const c=new g2(r,16711680);c.name=`${e.name}_helper`,t.push(c)});return t}getMeshByName(e){return this.scene.getObjectByName(e)}disposeGroup(e){e.traverse(t=>{(t.type=="Mesh"||t.type=="Line")&&(t.geometry.dispose(),t.material.dispose())}),e.children.length&&(e.children=[])}Destory(){this.map.remove()}actionResize(){this.map&&this.map.resize&&this.map.resize()}buildFence(e,t){new za({side:uu,transparent:!0,opacity:.1});const r=new ko({uniforms:tf.GetInstance().uniforms_of_geojson,transparent:!0,side:uu,vertexShader:bV,fragmentShader:BV}),c=new br,p=[],y={r:33/255,g:168/255,b:255/255},i={r:8/255,g:61/255,b:102/255},C=[],D=new tp;D.moveTo(e[0].x,e[0].y),e.forEach((ae,ce)=>{const Ae=ce+1>=e.length?e[0]:e[ce+1];p.push(ae.x,ae.y,this.modelBottomZ,Ae.x,Ae.y,this.modelBottomZ,Ae.x,Ae.y,this.modelTopZ),C.push(y.r,y.g,y.b,y.r,y.g,y.b,i.r,i.g,i.b),p.push(ae.x,ae.y,this.modelBottomZ,Ae.x,Ae.y,this.modelTopZ,ae.x,ae.y,this.modelTopZ),C.push(y.r,y.g,y.b,i.r,i.g,i.b,i.r,i.g,i.b),D.lineTo(ae.x,ae.y)}),c.attributes.position=new As(new Float32Array(p),3),c.attributes.color=new As(new Float32Array(C),3);let R=new us(c,r);R.name=`active_area_${t}`;const Q=new tg(D),z=new za({color:"#0b56ad",side:ga,opacity:.63,transparent:!0}),G=new us(Q,z);G.name=`faceMesh_${t}`,G.position.z=this.modelTopZ;const J=G.clone();if(J.name=`faceMeshMiddle_${t}`,J.position.z=this.modelMiddleZ,J.material=new za({color:"rgb(0, 0, 0)",side:ga,opacity:.755,transparent:!0}),J.layers.enable(this.bloomRenderLayer.currentLayerNum),t==="\u5409\u6797\u7701"){let ae=this.gui.addFolder("faceMesh");ae.addColor(G.material,"color").onChange(ce=>{G.material.color.setStyle(ce),this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").material.color=ce.clone()}),ae.add(G.material,"opacity",0,1).onChange(ce=>{this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").material.opacity=ce}),ae.add(G.position,"z",0,6e-4).onChange(ce=>{this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").position.z=ce}),ae=this.gui.addFolder("faceMeshMiddle"),ae.addColor(J.material,"color").onChange(ce=>{J.material.color.setStyle(ce),this.scene.getObjectByName("faceMeshMiddle_\u94C1\u5CAD\u5E02").material.color=ce.clone()}),ae.add(J.material,"opacity",0,1).onChange(ce=>{this.scene.getObjectByName("faceMeshMiddle_\u94C1\u5CAD\u5E02").material.opacity=ce}),ae.add(J.position,"z",0,6e-4).onChange(ce=>{this.scene.getObjectByName("faceMesh_\u94C1\u5CAD\u5E02").position.z=ce})}const Y=G.clone();Y.material=G.material.clone(),Y.material=new za({transparent:!0,opacity:.6,color:new Dn(1,1,1),side:ga}),Y.name=`faceMeshBottom_${t}`,Y.position.z=this.modelBottomZ;const B=new Hs;return B.name=`City_Fence_Group_${t}`,B.add(G),B.add(J),B.add(Y),B.add(R),B}flipMatrix(){const e=new ar,t=new ft(0,0,1);return e.set(1-2*t.x*t.x,-2*t.x*t.y,-2*t.x*t.z,0,-2*t.x*t.y,1-2*t.y*t.y,-2*t.y*t.z,0,-2*t.x*t.z,-2*t.y*t.z,1-2*t.z*t.z,0,0,0,0,1),e}renderSiteTag(e){e=Array.isArray(e)?e:[];const t=(e==null?void 0:e.map(r=>r.title))||["\u94C1\u5CAD\u897F","\u56DB\u5E73\u4E1C","\u516C\u4E3B\u5CAD\u5357","\u957F\u6625\u897F","\u5409\u6797","\u6566\u5316","\u5EF6\u5409\u897F"];console.log("rgbSites",t),this.markerList.forEach(r=>{var R,Q,z,G,J,Y,B,ae,ce,Ae,we,me,De,Je;const c=(e.find(Fe=>Fe.title===r.name)||{}).data,p=!!(t.indexOf(r.name)>-1||r.showRGB);let y=`
  5580. <div class="site-tag-tpl" renderType="${r.className}" id="siteTag_${r.name}">
  5581. <div class="siteDataWrap" style="display: ${p?"flex":"none"}">
  5582. <div class="left o">
  5583. <div class="ct t">${((R=c==null?void 0:c.\u53D8\u7535)==null?void 0:R[0])||0}</div>
  5584. <div class="ct c">${((Q=c==null?void 0:c.\u53D8\u7535)==null?void 0:Q[1])||0}</div>
  5585. <div class="ct b">${((z=c==null?void 0:c.\u53D8\u7535)==null?void 0:z[2])||0}</div>
  5586. </div>
  5587. <div class="mid o">
  5588. <img src="/gis/static/threeMap/three color@2x.png"/>
  5589. </div>
  5590. <div class="right o">
  5591. <div class="ct t">${((G=c==null?void 0:c.\u7535\u529B)==null?void 0:G[0])||0}</div>
  5592. <div class="ct c">${((J=c==null?void 0:c.\u7535\u529B)==null?void 0:J[1])||0}</div>
  5593. <div class="ct b">${((Y=c==null?void 0:c.\u7535\u529B)==null?void 0:Y[2])||0}</div>
  5594. </div>
  5595. </div>
  5596. <div class="siteLabel" style="font-size: ${(B=r.style)!=null&&B.fontSize?((ae=r.style)==null?void 0:ae.fontSize)+"px":"unset"}">${r.name}</div>
  5597. </div>
  5598. `;const i=document.createElement("div");i.classList.add("map3dTag"),i.innerHTML=y;const C=Ml.exports.MercatorCoordinate.fromLngLat(r.position,8e4),D=new hH(i);D.name="markerLabel_"+r.name,D.position.copy(C),D.translateX((((Ae=(ce=r==null?void 0:r.style)==null?void 0:ce.offset)==null?void 0:Ae[0])||0)+-2e-4),D.translateY(((me=(we=r==null?void 0:r.style)==null?void 0:we.offset)==null?void 0:me[1])||0),D.translateZ(((Je=(De=r==null?void 0:r.style)==null?void 0:De.offset)==null?void 0:Je[2])||0),this.labelGroup.add(D)})}initDebugger(){const e=new Im().load("/gis/static/threeMap/textures/carbon/Carbon.png");e.encoding=Ts,e.wrapS=HA,e.wrapT=HA,e.repeat.x=.001,e.repeat.y=.001;const t=new Im().load("/gis/static/threeMap/textures/carbon/Carbon_Normal.png");t.wrapS=HA,t.wrapT=HA;const r=new Vu(5,64,32),c={color:new Dn("rgb(255,0,0)").getHex(),roughness:.5,clearcoat:1,clearcoatRoughness:.1},p=new oB({...c}),y=this.gui.addFolder("THREE.MeshPhysicalMaterial");y.add(p,"roughness",0,1),y.add(p,"metalness",0,1),y.add(p,"reflectivity",0,1),y.add(p,"clearcoat",0,1).step(.01),y.add(p,"clearcoatRoughness",0,1).step(.01),y.add(p,"flatShading").onChange(ob(p,r)),y.add(p,"wireframe"),y.add(p,"vertexColors").onChange(ob(p,r)),y.add(p,"fog").onChange(ob(p,r));const i=new us(r,p);i.position.x=100,i.position.y=100,i.position.set(.852,.367,.006),i.name="debugger";const C=new us(new Vu(2e-4,8,8),new za({color:16777215}));C.position.set(.852,.367,.0186),this.scene.add(C),C.add(new fB(16777215,1));const D=new qA(3,3,3,1,1,1),R=new us(D,p);this.scene.add(R),this.canTouchMesh.push(R);const Q=new Vu(100,50,50);console.log(r);const z=new Im().load("https://storage.googleapis.com/umas_public_assets/michaelBay/free_star_sky_hdri_spherical_map_by_kirriaa_dbw8p0w%20(1).jpg"),G=new J_({map:z,side:ga}),J=new us(Q,G);J.name="outer_sphere",this.scene.add(J),this.canTouchMesh.push(R);const Y=new Vu(5,50,50),B=new Im().load("https://storage.googleapis.com/umas_public_assets/michaelBay/1280px-Solarsystemscope_texture_8k_earth_daymap.jpeg"),ae=new J_({map:B,side:ga}),ce=new us(Y,ae);ce.name="earth",this.scene.add(ce)}};let Jx=tf;Qi(Jx,"_instance");const km=class{constructor(){Qi(this,"_MinMap");Qi(this,"_SysMap");Qi(this,"_Palette");Qi(this,"_CacheTransfer");Qi(this,"_Image");Qi(this,"_Localforage");Qi(this,"_HashTools");Qi(this,"_Earth");Qi(this,"_ThreeMap");Qi(this,"_DxfRender")}static getInstance(){return km._instance==null&&(km._instance=new km),km._instance}BindTools(){return this._ThreeMap=Jx,this}};let D_=km;Qi(D_,"_instance");const Fc=class{constructor(){Qi(this,"_trajectoryUnit",new q1);Qi(this,"Fn",new Nm);Qi(this,"CbFn",new T_);Qi(this,"Tools",new D_);Qi(this,"hasRender",!1)}static getInstance(){return Fc._instance==null&&(Fc._instance=new Fc,Fc._instance.Fn=Nm.getInstance()),Fc._instance}async bindFn(e=[],t){var c;(c=t==null?void 0:t.a)==null||c.b("a");let r;return r=await this.waitFns(e),t=t===void 0?{}:t,this.Fn=Nm.getInstance().BindFn(r),this.CbFn=T_.getInstance().BindCbFn(t),this.Tools=D_.getInstance().BindTools(),this}async waitFns(e){return new Promise((t,r)=>{let c={},p=function(){let y=!1;for(let i of e)if(i)c=Object.assign(c,i);else{y=!1;break}y||e.length===0?(window.Fns=c,t(c)):setTimeout(()=>{p()},500)};p()})}load(e){return Fc._instance.Fn.baseOption=Object.assign({container:e}),Fc._instance.Fn.domId=e,this.preRender(e)?Fc._instance:{msg:"dom \u4E0D\u5B58\u5728"}}preRender(e){return!!document.getElementById(e)}bootstrap(){return Fc._instance.Fn===null&&Fc._instance.CbFn===null?null:(this._trajectoryUnit=new q1,this._trajectoryUnit)}destory(){Fc._instance={},this._trajectoryUnit=null}};let Jp=Fc;Qi(Jp,"_instance"),Qi(Jp,"Operation",{}),Qi(Jp,"Unit",{BaseUnit:H3,TrajectoryUnit:q1});window.LibPresets=Jp;setInterval(()=>{},2e3)});export default CH();